[VBSCRIPT] Sync with Wine Staging 4.0. CORE-15682
authorAmine Khaldi <amine.khaldi@reactos.org>
Mon, 4 Feb 2019 12:07:56 +0000 (13:07 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Mon, 4 Feb 2019 12:07:56 +0000 (13:07 +0100)
dll/win32/vbscript/global.c
dll/win32/vbscript/lex.c
dll/win32/vbscript/parser.tab.c
dll/win32/vbscript/parser.y
dll/win32/vbscript/vbdisp.c
dll/win32/vbscript/vbscript_main.c
media/doc/README.WINE

index 668a71a..6d26b2c 100644 (file)
@@ -338,7 +338,7 @@ static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, unsigned type, BSTR o
                 return E_OUTOFMEMORY;
 
             memcpy(title_buf, vbscriptW, sizeof(vbscriptW));
                 return E_OUTOFMEMORY;
 
             memcpy(title_buf, vbscriptW, sizeof(vbscriptW));
-            ptr = title_buf + sizeof(vbscriptW)/sizeof(WCHAR)-1;
+            ptr = title_buf + ARRAY_SIZE(vbscriptW)-1;
 
             *ptr++ = ':';
             *ptr++ = ' ';
 
             *ptr++ = ':';
             *ptr++ = ' ';
@@ -2450,7 +2450,7 @@ HRESULT init_global(script_ctx_t *ctx)
     HRESULT hres;
 
     ctx->global_desc.ctx = ctx;
     HRESULT hres;
 
     ctx->global_desc.ctx = ctx;
-    ctx->global_desc.builtin_prop_cnt = sizeof(global_props)/sizeof(*global_props);
+    ctx->global_desc.builtin_prop_cnt = ARRAY_SIZE(global_props);
     ctx->global_desc.builtin_props = global_props;
 
     hres = get_typeinfo(GlobalObj_tid, &ctx->global_desc.typeinfo);
     ctx->global_desc.builtin_props = global_props;
 
     hres = get_typeinfo(GlobalObj_tid, &ctx->global_desc.typeinfo);
@@ -2466,7 +2466,7 @@ HRESULT init_global(script_ctx_t *ctx)
         return hres;
 
     ctx->err_desc.ctx = ctx;
         return hres;
 
     ctx->err_desc.ctx = ctx;
-    ctx->err_desc.builtin_prop_cnt = sizeof(err_props)/sizeof(*err_props);
+    ctx->err_desc.builtin_prop_cnt = ARRAY_SIZE(err_props);
     ctx->err_desc.builtin_props = err_props;
 
     hres = get_typeinfo(ErrObj_tid, &ctx->err_desc.typeinfo);
     ctx->err_desc.builtin_props = err_props;
 
     hres = get_typeinfo(ErrObj_tid, &ctx->err_desc.typeinfo);
index 98b4cbb..571854d 100644 (file)
@@ -179,7 +179,7 @@ static int check_keyword(parser_ctx_t *ctx, const WCHAR *word)
 
 static int check_keywords(parser_ctx_t *ctx)
 {
 
 static int check_keywords(parser_ctx_t *ctx)
 {
-    int min = 0, max = sizeof(keywords)/sizeof(keywords[0])-1, r, i;
+    int min = 0, max = ARRAY_SIZE(keywords)-1, r, i;
 
     while(min <= max) {
         i = (min+max)/2;
 
     while(min <= max) {
         i = (min+max)/2;
@@ -383,13 +383,14 @@ static int parse_hex_literal(parser_ctx_t *ctx, LONG *ret)
 
 static void skip_spaces(parser_ctx_t *ctx)
 {
 
 static void skip_spaces(parser_ctx_t *ctx)
 {
-    while(*ctx->ptr == ' ' || *ctx->ptr == '\t' || *ctx->ptr == '\r')
+    while(*ctx->ptr == ' ' || *ctx->ptr == '\t')
         ctx->ptr++;
 }
 
 static int comment_line(parser_ctx_t *ctx)
 {
         ctx->ptr++;
 }
 
 static int comment_line(parser_ctx_t *ctx)
 {
-    ctx->ptr = strchrW(ctx->ptr, '\n');
+    static const WCHAR newlineW[] = {'\n','\r',0};
+    ctx->ptr = strpbrkW(ctx->ptr, newlineW);
     if(ctx->ptr)
         ctx->ptr++;
     else
     if(ctx->ptr)
         ctx->ptr++;
     else
@@ -421,6 +422,7 @@ static int parse_next_token(void *lval, parser_ctx_t *ctx)
 
     switch(c) {
     case '\n':
 
     switch(c) {
     case '\n':
+    case '\r':
         ctx->ptr++;
         return tNL;
     case '\'':
         ctx->ptr++;
         return tNL;
     case '\'':
index c39ff41..af2c044 100644 (file)
@@ -3414,7 +3414,7 @@ void *parser_alloc(parser_ctx_t *ctx, size_t size)
 
 HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code, const WCHAR *delimiter)
 {
 
 HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code, const WCHAR *delimiter)
 {
-    const WCHAR html_delimiterW[] = {'<','/','s','c','r','i','p','t','>',0};
+    static const WCHAR html_delimiterW[] = {'<','/','s','c','r','i','p','t','>',0};
 
     ctx->code = ctx->ptr = code;
     ctx->end = ctx->code + strlenW(ctx->code);
 
     ctx->code = ctx->ptr = code;
     ctx->end = ctx->code + strlenW(ctx->code);
index e8ecf4d..0201099 100644 (file)
@@ -969,7 +969,7 @@ void *parser_alloc(parser_ctx_t *ctx, size_t size)
 
 HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code, const WCHAR *delimiter)
 {
 
 HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code, const WCHAR *delimiter)
 {
-    const WCHAR html_delimiterW[] = {'<','/','s','c','r','i','p','t','>',0};
+    static const WCHAR html_delimiterW[] = {'<','/','s','c','r','i','p','t','>',0};
 
     ctx->code = ctx->ptr = code;
     ctx->end = ctx->code + strlenW(ctx->code);
 
     ctx->code = ctx->ptr = code;
     ctx->end = ctx->code + strlenW(ctx->code);
index daed7ec..a836b1d 100644 (file)
@@ -236,7 +236,7 @@ static HRESULT invoke_builtin(vbdisp_t *This, const builtin_prop_t *prop, WORD f
         return E_FAIL;
     }
 
         return E_FAIL;
     }
 
-    assert(argn < sizeof(args)/sizeof(*args));
+    assert(argn < ARRAY_SIZE(args));
 
     for(i=0; i < argn; i++) {
         if(V_VT(dp->rgvarg+dp->cArgs-i-1) == (VT_BYREF|VT_VARIANT))
 
     for(i=0; i < argn; i++) {
         if(V_VT(dp->rgvarg+dp->cArgs-i-1) == (VT_BYREF|VT_VARIANT))
@@ -647,7 +647,7 @@ HRESULT create_procedure_disp(script_ctx_t *ctx, vbscode_t *code, IDispatch **re
         return E_OUTOFMEMORY;
 
     desc->ctx = ctx;
         return E_OUTOFMEMORY;
 
     desc->ctx = ctx;
-    desc->builtin_prop_cnt = sizeof(procedure_props)/sizeof(*procedure_props);
+    desc->builtin_prop_cnt = ARRAY_SIZE(procedure_props);
     desc->builtin_props = procedure_props;
     desc->value_func = &code->main_code;
 
     desc->builtin_props = procedure_props;
     desc->value_func = &code->main_code;
 
index 7b7161c..786b7fb 100644 (file)
@@ -87,7 +87,7 @@ static void release_typelib(void)
     if(!typelib)
         return;
 
     if(!typelib)
         return;
 
-    for(i=0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++) {
+    for(i = 0; i < ARRAY_SIZE(typeinfos); i++) {
         if(typeinfos[i])
             ITypeInfo_Release(typeinfos[i]);
     }
         if(typeinfos[i])
             ITypeInfo_Release(typeinfos[i]);
     }
index 723f86c..78330c4 100644 (file)
@@ -191,7 +191,7 @@ reactos/dll/win32/url                 # Synced to WineStaging-3.3
 reactos/dll/win32/urlmon              # Synced to WineStaging-4.0
 reactos/dll/win32/usp10               # Synced to WineStaging-4.0
 reactos/dll/win32/uxtheme             # Forked
 reactos/dll/win32/urlmon              # Synced to WineStaging-4.0
 reactos/dll/win32/usp10               # Synced to WineStaging-4.0
 reactos/dll/win32/uxtheme             # Forked
-reactos/dll/win32/vbscript            # Synced to WineStaging-3.9
+reactos/dll/win32/vbscript            # Synced to WineStaging-4.0
 reactos/dll/win32/version             # Synced to WineStaging-3.9
 reactos/dll/win32/vssapi              # Synced to WineStaging-2.9
 reactos/dll/win32/wbemdisp            # Synced to WineStaging-3.3
 reactos/dll/win32/version             # Synced to WineStaging-3.9
 reactos/dll/win32/vssapi              # Synced to WineStaging-2.9
 reactos/dll/win32/wbemdisp            # Synced to WineStaging-3.3