[Libreoffice-commits] core.git: 6 commits - cui/source desktop/source include/jvmfwk jvmfwk/inc jvmfwk/plugins jvmfwk/source
Stephan Bergmann
sbergman at redhat.com
Wed Apr 12 07:36:42 UTC 2017
cui/source/options/optjava.cxx | 86 ++++----------------
cui/source/options/optjava.hxx | 9 --
desktop/source/migration/services/jvmfwk.cxx | 4
include/jvmfwk/framework.hxx | 32 ++-----
jvmfwk/inc/elements.hxx | 27 ------
jvmfwk/inc/vendorplugin.hxx | 14 ---
jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 39 ++-------
jvmfwk/source/elements.cxx | 82 ++-----------------
jvmfwk/source/framework.cxx | 54 +++---------
jvmfwk/source/framework.hxx | 38 --------
jvmfwk/source/fwkbase.cxx | 2
11 files changed, 81 insertions(+), 306 deletions(-)
New commits:
commit 9b157d37f15b34720fced0b94d4541f4149a8947
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Apr 11 22:43:26 2017 +0200
Remove unused jfw::VendorSettings instantiations
Change-Id: I0af90fbb9eb77e5e65b29a79cc3b37af8cfc75e6
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index 86d2df71be2e..adca111e3246 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -286,9 +286,6 @@ javaFrameworkError jfw_startVM(
}
assert(pInfo != nullptr);
- //get the function jfw_plugin_startJavaVirtualMachine
- jfw::VendorSettings aVendorSettings;
-
// create JavaVMOptions array that is passed to the plugin
// it contains the classpath and all options set in the
//options dialog
@@ -945,8 +942,6 @@ javaFrameworkError jfw_addJRELocation(OUString const & sLocation)
javaFrameworkError jfw_existJRE(const JavaInfo *pInfo, bool *exist)
{
- //get the function jfw_plugin_existJRE
- jfw::VendorSettings aVendorSettings;
javaPluginError plerr = jfw_plugin_existJRE(pInfo, exist);
javaFrameworkError ret = JFW_E_NONE;
commit 598f788116cc830ffd8e3b214d5dade651e2aa95
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Apr 11 22:33:49 2017 +0200
Remove unnecessary copy
Change-Id: Ib350999ddf3ed2753b9e615a07b963c459dc714b
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index dda5b3e8aefe..86d2df71be2e 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -947,8 +947,6 @@ javaFrameworkError jfw_existJRE(const JavaInfo *pInfo, bool *exist)
{
//get the function jfw_plugin_existJRE
jfw::VendorSettings aVendorSettings;
- jfw::CJavaInfo aInfo;
- aInfo = pInfo; //makes a copy of pInfo
javaPluginError plerr = jfw_plugin_existJRE(pInfo, exist);
javaFrameworkError ret = JFW_E_NONE;
commit 331f0e0c1e921d41116de5190c6eee81fad63a61
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Apr 11 22:29:51 2017 +0200
Remove unused function pointer typedefs
Change-Id: I51ee45dba007e5709b1516c36b029f940ea7153e
diff --git a/jvmfwk/source/framework.hxx b/jvmfwk/source/framework.hxx
index 9521a723c54a..f514964db995 100644
--- a/jvmfwk/source/framework.hxx
+++ b/jvmfwk/source/framework.hxx
@@ -24,44 +24,6 @@
#include "jvmfwk/framework.hxx"
#include "vendorplugin.hxx"
-/** typedefs for functions from vendorplugin.hxx
- */
-typedef javaPluginError (*jfw_plugin_getAllJavaInfos_ptr)(
- rtl_uString * sVendor,
- rtl_uString * sMinVersion,
- rtl_uString * sMaxVersion,
- rtl_uString * * arExcludeList,
- sal_Int32 nLenList,
- JavaInfo*** parJavaInfo,
- sal_Int32 *nLenInfoList);
-
-typedef javaPluginError (*jfw_plugin_getJavaInfoByPath_ptr)(
- rtl_uString * sPath,
- rtl_uString * sVendor,
- rtl_uString * sMinVersion,
- rtl_uString * sMaxVersion,
- rtl_uString * * arExcludeList,
- sal_Int32 nLenList,
- JavaInfo** ppInfo);
-
-/** starts a Java Virtual Machine.
- <p>
- The function shall ensure, that the VM does not abort the process
- during instantiation.
- </p>
- */
-typedef javaPluginError (*jfw_plugin_startJavaVirtualMachine_ptr)(
- const JavaInfo *info,
- const JavaVMOption* options,
- sal_Int32 cOptions,
- JavaVM ** ppVM,
- JNIEnv ** ppEnv);
-
-typedef javaPluginError (*jfw_plugin_existJRE_ptr)(
- const JavaInfo *info,
- sal_Bool *exist);
-
-
namespace jfw
{
commit f1bbafc584ba538c21ee156e411903ed142cac2a
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Apr 11 22:25:23 2017 +0200
Convert rtl_uString -> OUString in jfw_get/setVMParameters
Change-Id: I55f96873661f686cd9625d69523718ccb54659dc
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 84c9fef6ca1b..03a2c6232d83 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <vector>
+
#include <config_features.h>
#include "optaboutconfig.hxx"
@@ -63,35 +67,6 @@ using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::uno;
-#if HAVE_FEATURE_JAVA
-
-static bool areListsEqual( const Sequence< OUString >& rListA, const Sequence< OUString >& rListB )
-{
- bool bRet = true;
- const sal_Int32 nLen = rListA.getLength();
-
- if ( rListB.getLength() != nLen )
- bRet = false;
- else
- {
- const OUString* pStringA = rListA.getConstArray();
- const OUString* pStringB = rListB.getConstArray();
-
- for ( sal_Int32 i = 0; i < nLen; ++i )
- {
- if ( *pStringA++ != *pStringB++ )
- {
- bRet = false;
- break;
- }
- }
- }
-
- return bRet;
-}
-
-#endif
-
class SvxJavaListBox : public svx::SvxRadioButtonListBox
{
private:
@@ -138,10 +113,6 @@ SvxJavaOptionsPage::SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet&
: SfxTabPage(pParent, "OptAdvancedPage", "cui/ui/optadvancedpage.ui", &rSet)
, m_pParamDlg(nullptr)
, m_pPathDlg(nullptr)
-#if HAVE_FEATURE_JAVA
- , m_parParameters(nullptr)
- , m_nParamSize(0)
-#endif
, m_aResetIdle("cui options SvxJavaOptionsPage Reset")
, xDialogListener(new ::svt::DialogClosedListener())
{
@@ -293,21 +264,14 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, AddHdl_Impl, Button*, void)
IMPL_LINK_NOARG(SvxJavaOptionsPage, ParameterHdl_Impl, Button*, void)
{
#if HAVE_FEATURE_JAVA
- Sequence< OUString > aParameterList;
+ std::vector< OUString > aParameterList;
if ( !m_pParamDlg )
{
m_pParamDlg = VclPtr<SvxJavaParameterDlg>::Create( this );
- javaFrameworkError eErr = jfw_getVMParameters( &m_parParameters, &m_nParamSize );
- if ( JFW_E_NONE == eErr && m_parParameters && m_nParamSize > 0 )
+ javaFrameworkError eErr = jfw_getVMParameters( &m_parParameters );
+ if ( JFW_E_NONE == eErr && !m_parParameters.empty() )
{
- rtl_uString** pParamArr = m_parParameters;
- aParameterList.realloc( m_nParamSize );
- OUString* pParams = aParameterList.getArray();
- for ( sal_Int32 i = 0; i < m_nParamSize; ++i )
- {
- rtl_uString* pParam = *pParamArr++;
- pParams[i] = OUString( pParam );
- }
+ aParameterList = m_parParameters;
m_pParamDlg->SetParameters( aParameterList );
}
}
@@ -319,7 +283,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ParameterHdl_Impl, Button*, void)
if ( m_pParamDlg->Execute() == RET_OK )
{
- if ( !areListsEqual( aParameterList, m_pParamDlg->GetParameters() ) )
+ if ( aParameterList != m_pParamDlg->GetParameters() )
{
aParameterList = m_pParamDlg->GetParameters();
if ( jfw_isVMRunning() )
@@ -632,15 +596,8 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
javaFrameworkError eErr = JFW_E_NONE;
if ( m_pParamDlg )
{
- Sequence< OUString > aParamList = m_pParamDlg->GetParameters();
- sal_Int32 i, nSize = aParamList.getLength();
- rtl_uString** pParamArr = static_cast<rtl_uString**>(rtl_allocateMemory( sizeof(rtl_uString*) * nSize ));
- const OUString* pList = aParamList.getConstArray();
- for ( i = 0; i < nSize; ++i )
- pParamArr[i] = pList[i].pData;
- eErr = jfw_setVMParameters( pParamArr, nSize );
+ eErr = jfw_setVMParameters( m_pParamDlg->GetParameters() );
SAL_WARN_IF(JFW_E_NONE != eErr, "cui.options", "SvxJavaOptionsPage::FillItemSet(): error in jfw_setVMParameters");
- rtl_freeMemory( pParamArr );
bModified = true;
}
@@ -879,13 +836,12 @@ short SvxJavaParameterDlg::Execute()
}
-Sequence< OUString > SvxJavaParameterDlg::GetParameters() const
+std::vector< OUString > SvxJavaParameterDlg::GetParameters() const
{
sal_Int32 nCount = m_pAssignedList->GetEntryCount();
- Sequence< OUString > aParamList( nCount );
- OUString* pArray = aParamList.getArray();
+ std::vector< OUString > aParamList;
for ( sal_Int32 i = 0; i < nCount; ++i )
- pArray[i] = OUString( m_pAssignedList->GetEntry(i) );
+ aParamList.push_back( m_pAssignedList->GetEntry(i) );
return aParamList;
}
@@ -897,14 +853,11 @@ void SvxJavaParameterDlg::DisableButtons()
DisableRemoveButton();
}
-void SvxJavaParameterDlg::SetParameters( Sequence< OUString >& rParams )
+void SvxJavaParameterDlg::SetParameters( std::vector< OUString > const & rParams )
{
m_pAssignedList->Clear();
- sal_uLong i, nCount = rParams.getLength();
- const OUString* pArray = rParams.getConstArray();
- for ( i = 0; i < nCount; ++i )
+ for (auto const & sParam: rParams)
{
- OUString sParam = OUString( *pArray++ );
m_pAssignedList->InsertEntry( sParam );
}
DisableEditButton();
diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx
index 47fb0a85e32c..6598dfda5c70 100644
--- a/cui/source/options/optjava.hxx
+++ b/cui/source/options/optjava.hxx
@@ -66,9 +66,8 @@ private:
#if HAVE_FEATURE_JAVA
std::vector<std::unique_ptr<JavaInfo>> m_parJavaInfo;
- rtl_uString** m_parParameters;
+ std::vector<OUString> m_parParameters;
OUString m_pClassPath;
- sal_Int32 m_nParamSize;
#endif
OUString m_sInstallText;
OUString m_sAccessibilityText;
@@ -165,8 +164,8 @@ public:
virtual short Execute() override;
- css::uno::Sequence< OUString > GetParameters() const;
- void SetParameters( css::uno::Sequence< OUString >& rParams );
+ std::vector< OUString > GetParameters() const;
+ void SetParameters( std::vector< OUString > const & rParams );
void DisableButtons();
void EditParameter();
};
diff --git a/include/jvmfwk/framework.hxx b/include/jvmfwk/framework.hxx
index c0aff6841682..d6059bb640af 100644
--- a/include/jvmfwk/framework.hxx
+++ b/include/jvmfwk/framework.hxx
@@ -29,7 +29,6 @@
#include <jvmfwk/jvmfwkdllapi.hxx>
#include <rtl/byteseq.hxx>
-#include <rtl/ustring.h>
#include <rtl/ustring.hxx>
#include <osl/mutex.h>
#include "jni.h"
@@ -587,9 +586,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_getEnabled(bool *pbEnabled);
</p>
@param arParameters
- [in] contains the arguments. It can be NULL if nSize is 0.
- @param nSize
- [i] the size of <code>arArgs</code>
+ [in] contains the arguments.
@return
JFW_E_NONE function ran successfully.<br/>
@@ -599,21 +596,12 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_getEnabled(bool *pbEnabled);
JFW_E_DIRECT_MODE the function cannot be used in this mode.
*/
JVMFWK_DLLPUBLIC javaFrameworkError jfw_setVMParameters(
- rtl_uString ** arArgs, sal_Int32 nSize);
+ std::vector<OUString> const & arArgs);
/** obtains the currently used start parameters.
- <p>The caller needs to free the returned array with
- <code>rtl_freeMemory</code>. The contained strings must be released with
- <code>rtl_uString_release</code>.
- </p>
-
@param parParameters
[out] on returns contains a pointer to the array of the start arguments.
- If *parParameters is not NULL then the value is overwritten.
- @param pSize
- [out] on return contains the size of array returned in
- <code>parParameters</code>
@return
JFW_E_NONE function ran successfully.<br/>
@@ -623,8 +611,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_setVMParameters(
JFW_E_DIRECT_MODE the function cannot be used in this mode.
*/
JVMFWK_DLLPUBLIC javaFrameworkError jfw_getVMParameters(
- rtl_uString *** parParameters,
- sal_Int32 * pSize);
+ std::vector<OUString> * parParameters);
/** sets the user class path.
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 at 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)
{
commit 61f43d0327c81bb2df88734c9572e489e4a9de31
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Apr 11 21:52:36 2017 +0200
Simplify jfw::VersionInfo
Change-Id: I2cc1071bbaf9c68fbd621d6c0c6953b7646b1a62
diff --git a/jvmfwk/inc/elements.hxx b/jvmfwk/inc/elements.hxx
index a2c17bfcaeb0..f99861a83051 100644
--- a/jvmfwk/inc/elements.hxx
+++ b/jvmfwk/inc/elements.hxx
@@ -318,27 +318,11 @@ public:
};
-class VersionInfo
+struct VersionInfo
{
::std::vector< OUString> vecExcludeVersions;
- rtl_uString ** arVersions;
-
-public:
- VersionInfo();
- ~VersionInfo();
-
- void addExcludeVersion(const OUString& sVersion);
-
OUString sMinVersion;
OUString sMaxVersion;
-
- /** The caller DOES NOT get ownership of the strings. That is he
- does not need to release the strings.
- The array exists as long as this object exists.
- */
-
- rtl_uString** getExcludeVersions();
- sal_Int32 getExcludeVersionSize();
};
} //end namespace
diff --git a/jvmfwk/inc/vendorplugin.hxx b/jvmfwk/inc/vendorplugin.hxx
index d4febd726d18..d456fe74a59c 100644
--- a/jvmfwk/inc/vendorplugin.hxx
+++ b/jvmfwk/inc/vendorplugin.hxx
@@ -88,9 +88,7 @@ enum class javaPluginError
[in] represents the maximum version of a JRE. The string can be empty.
@param arExcludeList
[in] contains a list of "bad" versions. JREs which have one of these
- versions must not be returned by this function. It can be NULL.
- @param nSizeExcludeList
- [in] the number of version strings contained in <code>arExcludeList</code>.
+ versions must not be returned by this function.
@param parJavaInfo
[out] if the function runs successfully then <code>parJavaInfo</code> contains
on return an array of pointers to <code>JavaInfo</code> objects.
@@ -111,8 +109,7 @@ javaPluginError jfw_plugin_getAllJavaInfos(
OUString const& sVendor,
OUString const& sMinVersion,
OUString const& sMaxVersion,
- rtl_uString * * arExcludeList,
- sal_Int32 nSizeExcludeList,
+ std::vector<OUString> const & arExcludeList,
JavaInfo*** parJavaInfo,
sal_Int32 *nSizeJavaInfo,
std::vector<rtl::Reference<jfw_plugin::VendorBase>> & infos);
@@ -136,9 +133,7 @@ javaPluginError jfw_plugin_getAllJavaInfos(
[in] represents the maximum version of a JRE.
@param arExcludeList
[in] contains a list of "bad" versions. JREs which have one of these
- versions must not be returned by this function. It can be NULL.
- @param nSizeExcludeList
- [in] the number of version strings contained in <code>arExcludeList</code>.
+ versions must not be returned by this function.
@param ppInfo
[out] if the function runs successfully then <code>ppInfo</code> contains
on return a pointer to a <code>JavaInfo</code> object.
@@ -162,8 +157,7 @@ javaPluginError jfw_plugin_getJavaInfoByPath(
OUString const& sVendor,
OUString const& sMinVersion,
OUString const& sMaxVersion,
- rtl_uString * *arExcludeList,
- sal_Int32 nSizeExcludeList,
+ std::vector<OUString> const &arExcludeList,
JavaInfo ** ppInfo);
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 9f3822a3772c..7ade439ed694 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -32,6 +32,8 @@
#include <cassert>
#include <memory>
+#include <vector>
+
#include "config_options.h"
#include "osl/diagnose.h"
#include "rtl/ustring.hxx"
@@ -208,9 +210,7 @@ extern "C" void JNICALL abort_handler()
[in] represents the maximum version of a JRE. The string can be empty.
@param arExcludeList
[in] contains a list of "bad" versions. JREs which have one of these
- versions must not be returned by this function. It can be NULL.
- @param nLenList
- [in] the number of version strings contained in <code>arExcludeList</code>.
+ versions must not be returned by this function.
@return
javaPluginError::NONE the function ran successfully and the version requirements are met
@@ -225,8 +225,7 @@ javaPluginError checkJavaVersionRequirements(
rtl::Reference<VendorBase> const & aVendorInfo,
OUString const& sMinVersion,
OUString const& sMaxVersion,
- rtl_uString * * arExcludeList,
- sal_Int32 nLenList)
+ std::vector<OUString> const & arExcludeList)
{
if (!aVendorInfo->isValidArch())
{
@@ -270,9 +269,7 @@ javaPluginError checkJavaVersionRequirements(
}
}
- for (int i = 0; i < nLenList; i++)
- {
- OUString sExVer(arExcludeList[i]);
+ for (auto const & sExVer: arExcludeList) {
try
{
if (aVendorInfo->compareVersions(sExVer) == 0)
@@ -300,8 +297,7 @@ javaPluginError jfw_plugin_getAllJavaInfos(
OUString const& sVendor,
OUString const& sMinVersion,
OUString const& sMaxVersion,
- rtl_uString * *arExcludeList,
- sal_Int32 nLenList,
+ std::vector<OUString> const &arExcludeList,
JavaInfo*** parJavaInfo,
sal_Int32 *nLenInfoList,
std::vector<rtl::Reference<jfw_plugin::VendorBase>> & infos)
@@ -309,10 +305,6 @@ javaPluginError jfw_plugin_getAllJavaInfos(
assert(parJavaInfo);
assert(nLenInfoList);
- //nLenlist contains the number of elements in arExcludeList.
- //If no exclude list is provided then nLenList must be 0
- assert( ! (arExcludeList == nullptr && nLenList > 0));
-
OSL_ASSERT(!sVendor.isEmpty());
if (sVendor.isEmpty())
return javaPluginError::InvalidArg;
@@ -333,7 +325,7 @@ javaPluginError jfw_plugin_getAllJavaInfos(
continue;
javaPluginError err = checkJavaVersionRequirements(
- cur, sMinVersion, sMaxVersion, arExcludeList, nLenList);
+ cur, sMinVersion, sMaxVersion, arExcludeList);
if (err == javaPluginError::FailedVersion || err == javaPluginError::WrongArch)
continue;
@@ -363,8 +355,7 @@ javaPluginError jfw_plugin_getJavaInfoByPath(
OUString const& sVendor,
OUString const& sMinVersion,
OUString const& sMaxVersion,
- rtl_uString * *arExcludeList,
- sal_Int32 nLenList,
+ std::vector<OUString> const &arExcludeList,
JavaInfo ** ppInfo)
{
assert(ppInfo != nullptr);
@@ -372,10 +363,6 @@ javaPluginError jfw_plugin_getJavaInfoByPath(
if (sPath.isEmpty())
return javaPluginError::InvalidArg;
- //nLenlist contains the number of elements in arExcludeList.
- //If no exclude list is provided then nLenList must be 0
- assert( ! (arExcludeList == nullptr && nLenList > 0));
-
OSL_ASSERT(!sVendor.isEmpty());
if (sVendor.isEmpty())
return javaPluginError::InvalidArg;
@@ -388,7 +375,7 @@ javaPluginError jfw_plugin_getJavaInfoByPath(
if (!sVendor.equals(aVendorInfo->getVendor()))
return javaPluginError::NoJre;
javaPluginError errorcode = checkJavaVersionRequirements(
- aVendorInfo, sMinVersion, sMaxVersion, arExcludeList, nLenList);
+ aVendorInfo, sMinVersion, sMaxVersion, arExcludeList);
if (errorcode == javaPluginError::NONE)
*ppInfo = createJavaInfo(aVendorInfo);
@@ -422,8 +409,7 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
infoJavaHome[0],
versionInfo.sMinVersion,
versionInfo.sMaxVersion,
- versionInfo.getExcludeVersions(),
- versionInfo.getExcludeVersionSize());
+ versionInfo.vecExcludeVersions);
if (errorcode == javaPluginError::NONE)
{
@@ -457,7 +443,7 @@ javaPluginError jfw_plugin_getJavaInfosFromPath(
for (ci_pl vendorInfo = vecVendorInfos.begin(); vendorInfo != vecVendorInfos.end(); ++vendorInfo)
{
const OUString& vendor = vendorInfo->first;
- jfw::VersionInfo versionInfo = vendorInfo->second;
+ jfw::VersionInfo const & versionInfo = vendorInfo->second;
if (vendor.equals(currentInfo->getVendor()))
{
@@ -465,8 +451,7 @@ javaPluginError jfw_plugin_getJavaInfosFromPath(
currentInfo,
versionInfo.sMinVersion,
versionInfo.sMaxVersion,
- versionInfo.getExcludeVersions(),
- versionInfo.getExcludeVersionSize());
+ versionInfo.vecExcludeVersions);
if (errorcode == javaPluginError::NONE)
{
diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index 70c38e852eaf..b25c49f07104 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -171,43 +171,6 @@ void createSettingsStructure(xmlDoc * document, bool * bNeedsSave)
xmlAddChild(root, nodeCrLf);
}
-
-VersionInfo::VersionInfo(): arVersions(nullptr)
-{
-}
-
-VersionInfo::~VersionInfo()
-{
-}
-
-void VersionInfo::addExcludeVersion(const OUString& sVersion)
-{
- vecExcludeVersions.push_back(sVersion);
-}
-
-rtl_uString** VersionInfo::getExcludeVersions()
-{
- osl::MutexGuard guard(FwkMutex::get());
- if (arVersions != nullptr)
- return arVersions;
-
- arVersions = new rtl_uString*[vecExcludeVersions.size()];
- int j=0;
- typedef std::vector<OUString>::const_iterator it;
- for (it i = vecExcludeVersions.begin(); i != vecExcludeVersions.end();
- ++i, ++j)
- {
- arVersions[j] = vecExcludeVersions[j].pData;
- }
- return arVersions;
-}
-
-sal_Int32 VersionInfo::getExcludeVersionSize()
-{
- return vecExcludeVersions.size();
-}
-
-
NodeJava::NodeJava(Layer layer):
m_layer(layer)
{
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index 5ae4c8773f71..99b3e5e329dd 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -93,8 +93,7 @@ javaFrameworkError jfw_findAllJREs(std::vector<std::unique_ptr<JavaInfo>> *pparI
vendor,
versionInfo.sMinVersion,
versionInfo.sMaxVersion,
- versionInfo.getExcludeVersions(),
- versionInfo.getExcludeVersionSize(),
+ versionInfo.vecExcludeVersions,
& arInfos,
& cInfos,
infos);
@@ -121,8 +120,7 @@ javaFrameworkError jfw_findAllJREs(std::vector<std::unique_ptr<JavaInfo>> *pparI
vendor,
versionInfo.sMinVersion,
versionInfo.sMaxVersion,
- versionInfo.getExcludeVersions(),
- versionInfo.getExcludeVersionSize(),
+ versionInfo.vecExcludeVersions,
& aInfo.pInfo);
if (plerr == javaPluginError::NoJre)
continue;
@@ -480,8 +478,7 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo)
vendor,
versionInfo.sMinVersion,
versionInfo.sMaxVersion,
- versionInfo.getExcludeVersions(),
- versionInfo.getExcludeVersionSize(),
+ versionInfo.vecExcludeVersions,
& arInfos,
& cInfos,
infos);
@@ -551,8 +548,7 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo)
vendor,
versionInfo.sMinVersion,
versionInfo.sMaxVersion,
- versionInfo.getExcludeVersions(),
- versionInfo.getExcludeVersionSize(),
+ versionInfo.vecExcludeVersions,
& aInfo.pInfo);
if (err == javaPluginError::NoJre)
continue;
@@ -717,8 +713,7 @@ javaFrameworkError jfw_getJavaInfoByPath(OUString const & pPath, std::unique_ptr
vendor,
versionInfo.sMinVersion,
versionInfo.sMaxVersion,
- versionInfo.getExcludeVersions(),
- versionInfo.getExcludeVersionSize(),
+ versionInfo.vecExcludeVersions,
& pInfo);
if (plerr == javaPluginError::NONE)
diff --git a/jvmfwk/source/fwkbase.cxx b/jvmfwk/source/fwkbase.cxx
index df2e41e4994f..27950eb11630 100644
--- a/jvmfwk/source/fwkbase.cxx
+++ b/jvmfwk/source/fwkbase.cxx
@@ -191,7 +191,7 @@ VersionInfo VendorSettings::getVersionInformation(const OUString & sVendor)
OString osVersion(sVersion);
OUString usVersion = OStringToOUString(
osVersion, RTL_TEXTENCODING_UTF8);
- aVersionInfo.addExcludeVersion(usVersion);
+ aVersionInfo.vecExcludeVersions.push_back(usVersion);
}
}
cur = cur->next;
commit 346b5cfd9078826f8705e226ad317b2e4c58162d
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Apr 11 21:38:46 2017 +0200
Convert some rtl_uString -> OUString in jvmfwk
Change-Id: I08de5cab29dabc6fd824d5df8bac12c8520a05ae
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index a0d4d8dabcc1..84c9fef6ca1b 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -140,7 +140,6 @@ SvxJavaOptionsPage::SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet&
, m_pPathDlg(nullptr)
#if HAVE_FEATURE_JAVA
, m_parParameters(nullptr)
- , m_pClassPath(nullptr)
, m_nParamSize(0)
#endif
, m_aResetIdle("cui options SvxJavaOptionsPage Reset")
@@ -347,7 +346,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ClassPathHdl_Impl, Button*, void)
{
m_pPathDlg = VclPtr<SvxJavaClassPathDlg>::Create( this );
javaFrameworkError eErr = jfw_getUserClassPath( &m_pClassPath );
- if ( JFW_E_NONE == eErr && m_pClassPath )
+ if ( JFW_E_NONE == eErr )
{
sClassPath = m_pClassPath;
m_pPathDlg->SetClassPath( sClassPath );
@@ -538,7 +537,7 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder )
#if HAVE_FEATURE_JAVA
bool bStartAgain = true;
std::unique_ptr<JavaInfo> pInfo;
- javaFrameworkError eErr = jfw_getJavaInfoByPath( _rFolder.pData, &pInfo );
+ javaFrameworkError eErr = jfw_getJavaInfoByPath( _rFolder, &pInfo );
if ( JFW_E_NONE == eErr && pInfo )
{
sal_Int32 nPos = 0;
@@ -568,7 +567,7 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder )
if ( !bFound )
{
- jfw_addJRELocation( pInfo->sLocation.pData );
+ jfw_addJRELocation( pInfo->sLocation );
AddJRE( pInfo.get() );
m_aAddedInfos.push_back( std::move(pInfo) );
nPos = m_pJavaList->GetEntryCount() - 1;
@@ -650,7 +649,7 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
OUString sPath( m_pPathDlg->GetClassPath() );
if ( m_pPathDlg->GetOldPath() != sPath )
{
- eErr = jfw_setUserClassPath( sPath.pData );
+ eErr = jfw_setUserClassPath( sPath );
SAL_WARN_IF(JFW_E_NONE != eErr, "cui.options", "SvxJavaOptionsPage::FillItemSet(): error in jfw_setUserClassPath");
bModified = true;
}
diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx
index 6b301d2e229c..47fb0a85e32c 100644
--- a/cui/source/options/optjava.hxx
+++ b/cui/source/options/optjava.hxx
@@ -67,7 +67,7 @@ private:
#if HAVE_FEATURE_JAVA
std::vector<std::unique_ptr<JavaInfo>> m_parJavaInfo;
rtl_uString** m_parParameters;
- rtl_uString* m_pClassPath;
+ OUString m_pClassPath;
sal_Int32 m_nParamSize;
#endif
OUString m_sInstallText;
diff --git a/desktop/source/migration/services/jvmfwk.cxx b/desktop/source/migration/services/jvmfwk.cxx
index 9fb42e96c9e8..fc858ec3a039 100644
--- a/desktop/source/migration/services/jvmfwk.cxx
+++ b/desktop/source/migration/services/jvmfwk.cxx
@@ -239,7 +239,7 @@ void JavaMigration::migrateJavarc()
{
//get the directory
std::unique_ptr<JavaInfo> aInfo;
- javaFrameworkError err = jfw_getJavaInfoByPath(sValue.pData, &aInfo);
+ javaFrameworkError err = jfw_getJavaInfoByPath(sValue, &aInfo);
if (err == JFW_E_NONE)
{
@@ -339,7 +339,7 @@ void SAL_CALL JavaMigration::setPropertyValue(
"[Service implementation " IMPL_NAME
"] XLayerHandler::setPropertyValue received wrong type for UserClassPath property", nullptr, Any());
- if (jfw_setUserClassPath(cp.pData) != JFW_E_NONE)
+ if (jfw_setUserClassPath(cp) != JFW_E_NONE)
throw WrappedTargetException(
"[Service implementation " IMPL_NAME
"] XLayerHandler::setPropertyValue: jfw_setUserClassPath failed.", nullptr, Any());
diff --git a/include/jvmfwk/framework.hxx b/include/jvmfwk/framework.hxx
index fe806af5bc83..c0aff6841682 100644
--- a/include/jvmfwk/framework.hxx
+++ b/include/jvmfwk/framework.hxx
@@ -419,7 +419,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_findAllJREs(
requirements as determined by the javavendors.xml
*/
JVMFWK_DLLPUBLIC javaFrameworkError jfw_getJavaInfoByPath(
- rtl_uString *pPath, std::unique_ptr<JavaInfo> *ppInfo);
+ OUString const & pPath, std::unique_ptr<JavaInfo> *ppInfo);
/** starts a Java Virtual Machine (JVM).
@@ -643,16 +643,14 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_getVMParameters(
were not met.<br/>
JFW_E_DIRECT_MODE the function cannot be used in this mode.
*/
-JVMFWK_DLLPUBLIC javaFrameworkError jfw_setUserClassPath(rtl_uString * pCP);
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_setUserClassPath(OUString const & pCP);
/** provides the value of the current user class path.
<p>The function returns an empty string if no user class path is set.
</p>
@param ppCP
- [out] contains the user class path on return. If <code>*ppCP</code> was
- not NULL then the value is overwritten. No attempt at freeing that string
- is made.
+ [out] contains the user class path on return.
@return
JFW_E_NONE function ran successfully.<br/>
@@ -661,7 +659,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_setUserClassPath(rtl_uString * pCP);
were not met.<br/>
JFW_E_DIRECT_MODE the function cannot be used in this mode.
*/
-JVMFWK_DLLPUBLIC javaFrameworkError jfw_getUserClassPath(rtl_uString ** ppCP);
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_getUserClassPath(OUString * ppCP);
/** saves the location of a JRE.
@@ -688,7 +686,8 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_getUserClassPath(rtl_uString ** ppCP);
were not met.<br/>
JFW_E_DIRECT_MODE the function cannot be used in this mode.
*/
-JVMFWK_DLLPUBLIC javaFrameworkError jfw_addJRELocation(rtl_uString * sLocation);
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_addJRELocation(
+ OUString const & sLocation);
/** checks if the installation of the jre still exists.
diff --git a/jvmfwk/inc/elements.hxx b/jvmfwk/inc/elements.hxx
index edf44ccc0f64..a2c17bfcaeb0 100644
--- a/jvmfwk/inc/elements.hxx
+++ b/jvmfwk/inc/elements.hxx
@@ -210,7 +210,7 @@ public:
/** adds a location to the already existing locations.
Note: call load() before, then add the location and then call write().
*/
- void addJRELocation(rtl_uString * sLocation);
+ void addJRELocation(OUString const & sLocation);
/** writes the data to user settings.
*/
diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index 64258699713e..70c38e852eaf 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -645,18 +645,16 @@ void NodeJava::setVmParameters(rtl_uString * * arOptions, sal_Int32 size)
}
}
-void NodeJava::addJRELocation(rtl_uString * sLocation)
+void NodeJava::addJRELocation(OUString const & sLocation)
{
- assert( sLocation);
if (!m_JRELocations)
m_JRELocations = boost::optional<std::vector<OUString> >(
std::vector<OUString> ());
//only add the path if not already present
std::vector<OUString>::const_iterator it =
- std::find(m_JRELocations->begin(), m_JRELocations->end(),
- OUString(sLocation));
+ std::find(m_JRELocations->begin(), m_JRELocations->end(), sLocation);
if (it == m_JRELocations->end())
- m_JRELocations->push_back(OUString(sLocation));
+ m_JRELocations->push_back(sLocation);
}
jfw::FileStatus NodeJava::checkSettingsFileStatus(OUString const & sURL)
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index 9c3a35c56aca..5ae4c8773f71 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -641,9 +641,8 @@ javaFrameworkError jfw_getSelectedJRE(std::unique_ptr<JavaInfo> *ppInfo)
if (jfw::getMode() == jfw::JFW_MODE_DIRECT)
{
- OUString sJRE = jfw::BootParams::getJREHome();
-
- if ((errcode = jfw_getJavaInfoByPath(sJRE.pData, ppInfo))
+ if ((errcode = jfw_getJavaInfoByPath(
+ jfw::BootParams::getJREHome(), ppInfo))
!= JFW_E_NONE)
throw jfw::FrameworkException(
JFW_E_CONFIGURATION,
@@ -688,17 +687,14 @@ bool jfw_isVMRunning()
return g_pJavaVM != nullptr;
}
-javaFrameworkError jfw_getJavaInfoByPath(rtl_uString *pPath, std::unique_ptr<JavaInfo> *ppInfo)
+javaFrameworkError jfw_getJavaInfoByPath(OUString const & pPath, std::unique_ptr<JavaInfo> *ppInfo)
{
- assert(pPath != nullptr);
assert(ppInfo != nullptr);
javaFrameworkError errcode = JFW_E_NONE;
try
{
osl::MutexGuard guard(jfw::FwkMutex::get());
- OUString ouPath(pPath);
-
jfw::VendorSettings aVendorSettings;
std::vector<OUString> vecVendors =
aVendorSettings.getSupportedVendors();
@@ -717,7 +713,7 @@ javaFrameworkError jfw_getJavaInfoByPath(rtl_uString *pPath, std::unique_ptr<Jav
//Only if it does return a JavaInfo
JavaInfo* pInfo = nullptr;
javaPluginError plerr = jfw_plugin_getJavaInfoByPath(
- ouPath,
+ pPath,
vendor,
versionInfo.sMinVersion,
versionInfo.sMaxVersion,
@@ -888,9 +884,8 @@ javaFrameworkError jfw_getVMParameters(
return errcode;
}
-javaFrameworkError jfw_setUserClassPath(rtl_uString * pCp)
+javaFrameworkError jfw_setUserClassPath(OUString const & pCp)
{
- assert(pCp != nullptr);
javaFrameworkError errcode = JFW_E_NONE;
try
{
@@ -910,7 +905,7 @@ javaFrameworkError jfw_setUserClassPath(rtl_uString * pCp)
return errcode;
}
-javaFrameworkError jfw_getUserClassPath(rtl_uString ** ppCP)
+javaFrameworkError jfw_getUserClassPath(OUString * ppCP)
{
assert(ppCP != nullptr);
javaFrameworkError errcode = JFW_E_NONE;
@@ -920,8 +915,7 @@ javaFrameworkError jfw_getUserClassPath(rtl_uString ** ppCP)
if (jfw::getMode() == jfw::JFW_MODE_DIRECT)
return JFW_E_DIRECT_MODE;
const jfw::MergedSettings settings;
- *ppCP = settings.getUserClassPath().pData;
- rtl_uString_acquire(*ppCP);
+ *ppCP = settings.getUserClassPath();
}
catch (const jfw::FrameworkException& e)
{
@@ -932,7 +926,7 @@ javaFrameworkError jfw_getUserClassPath(rtl_uString ** ppCP)
return errcode;
}
-javaFrameworkError jfw_addJRELocation(rtl_uString * sLocation)
+javaFrameworkError jfw_addJRELocation(OUString const & sLocation)
{
javaFrameworkError errcode = JFW_E_NONE;
try
More information about the Libreoffice-commits
mailing list