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

Noel Grandin noel at peralex.com
Sun May 22 17:53:05 UTC 2016


 jvmfwk/inc/vendorplugin.hxx                         |   64 ++++++-------
 jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx |   92 ++++++++++----------
 jvmfwk/source/framework.cxx                         |   38 ++++----
 sal/qa/osl/file/osl_File.cxx                        |   26 ++---
 4 files changed, 110 insertions(+), 110 deletions(-)

New commits:
commit 57ef4457becdb5c66a3c0db9e499e1ac491860f2
Author: Noel Grandin <noel at peralex.com>
Date:   Fri May 20 15:45:02 2016 +0200

    Convert javaPluginError to scoped enum
    
    Change-Id: Ib3a32227d50fa9e0f9cc4106ce40a4c3e840f8c7
    Reviewed-on: https://gerrit.libreoffice.org/25206
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/jvmfwk/inc/vendorplugin.hxx b/jvmfwk/inc/vendorplugin.hxx
index c354087..8df13b1 100644
--- a/jvmfwk/inc/vendorplugin.hxx
+++ b/jvmfwk/inc/vendorplugin.hxx
@@ -46,17 +46,17 @@
    of this API may support multiple vendors. </p>
  */
 
-typedef enum
+enum class javaPluginError
 {
-    JFW_PLUGIN_E_NONE,
-    JFW_PLUGIN_E_ERROR,
-    JFW_PLUGIN_E_INVALID_ARG,
-    JFW_PLUGIN_E_WRONG_VERSION_FORMAT,
-    JFW_PLUGIN_E_FAILED_VERSION,
-    JFW_PLUGIN_E_NO_JRE,
-    JFW_PLUGIN_E_WRONG_VENDOR,
-    JFW_PLUGIN_E_VM_CREATION_FAILED
-} javaPluginError;
+    NONE,
+    Error,
+    InvalidArg,
+    WrongVersionFormat,
+    FailedVersion,
+    NoJre,
+    WrongVendor,
+    VmCreationFailed
+};
 
 
 /** obtains information about installations of Java Runtime Environments (JREs).
@@ -98,12 +98,12 @@ typedef enum
        <code>parJavaInfo</code>.
 
     @return
-    JFW_PLUGIN_E_NONE the function ran successfully.</br>
-    JFW_PLUGIN_E_ERROR an error occurred during execution.</br>
-    JFW_PLUGIN_E_INVALID_ARG an argument was not valid. For example
+    javaPluginError::NONE the function ran successfully.</br>
+    javaPluginError::Error an error occurred during execution.</br>
+    javaPluginError::InvalidArg an argument was not valid. For example
     <code>nSizeExcludeList</code> is greater null but <code>arExcludeList</code>
     is NULL or NULL pointer were passed for at least on of the strings.</br>
-    JFW_PLUGIN_E_WRONG_VERSION_FORMAT the version strings in
+    javaPluginError::WrongVersionFormat the version strings in
     <code>sMinVersion,sMaxVersion,arExcludeList</code> are not recognized as valid
     version strings.
  */
