Bug 835719 - 0002. Encode command string into UTF-8 byte array. r=terrence

This commit is contained in:
Chuck Lee 2013-02-21 17:48:15 +08:00
parent b4d7ba2694
commit 124f4fc7d7

View File

@ -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;