Piotr Caban : jscript: Fix toExponential behavior when exponent is 0.

Alexandre Julliard julliard at winehq.org
Wed Apr 25 13:40:26 CDT 2012


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Apr 25 12:10:18 2012 +0200

jscript: Fix toExponential behavior when exponent is 0.

---

 dlls/jscript/number.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/jscript/number.c b/dlls/jscript/number.c
index d296b79..8f6eeab 100644
--- a/dlls/jscript/number.c
+++ b/dlls/jscript/number.c
@@ -206,9 +206,12 @@ static inline void number_to_exponential(double val, int prec, BSTR *out)
         str[size++] = '-';
         dec_point = -dec_point;
     }
-    for(str[size]='0', size+=exp_size-1; dec_point>0; dec_point/=10)
-        str[size--] = '0'+dec_point%10;
-    size += exp_size+1;
+    size += exp_size;
+    do {
+        str[--size] = '0'+dec_point%10;
+        dec_point /= 10;
+    }while(dec_point>0);
+    size += exp_size;
     str[size] = 0;
 
     *out = str;




More information about the wine-cvs mailing list