Fix most remaining warnings in js/src. Patch courtesy slamm.

r=mccabe.


git-svn-id: svn://10.0.0.236/trunk@53245 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mccabe%netscape.com 1999-11-11 21:52:35 +00:00
parent 9d218e2b5b
commit b31e8409ff
16 changed files with 279 additions and 258 deletions

View File

@ -94,7 +94,7 @@ IdIsIndex(jsid id, jsuint *indexp)
if (JS7_ISDEC(*cp) && str->length < sizeof(MAXSTR)) {
jsuint index = JS7_UNDEC(*cp++);
jsuint oldIndex = 0;
jsint c = 0;
jsuint c = 0;
if (index != 0) {
while (JS7_ISDEC(*cp)) {
oldIndex = index;
@ -305,7 +305,8 @@ JSClass js_ArrayClass = {
"Array",
0,
array_addProperty, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, array_convert, JS_FinalizeStub
JS_EnumerateStub, JS_ResolveStub, array_convert, JS_FinalizeStub,
JSCLASS_NO_OPTIONAL_MEMBERS
};
static JSBool
@ -1278,30 +1279,30 @@ array_slice(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
static JSFunctionSpec array_methods[] = {
#if JS_HAS_TOSOURCE
{js_toSource_str, array_toSource, 0},
{js_toSource_str, array_toSource, 0,0,0},
#endif
{js_toString_str, array_toString, 0},
{js_toString_str, array_toString, 0,0,0},
/* Perl-ish methods. */
{"join", array_join, 1},
{"reverse", array_reverse, 0},
{"sort", array_sort, 1},
{"join", array_join, 1,0,0},
{"reverse", array_reverse, 0,0,0},
{"sort", array_sort, 1,0,0},
#ifdef NOTYET
{"pack", array_pack, 1},
{"pack", array_pack, 1,0,0},
#endif
{"push", array_push, 1},
{"pop", array_pop, 0},
{"shift", array_shift, 0},
{"unshift", array_unshift, 1},
{"splice", array_splice, 1},
{"push", array_push, 1,0,0},
{"pop", array_pop, 0,0,0},
{"shift", array_shift, 0,0,0},
{"unshift", array_unshift, 1,0,0},
{"splice", array_splice, 1,0,0},
/* Python-esque sequence methods. */
#if JS_HAS_SEQUENCE_OPS
{"concat", array_concat, 0},
{"slice", array_slice, 0},
{"concat", array_concat, 0,0,0},
{"slice", array_slice, 0,0,0},
#endif
{0}
{0,0,0,0,0}
};
static JSBool

View File

@ -53,7 +53,8 @@ static JSClass boolean_class = {
"Boolean",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
JSCLASS_NO_OPTIONAL_MEMBERS
};
#if JS_HAS_TOSOURCE
@ -115,11 +116,11 @@ bool_valueOf(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
static JSFunctionSpec boolean_methods[] = {
#if JS_HAS_TOSOURCE
{js_toSource_str, bool_toSource, 0},
{js_toSource_str, bool_toSource, 0,0,0},
#endif
{js_toString_str, bool_toString, 0},
{js_valueOf_str, bool_valueOf, 0},
{0}
{js_toString_str, bool_toString, 0,0,0},
{js_valueOf_str, bool_valueOf, 0,0,0},
{0,0,0,0,0}
};
#ifdef XP_MAC

View File

@ -431,7 +431,8 @@ static JSClass date_class = {
"Date",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
JSCLASS_NO_OPTIONAL_MEMBERS
};
/* for use by date_parse */
@ -1669,56 +1670,56 @@ date_valueOf(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
*/
static JSFunctionSpec date_static_methods[] = {
{"UTC", date_UTC, MAXARGS },
{"parse", date_parse, 1 },
{0}
{"UTC", date_UTC, MAXARGS,0,0 },
{"parse", date_parse, 1,0,0 },
{0,0,0,0,0}
};
static JSFunctionSpec date_methods[] = {
{"getTime", date_getTime, 0 },
{"getTimezoneOffset", date_getTimezoneOffset, 0 },
{"getYear", date_getYear, 0 },
{"getFullYear", date_getFullYear, 0 },
{"getUTCFullYear", date_getUTCFullYear, 0 },
{"getMonth", date_getMonth, 0 },
{"getUTCMonth", date_getUTCMonth, 0 },
{"getDate", date_getDate, 0 },
{"getUTCDate", date_getUTCDate, 0 },
{"getDay", date_getDay, 0 },
{"getUTCDay", date_getUTCDay, 0 },
{"getHours", date_getHours, 0 },
{"getUTCHours", date_getUTCHours, 0 },
{"getMinutes", date_getMinutes, 0 },
{"getUTCMinutes", date_getUTCMinutes, 0 },
{"getSeconds", date_getUTCSeconds, 0 },
{"getUTCSeconds", date_getUTCSeconds, 0 },
{"getMilliseconds", date_getUTCMilliseconds,0 },
{"getUTCMilliseconds",date_getUTCMilliseconds,0 },
{"setTime", date_setTime, 1 },
{"setYear", date_setYear, 1 },
{"setFullYear", date_setFullYear, 3 },
{"setUTCFullYear", date_setUTCFullYear, 3 },
{"setMonth", date_setMonth, 2 },
{"setUTCMonth", date_setUTCMonth, 2 },
{"setDate", date_setDate, 1 },
{"setUTCDate", date_setUTCDate, 1 },
{"setHours", date_setHours, 4 },
{"setUTCHours", date_setUTCHours, 4 },
{"setMinutes", date_setMinutes, 3 },
{"setUTCMinutes", date_setUTCMinutes, 3 },
{"setSeconds", date_setSeconds, 2 },
{"setUTCSeconds", date_setUTCSeconds, 2 },
{"setMilliseconds", date_setMilliseconds, 1 },
{"setUTCMilliseconds",date_setUTCMilliseconds,1 },
{"toGMTString", date_toGMTString, 0 },
{"toUTCString", date_toGMTString, 0 },
{"toLocaleString", date_toLocaleString, 0 },
{"getTime", date_getTime, 0,0,0 },
{"getTimezoneOffset", date_getTimezoneOffset, 0,0,0 },
{"getYear", date_getYear, 0,0,0 },
{"getFullYear", date_getFullYear, 0,0,0 },
{"getUTCFullYear", date_getUTCFullYear, 0,0,0 },
{"getMonth", date_getMonth, 0,0,0 },
{"getUTCMonth", date_getUTCMonth, 0,0,0 },
{"getDate", date_getDate, 0,0,0 },
{"getUTCDate", date_getUTCDate, 0,0,0 },
{"getDay", date_getDay, 0,0,0 },
{"getUTCDay", date_getUTCDay, 0,0,0 },
{"getHours", date_getHours, 0,0,0 },
{"getUTCHours", date_getUTCHours, 0,0,0 },
{"getMinutes", date_getMinutes, 0,0,0 },
{"getUTCMinutes", date_getUTCMinutes, 0,0,0 },
{"getSeconds", date_getUTCSeconds, 0,0,0 },
{"getUTCSeconds", date_getUTCSeconds, 0,0,0 },
{"getMilliseconds", date_getUTCMilliseconds,0,0,0 },
{"getUTCMilliseconds",date_getUTCMilliseconds,0,0,0 },
{"setTime", date_setTime, 1,0,0 },
{"setYear", date_setYear, 1,0,0 },
{"setFullYear", date_setFullYear, 3,0,0 },
{"setUTCFullYear", date_setUTCFullYear, 3,0,0 },
{"setMonth", date_setMonth, 2,0,0 },
{"setUTCMonth", date_setUTCMonth, 2,0,0 },
{"setDate", date_setDate, 1,0,0 },
{"setUTCDate", date_setUTCDate, 1,0,0 },
{"setHours", date_setHours, 4,0,0 },
{"setUTCHours", date_setUTCHours, 4,0,0 },
{"setMinutes", date_setMinutes, 3,0,0 },
{"setUTCMinutes", date_setUTCMinutes, 3,0,0 },
{"setSeconds", date_setSeconds, 2,0,0 },
{"setUTCSeconds", date_setUTCSeconds, 2,0,0 },
{"setMilliseconds", date_setMilliseconds, 1,0,0 },
{"setUTCMilliseconds",date_setUTCMilliseconds,1,0,0 },
{"toGMTString", date_toGMTString, 0,0,0 },
{"toUTCString", date_toGMTString, 0,0,0 },
{"toLocaleString", date_toLocaleString, 0,0,0 },
#if JS_HAS_TOSOURCE
{js_toSource_str, date_toSource, 0 },
{js_toSource_str, date_toSource, 0,0,0 },
#endif
{js_toString_str, date_toString, 0 },
{js_valueOf_str, date_valueOf, 0 },
{0}
{js_toString_str, date_toString, 0,0,0 },
{js_valueOf_str, date_valueOf, 0,0,0 },
{0,0,0,0,0}
};
static jsdouble *

View File

@ -94,7 +94,7 @@ EmitCheck(JSContext *cx, JSCodeGenerator *cg, JSOp op, ptrdiff_t delta)
ptrdiff_t offset, length;
size_t cgsize;
JS_ASSERT(delta < CGINCR);
JS_ASSERT(delta < (ptrdiff_t)CGINCR);
offset = CG_OFFSET(cg);
if ((jsuword)cg->next + delta >= (jsuword)cg->limit) {
length = PTRDIFF(cg->limit, cg->base, jsbytecode);

View File

@ -66,7 +66,8 @@ JSClass js_ErrorClass = {
JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, exn_finalize,
NULL, NULL, NULL, Exception
NULL, NULL, NULL, Exception,
0,0,{0,0}
};
/*
@ -254,7 +255,7 @@ static struct JSExnSpec exceptions[] = {
{ JSEXN_ERR, "SyntaxError" },
{ JSEXN_ERR, "TypeError" },
{ JSEXN_ERR, "URIError" },
{0}
{0,0}
};
static JSBool
@ -423,10 +424,10 @@ exn_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
static JSFunctionSpec exception_methods[] = {
#if JS_HAS_TOSOURCE
{js_toSource_str, exn_toSource, 0},
{js_toSource_str, exn_toSource, 0,0,0},
#endif
{js_toString_str, exn_toString, 0},
{0}
{js_toString_str, exn_toString, 0,0,0},
{0,0,0,0,0}
};
JSObject *

View File

@ -148,9 +148,9 @@ Arguments(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
}
static JSPropertySpec args_props[] = {
{js_length_str, ARGS_LENGTH, 0},
{js_callee_str, ARGS_CALLEE, 0},
{0}
{js_length_str, ARGS_LENGTH, 0,0,0},
{js_callee_str, ARGS_CALLEE, 0,0,0},
{0,0,0,0,0}
};
static JSBool
@ -249,7 +249,8 @@ JSClass js_ArgumentsClass = {
JS_PropertyStub, JS_PropertyStub,
args_getProperty, args_setProperty,
args_enumerate, JS_ResolveStub,
JS_ConvertStub, JS_FinalizeStub
JS_ConvertStub, JS_FinalizeStub,
JSCLASS_NO_OPTIONAL_MEMBERS
};
#endif /* JS_HAS_ARGS_OBJECT */
@ -349,10 +350,10 @@ Call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
}
static JSPropertySpec call_props[] = {
{js_arguments_str, CALL_ARGUMENTS, JSPROP_PERMANENT},
{"__callee__", ARGS_CALLEE, 0},
{"__call__", FUN_CALL, 0},
{0}
{js_arguments_str, CALL_ARGUMENTS, JSPROP_PERMANENT,0,0},
{"__callee__", ARGS_CALLEE, 0,0,0},
{"__call__", FUN_CALL, 0,0,0},
{0,0,0,0,0}
};
static JSBool
@ -570,7 +571,8 @@ JSClass js_CallClass = {
JS_PropertyStub, JS_PropertyStub,
call_getProperty, call_setProperty,
call_enumerate, (JSResolveOp)call_resolve,
call_convert, JS_FinalizeStub
call_convert, JS_FinalizeStub,
JSCLASS_NO_OPTIONAL_MEMBERS
};
#endif /* JS_HAS_CALL_OBJECT */
@ -664,7 +666,8 @@ JSClass js_ClosureClass = {
0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, closure_convert, JS_FinalizeStub,
NULL, NULL, closure_call, closure_call
NULL, NULL, closure_call, closure_call,
NULL,NULL,{0,0}
};
#endif /* JS_HAS_LEXICAL_CLOSURE */
@ -674,12 +677,12 @@ static JSPropertySpec function_props[] = {
* set by an unqualified assignment 'arguments = ...' within a call where
* fun->object is proxying for a Call object.
*/
{js_arguments_str, CALL_ARGUMENTS, JSPROP_PERMANENT},
{"__arity__", FUN_ARITY, JSPROP_READONLY | JSPROP_PERMANENT},
{"__length__", ARGS_LENGTH, JSPROP_READONLY | JSPROP_PERMANENT},
{"__name__", FUN_NAME, JSPROP_READONLY | JSPROP_PERMANENT},
{"__call__", FUN_CALL, JSPROP_READONLY | JSPROP_PERMANENT},
{0}
{js_arguments_str, CALL_ARGUMENTS, JSPROP_PERMANENT,0,0},
{"__arity__", FUN_ARITY, JSPROP_READONLY | JSPROP_PERMANENT,0,0},
{"__length__", ARGS_LENGTH, JSPROP_READONLY | JSPROP_PERMANENT,0,0},
{"__name__", FUN_NAME, JSPROP_READONLY | JSPROP_PERMANENT,0,0},
{"__call__", FUN_CALL, JSPROP_READONLY | JSPROP_PERMANENT,0,0},
{0,0,0,0,0}
};
static JSBool
@ -1178,7 +1181,8 @@ JSClass js_FunctionClass = {
fun_convert, fun_finalize,
NULL, NULL,
NULL, NULL,
fun_xdrObject, fun_hasInstance
fun_xdrObject, fun_hasInstance,
{0,0}
};
static JSBool
@ -1364,16 +1368,16 @@ out:
static JSFunctionSpec function_methods[] = {
#if JS_HAS_TOSOURCE
{js_toSource_str, fun_toSource, 0},
{js_toSource_str, fun_toSource, 0,0,0},
#endif
{js_toString_str, fun_toString, 1},
{js_toString_str, fun_toString, 1,0,0},
#if JS_HAS_APPLY_FUNCTION
{"apply", fun_apply, 1},
{"apply", fun_apply, 1,0,0},
#endif
#if JS_HAS_CALL_FUNCTION
{"call", fun_call, 1},
{"call", fun_call, 1,0,0},
#endif
{0}
{0,0,0,0,0}
};
JSBool

View File

@ -129,7 +129,8 @@ static JSClass prop_iterator_class = {
"PropertyIterator",
0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, prop_iterator_finalize
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, prop_iterator_finalize,
JSCLASS_NO_OPTIONAL_MEMBERS
};
/*
@ -1387,7 +1388,9 @@ js_Interpret(JSContext *cx, jsval *result)
* Stash private iteration state into property iterator object.
* NB: This code knows that the first slots are pre-allocated.
*/
JS_ASSERT(JS_INITIAL_NSLOTS >= 5);
#if JS_INITIAL_NSLOTS < 5
#error JS_INITIAL_NSLOTS must be greater than or equal to 5.
#endif
propobj->slots[JSSLOT_PARENT] = OBJECT_TO_JSVAL(obj);
} else {
/* This is not the first iteration. Recover iterator state. */

View File

@ -144,18 +144,19 @@ num_parseInt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
static JSFunctionSpec number_functions[] = {
{"isNaN", num_isNaN, 1},
{"isFinite", num_isFinite, 1},
{"parseFloat", num_parseFloat, 1},
{"parseInt", num_parseInt, 2},
{0}
{"isNaN", num_isNaN, 1,0,0},
{"isFinite", num_isFinite, 1,0,0},
{"parseFloat", num_parseFloat, 1,0,0},
{"parseInt", num_parseInt, 2,0,0},
{0,0,0,0,0}
};
static JSClass number_class = {
"Number",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
JSCLASS_NO_OPTIONAL_MEMBERS
};
static JSBool
@ -333,16 +334,16 @@ num_toPrecision(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rv
static JSFunctionSpec number_methods[] = {
#if JS_HAS_TOSOURCE
{js_toSource_str, num_toSource, 0},
{js_toSource_str, num_toSource, 0,0,0},
#endif
{js_toString_str, num_toString, 0},
{js_valueOf_str, num_valueOf, 0},
{js_toString_str, num_toString, 0,0,0},
{js_valueOf_str, num_valueOf, 0,0,0},
#if JS_HAS_NUMBER_FORMATS
{"toFixed", num_toFixed, 1},
{"toExponential", num_toExponential, 1},
{"toPrecision", num_toPrecision, 1},
{"toFixed", num_toFixed, 1,0,0},
{"toExponential", num_toExponential, 1,0,0},
{"toPrecision", num_toPrecision, 1,0,0},
#endif
{0}
{0,0,0,0,0}
};
/* NB: Keep this in synch with number_constants[]. */
@ -361,12 +362,12 @@ enum nc_slot {
* using union dpun.
*/
static JSConstDoubleSpec number_constants[] = {
{0, js_NaN_str},
{0, "POSITIVE_INFINITY"},
{0, "NEGATIVE_INFINITY"},
{1.7976931348623157E+308, "MAX_VALUE"},
{0, "MIN_VALUE"},
{0}
{0, js_NaN_str, 0,{0,0,0}},
{0, "POSITIVE_INFINITY", 0,{0,0,0}},
{0, "NEGATIVE_INFINITY", 0,{0,0,0}},
{1.7976931348623157E+308, "MAX_VALUE", 0,{0,0,0}},
{0, "MIN_VALUE", 0,{0,0,0}},
{0,0,0,{0,0,0}}
};
static jsdouble NaN;

View File

@ -88,7 +88,8 @@ JS_FRIEND_DATA(JSObjectOps) js_ObjectOps = {
js_Enumerate, js_CheckAccess,
NULL, NATIVE_DROP_PROPERTY,
js_Call, js_Construct,
NULL, js_HasInstance
NULL, js_HasInstance,
{0,0}
};
#ifdef XP_MAC
@ -99,7 +100,8 @@ JSClass js_ObjectClass = {
js_Object_str,
0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
JSCLASS_NO_OPTIONAL_MEMBERS
};
#if JS_HAS_OBJ_PROTO_PROP
@ -119,7 +121,7 @@ static JSPropertySpec object_props[] = {
{js_parent_str,JSSLOT_PARENT, JSPROP_PERMANENT|JSPROP_READONLY,
obj_getSlot, obj_setSlot},
{js_count_str, 0, JSPROP_PERMANENT, obj_getCount, obj_getCount},
{0}
{0,0,0,0,0}
};
static JSBool
@ -912,18 +914,18 @@ static JSFunctionSpec object_methods[] = {
{js_toSource_str, js_obj_toSource, 0, 0, OBJ_TOSTRING_EXTRA},
#endif
{js_toString_str, js_obj_toString, 0, 0, OBJ_TOSTRING_EXTRA},
{js_valueOf_str, obj_valueOf, 0},
{js_eval_str, obj_eval, 1},
{js_valueOf_str, obj_valueOf, 0,0,0},
{js_eval_str, obj_eval, 1,0,0},
#if JS_HAS_OBJ_WATCHPOINT
{"watch", obj_watch, 2},
{"unwatch", obj_unwatch, 1},
{"watch", obj_watch, 2,0,0},
{"unwatch", obj_unwatch, 1,0,0},
#endif
#if JS_HAS_NEW_OBJ_METHODS
{"hasOwnProperty", obj_hasOwnProperty, 1},
{"isPrototypeOf", obj_isPrototypeOf, 1},
{"propertyIsEnumerable", obj_propertyIsEnumerable, 1},
{"hasOwnProperty", obj_hasOwnProperty, 1,0,0},
{"isPrototypeOf", obj_isPrototypeOf, 1,0,0},
{"propertyIsEnumerable", obj_propertyIsEnumerable, 1,0,0},
#endif
{0}
{0,0,0,0,0}
};
static JSBool
@ -1058,7 +1060,8 @@ JS_FRIEND_DATA(JSObjectOps) js_WithObjectOps = {
with_GetAttributes, with_SetAttributes,
with_DeleteProperty, with_DefaultValue,
with_Enumerate, with_CheckAccess,
with_ThisObject, NATIVE_DROP_PROPERTY
with_ThisObject, NATIVE_DROP_PROPERTY,
0,0,0,0,{0,0}
};
static JSObjectOps *
@ -1072,7 +1075,8 @@ JSClass js_WithClass = {
0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
with_getObjectOps
with_getObjectOps,
0,0,0,0,0,{0,0}
};
#if JS_HAS_OBJ_PROTO_PROP

View File

@ -568,7 +568,9 @@ PushOff(SprintStack *ss, ptrdiff_t off, JSOp op)
{
uintN top;
JS_ASSERT(JSOP_LIMIT <= JSOP_GETPROP2);
#if JSOP_LIMIT > JSOP_GETPROP2
#error JSOP_LIMIT must be <= JSOP_GETPROP2
#endif
if (!SprintAlloc(&ss->sprinter, PAREN_SLOP))
return JS_FALSE;

View File

@ -2322,7 +2322,7 @@ PrimaryExpr(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
case TOK_LB:
{
JSBool matched;
jsint atomIndex;
jsuint atomIndex;
pn = NewParseNode(cx, &CURRENT_TOKEN(ts), PN_LIST);
if (!pn)

View File

@ -337,8 +337,8 @@ static int cvt_f(SprintfState *ss, double d, const char *fmt0, const char *fmt1)
char fout[300];
int amount = fmt1 - fmt0;
JS_ASSERT((amount > 0) && (amount < sizeof(fin)));
if (amount >= sizeof(fin)) {
JS_ASSERT((amount > 0) && (amount < (int)sizeof(fin)));
if (amount >= (int)sizeof(fin)) {
/* Totally bogus % command to sprintf. Just ignore it */
return 0;
}
@ -920,7 +920,7 @@ static int dosprintf(SprintfState *ss, const char *fmt, va_list ap)
u.d = va_arg(ap, double);
if( nas != NULL ){
i = fmt - dolPt;
if( i < sizeof( pattern ) ){
if( i < (int)sizeof( pattern ) ){
pattern[0] = '%';
memcpy( &pattern[1], dolPt, (size_t)i );
rv = cvt_f(ss, u.d, pattern, &pattern[i+1] );

View File

@ -2106,12 +2106,12 @@ enum regexp_tinyid {
};
static JSPropertySpec regexp_props[] = {
{"source", REGEXP_SOURCE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"global", REGEXP_GLOBAL, JSPROP_ENUMERATE | JSPROP_READONLY},
{"ignoreCase", REGEXP_IGNORE_CASE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"lastIndex", REGEXP_LAST_INDEX, JSPROP_ENUMERATE},
{"multiline", REGEXP_MULTILINE, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
{"source", REGEXP_SOURCE, JSPROP_ENUMERATE | JSPROP_READONLY,0,0},
{"global", REGEXP_GLOBAL, JSPROP_ENUMERATE | JSPROP_READONLY,0,0},
{"ignoreCase", REGEXP_IGNORE_CASE, JSPROP_ENUMERATE | JSPROP_READONLY,0,0},
{"lastIndex", REGEXP_LAST_INDEX, JSPROP_ENUMERATE,0,0},
{"multiline", REGEXP_MULTILINE, JSPROP_ENUMERATE | JSPROP_READONLY,0,0},
{0,0,0,0,0}
};
static JSBool
@ -2314,7 +2314,7 @@ static JSPropertySpec regexp_static_props[] = {
{"$9", 8, JSPROP_ENUMERATE|JSPROP_READONLY,
regexp_static_getProperty, regexp_static_getProperty},
{0}
{0,0,0,0,0}
};
static void
@ -2389,6 +2389,7 @@ JSClass js_RegExpClass = {
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, regexp_finalize,
NULL, NULL, regexp_call, NULL,
regexp_xdrObject,
0,{0,0}
};
static JSBool
@ -2562,13 +2563,13 @@ regexp_test(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
static JSFunctionSpec regexp_methods[] = {
#if JS_HAS_TOSOURCE
{js_toSource_str, regexp_toString, 0},
{js_toSource_str, regexp_toString, 0,0,0},
#endif
{js_toString_str, regexp_toString, 0},
{"compile", regexp_compile, 1},
{"exec", regexp_exec, 0},
{"test", regexp_test, 0},
{0}
{js_toString_str, regexp_toString, 0,0,0},
{"compile", regexp_compile, 1,0,0},
{"exec", regexp_exec, 0,0,0},
{"test", regexp_test, 0,0,0},
{0,0,0,0,0}
};
static JSBool

View File

@ -70,41 +70,41 @@ static struct keyword {
JSOp op; /* JSOp */
JSVersion version; /* JSVersion */
} keywords[] = {
{"break", TOK_BREAK, JSOP_NOP},
{"case", TOK_CASE, JSOP_NOP},
{"continue", TOK_CONTINUE, JSOP_NOP},
{"default", TOK_DEFAULT, JSOP_NOP},
{js_delete_str, TOK_DELETE, JSOP_NOP},
{"do", TOK_DO, JSOP_NOP},
{"else", TOK_ELSE, JSOP_NOP},
{"break", TOK_BREAK, JSOP_NOP, JSVERSION_DEFAULT},
{"case", TOK_CASE, JSOP_NOP, JSVERSION_DEFAULT},
{"continue", TOK_CONTINUE, JSOP_NOP, JSVERSION_DEFAULT},
{"default", TOK_DEFAULT, JSOP_NOP, JSVERSION_DEFAULT},
{js_delete_str, TOK_DELETE, JSOP_NOP, JSVERSION_DEFAULT},
{"do", TOK_DO, JSOP_NOP, JSVERSION_DEFAULT},
{"else", TOK_ELSE, JSOP_NOP, JSVERSION_DEFAULT},
{"export", TOK_EXPORT, JSOP_NOP, JSVERSION_1_2},
{js_false_str, TOK_PRIMARY, JSOP_FALSE},
{"for", TOK_FOR, JSOP_NOP},
{js_function_str, TOK_FUNCTION, JSOP_NOP},
{"if", TOK_IF, JSOP_NOP},
{js_in_str, TOK_IN, JSOP_IN},
{js_new_str, TOK_NEW, JSOP_NEW},
{js_null_str, TOK_PRIMARY, JSOP_NULL},
{"return", TOK_RETURN, JSOP_NOP},
{"switch", TOK_SWITCH, JSOP_NOP},
{js_this_str, TOK_PRIMARY, JSOP_THIS},
{js_true_str, TOK_PRIMARY, JSOP_TRUE},
{js_typeof_str, TOK_UNARYOP, JSOP_TYPEOF},
{"var", TOK_VAR, JSOP_NOP},
{js_void_str, TOK_UNARYOP, JSOP_VOID},
{"while", TOK_WHILE, JSOP_NOP},
{"with", TOK_WITH, JSOP_NOP},
{js_false_str, TOK_PRIMARY, JSOP_FALSE, JSVERSION_DEFAULT},
{"for", TOK_FOR, JSOP_NOP, JSVERSION_DEFAULT},
{js_function_str, TOK_FUNCTION, JSOP_NOP, JSVERSION_DEFAULT},
{"if", TOK_IF, JSOP_NOP, JSVERSION_DEFAULT},
{js_in_str, TOK_IN, JSOP_IN, JSVERSION_DEFAULT},
{js_new_str, TOK_NEW, JSOP_NEW, JSVERSION_DEFAULT},
{js_null_str, TOK_PRIMARY, JSOP_NULL, JSVERSION_DEFAULT},
{"return", TOK_RETURN, JSOP_NOP, JSVERSION_DEFAULT},
{"switch", TOK_SWITCH, JSOP_NOP, JSVERSION_DEFAULT},
{js_this_str, TOK_PRIMARY, JSOP_THIS, JSVERSION_DEFAULT},
{js_true_str, TOK_PRIMARY, JSOP_TRUE, JSVERSION_DEFAULT},
{js_typeof_str, TOK_UNARYOP, JSOP_TYPEOF,JSVERSION_DEFAULT},
{"var", TOK_VAR, JSOP_NOP, JSVERSION_DEFAULT},
{js_void_str, TOK_UNARYOP, JSOP_VOID, JSVERSION_DEFAULT},
{"while", TOK_WHILE, JSOP_NOP, JSVERSION_DEFAULT},
{"with", TOK_WITH, JSOP_NOP, JSVERSION_DEFAULT},
#if JS_HAS_EXCEPTIONS
{"try", TOK_TRY, JSOP_NOP},
{"catch", TOK_CATCH, JSOP_NOP},
{"finally", TOK_FINALLY, JSOP_NOP},
{"throw", TOK_THROW, JSOP_NOP},
{"try", TOK_TRY, JSOP_NOP, JSVERSION_DEFAULT},
{"catch", TOK_CATCH, JSOP_NOP, JSVERSION_DEFAULT},
{"finally", TOK_FINALLY, JSOP_NOP, JSVERSION_DEFAULT},
{"throw", TOK_THROW, JSOP_NOP, JSVERSION_DEFAULT},
#else
{"try", TOK_RESERVED, JSOP_NOP},
{"catch", TOK_RESERVED, JSOP_NOP},
{"finally", TOK_RESERVED, JSOP_NOP},
{"throw", TOK_RESERVED, JSOP_NOP},
{"try", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"catch", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"finally", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"throw", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
#endif
#if JS_HAS_INSTANCEOF
@ -114,34 +114,34 @@ static struct keyword {
#endif
#ifdef RESERVE_JAVA_KEYWORDS
{"abstract", TOK_RESERVED, JSOP_NOP},
{"boolean", TOK_RESERVED, JSOP_NOP},
{"byte", TOK_RESERVED, JSOP_NOP},
{"char", TOK_RESERVED, JSOP_NOP},
{"class", TOK_RESERVED, JSOP_NOP},
{"const", TOK_RESERVED, JSOP_NOP},
{"double", TOK_RESERVED, JSOP_NOP},
{"extends", TOK_RESERVED, JSOP_NOP},
{"final", TOK_RESERVED, JSOP_NOP},
{"float", TOK_RESERVED, JSOP_NOP},
{"goto", TOK_RESERVED, JSOP_NOP},
{"implements", TOK_RESERVED, JSOP_NOP},
{"import", TOK_IMPORT, JSOP_NOP},
{"int", TOK_RESERVED, JSOP_NOP},
{"interface", TOK_RESERVED, JSOP_NOP},
{"long", TOK_RESERVED, JSOP_NOP},
{"native", TOK_RESERVED, JSOP_NOP},
{"package", TOK_RESERVED, JSOP_NOP},
{"private", TOK_RESERVED, JSOP_NOP},
{"protected", TOK_RESERVED, JSOP_NOP},
{"public", TOK_RESERVED, JSOP_NOP},
{"short", TOK_RESERVED, JSOP_NOP},
{"static", TOK_RESERVED, JSOP_NOP},
{"super", TOK_RESERVED, JSOP_NOP},
{"synchronized", TOK_RESERVED, JSOP_NOP},
{"throws", TOK_RESERVED, JSOP_NOP},
{"transient", TOK_RESERVED, JSOP_NOP},
{"volatile", TOK_RESERVED, JSOP_NOP},
{"abstract", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"boolean", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"byte", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"char", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"class", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"const", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"double", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"extends", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"final", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"float", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"goto", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"implements", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"import", TOK_IMPORT, JSOP_NOP, JSVERSION_DEFAULT},
{"int", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"interface", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"long", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"native", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"package", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"private", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"protected", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"public", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"short", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"static", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"super", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"synchronized", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"throws", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"transient", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
{"volatile", TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT},
#endif
#ifdef RESERVE_ECMA_KEYWORDS
@ -153,7 +153,7 @@ static struct keyword {
#elif defined(RESERVE_ECMA_KEYWORDS)
{"debugger", TOK_RESERVED, JSOP_NOP, JSVERSION_1_3},
#endif
{0}
{0,0,0,0}
};
JSBool

View File

@ -555,16 +555,16 @@ static char js_thaw_str[] = "thaw";
static JSFunctionSpec script_methods[] = {
#if JS_HAS_TOSOURCE
{js_toSource_str, script_toSource, 0},
{js_toSource_str, script_toSource, 0,0,0},
#endif
{js_toString_str, script_toString, 0},
{"compile", script_compile, 2},
{"exec", script_exec, 1},
{js_toString_str, script_toString, 0,0,0},
{"compile", script_compile, 2,0,0},
{"exec", script_exec, 1,0,0},
#if JS_HAS_XDR
{"freeze", script_freeze, 0},
{js_thaw_str, script_thaw, 1},
{"freeze", script_freeze, 0,0,0},
{js_thaw_str, script_thaw, 1,0,0},
#endif /* JS_HAS_XDR */
{0}
{0,0,0,0,0}
};
#endif /* JS_HAS_SCRIPT_OBJECT */
@ -591,6 +591,7 @@ JSClass js_ScriptClass = {
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, script_finalize,
NULL, NULL, script_call, NULL,/*XXXbe xdr*/
0,0,{0,0}
};
#if JS_HAS_SCRIPT_OBJECT
@ -623,8 +624,8 @@ script_static_thaw(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
}
static JSFunctionSpec script_static_methods[] = {
{js_thaw_str, script_static_thaw, 1},
{0}
{js_thaw_str, script_static_thaw, 1,0,0},
{0,0,0,0,0}
};
#else /* !JS_HAS_XDR */

View File

@ -255,12 +255,12 @@ str_uneval(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
#endif
static JSFunctionSpec string_functions[] = {
{"escape", str_escape, 1},
{"unescape", str_unescape, 1},
{"escape", str_escape, 1,0,0},
{"unescape", str_unescape, 1,0,0},
#if JS_HAS_UNEVAL
{"uneval", str_uneval, 1},
{"uneval", str_uneval, 1,0,0},
#endif
{0}
{0,0,0,0,0}
};
jschar js_empty_ucstr[] = {0};
@ -271,8 +271,8 @@ enum string_tinyid {
};
static JSPropertySpec string_props[] = {
{js_length_str, STRING_LENGTH, JSPROP_READONLY},
{0}
{js_length_str, STRING_LENGTH, JSPROP_READONLY,0,0},
{0,0,0,0,0}
};
static JSBool
@ -357,7 +357,8 @@ static JSClass string_class = {
"String",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub, str_delProperty, str_getProperty, JS_PropertyStub,
str_enumerate, str_resolve, JS_ConvertStub, JS_FinalizeStub
str_enumerate, str_resolve, JS_ConvertStub, JS_FinalizeStub,
JSCLASS_NO_OPTIONAL_MEMBERS
};
#if JS_HAS_TOSOURCE
@ -1935,52 +1936,52 @@ str_sub(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
static JSFunctionSpec string_methods[] = {
#if JS_HAS_TOSOURCE
{"quote", str_quote, 0},
{js_toSource_str, str_toSource, 0},
{"quote", str_quote, 0,0,0},
{js_toSource_str, str_toSource, 0,0,0},
#endif
/* Java-like methods. */
{js_toString_str, str_toString, 0},
{js_valueOf_str, str_valueOf, 0},
{"substring", str_substring, 2},
{"toLowerCase", str_toLowerCase, 0},
{"toUpperCase", str_toUpperCase, 0},
{"charAt", str_charAt, 1},
{"charCodeAt", str_charCodeAt, 1},
{"indexOf", str_indexOf, 2},
{"lastIndexOf", str_lastIndexOf, 2},
{js_toString_str, str_toString, 0,0,0},
{js_valueOf_str, str_valueOf, 0,0,0},
{"substring", str_substring, 2,0,0},
{"toLowerCase", str_toLowerCase, 0,0,0},
{"toUpperCase", str_toUpperCase, 0,0,0},
{"charAt", str_charAt, 1,0,0},
{"charCodeAt", str_charCodeAt, 1,0,0},
{"indexOf", str_indexOf, 2,0,0},
{"lastIndexOf", str_lastIndexOf, 2,0,0},
/* Perl-ish methods (search is actually Python-esque). */
{"match", str_match, 1},
{"search", str_search, 1},
{"replace", str_replace, 2},
{"split", str_split, 1},
{"substr", str_substr, 2},
{"match", str_match, 1,0,0},
{"search", str_search, 1,0,0},
{"replace", str_replace, 2,0,0},
{"split", str_split, 1,0,0},
{"substr", str_substr, 2,0,0},
#ifdef NOTYET
{"unpack", str_unpack, 1},
{"unpack", str_unpack, 1,0,0},
#endif
/* Python-esque sequence methods. */
#if JS_HAS_SEQUENCE_OPS
{"concat", str_concat, 0},
{"slice", str_slice, 0},
{"concat", str_concat, 0,0,0},
{"slice", str_slice, 0,0,0},
#endif
/* HTML string methods. */
{"bold", str_bold, 0},
{"italics", str_italics, 0},
{"fixed", str_fixed, 0},
{"fontsize", str_fontsize, 1},
{"fontcolor", str_fontcolor, 1},
{"link", str_link, 1},
{"anchor", str_anchor, 1},
{"strike", str_strike, 0},
{"small", str_small, 0},
{"big", str_big, 0},
{"blink", str_blink, 0},
{"sup", str_sup, 0},
{"sub", str_sub, 0},
{0}
{"bold", str_bold, 0,0,0},
{"italics", str_italics, 0,0,0},
{"fixed", str_fixed, 0,0,0},
{"fontsize", str_fontsize, 1,0,0},
{"fontcolor", str_fontcolor, 1,0,0},
{"link", str_link, 1,0,0},
{"anchor", str_anchor, 1,0,0},
{"strike", str_strike, 0,0,0},
{"small", str_small, 0,0,0},
{"big", str_big, 0,0,0},
{"blink", str_blink, 0,0,0},
{"sup", str_sup, 0,0,0},
{"sub", str_sub, 0,0,0},
{0,0,0,0,0}
};
static JSBool
@ -2033,8 +2034,8 @@ str_fromCharCode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
}
static JSFunctionSpec string_static_methods[] = {
{"fromCharCode", str_fromCharCode, 1},
{0}
{"fromCharCode", str_fromCharCode, 1,0,0},
{0,0,0,0,0}
};
static JSHashTable *deflated_string_cache;