From 2cbeb20d395d9c1a1b61f0c7726e22bce2ff182a Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Thu, 30 Jun 2011 12:14:07 +0200 Subject: [PATCH] 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 e892f64f503..01df97433dc 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 d1bd6159ddd..69f6b68483c 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 414b70c09bb..09468c4bfe3 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 -- 2.11.4.GIT