[Libreoffice-commits] .: 2 commits - comphelper/inc setup_native/source

Tor Lillqvist tml at kemper.freedesktop.org
Mon Sep 12 03:35:17 PDT 2011


 comphelper/inc/comphelper/storagehelper.hxx                                              |    2 
 setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx |   72 --------
 setup_native/source/win32/customactions/patch/swappatchfiles.cxx                         |   84 ----------
 setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx           |   72 --------
 4 files changed, 13 insertions(+), 217 deletions(-)

New commits:
commit 9e126721bcffb2b588560da886b95b15551c683b
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Mon Sep 12 13:27:40 2011 +0300

    Nested classes need to be marked separately DLLPUBLIC, apparently

diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx
index f4f0f81..90685bf 100644
--- a/comphelper/inc/comphelper/storagehelper.hxx
+++ b/comphelper/inc/comphelper/storagehelper.hxx
@@ -175,7 +175,7 @@ public:
     // it is necessary to keep references to all storages down the
     // path - this is 'beautiful' (TM). So we need this ugly hack:
     class LifecycleProxyImpl;
-    class LifecycleProxy {
+    class COMPHELPER_DLLPUBLIC LifecycleProxy {
     public:
         LifecycleProxyImpl *pBadness;
         LifecycleProxy();
commit fa93288479b435b013e7517dd4dc1516f0bc5d1c
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Mon Sep 12 13:09:29 2011 +0300

    Drop Win9x code

diff --git a/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx b/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
index 1bebed7..2b7dc25 100644
--- a/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
+++ b/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
@@ -109,74 +109,6 @@ static inline void SetMsiProperty(MSIHANDLE handle, const std::_tstring& sProper
     MsiSetProperty(handle, sProperty.c_str(), TEXT("1"));
 }
 
-static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags )
-{
-    BOOL    fSuccess = FALSE;   // assume failure
-
-    // Windows 9x has a special mechanism to move files after reboot
-
-    if ( dwFlags & MOVEFILE_DELAY_UNTIL_REBOOT )
-    {
-        CHAR    szExistingFileNameA[MAX_PATH];
-        CHAR    szNewFileNameA[MAX_PATH] = "NUL";
-
-        // Path names in WININIT.INI must be in short path name form
-
-        if (
-            GetShortPathNameA( lpExistingFileNameA, szExistingFileNameA, MAX_PATH ) &&
-            (!lpNewFileNameA || GetShortPathNameA( lpNewFileNameA, szNewFileNameA, MAX_PATH ))
-            )
-        {
-            CHAR    szBuffer[32767];    // The buffer size must not exceed 32K
-            DWORD   dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, SAL_N_ELEMENTS(szBuffer), WININIT_FILENAME );
-
-            CHAR    szRename[MAX_PATH]; // This is enough for at most to times 67 chracters
-            strcpy( szRename, szNewFileNameA );
-            strcat( szRename, "=" );
-            strcat( szRename, szExistingFileNameA );
-            size_t  lnRename = strlen(szRename);
-
-            if ( dwBufLen + lnRename + 2 <= SAL_N_ELEMENTS(szBuffer) )
-            {
-                CopyMemory( &szBuffer[dwBufLen], szRename, lnRename );
-                szBuffer[dwBufLen + lnRename ] = 0;
-                szBuffer[dwBufLen + lnRename + 1 ] = 0;
-
-                fSuccess = WritePrivateProfileSectionA( RENAME_SECTION, szBuffer, WININIT_FILENAME );
-            }
-            else
-                SetLastError( ERROR_BUFFER_OVERFLOW );
-        }
-    }
-    else
-    {
-
-        fSuccess = MoveFileA( lpExistingFileNameA, lpNewFileNameA );
-
-        if ( !fSuccess && GetLastError() != ERROR_ACCESS_DENIED &&
-            0 != (dwFlags & (MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) )
-        {
-            BOOL    bFailIfExist = 0 == (dwFlags & MOVEFILE_REPLACE_EXISTING);
-
-            fSuccess = CopyFileA( lpExistingFileNameA, lpNewFileNameA, bFailIfExist );
-
-            if ( fSuccess )
-                fSuccess = DeleteFileA( lpExistingFileNameA );
-        }
-
-    }
-
-    return fSuccess;
-}
-
-static BOOL MoveFileExImpl( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags )
-{
-    if ( 0 > ((LONG)GetVersion())) // High order bit indicates Win 9x
-        return MoveFileEx9x( lpExistingFileNameA, lpNewFileNameA, dwFlags );
-    else
-        return MoveFileExA( lpExistingFileNameA, lpNewFileNameA, dwFlags );
-}
-
 extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle )
 {
     std::_tstring   sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") );
@@ -196,10 +128,10 @@ extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle )
             std::_tstring   sResourceFile = sResourceDir + aFindFileData.cFileName;
             std::_tstring   sIntermediate = sResourceFile + TEXT(".tmp");
 
