Jacek Caban : jscript: Always use jsval-based to_uint32 implementation.
Alexandre Julliard
julliard at winehq.org
Mon Sep 17 14:06:35 CDT 2012
Module: wine
Branch: master
Commit: 2fc71ab6d52178ff173514415af427fc4548dbb6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2fc71ab6d52178ff173514415af427fc4548dbb6
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Sep 17 15:18:41 2012 +0200
jscript: Always use jsval-based to_uint32 implementation.
---
dlls/jscript/array.c | 2 +-
dlls/jscript/engine.c | 2 +-
dlls/jscript/function.c | 2 +-
dlls/jscript/jscript.h | 3 +--
dlls/jscript/jsutils.c | 28 +---------------------------
dlls/jscript/string.c | 2 +-
6 files changed, 6 insertions(+), 33 deletions(-)
diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c
index 4eeca39..653bd9b 100644
--- a/dlls/jscript/array.c
+++ b/dlls/jscript/array.c
@@ -79,7 +79,7 @@ static HRESULT get_length(script_ctx_t *ctx, vdisp_t *vdisp, jsexcept_t *ei, jsd
if(FAILED(hres))
return hres;
- hres = to_uint32_jsval(ctx, val, ei, ret);
+ hres = to_uint32(ctx, val, ei, ret);
jsval_release(val);
if(FAILED(hres))
return hres;
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index da0aba6..61869cc 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -160,7 +160,7 @@ static inline HRESULT stack_pop_int(exec_ctx_t *ctx, INT *r)
static inline HRESULT stack_pop_uint(exec_ctx_t *ctx, DWORD *r)
{
- return to_uint32_jsval(ctx->script, stack_pop(ctx), ctx->ei, r);
+ return to_uint32(ctx->script, stack_pop(ctx), ctx->ei, r);
}
static inline IDispatch *stack_pop_objid(exec_ctx_t *ctx, DISPID *id)
diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c
index b3a616d..e45ba7a 100644
--- a/dlls/jscript/function.c
+++ b/dlls/jscript/function.c
@@ -347,7 +347,7 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, jsexcept_t
if(FAILED(hres))
return hres;
- hres = to_uint32_jsval(ctx, val, ei, &length);
+ hres = to_uint32(ctx, val, ei, &length);
jsval_release(val);
if(FAILED(hres))
return hres;
diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h
index 8cfc14e..c8ccb0b 100644
--- a/dlls/jscript/jscript.h
+++ b/dlls/jscript/jscript.h
@@ -259,8 +259,7 @@ HRESULT to_boolean(jsval_t,BOOL*) DECLSPEC_HIDDEN;
HRESULT to_number(script_ctx_t*,jsval_t,jsexcept_t*,double*) DECLSPEC_HIDDEN;
HRESULT to_integer(script_ctx_t*,jsval_t,jsexcept_t*,double*) DECLSPEC_HIDDEN;
HRESULT to_int32(script_ctx_t*,jsval_t,jsexcept_t*,INT*) DECLSPEC_HIDDEN;
-HRESULT to_uint32(script_ctx_t*,VARIANT*,jsexcept_t*,DWORD*) DECLSPEC_HIDDEN;
-HRESULT to_uint32_jsval(script_ctx_t*,jsval_t,jsexcept_t*,DWORD*) DECLSPEC_HIDDEN;
+HRESULT to_uint32(script_ctx_t*,jsval_t,jsexcept_t*,DWORD*) DECLSPEC_HIDDEN;
HRESULT to_string(script_ctx_t*,VARIANT*,jsexcept_t*,BSTR*) DECLSPEC_HIDDEN;
HRESULT to_string_jsval(script_ctx_t*,jsval_t,jsexcept_t*,BSTR*) DECLSPEC_HIDDEN;
HRESULT to_object(script_ctx_t*,VARIANT*,IDispatch**) DECLSPEC_HIDDEN;
diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c
index c0007fc..e14c352 100644
--- a/dlls/jscript/jsutils.c
+++ b/dlls/jscript/jsutils.c
@@ -645,23 +645,12 @@ HRESULT to_int32(script_ctx_t *ctx, jsval_t v, jsexcept_t *ei, INT *ret)
}
/* ECMA-262 3rd Edition 9.6 */
-HRESULT to_uint32(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, DWORD *ret)
+HRESULT to_uint32(script_ctx_t *ctx, jsval_t val, jsexcept_t *ei, DWORD *ret)
{
- jsval_t val;
double n;
HRESULT hres;
- if(V_VT(v) == VT_I4) {
- *ret = V_I4(v);
- return S_OK;
- }
-
- hres = variant_to_jsval(v, &val);
- if(FAILED(hres))
- return hres;
-
hres = to_number(ctx, val, ei, &n);
- jsval_release(val);
if(FAILED(hres))
return hres;
@@ -669,21 +658,6 @@ HRESULT to_uint32(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, DWORD *ret)
return S_OK;
}
-/* ECMA-262 3rd Edition 9.6 */
-HRESULT to_uint32_jsval(script_ctx_t *ctx, jsval_t v, jsexcept_t *ei, DWORD *ret)
-{
- VARIANT var;
- HRESULT hres;
-
- hres = jsval_to_variant(v, &var);
- if(FAILED(hres))
- return hres;
-
- hres = to_uint32(ctx, &var, ei, ret);
- VariantClear(&var);
- return hres;
-}
-
static BSTR int_to_bstr(int i)
{
WCHAR buf[12], *p;
diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c
index 1549ca1..76f9c41 100644
--- a/dlls/jscript/string.c
+++ b/dlls/jscript/string.c
@@ -1531,7 +1531,7 @@ static HRESULT StringConstr_fromCharCode(script_ctx_t *ctx, vdisp_t *jsthis, WOR
return E_OUTOFMEMORY;
for(i=0; i<argc; i++) {
- hres = to_uint32_jsval(ctx, argv[i], ei, &code);
+ hres = to_uint32(ctx, argv[i], ei, &code);
if(FAILED(hres)) {
SysFreeString(ret);
return hres;
More information about the wine-cvs
mailing list