Commit 4102d8a0 authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

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

parent 7325b798
...@@ -127,6 +127,7 @@ typedef struct { ...@@ -127,6 +127,7 @@ typedef struct {
BOOL txt; BOOL txt;
DWORD list_nb_elements; DWORD list_nb_elements;
BOOL list_type_float; BOOL list_type_float;
BOOL list_separator;
ULONG cur_pos_data; ULONG cur_pos_data;
LPBYTE cur_pstrings; LPBYTE cur_pstrings;
BYTE value[100]; BYTE value[100];
......
...@@ -743,16 +743,26 @@ static WORD parse_TOKEN(parse_buffer * buf) ...@@ -743,16 +743,26 @@ static WORD parse_TOKEN(parse_buffer * buf)
if (buf->list_nb_elements) if (buf->list_nb_elements)
{ {
token = buf->list_type_float ? TOKEN_FLOAT : TOKEN_INTEGER; if (buf->list_separator)
buf->list_nb_elements--; {
{ buf->list_nb_elements--;
DWORD integer; 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)) if (!read_bytes(buf, &value, 4))
return TOKEN_ERROR; 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); dump_TOKEN(token);
return token; return token;
} }
...@@ -1288,10 +1298,6 @@ static BOOL parse_object_parts(parse_buffer * buf, BOOL allow_optional) ...@@ -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; 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) while (1)
{ {
if (check_TOKEN(buf) == TOKEN_OBRACE) if (check_TOKEN(buf) == TOKEN_OBRACE)
......
...@@ -921,11 +921,11 @@ static void test_syntax_semicolon_comma(void) ...@@ -921,11 +921,11 @@ static void test_syntax_semicolon_comma(void)
/* Test object with a single integer list in binary mode */ /* 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)); 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 */ /* 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)); 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 */ /* 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)); ret = test_buffer_object(dxfile, object_syntax_integer_list_semicolon_bin, sizeof(object_syntax_integer_list_semicolon_bin));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment