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

Alexandre Julliard julliard at winehq.org
Thu May 14 11:07:43 CDT 2009


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

Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date:   Thu May 14 15:31:50 2009 +0200

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

---

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

diff --git a/dlls/oleaut32/tests/varformat.c b/dlls/oleaut32/tests/varformat.c
index c2d45ae..3c0e72e 100644
--- a/dlls/oleaut32/tests/varformat.c
+++ b/dlls/oleaut32/tests/varformat.c
@@ -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 */
diff --git a/dlls/oleaut32/varformat.c b/dlls/oleaut32/varformat.c
index fd257f0..f6c142d 100644
--- a/dlls/oleaut32/varformat.c
+++ b/dlls/oleaut32/varformat.c
@@ -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",




More information about the wine-cvs mailing list