Mike McCormack : msi: Clean up memset usage.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Apr 18 14:35:08 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 3a94011ab65fc87dc7f8d6788bfec4bc4d6c3d7f
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=3a94011ab65fc87dc7f8d6788bfec4bc4d6c3d7f

Author: Mike McCormack <mike at codeweavers.com>
Date:   Wed Apr 19 02:29:03 2006 +0900

msi: Clean up memset usage.

---

 dlls/msi/action.c  |   11 ++++-------
 dlls/msi/classes.c |    3 +--
 dlls/msi/msi.c     |   22 +++++++++++-----------
 3 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 66d75f9..270e9ae 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -573,8 +573,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *pac
 
     MSI_SetPropertyW(package, szAction, szInstall);
 
-    package->script = msi_alloc(sizeof(MSISCRIPT));
-    memset(package->script,0,sizeof(MSISCRIPT));
+    package->script = msi_alloc_zero(sizeof(MSISCRIPT));
 
     package->script->InWhatSequence = SEQUENCE_INSTALL;
 
@@ -3383,7 +3382,7 @@ static UINT ACTION_PublishFeatures(MSIPA
             MSICOMPONENT* component = cl->component;
             WCHAR buf[21];
 
-            memset(buf,0,sizeof(buf));
+            buf[0] = 0;
             if (component->ComponentId)
             {
                 TRACE("From %s\n",debugstr_w(component->ComponentId));
@@ -3914,8 +3913,7 @@ static LPWSTR load_ttfname_from(LPCWSTR 
                                     ttRecord.uStringOffset + 
                                     ttNTHeader.uStorageOffset,
                                     NULL, FILE_BEGIN);
-                    buf = msi_alloc( ttRecord.uStringLength + 1 + strlen(tt) );
-                    memset(buf, 0, ttRecord.uStringLength + 1 + strlen(tt));
+                    buf = msi_alloc_zero( ttRecord.uStringLength + 1 + strlen(tt) );
                     ReadFile(handle, buf, ttRecord.uStringLength, &dwRead, NULL);
                     if (strlen(buf) > 0)
                     {
@@ -4080,8 +4078,7 @@ static UINT ITERATE_PublishComponent(MSI
     sz+=3;
     sz *= sizeof(WCHAR);
            
-    output = msi_alloc(sz);
-    memset(output,0,sz);
+    output = msi_alloc_zero(sz);
     strcpyW(output,advertise);
     msi_free(advertise);
 
diff --git a/dlls/msi/classes.c b/dlls/msi/classes.c
index 45bd616..743ac86 100644
--- a/dlls/msi/classes.c
+++ b/dlls/msi/classes.c
@@ -1160,8 +1160,7 @@ static UINT register_verb(MSIPACKAGE *pa
          size += strlenW(verb->Argument);
      size += 4;
 
-     command = msi_alloc(size * sizeof (WCHAR));
-     memset(command,0,size*sizeof(WCHAR));
+     command = msi_alloc_zero(size * sizeof (WCHAR));
 
      strcpyW(command,advertise);
      if (verb->Argument)
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index b2038a1..1c22ac3 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -1891,29 +1891,29 @@ UINT WINAPI MsiReinstallFeatureW( LPCWST
     FIXME("%s %s %li\n", debugstr_w(szProduct), debugstr_w(szFeature),
                            dwReinstallMode);
 
-    memset(reinstallmode,0,sizeof(reinstallmode));
     ptr = reinstallmode;
 
     if (dwReinstallMode & REINSTALLMODE_FILEMISSING)
-        { *ptr = 'p'; ptr++; }
+        *ptr++ = 'p';
     if (dwReinstallMode & REINSTALLMODE_FILEOLDERVERSION)
-        { *ptr = 'o'; ptr++; }
+        *ptr++ = 'o';
     if (dwReinstallMode & REINSTALLMODE_FILEEQUALVERSION)
-        { *ptr = 'w'; ptr++; }
+        *ptr++ = 'w';
     if (dwReinstallMode & REINSTALLMODE_FILEEXACT)
-        { *ptr = 'd'; ptr++; }
+        *ptr++ = 'd';
     if (dwReinstallMode & REINSTALLMODE_FILEVERIFY)
-        { *ptr = 'c'; ptr++; }
+        *ptr++ = 'c';
     if (dwReinstallMode & REINSTALLMODE_FILEREPLACE)
-        { *ptr = 'a'; ptr++; }
+        *ptr++ = 'a';
     if (dwReinstallMode & REINSTALLMODE_USERDATA)
-        { *ptr = 'u'; ptr++; }
+        *ptr++ = 'u';
     if (dwReinstallMode & REINSTALLMODE_MACHINEDATA)
-        { *ptr = 'm'; ptr++; }
+        *ptr++ = 'm';
     if (dwReinstallMode & REINSTALLMODE_SHORTCUT)
-        { *ptr = 's'; ptr++; }
+        *ptr++ = 's';
     if (dwReinstallMode & REINSTALLMODE_PACKAGE)
-        { *ptr = 'v'; ptr++; }
+        *ptr++ = 'v';
+    *ptr = 0;
     
     sz = sizeof(sourcepath);
     MsiSourceListGetInfoW(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED, 




More information about the wine-cvs mailing list