@@ -145,18 +145,18 @@ javaPluginError jfw_plugin_getAllJavaInfos(
         on return a pointer to a <code>JavaInfo</code> object.
 
    @return
-   JFW_PLUGIN_E_NONE the function ran successfully.</br>
-   JFW_PLUGIN_E_ERROR an error occurred during execution.</br>
-   JFW_PLUGIN_E_INVALID_ARG an argument was not valid. For example
+   javaPluginError::NONE the function ran successfully.</br>
+   javaPluginError::Error an error occurred during execution.</br>
+   javaPluginError::InvalidArg an argument was not valid. For example
     <code>nSizeExcludeList</code> is greater null but <code>arExcludeList</code>
     is NULL, NULL pointer were passed for at least on of the strings, sLocation
     is an empty string.</br>
-   JFW_PLUGIN_E_WRONG_VERSION_FORMAT the version strings in
+   javaPluginError::WrongVersionFormat the version strings in
     <code>sMinVersion,sMaxVersion,arExcludeList</code> are not recognized as valid
     version strings.
-   JFW_PLUGIN_E_FAILED_VERSION there is a JRE at the given location but it does not
+   javaPluginError::FailedVersion there is a JRE at the given location but it does not
    meet the version requirements.
-   JFW_PLUGIN_E_NO_JRE no JRE could be detected at the given location. However, that
+   javaPluginError::NoJre no JRE could be detected at the given location. However, that
    does not mean necessarily that there is no JRE. There could be a JRE but it has
    a vendor which is not supported by this API implementation.
  */
@@ -189,10 +189,10 @@ javaPluginError jfw_plugin_getJavaInfoByPath(
         on return a pointer to its <code>JavaInfo</code> object.
 
    @return
-   JFW_PLUGIN_E_NONE the function ran successfully.</br>
-   JFW_PLUGIN_E_INVALID_ARG an argument was not valid, for example
+   javaPluginError::NONE the function ran successfully.</br>
+   javaPluginError::InvalidArg an argument was not valid, for example
     <code>ppInfo</code> is an invalid pointer.
-   JFW_PLUGIN_E_NO_JRE no suitable JRE could be detected at the given location. However, that
+   javaPluginError::NoJre no suitable JRE could be detected at the given location. However, that
    does not mean necessarily that there is no JRE. There could be a JRE but it has
    a vendor which is not supported by this API implementation or it does not
    meet the version requirements.
@@ -233,9 +233,9 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
         the <code>JavaInfo</code> objects inserted into the existing vector.
 
     @return
-    JFW_PLUGIN_E_NONE the function ran successfully and at least one JRE
+    javaPluginError::NONE the function ran successfully and at least one JRE
     that meets the requirements was found.</br>
-    JFW_PLUGIN_E_NO_JRE no JavaInfo that meets the version criteria was found
+    javaPluginError::NoJre no JavaInfo that meets the version criteria was found
     when inspecting the PATH
  */
 
@@ -278,11 +278,11 @@ javaPluginError jfw_plugin_getJavaInfosFromPath(
         [out] the JNIEnv pointer of the created VM.
 
     @return
-    JFW_PLUGIN_E_NONE the function ran successfully.</br>
-    JFW_PLUGIN_E_ERROR an error occurred during execution.</br>
-    JFW_PLUGIN_E_WRONG_VENDOR the <code>JavaInfo</code> object was not created
+    javaPluginError::NONE the function ran successfully.</br>
+    javaPluginError::Error an error occurred during execution.</br>
+    javaPluginError::WrongVendor the <code>JavaInfo</code> object was not created
     in by this library and the VM cannot be started.</br>
-    JFW_PLUGIN_E_INVALID_ARG an argument was not valid. For example
+    javaPluginError::InvalidArg an argument was not valid. For example
     <code>pInfo</code> or , <code>ppVM</code> or <code>ppEnv</code> are NULL.
     </br>
     JFW_PLUGIN_E_VM_CREATION_FAILED a VM could not be created. The error was caused
@@ -309,9 +309,9 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
         only valid if the function returns JFW_E_NONE.
 
    @return
-    JFW_PLUGIN_E_NONE the function ran successfully.</br>
-    JFW_PLUGIN_E_ERROR an error occurred during execution.</br>
-    JFW_PLUGIN_E_INVALID_ARG pInfo contains invalid data</br>
+    javaPluginError::NONE the function ran successfully.</br>
+    javaPluginError::Error an error occurred during execution.</br>
+    javaPluginError::InvalidArg pInfo contains invalid data</br>
  */
 javaPluginError jfw_plugin_existJRE(const JavaInfo *pInfo, sal_Bool *exist);
 
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 16e8ff1..fad3c0a9 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -212,10 +212,10 @@ extern "C" void JNICALL abort_handler()
         [in] the number of version strings contained in <code>arExcludeList</code>.
 
    @return
-    JFW_PLUGIN_E_NONE the function ran successfully and the version requirements are met
-    JFW_PLUGIN_E_FAILED_VERSION at least one of the version requirements (minVersion,
+    javaPluginError::NONE the function ran successfully and the version requirements are met
+    javaPluginError::FailedVersion at least one of the version requirements (minVersion,
     maxVersion, excludeVersions) was violated
-    JFW_PLUGIN_E_WRONG_VERSION_FORMAT the version strings in
+    javaPluginError::WrongVersionFormat the version strings in
     <code>sMinVersion,sMaxVersion,arExcludeList</code> are not recognized as valid
     version strings.
 
@@ -232,7 +232,7 @@ javaPluginError checkJavaVersionRequirements(
         try
         {
             if (aVendorInfo->compareVersions(sMinVersion) < 0)
-                return JFW_PLUGIN_E_FAILED_VERSION;
+                return javaPluginError::FailedVersion;
         }
         catch (MalformedVersionException&)
         {
@@ -242,7 +242,7 @@ javaPluginError checkJavaVersionRequirements(
                 "[Java framework]sunjavaplugin does not know version: "
                 + sMinVersion + " for vendor: " + aVendorInfo->getVendor()
                 + " .Check minimum Version." );
-            return JFW_PLUGIN_E_WRONG_VERSION_FORMAT;
+            return javaPluginError::WrongVersionFormat;
         }
     }
 
@@ -251,7 +251,7 @@ javaPluginError checkJavaVersionRequirements(
         try
         {
             if (aVendorInfo->compareVersions(sMaxVersion) > 0)
-                return JFW_PLUGIN_E_FAILED_VERSION;
+                return javaPluginError::FailedVersion;
         }
         catch (MalformedVersionException&)
         {
@@ -261,7 +261,7 @@ javaPluginError checkJavaVersionRequirements(
                 "[Java framework]sunjavaplugin does not know version: "
                 + sMaxVersion + " for vendor: " + aVendorInfo->getVendor()
                 + " .Check maximum Version." );
-            return JFW_PLUGIN_E_WRONG_VERSION_FORMAT;
+            return javaPluginError::WrongVersionFormat;
         }
     }
 
@@ -271,7 +271,7 @@ javaPluginError checkJavaVersionRequirements(
         try
         {
             if (aVendorInfo->compareVersions(sExVer) == 0)
-                return JFW_PLUGIN_E_FAILED_VERSION;
+                return javaPluginError::FailedVersion;
         }
         catch (MalformedVersionException&)
         {
@@ -281,11 +281,11 @@ javaPluginError checkJavaVersionRequirements(
                 "[Java framework]sunjavaplugin does not know version: "
                 + sExVer + " for vendor: " + aVendorInfo->getVendor()
                 + " .Check excluded versions." );
-            return JFW_PLUGIN_E_WRONG_VERSION_FORMAT;
+            return javaPluginError::WrongVersionFormat;
         }
     }
 
-    return JFW_PLUGIN_E_NONE;
+    return javaPluginError::NONE;
 }
 
 }
@@ -304,17 +304,17 @@ javaPluginError jfw_plugin_getAllJavaInfos(
     OSL_ASSERT(parJavaInfo);
     OSL_ASSERT(nLenInfoList);
     if (!parJavaInfo || !nLenInfoList)
-        return JFW_PLUGIN_E_INVALID_ARG;
+        return javaPluginError::InvalidArg;
 
     //nLenlist contains the number of elements in arExcludeList.
     //If no exclude list is provided then nLenList must be 0
     OSL_ASSERT( ! (arExcludeList == nullptr && nLenList > 0));
     if (arExcludeList == nullptr && nLenList > 0)
-        return JFW_PLUGIN_E_INVALID_ARG;
+        return javaPluginError::InvalidArg;
 
     OSL_ASSERT(!sVendor.isEmpty());
     if (sVendor.isEmpty())
-        return JFW_PLUGIN_E_INVALID_ARG;
+        return javaPluginError::InvalidArg;
 
     JavaInfo** arInfo = nullptr;
 
@@ -334,9 +334,9 @@ javaPluginError jfw_plugin_getAllJavaInfos(
         javaPluginError err = checkJavaVersionRequirements(
             cur, sMinVersion, sMaxVersion, arExcludeList, nLenList);
 
-        if (err == JFW_PLUGIN_E_FAILED_VERSION)
+        if (err == javaPluginError::FailedVersion)
             continue;
-        else if (err == JFW_PLUGIN_E_WRONG_VERSION_FORMAT)
+        else if (err == javaPluginError::WrongVersionFormat)
             return err;
 
         vecVerifiedInfos.push_back(*i);
@@ -354,7 +354,7 @@ javaPluginError jfw_plugin_getAllJavaInfos(
 
 
     *parJavaInfo = arInfo;
-    return JFW_PLUGIN_E_NONE;
+    return javaPluginError::NONE;
 }
 
 javaPluginError jfw_plugin_getJavaInfoByPath(
@@ -367,32 +367,32 @@ javaPluginError jfw_plugin_getJavaInfoByPath(
     JavaInfo ** ppInfo)
 {
     if (!ppInfo)
-        return JFW_PLUGIN_E_INVALID_ARG;
+        return javaPluginError::InvalidArg;
     OSL_ASSERT(!sPath.isEmpty());
     if (sPath.isEmpty())
-        return JFW_PLUGIN_E_INVALID_ARG;
+        return javaPluginError::InvalidArg;
 
     //nLenlist contains the number of elements in arExcludeList.
     //If no exclude list is provided then nLenList must be 0
     OSL_ASSERT( ! (arExcludeList == nullptr && nLenList > 0));
     if (arExcludeList == nullptr && nLenList > 0)
-        return JFW_PLUGIN_E_INVALID_ARG;
+        return javaPluginError::InvalidArg;
 
     OSL_ASSERT(!sVendor.isEmpty());
     if (sVendor.isEmpty())
-        return JFW_PLUGIN_E_INVALID_ARG;
+        return javaPluginError::InvalidArg;
 
     rtl::Reference<VendorBase> aVendorInfo = getJREInfoByPath(sPath);
     if (!aVendorInfo.is())
-        return JFW_PLUGIN_E_NO_JRE;
+        return javaPluginError::NoJre;
 
     //Check if the detected JRE matches the version requirements
     if (!sVendor.equals(aVendorInfo->getVendor()))
-        return JFW_PLUGIN_E_NO_JRE;
+        return javaPluginError::NoJre;
     javaPluginError errorcode = checkJavaVersionRequirements(
             aVendorInfo, sMinVersion, sMaxVersion, arExcludeList, nLenList);
 
-    if (errorcode == JFW_PLUGIN_E_NONE)
+    if (errorcode == javaPluginError::NONE)
         *ppInfo = createJavaInfo(aVendorInfo);
 
     return errorcode;
@@ -403,13 +403,13 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
     JavaInfo ** ppInfo, std::vector<rtl::Reference<VendorBase>> & infos)
 {
     if (!ppInfo)
-        return JFW_PLUGIN_E_INVALID_ARG;
+        return javaPluginError::InvalidArg;
 
     std::vector<rtl::Reference<VendorBase>> infoJavaHome;
     addJavaInfoFromJavaHome(infos, infoJavaHome);
 
     if (infoJavaHome.empty())
-        return JFW_PLUGIN_E_NO_JRE;
+        return javaPluginError::NoJre;
     assert(infoJavaHome.size() == 1);
 
     //Check if the detected JRE matches the version requirements
@@ -428,15 +428,15 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
                 versionInfo.getExcludeVersions(),
                 versionInfo.getExcludeVersionSize());
 
-            if (errorcode == JFW_PLUGIN_E_NONE)
+            if (errorcode == javaPluginError::NONE)
             {
                 *ppInfo = createJavaInfo(infoJavaHome[0]);
-                return JFW_PLUGIN_E_NONE;
+                return javaPluginError::NONE;
             }
         }
     }
 
-    return JFW_PLUGIN_E_NO_JRE;
+    return javaPluginError::NoJre;
 }
 
 javaPluginError jfw_plugin_getJavaInfosFromPath(
@@ -471,7 +471,7 @@ javaPluginError jfw_plugin_getJavaInfosFromPath(
                     versionInfo.getExcludeVersions(),
                     versionInfo.getExcludeVersionSize());
 
-                if (errorcode == JFW_PLUGIN_E_NONE)
+                if (errorcode == javaPluginError::NONE)
                 {
                     vecVerifiedInfos.push_back(createJavaInfo(currentInfo));
                 }
@@ -480,11 +480,11 @@ javaPluginError jfw_plugin_getJavaInfosFromPath(
     }
 
     if (vecVerifiedInfos.empty())
-        return JFW_PLUGIN_E_NO_JRE;
+        return javaPluginError::NoJre;
 
     javaInfosFromPath = vecVerifiedInfos;
 
-    return JFW_PLUGIN_E_NONE;
+    return javaPluginError::NONE;
 }
 
 
@@ -642,21 +642,21 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
     volatile osl::MutexGuard guard(PluginMutex::get());
     // unless errorcode is volatile the following warning occurs on gcc:
     // warning: variable 'errorcode' might be clobbered by `longjmp' or `vfork'
-    volatile javaPluginError errorcode = JFW_PLUGIN_E_NONE;
+    volatile javaPluginError errorcode = javaPluginError::NONE;
     if ( pInfo == nullptr || ppVm == nullptr || ppEnv == nullptr)
-        return JFW_PLUGIN_E_INVALID_ARG;
+        return javaPluginError::InvalidArg;
     //Check if the Vendor (pInfo->sVendor) is supported by this plugin
     if ( ! isVendorSupported(pInfo->sVendor))
-        return JFW_PLUGIN_E_WRONG_VENDOR;
+        return javaPluginError::WrongVendor;
 #ifdef MACOSX
     rtl::Reference<VendorBase> aVendorInfo = getJREInfoByPath( OUString( pInfo->sLocation ) );
     if ( !aVendorInfo.is() || aVendorInfo->compareVersions( OUString( pInfo->sVersion ) ) < 0 )
-        return JFW_PLUGIN_E_VM_CREATION_FAILED;
+        return javaPluginError::VmCreationFailed;
 #endif
     OUString sRuntimeLib = getRuntimeLib(pInfo->arVendorData);
 #ifdef MACOSX
     if ( !JvmfwkUtil_isLoadableJVM( sRuntimeLib ) )
-        return JFW_PLUGIN_E_VM_CREATION_FAILED;
+        return javaPluginError::VmCreationFailed;
 #endif
     JFW_TRACE2("Using Java runtime library: " << sRuntimeLib);
 
@@ -679,7 +679,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
                       " could not load Java runtime library: \n"
                    + sRuntimeLib + "\n");
         JFW_TRACE0("Could not load Java runtime library: " << sRuntimeLib);
-        return JFW_PLUGIN_E_VM_CREATION_FAILED;
+        return javaPluginError::VmCreationFailed;
     }
 
 #if defined UNX && !defined MACOSX
