oleaut32: Strip trailing decimal zeroes when rounding a number in VarFormat.

This commit is contained in:
Damjan Jovanovic 2009-05-14 15:31:50 +02:00 committed by Alexandre Julliard
parent d1de5f37d0
commit 80dfd00530
2 changed files with 4 additions and 0 deletions

View File

@ -380,6 +380,7 @@ static void test_VarFormat(void)
VARFMT(VT_R8,V_R8,-1.57,"#.##",S_OK,"-1.57");
VARFMT(VT_R8,V_R8,-0.1,".#",S_OK,"-.1");
VARFMT(VT_R8,V_R8,0.099,"#.#",S_OK,".1");
VARFMT(VT_R8,V_R8,0.0999,"#.##",S_OK,".1");
/* 'out' is not cleared */

View File

@ -1313,6 +1313,9 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
}
else
(*prgbDig)++;
/* We converted trailing digits to zeroes => have_frac has changed */
while (have_frac > 0 && rgbDig[have_int + have_frac - 1] == 0)
have_frac--;
}
}
TRACE("have_int=%d,need_int=%d,have_frac=%d,need_frac=%d,pad=%d,exp=%d\n",