Commit b6e91906 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Directly return error code instead of using throw_type_error in date.c.

parent df70647b
......@@ -582,7 +582,7 @@ static HRESULT Date_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
return dateobj_to_string(date, r);
}
......@@ -599,7 +599,7 @@ static HRESULT Date_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(isnan(date->time)) {
if(r)
......@@ -646,7 +646,7 @@ static HRESULT Date_toISOString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
year = year_from_time(date->time);
if(isnan(year) || year > 999999 || year < -999999) {
......@@ -686,7 +686,7 @@ static HRESULT Date_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(date->time);
......@@ -719,7 +719,7 @@ static inline HRESULT create_utc_string(script_ctx_t *ctx, vdisp_t *jsthis, jsva
DWORD lcid_en;
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(isnan(date->time)) {
if(r)
......@@ -838,7 +838,7 @@ static HRESULT Date_toDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DateInstance *date;
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
return dateobj_to_date_string(date, r);
}
......@@ -861,7 +861,7 @@ static HRESULT Date_toTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(isnan(date->time)) {
if(r)
......@@ -910,7 +910,7 @@ static HRESULT Date_toLocaleDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(isnan(date->time)) {
if(r)
......@@ -949,7 +949,7 @@ static HRESULT Date_toLocaleTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(isnan(date->time)) {
if(r)
......@@ -985,7 +985,7 @@ static HRESULT Date_getTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(date->time);
......@@ -1001,7 +1001,7 @@ static HRESULT Date_getFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r) {
DOUBLE time = local_time(date->time, date);
......@@ -1020,7 +1020,7 @@ static HRESULT Date_getUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(year_from_time(date->time));
......@@ -1035,7 +1035,7 @@ static HRESULT Date_getMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(month_from_time(local_time(date->time, date)));
......@@ -1051,7 +1051,7 @@ static HRESULT Date_getUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(month_from_time(date->time));
......@@ -1066,7 +1066,7 @@ static HRESULT Date_getDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(date_from_time(local_time(date->time, date)));
......@@ -1082,7 +1082,7 @@ static HRESULT Date_getUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(date_from_time(date->time));
......@@ -1098,7 +1098,7 @@ static HRESULT Date_getDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(week_day(local_time(date->time, date)));
......@@ -1114,7 +1114,7 @@ static HRESULT Date_getUTCDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(week_day(date->time));
......@@ -1130,7 +1130,7 @@ static HRESULT Date_getHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(hour_from_time(local_time(date->time, date)));
......@@ -1146,7 +1146,7 @@ static HRESULT Date_getUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(hour_from_time(date->time));
......@@ -1162,7 +1162,7 @@ static HRESULT Date_getMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(min_from_time(local_time(date->time, date)));
......@@ -1178,7 +1178,7 @@ static HRESULT Date_getUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(min_from_time(date->time));
......@@ -1193,7 +1193,7 @@ static HRESULT Date_getSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(sec_from_time(local_time(date->time, date)));
......@@ -1209,7 +1209,7 @@ static HRESULT Date_getUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(sec_from_time(date->time));
......@@ -1225,7 +1225,7 @@ static HRESULT Date_getMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(ms_from_time(local_time(date->time, date)));
......@@ -1241,7 +1241,7 @@ static HRESULT Date_getUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(ms_from_time(date->time));
......@@ -1257,7 +1257,7 @@ static HRESULT Date_getTimezoneOffset(script_ctx_t *ctx, vdisp_t *jsthis, WORD f
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(r)
*r = jsval_number(floor((date->time-local_time(date->time, date))/MS_PER_MINUTE));
......@@ -1275,10 +1275,10 @@ static HRESULT Date_setTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
hres = to_number(ctx, argv[0], &n);
if(FAILED(hres))
......@@ -1302,10 +1302,10 @@ static HRESULT Date_setMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
hres = to_number(ctx, argv[0], &n);
if(FAILED(hres))
......@@ -1332,10 +1332,10 @@ static HRESULT Date_setUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
hres = to_number(ctx, argv[0], &n);
if(FAILED(hres))
......@@ -1362,10 +1362,10 @@ static HRESULT Date_setSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
t = local_time(date->time, date);
......@@ -1401,10 +1401,10 @@ static HRESULT Date_setUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
t = date->time;
......@@ -1440,10 +1440,10 @@ static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
t = local_time(date->time, date);
......@@ -1487,10 +1487,10 @@ static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
t = date->time;
......@@ -1534,10 +1534,10 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
t = local_time(date->time, date);
......@@ -1588,10 +1588,10 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
t = date->time;
......@@ -1642,10 +1642,10 @@ static HRESULT Date_setDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
hres = to_number(ctx, argv[0], &n);
if(FAILED(hres))
......@@ -1671,10 +1671,10 @@ static HRESULT Date_setUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
hres = to_number(ctx, argv[0], &n);
if(FAILED(hres))
......@@ -1700,10 +1700,10 @@ static HRESULT Date_setMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
t = local_time(date->time, date);
......@@ -1739,10 +1739,10 @@ static HRESULT Date_setUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
t = date->time;
......@@ -1778,10 +1778,10 @@ static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
t = local_time(date->time, date);
......@@ -1824,10 +1824,10 @@ static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
t = date->time;
......@@ -1869,7 +1869,7 @@ static HRESULT Date_getYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
t = local_time(date->time, date);
if(isnan(t)) {
......@@ -1895,10 +1895,10 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
return JS_E_DATE_EXPECTED;
if(!argc)
return throw_type_error(ctx, JS_E_MISSING_ARG, NULL);
return JS_E_MISSING_ARG;
t = local_time(date->time, date);
......
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