From 4102d8a0dc1b02d37d834f17d1925f3b0de6e2f3 Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Thu, 30 May 2013 23:05:47 +0200 Subject: [PATCH] d3dxof: Fix list of float and integer in binary mode. --- dlls/d3dxof/d3dxof_private.h | 1 + dlls/d3dxof/parsing.c | 30 ++++++++++++++++++------------ dlls/d3dxof/tests/d3dxof.c | 4 ++-- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/dlls/d3dxof/d3dxof_private.h b/dlls/d3dxof/d3dxof_private.h index 7812fffbe22..cf33ed21cea 100644 --- a/dlls/d3dxof/d3dxof_private.h +++ b/dlls/d3dxof/d3dxof_private.h @@ -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]; diff --git a/dlls/d3dxof/parsing.c b/dlls/d3dxof/parsing.c index 9335fdccc2c..5df6f4ce8cc 100644 --- a/dlls/d3dxof/parsing.c +++ b/dlls/d3dxof/parsing.c @@ -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) diff --git a/dlls/d3dxof/tests/d3dxof.c b/dlls/d3dxof/tests/d3dxof.c index ecd4ba5202e..83fd23d22ac 100644 --- a/dlls/d3dxof/tests/d3dxof.c +++ b/dlls/d3dxof/tests/d3dxof.c @@ -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));