[Libreoffice-commits] core.git: setup_native/source

nd101 (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 10 02:46:05 UTC 2019


 setup_native/source/win32/customactions/inst_msu/inst_msu.cxx |   12 ++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 3811e9b80bbd4f1598ab8958a8bf050262170265
Author:     nd101 <Fong at nd.com.cn>
AuthorDate: Fri Jul 5 15:35:18 2019 +0800
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Jul 10 04:45:27 2019 +0200

    fix HRESULT_FROM_WIN32 can not be placed inside switch for SDK8.1
    
    For Windows SDK 8.1 HRESULT_FROM_WIN32 is defined as an inline
    function without the constexpr, which is required for case statement
    inside a switch.
    
    Change-Id: Ibb195ef900926d87ff04f82a6d73112b8858f633
    Reviewed-on: https://gerrit.libreoffice.org/75111
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Jenkins

diff --git a/setup_native/source/win32/customactions/inst_msu/inst_msu.cxx b/setup_native/source/win32/customactions/inst_msu/inst_msu.cxx
index 6ce517f2f863..26f7668ff069 100644
--- a/setup_native/source/win32/customactions/inst_msu/inst_msu.cxx
+++ b/setup_native/source/win32/customactions/inst_msu/inst_msu.cxx
@@ -604,13 +604,21 @@ extern "C" __declspec(dllexport) UINT __stdcall InstallMSU(MSIHANDLE hInstall)
         if (!GetExitCodeProcess(pi.hProcess, &nExitCode))
             ThrowLastError("GetExitCodeProcess");
 
-        switch (HRESULT hr = static_cast<HRESULT>(nExitCode))
+        HRESULT hr = static_cast<HRESULT>(nExitCode);
+
+        // HRESULT_FROM_WIN32 is defined as an inline function in SDK 8.1 without the constexpr
+        // And it won't work to place it inside the switch statement.
+        if (HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED) == hr)
+        {
+            hr = ERROR_SUCCESS_REBOOT_REQUIRED;
+        }
+
+        switch (hr)
         {
             case S_OK:
             case WU_S_ALREADY_INSTALLED:
             case WU_E_NOT_APPLICABLE: // Windows could lie us about its version, etc.
             case ERROR_SUCCESS_REBOOT_REQUIRED:
-            case HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED):
             case WU_S_REBOOT_REQUIRED:
                 WriteLog(hInstall, "wusa.exe succeeded with exit code", Num2Hex(nExitCode));
                 return ERROR_SUCCESS;


More information about the Libreoffice-commits mailing list