Jacek Caban : jscript: Use helpers to access string buffer in object.c.

Alexandre Julliard julliard at winehq.org
Wed Mar 27 15:40:05 CDT 2013


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Mar 27 11:04:09 2013 +0100

jscript: Use helpers to access string buffer in object.c.

---

 dlls/jscript/object.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c
index 6f597d6..4ad764b 100644
--- a/dlls/jscript/object.c
+++ b/dlls/jscript/object.c
@@ -130,9 +130,14 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
         return hres;
 
     if(is_jsdisp(jsthis)) {
+        const WCHAR *name_str;
         BOOL result;
 
-        hres = jsdisp_is_own_prop(jsthis->u.jsdisp, name->str, &result);
+        name_str = jsstr_flatten(name);
+        if(name_str)
+            hres = jsdisp_is_own_prop(jsthis->u.jsdisp, name_str, &result);
+        else
+            hres = E_OUTOFMEMORY;
         jsstr_release(name);
         if(FAILED(hres))
             return hres;
@@ -164,7 +169,8 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
 static HRESULT Object_propertyIsEnumerable(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
         jsval_t *r)
 {
-    jsstr_t *name;
+    const WCHAR *name;
+    jsstr_t *name_str;
     BOOL ret;
     HRESULT hres;
 
@@ -180,12 +186,12 @@ static HRESULT Object_propertyIsEnumerable(script_ctx_t *ctx, vdisp_t *jsthis, W
         return E_FAIL;
     }
 
-    hres = to_string(ctx, argv[0], &name);
+    hres = to_flat_string(ctx, argv[0], &name_str, &name);
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_is_enumerable(jsthis->u.jsdisp, name->str, &ret);
-    jsstr_release(name);
+    hres = jsdisp_is_enumerable(jsthis->u.jsdisp, name, &ret);
+    jsstr_release(name_str);
     if(FAILED(hres))
         return hres;
 




More information about the wine-cvs mailing list