зеркало из https://github.com/mozilla/gecko-dev.git
Bug 318402: Replaced JS_STRINGS_ARE_UTF* with JS_C_STRING_ARE_UTF8
This commit is contained in:
Родитель
e5e30a5864
Коммит
2d90931631
|
@ -4439,7 +4439,7 @@ JS_DecodeBytes(JSContext *cx, const char *src, size_t srclen, jschar *dst,
|
|||
JS_PUBLIC_API(JSBool)
|
||||
JS_CStringsAreUTF8()
|
||||
{
|
||||
#ifdef JS_STRINGS_ARE_UTF8
|
||||
#ifdef JS_C_STRINGS_ARE_UTF8
|
||||
return JS_TRUE;
|
||||
#else
|
||||
return JS_FALSE;
|
||||
|
|
|
@ -1827,7 +1827,7 @@ JS_MakeStringImmutable(JSContext *cx, JSString *str);
|
|||
|
||||
/*
|
||||
* Return JS_TRUE if C (char []) strings passed via the API and internally
|
||||
* are UTF-8. The source must be compiled with JS_STRINGS_ARE_UTF8 defined
|
||||
* are UTF-8. The source must be compiled with JS_C_STRINGS_ARE_UTF8 defined
|
||||
* to get UTF-8 support.
|
||||
*/
|
||||
JS_PUBLIC_API(JSBool)
|
||||
|
@ -1849,7 +1849,7 @@ JS_CStringsAreUTF8();
|
|||
* NB: Neither function stores an additional zero byte or jschar after the
|
||||
* transcoded string.
|
||||
*
|
||||
* If the source has been compiled with the #define JS_STRINGS_ARE_UTF8 to
|
||||
* If the source has been compiled with the #define JS_C_STRINGS_ARE_UTF8 to
|
||||
* enable UTF-8 interpretation of C char[] strings, then JS_EncodeCharacters
|
||||
* encodes to UTF-8, and JS_DecodeBytes decodes from UTF-8, which may create
|
||||
* addititional errors if the character sequence is malformed. If UTF-8
|
||||
|
|
|
@ -451,7 +451,7 @@ QuoteString(Sprinter *sp, JSString *str, jschar quote)
|
|||
if ((u = js_strchr(js_EscapeMap, c)) != NULL) {
|
||||
ok = Sprint(sp, "\\%c", (char)u[1]) >= 0;
|
||||
} else {
|
||||
#ifdef JS_STRINGS_ARE_UTF8
|
||||
#ifdef JS_C_STRINGS_ARE_UTF8
|
||||
/* If this is a surrogate pair, make sure to print the pair. */
|
||||
if (c >= 0xD800 && c <= 0xDBFF) {
|
||||
jschar buffer[3];
|
||||
|
|
|
@ -706,7 +706,7 @@ static int dosprintf(SprintfState *ss, const char *fmt, va_list ap)
|
|||
struct NumArgState nasArray[ NAS_DEFAULT_NUM ];
|
||||
char pattern[20];
|
||||
const char *dolPt = NULL; /* in "%4$.2f", dolPt will poiont to . */
|
||||
#ifdef JS_STRINGS_ARE_UTF8
|
||||
#ifdef JS_C_STRINGS_ARE_UTF8
|
||||
char utf8buf[6];
|
||||
int utf8len;
|
||||
#endif
|
||||
|
@ -946,8 +946,8 @@ static int dosprintf(SprintfState *ss, const char *fmt, va_list ap)
|
|||
}
|
||||
switch (type) {
|
||||
case TYPE_INT16:
|
||||
/* Treat %hc as %c if JS_STRINGS_ARE_UTF8 is undefined. */
|
||||
#ifdef JS_STRINGS_ARE_UTF8
|
||||
/* Treat %hc as %c if JS_C_STRINGS_ARE_UTF8 is undefined. */
|
||||
#ifdef JS_C_STRINGS_ARE_UTF8
|
||||
u.wch = va_arg(ap, int);
|
||||
utf8len = js_OneUcs4ToUtf8Char (utf8buf, u.wch);
|
||||
rv = (*ss->stuff)(ss, utf8buf, utf8len);
|
||||
|
@ -999,7 +999,7 @@ static int dosprintf(SprintfState *ss, const char *fmt, va_list ap)
|
|||
if(type == TYPE_INT16) {
|
||||
/*
|
||||
* This would do a simple string/byte conversion
|
||||
* if JS_STRINGS_ARE_UTF8 is not defined.
|
||||
* if JS_C_STRINGS_ARE_UTF8 is not defined.
|
||||
*/
|
||||
u.ws = va_arg(ap, const jschar*);
|
||||
rv = cvt_ws(ss, u.ws, width, prec, flags);
|
||||
|
|
|
@ -50,9 +50,9 @@
|
|||
** %ld, %lu, %lx, %lX, %lo - 32-bit versions of above
|
||||
** %lld, %llu, %llx, %llX, %llo - 64 bit versions of above
|
||||
** %s - string
|
||||
** %hs - 16-bit version of above (only available if compiled with JS_STRINGS_ARE_UTF8)
|
||||
** %hs - 16-bit version of above (only available if compiled with JS_C_STRINGS_ARE_UTF8)
|
||||
** %c - character
|
||||
** %hc - 16-bit version of above (only available if compiled with JS_STRINGS_ARE_UTF8)
|
||||
** %hc - 16-bit version of above (only available if compiled with JS_C_STRINGS_ARE_UTF8)
|
||||
** %p - pointer (deals with machine dependent pointer size)
|
||||
** %f - float
|
||||
** %g - float
|
||||
|
|
|
@ -565,7 +565,7 @@ typedef enum JSExnType {
|
|||
} JSExnType;
|
||||
|
||||
typedef struct JSErrorFormatString {
|
||||
const char *format; /* the error message (may be UTF-8 if compiled with JS_STRINGS_ARE_UTF8) */
|
||||
const char *format; /* the error message (may be UTF-8 if compiled with JS_C_STRINGS_ARE_UTF8) */
|
||||
uint16 argCount; /* the number of arguments to convert in the error message */
|
||||
int16 exnType; /* One of the JSExnType constants above */
|
||||
} JSErrorFormatString;
|
||||
|
|
|
@ -2908,7 +2908,7 @@ js_SkipWhiteSpace(const jschar *s)
|
|||
return s;
|
||||
}
|
||||
|
||||
#ifdef JS_STRINGS_ARE_UTF8
|
||||
#ifdef JS_C_STRINGS_ARE_UTF8
|
||||
|
||||
jschar *
|
||||
js_InflateString(JSContext *cx, const char *bytes, size_t *length)
|
||||
|
|
Загрузка…
Ссылка в новой задаче