msi: Remove the string index parameter from msi_addstringW.

This commit is contained in:
Hans Leidekker 2010-04-19 12:37:38 +02:00 committed by Alexandre Julliard
parent fc15e565d3
commit 8f53405544
5 changed files with 15 additions and 30 deletions

View File

@ -660,8 +660,7 @@ enum StringPersistence
StringNonPersistent = 1
};
extern BOOL msi_addstringW( string_table *st, UINT string_no, const WCHAR *data, int len, USHORT refcount, enum StringPersistence persistence );
extern BOOL msi_addstringW( string_table *st, const WCHAR *data, int len, USHORT refcount, enum StringPersistence persistence );
extern UINT msi_string2idW( const string_table *st, LPCWSTR buffer, UINT *id );
extern VOID msi_destroy_stringtable( string_table *st );
extern const WCHAR *msi_string_lookup_id( const string_table *st, UINT id );

View File

@ -77,7 +77,7 @@ static STORAGE *create_storage(MSISTORAGESVIEW *sv, LPCWSTR name, IStorage *stg)
if (!storage)
return NULL;
storage->str_index = msi_addstringW(sv->db->strings, 0, name, -1, 1, StringNonPersistent);
storage->str_index = msi_addstringW(sv->db->strings, name, -1, 1, StringNonPersistent);
storage->storage = stg;
if (storage->storage)

View File

@ -84,7 +84,7 @@ static STREAM *create_stream(MSISTREAMSVIEW *sv, LPCWSTR name, BOOL encoded, ISt
name = decoded;
}
stream->str_index = msi_addstringW(sv->db->strings, 0, name, -1, 1, StringNonPersistent);
stream->str_index = msi_addstringW(sv->db->strings, name, -1, 1, StringNonPersistent);
stream->stream = stm;
return stream;
}

View File

@ -288,42 +288,28 @@ static int msi_addstring( string_table *st, UINT n, const CHAR *data, int len, U
return n;
}
int msi_addstringW( string_table *st, UINT n, const WCHAR *data, int len, USHORT refcount, enum StringPersistence persistence )
int msi_addstringW( string_table *st, const WCHAR *data, int len, USHORT refcount, enum StringPersistence persistence )
{
UINT n;
LPWSTR str;
/* TRACE("[%2d] = %s\n", string_no, debugstr_an(data,len) ); */
if( !data )
return 0;
if( !data[0] )
return 0;
if( n > 0 )
if( msi_string2idW( st, data, &n ) == ERROR_SUCCESS )
{
if( st->strings[n].persistent_refcount ||
st->strings[n].nonpersistent_refcount )
return -1;
}
else
{
if( ERROR_SUCCESS == msi_string2idW( st, data, &n ) )
{
if (persistence == StringPersistent)
st->strings[n].persistent_refcount += refcount;
else
st->strings[n].nonpersistent_refcount += refcount;
return n;
}
n = st_find_free_entry( st );
if( n == -1 )
return -1;
if (persistence == StringPersistent)
st->strings[n].persistent_refcount += refcount;
else
st->strings[n].nonpersistent_refcount += refcount;
return n;
}
if( n < 1 )
{
ERR("invalid index adding %s (%d)\n", debugstr_w( data ), n );
n = st_find_free_entry( st );
if( n == -1 )
return -1;
}
/* allocate a new string */
if(len<0)

View File

@ -1383,7 +1383,7 @@ static UINT TABLE_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UI
if ( r != ERROR_SUCCESS )
{
LPCWSTR sval = MSI_RecordGetString( rec, i + 1 );
val = msi_addstringW( tv->db->strings, 0, sval, -1, 1,
val = msi_addstringW( tv->db->strings, sval, -1, 1,
persistent ? StringPersistent : StringNonPersistent );
}