Hans Leidekker : msi: Get rid of MSI_RecordSetStringA.

Alexandre Julliard julliard at winehq.org
Mon Oct 29 13:52:52 CDT 2012


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Mon Oct 29 12:13:29 2012 +0100

msi: Get rid of MSI_RecordSetStringA.

---

 dlls/msi/record.c |   34 ++++++++--------------------------
 1 files changed, 8 insertions(+), 26 deletions(-)

diff --git a/dlls/msi/record.c b/dlls/msi/record.c
index 3bf1ee5..263ea2c 100644
--- a/dlls/msi/record.c
+++ b/dlls/msi/record.c
@@ -574,45 +574,27 @@ UINT WINAPI MsiRecordDataSize(MSIHANDLE handle, UINT iField)
     return ret;
 }
 
-static UINT MSI_RecordSetStringA( MSIRECORD *rec, UINT iField, LPCSTR szValue )
-{
-    LPWSTR str;
-
-    TRACE("%p %d %s\n", rec, iField, debugstr_a(szValue));
-
-    if( iField > rec->count )
-        return ERROR_INVALID_FIELD;
-
-    MSI_FreeField( &rec->fields[iField] );
-    if( szValue && szValue[0] )
-    {
-        str = strdupAtoW( szValue );
-        rec->fields[iField].type = MSIFIELD_WSTR;
-        rec->fields[iField].u.szwVal = str;
-    }
-    else
-    {
-        rec->fields[iField].type = MSIFIELD_NULL;
-        rec->fields[iField].u.szwVal = NULL;
-    }
-
-    return 0;
-}
-
 UINT WINAPI MsiRecordSetStringA( MSIHANDLE handle, UINT iField, LPCSTR szValue )
 {
+    WCHAR *valueW = NULL;
     MSIRECORD *rec;
     UINT ret;
 
     TRACE("%d %d %s\n", handle, iField, debugstr_a(szValue));
 
+    if (szValue && !(valueW = strdupAtoW( szValue ))) return ERROR_OUTOFMEMORY;
+
     rec = msihandle2msiinfo( handle, MSIHANDLETYPE_RECORD );
     if( !rec )
+    {
+        msi_free( valueW );
         return ERROR_INVALID_HANDLE;
+    }
     msiobj_lock( &rec->hdr );
-    ret = MSI_RecordSetStringA( rec, iField, szValue );
+    ret = MSI_RecordSetStringW( rec, iField, valueW );
     msiobj_unlock( &rec->hdr );
     msiobj_release( &rec->hdr );
+    msi_free( valueW );
     return ret;
 }
 




More information about the wine-cvs mailing list