Jacek Caban : jscript: Use enum to pass enumeration type to jsdisp_next_prop.

Alexandre Julliard julliard at winehq.org
Tue Apr 20 16:27:47 CDT 2021


Module: wine
Branch: master
Commit: c4948c428a58bcbd12e11054af6f72e8c024d4d0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c4948c428a58bcbd12e11054af6f72e8c024d4d0

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Apr 20 19:11:56 2021 +0200

jscript: Use enum to pass enumeration type to jsdisp_next_prop.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/jscript/dispex.c  | 8 ++++----
 dlls/jscript/jscript.h | 7 ++++++-
 dlls/jscript/object.c  | 4 ++--
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c
index 67b7cfad005..61f4df48c86 100644
--- a/dlls/jscript/dispex.c
+++ b/dlls/jscript/dispex.c
@@ -1700,7 +1700,7 @@ static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex,
 
     TRACE("(%p)->(%x %x %p)\n", This, grfdex, id, pid);
 
-    hres = jsdisp_next_prop(This, id, FALSE, pid);
+    hres = jsdisp_next_prop(This, id, JSDISP_ENUM_ALL, pid);
     if(hres == S_FALSE)
         *pid = DISPID_STARTENUM;
     return hres;
@@ -2366,12 +2366,12 @@ HRESULT disp_delete(IDispatch *disp, DISPID id, BOOL *ret)
     return S_OK;
 }
 
-HRESULT jsdisp_next_prop(jsdisp_t *obj, DISPID id, BOOL own_only, DISPID *ret)
+HRESULT jsdisp_next_prop(jsdisp_t *obj, DISPID id, enum jsdisp_enum_type enum_type, DISPID *ret)
 {
     dispex_prop_t *iter;
     HRESULT hres;
 
-    if(id == DISPID_STARTENUM && !own_only) {
+    if(id == DISPID_STARTENUM && enum_type == JSDISP_ENUM_ALL) {
         hres = fill_protrefs(obj);
         if(FAILED(hres))
             return hres;
@@ -2383,7 +2383,7 @@ HRESULT jsdisp_next_prop(jsdisp_t *obj, DISPID id, BOOL own_only, DISPID *ret)
     for(iter = &obj->props[id + 1]; iter < obj->props + obj->prop_cnt; iter++) {
         if(!iter->name || iter->type == PROP_DELETED)
             continue;
-        if(own_only && iter->type == PROP_PROTREF)
+        if(enum_type != JSDISP_ENUM_ALL && iter->type == PROP_PROTREF)
             continue;
         if(!(get_flags(obj, iter) & PROPF_ENUMERABLE))
             continue;
diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h
index 3c870a68a54..ec2c6583682 100644
--- a/dlls/jscript/jscript.h
+++ b/dlls/jscript/jscript.h
@@ -290,6 +290,11 @@ void jsdisp_release(jsdisp_t*) DECLSPEC_HIDDEN;
 
 #endif
 
+enum jsdisp_enum_type {
+    JSDISP_ENUM_ALL,
+    JSDISP_ENUM_OWN_ENUMERABLE
+};
+
 HRESULT create_dispex(script_ctx_t*,const builtin_info_t*,jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN;
 HRESULT init_dispex(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*) DECLSPEC_HIDDEN;
 HRESULT init_dispex_from_constr(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*) DECLSPEC_HIDDEN;
@@ -315,7 +320,7 @@ HRESULT jsdisp_delete_idx(jsdisp_t*,DWORD) DECLSPEC_HIDDEN;
 HRESULT jsdisp_get_own_property(jsdisp_t*,const WCHAR*,BOOL,property_desc_t*) DECLSPEC_HIDDEN;
 HRESULT jsdisp_define_property(jsdisp_t*,const WCHAR*,property_desc_t*) DECLSPEC_HIDDEN;
 HRESULT jsdisp_define_data_property(jsdisp_t*,const WCHAR*,unsigned,jsval_t) DECLSPEC_HIDDEN;
-HRESULT jsdisp_next_prop(jsdisp_t*,DISPID,BOOL,DISPID*) DECLSPEC_HIDDEN;
+HRESULT jsdisp_next_prop(jsdisp_t*,DISPID,enum jsdisp_enum_type,DISPID*) DECLSPEC_HIDDEN;
 HRESULT jsdisp_get_prop_name(jsdisp_t*,DISPID,jsstr_t**);
 void jsdisp_freeze(jsdisp_t*,BOOL) DECLSPEC_HIDDEN;
 BOOL jsdisp_is_frozen(jsdisp_t*,BOOL) DECLSPEC_HIDDEN;
diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c
index b957ea58bdf..a47516c7710 100644
--- a/dlls/jscript/object.c
+++ b/dlls/jscript/object.c
@@ -404,7 +404,7 @@ static HRESULT jsdisp_define_properties(script_ctx_t *ctx, jsdisp_t *obj, jsval_
     }
 
     while(1) {
-        hres = jsdisp_next_prop(list_obj, id, TRUE, &id);
+        hres = jsdisp_next_prop(list_obj, id, JSDISP_ENUM_OWN_ENUMERABLE, &id);
         if(hres != S_OK)
             break;
 
@@ -652,7 +652,7 @@ static HRESULT Object_keys(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
         return hres;
 
     do {
-        hres = jsdisp_next_prop(obj, id, TRUE, &id);
+        hres = jsdisp_next_prop(obj, id, JSDISP_ENUM_OWN_ENUMERABLE, &id);
         if(hres != S_OK)
             break;
 




More information about the wine-cvs mailing list