Mike McCormack : msi: Split MSI_CreatePackage into two functions.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Nov 14 05:14:32 CST 2006


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

Author: Mike McCormack <mike at codeweavers.com>
Date:   Tue Nov 14 14:47:24 2006 +0900

msi: Split MSI_CreatePackage into two functions.

---

 dlls/msi/package.c |   53 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index 15c39ca..164c7f2 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -427,34 +427,20 @@ static UINT msi_get_word_count( MSIPACKA
     return word_count;
 }
 
-MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPWSTR base_url )
+static MSIPACKAGE *msi_alloc_package( void )
 {
-    static const WCHAR szLevel[] = { 'U','I','L','e','v','e','l',0 };
-    static const WCHAR szpi[] = {'%','i',0};
-    static const WCHAR szProductCode[] = {
-        'P','r','o','d','u','c','t','C','o','d','e',0};
-    MSIPACKAGE *package = NULL;
-    WCHAR uilevel[10];
+    MSIPACKAGE *package;
     int i;
 
-    TRACE("%p\n", db);
-
     package = alloc_msiobject( MSIHANDLETYPE_PACKAGE, sizeof (MSIPACKAGE),
                                MSI_FreePackage );
     if( package )
     {
-        msiobj_addref( &db->hdr );
-
-        package->db = db;
         list_init( &package->components );
         list_init( &package->features );
         list_init( &package->files );
         list_init( &package->tempfiles );
         list_init( &package->folders );
-        package->ActionFormat = NULL;
-        package->LastAction = NULL;
-        package->dialog = NULL;
-        package->next_dialog = NULL;
         list_init( &package->subscriptions );
         list_init( &package->appids );
         list_init( &package->classes );
@@ -463,16 +449,39 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABA
         list_init( &package->progids );
         list_init( &package->RunningActions );
 
+        for (i=0; i<PROPERTY_HASH_SIZE; i++)
+            list_init( &package->props[i] );
+
+        package->ActionFormat = NULL;
+        package->LastAction = NULL;
+        package->dialog = NULL;
+        package->next_dialog = NULL;
+    }
+
+    return package;
+}
+
+MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPWSTR base_url )
+{
+    static const WCHAR szLevel[] = { 'U','I','L','e','v','e','l',0 };
+    static const WCHAR szpi[] = {'%','i',0};
+    static const WCHAR szProductCode[] = {
+        'P','r','o','d','u','c','t','C','o','d','e',0};
+    MSIPACKAGE *package;
+    WCHAR uilevel[10];
+
+    TRACE("%p\n", db);
+
+    package = msi_alloc_package();
+    if (package)
+    {
+        msiobj_addref( &db->hdr );
+        package->db = db;
+
         package->WordCount = msi_get_word_count( package );
         package->PackagePath = strdupW( db->path );
         package->BaseURL = strdupW( base_url );
 
-        /* OK, here is where we do a slew of things to the database to 
-         * prep for all that is to come as a package */
-
-        for (i=0; i<PROPERTY_HASH_SIZE; i++)
-            list_init( &package->props[i] );
-
         clone_properties( package );
         set_installer_properties(package);
         sprintfW(uilevel,szpi,gUILevel);




More information about the wine-cvs mailing list