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

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Mon Oct 14 11:07:09 UTC 2019


 filter/source/graphicfilter/ieps/ieps.cxx |   26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

New commits:
commit 1c85b047b6cfdbae010f0967e9c9f99f7a101d32
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Oct 14 07:47:17 2019 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Oct 14 13:06:21 2019 +0200

    tdf#94117: try gswin64c if gswin32c failed
    
    Change-Id: I3c29ef72525aa25ee8606122f01b7b611ecb2091
    Reviewed-on: https://gerrit.libreoffice.org/80748
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx
index 2ce4fd01b022..39c2d1fe784d 100644
--- a/filter/source/graphicfilter/ieps/ieps.cxx
+++ b/filter/source/graphicfilter/ieps/ieps.cxx
@@ -296,15 +296,21 @@ static void WriteFileInThread(void *wData)
 }
 
 static bool RenderAsBMPThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
-    Graphic &rGraphic, const OUString &rProgName, rtl_uString *pArgs[], size_t nArgs)
+                                     Graphic& rGraphic,
+                                     std::initializer_list<OUStringLiteral> aProgNames,
+                                     rtl_uString* pArgs[], size_t nArgs)
 {
-    oslProcess aProcess;
+    oslProcess aProcess = nullptr;
     oslFileHandle pIn = nullptr;
     oslFileHandle pOut = nullptr;
     oslFileHandle pErr = nullptr;
-    oslProcessError eErr = runProcessWithPathSearch(rProgName,
-            pArgs, nArgs,
-            &aProcess, &pIn, &pOut, &pErr);
+    oslProcessError eErr = osl_Process_E_Unknown;
+    for (const auto& rProgName : aProgNames)
+    {
+        eErr = runProcessWithPathSearch(rProgName, pArgs, nArgs, &aProcess, &pIn, &pOut, &pErr);
+        if (eErr == osl_Process_E_None)
+            break;
+    }
     if (eErr!=osl_Process_E_None)
         return false;
 
@@ -362,7 +368,7 @@ static bool RenderAsBMPThroughConvert(const sal_uInt8* pBuf, sal_uInt32 nBytesRe
         arg1.pData, arg2.pData, arg3.pData, arg4.pData
     };
     return RenderAsBMPThroughHelper(pBuf, nBytesRead, rGraphic,
-        ("convert" EXESUFFIX),
+        { "convert" EXESUFFIX },
         args,
         SAL_N_ELEMENTS(args));
 }
@@ -389,9 +395,13 @@ static bool RenderAsBMPThroughGS(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
     };
     return RenderAsBMPThroughHelper(pBuf, nBytesRead, rGraphic,
 #ifdef _WIN32
-        "gswin32c" EXESUFFIX,
+        // Try both 32-bit and 64-bit ghostscript executable name
+        {
+            "gswin32c" EXESUFFIX,
+            "gswin64c" EXESUFFIX,
+        },
 #else
-        "gs" EXESUFFIX,
+        { "gs" EXESUFFIX },
 #endif
         args,
         SAL_N_ELEMENTS(args));


More information about the Libreoffice-commits mailing list