[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - shell/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Wed May 15 05:50:33 UTC 2019


 shell/source/win32/spsupp/COMOpenDocuments.cxx |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 51fb20cda19dfd0f26228d10ba1296ceca4e3601
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue May 14 19:15:59 2019 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed May 15 07:49:40 2019 +0200

    Use proper VARIANT_BOOL values: VARIANT_TRUE is actually -1
    
    Who was that idiot who initially used wrong values??? Hmm... oh damn,
    that was me :-(
    
    Change-Id: I3bfde7511bcf8adfa38ae68372f21511f21efca1
    Reviewed-on: https://gerrit.libreoffice.org/72308
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit 31cc28ca7c02f28b64e9d757c9fc17e2a81ba352)
    Reviewed-on: https://gerrit.libreoffice.org/72332

diff --git a/shell/source/win32/spsupp/COMOpenDocuments.cxx b/shell/source/win32/spsupp/COMOpenDocuments.cxx
index e731ceccaadc..93f6a17aaa8b 100644
--- a/shell/source/win32/spsupp/COMOpenDocuments.cxx
+++ b/shell/source/win32/spsupp/COMOpenDocuments.cxx
@@ -16,6 +16,9 @@
 #include <spsuppServ.hpp>
 #include <stdio.h>
 
+namespace
+{
+
 // Display confirmation dialog, return false on negative answer
 bool SecurityWarning(const wchar_t* sProgram, const wchar_t* sDocument)
 {
@@ -76,6 +79,10 @@ HRESULT LOStart(const wchar_t* sModeArg, const wchar_t* sFilePath, bool bDoSecur
     return S_OK;
 }
 
+VARIANT_BOOL toVBool(bool b) { return b ? VARIANT_TRUE : VARIANT_FALSE; }
+
+} // namespace
+
 // IObjectSafety methods
 
 void COMOpenDocuments::COMObjectSafety::SetMaskedOptions(DWORD iMask, DWORD iOptions)
@@ -309,7 +316,7 @@ STDMETHODIMP COMOpenDocuments::CreateNewDocument2(
 {
     // TODO: resolve the program from varProgID (nullptr -> default?)
     HRESULT hr = LOStart(L"-n", bstrTemplateLocation, m_aObjectSafety.GetSafe_forUntrustedCaller() || m_aObjectSafety.GetSafe_forUntrustedData());
-    *pbResult = VARIANT_BOOL(SUCCEEDED(hr));
+    *pbResult = toVBool(SUCCEEDED(hr));
     return hr;
 }
 
@@ -360,7 +367,7 @@ STDMETHODIMP COMOpenDocuments::ViewDocument3(
 {
     // TODO: resolve the program from varProgID (nullptr -> default?)
     HRESULT hr = LOStart(L"--view", bstrDocumentLocation, m_aObjectSafety.GetSafe_forUntrustedCaller() || m_aObjectSafety.GetSafe_forUntrustedData());
-    *pbResult = VARIANT_BOOL(SUCCEEDED(hr));
+    *pbResult = toVBool(SUCCEEDED(hr));
     return hr;
 }
 
@@ -422,7 +429,7 @@ STDMETHODIMP COMOpenDocuments::EditDocument3(
 {
     // TODO: resolve the program from varProgID (nullptr -> default?)
     HRESULT hr = LOStart(L"-o", bstrDocumentLocation, m_aObjectSafety.GetSafe_forUntrustedCaller() || m_aObjectSafety.GetSafe_forUntrustedData());
-    *pbResult = VARIANT_BOOL(SUCCEEDED(hr));
+    *pbResult = toVBool(SUCCEEDED(hr));
     return hr;
 }
 


More information about the Libreoffice-commits mailing list