https://git.reactos.org/?p=reactos.git;a=commitdiff;h=211c4104969b2c9d23b40…
commit 211c4104969b2c9d23b40e43c05cd90ddf17f033
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sun Mar 13 00:16:29 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:28:09 2022 +0100
[WINESYNC] msi: Use a BOOL to track string persistence.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id a7f455b97fdd0ef07a15b66eea63f82522ff4f31 by Zebediah Figura
<z.figura12(a)gmail.com>
---
dll/win32/msi/msipriv.h | 8 +-------
dll/win32/msi/storages.c | 2 +-
dll/win32/msi/streams.c | 4 ++--
dll/win32/msi/string.c | 18 +++++++++---------
dll/win32/msi/table.c | 8 +++-----
5 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h
index 90fd569aea8..16b02ae86eb 100644
--- a/dll/win32/msi/msipriv.h
+++ b/dll/win32/msi/msipriv.h
@@ -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;
diff --git a/dll/win32/msi/storages.c b/dll/win32/msi/storages.c
index 9d262b78f72..4379ae268b2 100644
--- a/dll/win32/msi/storages.c
+++ b/dll/win32/msi/storages.c
@@ -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)
diff --git a/dll/win32/msi/streams.c b/dll/win32/msi/streams.c
index 78d8aaa69c2..845c3f2608e 100644
--- a/dll/win32/msi/streams.c
+++ b/dll/win32/msi/streams.c
@@ -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)
{
@@ -423,7 +423,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++;
diff --git a/dll/win32/msi/string.c b/dll/win32/msi/string.c
index 7383fddbed3..9dec32d73fe 100644
--- a/dll/win32/msi/string.c
+++ b/dll/win32/msi/string.c
@@ -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++;
diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c
index 4a0633441f0..dfa4469befd 100644
--- a/dll/win32/msi/table.c
+++ b/dll/win32/msi/table.c
@@ -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
{