Mike McCormack : msi: Use msi_string_lookup_id instead of msi_id2stringW where possible.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Sep 8 10:24:33 CDT 2006


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

Author: Mike McCormack <mike at codeweavers.com>
Date:   Fri Sep  8 12:25:11 2006 +0900

msi: Use msi_string_lookup_id instead of msi_id2stringW where possible.

---

 dlls/msi/table.c |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/dlls/msi/table.c b/dlls/msi/table.c
index 51986d7..1c05e79 100644
--- a/dlls/msi/table.c
+++ b/dlls/msi/table.c
@@ -926,20 +926,7 @@ static void msi_free_colinfo( MSICOLUMNI
 
 LPWSTR MSI_makestring( MSIDATABASE *db, UINT stringid)
 {
-    UINT sz=0, r;
-    LPWSTR str;
-
-    r = msi_id2stringW( db->strings, stringid, NULL, &sz );
-    if( r != ERROR_SUCCESS )
-        return NULL;
-    str = msi_alloc( sz*sizeof (WCHAR) );
-    if( !str )
-        return str;
-    r = msi_id2stringW( db->strings, stringid, str, &sz );
-    if( r == ERROR_SUCCESS )
-        return str;
-    msi_free( str );
-    return NULL;
+    return strdupW(msi_string_lookup_id( db->strings, stringid ));
 }
 
 static UINT get_tablecolumns( MSIDATABASE *db, 
@@ -1116,7 +1103,7 @@ static UINT TABLE_fetch_stream( struct t
 {
     MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
     UINT ival = 0, refcol = 0, r;
-    LPWSTR sval;
+    LPCWSTR sval;
     LPWSTR full_name;
     DWORD len;
     static const WCHAR szDot[] = { '.', 0 };
@@ -1140,7 +1127,7 @@ static UINT TABLE_fetch_stream( struct t
         return r;
 
     /* lookup the string value from the string table */
-    sval = MSI_makestring( tv->db, refcol );
+    sval = msi_string_lookup_id( tv->db->strings, refcol );
     if( !sval )
         return ERROR_INVALID_PARAMETER;
 
@@ -1154,7 +1141,6 @@ static UINT TABLE_fetch_stream( struct t
     if( r )
         ERR("fetching stream %s, error = %d\n",debugstr_w(full_name), r);
     msi_free( full_name );
-    msi_free( sval );
 
     return r;
 }




More information about the wine-cvs mailing list