Christian Costa : d3dxof: Cleanup separators handling and allow multi-semicolons + single comma separator .

Alexandre Julliard julliard at winehq.org
Wed May 22 13:46:59 CDT 2013


Module: wine
Branch: master
Commit: e7c3b03531a9642cb8cce81322906c0281fa5928
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e7c3b03531a9642cb8cce81322906c0281fa5928

Author: Christian Costa <titan.costa at gmail.com>
Date:   Tue May 21 20:02:03 2013 +0200

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

---

 dlls/d3dxof/parsing.c      |   42 ++++++++++++++++--------------------------
 dlls/d3dxof/tests/d3dxof.c |   22 +++++++++++-----------
 2 files changed, 27 insertions(+), 37 deletions(-)

diff --git a/dlls/d3dxof/parsing.c b/dlls/d3dxof/parsing.c
index 37cf2e1..2faf7a2 100644
--- a/dlls/d3dxof/parsing.c
+++ b/dlls/d3dxof/parsing.c
@@ -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++)
@@ -1270,23 +1257,26 @@ 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))
-        return FALSE;
+      if (basic_type)
+      {
+        /* 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;
   }
 
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-cvs mailing list