Mike McCormack : msi: Factor out code to calculate column offsets.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Feb 6 08:03:31 CST 2007
Module: wine
Branch: master
Commit: a16e5151da9432f7deab7b89d4babb421b40e569
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a16e5151da9432f7deab7b89d4babb421b40e569
Author: Mike McCormack <mike at codeweavers.com>
Date: Tue Feb 6 18:08:20 2007 +0900
msi: Factor out code to calculate column offsets.
---
dlls/msi/table.c | 35 +++++++++++++++++++++--------------
1 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/dlls/msi/table.c b/dlls/msi/table.c
index dd611d2..420519b 100644
--- a/dlls/msi/table.c
+++ b/dlls/msi/table.c
@@ -873,6 +873,24 @@ static const MSICOLUMNINFO _Tables_cols[
{ szTables, 1, szName, MSITYPE_VALID | MSITYPE_STRING | 64, 0 },
};
+static void table_calc_column_offsets( MSICOLUMNINFO *colinfo, DWORD count )
+{
+ DWORD i;
+
+ for( i=0; colinfo && (i<count); i++ )
+ {
+ assert( (i+1) == colinfo[ i ].number );
+ if (i)
+ colinfo[i].offset = colinfo[ i - 1 ].offset
+ + bytes_per_column( &colinfo[ i - 1 ] );
+ else
+ colinfo[i].offset = 0;
+ TRACE("column %d is [%s] with type %08x ofs %d\n",
+ colinfo[i].number, debugstr_w(colinfo[i].colname),
+ colinfo[i].type, colinfo[i].offset);
+ }
+}
+
static UINT get_defaulttablecolumns( LPCWSTR name, MSICOLUMNINFO *colinfo, UINT *sz)
{
const MSICOLUMNINFO *p;
@@ -905,6 +923,7 @@ static UINT get_defaulttablecolumns( LPC
if( colinfo && (i >= *sz) )
break;
}
+ table_calc_column_offsets( colinfo, n );
*sz = n;
return ERROR_SUCCESS;
}
@@ -994,26 +1013,14 @@ static UINT get_tablecolumns( MSIDATABAS
TRACE("%s has %d columns\n", debugstr_w(szTableName), n);
- if (maxcount && n != maxcount)
+ if (colinfo && n != maxcount)
{
ERR("missing column in table %s\n", debugstr_w(szTableName));
msi_free_colinfo(colinfo, maxcount );
return ERROR_FUNCTION_FAILED;
}
- /* calculate the offsets */
- for( i=0; maxcount && (i<maxcount); i++ )
- {
- assert( (i+1) == colinfo[ i ].number );
- if (i)
- colinfo[i].offset = colinfo[ i - 1 ].offset
- + bytes_per_column( &colinfo[ i - 1 ] );
- else
- colinfo[i].offset = 0;
- TRACE("column %d is [%s] with type %08x ofs %d\n",
- colinfo[i].number, debugstr_w(colinfo[i].colname),
- colinfo[i].type, colinfo[i].offset);
- }
+ table_calc_column_offsets( colinfo, n );
*sz = n;
return ERROR_SUCCESS;
More information about the wine-cvs
mailing list