[Libreoffice-commits] .: 10 commits - cosv/source desktop/win32 fpicker/source sal/osl sal/rtl setup_native/source xml2cmp/source

Tor Lillqvist tml at kemper.freedesktop.org
Mon Sep 12 01:05:59 PDT 2011


 cosv/source/comphelp/badcast.cxx                                               |    5 
 desktop/win32/source/applauncher/launcher.cxx                                  |    5 
 fpicker/source/win32/filepicker/previewadapter.cxx                             |    4 
 sal/osl/w32/salinit.cxx                                                        |    9 +
 sal/rtl/source/bootstrap.cxx                                                   |   22 ++-
 setup_native/source/win32/customactions/patch/swappatchfiles.cxx               |    5 
 setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx |    4 
 setup_native/source/win32/customactions/shellextensions/registerextensions.cxx |   34 -----
 setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx       |   60 ----------
 xml2cmp/source/support/badcast.cxx                                             |    5 
 10 files changed, 40 insertions(+), 113 deletions(-)

New commits:
commit 962dc00065333bb421d895006c37dd3cbd9ec085
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Mon Sep 12 10:32:55 2011 +0300

    Accept also a soffice.bin renamed to soffice.bin.exe

diff --git a/sal/rtl/source/bootstrap.cxx b/sal/rtl/source/bootstrap.cxx
index 616470c..498cebc 100644
--- a/sal/rtl/source/bootstrap.cxx
+++ b/sal/rtl/source/bootstrap.cxx
@@ -399,15 +399,21 @@ Bootstrap_Impl * BootstrapMap::getBaseIni() {
                 resolvePathnameUrl(&uri);
             } else {
                 osl_bootstrap_getExecutableFile_Impl(&uri.pData);
+                // Strip potentially two such extensions, to allow for
+                // renaming of soffice.bin to soffice.bin.exe so that
+                // Visual Studio agrees to start it, if you want to
+                // debug it from the start.
                 static char const BIN_EXT[] = ".bin";
                 static char const EXE_EXT[] = ".exe";
-                if (uri.endsWithAsciiL(RTL_CONSTASCII_STRINGPARAM(BIN_EXT))) {
-                    uri = uri.copy(
-                        0, uri.getLength() - RTL_CONSTASCII_LENGTH(BIN_EXT));
-                } else if (uri.endsWithAsciiL(
-                               RTL_CONSTASCII_STRINGPARAM(EXE_EXT))) {
-                    uri = uri.copy(
-                        0, uri.getLength() - RTL_CONSTASCII_LENGTH(EXE_EXT));
+                for (int i = 0; i < 2; i++) {
+                    if (uri.endsWithAsciiL(RTL_CONSTASCII_STRINGPARAM(BIN_EXT))) {
+                        uri = uri.copy(
+                            0, uri.getLength() - RTL_CONSTASCII_LENGTH(BIN_EXT));
+                    } else if (uri.endsWithAsciiL(
+                                   RTL_CONSTASCII_STRINGPARAM(EXE_EXT))) {
+                        uri = uri.copy(
+                            0, uri.getLength() - RTL_CONSTASCII_LENGTH(EXE_EXT));
+                    }
                 }
                 uri += rtl::OUString(
                     RTL_CONSTASCII_USTRINGPARAM(SAL_CONFIGFILE("")));
commit 40816125618dabdff371bb5e39b4ecea36f7a8bd
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Mon Sep 12 10:32:15 2011 +0300

    Fix copy/paste error

diff --git a/sal/rtl/source/bootstrap.cxx b/sal/rtl/source/bootstrap.cxx
index e4eadf8..616470c 100644
--- a/sal/rtl/source/bootstrap.cxx
+++ b/sal/rtl/source/bootstrap.cxx
@@ -400,7 +400,7 @@ Bootstrap_Impl * BootstrapMap::getBaseIni() {
             } else {
                 osl_bootstrap_getExecutableFile_Impl(&uri.pData);
                 static char const BIN_EXT[] = ".bin";
-                static char const EXE_EXT[] = ".bin";
+                static char const EXE_EXT[] = ".exe";
                 if (uri.endsWithAsciiL(RTL_CONSTASCII_STRINGPARAM(BIN_EXT))) {
                     uri = uri.copy(
                         0, uri.getLength() - RTL_CONSTASCII_LENGTH(BIN_EXT));
commit e5f99329f812a00c0fb104306ea5f33d3547b908
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Fri Sep 9 21:58:21 2011 +0200

    deleted unread var and code in setup_native, vistaspecial.cxx
    
    and simplified coding after that since the logic is not needed
    anymore.

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;
 }
 
commit 2b44c6ee402ae2b96e87772a6a7bb11ddf79c136
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Fri Sep 9 21:52:22 2011 +0200

    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.

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;
         }
     }
commit 332dbe0df2ac8d746ac3ce621dd947c379dde776
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Fri Sep 9 21:34:32 2011 +0200

    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.

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) );
 
commit 43b5c9e772eacbd1bdf607b1e55d5fffb6c51ef4
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Fri Sep 9 21:30:04 2011 +0200

    deleted unneded var in setup_native, migrateinstallpath.cxx
    
    and some coding commented since 2005

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 ) )
commit 03369ebd2d613238e0c1e47c91dcd57f787a764d
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Fri Sep 9 21:26:21 2011 +0200

    deletion of unneded variable in setup_native, swappatchfiles.cxx

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) )
commit 8039e149f8362d524e4a563911d99ace043437db
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Fri Sep 9 20:55:53 2011 +0200

    deletion of unneded variable in fpicker, previewadapter.cxx

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);
 
commit 31f7d27c2ca5f7decd6d79d6fff284f38e8a90f0
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Fri Sep 9 09:28:13 2011 +0300

    Don't bother with SetProcessDEPPolicy() on _WIN64 where it is always on

diff --git a/sal/osl/w32/salinit.cxx b/sal/osl/w32/salinit.cxx
index ffe2c7e..806c35b 100644
--- a/sal/osl/w32/salinit.cxx
+++ b/sal/osl/w32/salinit.cxx
@@ -47,11 +47,14 @@ void SAL_CALL sal_detail_initialize(int argc, char ** argv)
     //   BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE | BASE_SEARCH_PATH_PERMANENT);
     HMODULE h = GetModuleHandleW(L"kernel32.dll");
     if (h != 0) {
-        FARPROC p = GetProcAddress(h, "SetProcessDEPPolicy");
+        FARPROC p;
+#ifndef _WIN64
+        p = GetProcAddress(h, "SetProcessDEPPolicy");
         if (p != 0) {
             reinterpret_cast< BOOL (WINAPI *)(DWORD) >(p)(0x00000001);
-    }
-    p = GetProcAddress(h, "SetDllDirectoryW");
+        }
+#endif
+        p = GetProcAddress(h, "SetDllDirectoryW");
         if (p != 0) {
             reinterpret_cast< BOOL (WINAPI *)(LPCWSTR) >(p)(L"");
         }
commit b60773a322d332267f58a5be09efcea3e93c055d
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Thu Sep 8 17:04:21 2011 +0300

    Add pleas for help to explain a mysterious piece of code

diff --git a/cosv/source/comphelp/badcast.cxx b/cosv/source/comphelp/badcast.cxx
index 37a7639..3f68f1c 100644
--- a/cosv/source/comphelp/badcast.cxx
+++ b/cosv/source/comphelp/badcast.cxx
@@ -32,6 +32,11 @@
    due to problems with WNT-STL-headers.
 */
 
+// If anybody who happens to read this has any idea what dark magic
+// this is supposed to achieve, and whether it is needed or in any way
+// relevant with MSVC2008 (or eventually newer), please add a
+// comment...
+
 #if defined(WNT) && !defined(__MINGW32__)
 
 #define _NTSDK
diff --git a/xml2cmp/source/support/badcast.cxx b/xml2cmp/source/support/badcast.cxx
index 37a7639..3f68f1c 100644
--- a/xml2cmp/source/support/badcast.cxx
+++ b/xml2cmp/source/support/badcast.cxx
@@ -32,6 +32,11 @@
    due to problems with WNT-STL-headers.
 */
 
+// If anybody who happens to read this has any idea what dark magic
+// this is supposed to achieve, and whether it is needed or in any way
+// relevant with MSVC2008 (or eventually newer), please add a
+// comment...
+
 #if defined(WNT) && !defined(__MINGW32__)
 
 #define _NTSDK


More information about the Libreoffice-commits mailing list