Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hello,

I will have a look at your patches on Monday, unless somebody beats me
to it during the weekend.

Thanks,
based on some remarks, here exactly the same patches, but with improved commit comments. Will be probably better to integrate these.

Regards
Pierre-André
From 94bed68189f2298d03972febeb28ebafeadf7d91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pierre-Andr=C3=A9=20Jacquod?= <pjacquod@alumni.ethz.ch>
Date: Fri, 9 Sep 2011 21:58:21 +0200
Subject: [PATCH 6/6] [cppchecker] deleted unread var and code in setup_native, vistaspecial.cxx

and simplified coding after that since the logic is not needed
anymore.
---
 .../customactions/shellextensions/vistaspecial.cxx |   60 ++------------------
 1 files changed, 5 insertions(+), 55 deletions(-)

diff --git a/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx 
b/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx
index aede073..40ff772 100644
--- a/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx
@@ -96,7 +96,6 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
 {
     bool bDirectoryRemoved = true;
 
-    std::_tstring mystr;
     std::_tstring sPattern = sPath + TEXT("\\") + TEXT("*.*");
     WIN32_FIND_DATA aFindData;
 
@@ -114,9 +113,6 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
         {
             std::_tstring sFileName = aFindData.cFileName;
 
-            mystr = "Current short file: " + sFileName;
-            // MessageBox(NULL, mystr.c_str(), "Current Content", MB_OK);
-
             if (( strcmp(sFileName.c_str(),sCurrentDir.c_str()) != 0 ) &&
                 ( strcmp(sFileName.c_str(),sParentDir.c_str()) != 0 ))
             {
@@ -124,31 +120,11 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
 
                 if ( aFindData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY )
                 {
-                    bool fSuccess = RemoveCompleteDirectory(sCompleteFileName);
-                    if ( fSuccess )
-                    {
-                        mystr = "Successfully removed content of dir " + sCompleteFileName;
-                        // MessageBox(NULL, mystr.c_str(), "Removed Directory", MB_OK);
-                    }
-                    else
-                    {
-                        mystr = "An error occurred during removing content of " + 
sCompleteFileName;
-                        // MessageBox(NULL, mystr.c_str(), "Error removing directory", MB_OK);
-                    }
+                    RemoveCompleteDirectory(sCompleteFileName);
                 }
                 else
                 {
-                    bool fSuccess = DeleteFile( sCompleteFileName.c_str() );
-                    if ( fSuccess )
-                    {
-                        mystr = "Successfully removed file " + sCompleteFileName;
-                        // MessageBox(NULL, mystr.c_str(), "Removed File", MB_OK);
-                    }
-                    else
-                    {
-                        mystr = "An error occurred during removal of file " + sCompleteFileName;
-                        // MessageBox(NULL, mystr.c_str(), "Error removing file", MB_OK);
-                    }
+                    DeleteFile( sCompleteFileName.c_str() );
                 }
             }
 
@@ -162,17 +138,9 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
         // RemoveDirectory is only successful, if the last handle to the directory is closed
         // -> first removing content -> closing handle -> remove empty directory
 
-        bool fRemoveDirSuccess = RemoveDirectory(sPath.c_str());
 
-        if ( fRemoveDirSuccess )
-        {
-            mystr = "Successfully removed dir " + sPath;
-            // MessageBox(NULL, mystr.c_str(), "Removed Directory", MB_OK);
-        }
-        else
+        if( !( RemoveDirectory(sPath.c_str()) ) )
         {
-            mystr = "An error occurred during removal of empty directory " + sPath;
-            // MessageBox(NULL, mystr.c_str(), "Error removing directory", MB_OK);
             bDirectoryRemoved = false;
         }
     }
@@ -189,8 +157,6 @@ extern "C" UINT __stdcall RenamePrgFolder( MSIHANDLE handle )
     std::_tstring sRenameSrc = sOfficeInstallPath + TEXT("program");
     std::_tstring sRenameDst = sOfficeInstallPath + TEXT("program_old");
 
-//    MessageBox(NULL, sRenameSrc.c_str(), "INSTALLLOCATION", MB_OK);
-
     bool bSuccess = MoveFile( sRenameSrc.c_str(), sRenameDst.c_str() );
     if ( !bSuccess )
     {
@@ -205,13 +171,6 @@ extern "C" UINT __stdcall RenamePrgFolder( MSIHANDLE handle )
         }
     }
 
-#if 0
-    if ( !bSuccess )
-        MessageBox(NULL, "Renaming folder failed", "RenamePrgFolder", MB_OK);
-    else
-        MessageBox(NULL, "Renaming folder successful", "RenamePrgFolder", MB_OK);
-#endif
-
     return ERROR_SUCCESS;
 }
 
@@ -220,25 +179,16 @@ extern "C" UINT __stdcall RemovePrgFolder( MSIHANDLE handle )
     std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION"));
     std::_tstring sRemoveDir = sOfficeInstallPath + TEXT("program_old");
 
