Jacek Caban : jscript: Added VT_R8 to string conversion implementation.

Alexandre Julliard julliard at winehq.org
Thu Sep 25 07:13:24 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Sep 25 00:50:49 2008 +0200

jscript: Added VT_R8 to string conversion implementation.

---

 dlls/jscript/jsutils.c     |   12 ++++++++++++
 dlls/jscript/tests/lang.js |    2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c
index cd7fa57..422076e 100644
--- a/dlls/jscript/jsutils.c
+++ b/dlls/jscript/jsutils.c
@@ -441,6 +441,18 @@ HRESULT to_string(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, BSTR *str)
     case VT_I4:
         *str = int_to_bstr(V_I4(v));
         break;
+    case VT_R8: {
+        VARIANT strv;
+        HRESULT hres;
+
+        V_VT(&strv) = VT_EMPTY;
+        hres = VariantChangeType(&strv, v, 0, VT_BSTR);
+        if(FAILED(hres))
+            return hres;
+
+        *str = V_BSTR(&strv);
+        return S_OK;
+    }
     case VT_BSTR:
         *str = SysAllocString(V_BSTR(v));
         break;
diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js
index dbe714d..63c8bc0 100644
--- a/dlls/jscript/tests/lang.js
+++ b/dlls/jscript/tests/lang.js
@@ -366,6 +366,8 @@ ok("" + null === "null", "\"\" + null !== \"null\"");
 ok("" + undefined === "undefined", "\"\" + undefined !== \"undefined\"");
 ok("" + true === "true", "\"\" + true !== \"true\"");
 ok("" + false === "false", "\"\" + false !== \"false\"");
+ok("" + 0.5 === "0.5", "'' + 0.5 = " + 0.5);
+ok("" + (-0.5432) === "-0.5432", "'' + (-0.5432) = " + (-0.5432));
 
 ok(1 < 3.4, "1 < 3.4 failed");
 ok(!(3.4 < 1), "3.4 < 1");




More information about the wine-cvs mailing list