diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-04 10:50:56 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-04 09:21:49 +0200 |
commit | 65a57e5c7c3770d788e076303a7182de43a17cbf (patch) | |
tree | a37fbd14fd54b085544deea7e8d35d788767327e /sdext | |
parent | 9e47e217126d421e51e167da0d94a5d7c2f078ed (diff) |
A small refactor
Change-Id: I299cc7c2850a71ee563824c6361707d894f5ddcc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165773
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/source/pdfimport/wrapper/wrapper.cxx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index 6a17d295eae1..86c0d3cf806f 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -61,6 +61,7 @@ #include <memory> #include <string_view> #include <unordered_map> +#include <vector> #include <string.h> using namespace com::sun::star; @@ -1081,10 +1082,13 @@ bool xpdf_ImportFromFile(const OUString& rURL, // spawn separate process to keep LGPL/GPL code apart. - OUString aOptFlag("-o"); - rtl_uString* args[] = { aSysUPath.pData, - aOptFlag.pData, rFilterOptions.pData }; - sal_Int32 nArgs = rFilterOptions.isEmpty() ? std::size(args) - 2 : std::size(args); + constexpr OUString aOptFlag(u"-o"_ustr); + std::vector<rtl_uString*> args({ aSysUPath.pData }); + if (!rFilterOptions.isEmpty()) + { + args.push_back(aOptFlag.pData); + args.push_back(rFilterOptions.pData); + } oslProcess aProcess; oslFileHandle pIn = nullptr; @@ -1093,8 +1097,8 @@ bool xpdf_ImportFromFile(const OUString& rURL, oslSecurity pSecurity = osl_getCurrentSecurity (); oslProcessError eErr = osl_executeProcess_WithRedirectedIO(converterURL.pData, - args, - nArgs, + args.data(), + args.size(), osl_Process_SEARCHPATH|osl_Process_HIDDEN, pSecurity, nullptr, nullptr, 0, |