[PATCH] d3dxof: Cleanup separators handling and allow multi-semicolons + single comma separator.

Christian Costa titan.costa at gmail.com
Mon May 20 17:05:12 CDT 2013


There is one test becoming todo. This will be fixed in another patch.
This patch also should fix bug 30897.
---
 dlls/d3dxof/parsing.c      |   35 ++++++++++-------------------------
 dlls/d3dxof/tests/d3dxof.c |   22 +++++++++++-----------
 2 files changed, 21 insertions(+), 36 deletions(-)

diff --git a/dlls/d3dxof/parsing.c b/dlls/d3dxof/parsing.c
index 37cf2e1..9f6f0bb 100644
--- a/dlls/d3dxof/parsing.c
+++ b/dlls/d3dxof/parsing.c
@@ -1157,21 +1157,6 @@ 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;
@@ -1270,23 +1255,23 @@ static BOOL parse_object_members_list(parse_buffer * buf)
           }
         }
         else
-	{
+        {
           FIXME("Unexpected token %d\n", token);
           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))
-    {
-      token = get_TOKEN(buf);
-      if ((token != TOKEN_SEMICOLON) && (token != TOKEN_COMMA))
+      /* Handle separator */
+      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;
   }
 
diff --git a/dlls/d3dxof/tests/d3dxof.c b/dlls/d3dxof/tests/d3dxof.c
index 52012d7..ecd4ba5 100644
--- a/dlls/d3dxof/tests/d3dxof.c
+++ b/dlls/d3dxof/tests/d3dxof.c
@@ -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));




More information about the wine-patches mailing list