зеркало из https://github.com/mozilla/pjs.git
Bug 564980. Use JSString::length directly instead of JS_GetStringLength in some places in xpconnect. r=mrbkap
This commit is contained in:
Родитель
ad75594e7d
Коммит
ebbde60f1b
|
@ -907,8 +907,8 @@ public:
|
|||
{ SetIsVoid(PR_TRUE); }
|
||||
|
||||
explicit XPCReadableJSStringWrapper(JSString *str) :
|
||||
nsDependentString((const PRUnichar *)::JS_GetStringChars(str),
|
||||
::JS_GetStringLength(str))
|
||||
nsDependentString(reinterpret_cast<const PRUnichar *>(::JS_GetStringChars(str)),
|
||||
str->length())
|
||||
{ }
|
||||
};
|
||||
|
||||
|
|
|
@ -723,8 +723,9 @@ xpc_qsDOMString::xpc_qsDOMString(JSContext *cx, jsval v, jsval *pval,
|
|||
*pval = STRING_TO_JSVAL(s); // Root the new string.
|
||||
}
|
||||
|
||||
len = JS_GetStringLength(s);
|
||||
chars = (len == 0 ? traits::sEmptyBuffer : (const PRUnichar*)JS_GetStringChars(s));
|
||||
len = s->length();
|
||||
chars = (len == 0 ? traits::sEmptyBuffer :
|
||||
reinterpret_cast<const PRUnichar*>(JS_GetStringChars(s)));
|
||||
new(mBuf) implementation_type(chars, len);
|
||||
mValid = JS_TRUE;
|
||||
}
|
||||
|
@ -757,7 +758,7 @@ xpc_qsACString::xpc_qsACString(JSContext *cx, jsval v, jsval *pval)
|
|||
}
|
||||
|
||||
const char *bytes = JS_GetStringBytes(s);
|
||||
size_t len = JS_GetStringLength(s);
|
||||
size_t len = s->length();
|
||||
new(mBuf) implementation_type(bytes, len);
|
||||
mValid = JS_TRUE;
|
||||
}
|
||||
|
@ -1041,6 +1042,7 @@ xpc_qsJsvalToWcharStr(JSContext *cx, jsval v, jsval *pval, PRUnichar **pstr)
|
|||
*pval = STRING_TO_JSVAL(str); // Root the new string.
|
||||
}
|
||||
|
||||
// XXXbz this is casting away constness too... That seems like a bad idea.
|
||||
*pstr = (PRUnichar*)JS_GetStringChars(str);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче