Kaydet (Commit) bb65b096 authored tarafından Michael Weghorn's avatar Michael Weghorn Kaydeden (comit) Caolán McNamara

avoid copying of vector

Change-Id: I06ce27f4fa52637bbeaa6d84fdecdf81364e15a7
Reviewed-on: https://gerrit.libreoffice.org/13489Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 2abbc6fa
...@@ -456,13 +456,13 @@ javaPluginError jfw_plugin_getJavaInfosFromPath( ...@@ -456,13 +456,13 @@ javaPluginError jfw_plugin_getJavaInfosFromPath(
vector<rtl::Reference<VendorBase>> vecInfosFromPath; vector<rtl::Reference<VendorBase>> vecInfosFromPath;
addJavaInfosFromPath(infos, vecInfosFromPath); addJavaInfosFromPath(infos, vecInfosFromPath);
vector<rtl::Reference<VendorBase> > vecVerifiedInfos; vector<JavaInfo*> vecVerifiedInfos;
// copy JREs that meet version requirements to vecVerifiedInfos // copy infos of JREs that meet version requirements to vecVerifiedInfos
typedef vector<rtl::Reference<VendorBase> >::iterator it; typedef vector<rtl::Reference<VendorBase> >::iterator it;
for (it i= vecInfosFromPath.begin(); i != vecInfosFromPath.end(); ++i) for (it i= vecInfosFromPath.begin(); i != vecInfosFromPath.end(); ++i)
{ {
const rtl::Reference<VendorBase>& cur = *i; const rtl::Reference<VendorBase>& currentInfo = *i;
typedef std::vector<pair<OUString, jfw::VersionInfo>>::const_iterator ci_pl; typedef std::vector<pair<OUString, jfw::VersionInfo>>::const_iterator ci_pl;
for (ci_pl vendorInfo = vecVendorInfos.begin(); vendorInfo != vecVendorInfos.end(); ++vendorInfo) for (ci_pl vendorInfo = vecVendorInfos.begin(); vendorInfo != vecVendorInfos.end(); ++vendorInfo)
...@@ -470,10 +470,10 @@ javaPluginError jfw_plugin_getJavaInfosFromPath( ...@@ -470,10 +470,10 @@ javaPluginError jfw_plugin_getJavaInfosFromPath(
const OUString& vendor = vendorInfo->first; const OUString& vendor = vendorInfo->first;
jfw::VersionInfo versionInfo = vendorInfo->second; jfw::VersionInfo versionInfo = vendorInfo->second;
if (vendor.equals(cur->getVendor())) if (vendor.equals(currentInfo->getVendor()))
{ {
javaPluginError errorcode = checkJavaVersionRequirements( javaPluginError errorcode = checkJavaVersionRequirements(
cur, currentInfo,
versionInfo.sMinVersion, versionInfo.sMinVersion,
versionInfo.sMaxVersion, versionInfo.sMaxVersion,
versionInfo.getExcludeVersions(), versionInfo.getExcludeVersions(),
...@@ -481,7 +481,7 @@ javaPluginError jfw_plugin_getJavaInfosFromPath( ...@@ -481,7 +481,7 @@ javaPluginError jfw_plugin_getJavaInfosFromPath(
if (errorcode == JFW_PLUGIN_E_NONE) if (errorcode == JFW_PLUGIN_E_NONE)
{ {
vecVerifiedInfos.push_back(*i); vecVerifiedInfos.push_back(createJavaInfo(currentInfo));
} }
} }
} }
...@@ -490,17 +490,7 @@ javaPluginError jfw_plugin_getJavaInfosFromPath( ...@@ -490,17 +490,7 @@ javaPluginError jfw_plugin_getJavaInfosFromPath(
if (vecVerifiedInfos.empty()) if (vecVerifiedInfos.empty())
return JFW_PLUGIN_E_NO_JRE; return JFW_PLUGIN_E_NO_JRE;
// Now vecVerifiedInfos contains all those JREs which meet the version requirements javaInfosFromPath = vecVerifiedInfos;
// Transfer them into the vector that is passed out.
vector<JavaInfo*> infosFromPath;
typedef vector<rtl::Reference<VendorBase> >::const_iterator cit;
for (cit ii = vecVerifiedInfos.begin(); ii != vecVerifiedInfos.end(); ++ii)
{
infosFromPath.push_back(createJavaInfo(*ii));
}
javaInfosFromPath = infosFromPath;
return JFW_PLUGIN_E_NONE; return JFW_PLUGIN_E_NONE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment