forked from Mirrors/wine-wine
d3dxof: Cleanup separators handling and allow multi-semicolons + single comma separator.
parent
90e913c42f
commit
e7c3b03531
|
@ -1141,6 +1141,7 @@ static BOOL parse_object_members_list(parse_buffer * buf)
|
|||
{
|
||||
ULONG k;
|
||||
ULONG nb_elems = 1;
|
||||
BOOL basic_type = TRUE;
|
||||
|
||||
buf->pxo->members[i].name = pt->members[i].name;
|
||||
buf->pxo->members[i].start = buf->cur_pos_data;
|
||||
|
@ -1157,26 +1158,12 @@ static BOOL parse_object_members_list(parse_buffer * buf)
|
|||
|
||||
for (k = 0; k < nb_elems; k++)
|
||||
{
|
||||
if (buf->txt && k)
|
||||
{
|
||||
token = check_TOKEN(buf);
|
||||
if (token == TOKEN_COMMA)
|
||||
{
|
||||
get_TOKEN(buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Allow comma omission */
|
||||
if (!((token == TOKEN_FLOAT) || (token == TOKEN_INTEGER)))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (pt->members[i].type == TOKEN_NAME)
|
||||
{
|
||||
ULONG j;
|
||||
|
||||
TRACE("Found sub-object %s\n", buf->pdxf->xtemplates[pt->members[i].idx_template].name);
|
||||
basic_type = FALSE;
|
||||
buf->level++;
|
||||
/* To do template lookup */
|
||||
for (j = 0; j < buf->pdxf->nb_xtemplates; j++)
|
||||
|
@ -1275,18 +1262,21 @@ static BOOL parse_object_members_list(parse_buffer * buf)
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Empty arrays can have the semicolon at the end or not so remove it if any and skip next check */
|
||||
if (!nb_elems && (check_TOKEN(buf) == TOKEN_SEMICOLON))
|
||||
get_TOKEN(buf);
|
||||
|
||||
if (nb_elems && buf->txt && (check_TOKEN(buf) != TOKEN_CBRACE) && (check_TOKEN(buf) != TOKEN_NAME))
|
||||
if (basic_type)
|
||||
{
|
||||
token = get_TOKEN(buf);
|
||||
if ((token != TOKEN_SEMICOLON) && (token != TOKEN_COMMA))
|
||||
/* Handle separator only for basic types */
|
||||
token = check_TOKEN(buf);
|
||||
if ((token != TOKEN_COMMA) && (token != TOKEN_SEMICOLON))
|
||||
return FALSE;
|
||||
/* Allow multi-semicolons + single comma separator */
|
||||
while (check_TOKEN(buf) == TOKEN_SEMICOLON)
|
||||
get_TOKEN(buf);
|
||||
if (check_TOKEN(buf) == TOKEN_COMMA)
|
||||
get_TOKEN(buf);
|
||||
}
|
||||
}
|
||||
|
||||
buf->pxo->members[i].size = buf->cur_pos_data - buf->pxo->members[i].start;
|
||||
}
|
||||
|
||||
|
|
|
@ -865,24 +865,24 @@ static void test_syntax_semicolon_comma(void)
|
|||
|
||||
/* Test semicolon separators in text mode */
|
||||
ret = test_buffer_object(dxfile, object_syntax_semicolon_txt, sizeof(object_syntax_semicolon_txt) - 1);
|
||||
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 semicolon separators in binary mode */
|
||||
ret = test_buffer_object(dxfile, object_syntax_semicolon_bin, sizeof(object_syntax_semicolon_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 comma separators in text mode */
|
||||
ret = test_buffer_object(dxfile, object_syntax_comma_txt, sizeof(object_syntax_comma_txt) - 1);
|
||||
ok(ret == DXFILE_OK, "test_buffer_object failed with %#x\n", ret);
|
||||
/* Test comma separators in binary mode */
|
||||
ret = test_buffer_object(dxfile, object_syntax_comma_bin, sizeof(object_syntax_comma_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 multi-semicolons separators in text mode */
|
||||
ret = test_buffer_object(dxfile, object_syntax_multi_semicolons_txt, sizeof(object_syntax_multi_semicolons_txt) - 1);
|
||||
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 multi-semicolons separators in binary mode */
|
||||
ret = test_buffer_object(dxfile, object_syntax_multi_semicolons_bin, sizeof(object_syntax_multi_semicolons_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 multi-commas separators in text mode */
|
||||
ret = test_buffer_object(dxfile, object_syntax_multi_commas_txt, sizeof(object_syntax_multi_semicolons_txt) - 1);
|
||||
|
@ -893,10 +893,10 @@ static void test_syntax_semicolon_comma(void)
|
|||
|
||||
/* Test multi-semicolons + single comma separators in text mode */
|
||||
ret = test_buffer_object(dxfile, object_syntax_multi_semicolons_and_comma_txt, sizeof(object_syntax_multi_semicolons_and_comma_txt) - 1);
|
||||
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 multi-semicolons + single comma separators in binary mode */
|
||||
ret = test_buffer_object(dxfile, object_syntax_multi_semicolons_and_comma_bin, sizeof(object_syntax_multi_semicolons_and_comma_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 comma + semicolon separators in text mode */
|
||||
ret = test_buffer_object(dxfile, object_syntax_comma_and_semicolon_txt, sizeof(object_syntax_comma_and_semicolon_txt) - 1);
|
||||
|
@ -907,14 +907,14 @@ static void test_syntax_semicolon_comma(void)
|
|||
|
||||
/* Test no ending separator in text mode */
|
||||
ret = test_buffer_object(dxfile, object_syntax_no_ending_separator_txt, sizeof(object_syntax_no_ending_separator_txt) - 1);
|
||||
todo_wine ok(ret == DXFILEERR_PARSEERROR, "test_buffer_object returned %#x, expected %#x\n", ret, DXFILEERR_PARSEERROR);
|
||||
ok(ret == DXFILEERR_PARSEERROR, "test_buffer_object returned %#x, expected %#x\n", ret, DXFILEERR_PARSEERROR);
|
||||
/* Test no ending separator in binary mode */
|
||||
ret = test_buffer_object(dxfile, object_syntax_no_ending_separator_bin, sizeof(object_syntax_no_ending_separator_bin));
|
||||
ok(ret == DXFILEERR_PARSEERROR, "test_buffer_object returned %#x, expected %#x\n", ret, DXFILEERR_PARSEERROR);
|
||||
|
||||
/* Test no array separator in text mode */
|
||||
ret = test_buffer_object(dxfile, object_syntax_array_no_separator_txt, sizeof(object_syntax_array_no_separator_txt) - 1);
|
||||
todo_wine ok(ret == DXFILEERR_PARSEERROR, "test_buffer_object returned %#x, expected %#x\n", ret, DXFILEERR_PARSEERROR);
|
||||
ok(ret == DXFILEERR_PARSEERROR, "test_buffer_object returned %#x, expected %#x\n", ret, DXFILEERR_PARSEERROR);
|
||||
/* Test no array separator in binary mode */
|
||||
ret = test_buffer_object(dxfile, object_syntax_array_no_separator_bin, sizeof(object_syntax_array_no_separator_bin));
|
||||
ok(ret == DXFILEERR_PARSEERROR, "test_buffer_object returned %#x, expected %#x\n", ret, DXFILEERR_PARSEERROR);
|
||||
|
@ -925,11 +925,11 @@ static void test_syntax_semicolon_comma(void)
|
|||
|
||||
/* 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));
|
||||
ok(ret == DXFILE_OK, "test_buffer_object failed with %#x\n", ret);
|
||||
todo_wine 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));
|
||||
todo_wine ok(ret == DXFILEERR_PARSEERROR, "test_buffer_object returned %#x, expected %#x\n", ret, DXFILEERR_PARSEERROR);
|
||||
ok(ret == DXFILEERR_PARSEERROR, "test_buffer_object returned %#x, expected %#x\n", ret, DXFILEERR_PARSEERROR);
|
||||
|
||||
/* Test integer list followed by a comma in binary mode */
|
||||
ret = test_buffer_object(dxfile, object_syntax_integer_list_comma_bin, sizeof(object_syntax_integer_list_comma_bin));
|
||||
|
|
Loading…
Reference in New Issue