Mike McCormack : msi: Fix the join algorithm.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Oct 26 06:32:00 CDT 2006


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

Author: Mike McCormack <mike at codeweavers.com>
Date:   Thu Oct 26 18:29:52 2006 +0900

msi: Fix the join algorithm.

---

 dlls/msi/join.c     |    9 ++++++---
 dlls/msi/tests/db.c |   19 +++++--------------
 2 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/dlls/msi/join.c b/dlls/msi/join.c
index 3462521..e4e4154 100644
--- a/dlls/msi/join.c
+++ b/dlls/msi/join.c
@@ -172,13 +172,16 @@ static UINT join_match( UINT *ldata, UIN
         {
             pairs[n*2] = ldata[i*2];
             pairs[n*2+1] = rdata[j*2];
-            i++;  /* FIXME: assumes primary key on the right */
             n++;
-            continue;
+
+            if ( ldata[i*2+3] < rdata[j*2+3])
+                i++;
+            else
+                j++;
         }
 
         /* values differ... move along */
-        if (ldata[i*2+1] < rdata[j*2+1])
+        else if (ldata[i*2+1] < rdata[j*2+1])
             i++;
         else
             j++;
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index 6afb307..134c12a 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -2206,29 +2206,20 @@ static void test_join(void)
         size = MAX_PATH;
         r = MsiRecordGetString( hrec, 1, buf, &size );
         ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r );
-        if (i == 2 || i == 3) todo_wine
-        {
-            ok( !lstrcmp( buf, join_res_first[i].one ),
-                "For (row %d, column 1) expected '%s', got %s\n", i, join_res_first[i].one, buf );
-        }
+        ok( !lstrcmp( buf, join_res_first[i].one ),
+            "For (row %d, column 1) expected '%s', got %s\n", i, join_res_first[i].one, buf );
 
         size = MAX_PATH;
         r = MsiRecordGetString( hrec, 2, buf, &size );
         ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r );
-        if (i == 3) todo_wine
-        {
-            ok( !lstrcmp( buf, join_res_first[i].two ),
-                "For (row %d, column 2) expected '%s', got %s\n", i, join_res_first[i].two, buf );
-        }
+        ok( !lstrcmp( buf, join_res_first[i].two ),
+            "For (row %d, column 2) expected '%s', got %s\n", i, join_res_first[i].two, buf );
 
         i++;
         MsiCloseHandle(hrec);
     }
 
-    todo_wine
-    {
-        ok( i == 5, "Expected 5 rows, got %d\n", i );
-    }
+    ok( i == 5, "Expected 5 rows, got %d\n", i );
 
     ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r );
 




More information about the wine-cvs mailing list