mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 835719 - 0002. Encode command string into UTF-8 byte array. r=terrence
This commit is contained in:
parent
b4d7ba2694
commit
124f4fc7d7
@ -111,12 +111,12 @@ PostToRIL(JSContext *cx, unsigned argc, jsval *vp)
|
||||
size_t size;
|
||||
if (JSVAL_IS_STRING(v)) {
|
||||
JSString *str = JSVAL_TO_STRING(v);
|
||||
if (!abs.encode(cx, str)) {
|
||||
if (!abs.encodeUtf8(cx, str)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
size = JS_GetStringLength(str);
|
||||
data = abs.ptr();
|
||||
size = abs.length();
|
||||
} else if (!JSVAL_IS_PRIMITIVE(v)) {
|
||||
JSObject *obj = JSVAL_TO_OBJECT(v);
|
||||
if (!JS_IsTypedArrayObject(obj)) {
|
||||
@ -185,11 +185,11 @@ DoNetdCommand(JSContext *cx, unsigned argc, jsval *vp)
|
||||
size_t size;
|
||||
if (JSVAL_IS_STRING(v)) {
|
||||
JSString *str = JSVAL_TO_STRING(v);
|
||||
if (!abs.encode(cx, str)) {
|
||||
if (!abs.encodeUtf8(cx, str)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
size = JS_GetStringLength(str);
|
||||
size = abs.length();
|
||||
if (!size) {
|
||||
JS_ReportError(cx, "Command length is zero");
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user