Damjan Jovanovic : oleaut32: fix a rounding bug in VarFormat.

Alexandre Julliard julliard at winehq.org
Wed May 13 10:19:41 CDT 2009


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

Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date:   Tue May 12 18:41:41 2009 +0200

oleaut32: fix a rounding bug in VarFormat.

---

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

diff --git a/dlls/oleaut32/tests/varformat.c b/dlls/oleaut32/tests/varformat.c
index b19efbd..c2d45ae 100644
--- a/dlls/oleaut32/tests/varformat.c
+++ b/dlls/oleaut32/tests/varformat.c
@@ -379,6 +379,7 @@ static void test_VarFormat(void)
   VARFMT(VT_R8,V_R8,-1.57,"0.00",S_OK,"-1.57");
   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");
 
 
   /* 'out' is not cleared */
diff --git a/dlls/oleaut32/varformat.c b/dlls/oleaut32/varformat.c
index 06bab0f..fd257f0 100644
--- a/dlls/oleaut32/varformat.c
+++ b/dlls/oleaut32/varformat.c
@@ -1305,7 +1305,10 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
           else
           {
             rgbDig[have_int + need_frac] = 0;
-            have_int++;
+            if (exponent < 0)
+              exponent++;
+            else
+              have_int++;
           }
         }
         else




More information about the wine-cvs mailing list