diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-04-11 22:25:23 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-04-12 09:36:20 +0200 |
commit | f1bbafc584ba538c21ee156e411903ed142cac2a (patch) | |
tree | 34a471868cbb85ea7aa26413fe87e5afac4781ec /jvmfwk | |
parent | 61f43d0327c81bb2df88734c9572e489e4a9de31 (diff) |
Convert rtl_uString -> OUString in jfw_get/setVMParameters
Change-Id: I55f96873661f686cd9625d69523718ccb54659dc
Diffstat (limited to 'jvmfwk')
-rw-r--r-- | jvmfwk/inc/elements.hxx | 7 | ||||
-rw-r--r-- | jvmfwk/source/elements.cxx | 37 | ||||
-rw-r--r-- | jvmfwk/source/framework.cxx | 10 |
3 files changed, 12 insertions, 42 deletions
diff --git a/jvmfwk/inc/elements.hxx b/jvmfwk/inc/elements.hxx index f99861a83051..f4766a5c92bd 100644 --- a/jvmfwk/inc/elements.hxx +++ b/jvmfwk/inc/elements.hxx @@ -205,7 +205,7 @@ public: /java/vmParameters@xsi:nil will be set to true when write() is called. */ - void setVmParameters(rtl_uString * * arParameters, sal_Int32 size); + void setVmParameters(std::vector<OUString> const & arParameters); /** adds a location to the already existing locations. Note: call load() before, then add the location and then call write(). @@ -309,10 +309,7 @@ public: bool getJavaInfoAttrAutoSelect() const; #endif - /** returns an array. - Caller must free the strings and the array. - */ - void getVmParametersArray(rtl_uString *** parParameters, sal_Int32 * size) const; + void getVmParametersArray(std::vector<OUString> * parParameters) const; const ::std::vector< OUString> & getJRELocations() const { return m_JRELocations;} }; diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx index b25c49f07104..4da38c001ed9 100644 --- a/jvmfwk/source/elements.cxx +++ b/jvmfwk/source/elements.cxx @@ -591,21 +591,9 @@ void NodeJava::setJavaInfo(const JavaInfo * pInfo, bool bAutoSelect) } } -void NodeJava::setVmParameters(rtl_uString * * arOptions, sal_Int32 size) +void NodeJava::setVmParameters(std::vector<OUString> const & arOptions) { - assert( !(arOptions == nullptr && size != 0)); - if ( ! m_vmParameters) - m_vmParameters = boost::optional<std::vector<OUString> >( - std::vector<OUString>()); - m_vmParameters->clear(); - if (arOptions != nullptr) - { - for (int i = 0; i < size; i++) - { - const OUString sOption(arOptions[i]); - m_vmParameters->push_back(sOption); - } - } + m_vmParameters = boost::optional<std::vector<OUString> >(arOptions); } void NodeJava::addJRELocation(OUString const & sLocation) @@ -1024,26 +1012,13 @@ bool MergedSettings::getJavaInfoAttrAutoSelect() const return m_javaInfo.bAutoSelect; } #endif -void MergedSettings::getVmParametersArray( - rtl_uString *** parParams, sal_Int32 * size) const +void MergedSettings::getVmParametersArray(std::vector<OUString> * parParams) + const { - assert(parParams != nullptr && size != nullptr); + assert(parParams != nullptr); osl::MutexGuard guard(FwkMutex::get()); - *parParams = static_cast<rtl_uString **>( - rtl_allocateMemory(sizeof(rtl_uString*) * m_vmParams.size())); - if (*parParams == nullptr) - return; - - int j=0; - typedef std::vector<OUString>::const_iterator it; - for (it i = m_vmParams.begin(); i != m_vmParams.end(); - ++i, ++j) - { - (*parParams)[j] = i->pData; - rtl_uString_acquire(i->pData); - } - *size = m_vmParams.size(); + *parParams = m_vmParams; } } diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx index 99b3e5e329dd..dda5b3e8aefe 100644 --- a/jvmfwk/source/framework.cxx +++ b/jvmfwk/source/framework.cxx @@ -834,8 +834,7 @@ javaFrameworkError jfw_getEnabled(bool *pbEnabled) } -javaFrameworkError jfw_setVMParameters( - rtl_uString * * arOptions, sal_Int32 nLen) +javaFrameworkError jfw_setVMParameters(std::vector<OUString> const & arOptions) { javaFrameworkError errcode = JFW_E_NONE; try @@ -844,7 +843,7 @@ javaFrameworkError jfw_setVMParameters( if (jfw::getMode() == jfw::JFW_MODE_DIRECT) return JFW_E_DIRECT_MODE; jfw::NodeJava node(jfw::NodeJava::USER); - node.setVmParameters(arOptions, nLen); + node.setVmParameters(arOptions); node.write(); } catch (const jfw::FrameworkException& e) @@ -857,8 +856,7 @@ javaFrameworkError jfw_setVMParameters( return errcode; } -javaFrameworkError jfw_getVMParameters( - rtl_uString *** parOptions, sal_Int32 * pLen) +javaFrameworkError jfw_getVMParameters(std::vector<OUString> * parOptions) { javaFrameworkError errcode = JFW_E_NONE; try @@ -868,7 +866,7 @@ javaFrameworkError jfw_getVMParameters( return JFW_E_DIRECT_MODE; const jfw::MergedSettings settings; - settings.getVmParametersArray(parOptions, pLen); + settings.getVmParametersArray(parOptions); } catch (const jfw::FrameworkException& e) { |