summaryrefslogtreecommitdiff
path: root/jvmfwk
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 /jvmfwk
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 'jvmfwk')
-rw-r--r--jvmfwk/source/framework.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index 0165fcf9efd9..42d99557fc0b 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -187,10 +187,9 @@ javaFrameworkError jfw_findAllJREs(std::vector<std::unique_ptr<JavaInfo>> *pparI
}
javaFrameworkError jfw_startVM(
- JavaInfo const * pInfo, JavaVMOption * arOptions, sal_Int32 cOptions,
+ JavaInfo const * pInfo, std::vector<OUString> const & arOptions,
JavaVM ** ppVM, JNIEnv ** ppEnv)
{
- assert(cOptions == 0 || arOptions != nullptr);
assert(ppVM != nullptr);
javaFrameworkError errcode = JFW_E_NONE;
@@ -289,7 +288,7 @@ javaFrameworkError jfw_startVM(
// it contains the classpath and all options set in the
//options dialog
std::unique_ptr<JavaVMOption[]> sarJOptions(
- new JavaVMOption[cOptions + 2 + vmParams.size()]);
+ new JavaVMOption[arOptions.size() + 2 + vmParams.size()]);
JavaVMOption * arOpt = sarJOptions.get();
if (! arOpt)
return JFW_E_ERROR;
@@ -313,10 +312,13 @@ javaFrameworkError jfw_startVM(
index ++;
}
//add all options of the arOptions argument
- for (int ii = 0; ii < cOptions; ii++)
+ std::vector<OString> convertedOptions;
+ for (auto const & ii: arOptions)
{
- arOpt[index].optionString = arOptions[ii].optionString;
- arOpt[index].extraInfo = arOptions[ii].extraInfo;
+ OString conv = OUStringToOString(ii, osl_getThreadTextEncoding());
+ convertedOptions.push_back(conv);
+ arOpt[index].optionString = const_cast<char *>(conv.getStr());
+ arOpt[index].extraInfo = nullptr;
index++;
}