Zebediah Figura : msi: Use a BOOL to track string persistence.

Alexandre Julliard julliard at winehq.org
Fri Jan 25 16:29:06 CST 2019


Module: wine
Branch: master
Commit: a7f455b97fdd0ef07a15b66eea63f82522ff4f31
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a7f455b97fdd0ef07a15b66eea63f82522ff4f31

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu Jan 24 00:07:32 2019 -0600

msi: Use a BOOL to track string persistence.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msi/msipriv.h  |  8 +-------
 dlls/msi/storages.c |  2 +-
 dlls/msi/streams.c  |  4 ++--
 dlls/msi/string.c   | 18 +++++++++---------
 dlls/msi/table.c    |  8 +++-----
 5 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index d05ad0e..1cbeae4 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/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/dlls/msi/storages.c b/dlls/msi/storages.c
index 9d262b7..4379ae2 100644
--- a/dlls/msi/storages.c
+++ b/dlls/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/dlls/msi/streams.c b/dlls/msi/streams.c
index 37b8cb3..fc9f715 100644
--- a/dlls/msi/streams.c
+++ b/dlls/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)
     {
@@ -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++;
 
diff --git a/dlls/msi/string.c b/dlls/msi/string.c
index 7383fdd..9dec32d 100644
--- a/dlls/msi/string.c
+++ b/dlls/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/dlls/msi/table.c b/dlls/msi/table.c
index 4a06334..dfa4469 100644
--- a/dlls/msi/table.c
+++ b/dlls/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
                 {




More information about the wine-cvs mailing list