d3dxof: Get rid of cur_subobject.

This commit is contained in:
Christian Costa 2009-12-30 22:06:11 +01:00 committed by Alexandre Julliard
parent b5290bde98
commit 24d6c0a90d
3 changed files with 5 additions and 8 deletions

View File

@ -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;
}

View File

@ -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];

View File

@ -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++;