@@ -704,7 +704,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
         fprintf(stderr,"[Java framework]sunjavaplugin" SAL_DLLEXTENSION
                 "Java runtime library: %s does not export symbol %s !\n",
                 sLib.getStr(), sSymbol.getStr());
-        return JFW_PLUGIN_E_VM_CREATION_FAILED;
+        return javaPluginError::VmCreationFailed;
     }
     moduleRt.release();
 
@@ -839,13 +839,13 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
         {
             fprintf(stderr,"[Java framework] sunjavaplugin" SAL_DLLEXTENSION
                     "Can not create Java Virtual Machine\n");
-            errorcode = JFW_PLUGIN_E_VM_CREATION_FAILED;
+            errorcode = javaPluginError::VmCreationFailed;
         }
         else if( err > 0)
         {
             fprintf(stderr,"[Java framework] sunjavaplugin" SAL_DLLEXTENSION
                     "Can not create JavaVirtualMachine, abort handler was called.\n");
-            errorcode = JFW_PLUGIN_E_VM_CREATION_FAILED;
+            errorcode = javaPluginError::VmCreationFailed;
         }
     }
     else
@@ -867,13 +867,13 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
 
 javaPluginError jfw_plugin_existJRE(const JavaInfo *pInfo, sal_Bool *exist)
 {
-    javaPluginError ret = JFW_PLUGIN_E_NONE;
+    javaPluginError ret = javaPluginError::NONE;
     if (!pInfo || !exist)
-        return JFW_PLUGIN_E_INVALID_ARG;
+        return javaPluginError::InvalidArg;
     OUString sLocation(pInfo->sLocation);
 
     if (sLocation.isEmpty())
-        return JFW_PLUGIN_E_INVALID_ARG;
+        return javaPluginError::InvalidArg;
     ::osl::DirectoryItem item;
     ::osl::File::RC rc_item = ::osl::DirectoryItem::get(sLocation, item);
     if (::osl::File::E_None == rc_item)
@@ -886,13 +886,13 @@ javaPluginError jfw_plugin_existJRE(const JavaInfo *pInfo, sal_Bool *exist)
     }
     else
     {
-        ret = JFW_PLUGIN_E_ERROR;
+        ret = javaPluginError::Error;
     }
     //We can have the situation that the JavaVM runtime library is not
     //contained within JAVA_HOME. Then the check for JAVA_HOME would return
     //true although the runtime library may not be loadable.
     //Or the JAVA_HOME directory of a deinstalled JRE left behind.