-//    MessageBox(NULL, sRemoveDir.c_str(), "REMOVING OLD DIR", MB_OK);
-
-    bool bSuccess = RemoveCompleteDirectory( sRemoveDir );
+    RemoveCompleteDirectory( sRemoveDir );
 
     TCHAR sAppend[2] = TEXT("0");
     for ( int i = 0; i < 10; i++ )
     {
         sRemoveDir = sOfficeInstallPath + TEXT("program_old") + sAppend;
-        bSuccess = RemoveCompleteDirectory( sRemoveDir );
+        RemoveCompleteDirectory( sRemoveDir );
         sAppend[0] += 1;
     }
 
-#if 0
-    if ( bSuccess )
-        MessageBox(NULL, "Removing folder successful", "RemovePrgFolder", MB_OK);
-    else
-        MessageBox(NULL, "Removing folder failed", "RemovePrgFolder", MB_OK);
-#endif
-
     return ERROR_SUCCESS;
 }
 
-- 
1.7.3.4

From c705be5efcca7ced06e70cb7e9d79e536b488ffa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pierre-Andr=C3=A9=20Jacquod?= <pjacquod@alumni.ethz.ch>
Date: Fri, 9 Sep 2011 21:52:22 +0200
Subject: [PATCH 5/6] [cppchecker] unneded var deleted and code simplified. in setup_native

After deleting the different assignment that were not used, some
part of the code could be simiplified, since there is no need
any more for the logic.
---
 .../shellextensions/registerextensions.cxx         |   34 ++------------------
 1 files changed, 3 insertions(+), 31 deletions(-)

diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx 
b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
index 28ea399..9435118 100644
--- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
@@ -117,7 +117,6 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
 {
     bool bDirectoryRemoved = true;
 
-    std::_tstring mystr;
     std::_tstring sPattern = sPath + TEXT("\\") + TEXT("*.*");
     WIN32_FIND_DATA aFindData;
 
@@ -135,8 +134,6 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
             std::_tstring sCurrentDir = TEXT(".");
             std::_tstring sParentDir = TEXT("..");
 
-            mystr = "Current short file: " + sFileName;
-
             if (( strcmp(sFileName.c_str(),sCurrentDir.c_str()) != 0 ) &&
                 ( strcmp(sFileName.c_str(),sParentDir.c_str()) != 0 ))
             {
@@ -144,27 +141,11 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
 
                 if ( aFindData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY )
                 {
-                    bool fSuccess = RemoveCompleteDirectory(sCompleteFileName);
-                    if ( fSuccess )
-                    {
-                        mystr = "Successfully removed content of dir " + sCompleteFileName;
-                    }
-                    else
-                    {
-                        mystr = "An error occurred during removing content of " + 
sCompleteFileName;
-                    }
+                    RemoveCompleteDirectory(sCompleteFileName);
                 }
                 else
                 {
-                    bool fSuccess = DeleteFile( sCompleteFileName.c_str() );
-                    if ( fSuccess )
-                    {
-                        mystr = "Successfully removed file " + sCompleteFileName;
-                    }
-                    else
-                    {
-                        mystr = "An error occurred during removal of file " + sCompleteFileName;
-                    }
+                    DeleteFile( sCompleteFileName.c_str() );
                 }
             }
 
@@ -178,17 +159,8 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
         // RemoveDirectory is only successful, if the last handle to the directory is closed
         // -> first removing content -> closing handle -> remove empty directory
 
-        bool fRemoveDirSuccess = RemoveDirectory(sPath.c_str());
-
-        if ( fRemoveDirSuccess )
-        {
-            mystr = "Successfully removed dir " + sPath;
-            // MessageBox(NULL, mystr.c_str(), "Removed Directory", MB_OK);
-        }
-        else
+        if ( ! ( RemoveDirectory(sPath.c_str()) ) )
         {
-            mystr = "An error occurred during removal of empty directory " + sPath;
-            // MessageBox(NULL, mystr.c_str(), "Error removing directory", MB_OK);
             bDirectoryRemoved = false;
         }
     }
-- 
1.7.3.4

From d60b4573712c6b178e815e516acaa09d79af982d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pierre-Andr=C3=A9=20Jacquod?= <pjacquod@alumni.ethz.ch>
Date: Fri, 9 Sep 2011 21:34:32 +0200
Subject: [PATCH 4/6] [cppchecker] deleted unneded var and code simplified in desktop, launcher.cxx

Also deleted a part of the code that did nothing, just defining
variable and reading them as argument.
---
 desktop/win32/source/applauncher/launcher.cxx |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/desktop/win32/source/applauncher/launcher.cxx 
b/desktop/win32/source/applauncher/launcher.cxx
index a7a17b5..fd8edb1 100644
--- a/desktop/win32/source/applauncher/launcher.cxx
+++ b/desktop/win32/source/applauncher/launcher.cxx
@@ -67,11 +67,6 @@ extern "C" int APIENTRY _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
 
     LPTSTR  lpCommandLine = GetCommandLine();
 
-    LPTSTR  *ppArguments = NULL;
-    int     nArguments = 0;
-
-    ppArguments = GetArgv( &nArguments );
-
     {
         lpCommandLine = (LPTSTR)_alloca( sizeof(_TCHAR) * (_tcslen(lpCommandLine) + 
_tcslen(APPLICATION_SWITCH) + 2) );
 
-- 
1.7.3.4

From 8ade7be3b2f29425089699e5b492f8f2c403d5b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pierre-Andr=C3=A9=20Jacquod?= <pjacquod@alumni.ethz.ch>
Date: Fri, 9 Sep 2011 21:30:04 +0200
Subject: [PATCH 3/6] [cppchecker] deleted unneded var in setup_native, migrateinstallpath.cxx

and some coding commented since 2005
---
 .../shellextensions/migrateinstallpath.cxx         |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx 
b/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx
index a487309..395a21f 100644
--- a/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx
@@ -86,10 +86,6 @@ extern "C" UINT __stdcall MigrateInstallPath( MSIHANDLE handle )
     std::_tstring   sProductKey = "Software\\" + sManufacturer + "\\" + sDefinedName +
                                         "\\" + sUpdateVersion + "\\" + sUpgradeCode;
 
-    std::_tstring   mystr;
-    mystr = "ProductKey: " + sProductKey;
-    // MessageBox( NULL, mystr.c_str(), "ProductKey", MB_OK );
-
     if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER,  sProductKey.c_str(), &hKey ) )
     {
         if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, 
(LPBYTE)szValue, &nValueSize ) )
-- 
1.7.3.4

From f373ae4cdb59777a78a2f61cde890602ff98b76e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pierre-Andr=C3=A9=20Jacquod?= <pjacquod@alumni.ethz.ch>
Date: Fri, 9 Sep 2011 21:26:21 +0200
Subject: [PATCH 2/6] [cppchecker] deletion of unneded variable in setup_native, swappatchfiles.cxx

---
 .../win32/customactions/patch/swappatchfiles.cxx   |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/setup_native/source/win32/customactions/patch/swappatchfiles.cxx 
b/setup_native/source/win32/customactions/patch/swappatchfiles.cxx
index db7fbeb..5028a5f 100644
--- a/setup_native/source/win32/customactions/patch/swappatchfiles.cxx
+++ b/setup_native/source/win32/customactions/patch/swappatchfiles.cxx
@@ -691,7 +691,6 @@ extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle )
 
 extern "C" UINT __stdcall SetFeatureState( MSIHANDLE handle )
 {
-    std::_tstring   mystr;
 
     // 1. Reading Product Code from setup.ini of installed Office
 
@@ -719,7 +718,6 @@ extern "C" UINT __stdcall SetFeatureState( MSIHANDLE handle )
 
     std::_tstring productCode = TEXT(szProductCode);
     productCode = ConvertGuid(std::_tstring(productCode.c_str() + 1, productCode.length() - 2));
-    mystr = TEXT("Changed product code: ") + productCode;
 
     // 3. Setting path in the Windows registry to find installed features
 
@@ -730,13 +728,11 @@ extern "C" UINT __stdcall SetFeatureState( MSIHANDLE handle )
     {
         registryRoot = HKEY_LOCAL_MACHINE;
         registryKey = TEXT("Software\\Classes\\Installer\\Features\\") + productCode;
-        mystr = registryKey;
     }
     else
     {
         registryRoot = HKEY_CURRENT_USER;
         registryKey = TEXT("Software\\Microsoft\\Installer\\Features\\") + productCode;
-        mystr = registryKey;
     }
 
     // 4. Collecting all installed features from Windows registry
@@ -760,7 +756,6 @@ extern "C" UINT __stdcall SetFeatureState( MSIHANDLE handle )
             if ( ERROR_SUCCESS == lEnumResult )
             {
                 std::_tstring sValueName = szValueName;
-                std::_tstring sValueData = szValueData;
 
                 // Does this feature exist in this patch?
                 if ( IsSetMsiProperty(handle, sValueName) )
-- 
1.7.3.4

From b1620e07eaa3f243ddd28acc33f5fdb6a8c7cdd5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pierre-Andr=C3=A9=20Jacquod?= <pjacquod@alumni.ethz.ch>
Date: Fri, 9 Sep 2011 20:55:53 +0200
Subject: [PATCH 1/6] [cppchecker]  deletion of unneded variable in fpicker, previewadapter.cxx

---
 fpicker/source/win32/filepicker/previewadapter.cxx |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fpicker/source/win32/filepicker/previewadapter.cxx 
b/fpicker/source/win32/filepicker/previewadapter.cxx
index 51eb8b5..fcd7ea3 100644
--- a/fpicker/source/win32/filepicker/previewadapter.cxx
+++ b/fpicker/source/win32/filepicker/previewadapter.cxx
@@ -317,11 +317,11 @@ void SAL_CALL CPreviewAdapterImpl::rearrangeLayout()
 
         // resize the filelistbox to the half of the
         // available space
-        bool bRet = SetWindowPos(flb_new,
+        SetWindowPos(flb_new,
             NULL, 0, 0, cx, height,
             SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
 
-        bRet = SetWindowPos(flb_old,
+        SetWindowPos(flb_old,
             NULL, 0, 0, cx, height,
             SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
 
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.