Hans Leidekker : msi: Get rid of the refcount parameter to msi_addstringW.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Feb 13 07:55:57 CST 2015


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Fri Feb 13 13:38:14 2015 +0100

msi: Get rid of the refcount parameter to msi_addstringW.

---

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

diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 661535f..e4a8235 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -750,7 +750,7 @@ enum StringPersistence
     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 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 35c1de5..3ca708c 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_addstringW(sv->db->strings, name, -1, 1, StringNonPersistent);
+    storage->str_index = msi_add_string(sv->db->strings, name, -1, StringNonPersistent);
     storage->storage = stg;
 
     if (storage->storage)
diff --git a/dlls/msi/streams.c b/dlls/msi/streams.c
index 28a572d..d795c8a 100644
--- a/dlls/msi/streams.c
+++ b/dlls/msi/streams.c
@@ -83,7 +83,7 @@ static STREAM *create_stream(MSISTREAMSVIEW *sv, LPCWSTR name, BOOL encoded, ISt
         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;
     return stream;
 }
diff --git a/dlls/msi/string.c b/dlls/msi/string.c
index 8e3e575..f094a53 100644
--- a/dlls/msi/string.c
+++ b/dlls/msi/string.c
@@ -231,7 +231,7 @@ static void set_st_entry( string_table *st, UINT n, WCHAR *str, int len, USHORT
         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;
     UINT r = ERROR_INVALID_PARAMETER;
@@ -258,7 +258,7 @@ static UINT msi_string2idA( const string_table *st, LPCSTR buffer, UINT *id )
     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;
     int sz;
@@ -273,7 +273,7 @@ static int msi_addstring( string_table *st, UINT n, const char *data, UINT len,
     }
     else
     {
-        if( ERROR_SUCCESS == msi_string2idA( st, data, &n ) )
+        if (string2id( st, data, &n ) == ERROR_SUCCESS)
         {
             if (persistence == StringPersistent)
                 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;
 }
 
-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;
     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 (persistence == StringPersistent)
-            st->strings[n].persistent_refcount += refcount;
+            st->strings[n].persistent_refcount++;
         else
-            st->strings[n].nonpersistent_refcount += refcount;
+            st->strings[n].nonpersistent_refcount++;
         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) );
     str[len] = 0;
 
-    set_st_entry( st, n, str, len, refcount, persistence );
+    set_st_entry( st, n, str, len, 1, persistence );
     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] 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.
  */
-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;
     const WCHAR *str;
@@ -546,7 +546,7 @@ string_table *msi_load_string_table( IStorage *stg, UINT *bytes_per_strref )
             break;
         }
 
-        r = msi_addstring( st, n, data+offset, len, refs, StringPersistent );
+        r = add_string( st, n, data+offset, len, refs, StringPersistent );
         if( r != n )
             ERR("Failed to add string %d\n", n );
         n++;
@@ -616,7 +616,7 @@ UINT msi_save_string_table( const string_table *st, IStorage *storage, UINT *byt
         }
 
         sz = datasize - used;
-        r = msi_id2stringA( st, i, data+used, &sz );
+        r = id2string( st, i, data+used, &sz );
         if( r != ERROR_SUCCESS )
         {
             ERR("failed to fetch string\n");
diff --git a/dlls/msi/table.c b/dlls/msi/table.c
index 3cd939e..53f4b4b 100644
--- a/dlls/msi/table.c
+++ b/dlls/msi/table.c
@@ -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 )
     {
-        UINT table_id = msi_addstringW( db->strings, col->table, -1, 1, string_persistence );
-        UINT col_id = msi_addstringW( db->strings, col->column, -1, 1, string_persistence );
+        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 );
 
         table->colinfo[ i ].tablename = msi_string_lookup( db->strings, table_id, NULL );
         table->colinfo[ i ].number = i + 1;
@@ -1369,8 +1369,8 @@ 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_addstringW( tv->db->strings, sval, len, 1,
-                      persistent ? StringPersistent : StringNonPersistent );
+                    val = msi_add_string( tv->db->strings, sval, len,
+                                          persistent ? StringPersistent : StringNonPersistent );
                 }
                 else
                 {




More information about the wine-cvs mailing list