d3dxof: Move list type and list nb elements into the parse context.

This commit is contained in:
Christian Costa 2013-05-30 23:05:39 +02:00 committed by Alexandre Julliard
parent f39547f5a8
commit 7325b798b4
3 changed files with 13 additions and 15 deletions

View File

@ -291,10 +291,9 @@ static HRESULT WINAPI IDirectXFileImpl_RegisterTemplates(IDirectXFile* iface, LP
HRESULT hr;
LPBYTE decomp_buffer = NULL;
ZeroMemory(&buf, sizeof(buf));
buf.buffer = pvData;
buf.rem_bytes = cbSize;
buf.txt = FALSE;
buf.token_present = FALSE;
buf.pdxf = This;
TRACE("(%p/%p)->(%p,%d)\n", This, iface, pvData, cbSize);

View File

@ -125,6 +125,8 @@ typedef struct {
WORD current_token;
BOOL token_present;
BOOL txt;
DWORD list_nb_elements;
BOOL list_type_float;
ULONG cur_pos_data;
LPBYTE cur_pstrings;
BYTE value[100];

View File

@ -717,10 +717,7 @@ static WORD parse_TOKEN(parse_buffer * buf)
}
else
{
static int nb_elem;
static int is_float;
if (!nb_elem)
if (!buf->list_nb_elements)
{
if (!read_bytes(buf, &token, 2))
return TOKEN_NONE;
@ -728,26 +725,26 @@ static WORD parse_TOKEN(parse_buffer * buf)
/* Convert integer and float list into separate elements */
if (token == TOKEN_INTEGER_LIST)
{
if (!read_bytes(buf, &nb_elem, 4))
if (!read_bytes(buf, &buf->list_nb_elements, 4))
return TOKEN_ERROR;
token = TOKEN_INTEGER;
is_float = FALSE;
TRACE("Integer list (TOKEN_INTEGER_LIST) of size %d\n", nb_elem);
buf->list_type_float = FALSE;
TRACE("Integer list (TOKEN_INTEGER_LIST) of size %d\n", buf->list_nb_elements);
}
else if (token == TOKEN_FLOAT_LIST)
{
if (!read_bytes(buf, &nb_elem, 4))
if (!read_bytes(buf, &buf->list_nb_elements, 4))
return TOKEN_ERROR;
token = TOKEN_FLOAT;
is_float = TRUE;
TRACE("Float list (TOKEN_FLOAT_LIST) of size %d\n", nb_elem);
buf->list_type_float = TRUE;
TRACE("Float list (TOKEN_FLOAT_LIST) of size %d\n", buf->list_nb_elements);
}
}
if (nb_elem)
if (buf->list_nb_elements)
{
token = is_float ? TOKEN_FLOAT : TOKEN_INTEGER;
nb_elem--;
token = buf->list_type_float ? TOKEN_FLOAT : TOKEN_INTEGER;
buf->list_nb_elements--;
{
DWORD integer;