diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-04-13 15:25:28 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-04-13 17:32:43 +0200 |
commit | 74315cbccf13b578551390762d5efc0a30c2d65b (patch) | |
tree | 68c4390e825b8eb6225825514a7b13af579ee215 /jvmfwk | |
parent | 626dec44e33727a56353efb7f4eee83e93bc2f3d (diff) |
Use std::unique_ptr<JavaInfo> in jfw_plugin_getJavaInfoFromJavaHome
Change-Id: I8be48d1eec799f347a5edaa67837cf1bbf4d2cc3
Diffstat (limited to 'jvmfwk')
-rw-r--r-- | jvmfwk/inc/vendorplugin.hxx | 2 | ||||
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 5 | ||||
-rw-r--r-- | jvmfwk/source/framework.cxx | 9 |
3 files changed, 7 insertions, 9 deletions
diff --git a/jvmfwk/inc/vendorplugin.hxx b/jvmfwk/inc/vendorplugin.hxx index 875185551688..edd32854dda7 100644 --- a/jvmfwk/inc/vendorplugin.hxx +++ b/jvmfwk/inc/vendorplugin.hxx @@ -190,7 +190,7 @@ javaPluginError jfw_plugin_getJavaInfoByPath( */ javaPluginError jfw_plugin_getJavaInfoFromJavaHome( std::vector<std::pair<OUString, jfw::VersionInfo>> const& vecVendorInfos, - JavaInfo ** ppInfo, + std::unique_ptr<JavaInfo> * ppInfo, std::vector<rtl::Reference<jfw_plugin::VendorBase>> & infos); diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index da7f6218d0d3..f336532f3515 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx @@ -386,7 +386,8 @@ javaPluginError jfw_plugin_getJavaInfoByPath( javaPluginError jfw_plugin_getJavaInfoFromJavaHome( std::vector<pair<OUString, jfw::VersionInfo>> const& vecVendorInfos, - JavaInfo ** ppInfo, std::vector<rtl::Reference<VendorBase>> & infos) + std::unique_ptr<JavaInfo> * ppInfo, + std::vector<rtl::Reference<VendorBase>> & infos) { assert(ppInfo); @@ -414,7 +415,7 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome( if (errorcode == javaPluginError::NONE) { - *ppInfo = createJavaInfo(infoJavaHome[0]); + ppInfo->reset(createJavaInfo(infoJavaHome[0])); return javaPluginError::NONE; } } diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx index 0dd643d92d45..87f4d3adce2b 100644 --- a/jvmfwk/source/framework.cxx +++ b/jvmfwk/source/framework.cxx @@ -364,20 +364,17 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo) // first inspect Java installation that the JAVA_HOME // environment variable points to (if it is set) - JavaInfo* pHomeInfo = nullptr; - if (jfw_plugin_getJavaInfoFromJavaHome(versionInfos, &pHomeInfo, infos) + if (jfw_plugin_getJavaInfoFromJavaHome( + versionInfos, &aCurrentInfo, infos) == javaPluginError::NONE) { - aCurrentInfo.reset(pHomeInfo); - // compare features // if the user does not require any features (nFeatureFlags = 0) // or the Java installation provides all features, then this installation is used - if ((pHomeInfo->nFeatures & nFeatureFlags) == nFeatureFlags) + if ((aCurrentInfo->nFeatures & nFeatureFlags) == nFeatureFlags) { bInfoFound = true; } - delete pHomeInfo; } // if no Java installation providing all features was detected by using JAVA_HOME, |