oleaut32: VarParseNumFromStr: trailing zeros
Walt Ogburn
reuben at ugcs.caltech.edu
Tue Oct 19 01:35:14 CDT 2004
There is some strange code in VarParseNumFromStr that strips the "trailing
zeros" from the whole number part of a decimal number. For example,
"10.1" gets parsed to "11". Simply remove this code, and add "10.1" as an
example in vartest.c. This doesn't break any of the other tests.
- Walter
Changelog
Keep "trailing" zeros on whole number part of a decimal
Add an example of this to tests
Index: dlls/oleaut32/variant.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/variant.c,v
retrieving revision 1.103
diff -u -r1.103 variant.c
--- dlls/oleaut32/variant.c 11 Oct 2004 20:53:29 -0000 1.103
+++ dlls/oleaut32/variant.c 19 Oct 2004 06:16:18 -0000
@@ -1735,13 +1735,6 @@
pNumprs->dwOutFlags |= NUMPRS_DECIMAL;
cchUsed++;
- /* Remove trailing zeros from the whole number part */
- while (pNumprs->cDig > 1 && !rgbTmp[pNumprs->cDig - 1])
- {
- pNumprs->nPwr10++;
- pNumprs->cDig--;
- }
-
/* If we have no digits so far, skip leading zeros */
if (!pNumprs->cDig)
{
Index: dlls/oleaut32/tests/vartest.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/tests/vartest.c,v
retrieving revision 1.31
diff -u -r1.31 vartest.c
--- dlls/oleaut32/tests/vartest.c 18 Oct 2004 22:35:18 -0000
1.31
+++ dlls/oleaut32/tests/vartest.c 19 Oct 2004 06:16:18 -0000
@@ -1048,6 +1048,12 @@
CONVERT("-0.51", NUMPRS_STD);
EXPECT(2,NUMPRS_STD,NUMPRS_NEG|NUMPRS_DECIMAL|NUMPRS_LEADING_MINUS,5,0,-2);
EXPECT2(5,1);
+
+ /* Keep trailing zeros on whole number part of a decimal */
+ CONVERT("40.1", NUMPRS_STD);
+ EXPECT(3,NUMPRS_STD,NUMPRS_DECIMAL,4,0,-1);
+ EXPECT2(4,0);
+ EXPECTRGB(2,1);
}
static HRESULT (WINAPI *pVarNumFromParseNum)(NUMPARSE*,BYTE*,ULONG,VARIANT*);
More information about the wine-patches
mailing list