msi: Use a BOOL to track string persistence.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Zebediah Figura 2019-01-24 00:07:32 -06:00 committed by Alexandre Julliard
parent c2810f40a0
commit a7f455b97f
5 changed files with 16 additions and 24 deletions

View File

@ -742,13 +742,7 @@ extern UINT msi_commit_streams( MSIDATABASE *db ) DECLSPEC_HIDDEN;
/* string table functions */
enum StringPersistence
{
StringPersistent = 0,
StringNonPersistent = 1
};
extern BOOL msi_add_string( string_table *st, const WCHAR *data, int len, enum StringPersistence persistence ) DECLSPEC_HIDDEN;
extern BOOL msi_add_string( string_table *st, const WCHAR *data, int len, BOOL persistent ) 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 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)
return NULL;
storage->str_index = msi_add_string(sv->db->strings, name, -1, StringNonPersistent);
storage->str_index = msi_add_string(sv->db->strings, name, -1, FALSE);
storage->storage = stg;
if (storage->storage)

View File

@ -127,7 +127,7 @@ static UINT STREAMS_set_row(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, U
const WCHAR *name = MSI_RecordGetString( rec, 1 );
if (!name) return ERROR_INVALID_PARAMETER;
sv->db->streams[row].str_index = msi_add_string( sv->db->strings, name, -1, StringNonPersistent );
sv->db->streams[row].str_index = msi_add_string( sv->db->strings, name, -1, FALSE );
}
if (mask & 2)
{
@ -399,7 +399,7 @@ static UINT append_stream( MSIDATABASE *db, const WCHAR *name, IStream *stream )
if (!streams_resize_table( db, db->num_streams + 1 ))
return ERROR_OUTOFMEMORY;
db->streams[i].str_index = msi_add_string( db->strings, name, -1, StringNonPersistent );
db->streams[i].str_index = msi_add_string( db->strings, name, -1, FALSE );
db->streams[i].stream = stream;
db->num_streams++;

View File

@ -209,9 +209,9 @@ static void insert_string_sorted( string_table *st, UINT string_id )
}
static void set_st_entry( string_table *st, UINT n, WCHAR *str, int len, USHORT refcount,
enum StringPersistence persistence )
BOOL persistent )
{
if (persistence == StringPersistent)
if (persistent)
{
st->strings[n].persistent_refcount = refcount;
st->strings[n].nonpersistent_refcount = 0;
@ -257,7 +257,7 @@ static UINT string2id( const string_table *st, const char *buffer, UINT *id )
return r;
}
static int add_string( 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, BOOL persistent )
{
LPWSTR str;
int sz;
@ -274,7 +274,7 @@ static int add_string( string_table *st, UINT n, const char *data, UINT len, USH
{
if (string2id( st, data, &n ) == ERROR_SUCCESS)
{
if (persistence == StringPersistent)
if (persistent)
st->strings[n].persistent_refcount += refcount;
else
st->strings[n].nonpersistent_refcount += refcount;
@ -299,11 +299,11 @@ static int add_string( string_table *st, UINT n, const char *data, UINT len, USH
MultiByteToWideChar( st->codepage, 0, data, len, str, sz );
str[sz] = 0;
set_st_entry( st, n, str, sz, refcount, persistence );
set_st_entry( st, n, str, sz, refcount, persistent );
return n;
}
int msi_add_string( string_table *st, const WCHAR *data, int len, enum StringPersistence persistence )
int msi_add_string( string_table *st, const WCHAR *data, int len, BOOL persistent )
{
UINT n;
LPWSTR str;
@ -318,7 +318,7 @@ int msi_add_string( string_table *st, const WCHAR *data, int len, enum StringPer
if (msi_string2id( st, data, len, &n) == ERROR_SUCCESS )
{
if (persistence == StringPersistent)
if (persistent)
st->strings[n].persistent_refcount++;
else
st->strings[n].nonpersistent_refcount++;
@ -338,7 +338,7 @@ int msi_add_string( string_table *st, const WCHAR *data, int len, enum StringPer
memcpy( str, data, len*sizeof(WCHAR) );
str[len] = 0;
set_st_entry( st, n, str, len, 1, persistence );
set_st_entry( st, n, str, len, 1, persistent );
return n;
}
@ -545,7 +545,7 @@ string_table *msi_load_string_table( IStorage *stg, UINT *bytes_per_strref )
break;
}
r = add_string( st, n, data+offset, len, refs, StringPersistent );
r = add_string( st, n, data+offset, len, refs, TRUE );
if( r != n )
ERR("Failed to add string %d\n", n );
n++;

View File

@ -716,7 +716,6 @@ static UINT get_tablecolumns( MSIDATABASE *db, LPCWSTR szTableName, MSICOLUMNINF
UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
MSICONDITION persistent )
{
enum StringPersistence string_persistence = (persistent) ? StringPersistent : StringNonPersistent;
UINT r, nField;
MSIVIEW *tv = NULL;
MSIRECORD *rec = NULL;
@ -756,8 +755,8 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
for( i = 0, col = col_info; col; i++, col = col->next )
{
UINT table_id = msi_add_string( db->strings, col->table, -1, string_persistence );
UINT col_id = msi_add_string( db->strings, col->column, -1, string_persistence );
UINT table_id = msi_add_string( db->strings, col->table, -1, persistent );
UINT col_id = msi_add_string( db->strings, col->column, -1, persistent );
table->colinfo[ i ].tablename = msi_string_lookup( db->strings, table_id, NULL );
table->colinfo[ i ].number = i + 1;
@ -1385,8 +1384,7 @@ static UINT TABLE_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UI
{
int len;
const WCHAR *sval = msi_record_get_string( rec, i + 1, &len );
val = msi_add_string( tv->db->strings, sval, len,
persistent ? StringPersistent : StringNonPersistent );
val = msi_add_string( tv->db->strings, sval, len, persistent );
}
else
{