diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index dbd34cb315c7..793db425d8dc 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -2099,9 +2099,9 @@ JS_IdArrayLength(JSContext *cx, JSIdArray *ida) } JS_PUBLIC_API(jsid) -JS_IdArrayGet(JSContext *cx, JSIdArray *ida, int index) +JS_IdArrayGet(JSContext *cx, JSIdArray *ida, unsigned index) { - JS_ASSERT(index >= 0 && index < ida->length); + JS_ASSERT(index < unsigned(ida->length)); return ida->vector[index]; } diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 1dca2219ccaf..f0708cd21ce4 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -2215,7 +2215,7 @@ extern JS_PUBLIC_API(int) JS_IdArrayLength(JSContext *cx, JSIdArray *ida); extern JS_PUBLIC_API(jsid) -JS_IdArrayGet(JSContext *cx, JSIdArray *ida, int index); +JS_IdArrayGet(JSContext *cx, JSIdArray *ida, unsigned index); extern JS_PUBLIC_API(void) JS_DestroyIdArray(JSContext *cx, JSIdArray *ida); @@ -2240,7 +2240,7 @@ class AutoIdArray : private AutoGCRooter } jsid operator[](size_t i) const { JS_ASSERT(idArray); - return JS_IdArrayGet(context, idArray, i); + return JS_IdArrayGet(context, idArray, unsigned(i)); } size_t length() const { return JS_IdArrayLength(context, idArray);