jscript: Directly return error code instead of using throw_range_error.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1d487027a0
commit
b67c957f39
|
@ -149,7 +149,7 @@ static HRESULT Array_set_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t val
|
||||||
|
|
||||||
len = floor(len);
|
len = floor(len);
|
||||||
if(len!=(DWORD)len)
|
if(len!=(DWORD)len)
|
||||||
return throw_range_error(ctx, JS_E_INVALID_LENGTH, NULL);
|
return JS_E_INVALID_LENGTH;
|
||||||
|
|
||||||
for(i=len; i < This->length; i++) {
|
for(i=len; i < This->length; i++) {
|
||||||
hres = jsdisp_delete_idx(&This->dispex, i);
|
hres = jsdisp_delete_idx(&This->dispex, i);
|
||||||
|
@ -1281,7 +1281,7 @@ static HRESULT ArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
|
||||||
double n = get_number(argv[0]);
|
double n = get_number(argv[0]);
|
||||||
|
|
||||||
if(n < 0 || !is_int32(n))
|
if(n < 0 || !is_int32(n))
|
||||||
return throw_range_error(ctx, JS_E_INVALID_LENGTH, NULL);
|
return JS_E_INVALID_LENGTH;
|
||||||
|
|
||||||
hres = create_array(ctx, n, &obj);
|
hres = create_array(ctx, n, &obj);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
|
|
|
@ -435,11 +435,6 @@ static HRESULT throw_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str, j
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT throw_range_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
|
|
||||||
{
|
|
||||||
return throw_error(ctx, error, str, ctx->range_error_constr);
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT throw_reference_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
|
HRESULT throw_reference_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
|
||||||
{
|
{
|
||||||
return throw_error(ctx, error, str, ctx->reference_error_constr);
|
return throw_error(ctx, error, str, ctx->reference_error_constr);
|
||||||
|
|
|
@ -312,7 +312,6 @@ HRESULT Function_get_value(script_ctx_t*,jsdisp_t*,jsval_t*) DECLSPEC_HIDDEN;
|
||||||
struct _function_code_t *Function_get_code(jsdisp_t*) DECLSPEC_HIDDEN;
|
struct _function_code_t *Function_get_code(jsdisp_t*) DECLSPEC_HIDDEN;
|
||||||
#define DEFAULT_FUNCTION_VALUE {NULL, Function_value,0, Function_get_value}
|
#define DEFAULT_FUNCTION_VALUE {NULL, Function_value,0, Function_get_value}
|
||||||
|
|
||||||
HRESULT throw_range_error(script_ctx_t*,HRESULT,const WCHAR*) DECLSPEC_HIDDEN;
|
|
||||||
HRESULT throw_reference_error(script_ctx_t*,HRESULT,const WCHAR*) DECLSPEC_HIDDEN;
|
HRESULT throw_reference_error(script_ctx_t*,HRESULT,const WCHAR*) DECLSPEC_HIDDEN;
|
||||||
HRESULT throw_regexp_error(script_ctx_t*,HRESULT,const WCHAR*) DECLSPEC_HIDDEN;
|
HRESULT throw_regexp_error(script_ctx_t*,HRESULT,const WCHAR*) DECLSPEC_HIDDEN;
|
||||||
HRESULT throw_syntax_error(script_ctx_t*,HRESULT,const WCHAR*) DECLSPEC_HIDDEN;
|
HRESULT throw_syntax_error(script_ctx_t*,HRESULT,const WCHAR*) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -375,8 +375,8 @@ static HRESULT Number_toFixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
if(prec<0 || prec>20)
|
if(prec < 0 || prec > 20)
|
||||||
return throw_range_error(ctx, JS_E_FRACTION_DIGITS_OUT_OF_RANGE, NULL);
|
return JS_E_FRACTION_DIGITS_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = number->value;
|
val = number->value;
|
||||||
|
@ -416,8 +416,8 @@ static HRESULT Number_toExponential(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
if(prec<0 || prec>20)
|
if(prec < 0 || prec > 20)
|
||||||
return throw_range_error(ctx, JS_E_FRACTION_DIGITS_OUT_OF_RANGE, NULL);
|
return JS_E_FRACTION_DIGITS_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = number->value;
|
val = number->value;
|
||||||
|
@ -458,7 +458,7 @@ static HRESULT Number_toPrecision(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
if(prec<1 || prec>21)
|
if(prec<1 || prec>21)
|
||||||
return throw_range_error(ctx, JS_E_PRECISION_OUT_OF_RANGE, NULL);
|
return JS_E_PRECISION_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = number->value;
|
val = number->value;
|
||||||
|
|
|
@ -80,7 +80,7 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
|
||||||
return throw_type_error(ctx, JS_E_VBARRAY_EXPECTED, NULL);
|
return throw_type_error(ctx, JS_E_VBARRAY_EXPECTED, NULL);
|
||||||
|
|
||||||
if(argc < SafeArrayGetDim(vbarray->safearray))
|
if(argc < SafeArrayGetDim(vbarray->safearray))
|
||||||
return throw_range_error(ctx, JS_E_SUBSCRIPT_OUT_OF_RANGE, NULL);
|
return JS_E_SUBSCRIPT_OUT_OF_RANGE;
|
||||||
|
|
||||||
indexes = heap_alloc(sizeof(int)*argc);
|
indexes = heap_alloc(sizeof(int)*argc);
|
||||||
if(!indexes)
|
if(!indexes)
|
||||||
|
@ -97,7 +97,7 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
|
||||||
hres = SafeArrayGetElement(vbarray->safearray, indexes, (void*)&out);
|
hres = SafeArrayGetElement(vbarray->safearray, indexes, (void*)&out);
|
||||||
heap_free(indexes);
|
heap_free(indexes);
|
||||||
if(hres == DISP_E_BADINDEX)
|
if(hres == DISP_E_BADINDEX)
|
||||||
return throw_range_error(ctx, JS_E_SUBSCRIPT_OUT_OF_RANGE, NULL);
|
return JS_E_SUBSCRIPT_OUT_OF_RANGE;
|
||||||
else if(FAILED(hres))
|
else if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
|
||||||
|
|
||||||
hres = SafeArrayGetLBound(vbarray->safearray, dim, &dim);
|
hres = SafeArrayGetLBound(vbarray->safearray, dim, &dim);
|
||||||
if(hres == DISP_E_BADINDEX)
|
if(hres == DISP_E_BADINDEX)
|
||||||
return throw_range_error(ctx, JS_E_SUBSCRIPT_OUT_OF_RANGE, NULL);
|
return JS_E_SUBSCRIPT_OUT_OF_RANGE;
|
||||||
else if(FAILED(hres))
|
else if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
|
||||||
|
|
||||||
hres = SafeArrayGetUBound(vbarray->safearray, dim, &dim);
|
hres = SafeArrayGetUBound(vbarray->safearray, dim, &dim);
|
||||||
if(hres == DISP_E_BADINDEX)
|
if(hres == DISP_E_BADINDEX)
|
||||||
return throw_range_error(ctx, JS_E_SUBSCRIPT_OUT_OF_RANGE, NULL);
|
return JS_E_SUBSCRIPT_OUT_OF_RANGE;
|
||||||
else if(FAILED(hres))
|
else if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue