summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-04-12 23:10:11 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-04-13 07:47:48 +0200
commit1a2afa01c98b6edefaaf18590d6e55c3a9731920 (patch)
tree3b3aedbbe3756e125cdad8638db11064d8647b25 /stoc
parent3c3f7d784eadd60c053284ec2835675f158d4156 (diff)
Simplify passing options to jfw_startVM
Change-Id: Idac31e282fe4df69449298a03d491473e460c742 Reviewed-on: https://gerrit.libreoffice.org/36495 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/javavm/javavm.cxx30
1 files changed, 4 insertions, 26 deletions
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index 18ab9084c78e..a4e9efe66e59 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -706,33 +706,11 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
stoc_javavm::JVM aJvm;
initVMConfiguration(&aJvm, m_xContext->getServiceManager(),
m_xContext);
- //Create the JavaVMOption array
const std::vector<OUString> & props = aJvm.getProperties();
- std::unique_ptr<JavaVMOption[]> sarOptions(
- new JavaVMOption[props.size()]);
- JavaVMOption * arOptions = sarOptions.get();
- //Create an array that contains the strings which are passed
- //into the options
- std::unique_ptr<OString[]> sarPropStrings(
- new OString[props.size()]);
- OString * arPropStrings = sarPropStrings.get();
-
- OString sJavaOption("-");
- typedef std::vector<OUString>::const_iterator cit;
- int index = 0;
- for (cit i = props.begin(); i != props.end(); ++i)
+ std::vector<OUString> options;
+ for (auto const & i: props)
{
- OString sOption = OUStringToOString(
- *i, osl_getThreadTextEncoding());
-
- if (!sOption.matchIgnoreAsciiCase(sJavaOption))
- arPropStrings[index]= OString("-D") + sOption;
- else
- arPropStrings[index] = sOption;
-
- arOptions[index].optionString = const_cast<sal_Char*>(arPropStrings[index].getStr());
- arOptions[index].extraInfo = nullptr;
- index ++;
+ options.push_back(i.startsWith("-") ? i : "-D" + i);
}
JNIEnv * pMainThreadEnv = nullptr;
@@ -741,7 +719,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
if (getenv("STOC_FORCE_NO_JRE"))
errcode = JFW_E_NO_SELECT;
else
- errcode = jfw_startVM(info.get(), arOptions, index, & m_pJavaVm,
+ errcode = jfw_startVM(info.get(), options, & m_pJavaVm,
& pMainThreadEnv);
bool bStarted = false;