Hans Leidekker : msi: Use an enum to represent folder states.

Alexandre Julliard julliard at winehq.org
Fri Jul 1 14:11:03 CDT 2011


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Thu Jun 30 12:14:07 2011 +0200

msi: Use an enum to represent folder states.

---

 dlls/msi/action.c  |    6 +++---
 dlls/msi/files.c   |    4 ++--
 dlls/msi/msipriv.h |   19 ++++++++++++-------
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index e892f64..01df974 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -877,8 +877,8 @@ static UINT ITERATE_CreateFolders(MSIRECORD *row, LPVOID param)
     TRACE("folder is %s\n", debugstr_w(full_path));
 
     folder = msi_get_loaded_folder( package, dir );
-    if (folder->State == 0) msi_create_full_path( full_path );
-    folder->State = 3;
+    if (folder->State == FOLDER_STATE_UNINITIALIZED) msi_create_full_path( full_path );
+    folder->State = FOLDER_STATE_CREATED_PERSISTENT;
     return ERROR_SUCCESS;
 }
 
@@ -946,7 +946,7 @@ static UINT ITERATE_RemoveFolders( MSIRECORD *row, LPVOID param )
 
     RemoveDirectoryW( full_path );
     folder = msi_get_loaded_folder( package, dir );
-    folder->State = 0;
+    folder->State = FOLDER_STATE_REMOVED;
     return ERROR_SUCCESS;
 }
 
diff --git a/dlls/msi/files.c b/dlls/msi/files.c
index d1bd615..69f6b68 100644
--- a/dlls/msi/files.c
+++ b/dlls/msi/files.c
@@ -239,10 +239,10 @@ static UINT msi_create_directory( MSIPACKAGE *package, const WCHAR *dir )
     if (!install_path) return ERROR_FUNCTION_FAILED;
 
     folder = msi_get_loaded_folder( package, dir );
-    if (folder->State == 0)
+    if (folder->State == FOLDER_STATE_UNINITIALIZED)
     {
         msi_create_full_path( install_path );
-        folder->State = 2;
+        folder->State = FOLDER_STATE_CREATED;
     }
     return ERROR_SUCCESS;
 }
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 414b70c..09468c4 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -490,6 +490,15 @@ typedef struct tagFeatureList
     MSIFEATURE *feature;
 } FeatureList;
 
+enum folder_state
+{
+    FOLDER_STATE_UNINITIALIZED,
+    FOLDER_STATE_EXISTS,
+    FOLDER_STATE_CREATED,
+    FOLDER_STATE_CREATED_PERSISTENT,
+    FOLDER_STATE_REMOVED
+};
+
 typedef struct tagMSIFOLDER
 {
     struct list entry;
@@ -502,13 +511,9 @@ typedef struct tagMSIFOLDER
 
     LPWSTR ResolvedTarget;
     LPWSTR ResolvedSource;
-    INT   State;
-        /* 0 = uninitialized */
-        /* 1 = existing */
-        /* 2 = created remove if empty */
-        /* 3 = created persist if empty */
-    INT   Cost;
-    INT   Space;
+    enum folder_state State;
+    INT Cost;
+    INT Space;
 } MSIFOLDER;
 
 typedef struct tagFolderList




More information about the wine-cvs mailing list