msi: Get rid of the refcount parameter to msi_addstringW.

This commit is contained in:
Hans Leidekker 2015-02-13 13:38:14 +01:00 committed by Alexandre Julliard
parent d954fbf8da
commit db3346247c
5 changed files with 18 additions and 18 deletions

View File

@ -750,7 +750,7 @@ enum StringPersistence
StringNonPersistent = 1 StringNonPersistent = 1
}; };
extern BOOL msi_addstringW( string_table *st, const WCHAR *data, int len, USHORT refcount, enum StringPersistence persistence ) DECLSPEC_HIDDEN; extern BOOL msi_add_string( string_table *st, const WCHAR *data, int len, enum StringPersistence persistence ) DECLSPEC_HIDDEN;
extern UINT msi_string2id( const string_table *st, const WCHAR *data, int len, UINT *id ) DECLSPEC_HIDDEN; extern UINT msi_string2id( const string_table *st, const WCHAR *data, int len, UINT *id ) DECLSPEC_HIDDEN;
extern VOID msi_destroy_stringtable( string_table *st ) DECLSPEC_HIDDEN; extern VOID msi_destroy_stringtable( string_table *st ) DECLSPEC_HIDDEN;
extern const WCHAR *msi_string_lookup( const string_table *st, UINT id, int *len ) DECLSPEC_HIDDEN; extern const WCHAR *msi_string_lookup( const string_table *st, UINT id, int *len ) DECLSPEC_HIDDEN;

View File

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

View File

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

View File

@ -231,7 +231,7 @@ static void set_st_entry( string_table *st, UINT n, WCHAR *str, int len, USHORT
st->freeslot = n + 1; st->freeslot = n + 1;
} }
static UINT msi_string2idA( const string_table *st, LPCSTR buffer, UINT *id ) static UINT string2id( const string_table *st, const char *buffer, UINT *id )
{ {
DWORD sz; DWORD sz;
UINT r = ERROR_INVALID_PARAMETER; UINT r = ERROR_INVALID_PARAMETER;
@ -258,7 +258,7 @@ static UINT msi_string2idA( const string_table *st, LPCSTR buffer, UINT *id )
return r; return r;
} }
static int msi_addstring( string_table *st, UINT n, const char *data, UINT len, USHORT refcount, enum StringPersistence persistence ) static int add_string( string_table *st, UINT n, const char *data, UINT len, USHORT refcount, enum StringPersistence persistence )
{ {
LPWSTR str; LPWSTR str;
int sz; int sz;
@ -273,7 +273,7 @@ static int msi_addstring( string_table *st, UINT n, const char *data, UINT len,
} }
else else
{ {
if( ERROR_SUCCESS == msi_string2idA( st, data, &n ) ) if (string2id( st, data, &n ) == ERROR_SUCCESS)
{ {
if (persistence == StringPersistent) if (persistence == StringPersistent)
st->strings[n].persistent_refcount += refcount; st->strings[n].persistent_refcount += refcount;
@ -304,7 +304,7 @@ static int msi_addstring( string_table *st, UINT n, const char *data, UINT len,
return n; return n;
} }
int msi_addstringW( string_table *st, const WCHAR *data, int len, USHORT refcount, enum StringPersistence persistence ) int msi_add_string( string_table *st, const WCHAR *data, int len, enum StringPersistence persistence )
{ {
UINT n; UINT n;
LPWSTR str; LPWSTR str;
@ -320,9 +320,9 @@ int msi_addstringW( string_table *st, const WCHAR *data, int len, USHORT refcoun
if (msi_string2id( st, data, len, &n) == ERROR_SUCCESS ) if (msi_string2id( st, data, len, &n) == ERROR_SUCCESS )
{ {
if (persistence == StringPersistent) if (persistence == StringPersistent)
st->strings[n].persistent_refcount += refcount; st->strings[n].persistent_refcount++;
else else
st->strings[n].nonpersistent_refcount += refcount; st->strings[n].nonpersistent_refcount++;
return n; return n;
} }
@ -339,7 +339,7 @@ int msi_addstringW( string_table *st, const WCHAR *data, int len, USHORT refcoun
memcpy( str, data, len*sizeof(WCHAR) ); memcpy( str, data, len*sizeof(WCHAR) );
str[len] = 0; str[len] = 0;
set_st_entry( st, n, str, len, refcount, persistence ); set_st_entry( st, n, str, len, 1, persistence );
return n; return n;
} }
@ -363,7 +363,7 @@ const WCHAR *msi_string_lookup( const string_table *st, UINT id, int *len )
} }
/* /*
* msi_id2stringA * id2string
* *
* [in] st - pointer to the string table * [in] st - pointer to the string table
* [in] id - id of the string to retrieve * [in] id - id of the string to retrieve
@ -373,7 +373,7 @@ const WCHAR *msi_string_lookup( const string_table *st, UINT id, int *len )
* *
* Returned string is not nul terminated. * Returned string is not nul terminated.
*/ */
static UINT msi_id2stringA( const string_table *st, UINT id, LPSTR buffer, UINT *sz ) static UINT id2string( const string_table *st, UINT id, char *buffer, UINT *sz )
{ {
int len, lenW; int len, lenW;
const WCHAR *str; const WCHAR *str;
@ -546,7 +546,7 @@ string_table *msi_load_string_table( IStorage *stg, UINT *bytes_per_strref )
break; break;
} }
r = msi_addstring( st, n, data+offset, len, refs, StringPersistent ); r = add_string( st, n, data+offset, len, refs, StringPersistent );
if( r != n ) if( r != n )
ERR("Failed to add string %d\n", n ); ERR("Failed to add string %d\n", n );
n++; n++;
@ -616,7 +616,7 @@ UINT msi_save_string_table( const string_table *st, IStorage *storage, UINT *byt
} }
sz = datasize - used; sz = datasize - used;
r = msi_id2stringA( st, i, data+used, &sz ); r = id2string( st, i, data+used, &sz );
if( r != ERROR_SUCCESS ) if( r != ERROR_SUCCESS )
{ {
ERR("failed to fetch string\n"); ERR("failed to fetch string\n");

View File

@ -760,8 +760,8 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
for( i = 0, col = col_info; col; i++, col = col->next ) for( i = 0, col = col_info; col; i++, col = col->next )
{ {
UINT table_id = msi_addstringW( db->strings, col->table, -1, 1, string_persistence ); UINT table_id = msi_add_string( db->strings, col->table, -1, string_persistence );
UINT col_id = msi_addstringW( db->strings, col->column, -1, 1, string_persistence ); UINT col_id = msi_add_string( db->strings, col->column, -1, string_persistence );
table->colinfo[ i ].tablename = msi_string_lookup( db->strings, table_id, NULL ); table->colinfo[ i ].tablename = msi_string_lookup( db->strings, table_id, NULL );
table->colinfo[ i ].number = i + 1; table->colinfo[ i ].number = i + 1;
@ -1369,7 +1369,7 @@ static UINT TABLE_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UI
{ {
int len; int len;
const WCHAR *sval = msi_record_get_string( rec, i + 1, &len ); const WCHAR *sval = msi_record_get_string( rec, i + 1, &len );
val = msi_addstringW( tv->db->strings, sval, len, 1, val = msi_add_string( tv->db->strings, sval, len,
persistent ? StringPersistent : StringNonPersistent ); persistent ? StringPersistent : StringNonPersistent );
} }
else else