-    if (ret == JFW_PLUGIN_E_NONE && *exist)
+    if (ret == javaPluginError::NONE && *exist)
     {
         OUString sRuntimeLib = getRuntimeLib(pInfo->arVendorData);
         JFW_TRACE2("Checking existence of Java runtime library");
@@ -912,7 +912,7 @@ javaPluginError jfw_plugin_existJRE(const JavaInfo *pInfo, sal_Bool *exist)
         }
         else
         {
-            ret = JFW_PLUGIN_E_ERROR;
+            ret = javaPluginError::Error;
             JFW_TRACE2("Error while looking for Java runtime library: " << sRuntimeLib);
         }
     }
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index bc53abd..bf174e3 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -98,7 +98,7 @@ javaFrameworkError jfw_findAllJREs(JavaInfo ***pparInfo, sal_Int32 *pSize)
                 & cInfos,
                 infos);
 
-            if (plerr != JFW_PLUGIN_E_NONE)
+            if (plerr != javaPluginError::NONE)
                 return JFW_E_ERROR;
 
             for (int j = 0; j < cInfos; j++)
@@ -123,11 +123,11 @@ javaFrameworkError jfw_findAllJREs(JavaInfo ***pparInfo, sal_Int32 *pSize)
                     versionInfo.getExcludeVersions(),
                     versionInfo.getExcludeVersionSize(),
                     & aInfo.pInfo);
-                if (plerr == JFW_PLUGIN_E_NO_JRE)
+                if (plerr == javaPluginError::NoJre)
                     continue;
-                if (plerr == JFW_PLUGIN_E_FAILED_VERSION)
+                if (plerr == javaPluginError::FailedVersion)
                     continue;
-                else if (plerr !=JFW_PLUGIN_E_NONE)
+                else if (plerr != javaPluginError::NONE)
                     return JFW_E_ERROR;
 
                 if (aInfo)
@@ -341,11 +341,11 @@ javaFrameworkError jfw_startVM(
         JavaVM *pVm = nullptr;
         SAL_INFO("jfw", "Starting Java");
         javaPluginError plerr = jfw_plugin_startJavaVirtualMachine(pInfo, arOpt, index, & pVm, ppEnv);
-        if (plerr == JFW_PLUGIN_E_VM_CREATION_FAILED)
+        if (plerr == javaPluginError::VmCreationFailed)
         {
             errcode = JFW_E_VM_CREATION_FAILED;
         }
-        else if (plerr != JFW_PLUGIN_E_NONE )
+        else if (plerr != javaPluginError::NONE )
         {
             errcode = JFW_E_ERROR;
         }
@@ -354,7 +354,7 @@ javaFrameworkError jfw_startVM(
             g_pJavaVM = pVm;
             *ppVM = pVm;
         }
-        OSL_ASSERT(plerr != JFW_PLUGIN_E_WRONG_VENDOR);
+        OSL_ASSERT(plerr != javaPluginError::WrongVendor);
     }
     catch (const jfw::FrameworkException& e)
     {
@@ -416,7 +416,7 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo)
         // environment variable points to (if it is set)
         JavaInfo* pHomeInfo = nullptr;
         if (jfw_plugin_getJavaInfoFromJavaHome(versionInfos, &pHomeInfo, infos)
-            == JFW_PLUGIN_E_NONE)
+            == javaPluginError::NONE)
         {
             aCurrentInfo = pHomeInfo;
 
@@ -437,7 +437,7 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo)
             std::vector<JavaInfo*> vecJavaInfosFromPath;
             if (jfw_plugin_getJavaInfosFromPath(
                     versionInfos, vecJavaInfosFromPath, infos)
-                == JFW_PLUGIN_E_NONE)
+                == javaPluginError::NONE)
             {
                 std::vector<JavaInfo*>::const_iterator it = vecJavaInfosFromPath.begin();
                 while(it != vecJavaInfosFromPath.end() && !bInfoFound)
@@ -497,7 +497,7 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo)
                     & cInfos,
                     infos);
 
