Remove some redundant null pointer checks.

This commit is contained in:
Mike McCormack 2005-11-03 09:56:29 +00:00 committed by Alexandre Julliard
parent 73f7847297
commit a977b2c346
4 changed files with 9 additions and 61 deletions

View File

@ -894,6 +894,12 @@ static BOOL ACTION_HandleStandardAction(MSIPACKAGE *package, LPCWSTR action,
BOOL run = force;
int i;
if (!package)
{
ERR("package was null!\n");
return FALSE;
}
if (!run && !package->script->CurrentlyScripting)
run = TRUE;
@ -2552,9 +2558,6 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
MSICOMPONENT *comp;
HKEY hkey=0,hkey2=0;
if (!package)
return ERROR_INVALID_HANDLE;
/* writes the Component and Features values to the registry */
rc = MSIREG_OpenComponents(&hkey);
@ -2804,9 +2807,6 @@ static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package)
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','T','y','p','e','L','i','b','`',0};
if (!package)
return ERROR_INVALID_HANDLE;
rc = MSI_DatabaseOpenViewW(package->db, Query, &view);
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
@ -2955,9 +2955,6 @@ static UINT ACTION_CreateShortcuts(MSIPACKAGE *package)
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','S','h','o','r','t','c','u','t','`',0};
if (!package)
return ERROR_INVALID_HANDLE;
rc = MSI_DatabaseOpenViewW(package->db, Query, &view);
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
@ -3056,9 +3053,6 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
DWORD size;
MSIHANDLE hDb, hSumInfo;
if (!package)
return ERROR_INVALID_HANDLE;
/* write out icon files */
rc = MSI_DatabaseOpenViewW(package->db, Query, &view);
@ -3333,9 +3327,6 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
HKEY hkey=0;
HKEY hukey=0;
if (!package)
return ERROR_INVALID_HANDLE;
rc = MSIREG_OpenFeaturesKey(package->ProductCode,&hkey,TRUE);
if (rc != ERROR_SUCCESS)
goto end;
@ -3545,9 +3536,6 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
LPWSTR upgrade_code;
WCHAR szDate[9];
if (!package)
return ERROR_INVALID_HANDLE;
rc = MSIREG_OpenUninstallKey(package->ProductCode,&hkey,TRUE);
if (rc != ERROR_SUCCESS)
return rc;
@ -3613,23 +3601,13 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
static UINT ACTION_InstallExecute(MSIPACKAGE *package)
{
UINT rc;
if (!package)
return ERROR_INVALID_HANDLE;
rc = execute_script(package,INSTALL_SCRIPT);
return rc;
return execute_script(package,INSTALL_SCRIPT);
}
static UINT ACTION_InstallFinalize(MSIPACKAGE *package)
{
UINT rc;
if (!package)
return ERROR_INVALID_HANDLE;
/* turn off scheduleing */
package->script->CurrentlyScripting= FALSE;
@ -3672,9 +3650,6 @@ static UINT ACTION_ForceReboot(MSIPACKAGE *package)
HKEY hkey;
WCHAR squished_pc[100];
if (!package)
return ERROR_INVALID_HANDLE;
squash_guid(package->ProductCode,squished_pc);
GetSystemDirectoryW(sysdir, sizeof(sysdir)/sizeof(sysdir[0]));
@ -3770,9 +3745,6 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package)
{0},
};
if (!package)
return ERROR_INVALID_HANDLE;
productid = msi_dup_property( package, INSTALLPROPERTY_PRODUCTIDW );
if (!productid)
return ERROR_SUCCESS;

View File

@ -835,9 +835,6 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
BOOL install_on_demand = FALSE;
MSICLASS *cls;
if (!package)
return ERROR_INVALID_HANDLE;
load_classes_and_such(package);
rc = RegCreateKeyW(HKEY_CLASSES_ROOT,szCLSID,&hkey);
if (rc != ERROR_SUCCESS)
@ -1095,9 +1092,6 @@ UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package)
MSIPROGID *progid;
MSIRECORD *uirow;
if (!package)
return ERROR_INVALID_HANDLE;
load_classes_and_such(package);
LIST_FOR_EACH_ENTRY( progid, &package->progids, MSIPROGID, entry )
@ -1214,9 +1208,6 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
MSIRECORD *uirow;
BOOL install_on_demand = TRUE;
if (!package)
return ERROR_INVALID_HANDLE;
load_classes_and_such(package);
/* We need to set install_on_demand based on if the shell handles advertised
@ -1322,9 +1313,6 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
MSIRECORD *uirow;
MSIMIME *mt;
if (!package)
return ERROR_INVALID_HANDLE;
load_classes_and_such(package);
LIST_FOR_EACH_ENTRY( mt, &package->mimes, MSIMIME, entry )

View File

@ -608,9 +608,6 @@ static UINT get_file_target(MSIPACKAGE *package, LPCWSTR file_key,
{
MSIFILE *file;
if (!package)
return ERROR_INVALID_HANDLE;
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
{
if (lstrcmpW( file_key, file->File )==0)
@ -642,9 +639,6 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
LPWSTR ptr;
MSIFILE *file;
if (!package)
return ERROR_INVALID_HANDLE;
/* increment progress bar each time action data is sent */
ui_progress(package,1,1,0,0);
@ -856,9 +850,6 @@ UINT ACTION_DuplicateFiles(MSIPACKAGE *package)
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','D','u','p','l','i','c','a','t','e','F','i','l','e','`',0};
if (!package)
return ERROR_INVALID_HANDLE;
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;

View File

@ -173,9 +173,6 @@ int track_tempfile( MSIPACKAGE *package, LPCWSTR name, LPCWSTR path )
{
MSITEMPFILE *temp;
if (!package)
return -1;
LIST_FOR_EACH_ENTRY( temp, &package->tempfiles, MSITEMPFILE, entry )
{
if (lstrcmpW( name, temp->File )==0)
@ -907,7 +904,7 @@ UINT register_unique_action(MSIPACKAGE *package, LPCWSTR action)
UINT count;
LPWSTR *newbuf = NULL;
if (!package || !package->script)
if (!package->script)
return FALSE;
TRACE("Registering Action %s as having fun\n",debugstr_w(action));
@ -930,7 +927,7 @@ BOOL check_unique_action(MSIPACKAGE *package, LPCWSTR action)
{
INT i;
if (!package || !package->script)
if (!package->script)
return FALSE;
for (i = 0; i < package->script->UniqueActionsCount; i++)