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

This commit is contained in:
Igor Bukanov
2010-11-11 21:40:29 +01:00
parent 503d83583a
commit b14cc26d66
49 changed files with 801 additions and 582 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