-            fRenameSucceeded = MoveFileExImpl( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING );
+            fRenameSucceeded = MoveFileExA( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING );
             if ( fRenameSucceeded )
             {
-                MoveFileExImpl( sIntermediate.c_str(), sResourceFile.c_str(), 0 );
+                MoveFileExA( sIntermediate.c_str(), sResourceFile.c_str(), 0 );
                 fSuccess = FindNextFile( hFind, &aFindFileData );
             }
         } while ( fSuccess && fRenameSucceeded );
diff --git a/setup_native/source/win32/customactions/patch/swappatchfiles.cxx b/setup_native/source/win32/customactions/patch/swappatchfiles.cxx
index 5028a5f..07e9bc2 100644
--- a/setup_native/source/win32/customactions/patch/swappatchfiles.cxx
+++ b/setup_native/source/win32/customactions/patch/swappatchfiles.cxx
@@ -178,74 +178,6 @@ static inline void SetMsiProperty(MSIHANDLE handle, const std::_tstring& sProper
     MsiSetProperty(handle, sProperty.c_str(), TEXT("1"));
 }
 
-static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags )
-{
-    BOOL    fSuccess = FALSE;   // assume failure
-
-    // Windows 9x has a special mechanism to move files after reboot
-
-    if ( dwFlags & MOVEFILE_DELAY_UNTIL_REBOOT )
-    {
-        CHAR    szExistingFileNameA[MAX_PATH];
-        CHAR    szNewFileNameA[MAX_PATH] = "NUL";
-
-        // Path names in WININIT.INI must be in short path name form
-
-        if (
-            GetShortPathNameA( lpExistingFileNameA, szExistingFileNameA, MAX_PATH ) &&
-            (!lpNewFileNameA || GetShortPathNameA( lpNewFileNameA, szNewFileNameA, MAX_PATH ))
-            )
-        {
-            CHAR    szBuffer[32767];    // The buffer size must not exceed 32K
-            DWORD   dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, SAL_N_ELEMENTS(szBuffer), WININIT_FILENAME );
-
-            CHAR    szRename[MAX_PATH]; // This is enough for at most to times 67 chracters
-            strcpy( szRename, szNewFileNameA );
-            strcat( szRename, "=" );
-            strcat( szRename, szExistingFileNameA );
-            size_t  lnRename = strlen(szRename);
-
-            if ( dwBufLen + lnRename + 2 <= SAL_N_ELEMENTS(szBuffer) )
-            {
-                CopyMemory( &szBuffer[dwBufLen], szRename, lnRename );
-                szBuffer[dwBufLen + lnRename ] = 0;
-                szBuffer[dwBufLen + lnRename + 1 ] = 0;
-
-                fSuccess = WritePrivateProfileSectionA( RENAME_SECTION, szBuffer, WININIT_FILENAME );
-            }
-            else
-                SetLastError( ERROR_BUFFER_OVERFLOW );
-        }
-    }
-    else
-    {
-
-        fSuccess = MoveFileA( lpExistingFileNameA, lpNewFileNameA );
-
-        if ( !fSuccess && GetLastError() != ERROR_ACCESS_DENIED &&
-            0 != (dwFlags & (MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) )
-        {
-            BOOL    bFailIfExist = 0 == (dwFlags & MOVEFILE_REPLACE_EXISTING);
-
-            fSuccess = CopyFileA( lpExistingFileNameA, lpNewFileNameA, bFailIfExist );
-
-            if ( fSuccess )
-                fSuccess = DeleteFileA( lpExistingFileNameA );
-        }
-
-    }
-
-    return fSuccess;
-}
-
-static BOOL MoveFileExImpl( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags )
-{
-    if ( 0 > ((LONG)GetVersion())) // High order bit indicates Win 9x
-        return MoveFileEx9x( lpExistingFileNameA, lpNewFileNameA, dwFlags );
-    else
-        return MoveFileExA( lpExistingFileNameA, lpNewFileNameA, dwFlags );
-}
-
 static bool SwapFiles( const std::_tstring& sFileName1, const std::_tstring& sFileName2 )
 {
     std::_tstring   sTempFileName = sFileName1 + TEXT(".tmp");
@@ -253,26 +185,26 @@ static bool SwapFiles( const std::_tstring& sFileName1, const std::_tstring& sFi
     bool fSuccess = true;
 
     //Try to move the original file to a temp file
-    fSuccess = MoveFileExImpl( sFileName1.c_str(), sTempFileName.c_str(), MOVEFILE_REPLACE_EXISTING);
+    fSuccess = MoveFileExA( sFileName1.c_str(), sTempFileName.c_str(), MOVEFILE_REPLACE_EXISTING);
 
     std::_tstring   mystr;
 
     if ( fSuccess )
     {
-        fSuccess = MoveFileExImpl( sFileName2.c_str(), sFileName1.c_str(), MOVEFILE_REPLACE_EXISTING );
+        fSuccess = MoveFileExA( sFileName2.c_str(), sFileName1.c_str(), MOVEFILE_REPLACE_EXISTING );
 
         if ( fSuccess )
         {
-            fSuccess = MoveFileExImpl( sTempFileName.c_str(), sFileName2.c_str(),
+            fSuccess = MoveFileExA( sTempFileName.c_str(), sFileName2.c_str(),
                                         MOVEFILE_REPLACE_EXISTING );
             if ( !fSuccess )
             {
-                MoveFileExImpl( sFileName1.c_str(), sFileName2.c_str(), MOVEFILE_REPLACE_EXISTING );
+                MoveFileExA( sFileName1.c_str(), sFileName2.c_str(), MOVEFILE_REPLACE_EXISTING );
             }
         }
         else
         {
-            MoveFileExImpl( sTempFileName.c_str(), sFileName1.c_str(), MOVEFILE_REPLACE_EXISTING  );
+            MoveFileExA( sTempFileName.c_str(), sFileName1.c_str(), MOVEFILE_REPLACE_EXISTING  );
         }
     }
     else
@@ -284,7 +216,7 @@ static bool SwapFiles( const std::_tstring& sFileName1, const std::_tstring& sFi
         HANDLE hdl = FindFirstFile(sFileName1.c_str(), &data);
         if (hdl == INVALID_HANDLE_VALUE)
         {
-            fSuccess = MoveFileExImpl( sFileName2.c_str(), sFileName1.c_str(), MOVEFILE_REPLACE_EXISTING );
+            fSuccess = MoveFileExA( sFileName2.c_str(), sFileName1.c_str(), MOVEFILE_REPLACE_EXISTING );
         }
         else
         {
@@ -668,10 +600,10 @@ extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle )
             std::_tstring   sResourceFile = sResourceDir + aFindFileData.cFileName;
             std::_tstring   sIntermediate = sResourceFile + TEXT(".tmp");
 
-            fRenameSucceeded = MoveFileExImpl( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING );
+            fRenameSucceeded = MoveFileExA( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING );
             if ( fRenameSucceeded )
             {
-                MoveFileExImpl( sIntermediate.c_str(), sResourceFile.c_str(), 0 );
+                MoveFileExA( sIntermediate.c_str(), sResourceFile.c_str(), 0 );
                 fSuccess = FindNextFile( hFind, &aFindFileData );
             }
         } while ( fSuccess && fRenameSucceeded );
diff --git a/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx b/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx
index f50c795..76f6b6e 100644
--- a/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx
@@ -109,74 +109,6 @@ static inline void SetMsiProperty(MSIHANDLE handle, const std::_tstring& sProper
     MsiSetProperty(handle, sProperty.c_str(), TEXT("1"));
 }
 
-static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags )
-{
-    BOOL    fSuccess = FALSE;   // assume failure
-
-    // Windows 9x has a special mechanism to move files after reboot
-
-    if ( dwFlags & MOVEFILE_DELAY_UNTIL_REBOOT )
-    {
-        CHAR    szExistingFileNameA[MAX_PATH];
-        CHAR    szNewFileNameA[MAX_PATH] = "NUL";
-
-        // Path names in WININIT.INI must be in short path name form
-
-        if (
-            GetShortPathNameA( lpExistingFileNameA, szExistingFileNameA, MAX_PATH ) &&
-            (!lpNewFileNameA || GetShortPathNameA( lpNewFileNameA, szNewFileNameA, MAX_PATH ))
-            )
-        {
-            CHAR    szBuffer[32767];    // The buffer size must not exceed 32K
-            DWORD   dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, SAL_N_ELEMENTS(szBuffer), WININIT_FILENAME );
-
-            CHAR    szRename[MAX_PATH]; // This is enough for at most to times 67 chracters
-            strcpy( szRename, szNewFileNameA );
-            strcat( szRename, "=" );
-            strcat( szRename, szExistingFileNameA );
-            size_t  lnRename = strlen(szRename);
-
-            if ( dwBufLen + lnRename + 2 <= SAL_N_ELEMENTS(szBuffer) )
-            {
-                CopyMemory( &szBuffer[dwBufLen], szRename, lnRename );
-                szBuffer[dwBufLen + lnRename ] = 0;
-                szBuffer[dwBufLen + lnRename + 1 ] = 0;
-
-                fSuccess = WritePrivateProfileSectionA( RENAME_SECTION, szBuffer, WININIT_FILENAME );
-            }
-            else
-                SetLastError( ERROR_BUFFER_OVERFLOW );
-        }
-    }
-    else
-    {
-
-        fSuccess = MoveFileA( lpExistingFileNameA, lpNewFileNameA );
-
-        if ( !fSuccess && GetLastError() != ERROR_ACCESS_DENIED &&
-            0 != (dwFlags & (MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) )
-        {
-            BOOL    bFailIfExist = 0 == (dwFlags & MOVEFILE_REPLACE_EXISTING);
-
-            fSuccess = CopyFileA( lpExistingFileNameA, lpNewFileNameA, bFailIfExist );
-
-            if ( fSuccess )
-                fSuccess = DeleteFileA( lpExistingFileNameA );
-        }
-
-    }
-
-    return fSuccess;
-}
-
-static BOOL MoveFileExImpl( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags )
-{
-    if ( 0 > ((LONG)GetVersion())) // High order bit indicates Win 9x
-        return MoveFileEx9x( lpExistingFileNameA, lpNewFileNameA, dwFlags );
-    else
-        return MoveFileExA( lpExistingFileNameA, lpNewFileNameA, dwFlags );
-}
-
 extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle )
 {
     OSVERSIONINFO   osverinfo;
@@ -211,10 +143,10 @@ extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle )
                 std::_tstring   sResourceFile = sResourceDir + aFindFileData.cFileName;
                 std::_tstring   sIntermediate = sResourceFile + TEXT(".tmp");
 
-                fRenameSucceeded = MoveFileExImpl( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING );
+                fRenameSucceeded = MoveFileExA( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING );
                 if ( fRenameSucceeded )
                 {
-                    MoveFileExImpl( sIntermediate.c_str(), sResourceFile.c_str(), 0 );
+                    MoveFileExA( sIntermediate.c_str(), sResourceFile.c_str(), 0 );
                     fSuccess = FindNextFile( hFind, &aFindFileData );
                 }
             } while ( fSuccess && fRenameSucceeded );


More information about the Libreoffice-commits mailing list