msi [1/4]: Use fetch_int to reduce code duplication and access to table data

James Hawkins truiken at gmail.com
Thu Jun 7 18:37:48 CDT 2007


Hi,

The following four patches allow the Visual Studio 2005 installer to
load up and get running.  The first two patches reduce the lines of
code that access the table data directly.  This reduces the patch size
of the third patch, which switches the table over to bytes instead of
shorts.  Making this switch is required because string references in
all tables of a package that have large string tables (> 2^16-1
strings) are 3 bytes instead of 2 bytes, so we need access off the
boundary alignment of shorts.  The final patch adds the actual support
for 3 bytes string references (actually, it can be any length).

Changelog:
* Use fetch_int to reduce code duplication and access to table data.

 dlls/msi/table.c |   29 +++--------------------------
 1 files changed, 3 insertions(+), 26 deletions(-)

-- 
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/table.c b/dlls/msi/table.c
index 64ddcab..bba93dc 100644
--- a/dlls/msi/table.c
+++ b/dlls/msi/table.c
@@ -1565,33 +1565,10 @@ static UINT TABLE_find_matching_rows( st
 
         for (i = 0; i < num_rows; i++, new_entry++)
         {
-            UINT row_value, n;
-            UINT offset;
-            USHORT **data;
-            UINT row = i;
-            if( row >= tv->table->row_count )
-            {
-                row -= tv->table->row_count;
-                data = tv->table->nonpersistent_data;
-            }
-            else
-                data = tv->table->data;
-            n = bytes_per_column( &tv->columns[col-1] );
-            switch( n )
-            {
-            case 4:
-                offset = tv->columns[col-1].offset/2;
-                row_value = data[row][offset] +
-                    (data[row][offset + 1] << 16);
-                break;
-            case 2:
-                offset = tv->columns[col-1].offset/2;
-                row_value = data[row][offset];
-                break;
-            default:
-                ERR("oops! what is %d bytes per column?\n", n );
+            UINT row_value;
+
+            if (view->ops->fetch_int( view, i, col, &row_value ) != ERROR_SUCCESS)
                 continue;
-            }
 
             new_entry->next = NULL;
             new_entry->value = row_value;
-- 
1.4.1


More information about the wine-patches mailing list