d3dxof: Fix list of float and integer in binary mode.

This commit is contained in:
Christian Costa 2013-05-30 23:05:47 +02:00 committed by Alexandre Julliard
parent 7325b798b4
commit 4102d8a0dc
3 changed files with 21 additions and 14 deletions

View File

@ -127,6 +127,7 @@ typedef struct {
BOOL txt;
DWORD list_nb_elements;
BOOL list_type_float;
BOOL list_separator;
ULONG cur_pos_data;
LPBYTE cur_pstrings;
BYTE value[100];

View File

@ -743,16 +743,26 @@ static WORD parse_TOKEN(parse_buffer * buf)
if (buf->list_nb_elements)
{
token = buf->list_type_float ? TOKEN_FLOAT : TOKEN_INTEGER;
buf->list_nb_elements--;
{
DWORD integer;
if (buf->list_separator)
{
buf->list_nb_elements--;
buf->list_separator = FALSE;
/* Insert separarator between each values and since list does not accept separator at the end
use a comma so any extra separator will generate an error */
token = TOKEN_COMMA;
}
else
{
DWORD value;
if (!read_bytes(buf, &integer, 4))
return TOKEN_ERROR;
if (!read_bytes(buf, &value, 4))
return TOKEN_ERROR;
*(DWORD*)buf->value = value;
*(DWORD*)buf->value = integer;
}
buf->list_separator = TRUE;
/* Convert list into a serie of their basic type counterpart */
token = buf->list_type_float ? TOKEN_FLOAT : TOKEN_INTEGER;
}
dump_TOKEN(token);
return token;
}
@ -1288,10 +1298,6 @@ static BOOL parse_object_parts(parse_buffer * buf, BOOL allow_optional)
{
buf->pxo->size = buf->cur_pos_data - buf->pxo->pos_data;
/* Skip trailing semicolon */
while (check_TOKEN(buf) == TOKEN_SEMICOLON)
get_TOKEN(buf);
while (1)
{
if (check_TOKEN(buf) == TOKEN_OBRACE)

View File

@ -921,11 +921,11 @@ static void test_syntax_semicolon_comma(void)
/* Test object with a single integer list in binary mode */
ret = test_buffer_object(dxfile, object_syntax_full_integer_list_bin, sizeof(object_syntax_full_integer_list_bin));
todo_wine ok(ret == DXFILE_OK, "test_buffer_object failed with %#x\n", ret);
ok(ret == DXFILE_OK, "test_buffer_object failed with %#x\n", ret);
/* Test object with mixed integer list and integers + single comma separators in binary mode */
ret = test_buffer_object(dxfile, object_syntax_mixed_integer_list_bin, sizeof(object_syntax_mixed_integer_list_bin));
todo_wine ok(ret == DXFILE_OK, "test_buffer_object failed with %#x\n", ret);
ok(ret == DXFILE_OK, "test_buffer_object failed with %#x\n", ret);
/* Test integer list followed by a semicolon in binary mode */
ret = test_buffer_object(dxfile, object_syntax_integer_list_semicolon_bin, sizeof(object_syntax_integer_list_semicolon_bin));