Commit 8f534055 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Remove the string index parameter from msi_addstringW.

parent fc15e565
......@@ -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 );
......
......@@ -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)
......
......@@ -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;
}
......
......@@ -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( st->strings[n].persistent_refcount ||
st->strings[n].nonpersistent_refcount )
return -1;
}
else
if( msi_string2idW( st, data, &n ) == ERROR_SUCCESS )
{
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)
......
......@@ -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 );
}
......
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