vbscript: Use wide-char string literals.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2020-11-15 23:11:20 +01:00 committed by Alexandre Julliard
parent 5d066f4f7a
commit ca5bc488d9
5 changed files with 23 additions and 46 deletions

View File

@ -1674,9 +1674,6 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl)
unsigned i; unsigned i;
HRESULT hres; HRESULT hres;
static const WCHAR class_initializeW[] = {'c','l','a','s','s','_','i','n','i','t','i','a','l','i','z','e',0};
static const WCHAR class_terminateW[] = {'c','l','a','s','s','_','t','e','r','m','i','n','a','t','e',0};
if(lookup_dim_decls(ctx, class_decl->name) || lookup_funcs_name(ctx, class_decl->name) if(lookup_dim_decls(ctx, class_decl->name) || lookup_funcs_name(ctx, class_decl->name)
|| lookup_const_decls(ctx, class_decl->name, FALSE) || lookup_class_name(ctx, class_decl->name)) { || lookup_const_decls(ctx, class_decl->name, FALSE) || lookup_class_name(ctx, class_decl->name)) {
FIXME("%s: redefinition\n", debugstr_w(class_decl->name)); FIXME("%s: redefinition\n", debugstr_w(class_decl->name));
@ -1722,14 +1719,14 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl)
} }
} }
if(!wcsicmp(class_initializeW, func_decl->name)) { if(!wcsicmp(L"class_initialize", func_decl->name)) {
if(func_decl->type != FUNC_SUB) { if(func_decl->type != FUNC_SUB) {
FIXME("class initializer is not sub\n"); FIXME("class initializer is not sub\n");
return E_FAIL; return E_FAIL;
} }
class_desc->class_initialize_id = i; class_desc->class_initialize_id = i;
}else if(!wcsicmp(class_terminateW, func_decl->name)) { }else if(!wcsicmp(L"class_terminate", func_decl->name)) {
if(func_decl->type != FUNC_SUB) { if(func_decl->type != FUNC_SUB) {
FIXME("class terminator is not sub\n"); FIXME("class terminator is not sub\n");
return E_FAIL; return E_FAIL;

View File

@ -37,9 +37,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(vbscript);
const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY = const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY =
{0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}}; {0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}};
static const WCHAR emptyW[] = {0};
static const WCHAR vbscriptW[] = {'V','B','S','c','r','i','p','t',0};
#define BP_GET 1 #define BP_GET 1
#define BP_GETPUT 2 #define BP_GETPUT 2
@ -600,21 +597,21 @@ static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, unsigned type, BSTR o
if(orig_title && *orig_title) { if(orig_title && *orig_title) {
WCHAR *ptr; WCHAR *ptr;
title = title_buf = heap_alloc(sizeof(vbscriptW) + (lstrlenW(orig_title)+2)*sizeof(WCHAR)); title = title_buf = heap_alloc(sizeof(L"VBScript") + (lstrlenW(orig_title)+2)*sizeof(WCHAR));
if(!title) if(!title)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(title_buf, vbscriptW, sizeof(vbscriptW)); memcpy(title_buf, L"VBScript", sizeof(L"VBScript"));
ptr = title_buf + ARRAY_SIZE(vbscriptW)-1; ptr = title_buf + ARRAY_SIZE(L"VBScript")-1;
*ptr++ = ':'; *ptr++ = ':';
*ptr++ = ' '; *ptr++ = ' ';
lstrcpyW(ptr, orig_title); lstrcpyW(ptr, orig_title);
}else { }else {
title = vbscriptW; title = L"VBScript";
} }
}else { }else {
title = orig_title ? orig_title : emptyW; title = orig_title ? orig_title : L"";
} }
hres = IActiveScriptSiteWindow_GetWindow(acts_window, &hwnd); hres = IActiveScriptSiteWindow_GetWindow(acts_window, &hwnd);
@ -2203,19 +2200,6 @@ static HRESULT Global_DatePart(BuiltinDisp *This, VARIANT *arg, unsigned args_cn
static HRESULT Global_TypeName(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) static HRESULT Global_TypeName(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{ {
static const WCHAR ByteW[] = {'B', 'y', 't', 'e', 0};
static const WCHAR IntegerW[] = {'I', 'n', 't', 'e', 'g', 'e', 'r', 0};
static const WCHAR LongW[] = {'L', 'o', 'n', 'g', 0};
static const WCHAR SingleW[] = {'S', 'i', 'n', 'g', 'l', 'e', 0};
static const WCHAR DoubleW[] = {'D', 'o', 'u', 'b', 'l', 'e', 0};
static const WCHAR CurrencyW[] = {'C', 'u', 'r', 'r', 'e', 'n', 'c', 'y', 0};
static const WCHAR DecimalW[] = {'D', 'e', 'c', 'i', 'm', 'a', 'l', 0};
static const WCHAR DateW[] = {'D', 'a', 't', 'e', 0};
static const WCHAR StringW[] = {'S', 't', 'r', 'i', 'n', 'g', 0};
static const WCHAR BooleanW[] = {'B', 'o', 'o', 'l', 'e', 'a', 'n', 0};
static const WCHAR EmptyW[] = {'E', 'm', 'p', 't', 'y', 0};
static const WCHAR NullW[] = {'N', 'u', 'l', 'l', 0};
TRACE("(%s)\n", debugstr_variant(arg)); TRACE("(%s)\n", debugstr_variant(arg));
assert(args_cnt == 1); assert(args_cnt == 1);
@ -2225,29 +2209,29 @@ static HRESULT Global_TypeName(BuiltinDisp *This, VARIANT *arg, unsigned args_cn
switch(V_VT(arg)) { switch(V_VT(arg)) {
case VT_UI1: case VT_UI1:
return return_string(res, ByteW); return return_string(res, L"Byte");
case VT_I2: case VT_I2:
return return_string(res, IntegerW); return return_string(res, L"Integer");
case VT_I4: case VT_I4:
return return_string(res, LongW); return return_string(res, L"Long");
case VT_R4: case VT_R4:
return return_string(res, SingleW); return return_string(res, L"Single");
case VT_R8: case VT_R8:
return return_string(res, DoubleW); return return_string(res, L"Double");
case VT_CY: case VT_CY:
return return_string(res, CurrencyW); return return_string(res, L"Currency");
case VT_DECIMAL: case VT_DECIMAL:
return return_string(res, DecimalW); return return_string(res, L"Decimal");
case VT_DATE: case VT_DATE:
return return_string(res, DateW); return return_string(res, L"Date");
case VT_BSTR: case VT_BSTR:
return return_string(res, StringW); return return_string(res, L"String");
case VT_BOOL: case VT_BOOL:
return return_string(res, BooleanW); return return_string(res, L"Boolean");
case VT_EMPTY: case VT_EMPTY:
return return_string(res, EmptyW); return return_string(res, L"Empty");
case VT_NULL: case VT_NULL:
return return_string(res, NullW); return return_string(res, L"Null");
default: default:
FIXME("arg %s not supported\n", debugstr_variant(arg)); FIXME("arg %s not supported\n", debugstr_variant(arg));
return E_NOTIMPL; return E_NOTIMPL;
@ -2665,7 +2649,7 @@ static HRESULT Global_ScriptEngine(BuiltinDisp *This, VARIANT *arg, unsigned arg
assert(args_cnt == 0); assert(args_cnt == 0);
return return_string(res, vbscriptW); return return_string(res, L"VBScript");
} }
static HRESULT Global_ScriptEngineMajorVersion(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) static HRESULT Global_ScriptEngineMajorVersion(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)

View File

@ -1127,11 +1127,9 @@ static HRESULT interp_new(exec_ctx_t *ctx)
VARIANT v; VARIANT v;
HRESULT hres; HRESULT hres;
static const WCHAR regexpW[] = {'r','e','g','e','x','p',0};
TRACE("%s\n", debugstr_w(arg)); TRACE("%s\n", debugstr_w(arg));
if(!wcsicmp(arg, regexpW)) { if(!wcsicmp(arg, L"regexp")) {
V_VT(&v) = VT_DISPATCH; V_VT(&v) = VT_DISPATCH;
hres = create_regexp(&V_DISPATCH(&v)); hres = create_regexp(&V_DISPATCH(&v));
if(FAILED(hres)) if(FAILED(hres))

View File

@ -337,8 +337,7 @@ static void skip_spaces(parser_ctx_t *ctx)
static int comment_line(parser_ctx_t *ctx) static int comment_line(parser_ctx_t *ctx)
{ {
static const WCHAR newlineW[] = {'\n','\r',0}; ctx->ptr = wcspbrk(ctx->ptr, L"\n\r");
ctx->ptr = wcspbrk(ctx->ptr, newlineW);
if(ctx->ptr) if(ctx->ptr)
ctx->ptr++; ctx->ptr++;
else else

View File

@ -52,10 +52,9 @@ static HRESULT init_regexp_typeinfo(regexp_tid_t tid)
HRESULT hres; HRESULT hres;
if(!typelib) { if(!typelib) {
static const WCHAR vbscript_dll3W[] = {'v','b','s','c','r','i','p','t','.','d','l','l','\\','3',0};
ITypeLib *tl; ITypeLib *tl;
hres = LoadTypeLib(vbscript_dll3W, &tl); hres = LoadTypeLib(L"vbscript.dll\\3", &tl);
if(FAILED(hres)) { if(FAILED(hres)) {
ERR("LoadRegTypeLib failed: %08x\n", hres); ERR("LoadRegTypeLib failed: %08x\n", hres);
return hres; return hres;