зеркало из https://github.com/mozilla/pjs.git
Bug 701735 - xpc_qsJsvalToWcharStr shouldn't const_cast; r=bz
This commit is contained in:
Родитель
37ac4b56c3
Коммит
f99551ba2a
|
@ -1,6 +1,5 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
|
@ -1001,7 +1000,7 @@ xpc_qsJsvalToCharStr(JSContext *cx, jsval v, JSAutoByteString *bytes)
|
|||
}
|
||||
|
||||
JSBool
|
||||
xpc_qsJsvalToWcharStr(JSContext *cx, jsval v, jsval *pval, PRUnichar **pstr)
|
||||
xpc_qsJsvalToWcharStr(JSContext *cx, jsval v, jsval *pval, const PRUnichar **pstr)
|
||||
{
|
||||
JSString *str;
|
||||
|
||||
|
@ -1020,8 +1019,7 @@ xpc_qsJsvalToWcharStr(JSContext *cx, jsval v, jsval *pval, PRUnichar **pstr)
|
|||
if (!chars)
|
||||
return JS_FALSE;
|
||||
|
||||
// XXXbz this is casting away constness too... That seems like a bad idea.
|
||||
*pstr = const_cast<jschar *>(chars);
|
||||
*pstr = static_cast<const PRUnichar *>(chars);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -467,7 +467,7 @@ JSBool
|
|||
xpc_qsJsvalToCharStr(JSContext *cx, jsval v, JSAutoByteString *bytes);
|
||||
|
||||
JSBool
|
||||
xpc_qsJsvalToWcharStr(JSContext *cx, jsval v, jsval *pval, PRUnichar **pstr);
|
||||
xpc_qsJsvalToWcharStr(JSContext *cx, jsval v, jsval *pval, const PRUnichar **pstr);
|
||||
|
||||
|
||||
/** Convert an nsString to jsval, returning JS_TRUE on success.
|
||||
|
|
|
@ -170,7 +170,7 @@ argumentUnboxingTemplates = {
|
|||
" char *${name} = ${name}_bytes.ptr();\n",
|
||||
|
||||
'wstring':
|
||||
" PRUnichar *${name};\n"
|
||||
" const PRUnichar *${name};\n"
|
||||
" if (!xpc_qsJsvalToWcharStr(cx, ${argVal}, ${argPtr}, &${name}))\n"
|
||||
" return JS_FALSE;\n",
|
||||
|
||||
|
|
|
@ -488,7 +488,7 @@ argumentUnboxingTemplates = {
|
|||
" char *${name} = ${name}_bytes.ptr();\n",
|
||||
|
||||
'wstring':
|
||||
" PRUnichar *${name};\n"
|
||||
" const PRUnichar *${name};\n"
|
||||
" if (!xpc_qsJsvalToWcharStr(cx, ${argVal}, ${argPtr}, &${name}))\n"
|
||||
" return JS_FALSE;\n",
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче