diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-04-13 16:06:17 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-04-13 17:32:43 +0200 |
commit | 8d475bb13fa44a3a2385635dfbc49ab1b2765dd1 (patch) | |
tree | ab5b557498a8a9b25d955a268731a90673b27ee7 /jvmfwk | |
parent | 74315cbccf13b578551390762d5efc0a30c2d65b (diff) |
Use std::unique_ptr<JavaInfo> in jfw_plugin_getJavaInfoByPath
Change-Id: I3511eaa12bb689a374a775204a3480d7c667a915
Diffstat (limited to 'jvmfwk')
-rw-r--r-- | jvmfwk/inc/vendorplugin.hxx | 2 | ||||
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 4 | ||||
-rw-r--r-- | jvmfwk/source/framework.cxx | 14 |
3 files changed, 8 insertions, 12 deletions
diff --git a/jvmfwk/inc/vendorplugin.hxx b/jvmfwk/inc/vendorplugin.hxx index edd32854dda7..141a93689a8e 100644 --- a/jvmfwk/inc/vendorplugin.hxx +++ b/jvmfwk/inc/vendorplugin.hxx @@ -160,7 +160,7 @@ javaPluginError jfw_plugin_getJavaInfoByPath( OUString const& sMinVersion, OUString const& sMaxVersion, std::vector<OUString> const &arExcludeList, - JavaInfo ** ppInfo); + std::unique_ptr<JavaInfo> * ppInfo); /** obtains information for a JRE referenced by the JAVA_HOME environment variable. diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index f336532f3515..261c648f5da5 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx @@ -357,7 +357,7 @@ javaPluginError jfw_plugin_getJavaInfoByPath( OUString const& sMinVersion, OUString const& sMaxVersion, std::vector<OUString> const &arExcludeList, - JavaInfo ** ppInfo) + std::unique_ptr<JavaInfo> * ppInfo) { assert(ppInfo != nullptr); OSL_ASSERT(!sPath.isEmpty()); @@ -379,7 +379,7 @@ javaPluginError jfw_plugin_getJavaInfoByPath( aVendorInfo, sMinVersion, sMaxVersion, arExcludeList); if (errorcode == javaPluginError::NONE) - *ppInfo = createJavaInfo(aVendorInfo); + ppInfo->reset(createJavaInfo(aVendorInfo)); return errorcode; } diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx index 87f4d3adce2b..90aa407e2eb7 100644 --- a/jvmfwk/source/framework.cxx +++ b/jvmfwk/source/framework.cxx @@ -101,15 +101,14 @@ javaFrameworkError jfw_findAllJREs(std::vector<std::unique_ptr<JavaInfo>> *pparI //Check every manually added location for (auto const & ii: vecJRELocations) { - JavaInfo * info; + std::unique_ptr<JavaInfo> aInfo; plerr = jfw_plugin_getJavaInfoByPath( ii, vendor, versionInfo.sMinVersion, versionInfo.sMaxVersion, versionInfo.vecExcludeVersions, - &info); - std::unique_ptr<JavaInfo> aInfo(info); + &aInfo); if (plerr == javaPluginError::NoJre) continue; if (plerr == javaPluginError::FailedVersion) @@ -499,15 +498,14 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo) for (citLoc it = vecJRELocations.begin(); it != vecJRELocations.end(); ++it) { - JavaInfo * info; + std::unique_ptr<JavaInfo> aInfo; javaPluginError err = jfw_plugin_getJavaInfoByPath( *it, vendor, versionInfo.sMinVersion, versionInfo.sMaxVersion, versionInfo.vecExcludeVersions, - &info); - std::unique_ptr<JavaInfo> aInfo(info); + &aInfo); if (err == javaPluginError::NoJre) continue; if (err == javaPluginError::FailedVersion) @@ -667,18 +665,16 @@ javaFrameworkError jfw_getJavaInfoByPath(OUString const & pPath, std::unique_ptr //ask the plugin if this is a JRE. //If so check if it meets the version requirements. //Only if it does return a JavaInfo - JavaInfo* pInfo = nullptr; javaPluginError plerr = jfw_plugin_getJavaInfoByPath( pPath, vendor, versionInfo.sMinVersion, versionInfo.sMaxVersion, versionInfo.vecExcludeVersions, - & pInfo); + ppInfo); if (plerr == javaPluginError::NONE) { - ppInfo->reset(pInfo); break; } else if(plerr == javaPluginError::FailedVersion) |