Bug 733260: remove typedef jsuint, r=luke

--HG--
extra : rebase_source : e8f576e1b5b189b47807c613c0cff79f5c8038e7
This commit is contained in:
David Mandelin 2012-03-05 18:43:45 -08:00
Родитель d1fe0337f9
Коммит 63952fac3f
50 изменённых файлов: 201 добавлений и 204 удалений

Просмотреть файл

@ -602,7 +602,7 @@ nsWebSocket::Initialize(nsISupports* aOwner,
if (JSVAL_IS_OBJECT(aArgv[1]) &&
(jsobj = JSVAL_TO_OBJECT(aArgv[1])) &&
JS_IsArrayObject(aContext, jsobj)) {
jsuint len;
unsigned len;
JS_GetArrayLength(aContext, jsobj, &len);
for (PRUint32 index = 0; index < len; ++index) {

Просмотреть файл

@ -122,7 +122,7 @@ JSValToMatrixElts(JSContext* cx, const jsval& val,
double* (&elts)[N], nsresult* rv)
{
JSObject* obj;
jsuint length;
unsigned length;
if (JSVAL_IS_PRIMITIVE(val) ||
!(obj = JSVAL_TO_OBJECT(val)) ||

Просмотреть файл

@ -146,11 +146,11 @@ JSValToDashArray(JSContext* cx, const jsval& patternArray,
{
// The cap is pretty arbitrary. 16k should be enough for
// anybody...
static const jsuint MAX_NUM_DASHES = 1 << 14;
static const unsigned MAX_NUM_DASHES = 1 << 14;
if (!JSVAL_IS_PRIMITIVE(patternArray)) {
JSObject* obj = JSVAL_TO_OBJECT(patternArray);
jsuint length;
unsigned length;
if (!JS_GetArrayLength(cx, obj, &length)) {
// Not an array-like thing
return NS_ERROR_INVALID_ARG;

Просмотреть файл

@ -90,7 +90,7 @@ ConvertCloneReadInfosToArrayInternal(
}
if (!aReadInfos.IsEmpty()) {
if (!JS_SetArrayLength(aCx, array, jsuint(aReadInfos.Length()))) {
if (!JS_SetArrayLength(aCx, array, unsigned(aReadInfos.Length()))) {
NS_WARNING("Failed to set array length!");
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}

Просмотреть файл

@ -410,7 +410,7 @@ IDBDatabase::CreateObjectStore(const nsAString& aName,
JSObject* obj = JSVAL_TO_OBJECT(val);
jsuint length;
unsigned length;
if (!JS_GetArrayLength(aCx, obj, &length)) {
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
@ -421,7 +421,7 @@ IDBDatabase::CreateObjectStore(const nsAString& aName,
keyPathArray.SetCapacity(length);
for (jsuint index = 0; index < length; index++) {
for (unsigned index = 0; index < length; index++) {
jsval val;
JSString* jsstr;
nsDependentJSString str;
@ -566,7 +566,7 @@ IDBDatabase::Transaction(const jsval& aStoreNames,
// See if this is a JS array.
if (JS_IsArrayObject(aCx, obj)) {
jsuint length;
unsigned length;
if (!JS_GetArrayLength(aCx, obj, &length)) {
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
@ -577,7 +577,7 @@ IDBDatabase::Transaction(const jsval& aStoreNames,
storesToOpen.SetCapacity(length);
for (jsuint index = 0; index < length; index++) {
for (unsigned index = 0; index < length; index++) {
jsval val;
JSString* jsstr;
nsDependentJSString str;

Просмотреть файл

@ -904,7 +904,7 @@ GetAllKeysHelper::GetSuccessResult(JSContext* aCx,
}
if (!keys.IsEmpty()) {
if (!JS_SetArrayLength(aCx, array, jsuint(keys.Length()))) {
if (!JS_SetArrayLength(aCx, array, unsigned(keys.Length()))) {
NS_WARNING("Failed to set array length!");
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}

Просмотреть файл

@ -618,12 +618,12 @@ IDBObjectStore::AppendIndexUpdateInfo(PRInt64 aIndexID,
if (aMultiEntry && !JSVAL_IS_PRIMITIVE(key) &&
JS_IsArrayObject(aCx, JSVAL_TO_OBJECT(key))) {
JSObject* array = JSVAL_TO_OBJECT(key);
jsuint arrayLength;
unsigned arrayLength;
if (!JS_GetArrayLength(aCx, array, &arrayLength)) {
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
for (jsuint arrayIndex = 0; arrayIndex < arrayLength; arrayIndex++) {
for (unsigned arrayIndex = 0; arrayIndex < arrayLength; arrayIndex++) {
jsval arrayItem;
if (!JS_GetElement(aCx, array, arrayIndex, &arrayItem)) {
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
@ -1700,7 +1700,7 @@ IDBObjectStore::CreateIndex(const nsAString& aName,
JSObject* obj = JSVAL_TO_OBJECT(aKeyPath);
jsuint length;
unsigned length;
if (!JS_GetArrayLength(aCx, obj, &length)) {
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
@ -1711,7 +1711,7 @@ IDBObjectStore::CreateIndex(const nsAString& aName,
keyPathArray.SetCapacity(length);
for (jsuint index = 0; index < length; index++) {
for (unsigned index = 0; index < length; index++) {
jsval val;
JSString* jsstr;
nsDependentJSString str;

Просмотреть файл

@ -170,12 +170,12 @@ Key::EncodeJSVal(JSContext* aCx, const jsval aVal, PRUint8 aTypeOffset)
aTypeOffset < (eMaxType * MaxArrayCollapse),
"Wrong typeoffset");
jsuint length;
unsigned length;
if (!JS_GetArrayLength(aCx, obj, &length)) {
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
for (jsuint index = 0; index < length; index++) {
for (unsigned index = 0; index < length; index++) {
jsval val;
if (!JS_GetElement(aCx, obj, index, &val)) {
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
@ -220,7 +220,7 @@ Key::DecodeJSVal(const unsigned char*& aPos, const unsigned char* aEnd,
aTypeOffset = 0;
}
jsuint index = 0;
unsigned index = 0;
while (aPos < aEnd && *aPos - aTypeOffset != eTerminator) {
jsval val;
nsresult rv = DecodeJSVal(aPos, aEnd, aCx, aTypeOffset, &val);

Просмотреть файл

@ -190,12 +190,12 @@ SmsFilter::SetNumbers(JSContext* aCx, const jsval& aNumbers)
return NS_ERROR_INVALID_ARG;
}
jsuint size;
unsigned size;
JS_ALWAYS_TRUE(JS_GetArrayLength(aCx, &obj, &size));
nsTArray<nsString> numbers;
for (jsuint i=0; i<size; ++i) {
for (unsigned i=0; i<size; ++i) {
jsval jsNumber;
if (!JS_GetElement(aCx, &obj, i, &jsNumber)) {
return NS_ERROR_INVALID_ARG;

Просмотреть файл

@ -199,12 +199,12 @@ SmsManager::Send(const jsval& aNumber, const nsAString& aMessage, jsval* aReturn
// Must be an array then.
JSObject& numbers = aNumber.toObject();
jsuint size;
unsigned size;
JS_ALWAYS_TRUE(JS_GetArrayLength(cx, &numbers, &size));
jsval* requests = new jsval[size];
for (jsuint i=0; i<size; ++i) {
for (unsigned i=0; i<size; ++i) {
jsval number;
if (!JS_GetElement(cx, &numbers, i, &number)) {
return NS_ERROR_INVALID_ARG;

Просмотреть файл

@ -506,11 +506,11 @@ ObjectWrapperChild::AnswerNewEnumerateNext(const JSVariant& in_state,
jsval v = JS_GetReservedSlot(state, sNextIdIndexSlot);
jsuint i = JSVAL_TO_INT(v);
int32_t i = JSVAL_TO_INT(v);
NS_ASSERTION(i >= 0, "Index of next jsid negative?");
NS_ASSERTION(i <= strIds->Length(), "Index of next jsid too large?");
if (jsuint(i) == strIds->Length()) {
if (size_t(i) == strIds->Length()) {
*status = JS_TRUE;
return JSObject_to_JSVariant(cx, NULL, statep);
}

Просмотреть файл

@ -1574,7 +1574,7 @@ jsvalToPtrExplicit(JSContext* cx, jsval val, uintptr_t* result)
template<class IntegerType, class CharType, size_t N, class AP>
void
IntegerToString(IntegerType i, jsuint radix, Vector<CharType, N, AP>& result)
IntegerToString(IntegerType i, int radix, Vector<CharType, N, AP>& result)
{
JS_STATIC_ASSERT(numeric_limits<IntegerType>::is_exact);
@ -1955,7 +1955,7 @@ ImplicitConvert(JSContext* cx,
JS_IsArrayObject(cx, JSVAL_TO_OBJECT(val))) {
// Convert each element of the array by calling ImplicitConvert.
JSObject* sourceArray = JSVAL_TO_OBJECT(val);
jsuint sourceLength;
unsigned sourceLength;
if (!JS_GetArrayLength(cx, sourceArray, &sourceLength) ||
targetLength != size_t(sourceLength)) {
JS_ReportError(cx, "ArrayType length does not match source array length");
@ -1971,7 +1971,7 @@ ImplicitConvert(JSContext* cx,
return false;
}
for (jsuint i = 0; i < sourceLength; ++i) {
for (unsigned i = 0; i < sourceLength; ++i) {
js::AutoValueRooter item(cx);
if (!JS_GetElement(cx, sourceArray, i, item.jsval_addr()))
return false;
@ -4112,7 +4112,7 @@ StructType::Create(JSContext* cx, unsigned argc, jsval* vp)
JSBool
StructType::DefineInternal(JSContext* cx, JSObject* typeObj, JSObject* fieldsObj)
{
jsuint len;
unsigned len;
ASSERT_OK(JS_GetArrayLength(cx, fieldsObj, &len));
// Get the common prototype for CData objects of this type from
@ -4150,7 +4150,7 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj, JSObject* fieldsObj
structSize = 0;
structAlign = 0;
for (jsuint i = 0; i < len; ++i) {
for (unsigned i = 0; i < len; ++i) {
js::AutoValueRooter item(cx);
if (!JS_GetElement(cx, fieldsObj, i, item.jsval_addr()))
return JS_FALSE;
@ -4925,7 +4925,7 @@ FunctionType::Create(JSContext* cx, unsigned argc, jsval* vp)
}
arrayObj = JSVAL_TO_OBJECT(argv[2]);
jsuint len;
unsigned len;
ASSERT_OK(JS_GetArrayLength(cx, arrayObj, &len));
if (!argTypes.appendN(JSVAL_VOID, len)) {
@ -4937,7 +4937,7 @@ FunctionType::Create(JSContext* cx, unsigned argc, jsval* vp)
// Pull out the argument types from the array, if any.
JS_ASSERT(!argTypes.length() || arrayObj);
js::AutoArrayRooter items(cx, argTypes.length(), argTypes.begin());
for (jsuint i = 0; i < argTypes.length(); ++i) {
for (unsigned i = 0; i < argTypes.length(); ++i) {
if (!JS_GetElement(cx, arrayObj, i, &argTypes[i]))
return JS_FALSE;
}
@ -4956,7 +4956,7 @@ FunctionType::CreateInternal(JSContext* cx,
jsval abi,
jsval rtype,
jsval* argtypes,
jsuint arglen)
unsigned arglen)
{
// Determine and check the types, and prepare the function CIF.
AutoPtr<FunctionInfo> fninfo(NewFunctionInfo(cx, abi, rtype, argtypes, arglen));
@ -5109,7 +5109,7 @@ FunctionType::Call(JSContext* cx,
}
jsval* argv = JS_ARGV(cx, vp);
for (jsuint i = 0; i < argcFixed; ++i)
for (unsigned i = 0; i < argcFixed; ++i)
if (!ConvertArgument(cx, argv[i], fninfo->mArgTypes[i], &values[i], &strings))
return false;
@ -6044,7 +6044,7 @@ Int64Base::ToString(JSContext* cx,
return JS_FALSE;
}
jsuint radix = 10;
int radix = 10;
if (argc == 1) {
jsval arg = JS_ARGV(cx, vp)[0];
if (JSVAL_IS_INT(arg))

Просмотреть файл

@ -496,7 +496,7 @@ namespace StructType {
namespace FunctionType {
JSObject* CreateInternal(JSContext* cx, jsval abi, jsval rtype,
jsval* argtypes, jsuint arglen);
jsval* argtypes, unsigned arglen);
JSObject* ConstructWithObject(JSContext* cx, JSObject* typeObj,
JSObject* refObj, PRFuncPtr fnptr, JSObject* result);

Просмотреть файл

@ -1010,7 +1010,7 @@ BytecodeEmitter::shouldNoteClosedName(ParseNode *pn)
static int
AdjustBlockSlot(JSContext *cx, BytecodeEmitter *bce, int slot)
{
JS_ASSERT((jsuint) slot < bce->maxStackDepth);
JS_ASSERT((unsigned) slot < bce->maxStackDepth);
if (bce->inFunction()) {
slot += bce->bindings.countVars();
if ((unsigned) slot >= SLOTNO_LIMIT) {
@ -2468,7 +2468,7 @@ EmitSwitch(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
continue;
}
i = pn3->pn_pval->toInt32();
if ((jsuint)(i + (int)JS_BIT(15)) >= (jsuint)JS_BIT(16)) {
if ((unsigned)(i + (int)JS_BIT(15)) >= (unsigned)JS_BIT(16)) {
switchOp = JSOP_LOOKUPSWITCH;
continue;
}
@ -3068,7 +3068,7 @@ EmitDestructuringOpsHelper(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn,
{
JS_ASSERT(emitOption != DefineVars);
jsuint index;
unsigned index;
ParseNode *pn2, *pn3;
JSBool doElemOp;
@ -3303,7 +3303,7 @@ static JSBool
EmitGroupAssignment(JSContext *cx, BytecodeEmitter *bce, JSOp prologOp,
ParseNode *lhs, ParseNode *rhs)
{
jsuint depth, limit, i, nslots;
unsigned depth, limit, i, nslots;
ParseNode *pn;
depth = limit = (unsigned) bce->stackDepth;

Просмотреть файл

@ -6810,7 +6810,7 @@ Parser::primaryExpr(TokenKind tt, bool afterDoubleDot)
case TOK_LB:
{
JSBool matched;
jsuint index;
unsigned index;
pn = ListNode::create(PNK_RB, tc);
if (!pn)

Просмотреть файл

@ -8,14 +8,14 @@
static JSGCCallback oldGCCallback;
static void **checkPointers;
static jsuint checkPointersLength;
static unsigned checkPointersLength;
static size_t checkPointersStaticStrings;
static JSBool
TestAboutToBeFinalizedCallback(JSContext *cx, JSGCStatus status)
{
if (status == JSGC_MARK_END && checkPointers) {
for (jsuint i = 0; i != checkPointersLength; ++i) {
for (unsigned i = 0; i != checkPointersLength; ++i) {
void *p = checkPointers[i];
JS_ASSERT(p);
if (JS_IsAboutToBeFinalized(p))
@ -52,7 +52,7 @@ BEGIN_TEST(testIsAboutToBeFinalized_bug528645)
JS_GC(cx);
/* Everything is unrooted except unit strings. */
for (jsuint i = 0; i != checkPointersLength; ++i) {
for (unsigned i = 0; i != checkPointersLength; ++i) {
void *p = checkPointers[i];
if (p) {
CHECK(JSString::isStatic(p));
@ -97,7 +97,7 @@ cls_testIsAboutToBeFinalized_bug528645::createAndTestRooted()
CHECK(checkPointers);
checkPointersStaticStrings = 0;
for (jsuint i = 0; i != checkPointersLength; ++i) {
for (unsigned i = 0; i != checkPointersLength; ++i) {
jsval v;
ok = JS_GetElement(cx, array, i, &v);
CHECK(ok);
@ -115,7 +115,7 @@ cls_testIsAboutToBeFinalized_bug528645::createAndTestRooted()
* All GC things are rooted via the root holding the array containing them
* and TestAboutToBeFinalizedCallback must keep them as is.
*/
for (jsuint i = 0; i != checkPointersLength; ++i)
for (unsigned i = 0; i != checkPointersLength; ++i)
CHECK(checkPointers[i]);
/*
@ -127,7 +127,7 @@ cls_testIsAboutToBeFinalized_bug528645::createAndTestRooted()
array = JSVAL_TO_OBJECT(root.value());
JS_ASSERT(JS_IsArrayObject(cx, array));
jsuint tmp;
unsigned tmp;
CHECK(JS_GetArrayLength(cx, array, &tmp));
CHECK(ok);

Просмотреть файл

@ -55,7 +55,7 @@ BEGIN_TEST(testNewObject_1)
CHECK(obj);
jsvalRoot rt(cx, OBJECT_TO_JSVAL(obj));
CHECK(JS_IsArrayObject(cx, obj));
jsuint len;
unsigned len;
CHECK(JS_GetArrayLength(cx, obj, &len));
CHECK_EQUAL(len, 0);

Просмотреть файл

@ -4407,9 +4407,9 @@ JS_NewArrayObject(JSContext *cx, int length, jsval *vector)
JS_THREADSAFE_ASSERT(cx->compartment != cx->runtime->atomsCompartment);
AssertNoGC(cx);
CHECK_REQUEST(cx);
/* NB: jsuint cast does ToUint32. */
assertSameCompartment(cx, JSValueArray(vector, vector ? (jsuint)length : 0));
return NewDenseCopiedArray(cx, (jsuint)length, vector);
assertSameCompartment(cx, JSValueArray(vector, vector ? (unsigned)length : 0));
return NewDenseCopiedArray(cx, (unsigned)length, vector);
}
JS_PUBLIC_API(JSBool)
@ -4420,7 +4420,7 @@ JS_IsArrayObject(JSContext *cx, JSObject *obj)
}
JS_PUBLIC_API(JSBool)
JS_GetArrayLength(JSContext *cx, JSObject *obj, jsuint *lengthp)
JS_GetArrayLength(JSContext *cx, JSObject *obj, unsigned *lengthp)
{
AssertNoGC(cx);
CHECK_REQUEST(cx);
@ -4429,7 +4429,7 @@ JS_GetArrayLength(JSContext *cx, JSObject *obj, jsuint *lengthp)
}
JS_PUBLIC_API(JSBool)
JS_SetArrayLength(JSContext *cx, JSObject *obj, jsuint length)
JS_SetArrayLength(JSContext *cx, JSObject *obj, unsigned length)
{
AssertNoGC(cx);
CHECK_REQUEST(cx);

Просмотреть файл

@ -1896,8 +1896,8 @@ JSID_TO_INT(jsid id)
static JS_ALWAYS_INLINE JSBool
INT_FITS_IN_JSID(int32_t i)
{
return ((jsuint)(i) - (jsuint)JSID_INT_MIN <=
(jsuint)(JSID_INT_MAX - JSID_INT_MIN));
return ((unsigned)(i) - (unsigned)JSID_INT_MIN <=
(unsigned)(JSID_INT_MAX - JSID_INT_MIN));
}
static JS_ALWAYS_INLINE jsid
@ -3986,10 +3986,10 @@ extern JS_PUBLIC_API(JSBool)
JS_IsArrayObject(JSContext *cx, JSObject *obj);
extern JS_PUBLIC_API(JSBool)
JS_GetArrayLength(JSContext *cx, JSObject *obj, jsuint *lengthp);
JS_GetArrayLength(JSContext *cx, JSObject *obj, unsigned *lengthp);
extern JS_PUBLIC_API(JSBool)
JS_SetArrayLength(JSContext *cx, JSObject *obj, jsuint length);
JS_SetArrayLength(JSContext *cx, JSObject *obj, unsigned length);
extern JS_PUBLIC_API(JSBool)
JS_DefineElement(JSContext *cx, JSObject *obj, uint32_t index, jsval value,

Просмотреть файл

@ -148,7 +148,7 @@ using namespace js::gc;
using namespace js::types;
JSBool
js_GetLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp)
js_GetLengthProperty(JSContext *cx, JSObject *obj, unsigned *lengthp)
{
if (obj->isArray()) {
*lengthp = obj->getArrayLength();
@ -168,11 +168,11 @@ js_GetLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp)
return false;
if (tvr.value().isInt32()) {
*lengthp = jsuint(tvr.value().toInt32()); /* jsuint cast does ToUint32_t */
*lengthp = unsigned(tvr.value().toInt32()); /* unsigned cast does ToUint32_t */
return true;
}
JS_STATIC_ASSERT(sizeof(jsuint) == sizeof(uint32_t));
return ToUint32(cx, tvr.value(), (uint32_t *)lengthp);
}
@ -198,7 +198,7 @@ namespace js {
*
*/
JS_FRIEND_API(bool)
StringIsArrayIndex(JSLinearString *str, jsuint *indexp)
StringIsArrayIndex(JSLinearString *str, unsigned *indexp)
{
const jschar *s = str->chars();
uint32_t length = str->length();
@ -237,10 +237,10 @@ StringIsArrayIndex(JSLinearString *str, jsuint *indexp)
}
static JSBool
BigIndexToId(JSContext *cx, JSObject *obj, jsuint index, JSBool createAtom,
BigIndexToId(JSContext *cx, JSObject *obj, unsigned index, JSBool createAtom,
jsid *idp)
{
JS_STATIC_ASSERT((jsuint)-1 == 4294967295U);
JS_ASSERT(index > JSID_INT_MAX);
jschar buf[10];
@ -319,8 +319,8 @@ IndexToId(JSContext* cx, JSObject* obj, double index, JSBool* hole, jsid* idp,
return JS_TRUE;
}
if (index <= jsuint(-1)) {
if (!BigIndexToId(cx, obj, jsuint(index), createAtom, idp))
if (index <= unsigned(-1)) {
if (!BigIndexToId(cx, obj, unsigned(index), createAtom, idp))
return JS_FALSE;
if (hole && JSID_IS_VOID(*idp))
*hole = JS_TRUE;
@ -438,7 +438,7 @@ GetElementsSlow(JSContext *cx, JSObject *aobj, uint32_t length, Value *vp)
}
bool
GetElements(JSContext *cx, JSObject *aobj, jsuint length, Value *vp)
GetElements(JSContext *cx, JSObject *aobj, unsigned length, Value *vp)
{
if (aobj->isDenseArray() && length <= aobj->getDenseArrayInitializedLength() &&
!js_PrototypeHasIndexedProperties(cx, aobj)) {
@ -476,9 +476,9 @@ SetArrayElement(JSContext *cx, JSObject *obj, double index, const Value &v)
/* Predicted/prefetched code should favor the remains-dense case. */
JSObject::EnsureDenseResult result = JSObject::ED_SPARSE;
do {
if (index > jsuint(-1))
if (index > unsigned(-1))
break;
jsuint idx = jsuint(index);
unsigned idx = unsigned(index);
result = obj->ensureDenseArrayElements(cx, idx, 1);
if (result != JSObject::ED_OK)
break;
@ -630,8 +630,8 @@ array_length_setter(JSContext *cx, JSObject *obj, jsid id, JSBool strict, Value
* us to disregard length when reading from arrays as long we are within
* the initialized capacity.
*/
jsuint oldcap = obj->getDenseArrayCapacity();
jsuint oldinit = obj->getDenseArrayInitializedLength();
unsigned oldcap = obj->getDenseArrayCapacity();
unsigned oldinit = obj->getDenseArrayInitializedLength();
if (oldinit > newlen)
obj->setDenseArrayInitializedLength(newlen);
if (oldcap > newlen)
@ -661,13 +661,13 @@ array_length_setter(JSContext *cx, JSObject *obj, jsid id, JSBool strict, Value
if (!iter)
return false;
jsuint gap = oldlen - newlen;
unsigned gap = oldlen - newlen;
for (;;) {
if (!JS_CHECK_OPERATION_LIMIT(cx) || !JS_NextProperty(cx, iter, &id))
return false;
if (JSID_IS_VOID(id))
break;
jsuint index;
unsigned index;
Value junk;
if (js_IdIsIndex(id, &index) && index - newlen < gap &&
!obj->deleteElement(cx, index, &junk, false)) {
@ -864,7 +864,7 @@ array_getGeneric(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Valu
static JSBool
slowarray_addProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
{
jsuint index, length;
unsigned index, length;
if (!js_IdIsIndex(id, &index))
return JS_TRUE;
@ -1489,11 +1489,11 @@ array_toSource(JSContext *cx, unsigned argc, Value *vp)
if (!sb.append('['))
return false;
jsuint length;
unsigned length;
if (!js_GetLengthProperty(cx, obj, &length))
return false;
for (jsuint index = 0; index < length; index++) {
for (unsigned index = 0; index < length; index++) {
JSBool hole;
Value elt;
if (!JS_CHECK_OPERATION_LIMIT(cx) ||
@ -1609,7 +1609,7 @@ array_toString_sub(JSContext *cx, JSObject *obj, JSBool locale,
return true;
}
jsuint length;
unsigned length;
if (!js_GetLengthProperty(cx, obj, &length))
return false;
@ -1650,7 +1650,7 @@ array_toString_sub(JSContext *cx, JSObject *obj, JSBool locale,
}
}
} else {
for (jsuint index = 0; index < length; index++) {
for (unsigned index = 0; index < length; index++) {
if (!JS_CHECK_OPERATION_LIMIT(cx))
return false;
@ -1794,7 +1794,7 @@ InitArrayElements(JSContext *cx, JSObject *obj, uint32_t start, uint32_t count,
JS_ASSERT(result == JSObject::ED_SPARSE);
break;
}
jsuint newlen = start + count;
unsigned newlen = start + count;
if (newlen > obj->getArrayLength())
obj->setDenseArrayLength(newlen);
@ -1837,7 +1837,7 @@ InitArrayElements(JSContext *cx, JSObject *obj, uint32_t start, uint32_t count,
#if 0
static JSBool
InitArrayObject(JSContext *cx, JSObject *obj, jsuint length, const Value *vector)
InitArrayObject(JSContext *cx, JSObject *obj, unsigned length, const Value *vector)
{
JS_ASSERT(obj->isArray());
@ -1856,7 +1856,7 @@ InitArrayObject(JSContext *cx, JSObject *obj, jsuint length, const Value *vector
obj->setDenseArrayInitializedLength(length);
bool hole = false;
for (jsuint i = 0; i < length; i++) {
for (unsigned i = 0; i < length; i++) {
obj->setDenseArrayElement(i, vector[i]);
hole |= vector[i].isMagic(JS_ARRAY_HOLE);
}
@ -1899,7 +1899,7 @@ array_reverse(JSContext *cx, unsigned argc, Value *vp)
if (!obj)
return false;
jsuint len;
unsigned len;
if (!js_GetLengthProperty(cx, obj, &len))
return false;
@ -1961,7 +1961,7 @@ array_reverse(JSContext *cx, unsigned argc, Value *vp)
} while (false);
Value lowval, hival;
for (jsuint i = 0, half = len / 2; i < half; i++) {
for (unsigned i = 0, half = len / 2; i < half; i++) {
JSBool hole, hole2;
if (!JS_CHECK_OPERATION_LIMIT(cx) ||
!GetElement(cx, obj, i, &hole, &lowval) ||
@ -2203,7 +2203,7 @@ js::array_sort(JSContext *cx, unsigned argc, Value *vp)
if (!obj)
return false;
jsuint len;
unsigned len;
if (!js_GetLengthProperty(cx, obj, &len))
return false;
if (len == 0) {
@ -2250,7 +2250,7 @@ js::array_sort(JSContext *cx, unsigned argc, Value *vp)
undefs = 0;
bool allStrings = true;
bool allInts = true;
for (jsuint i = 0; i < len; i++) {
for (unsigned i = 0; i < len; i++) {
if (!JS_CHECK_OPERATION_LIMIT(cx))
return false;
@ -2341,7 +2341,7 @@ js::array_sort(JSContext *cx, unsigned argc, Value *vp)
}
}
if (!InitArrayElements(cx, obj, 0, jsuint(n), result, DontUpdateTypes))
if (!InitArrayElements(cx, obj, 0, unsigned(n), result, DontUpdateTypes))
return false;
}
@ -2367,7 +2367,7 @@ js::array_sort(JSContext *cx, unsigned argc, Value *vp)
static bool
array_push_slowly(JSContext *cx, JSObject *obj, CallArgs &args)
{
jsuint length;
unsigned length;
if (!js_GetLengthProperty(cx, obj, &length))
return false;
@ -2451,7 +2451,7 @@ js::array_push(JSContext *cx, unsigned argc, Value *vp)
static JSBool
array_pop_slowly(JSContext *cx, JSObject* obj, CallArgs &args)
{
jsuint index;
unsigned index;
if (!js_GetLengthProperty(cx, obj, &index))
return false;
@ -2477,7 +2477,7 @@ array_pop_slowly(JSContext *cx, JSObject* obj, CallArgs &args)
static JSBool
array_pop_dense(JSContext *cx, JSObject* obj, CallArgs &args)
{
jsuint index = obj->getArrayLength();
unsigned index = obj->getArrayLength();
if (index == 0) {
args.rval().setUndefined();
return JS_TRUE;
@ -2538,7 +2538,7 @@ js::array_shift(JSContext *cx, unsigned argc, Value *vp)
if (!obj)
return JS_FALSE;
jsuint length;
unsigned length;
if (!js_GetLengthProperty(cx, obj, &length))
return JS_FALSE;
@ -2567,7 +2567,7 @@ js::array_shift(JSContext *cx, unsigned argc, Value *vp)
/* Slide down the array above the first element. */
AutoValueRooter tvr(cx);
for (jsuint i = 0; i < length; i++) {
for (unsigned i = 0; i < length; i++) {
if (!JS_CHECK_OPERATION_LIMIT(cx) ||
!GetElement(cx, obj, i + 1, &hole, tvr.addr()) ||
!SetOrDeleteArrayElement(cx, obj, i, hole, tvr.value())) {
@ -2590,7 +2590,7 @@ array_unshift(JSContext *cx, unsigned argc, Value *vp)
if (!obj)
return false;
jsuint length;
unsigned length;
if (!js_GetLengthProperty(cx, obj, &length))
return JS_FALSE;
@ -2936,11 +2936,11 @@ js::array_concat(JSContext *cx, unsigned argc, Value *vp)
return false;
JSObject *nobj;
jsuint length;
unsigned length;
if (aobj->isDenseArray()) {
length = aobj->getArrayLength();
const Value *vector = aobj->getDenseArrayElements();
jsuint initlen = aobj->getDenseArrayInitializedLength();
unsigned initlen = aobj->getDenseArrayInitializedLength();
nobj = NewDenseCopiedArray(cx, initlen, vector);
if (!nobj)
return JS_FALSE;
@ -2967,7 +2967,7 @@ js::array_concat(JSContext *cx, unsigned argc, Value *vp)
if (v.isObject()) {
JSObject &obj = v.toObject();
if (ObjectClassIs(obj, ESClass_Array, cx)) {
jsuint alength;
unsigned alength;
if (!js_GetLengthProperty(cx, &obj, &alength))
return false;
for (uint32_t slot = 0; slot < alength; slot++) {
@ -3000,7 +3000,7 @@ static JSBool
array_slice(JSContext *cx, unsigned argc, Value *vp)
{
JSObject *nobj;
jsuint length, begin, end, slot;
unsigned length, begin, end, slot;
JSBool hole;
CallArgs args = CallArgsFromVp(argc, vp);
@ -3025,7 +3025,7 @@ array_slice(JSContext *cx, unsigned argc, Value *vp)
} else if (d > length) {
d = length;
}
begin = (jsuint)d;
begin = (unsigned)d;
if (args.hasDefined(1)) {
if (!ToInteger(cx, args[1], &d))
@ -3037,7 +3037,7 @@ array_slice(JSContext *cx, unsigned argc, Value *vp)
} else if (d > length) {
d = length;
}
end = (jsuint)d;
end = (unsigned)d;
}
}
@ -3081,7 +3081,7 @@ enum IndexOfKind {
static JSBool
array_indexOfHelper(JSContext *cx, IndexOfKind mode, CallArgs &args)
{
jsuint length, i, stop;
unsigned length, i, stop;
Value tosearch;
int direction;
JSBool hole;
@ -3110,14 +3110,14 @@ array_indexOfHelper(JSContext *cx, IndexOfKind mode, CallArgs &args)
goto not_found;
i = 0;
} else {
i = (jsuint)start;
i = (unsigned)start;
}
} else if (start >= length) {
if (mode == IndexOf)
goto not_found;
i = length - 1;
} else {
i = (jsuint)start;
i = (unsigned)start;
}
}
@ -3132,7 +3132,7 @@ array_indexOfHelper(JSContext *cx, IndexOfKind mode, CallArgs &args)
for (;;) {
Value elt;
if (!JS_CHECK_OPERATION_LIMIT(cx) ||
!GetElement(cx, obj, (jsuint)i, &hole, &elt)) {
!GetElement(cx, obj, (unsigned)i, &hole, &elt)) {
return JS_FALSE;
}
if (!hole) {
@ -3736,7 +3736,7 @@ js_InitArrayClass(JSContext *cx, JSObject *obj)
namespace js {
static inline bool
EnsureNewArrayElements(JSContext *cx, JSObject *obj, jsuint length)
EnsureNewArrayElements(JSContext *cx, JSObject *obj, unsigned length)
{
/*
* If ensureElements creates dynamically allocated slots, then having

Просмотреть файл

@ -57,13 +57,13 @@ const uint32_t MAX_ARRAY_INDEX = 4294967294u;
}
inline JSBool
js_IdIsIndex(jsid id, jsuint *indexp)
js_IdIsIndex(jsid id, unsigned *indexp)
{
if (JSID_IS_INT(id)) {
int32_t i = JSID_TO_INT(id);
if (i < 0)
return JS_FALSE;
*indexp = (jsuint)i;
*indexp = (unsigned)i;
return JS_TRUE;
}
@ -137,7 +137,7 @@ NewSlowEmptyArray(JSContext *cx);
} /* namespace js */
extern JSBool
js_GetLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp);
js_GetLengthProperty(JSContext *cx, JSObject *obj, unsigned *lengthp);
extern JSBool
js_SetLengthProperty(JSContext *cx, JSObject *obj, double length);
@ -158,7 +158,7 @@ array_deleteElement(JSContext *cx, JSObject *obj, uint32_t index, Value *rval, J
* js_GetLengthProperty on aobj.
*/
extern bool
GetElements(JSContext *cx, JSObject *aobj, jsuint length, js::Value *vp);
GetElements(JSContext *cx, JSObject *aobj, unsigned length, js::Value *vp);
/* Natives exposed for optimization by the interpreter and JITs. */

Просмотреть файл

@ -712,9 +712,9 @@ js_CheckForStringIndex(jsid id)
const jschar *cp = s;
const jschar *end = s + n;
jsuint index = JS7_UNDEC(*cp++);
jsuint oldIndex = 0;
jsuint c = 0;
unsigned index = JS7_UNDEC(*cp++);
unsigned oldIndex = 0;
unsigned c = 0;
if (index != 0) {
while (JS7_ISDEC(*cp)) {

Просмотреть файл

@ -498,7 +498,7 @@ JS_FRIEND_API(bool)
GetPropertyNames(JSContext *cx, JSObject *obj, unsigned flags, js::AutoIdVector *props);
JS_FRIEND_API(bool)
StringIsArrayIndex(JSLinearString *str, jsuint *indexp);
StringIsArrayIndex(JSLinearString *str, unsigned *indexp);
JS_FRIEND_API(void)
SetPreserveWrapperCallback(JSRuntime *rt, PreserveWrapperCallback callback);

Просмотреть файл

@ -1296,7 +1296,7 @@ js_fun_apply(JSContext *cx, unsigned argc, Value *vp)
* original version of ES5).
*/
JSObject *aobj = &vp[3].toObject();
jsuint length;
unsigned length;
if (!js_GetLengthProperty(cx, aobj, &length))
return false;

Просмотреть файл

@ -664,7 +664,7 @@ Chunk::init()
info.age = 0;
/* Initialize the arena header state. */
for (jsuint i = 0; i < ArenasPerChunk; i++) {
for (unsigned i = 0; i < ArenasPerChunk; i++) {
arenas[i].aheader.setAsNotAllocated();
arenas[i].aheader.next = (i + 1 < ArenasPerChunk)
? &arenas[i + 1].aheader
@ -724,14 +724,14 @@ Chunk::removeFromAvailableList()
* it to the most recently freed arena when we free, and forcing it to
* the last alloc + 1 when we allocate.
*/
jsuint
unsigned
Chunk::findDecommittedArenaOffset()
{
/* Note: lastFreeArenaOffset can be past the end of the list. */
for (jsuint i = info.lastDecommittedArenaOffset; i < ArenasPerChunk; i++)
for (unsigned i = info.lastDecommittedArenaOffset; i < ArenasPerChunk; i++)
if (decommittedArenas.get(i))
return i;
for (jsuint i = 0; i < info.lastDecommittedArenaOffset; i++)
for (unsigned i = 0; i < info.lastDecommittedArenaOffset; i++)
if (decommittedArenas.get(i))
return i;
JS_NOT_REACHED("No decommitted arenas found.");
@ -744,7 +744,7 @@ Chunk::fetchNextDecommittedArena()
JS_ASSERT(info.numArenasFreeCommitted == 0);
JS_ASSERT(info.numArenasFree > 0);
jsuint offset = findDecommittedArenaOffset();
unsigned offset = findDecommittedArenaOffset();
info.lastDecommittedArenaOffset = offset + 1;
--info.numArenasFree;
decommittedArenas.unset(offset);

Просмотреть файл

@ -808,7 +808,7 @@ struct Chunk {
inline void init();
/* Search for a decommitted arena to allocate. */
jsuint findDecommittedArenaOffset();
unsigned findDecommittedArenaOffset();
ArenaHeader* fetchNextDecommittedArena();
public:

Просмотреть файл

@ -2905,7 +2905,7 @@ BEGIN_CASE(JSOP_TABLESWITCH)
int32_t high = GET_JUMP_OFFSET(pc2);
i -= low;
if ((jsuint)i < (jsuint)(high - low + 1)) {
if ((unsigned)i < (unsigned)(high - low + 1)) {
pc2 += JUMP_OFFSET_LEN + JUMP_OFFSET_LEN * i;
int32_t off = (int32_t) GET_JUMP_OFFSET(pc2);
if (off)
@ -3557,9 +3557,9 @@ BEGIN_CASE(JSOP_INITELEM)
if (rref.isMagic(JS_ARRAY_HOLE)) {
JS_ASSERT(obj->isArray());
JS_ASSERT(JSID_IS_INT(id));
JS_ASSERT(jsuint(JSID_TO_INT(id)) < StackSpace::ARGS_LENGTH_MAX);
JS_ASSERT(unsigned(JSID_TO_INT(id)) < StackSpace::ARGS_LENGTH_MAX);
if (JSOp(regs.pc[JSOP_INITELEM_LENGTH]) == JSOP_ENDINIT &&
!js_SetLengthProperty(cx, obj, (jsuint) (JSID_TO_INT(id) + 1))) {
!js_SetLengthProperty(cx, obj, (unsigned) (JSID_TO_INT(id) + 1))) {
goto error;
}
} else {

Просмотреть файл

@ -232,7 +232,7 @@ GetPropertyOperation(JSContext *cx, jsbytecode *pc, const Value &lval, Value *vp
if (lval.isObject()) {
JSObject *obj = &lval.toObject();
if (obj->isArray()) {
jsuint length = obj->getArrayLength();
unsigned length = obj->getArrayLength();
*vp = NumberValue(length);
return true;
}
@ -804,13 +804,13 @@ SetObjectElementOperation(JSContext *cx, JSObject *obj, jsid id, const Value &va
do {
if (obj->isDenseArray() && JSID_IS_INT(id)) {
jsuint length = obj->getDenseArrayInitializedLength();
unsigned length = obj->getDenseArrayInitializedLength();
int32_t i = JSID_TO_INT(id);
if ((jsuint)i < length) {
if ((unsigned)i < length) {
if (obj->getDenseArrayElement(i).isMagic(JS_ARRAY_HOLE)) {
if (js_PrototypeHasIndexedProperties(cx, obj))
break;
if ((jsuint)i >= obj->getArrayLength())
if ((unsigned)i >= obj->getArrayLength())
obj->setArrayLength(cx, i + 1);
}
obj->setDenseArrayElementWithType(cx, i, value);

Просмотреть файл

@ -435,7 +435,7 @@ js_math_min(JSContext *cx, unsigned argc, Value *vp)
static double
powi(double x, int y)
{
jsuint n = (y < 0) ? -y : y;
unsigned n = (y < 0) ? -y : y;
double m = x;
double p = 1;
while (true) {

Просмотреть файл

@ -577,7 +577,7 @@ js_IntToString(JSContext *cx, int32_t si)
static char *
IntToCString(ToCStringBuf *cbuf, int i, int base = 10)
{
jsuint u = (i < 0) ? -i : i;
unsigned u = (i < 0) ? -i : i;
RangedPtr<char> cp(cbuf->sbuf + cbuf->sbufSize - 1, cbuf->sbuf, cbuf->sbufSize);
*cp = '\0';
@ -589,7 +589,7 @@ IntToCString(ToCStringBuf *cbuf, int i, int base = 10)
break;
case 16:
do {
jsuint newu = u / 16;
unsigned newu = u / 16;
*--cp = "0123456789abcdef"[u - newu * 16];
u = newu;
} while (u != 0);
@ -597,7 +597,7 @@ IntToCString(ToCStringBuf *cbuf, int i, int base = 10)
default:
JS_ASSERT(base >= 2 && base <= 36);
do {
jsuint newu = u / base;
unsigned newu = u / base;
*--cp = "0123456789abcdefghijklmnopqrstuvwxyz"[u - newu * base];
u = newu;
} while (u != 0);
@ -1127,7 +1127,7 @@ js_NumberToStringWithBase(JSContext *cx, double d, int base)
if (JSDOUBLE_IS_INT32(d, &i)) {
if (base == 10 && StaticStrings::hasInt(i))
return cx->runtime->staticStrings.getInt(i);
if (jsuint(i) < jsuint(base)) {
if (unsigned(i) < unsigned(base)) {
if (i < 10)
return cx->runtime->staticStrings.getInt(i);
jschar c = 'a' + i - 10;
@ -1346,7 +1346,7 @@ ValueToUint16Slow(JSContext *cx, const Value &v, uint16_t *out)
bool neg = (d < 0);
d = floor(neg ? -d : d);
d = neg ? -d : d;
jsuint m = JS_BIT(16);
unsigned m = JS_BIT(16);
d = fmod(d, (double) m);
if (d < 0)
d += m;

Просмотреть файл

@ -2194,7 +2194,7 @@ DefinePropertyOnArray(JSContext *cx, JSObject *obj, const jsid &id, const PropDe
if (obj->isDenseArray() && !obj->makeDenseArraySlow(cx))
return JS_FALSE;
jsuint oldLen = obj->getArrayLength();
unsigned oldLen = obj->getArrayLength();
if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom)) {
/*

Просмотреть файл

@ -500,7 +500,7 @@ JA(JSContext *cx, JSObject *obj, StringifyContext *scx)
return JS_FALSE;
/* Step 6. */
jsuint length;
unsigned length;
if (!js_GetLengthProperty(cx, obj, &length))
return JS_FALSE;
@ -649,7 +649,7 @@ js_Stringify(JSContext *cx, Value *vp, JSObject *replacer, Value space, StringBu
*/
/* Step 4b(ii). */
jsuint len;
unsigned len;
JS_ALWAYS_TRUE(js_GetLengthProperty(cx, replacer, &len));
if (replacer->isDenseArray())
len = JS_MIN(len, replacer->getDenseArrayCapacity());
@ -659,7 +659,7 @@ js_Stringify(JSContext *cx, Value *vp, JSObject *replacer, Value space, StringBu
return false;
/* Step 4b(iii). */
jsuint i = 0;
unsigned i = 0;
/* Step 4b(iv). */
for (; i < len; i++) {

Просмотреть файл

@ -1825,7 +1825,7 @@ GetLocal(SprintStack *ss, int i)
if (obj->isBlock()) {
uint32_t depth = obj->asBlock().stackDepth();
uint32_t count = obj->asBlock().slotCount();
if (jsuint(i - depth) < jsuint(count))
if (unsigned(i - depth) < unsigned(count))
return GetLocalInSlot(ss, i, int(i - depth), obj);
}
}
@ -1838,7 +1838,7 @@ GetLocal(SprintStack *ss, int i)
if (obj->isBlock()) {
uint32_t depth = obj->asBlock().stackDepth();
uint32_t count = obj->asBlock().slotCount();
if (jsuint(i - depth) < jsuint(count))
if (unsigned(i - depth) < unsigned(count))
return GetLocalInSlot(ss, i, int(i - depth), obj);
}
}

Просмотреть файл

@ -494,11 +494,11 @@ ArrayToIdVector(JSContext *cx, const Value &array, AutoIdVector &props)
return true;
JSObject *obj = &array.toObject();
jsuint length;
unsigned length;
if (!js_GetLengthProperty(cx, obj, &length))
return false;
for (jsuint n = 0; n < length; ++n) {
for (unsigned n = 0; n < length; ++n) {
if (!JS_CHECK_OPERATION_LIMIT(cx))
return false;
Value v;

Просмотреть файл

@ -93,9 +93,6 @@ typedef ptrdiff_t jsid;
JS_BEGIN_EXTERN_C
/* Scalar typedefs. */
typedef uint32_t jsuint;
#ifdef WIN32
typedef wchar_t jschar;
#else

Просмотреть файл

@ -644,7 +644,7 @@ JSObject::addPropertyInternal(JSContext *cx, jsid id,
{
shape = self->lastProperty();
jsuint index;
unsigned index;
bool indexed = js_IdIsIndex(id, &index);
UnownedBaseShape *nbase;
if (shape->base()->matchesGetterSetter(getter, setter) && !indexed) {
@ -758,7 +758,7 @@ JSObject::putProperty(JSContext *cx, jsid id,
RootedVar<UnownedBaseShape*> nbase(cx);
{
jsuint index;
unsigned index;
bool indexed = js_IdIsIndex(id, &index);
StackBaseShape base(self->lastProperty()->base());
base.updateGetterSetter(attrs, getter, setter);

Просмотреть файл

@ -877,31 +877,31 @@ out_of_range:
*
* Return the index of pat in text, or -1 if not found.
*/
static const jsuint sBMHCharSetSize = 256; /* ISO-Latin-1 */
static const jsuint sBMHPatLenMax = 255; /* skip table element is uint8_t */
static const int sBMHBadPattern = -2; /* return value if pat is not ISO-Latin-1 */
static const unsigned sBMHCharSetSize = 256; /* ISO-Latin-1 */
static const unsigned sBMHPatLenMax = 255; /* skip table element is uint8_t */
static const int sBMHBadPattern = -2; /* return value if pat is not ISO-Latin-1 */
int
js_BoyerMooreHorspool(const jschar *text, jsuint textlen,
const jschar *pat, jsuint patlen)
js_BoyerMooreHorspool(const jschar *text, unsigned textlen,
const jschar *pat, unsigned patlen)
{
uint8_t skip[sBMHCharSetSize];
JS_ASSERT(0 < patlen && patlen <= sBMHPatLenMax);
for (jsuint i = 0; i < sBMHCharSetSize; i++)
for (unsigned i = 0; i < sBMHCharSetSize; i++)
skip[i] = (uint8_t)patlen;
jsuint m = patlen - 1;
for (jsuint i = 0; i < m; i++) {
unsigned m = patlen - 1;
for (unsigned i = 0; i < m; i++) {
jschar c = pat[i];
if (c >= sBMHCharSetSize)
return sBMHBadPattern;
skip[c] = (uint8_t)(m - i);
}
jschar c;
for (jsuint k = m;
for (unsigned k = m;
k < textlen;
k += ((c = text[k]) >= sBMHCharSetSize) ? patlen : skip[c]) {
for (jsuint i = k, j = m; ; i--, j--) {
for (unsigned i = k, j = m; ; i--, j--) {
if (text[i] != pat[j])
break;
if (j == 0)
@ -912,8 +912,8 @@ js_BoyerMooreHorspool(const jschar *text, jsuint textlen,
}
struct MemCmp {
typedef jsuint Extent;
static JS_ALWAYS_INLINE Extent computeExtent(const jschar *, jsuint patlen) {
typedef unsigned Extent;
static JS_ALWAYS_INLINE Extent computeExtent(const jschar *, unsigned patlen) {
return (patlen - 1) * sizeof(jschar);
}
static JS_ALWAYS_INLINE bool match(const jschar *p, const jschar *t, Extent extent) {
@ -923,7 +923,7 @@ struct MemCmp {
struct ManualCmp {
typedef const jschar *Extent;
static JS_ALWAYS_INLINE Extent computeExtent(const jschar *pat, jsuint patlen) {
static JS_ALWAYS_INLINE Extent computeExtent(const jschar *pat, unsigned patlen) {
return pat + patlen;
}
static JS_ALWAYS_INLINE bool match(const jschar *p, const jschar *t, Extent extent) {
@ -937,7 +937,7 @@ struct ManualCmp {
template <class InnerMatch>
static int
UnrolledMatch(const jschar *text, jsuint textlen, const jschar *pat, jsuint patlen)
UnrolledMatch(const jschar *text, unsigned textlen, const jschar *pat, unsigned patlen)
{
JS_ASSERT(patlen > 0 && textlen > 0);
const jschar *textend = text + textlen - (patlen - 1);
@ -982,8 +982,8 @@ UnrolledMatch(const jschar *text, jsuint textlen, const jschar *pat, jsuint patl
}
static JS_ALWAYS_INLINE int
StringMatch(const jschar *text, jsuint textlen,
const jschar *pat, jsuint patlen)
StringMatch(const jschar *text, unsigned textlen,
const jschar *pat, unsigned patlen)
{
if (patlen == 0)
return 0;
@ -1046,7 +1046,7 @@ static const size_t sRopeMatchThresholdRatioLog2 = 5;
* the 'match' outparam (-1 for not found).
*/
static bool
RopeMatch(JSContext *cx, JSString *textstr, const jschar *pat, jsuint patlen, int *match)
RopeMatch(JSContext *cx, JSString *textstr, const jschar *pat, unsigned patlen, int *match)
{
JS_ASSERT(textstr->isRope());
@ -1157,21 +1157,21 @@ str_indexOf(JSContext *cx, unsigned argc, Value *vp)
if (!patstr)
return false;
jsuint textlen = str->length();
unsigned textlen = str->length();
const jschar *text = str->getChars(cx);
if (!text)
return false;
jsuint patlen = patstr->length();
unsigned patlen = patstr->length();
const jschar *pat = patstr->chars();
jsuint start;
unsigned start;
if (args.length() > 1) {
if (args[1].isInt32()) {
int i = args[1].toInt32();
if (i <= 0) {
start = 0;
} else if (jsuint(i) > textlen) {
} else if (unsigned(i) > textlen) {
start = textlen;
textlen = 0;
} else {
@ -3957,7 +3957,7 @@ Decode(JSContext *cx, JSString *str, const jschar *reservedSet, Value *rval)
goto report_bad_uri;
if (!JS7_ISHEX(chars[k+1]) || !JS7_ISHEX(chars[k+2]))
goto report_bad_uri;
jsuint B = JS7_UNHEX(chars[k+1]) * 16 + JS7_UNHEX(chars[k+2]);
unsigned B = JS7_UNHEX(chars[k+1]) * 16 + JS7_UNHEX(chars[k+2]);
k += 2;
if (!(B & 0x80)) {
c = (jschar)B;

Просмотреть файл

@ -81,7 +81,7 @@ using namespace js::types;
static const uint8_t ARRAYBUFFER_RESERVED_SLOTS = JSObject::MAX_FIXED_SLOTS - 1;
static bool
ValueIsLength(JSContext *cx, const Value &v, jsuint *len)
ValueIsLength(JSContext *cx, const Value &v, unsigned *len)
{
if (v.isInt32()) {
int32_t i = v.toInt32();
@ -96,7 +96,7 @@ ValueIsLength(JSContext *cx, const Value &v, jsuint *len)
if (JSDOUBLE_IS_NaN(d))
return false;
jsuint length = jsuint(d);
unsigned length = unsigned(d);
if (d != double(length))
return false;
@ -730,9 +730,9 @@ TypedArray::getTypedArray(JSObject *obj)
}
inline bool
TypedArray::isArrayIndex(JSContext *cx, JSObject *obj, jsid id, jsuint *ip)
TypedArray::isArrayIndex(JSContext *cx, JSObject *obj, jsid id, unsigned *ip)
{
jsuint index;
unsigned index;
if (js_IdIsIndex(id, &index) && index < getLength(obj)) {
if (ip)
*ip = index;
@ -1264,7 +1264,7 @@ class TypedArrayTemplate
return true;
}
jsuint index;
unsigned index;
// We can't just chain to js_SetPropertyHelper, because we're not a normal object.
if (!isArrayIndex(cx, tarray, id, &index)) {
// Silent ignore is better than an exception here, because
@ -1509,7 +1509,7 @@ class TypedArrayTemplate
/* N.B. there may not be an argv[-2]/argv[-1]. */
/* () or (number) */
jsuint len = 0;
unsigned len = 0;
if (argc == 0 || ValueIsLength(cx, argv[0], &len)) {
JSObject *bufobj = createBufferWithSizeAndCount(cx, len);
if (!bufobj)
@ -1663,7 +1663,7 @@ class TypedArrayTemplate
if (!copyFromTypedArray(cx, obj, src, offset))
return false;
} else {
jsuint len;
unsigned len;
if (!js_GetLengthProperty(cx, arg0, &len))
return false;
@ -1734,7 +1734,7 @@ class TypedArrayTemplate
* Otherwise create a new typed array and copy len properties from the
* object.
*/
jsuint len;
unsigned len;
if (!js_GetLengthProperty(cx, other, &len))
return NULL;
@ -1824,7 +1824,7 @@ class TypedArrayTemplate
static bool
copyFromArray(JSContext *cx, JSObject *thisTypedArrayObj,
JSObject *ar, jsuint len, jsuint offset = 0)
JSObject *ar, unsigned len, unsigned offset = 0)
{
thisTypedArrayObj = getTypedArray(thisTypedArrayObj);
JS_ASSERT(thisTypedArrayObj);
@ -1858,7 +1858,7 @@ class TypedArrayTemplate
}
static bool
copyFromTypedArray(JSContext *cx, JSObject *thisTypedArrayObj, JSObject *tarray, jsuint offset)
copyFromTypedArray(JSContext *cx, JSObject *thisTypedArrayObj, JSObject *tarray, unsigned offset)
{
thisTypedArrayObj = getTypedArray(thisTypedArrayObj);
JS_ASSERT(thisTypedArrayObj);
@ -1935,7 +1935,7 @@ class TypedArrayTemplate
}
static bool
copyFromWithOverlap(JSContext *cx, JSObject *self, JSObject *tarray, jsuint offset)
copyFromWithOverlap(JSContext *cx, JSObject *self, JSObject *tarray, unsigned offset)
{
JS_ASSERT(offset <= getLength(self));
@ -2532,13 +2532,13 @@ js_IsTypedArray(JSObject *obj)
}
JS_FRIEND_API(JSObject *)
js_CreateArrayBuffer(JSContext *cx, jsuint nbytes)
js_CreateArrayBuffer(JSContext *cx, unsigned nbytes)
{
return ArrayBuffer::create(cx, nbytes);
}
JS_FRIEND_API(JSObject *)
JS_NewArrayBuffer(JSContext *cx, jsuint nbytes)
JS_NewArrayBuffer(JSContext *cx, unsigned nbytes)
{
return js_CreateArrayBuffer(cx, nbytes);
}
@ -2581,7 +2581,7 @@ TypedArrayConstruct(JSContext *cx, int atype, unsigned argc, Value *argv)
}
JS_FRIEND_API(JSObject *)
js_CreateTypedArray(JSContext *cx, int atype, jsuint nelements)
js_CreateTypedArray(JSContext *cx, int atype, unsigned nelements)
{
JS_ASSERT(atype >= 0 && atype < TypedArray::TYPE_MAX);

Просмотреть файл

@ -252,7 +252,7 @@ struct JS_FRIEND_API(TypedArray) {
public:
static bool
isArrayIndex(JSContext *cx, JSObject *obj, jsid id, jsuint *ip = NULL);
isArrayIndex(JSContext *cx, JSObject *obj, jsid id, unsigned *ip = NULL);
static inline uint32_t slotWidth(int atype) {
switch (atype) {
@ -335,7 +335,7 @@ JS_FRIEND_API(JSBool)
JS_IsArrayBufferObject(JSObject *obj);
JS_FRIEND_API(JSObject *)
JS_NewArrayBuffer(JSContext *cx, jsuint nbytes);
JS_NewArrayBuffer(JSContext *cx, unsigned nbytes);
JS_FRIEND_API(uint32_t)
JS_GetArrayBufferByteLength(JSObject *obj);

Просмотреть файл

@ -4665,7 +4665,7 @@ HasFunctionProperty(JSContext *cx, JSObject *obj, jsid funid, JSBool *found)
}
static bool
IdValIsIndex(JSContext *cx, jsval id, jsuint *indexp, bool *isIndex)
IdValIsIndex(JSContext *cx, jsval id, unsigned *indexp, bool *isIndex)
{
if (JSVAL_IS_INT(id)) {
int32_t i = JSVAL_TO_INT(id);
@ -4673,7 +4673,7 @@ IdValIsIndex(JSContext *cx, jsval id, jsuint *indexp, bool *isIndex)
*isIndex = false;
return true;
}
*indexp = (jsuint)i;
*indexp = (unsigned)i;
*isIndex = true;
return true;
}
@ -6198,7 +6198,7 @@ static JSBool
xml_namespace(JSContext *cx, unsigned argc, jsval *vp)
{
JSLinearString *prefix, *nsprefix;
jsuint i, length;
unsigned i, length;
JSObject *ns;
NON_LIST_XML_METHOD_PROLOG;

Просмотреть файл

@ -1143,7 +1143,7 @@ ic::SplatApplyArgs(VMFrame &f)
/* Steps 4-5. */
JSObject *aobj = &vp[3].toObject();
jsuint length;
unsigned length;
if (!js_GetLengthProperty(cx, aobj, &length))
THROWV(false);

Просмотреть файл

@ -234,13 +234,13 @@ stubs::SetElem(VMFrame &f)
do {
if (obj->isDenseArray() && JSID_IS_INT(id)) {
jsuint length = obj->getDenseArrayInitializedLength();
unsigned length = obj->getDenseArrayInitializedLength();
int32_t i = JSID_TO_INT(id);
if ((jsuint)i < length) {
if ((unsigned)i < length) {
if (obj->getDenseArrayElement(i).isMagic(JS_ARRAY_HOLE)) {
if (js_PrototypeHasIndexedProperties(cx, obj))
break;
if ((jsuint)i >= obj->getArrayLength())
if ((unsigned)i >= obj->getArrayLength())
obj->setArrayLength(cx, i + 1);
}
obj->setDenseArrayElementWithType(cx, i, rval);
@ -1034,8 +1034,8 @@ stubs::InitElem(VMFrame &f, uint32_t last)
if (rref.isMagic(JS_ARRAY_HOLE)) {
JS_ASSERT(obj->isArray());
JS_ASSERT(JSID_IS_INT(id));
JS_ASSERT(jsuint(JSID_TO_INT(id)) < StackSpace::ARGS_LENGTH_MAX);
if (last && !js_SetLengthProperty(cx, obj, (jsuint) (JSID_TO_INT(id) + 1)))
JS_ASSERT(unsigned(JSID_TO_INT(id)) < StackSpace::ARGS_LENGTH_MAX);
if (last && !js_SetLengthProperty(cx, obj, (unsigned) (JSID_TO_INT(id) + 1)))
THROW();
} else {
if (!obj->defineGeneric(cx, id, rref, NULL, NULL, JSPROP_ENUMERATE))
@ -1584,7 +1584,7 @@ stubs::TableSwitch(VMFrame &f, jsbytecode *origPc)
pc += JUMP_OFFSET_LEN;
tableIdx -= low;
if ((jsuint) tableIdx < (jsuint)(high - low + 1)) {
if ((unsigned) tableIdx < (unsigned)(high - low + 1)) {
pc += JUMP_OFFSET_LEN * tableIdx;
if (uint32_t candidateOffset = GET_JUMP_OFFSET(pc))
jumpOffset = candidateOffset;

Просмотреть файл

@ -532,7 +532,7 @@ ReferenceFinder::addReferrer(jsval referrer, Path *path)
JS_ASSERT(JS_IsArrayObject(context, array));
/* Append our referrer to this array. */
jsuint length;
unsigned length;
return JS_GetArrayLength(context, array, &length) &&
JS_SetElement(context, array, length, &referrer);
}

Просмотреть файл

@ -376,7 +376,7 @@ js::StaticStrings::lookup(const jschar *chars, size_t length)
(chars[1] - '0') * 10 +
(chars[2] - '0');
if (jsuint(i) < INT_STATIC_LIMIT)
if (unsigned(i) < INT_STATIC_LIMIT)
return getInt(i);
}
return NULL;

Просмотреть файл

@ -533,7 +533,7 @@ StaticStrings::isStatic(JSAtom *atom)
(chars[1] - '0') * 10 +
(chars[2] - '0');
return (jsuint(i) < INT_STATIC_LIMIT);
return (unsigned(i) < INT_STATIC_LIMIT);
}
return false;
default:

Просмотреть файл

@ -1214,7 +1214,7 @@ mozJSComponentLoader::ImportInto(const nsACString & aLocation,
// Iterate over symbols array, installing symbols on targetObj:
jsuint symbolCount = 0;
unsigned symbolCount = 0;
if (!JS_GetArrayLength(mContext, symbolsObj, &symbolCount)) {
return ReportOnCaller(cxhelper, ERROR_GETTING_ARRAY_LENGTH,
PromiseFlatCString(aLocation).get());
@ -1224,7 +1224,7 @@ mozJSComponentLoader::ImportInto(const nsACString & aLocation,
nsCAutoString logBuffer;
#endif
for (jsuint i = 0; i < symbolCount; ++i) {
for (unsigned i = 0; i < symbolCount; ++i) {
jsval val;
jsid symbolId;

Просмотреть файл

@ -190,7 +190,7 @@ private:
public:
static JSBool GetTypeForArray(XPCCallContext& ccx, JSObject* array,
jsuint length,
unsigned length,
nsXPTType* resultType, nsID* resultID);
};
@ -215,7 +215,7 @@ XPCArrayHomogenizer::StateTable[tTypeCount][tTypeCount-1] = {
// static
JSBool
XPCArrayHomogenizer::GetTypeForArray(XPCCallContext& ccx, JSObject* array,
jsuint length,
unsigned length,
nsXPTType* resultType, nsID* resultID)
{
Type state = tUnk;

Просмотреть файл

@ -607,7 +607,7 @@ GetArrayIndexFromId(JSContext *cx, jsid id)
if (NS_LIKELY((unsigned)s >= 'a' && (unsigned)s <= 'z'))
return -1;
jsuint i;
unsigned i;
JSLinearString *str = js::AtomToLinearString(JSID_TO_ATOM(id));
return js::StringIsArrayIndex(str, &i) ? i : -1;
}

Просмотреть файл

@ -359,7 +359,7 @@ GetHistogramCounts(const char *testmsg, JSContext *cx, jsval *counts)
nsresult
CompareCountArrays(JSContext *cx, JSObject *before, JSObject *after)
{
jsuint before_size, after_size;
unsigned before_size, after_size;
if (!(JS_GetArrayLength(cx, before, &before_size)
&& JS_GetArrayLength(cx, after, &after_size))) {
return NS_ERROR_UNEXPECTED;
@ -369,7 +369,7 @@ CompareCountArrays(JSContext *cx, JSObject *before, JSObject *after)
return NS_ERROR_UNEXPECTED;
}
for (jsuint i = 0; i < before_size; ++i) {
for (unsigned i = 0; i < before_size; ++i) {
jsval before_num, after_num;
if (!(JS_GetElement(cx, before, i, &before_num)

Просмотреть файл

@ -318,7 +318,7 @@ GetIntFromJSObject(JSContext* aCtx,
nsresult
GetJSObjectFromArray(JSContext* aCtx,
JSObject* aArray,
jsuint aIndex,
unsigned aIndex,
JSObject** _rooter)
{
NS_PRECONDITION(JS_IsArrayObject(aCtx, aArray),
@ -2104,7 +2104,7 @@ History::UpdatePlaces(const jsval& aPlaceInfos,
NS_ENSURE_TRUE(NS_IsMainThread(), NS_ERROR_UNEXPECTED);
NS_ENSURE_TRUE(!JSVAL_IS_PRIMITIVE(aPlaceInfos), NS_ERROR_INVALID_ARG);
jsuint infosLength = 1;
unsigned infosLength = 1;
JSObject* infos;
if (JS_IsArrayObject(aCtx, JSVAL_TO_OBJECT(aPlaceInfos))) {
infos = JSVAL_TO_OBJECT(aPlaceInfos);
@ -2122,7 +2122,7 @@ History::UpdatePlaces(const jsval& aPlaceInfos,
}
nsTArray<VisitData> visitData;
for (jsuint i = 0; i < infosLength; i++) {
for (unsigned i = 0; i < infosLength; i++) {
JSObject* info;
nsresult rv = GetJSObjectFromArray(aCtx, infos, i, &info);
NS_ENSURE_SUCCESS(rv, rv);
@ -2168,7 +2168,7 @@ History::UpdatePlaces(const jsval& aPlaceInfos,
}
NS_ENSURE_ARG(visits);
jsuint visitsLength = 0;
unsigned visitsLength = 0;
if (visits) {
(void)JS_GetArrayLength(aCtx, visits, &visitsLength);
}
@ -2176,7 +2176,7 @@ History::UpdatePlaces(const jsval& aPlaceInfos,
// Check each visit, and build our array of VisitData objects.
visitData.SetCapacity(visitData.Length() + visitsLength);
for (jsuint j = 0; j < visitsLength; j++) {
for (unsigned j = 0; j < visitsLength; j++) {
JSObject* visit;
rv = GetJSObjectFromArray(aCtx, visits, j, &visit);
NS_ENSURE_SUCCESS(rv, rv);