Commit 47ec8ab0 authored by Hib Eris's avatar Hib Eris Committed by Alexandre Julliard

msi: Remove table_find_insert_idx().

The function table_find_insert_idx() is replaced by the more generic function find_insert_index().
parent f6ae2507
...@@ -121,7 +121,6 @@ static void table_calc_column_offsets( MSIDATABASE *db, MSICOLUMNINFO *colinfo, ...@@ -121,7 +121,6 @@ static void table_calc_column_offsets( MSIDATABASE *db, MSICOLUMNINFO *colinfo,
static UINT get_tablecolumns( MSIDATABASE *db, static UINT get_tablecolumns( MSIDATABASE *db,
LPCWSTR szTableName, MSICOLUMNINFO *colinfo, UINT *sz); LPCWSTR szTableName, MSICOLUMNINFO *colinfo, UINT *sz);
static void msi_free_colinfo( MSICOLUMNINFO *colinfo, UINT count ); static void msi_free_colinfo( MSICOLUMNINFO *colinfo, UINT count );
static UINT table_find_insert_idx (MSIVIEW *view, LPCWSTR name, INT *pidx);
static inline UINT bytes_per_column( MSIDATABASE *db, const MSICOLUMNINFO *col ) static inline UINT bytes_per_column( MSIDATABASE *db, const MSICOLUMNINFO *col )
{ {
...@@ -627,7 +626,6 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, ...@@ -627,7 +626,6 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
column_info *col; column_info *col;
MSITABLE *table; MSITABLE *table;
UINT i; UINT i;
INT idx;
/* only add tables that don't exist already */ /* only add tables that don't exist already */
if( TABLE_Exists(db, name ) ) if( TABLE_Exists(db, name ) )
...@@ -693,11 +691,7 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, ...@@ -693,11 +691,7 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
if( r ) if( r )
goto err; goto err;
r = table_find_insert_idx (tv, name, &idx); r = tv->ops->insert_row( tv, rec, -1, persistent == MSICONDITION_FALSE );
if (r != ERROR_SUCCESS)
idx = -1;
r = tv->ops->insert_row( tv, rec, idx, persistent == MSICONDITION_FALSE );
TRACE("insert_row returned %x\n", r); TRACE("insert_row returned %x\n", r);
if( r ) if( r )
goto err; goto err;
...@@ -747,11 +741,7 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, ...@@ -747,11 +741,7 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
if( r ) if( r )
goto err; goto err;
r = table_find_insert_idx (tv, name, &idx); r = tv->ops->insert_row( tv, rec, -1, FALSE );
if (r != ERROR_SUCCESS)
idx = -1;
r = tv->ops->insert_row( tv, rec, idx, FALSE );
if( r ) if( r )
goto err; goto err;
...@@ -3033,29 +3023,3 @@ void msi_free_transforms( MSIDATABASE *db ) ...@@ -3033,29 +3023,3 @@ void msi_free_transforms( MSIDATABASE *db )
msi_free( t ); msi_free( t );
} }
} }
static UINT table_find_insert_idx (MSIVIEW *view, LPCWSTR name, INT *pidx)
{
UINT r, name_id, row_id;
INT idx;
MSITABLEVIEW *tv = (MSITABLEVIEW *)view;
TRACE ("%p %s\n", view, debugstr_w(name));
r = msi_string2idW(tv->db->strings, name, &name_id);
if (r != ERROR_SUCCESS)
{
*pidx = -1;
return r;
}
for( idx = 0; idx < tv->table->row_count; idx++ )
{
r = TABLE_fetch_int( &tv->view, idx, 1, &row_id );
if (row_id > name_id)
break;
}
*pidx = idx;
return ERROR_SUCCESS;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment