[Libreoffice-commits] core.git: jvmfwk/inc jvmfwk/plugins jvmfwk/source

Michael Weghorn m.weghorn at posteo.de
Wed Nov 19 00:10:50 PST 2014


 jvmfwk/inc/vendorplugin.hxx                         |   22 ++----
 jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx |   73 +++++++-------------
 jvmfwk/source/framework.cxx                         |   38 +++++-----
 3 files changed, 58 insertions(+), 75 deletions(-)

New commits:
commit 772a36932e4803beaffdad87200e0162e1020e94
Author: Michael Weghorn <m.weghorn at posteo.de>
Date:   Tue Nov 18 17:40:13 2014 +0000

    changed type of parameters from rtl_uString to OUString
    
    changed type of several parameters of the functions
    jfw_plugin_getAllJavaInfos and jfw_plugin_getJavaInfoByPath
    from rtl_uString to OUString
    
    Change-Id: I80feb311542e6ccded9f9924f800c75a7e14a1e7
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/jvmfwk/inc/vendorplugin.hxx b/jvmfwk/inc/vendorplugin.hxx
index 02ea040..3fd4d35 100644
--- a/jvmfwk/inc/vendorplugin.hxx
+++ b/jvmfwk/inc/vendorplugin.hxx
@@ -36,7 +36,7 @@
    what version a JRE must have then it relies on certain features and bug
    fixes of that version. Because a version 1.4.2_1 from vendor X may contain
    different fixes as the same version from vendor Y it is important to see
-   version an vendor as one entity. One without the other does not guarantee
+   version and vendor as one entity. One without the other does not guarantee
    the existence of a particular set of features or bug fixes. An implementation
    of this API may support multiple vendors. </p>
    <p>
@@ -83,11 +83,9 @@ typedef enum
         [in] only JREs from this vendor are examined. This parameter always contains
         a vendor string. That is, the string it is not empty.
     @param sMinVersion
-        [in] represents the minimum version of a JRE. The string can be empty but
-        a null pointer is not allowed.
+        [in] represents the minimum version of a JRE. The string can be empty.
     @param sMaxVersion
-        [in] represents the maximum version of a JRE. The string can be empty but
-        a null pointer is not allowed.
+        [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.
@@ -111,9 +109,9 @@ typedef enum
     version strings.
  */
 javaPluginError jfw_plugin_getAllJavaInfos(
-    rtl_uString *sVendor,
-    rtl_uString *sMinVersion,
-    rtl_uString *sMaxVersion,
+    OUString const& sVendor,
+    OUString const& sMinVersion,
+    OUString const& sMaxVersion,
     rtl_uString * * arExcludeList,
     sal_Int32  nSizeExcludeList,
     JavaInfo*** parJavaInfo,
@@ -162,10 +160,10 @@ javaPluginError jfw_plugin_getAllJavaInfos(
    a vendor which is not supported by this API implementation.
  */
 javaPluginError jfw_plugin_getJavaInfoByPath(
-    rtl_uString *sLocation,
-    rtl_uString *sVendor,
-    rtl_uString *sMinVersion,
-    rtl_uString *sMaxVersion,
+    OUString const& sLocation,
+    OUString const& sVendor,
+    OUString const& sMinVersion,
+    OUString const& sMaxVersion,
     rtl_uString * *arExcludeList,
     sal_Int32  nSizeExcludeList,
     JavaInfo ** ppInfo);
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index dd6335e..d0dac26 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -210,11 +210,9 @@ extern "C" void JNICALL abort_handler()
     @param aVendorInfo
         [in]  the object to be inspected whether it meets the version requirements
     @param sMinVersion
-        [in] represents the minimum version of a JRE. The string can be empty but
-        a null pointer is not allowed.
+        [in] represents the minimum version of a JRE. The string can be empty.
     @param sMaxVersion
-        [in] represents the maximum version of a JRE. The string can be empty but
-        a null pointer is not allowed.
+        [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.
@@ -232,19 +230,16 @@ extern "C" void JNICALL abort_handler()
      */
 javaPluginError checkJavaVersionRequirements(
     rtl::Reference<VendorBase> const & aVendorInfo,
-    rtl_uString *sMinVersion,
-    rtl_uString *sMaxVersion,
+    OUString const& sMinVersion,
+    OUString const& sMaxVersion,
     rtl_uString * * arExcludeList,
     sal_Int32  nLenList)
 {
-    OUString ouMinVer(sMinVersion);
-    OUString ouMaxVer(sMaxVersion);
-
-    if (!ouMinVer.isEmpty())
+    if (!sMinVersion.isEmpty())
     {
         try
         {
-            if (aVendorInfo->compareVersions(ouMinVer) < 0)
+            if (aVendorInfo->compareVersions(sMinVersion) < 0)
                 return JFW_PLUGIN_E_FAILED_VERSION;
         }
         catch (MalformedVersionException&)
@@ -253,17 +248,17 @@ javaPluginError checkJavaVersionRequirements(
             JFW_ENSURE(
                 false,
                 "[Java framework]sunjavaplugin does not know version: "
-                + ouMinVer + " for vendor: " + aVendorInfo->getVendor()
+                + sMinVersion + " for vendor: " + aVendorInfo->getVendor()
                 + " .Check minimum Version." );
             return JFW_PLUGIN_E_WRONG_VERSION_FORMAT;
         }
     }
 
-    if (!ouMaxVer.isEmpty())
+    if (!sMaxVersion.isEmpty())
     {
         try
         {
-            if (aVendorInfo->compareVersions(ouMaxVer) > 0)
+            if (aVendorInfo->compareVersions(sMaxVersion) > 0)
                 return JFW_PLUGIN_E_FAILED_VERSION;
         }
         catch (MalformedVersionException&)
@@ -272,7 +267,7 @@ javaPluginError checkJavaVersionRequirements(
             JFW_ENSURE(
                 false,
                 "[Java framework]sunjavaplugin does not know version: "
-                + ouMaxVer + " for vendor: " + aVendorInfo->getVendor()
+                + sMaxVersion + " for vendor: " + aVendorInfo->getVendor()
                 + " .Check maximum Version." );
             return JFW_PLUGIN_E_WRONG_VERSION_FORMAT;
         }
@@ -304,20 +299,17 @@ javaPluginError checkJavaVersionRequirements(
 }
 
 javaPluginError jfw_plugin_getAllJavaInfos(
-    rtl_uString *sVendor,
-    rtl_uString *sMinVersion,
-    rtl_uString *sMaxVersion,
+    OUString const& sVendor,
+    OUString const& sMinVersion,
+    OUString const& sMaxVersion,
     rtl_uString  * *arExcludeList,
     sal_Int32  nLenList,
     JavaInfo*** parJavaInfo,
     sal_Int32 *nLenInfoList)
 {
-    OSL_ASSERT(sVendor);
-    OSL_ASSERT(sMinVersion);
-    OSL_ASSERT(sMaxVersion);
     OSL_ASSERT(parJavaInfo);
     OSL_ASSERT(nLenInfoList);
-    if (!sVendor || !sMinVersion || !sMaxVersion || !parJavaInfo || !nLenInfoList)
+    if (!parJavaInfo || !nLenInfoList)
         return JFW_PLUGIN_E_INVALID_ARG;
 
     //nLenlist contains the number of elements in arExcludeList.
@@ -326,10 +318,8 @@ javaPluginError jfw_plugin_getAllJavaInfos(
     if (arExcludeList == NULL && nLenList > 0)
         return JFW_PLUGIN_E_INVALID_ARG;
 
-    OUString ouVendor(sVendor);
-
-    OSL_ASSERT(!ouVendor.isEmpty());
-    if (ouVendor.isEmpty())
+    OSL_ASSERT(!sVendor.isEmpty());
+    if (sVendor.isEmpty())
         return JFW_PLUGIN_E_INVALID_ARG;
 
     JavaInfo** arInfo = NULL;
@@ -344,7 +334,7 @@ javaPluginError jfw_plugin_getAllJavaInfos(
     {
         const rtl::Reference<VendorBase>& cur = *i;
 
-        if (!ouVendor.equals(cur->getVendor()))
+        if (!sVendor.equals(cur->getVendor()))
             continue;
 
         javaPluginError err = checkJavaVersionRequirements(
@@ -374,23 +364,18 @@ javaPluginError jfw_plugin_getAllJavaInfos(
 }
 
 javaPluginError jfw_plugin_getJavaInfoByPath(
-    rtl_uString *path,
-    rtl_uString *sVendor,
-    rtl_uString *sMinVersion,
-    rtl_uString *sMaxVersion,
+    OUString const& sPath,
+    OUString const& sVendor,
+    OUString const& sMinVersion,
+    OUString const& sMaxVersion,
     rtl_uString  *  *arExcludeList,
     sal_Int32  nLenList,
     JavaInfo ** ppInfo)
 {
-    OSL_ASSERT(path);
-    OSL_ASSERT(sVendor);
-    OSL_ASSERT(sMinVersion);
-    OSL_ASSERT(sMaxVersion);
-    if (!path || !sVendor || !sMinVersion || !sMaxVersion || !ppInfo)
+    if (!ppInfo)
         return JFW_PLUGIN_E_INVALID_ARG;
-    OUString ouPath(path);
-    OSL_ASSERT(!ouPath.isEmpty());
-    if (ouPath.isEmpty())
+    OSL_ASSERT(!sPath.isEmpty());
+    if (sPath.isEmpty())
         return JFW_PLUGIN_E_INVALID_ARG;
 
     //nLenlist contains the number of elements in arExcludeList.
@@ -399,18 +384,16 @@ javaPluginError jfw_plugin_getJavaInfoByPath(
     if (arExcludeList == NULL && nLenList > 0)
         return JFW_PLUGIN_E_INVALID_ARG;
 
-    OUString ouVendor(sVendor);
-
-    OSL_ASSERT(!ouVendor.isEmpty());
-    if (ouVendor.isEmpty())
+    OSL_ASSERT(!sVendor.isEmpty());
+    if (sVendor.isEmpty())
         return JFW_PLUGIN_E_INVALID_ARG;
 
-    rtl::Reference<VendorBase> aVendorInfo = getJREInfoByPath(ouPath);
+    rtl::Reference<VendorBase> aVendorInfo = getJREInfoByPath(sPath);
     if (!aVendorInfo.is())
         return JFW_PLUGIN_E_NO_JRE;
 
     //Check if the detected JRE matches the version requirements
-    if (!ouVendor.equals(aVendorInfo->getVendor()))
+    if (!sVendor.equals(aVendorInfo->getVendor()))
         return JFW_PLUGIN_E_NO_JRE;
     javaPluginError errorcode = checkJavaVersionRequirements(
             aVendorInfo, sMinVersion, sMaxVersion, arExcludeList, nLenList);
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index 00b6f99..d2092dcc 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -88,9 +88,9 @@ javaFrameworkError SAL_CALL jfw_findAllJREs(JavaInfo ***pparInfo, sal_Int32 *pSi
             sal_Int32 cInfos = 0;
             JavaInfo** arInfos = NULL;
             javaPluginError plerr = jfw_plugin_getAllJavaInfos(
-                vendor.pData,
-                versionInfo.sMinVersion.pData,
-                versionInfo.sMaxVersion.pData,
+                vendor,
+                versionInfo.sMinVersion,
+                versionInfo.sMaxVersion,
                 versionInfo.getExcludeVersions(),
                 versionInfo.getExcludeVersionSize(),
                 & arInfos,
@@ -114,10 +114,10 @@ javaFrameworkError SAL_CALL jfw_findAllJREs(JavaInfo ***pparInfo, sal_Int32 *pSi
             {
                 jfw::CJavaInfo aInfo;
                 plerr = jfw_plugin_getJavaInfoByPath(
-                    ii->pData,
-                    vendor.pData,
-                    versionInfo.sMinVersion.pData,
-                    versionInfo.sMaxVersion.pData,
+                    *ii,
+                    vendor,
+                    versionInfo.sMinVersion,
+                    versionInfo.sMaxVersion,
                     versionInfo.getExcludeVersions(),
                     versionInfo.getExcludeVersionSize(),
                     & aInfo.pInfo);
@@ -405,9 +405,9 @@ javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo)
             sal_Int32 cInfos = 0;
             JavaInfo** arInfos = NULL;
             javaPluginError plerr = jfw_plugin_getAllJavaInfos(
-                vendor.pData,
-                versionInfo.sMinVersion.pData,
-                versionInfo.sMaxVersion.pData,
+                vendor,
+                versionInfo.sMinVersion,
+                versionInfo.sMaxVersion,
                 versionInfo.getExcludeVersions(),
                 versionInfo.getExcludeVersionSize(),
                 & arInfos,
@@ -475,10 +475,10 @@ javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo)
                 {
                     jfw::CJavaInfo aInfo;
                     javaPluginError err = jfw_plugin_getJavaInfoByPath(
-                        it->pData,
-                        vendor.pData,
-                        versionInfo.sMinVersion.pData,
-                        versionInfo.sMaxVersion.pData,
+                        *it,
+                        vendor,
+                        versionInfo.sMinVersion,
+                        versionInfo.sMaxVersion,
                         versionInfo.getExcludeVersions(),
                         versionInfo.getExcludeVersionSize(),
                         & aInfo.pInfo);
@@ -651,6 +651,8 @@ javaFrameworkError SAL_CALL jfw_getJavaInfoByPath(
         if (pPath == NULL || ppInfo == NULL)
             return JFW_E_INVALID_ARG;
 
+        OUString ouPath(pPath);
+
         jfw::VendorSettings aVendorSettings;
         std::vector<OUString> vecVendors =
             aVendorSettings.getSupportedVendors();
@@ -671,10 +673,10 @@ javaFrameworkError SAL_CALL jfw_getJavaInfoByPath(
             //Only if it does return a JavaInfo
             JavaInfo* pInfo = NULL;
             javaPluginError plerr = jfw_plugin_getJavaInfoByPath(
-                pPath,
-                vendor.pData,
-                versionInfo.sMinVersion.pData,
-                versionInfo.sMaxVersion.pData,
+                ouPath,
+                vendor,
+                versionInfo.sMinVersion,
+                versionInfo.sMaxVersion,
                 versionInfo.getExcludeVersions(),
                 versionInfo.getExcludeVersionSize(),
                 & pInfo);


More information about the Libreoffice-commits mailing list