From 72faaf1273ea093cd2a8a2b4ff330ef2711a6254 Mon Sep 17 00:00:00 2001 From: Damjan Jovanovic Date: Wed, 24 Sep 2008 18:49:19 +0200 Subject: [PATCH] oleaut32: Fix double negative sign regression in VarFormat. --- dlls/oleaut32/tests/varformat.c | 2 ++ dlls/oleaut32/varformat.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/oleaut32/tests/varformat.c b/dlls/oleaut32/tests/varformat.c index 00551e701c7..12d65b66a09 100644 --- a/dlls/oleaut32/tests/varformat.c +++ b/dlls/oleaut32/tests/varformat.c @@ -328,6 +328,8 @@ static void test_VarFormat(void) VARFMT(VT_I4,V_I4,1,"0,000,000,000",S_OK,"0,000,000,001"); VARFMT(VT_I4,V_I4,123456789,"#,#.#",S_OK,"123,456,789."); VARFMT(VT_I4,V_I4,123456789,"###, ###, ###",S_OK,"123, 456, 789"); + VARFMT(VT_I4,V_I4,1,"#;-#",S_OK,"1"); + VARFMT(VT_I4,V_I4,-1,"#;-#",S_OK,"-1"); VARFMT(VT_R8,V_R8,1.23456789,"0#.0#0#0#0#0",S_OK,"01.234567890"); VARFMT(VT_R8,V_R8,1.2,"0#.0#0#0#0#0",S_OK,"01.200000000"); VARFMT(VT_R8,V_R8,9.87654321,"#0.#0#0#0#0#",S_OK,"9.87654321"); diff --git a/dlls/oleaut32/varformat.c b/dlls/oleaut32/varformat.c index 217fb10c374..79c305314bc 100644 --- a/dlls/oleaut32/varformat.c +++ b/dlls/oleaut32/varformat.c @@ -1391,7 +1391,7 @@ VARIANT_FormatNumber_Bool: break; case FMT_NUM_DECIMAL: - if ((np.dwOutFlags & NUMPRS_NEG) && !(dwState & NUM_WROTE_SIGN)) + if ((np.dwOutFlags & NUMPRS_NEG) && !(dwState & NUM_WROTE_SIGN) && !header->starts[1]) { /* last chance for a negative sign in the .# case */ TRACE("write negative sign\n"); @@ -1476,7 +1476,7 @@ VARIANT_FormatNumber_Bool: { int count, count_max, position; - if ((np.dwOutFlags & NUMPRS_NEG) && !(dwState & NUM_WROTE_SIGN)) + if ((np.dwOutFlags & NUMPRS_NEG) && !(dwState & NUM_WROTE_SIGN) && !header->starts[1]) { TRACE("write negative sign\n"); localeValue = LOCALE_SNEGATIVESIGN;