[PATCH 1/2] d3dxof: Get rid of cur_subobject

Christian Costa titan.costa at wanadoo.fr
Wed Dec 30 15:06:11 CST 2009


---

 dlls/d3dxof/d3dxof.c         |    8 +++-----
 dlls/d3dxof/d3dxof_private.h |    1 -
 dlls/d3dxof/parsing.c        |    4 ++--
 3 files changed, 5 insertions(+), 8 deletions(-)
-------------- next part --------------
diff --git a/dlls/d3dxof/d3dxof.c b/dlls/d3dxof/d3dxof.c
index cd4690d..67e4f61 100644
--- a/dlls/d3dxof/d3dxof.c
+++ b/dlls/d3dxof/d3dxof.c
@@ -280,7 +280,6 @@ static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPV
   object->buf.pdxf = This;
   object->buf.txt = (header[2] == XOFFILE_FORMAT_TEXT);
   object->buf.token_present = FALSE;
-  object->buf.cur_subobject = 0;
 
   TRACE("File size is %d bytes\n", file_size);
 
@@ -1044,7 +1043,6 @@ static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileE
 
   This->buf.pxo_globals = This->xobjects;
   This->buf.nb_pxo_globals = This->nb_xobjects;
-  This->buf.cur_subobject = 1;
   This->buf.level = 0;
 
   This->buf.pxo_tab = HeapAlloc(GetProcessHeap(), 0, sizeof(xobject)*MAX_SUBOBJECTS);
@@ -1059,6 +1057,7 @@ static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileE
   This->buf.pxo->pdata = This->buf.pdata = NULL;
   This->buf.capacity = 0;
   This->buf.cur_pos_data = 0;
+  This->buf.pxo->nb_subobjects = 1;
 
   pstrings = HeapAlloc(GetProcessHeap(), 0, MAX_STRINGS_BUFFER);
   if (!pstrings)
@@ -1076,10 +1075,9 @@ static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileE
     goto error;
   }
 
-  This->buf.pxo->nb_subobjects = This->buf.cur_subobject;
-  if (This->buf.cur_subobject > MAX_SUBOBJECTS)
+  if (This->buf.pxo->nb_subobjects > MAX_SUBOBJECTS)
   {
-    FIXME("Too many suobjects %d\n", This->buf.cur_subobject);
+    FIXME("Too many subobjects %d\n", This->buf.pxo->nb_subobjects);
     hr = DXFILEERR_BADALLOC;
     goto error;
   }
diff --git a/dlls/d3dxof/d3dxof_private.h b/dlls/d3dxof/d3dxof_private.h
index 13c5f54..ffa27d2 100644
--- a/dlls/d3dxof/d3dxof_private.h
+++ b/dlls/d3dxof/d3dxof_private.h
@@ -128,7 +128,6 @@ typedef struct {
   WORD current_token;
   BOOL token_present;
   BOOL txt;
-  ULONG cur_subobject;
   ULONG cur_pos_data;
   LPBYTE cur_pstrings;
   BYTE value[100];
diff --git a/dlls/d3dxof/parsing.c b/dlls/d3dxof/parsing.c
index fb5ab4e..ec962b0 100644
--- a/dlls/d3dxof/parsing.c
+++ b/dlls/d3dxof/parsing.c
@@ -1212,14 +1212,14 @@ _exit:
           ERR("Reference to unknown object %s\n", (char*)buf->value);
           return FALSE;
         }
-        buf->pxo->childs[buf->pxo->nb_childs] = &buf->pxo_tab[buf->cur_subobject++];
+        buf->pxo->childs[buf->pxo->nb_childs] = &buf->pxo_tab[buf->pxo->root->nb_subobjects++];
         buf->pxo->childs[buf->pxo->nb_childs]->ptarget = &(buf->pxo_globals[i])[j];
         buf->pxo->nb_childs++;
       }
       else if (check_TOKEN(buf) == TOKEN_NAME)
       {
         xobject* pxo = buf->pxo;
-        buf->pxo = buf->pxo->childs[buf->pxo->nb_childs] = &buf->pxo_tab[buf->cur_subobject++];
+        buf->pxo = buf->pxo->childs[buf->pxo->nb_childs] = &buf->pxo_tab[buf->pxo->root->nb_subobjects++];
 
         TRACE("Enter optional %s\n", (char*)buf->value);
         buf->level++;


More information about the wine-patches mailing list