From 2767dcc7b2dd4c82981ffdae74547223162c71ff Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 13 Apr 2017 12:16:19 +0200 Subject: Replace a use of CJavaInfo with std::unique_ptr Change-Id: I89cb19969285200a61c47d29e819a50845fa692b --- jvmfwk/source/framework.cxx | 26 +++++++++++--------------- jvmfwk/source/framework.hxx | 1 - 2 files changed, 11 insertions(+), 16 deletions(-) (limited to 'jvmfwk') diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx index b4e94e0d93bf..4786b9424844 100644 --- a/jvmfwk/source/framework.cxx +++ b/jvmfwk/source/framework.cxx @@ -540,14 +540,15 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr *pInfo) for (citLoc it = vecJRELocations.begin(); it != vecJRELocations.end(); ++it) { - jfw::CJavaInfo aInfo; + JavaInfo * info; javaPluginError err = jfw_plugin_getJavaInfoByPath( *it, vendor, versionInfo.sMinVersion, versionInfo.sMaxVersion, versionInfo.vecExcludeVersions, - & aInfo.pInfo); + &info); + std::unique_ptr aInfo(info); if (err == javaPluginError::NoJre) continue; if (err == javaPluginError::FailedVersion) @@ -557,20 +558,23 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr *pInfo) if (aInfo) { - //We remember the very first installation in aCurrentInfo - if (aCurrentInfo.getLocation().isEmpty()) - aCurrentInfo = aInfo; // compare features // If the user does not require any features (nFeatureFlags = 0) // then the first installation is used - if ((aInfo.getFeatures() & nFeatureFlags) == nFeatureFlags) + if ((aInfo->nFeatures & nFeatureFlags) == nFeatureFlags) { //the just found Java implements all required features //currently there is only accessibility!!! - aCurrentInfo = aInfo; + aCurrentInfo = aInfo.release(); bInfoFound = true; break; } + else if (aCurrentInfo.getLocation().isEmpty()) + { + // We remember the very first installation in + // aCurrentInfo: + aCurrentInfo = aInfo.release(); + } } }//end iterate over paths if (bInfoFound) @@ -1040,14 +1044,6 @@ OUString CJavaInfo::getLocation() const return OUString(); } -sal_uInt64 CJavaInfo::getFeatures() const -{ - if (pInfo) - return pInfo->nFeatures; - else - return 0l; -} - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/jvmfwk/source/framework.hxx b/jvmfwk/source/framework.hxx index f514964db995..04fdf86165bf 100644 --- a/jvmfwk/source/framework.hxx +++ b/jvmfwk/source/framework.hxx @@ -58,7 +58,6 @@ public: operator ::JavaInfo* () { return pInfo;} OUString getLocation() const; - sal_uInt64 getFeatures() const; static JavaInfo * copyJavaInfo(const JavaInfo * pInfo); }; -- cgit v1.2.3