wine/dlls/msi files.c action.h action.c
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Nov 2 04:56:42 CST 2005
ChangeSet ID: 21037
CVSROOT: /opt/cvs-commit
Module name: wine
Changes by: julliard at winehq.org 2005/11/02 04:56:42
Modified files:
dlls/msi : files.c action.h action.c
Log message:
Mike McCormack <mike at codeweavers.com>
Use an enumeration for file states.
Patch: http://cvs.winehq.org/patch.py?id=21037
Old revision New revision Changes Path
1.27 1.28 +14 -14 wine/dlls/msi/files.c
1.46 1.47 +10 -8 wine/dlls/msi/action.h
1.225 1.226 +6 -6 wine/dlls/msi/action.c
Index: wine/dlls/msi/files.c
diff -u -p wine/dlls/msi/files.c:1.27 wine/dlls/msi/files.c:1.28
--- wine/dlls/msi/files.c:1.27 2 Nov 2005 10:56:42 -0000
+++ wine/dlls/msi/files.c 2 Nov 2005 10:56:42 -0000
@@ -221,7 +221,7 @@ static INT_PTR cabinet_notify(FDINOTIFIC
return 0;
}
- if (f->State != 1 && f->State != 2)
+ if (f->state != msifs_missing && f->state != msifs_overwrite)
{
TRACE("Skipping extraction of %s\n",debugstr_a(pfdin->psz1));
return 0;
@@ -240,7 +240,7 @@ static INT_PTR cabinet_notify(FDINOTIFIC
return 0;
}
- f->State = 4;
+ f->state = msifs_installed;
return (INT_PTR) handle;
}
case fdintCLOSE_FILE_INFO:
@@ -615,7 +615,7 @@ static UINT get_file_target(MSIPACKAGE *
{
if (lstrcmpW( file_key, file->File )==0)
{
- if (file->State >= 2)
+ if (file->state >= msifs_overwrite)
{
*file_source = strdupW( file->TargetPath );
return ERROR_SUCCESS;
@@ -629,11 +629,11 @@ static UINT get_file_target(MSIPACKAGE *
}
/*
- * In order to make this work more effeciencly I am going to do this in 2
- * passes.
- * Pass 1) Correct all the TargetPaths and determin what files are to be
- * installed.
- * Pass 2) Extract Cabinents and copy files.
+ * ACTION_InstallFiles()
+ *
+ * For efficiency, this is done in two passes:
+ * 1) Correct all the TargetPaths and determine what files are to be installed.
+ * 2) Extract Cabinets and copy files.
*/
UINT ACTION_InstallFiles(MSIPACKAGE *package)
{
@@ -648,7 +648,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *pac
/* increment progress bar each time action data is sent */
ui_progress(package,1,1,0,0);
- /* handle the keys for the SouceList */
+ /* handle the keys for the SourceList */
ptr = strrchrW(package->PackagePath,'\\');
if (ptr)
{
@@ -669,7 +669,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *pac
TRACE("File %s is not scheduled for install\n",
debugstr_w(file->File));
- file->State = 5;
+ file->state = msifs_skipped;
}
}
@@ -686,7 +686,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *pac
/* Pass 2 */
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
{
- if (file->State != 1 && file->State != 2)
+ if (file->state != msifs_missing && file->state != msifs_overwrite)
continue;
TRACE("Pass 2: %s\n",debugstr_w(file->File));
@@ -702,7 +702,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *pac
TRACE("file paths %s to %s\n",debugstr_w(file->SourcePath),
debugstr_w(file->TargetPath));
- if (file->State != 1 && file->State != 2)
+ if (file->state != msifs_missing && file->state != msifs_overwrite)
continue;
/* compressed files are extracted in ready_media_for_file */
@@ -720,7 +720,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *pac
rc = GetLastError();
ERR("Unable to copy file (%s -> %s) (error %d)\n",
debugstr_w(file->SourcePath), debugstr_w(file->TargetPath), rc);
- if (rc == ERROR_ALREADY_EXISTS && file->State == 2)
+ if (rc == ERROR_ALREADY_EXISTS && file->state == msifs_overwrite)
{
rc = 0;
}
@@ -737,7 +737,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *pac
}
else
{
- file->State = 4;
+ file->state = msifs_installed;
rc = ERROR_SUCCESS;
}
}
Index: wine/dlls/msi/action.h
diff -u -p wine/dlls/msi/action.h:1.46 wine/dlls/msi/action.h:1.47
--- wine/dlls/msi/action.h:1.46 2 Nov 2005 10:56:42 -0000
+++ wine/dlls/msi/action.h 2 Nov 2005 10:56:42 -0000
@@ -93,6 +93,15 @@ typedef struct tagMSIFOLDER
INT Space;
} MSIFOLDER;
+typedef enum _msi_file_state {
+ msifs_invalid,
+ msifs_missing,
+ msifs_overwrite,
+ msifs_present,
+ msifs_installed,
+ msifs_skipped,
+} msi_file_state;
+
typedef struct tagMSIFILE
{
struct list entry;
@@ -105,14 +114,7 @@ typedef struct tagMSIFILE
LPWSTR Language;
INT Attributes;
INT Sequence;
-
- INT State;
- /* 0 = uninitialize */
- /* 1 = not present */
- /* 2 = present but replace */
- /* 3 = present do not replace */
- /* 4 = Installed */
- /* 5 = Skipped */
+ msi_file_state state;
LPWSTR SourcePath;
LPWSTR TargetPath;
} MSIFILE;
Index: wine/dlls/msi/action.c
diff -u -p wine/dlls/msi/action.c:1.225 wine/dlls/msi/action.c:1.226
--- wine/dlls/msi/action.c:1.225 2 Nov 2005 10:56:42 -0000
+++ wine/dlls/msi/action.c 2 Nov 2005 10:56:42 -0000
@@ -1305,7 +1305,7 @@ static UINT load_file(MSIRECORD *row, LP
file->Attributes = MSI_RecordGetInteger( row, 7 );
file->Sequence = MSI_RecordGetInteger( row, 8 );
- file->State = 0;
+ file->state = msifs_invalid;
TRACE("File Loaded (%s)\n",debugstr_w(file->File));
@@ -1861,7 +1861,7 @@ static UINT ACTION_CostFinalize(MSIPACKA
if (GetFileAttributesW(file->TargetPath) == INVALID_FILE_ATTRIBUTES)
{
- file->State = 1;
+ file->state = msifs_missing;
comp->Cost += file->FileSize;
continue;
}
@@ -1896,16 +1896,16 @@ static UINT ACTION_CostFinalize(MSIPACKA
debugstr_w(filever));
if (strcmpiW(filever,file->Version)<0)
{
- file->State = 2;
- FIXME("cost should be diff in size\n");
+ file->state = msifs_overwrite;
+ /* FIXME: cost should be diff in size */
comp->Cost += file->FileSize;
}
else
- file->State = 3;
+ file->state = msifs_present;
msi_free(version);
}
else
- file->State = 3;
+ file->state = msifs_present;
}
TRACE("Evaluating Condition Table\n");
More information about the wine-cvs
mailing list