Hans Leidekker : wbemprox: Store the result index in the class enumerator instead of the view.

Alexandre Julliard julliard at winehq.org
Wed Jun 27 19:14:00 CDT 2012


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed Jun 27 11:33:52 2012 +0200

wbemprox: Store the result index in the class enumerator instead of the view.

---

 dlls/wbemprox/class.c            |   19 ++++++++++---------
 dlls/wbemprox/query.c            |    1 -
 dlls/wbemprox/wbemprox_private.h |    1 -
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c
index 524ba09..bb2c5e6 100644
--- a/dlls/wbemprox/class.c
+++ b/dlls/wbemprox/class.c
@@ -36,6 +36,7 @@ struct enum_class_object
     IEnumWbemClassObject IEnumWbemClassObject_iface;
     LONG refs;
     struct query *query;
+    UINT index;
 };
 
 static inline struct enum_class_object *impl_from_IEnumWbemClassObject(
@@ -92,11 +93,10 @@ static HRESULT WINAPI enum_class_object_Reset(
     IEnumWbemClassObject *iface )
 {
     struct enum_class_object *ec = impl_from_IEnumWbemClassObject( iface );
-    struct view *view = ec->query->view;
 
     TRACE("%p\n", iface);
 
-    view->index = 0;
+    ec->index = 0;
     return WBEM_S_NO_ERROR;
 }
 
@@ -118,14 +118,14 @@ static HRESULT WINAPI enum_class_object_Next(
     if (lTimeout != WBEM_INFINITE) FIXME("timeout not supported\n");
 
     *puReturned = 0;
-    if (view->index + uCount > view->count) return WBEM_S_FALSE;
+    if (ec->index + uCount > view->count) return WBEM_S_FALSE;
 
-    hr = WbemClassObject_create( NULL, iface, view->index, (void **)apObjects );
+    hr = WbemClassObject_create( NULL, iface, ec->index, (void **)apObjects );
     if (hr != S_OK) return hr;
 
-    view->index++;
+    ec->index++;
     *puReturned = 1;
-    if (view->index == view->count) return WBEM_S_FALSE;
+    if (ec->index == view->count) return WBEM_S_FALSE;
     if (uCount > 1) return WBEM_S_TIMEDOUT;
     return WBEM_S_NO_ERROR;
 }
@@ -159,12 +159,12 @@ static HRESULT WINAPI enum_class_object_Skip(
 
     if (lTimeout != WBEM_INFINITE) FIXME("timeout not supported\n");
 
-    if (view->index + nCount >= view->count)
+    if (ec->index + nCount >= view->count)
     {
-        view->index = view->count - 1;
+        ec->index = view->count - 1;
         return WBEM_S_FALSE;
     }
-    view->index += nCount;
+    ec->index += nCount;
     return WBEM_S_NO_ERROR;
 }
 
@@ -193,6 +193,7 @@ HRESULT EnumWbemClassObject_create(
     ec->IEnumWbemClassObject_iface.lpVtbl = &enum_class_object_vtbl;
     ec->refs  = 1;
     ec->query = query;
+    ec->index = 0;
 
     *ppObj = &ec->IEnumWbemClassObject_iface;
 
diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c
index 181549f..35b6a0c 100644
--- a/dlls/wbemprox/query.c
+++ b/dlls/wbemprox/query.c
@@ -172,7 +172,6 @@ HRESULT create_view( const struct property *proplist, const WCHAR *class,
     view->cond     = cond;
     view->result   = NULL;
     view->count    = 0;
-    view->index    = 0;
     *ret = view;
     return S_OK;
 }
diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h
index 9273744..db3cb3a 100644
--- a/dlls/wbemprox/wbemprox_private.h
+++ b/dlls/wbemprox/wbemprox_private.h
@@ -100,7 +100,6 @@ struct view
     const struct expr *cond;
     UINT *result;
     UINT  count;
-    UINT  index;
 };
 
 struct query




More information about the wine-cvs mailing list