-                if (plerr != JFW_PLUGIN_E_NONE)
+                if (plerr != javaPluginError::NONE)
                     continue;
                 //iterate over all installations to find the best which has
                 //all features
@@ -565,11 +565,11 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo)
                             versionInfo.getExcludeVersions(),
                             versionInfo.getExcludeVersionSize(),
                             & aInfo.pInfo);
-                        if (err == JFW_PLUGIN_E_NO_JRE)
+                        if (err == javaPluginError::NoJre)
                             continue;
-                        if (err == JFW_PLUGIN_E_FAILED_VERSION)
+                        if (err == javaPluginError::FailedVersion)
                             continue;
-                        else if (err !=JFW_PLUGIN_E_NONE)
+                        else if (err !=javaPluginError::NONE)
                             return JFW_E_ERROR;
 
                         if (aInfo)
@@ -745,18 +745,18 @@ javaFrameworkError jfw_getJavaInfoByPath(rtl_uString *pPath, JavaInfo **ppInfo)
                 versionInfo.getExcludeVersionSize(),
                 & pInfo);
 
-            if (plerr == JFW_PLUGIN_E_NONE)
+            if (plerr == javaPluginError::NONE)
             {
                 *ppInfo = pInfo;
                 break;
             }
-            else if(plerr == JFW_PLUGIN_E_FAILED_VERSION)
+            else if(plerr == javaPluginError::FailedVersion)
             {//found JRE but it has the wrong version
                 *ppInfo = nullptr;
                 errcode = JFW_E_FAILED_VERSION;
                 break;
             }
