bug 610198 - Replacing JS_GetStringBytes usage with JS_EncodeString. r=gal

This commit is contained in:
Igor Bukanov
2010-11-02 15:36:25 +01:00
parent df66f2eee9
commit f73bb91440
49 changed files with 796 additions and 576 deletions

View File

@@ -2299,21 +2299,18 @@ date_toLocaleTimeString(JSContext *cx, uintN argc, Value *vp)
static JSBool
date_toLocaleFormat(JSContext *cx, uintN argc, Value *vp)
{
JSString *fmt;
const char *fmtbytes;
if (argc == 0)
return date_toLocaleString(cx, argc, vp);
fmt = js_ValueToString(cx, vp[2]);
JSString *fmt = js_ValueToString(cx, vp[2]);
if (!fmt)
return JS_FALSE;
vp[2].setString(fmt);
fmtbytes = js_GetStringBytes(cx, fmt);
JSAutoByteString fmtbytes(cx, fmt);
if (!fmtbytes)
return JS_FALSE;
return date_toLocaleHelper(cx, fmtbytes, vp);
return date_toLocaleHelper(cx, fmtbytes.ptr(), vp);
}
static JSBool