From a977b2c346623008628dae42afc65c24076ed810 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Thu, 3 Nov 2005 09:56:29 +0000 Subject: [PATCH] Remove some redundant null pointer checks. --- dlls/msi/action.c | 42 +++++++----------------------------------- dlls/msi/classes.c | 12 ------------ dlls/msi/files.c | 9 --------- dlls/msi/helpers.c | 7 ++----- 4 files changed, 9 insertions(+), 61 deletions(-) diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 786cc7cb0ec..9a6d5d8dfb9 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -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; diff --git a/dlls/msi/classes.c b/dlls/msi/classes.c index 733e1ad0faa..b7799f38059 100644 --- a/dlls/msi/classes.c +++ b/dlls/msi/classes.c @@ -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 ) diff --git a/dlls/msi/files.c b/dlls/msi/files.c index 6e8a65295b1..2a74116089e 100644 --- a/dlls/msi/files.c +++ b/dlls/msi/files.c @@ -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; diff --git a/dlls/msi/helpers.c b/dlls/msi/helpers.c index 01261c25e78..a47766b8a58 100644 --- a/dlls/msi/helpers.c +++ b/dlls/msi/helpers.c @@ -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++) -- 2.11.4.GIT