-            else if (plerr == JFW_PLUGIN_E_NO_JRE)
+            else if (plerr == javaPluginError::NoJre)
             {// plugin does not recognize this path as belonging to JRE
                 continue;
             }
@@ -998,13 +998,13 @@ javaFrameworkError jfw_existJRE(const JavaInfo *pInfo, sal_Bool *exist)
     javaFrameworkError ret = JFW_E_NONE;
     switch (plerr)
     {
-    case JFW_PLUGIN_E_NONE:
+    case javaPluginError::NONE:
         ret = JFW_E_NONE;
         break;
-    case JFW_PLUGIN_E_INVALID_ARG:
+    case javaPluginError::InvalidArg:
         ret = JFW_E_INVALID_ARG;
         break;
-    case JFW_PLUGIN_E_ERROR:
+    case javaPluginError::Error:
         ret = JFW_E_ERROR;
         break;
     default:
commit 90cd1b56c98c56010ca43704df94d6096beee6e0
Author: Noel Grandin <noel at peralex.com>
Date:   Fri May 20 15:34:02 2016 +0200

    Convert oslCheckMode to scoped enum
    
    Change-Id: I7cd31d5624682bf7bd021586769593499d2481af
    Reviewed-on: https://gerrit.libreoffice.org/25204
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index 69ec26e..6ba4580 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -296,12 +296,12 @@ inline void deleteTestDirectory( const ::rtl::OUString& basename, const ::rtl::O
 
 /** Check for the file and directory access right.
 */
-typedef enum {
-    osl_Check_Mode_Exist,
-    osl_Check_Mode_OpenAccess,
-    osl_Check_Mode_ReadAccess,
-    osl_Check_Mode_WriteAccess
-} oslCheckMode;
+enum class oslCheckMode {
+    Exist,
+    OpenAccess,
+    ReadAccess,
+    WriteAccess
+};
 
 //check if the file exist
 inline bool ifFileExist( const ::rtl::OUString & str )
@@ -345,15 +345,15 @@ inline bool checkDirectory( const ::rtl::OUString & str, oslCheckMode nCheckMode
     if ( ( ::osl::FileBase::E_NOENT != rc ) && ( ::osl::FileBase::E_ACCES != rc ) ){
 
         switch ( nCheckMode ) {
-            case osl_Check_Mode_Exist:
+            case oslCheckMode::Exist:
                 if ( rc == ::osl::FileBase::E_None )
                     bCheckResult = true;
                 break;
-            case osl_Check_Mode_OpenAccess:
+            case oslCheckMode::OpenAccess:
                 if ( rc == ::osl::FileBase::E_None )
                     bCheckResult = true;
                 break;
-            case osl_Check_Mode_ReadAccess:
+            case oslCheckMode::ReadAccess:
                 //rc = pDir->getNextItem( rItem, 0 );
                 rc = aDir.getNextItem( rItem );
                 if ( ( rc == ::osl::FileBase::E_None ) || ( rc == ::osl::FileBase::E_NOENT ) )
@@ -361,7 +361,7 @@ inline bool checkDirectory( const ::rtl::OUString & str, oslCheckMode nCheckMode
                 else
                     bCheckResult = false;
                 break;
-            case osl_Check_Mode_WriteAccess:
+            case oslCheckMode::WriteAccess:
                 ( ( aUString += str ) += aSlashURL ) += aTmpName2;
                 //if ( ( rc = pDir->create( aUString ) ) == ::osl::FileBase::E_None )
                 if ( ( rc = Directory::create( aUString ) ) == ::osl::FileBase::E_None )
@@ -1104,9 +1104,9 @@ namespace osl_FileBase
         void getTempDirURL_002()
         {
             CPPUNIT_ASSERT_MESSAGE( "test for getTempDirURL function: test for open and write access rights",
-                                    checkDirectory( aUStr, osl_Check_Mode_OpenAccess ) &&
-                                    checkDirectory( aUStr, osl_Check_Mode_ReadAccess ) &&
-                                    checkDirectory( aUStr,osl_Check_Mode_WriteAccess ) );
+                                    checkDirectory( aUStr, oslCheckMode::OpenAccess ) &&
+                                    checkDirectory( aUStr, oslCheckMode::ReadAccess ) &&
+                                    checkDirectory( aUStr, oslCheckMode::WriteAccess ) );
         }
 
         CPPUNIT_TEST_SUITE( getTempDirURL );


More information about the Libreoffice-commits mailing list