Jacek Caban : jscript: Use num_set_int in array.c.

Alexandre Julliard julliard at winehq.org
Wed Jun 20 13:49:43 CDT 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Jun 20 11:18:42 2012 +0200

jscript: Use num_set_int in array.c.

---

 dlls/jscript/array.c |   27 +++++++++------------------
 1 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c
index 5ff6344..91a7b82 100644
--- a/dlls/jscript/array.c
+++ b/dlls/jscript/array.c
@@ -97,8 +97,7 @@ static HRESULT set_length(jsdisp_t *obj, jsexcept_t *ei, DWORD length)
         return S_OK;
     }
 
-    V_VT(&var) = VT_I4;
-    V_I4(&var) = length;
+    num_set_int(&var, length);
     return jsdisp_propput_name(obj, lengthW, &var, ei);
 }
 
@@ -126,8 +125,7 @@ static HRESULT Array_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
 
     switch(flags) {
     case DISPATCH_PROPERTYGET:
-        V_VT(retv) = VT_I4;
-        V_I4(retv) = This->length;
+        num_set_int(retv, This->length);
         break;
     case DISPATCH_PROPERTYPUT: {
         DOUBLE len = -1;
@@ -448,10 +446,8 @@ static HRESULT Array_push(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPAR
     if(FAILED(hres))
         return hres;
 
-    if(retv) {
-        V_VT(retv) = VT_I4;
-        V_I4(retv) = length+n;
-    }
+    if(retv)
+        num_set_int(retv, length+n);
     return S_OK;
 }
 
@@ -909,9 +905,7 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPP
         }
 
         if(SUCCEEDED(hres)) {
-            V_VT(&v) = VT_I4;
-            V_I4(&v) = delete_cnt;
-
+            num_set_int(&v, delete_cnt);
             hres = jsdisp_propput_name(ret_array, lengthW, &v, ei);
         }
     }
@@ -941,8 +935,7 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPP
         hres = jsdisp_propput_idx(jsthis, start+i, get_arg(dp,i+2), ei);
 
     if(SUCCEEDED(hres)) {
-        V_VT(&v) = VT_I4;
-        V_I4(&v) = length-delete_cnt+add_args;
+        num_set_int(&v, length-delete_cnt+add_args);
         hres = jsdisp_propput_name(jsthis, lengthW, &v, ei);
     }
 
@@ -1036,12 +1029,10 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISP
     }
 
     if(retv) {
-        if(ctx->version < 2) {
+        if(ctx->version < 2)
             V_VT(retv) = VT_EMPTY;
-        }else {
-            V_VT(retv) = VT_I4;
-            V_I4(retv) = length;
-        }
+        else
+            num_set_int(retv, length);
     }
     return S_OK;
 }




More information about the wine-cvs mailing list