Commit 2fc71ab6 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Always use jsval-based to_uint32 implementation.

parent 0bab034f
...@@ -79,7 +79,7 @@ static HRESULT get_length(script_ctx_t *ctx, vdisp_t *vdisp, jsexcept_t *ei, jsd ...@@ -79,7 +79,7 @@ static HRESULT get_length(script_ctx_t *ctx, vdisp_t *vdisp, jsexcept_t *ei, jsd
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = to_uint32_jsval(ctx, val, ei, ret); hres = to_uint32(ctx, val, ei, ret);
jsval_release(val); jsval_release(val);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
......
...@@ -160,7 +160,7 @@ static inline HRESULT stack_pop_int(exec_ctx_t *ctx, INT *r) ...@@ -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) 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) static inline IDispatch *stack_pop_objid(exec_ctx_t *ctx, DISPID *id)
......
...@@ -347,7 +347,7 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, jsexcept_t ...@@ -347,7 +347,7 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, jsexcept_t
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = to_uint32_jsval(ctx, val, ei, &length); hres = to_uint32(ctx, val, ei, &length);
jsval_release(val); jsval_release(val);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
......
...@@ -259,8 +259,7 @@ HRESULT to_boolean(jsval_t,BOOL*) DECLSPEC_HIDDEN; ...@@ -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_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_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_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(script_ctx_t*,jsval_t,jsexcept_t*,DWORD*) DECLSPEC_HIDDEN;
HRESULT to_uint32_jsval(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(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_string_jsval(script_ctx_t*,jsval_t,jsexcept_t*,BSTR*) DECLSPEC_HIDDEN;
HRESULT to_object(script_ctx_t*,VARIANT*,IDispatch**) DECLSPEC_HIDDEN; HRESULT to_object(script_ctx_t*,VARIANT*,IDispatch**) DECLSPEC_HIDDEN;
......
...@@ -645,23 +645,12 @@ HRESULT to_int32(script_ctx_t *ctx, jsval_t v, jsexcept_t *ei, INT *ret) ...@@ -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 */ /* 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; double n;
HRESULT hres; 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); hres = to_number(ctx, val, ei, &n);
jsval_release(val);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -669,21 +658,6 @@ HRESULT to_uint32(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, DWORD *ret) ...@@ -669,21 +658,6 @@ HRESULT to_uint32(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, DWORD *ret)
return S_OK; 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) static BSTR int_to_bstr(int i)
{ {
WCHAR buf[12], *p; WCHAR buf[12], *p;
......
...@@ -1531,7 +1531,7 @@ static HRESULT StringConstr_fromCharCode(script_ctx_t *ctx, vdisp_t *jsthis, WOR ...@@ -1531,7 +1531,7 @@ static HRESULT StringConstr_fromCharCode(script_ctx_t *ctx, vdisp_t *jsthis, WOR
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
for(i=0; i<argc; i++) { 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)) { if(FAILED(hres)) {
SysFreeString(ret); SysFreeString(ret);
return hres; return hres;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment