Hans Leidekker : msi: Remove the string index parameter from msi_addstringW .

Alexandre Julliard julliard at winehq.org
Mon Apr 19 11:51:15 CDT 2010


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Mon Apr 19 12:37:38 2010 +0200

msi: Remove the string index parameter from msi_addstringW.

---

 dlls/msi/msipriv.h  |    3 +--
 dlls/msi/storages.c |    2 +-
 dlls/msi/streams.c  |    2 +-
 dlls/msi/string.c   |   36 +++++++++++-------------------------
 dlls/msi/table.c    |    2 +-
 5 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 2b7d6ba..fada8c6 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -660,8 +660,7 @@ enum StringPersistence
     StringNonPersistent = 1
 };
 
-extern BOOL msi_addstringW( string_table *st, UINT string_no, const WCHAR *data, int len, USHORT refcount, enum StringPersistence persistence );
-
+extern BOOL msi_addstringW( string_table *st, const WCHAR *data, int len, USHORT refcount, enum StringPersistence persistence );
 extern UINT msi_string2idW( const string_table *st, LPCWSTR buffer, UINT *id );
 extern VOID msi_destroy_stringtable( string_table *st );
 extern const WCHAR *msi_string_lookup_id( const string_table *st, UINT id );
diff --git a/dlls/msi/storages.c b/dlls/msi/storages.c
index 5b555ba..3e88874 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, 0, name, -1, 1, StringNonPersistent);
+    storage->str_index = msi_addstringW(sv->db->strings, name, -1, 1, StringNonPersistent);
     storage->storage = stg;
 
     if (storage->storage)
diff --git a/dlls/msi/streams.c b/dlls/msi/streams.c
index e4204a2..59e845d 100644
--- a/dlls/msi/streams.c
+++ b/dlls/msi/streams.c
@@ -84,7 +84,7 @@ static STREAM *create_stream(MSISTREAMSVIEW *sv, LPCWSTR name, BOOL encoded, ISt
         name = decoded;
     }
 
-    stream->str_index = msi_addstringW(sv->db->strings, 0, name, -1, 1, StringNonPersistent);
+    stream->str_index = msi_addstringW(sv->db->strings, name, -1, 1, StringNonPersistent);
     stream->stream = stm;
     return stream;
 }
diff --git a/dlls/msi/string.c b/dlls/msi/string.c
index 84f4e71..21b1db2 100644
--- a/dlls/msi/string.c
+++ b/dlls/msi/string.c
@@ -288,42 +288,28 @@ static int msi_addstring( string_table *st, UINT n, const CHAR *data, int len, U
     return n;
 }
 
-int msi_addstringW( string_table *st, UINT n, const WCHAR *data, int len, USHORT refcount, enum StringPersistence persistence )
+int msi_addstringW( string_table *st, const WCHAR *data, int len, USHORT refcount, enum StringPersistence persistence )
 {
+    UINT n;
     LPWSTR str;
 
-    /* TRACE("[%2d] = %s\n", string_no, debugstr_an(data,len) ); */
-
     if( !data )
         return 0;
     if( !data[0] )
         return 0;
-    if( n > 0 )
-    {
-        if( st->strings[n].persistent_refcount ||
-            st->strings[n].nonpersistent_refcount )
-            return -1;
-    }
-    else
+
+    if( msi_string2idW( st, data, &n ) == ERROR_SUCCESS )
     {
-        if( ERROR_SUCCESS == msi_string2idW( st, data, &n ) )
-        {
-            if (persistence == StringPersistent)
-                st->strings[n].persistent_refcount += refcount;
-            else
-                st->strings[n].nonpersistent_refcount += refcount;
-            return n;
-        }
-        n = st_find_free_entry( st );
-        if( n == -1 )
-            return -1;
+        if (persistence == StringPersistent)
+            st->strings[n].persistent_refcount += refcount;
+        else
+            st->strings[n].nonpersistent_refcount += refcount;
+        return n;
     }
 
-    if( n < 1 )
-    {
-        ERR("invalid index adding %s (%d)\n", debugstr_w( data ), n );
+    n = st_find_free_entry( st );
+    if( n == -1 )
         return -1;
-    }
 
     /* allocate a new string */
     if(len<0)
diff --git a/dlls/msi/table.c b/dlls/msi/table.c
index 6737ac5..3b117ae 100644
--- a/dlls/msi/table.c
+++ b/dlls/msi/table.c
@@ -1383,7 +1383,7 @@ static UINT TABLE_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UI
                 if ( r != ERROR_SUCCESS )
                 {
                     LPCWSTR sval = MSI_RecordGetString( rec, i + 1 );
-                    val = msi_addstringW( tv->db->strings, 0, sval, -1, 1,
+                    val = msi_addstringW( tv->db->strings, sval, -1, 1,
                       persistent ? StringPersistent : StringNonPersistent );
 
                 }




More information about the wine-cvs mailing list