jscript: Use wide-char string literals.
Signed-off-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
79181a1d1d
commit
4d68572aa6
|
@ -113,14 +113,14 @@ HRESULT decode_source(WCHAR *code)
|
|||
const WCHAR *src = code;
|
||||
WCHAR *dst = code;
|
||||
|
||||
static const WCHAR decode_beginW[] = {'#','@','~','^'};
|
||||
static const WCHAR decode_endW[] = {'^','#','~','@'};
|
||||
static const WCHAR decode_beginW[] = L"#@~^";
|
||||
static const WCHAR decode_endW[] = L"^#~@";
|
||||
|
||||
while(*src) {
|
||||
if(!wcsncmp(src, decode_beginW, ARRAY_SIZE(decode_beginW))) {
|
||||
if(!wcsncmp(src, decode_beginW, ARRAY_SIZE(decode_beginW)-1)) {
|
||||
DWORD len, i, j=0, csum, s=0;
|
||||
|
||||
src += ARRAY_SIZE(decode_beginW);
|
||||
src += ARRAY_SIZE(decode_beginW) - 1;
|
||||
|
||||
if(!decode_dword(src, &len))
|
||||
return JS_E_INVALID_CHAR;
|
||||
|
@ -165,9 +165,9 @@ HRESULT decode_source(WCHAR *code)
|
|||
return JS_E_INVALID_CHAR;
|
||||
src += 8;
|
||||
|
||||
if(wcsncmp(src, decode_endW, ARRAY_SIZE(decode_endW)))
|
||||
if(wcsncmp(src, decode_endW, ARRAY_SIZE(decode_endW)-1))
|
||||
return JS_E_INVALID_CHAR;
|
||||
src += ARRAY_SIZE(decode_endW);
|
||||
src += ARRAY_SIZE(decode_endW) - 1;
|
||||
}else {
|
||||
*dst++ = *src++;
|
||||
}
|
||||
|
|
|
@ -620,17 +620,16 @@ static HRESULT NativeFunction_toString(FunctionInstance *func, jsstr_t **ret)
|
|||
jsstr_t *str;
|
||||
WCHAR *ptr;
|
||||
|
||||
static const WCHAR native_prefixW[] = {'\n','f','u','n','c','t','i','o','n',' '};
|
||||
static const WCHAR native_suffixW[] =
|
||||
{'(',')',' ','{','\n',' ',' ',' ',' ','[','n','a','t','i','v','e',' ','c','o','d','e',']','\n','}','\n'};
|
||||
static const WCHAR native_prefixW[] = L"\nfunction ";
|
||||
static const WCHAR native_suffixW[] = L"() {\n [native code]\n}\n";
|
||||
|
||||
name_len = function->name ? lstrlenW(function->name) : 0;
|
||||
str = jsstr_alloc_buf(ARRAY_SIZE(native_prefixW) + ARRAY_SIZE(native_suffixW) + name_len, &ptr);
|
||||
str = jsstr_alloc_buf(ARRAY_SIZE(native_prefixW) + ARRAY_SIZE(native_suffixW) + name_len - 2, &ptr);
|
||||
if(!str)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
memcpy(ptr, native_prefixW, sizeof(native_prefixW));
|
||||
ptr += ARRAY_SIZE(native_prefixW);
|
||||
ptr += ARRAY_SIZE(native_prefixW) - 1;
|
||||
memcpy(ptr, function->name, name_len*sizeof(WCHAR));
|
||||
ptr += name_len;
|
||||
memcpy(ptr, native_suffixW, sizeof(native_suffixW));
|
||||
|
@ -912,8 +911,8 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
|
|||
int j = 0;
|
||||
HRESULT hres = S_OK;
|
||||
|
||||
static const WCHAR function_anonymousW[] = {'f','u','n','c','t','i','o','n',' ','a','n','o','n','y','m','o','u','s','('};
|
||||
static const WCHAR function_beginW[] = {')',' ','{','\n'};
|
||||
static const WCHAR function_anonymousW[] = L"function anonymous(";
|
||||
static const WCHAR function_beginW[] = L") {\n";
|
||||
static const WCHAR function_endW[] = L"\n}";
|
||||
|
||||
if(argc) {
|
||||
|
@ -932,11 +931,11 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
|
|||
}
|
||||
|
||||
if(SUCCEEDED(hres)) {
|
||||
len += ARRAY_SIZE(function_anonymousW) + ARRAY_SIZE(function_beginW) + ARRAY_SIZE(function_endW);
|
||||
len += ARRAY_SIZE(function_anonymousW) + ARRAY_SIZE(function_beginW) + ARRAY_SIZE(function_endW) - 2;
|
||||
str = heap_alloc(len*sizeof(WCHAR));
|
||||
if(str) {
|
||||
memcpy(str, function_anonymousW, sizeof(function_anonymousW));
|
||||
ptr = str + ARRAY_SIZE(function_anonymousW);
|
||||
ptr = str + ARRAY_SIZE(function_anonymousW) - 1;
|
||||
if(argc > 1) {
|
||||
while(1) {
|
||||
ptr += jsstr_flush(params[j], ptr);
|
||||
|
@ -947,7 +946,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
|
|||
}
|
||||
}
|
||||
memcpy(ptr, function_beginW, sizeof(function_beginW));
|
||||
ptr += ARRAY_SIZE(function_beginW);
|
||||
ptr += ARRAY_SIZE(function_beginW) - 1;
|
||||
if(argc)
|
||||
ptr += jsstr_flush(params[argc-1], ptr);
|
||||
memcpy(ptr, function_endW, sizeof(function_endW));
|
||||
|
|
|
@ -494,7 +494,7 @@ static HRESULT str_to_number(jsstr_t *str, double *ret)
|
|||
BOOL neg = FALSE;
|
||||
DOUBLE d = 0.0;
|
||||
|
||||
static const WCHAR infinityW[] = {'I','n','f','i','n','i','t','y'};
|
||||
static const WCHAR infinityW[] = L"Infinity";
|
||||
|
||||
ptr = jsstr_flatten(str);
|
||||
if(!ptr)
|
||||
|
@ -510,8 +510,8 @@ static HRESULT str_to_number(jsstr_t *str, double *ret)
|
|||
ptr++;
|
||||
}
|
||||
|
||||
if(!wcsncmp(ptr, infinityW, ARRAY_SIZE(infinityW))) {
|
||||
ptr += ARRAY_SIZE(infinityW);
|
||||
if(!wcsncmp(ptr, infinityW, ARRAY_SIZE(infinityW)-1)) {
|
||||
ptr += ARRAY_SIZE(infinityW) - 1;
|
||||
while(*ptr && iswspace(*ptr))
|
||||
ptr++;
|
||||
|
||||
|
|
|
@ -1573,14 +1573,12 @@ HRESULT script_parse(script_ctx_t *ctx, struct _compiler_ctx_t *compiler, byteco
|
|||
heap_pool_t *mark;
|
||||
HRESULT hres;
|
||||
|
||||
const WCHAR html_tagW[] = {'<','/','s','c','r','i','p','t','>',0};
|
||||
|
||||
parser_ctx = heap_alloc_zero(sizeof(parser_ctx_t));
|
||||
if(!parser_ctx)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
parser_ctx->error_loc = -1;
|
||||
parser_ctx->is_html = delimiter && !wcsicmp(delimiter, html_tagW);
|
||||
parser_ctx->is_html = delimiter && !wcsicmp(delimiter, L"</script>");
|
||||
|
||||
parser_ctx->begin = parser_ctx->ptr = code->source;
|
||||
parser_ctx->end = parser_ctx->begin + lstrlenW(parser_ctx->begin);
|
||||
|
|
|
@ -888,9 +888,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
|
|||
if(FAILED(hres))
|
||||
break;
|
||||
}else {
|
||||
static const WCHAR undefinedW[] = {'u','n','d','e','f','i','n','e','d'};
|
||||
|
||||
hres = strbuf_append(&ret, undefinedW, ARRAY_SIZE(undefinedW));
|
||||
hres = strbuf_append(&ret, L"undefined", ARRAY_SIZE(L"undefined")-1);
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue