André Hentschel : oleaut32: Fix fractional calculation .

Alexandre Julliard julliard at winehq.org
Mon Mar 1 09:27:34 CST 2010


Module: wine
Branch: master
Commit: a78490bf8a7f4dad58dccfe41bdb84efd1a58ed7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a78490bf8a7f4dad58dccfe41bdb84efd1a58ed7

Author: André Hentschel <nerv at dawncrow.de>
Date:   Sun Feb 28 19:21:47 2010 +0100

oleaut32: Fix fractional calculation.

---

 dlls/oleaut32/tests/varformat.c |    2 +-
 dlls/oleaut32/varformat.c       |    9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/dlls/oleaut32/tests/varformat.c b/dlls/oleaut32/tests/varformat.c
index 1c476a0..fd598cb 100644
--- a/dlls/oleaut32/tests/varformat.c
+++ b/dlls/oleaut32/tests/varformat.c
@@ -390,7 +390,7 @@ static void test_VarFormat(void)
   VARFMT(VT_R8,V_R8,8.0995,"#.##",S_OK,"8.1");
   VARFMT(VT_R8,V_R8,0.0994,"#.##",S_OK,".1");
   VARFMT(VT_R8,V_R8,1.00,"#,##0.00",S_OK,"1.00");
-  todo_wine VARFMT(VT_R8,V_R8,0.0995,"#.###",S_OK,".1");
+  VARFMT(VT_R8,V_R8,0.0995,"#.###",S_OK,".1");
 
 
   /* 'out' is not cleared */
diff --git a/dlls/oleaut32/varformat.c b/dlls/oleaut32/varformat.c
index 9db390d..52ea37a 100644
--- a/dlls/oleaut32/varformat.c
+++ b/dlls/oleaut32/varformat.c
@@ -1296,8 +1296,7 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
     /* Rounding the number */
     if (have_frac > need_frac)
     {
-      prgbDig = &rgbDig[have_int + need_frac ? need_frac + 1 : 0];
-      if (*prgbDig < 5) prgbDig--;
+      prgbDig = &rgbDig[have_int + need_frac];
       have_frac = need_frac;
       if (*prgbDig >= 5)
       {
@@ -1320,10 +1319,10 @@ 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--;
       }
+      /* 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",
           have_int, need_int, have_frac, need_frac, pad, exponent);




More information about the wine-cvs mailing list