Kaydet (Commit) 2ea531c0 authored tarafından Julien Nabet's avatar Julien Nabet

Use loop ranges in jvmfwk

to simplify and avoid all the typedefs

Change-Id: Ia14337dd71b55fc24f162b5436af76aeeb8d2575
Reviewed-on: https://gerrit.libreoffice.org/43346Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst 923cea68
...@@ -97,7 +97,6 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props) ...@@ -97,7 +97,6 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props)
//javax.accessibility.assistive_technologies from system properties //javax.accessibility.assistive_technologies from system properties
OUString sJavaLibraryPath; OUString sJavaLibraryPath;
typedef vector<pair<OUString, OUString> >::const_iterator it_prop;
OUString const sVendorProperty("java.vendor"); OUString const sVendorProperty("java.vendor");
OUString const sVersionProperty("java.version"); OUString const sVersionProperty("java.version");
OUString const sJavaHomeProperty("java.home"); OUString const sJavaHomeProperty("java.home");
...@@ -112,28 +111,27 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props) ...@@ -112,28 +111,27 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props)
bool bJavaLibraryPath = false; bool bJavaLibraryPath = false;
bool bAccess = false; bool bAccess = false;
typedef vector<pair<OUString, OUString> >::const_iterator it_prop; for (auto const& prop : props)
for (it_prop i = props.begin(); i != props.end(); ++i)
{ {
if(! bVendor && sVendorProperty == i->first) if(! bVendor && sVendorProperty == prop.first)
{ {
m_sVendor = i->second; m_sVendor = prop.second;
bVendor = true; bVendor = true;
} }
else if (!bVersion && sVersionProperty == i->first) else if (!bVersion && sVersionProperty == prop.first)
{ {
m_sVersion = i->second; m_sVersion = prop.second;
bVersion = true; bVersion = true;
} }
else if (!bHome && sGNUHomeProperty == i->first) else if (!bHome && sGNUHomeProperty == prop.first)
{ {
m_sHome = i->second; m_sHome = prop.second;
bHome = true; bHome = true;
} }
else if (!bJavaHome && sJavaHomeProperty == i->first) else if (!bJavaHome && sJavaHomeProperty == prop.first)
{ {
OUString fileURL; OUString fileURL;
if (osl_getFileURLFromSystemPath(i->second.pData,& fileURL.pData) == if (osl_getFileURLFromSystemPath(prop.second.pData,& fileURL.pData) ==
osl_File_E_None) osl_File_E_None)
{ {
//make sure that the drive letter have all the same case //make sure that the drive letter have all the same case
...@@ -146,15 +144,15 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props) ...@@ -146,15 +144,15 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props)
} }
} }
} }
else if (!bJavaLibraryPath && sJavaLibraryPathProperty == i->first) else if (!bJavaLibraryPath && sJavaLibraryPathProperty == prop.first)
{ {
sal_Int32 nIndex = 0; sal_Int32 nIndex = 0;
osl_getFileURLFromSystemPath(i->second.getToken(0, ':', nIndex).pData, &sJavaLibraryPath.pData); osl_getFileURLFromSystemPath(prop.second.getToken(0, ':', nIndex).pData, &sJavaLibraryPath.pData);
bJavaLibraryPath = true; bJavaLibraryPath = true;
} }
else if (!bAccess && sAccessProperty == i->first) else if (!bAccess && sAccessProperty == prop.first)
{ {
if (!i->second.isEmpty()) if (!prop.second.isEmpty())
{ {
m_bAccessibility = true; m_bAccessibility = true;
bAccess = true; bAccess = true;
...@@ -179,11 +177,10 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props) ...@@ -179,11 +177,10 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props)
vector<OUString> libpaths = getVectorFromCharArray(arRtPaths, size); vector<OUString> libpaths = getVectorFromCharArray(arRtPaths, size);
bool bRt = false; bool bRt = false;
typedef vector<OUString>::const_iterator i_path; for (auto const& libpath : libpaths)
for(i_path ip = libpaths.begin(); ip != libpaths.end(); ++ip)
{ {
//Construct an absolute path to the possible runtime //Construct an absolute path to the possible runtime
OUString usRt= m_sHome + *ip; OUString usRt= m_sHome + libpath;
DirectoryItem item; DirectoryItem item;
if(DirectoryItem::get(usRt, item) == File::E_None) if(DirectoryItem::get(usRt, item) == File::E_None)
{ {
...@@ -197,10 +194,10 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props) ...@@ -197,10 +194,10 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props)
if (!bRt) if (!bRt)
{ {
m_sHome = m_sJavaHome; m_sHome = m_sJavaHome;
for(i_path ip = libpaths.begin(); ip != libpaths.end(); ++ip) for (auto const& libpath : libpaths)
{ {
//Construct an absolute path to the possible runtime //Construct an absolute path to the possible runtime
OUString usRt= m_sHome + *ip; OUString usRt= m_sHome + libpath;
DirectoryItem item; DirectoryItem item;
if(DirectoryItem::get(usRt, item) == File::E_None) if(DirectoryItem::get(usRt, item) == File::E_None)
{ {
...@@ -216,10 +213,10 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props) ...@@ -216,10 +213,10 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props)
if (!bRt && m_sJavaHome != sJavaLibraryPath) if (!bRt && m_sJavaHome != sJavaLibraryPath)
{ {
m_sHome = sJavaLibraryPath; m_sHome = sJavaLibraryPath;
for(i_path ip = libpaths.begin(); ip != libpaths.end(); ++ip) for (auto const& libpath : libpaths)
{ {
//Construct an absolute path to the possible runtime //Construct an absolute path to the possible runtime
OUString usRt= m_sHome + *ip; OUString usRt= m_sHome + libpath;
DirectoryItem item; DirectoryItem item;
if(DirectoryItem::get(usRt, item) == File::E_None) if(DirectoryItem::get(usRt, item) == File::E_None)
{ {
...@@ -236,10 +233,10 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props) ...@@ -236,10 +233,10 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props)
if (!bRt && m_sJavaHome != "file:///usr/lib") if (!bRt && m_sJavaHome != "file:///usr/lib")
{ {
m_sHome = "file:///usr/lib64"; m_sHome = "file:///usr/lib64";
for(i_path ip = libpaths.begin(); ip != libpaths.end(); ++ip) for (auto const& libpath : libpaths)
{ {
//Construct an absolute path to the possible runtime //Construct an absolute path to the possible runtime
OUString usRt= m_sHome + *ip; OUString usRt= m_sHome + libpath;
DirectoryItem item; DirectoryItem item;
if(DirectoryItem::get(usRt, item) == File::E_None) if(DirectoryItem::get(usRt, item) == File::E_None)
{ {
...@@ -263,9 +260,9 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props) ...@@ -263,9 +260,9 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props)
bool bLdPath = true; bool bLdPath = true;
int c = 0; int c = 0;
for(i_path il = ld_paths.begin(); il != ld_paths.end(); ++il, ++c) for (auto const& ld_path : ld_paths)
{ {
OUString usAbsUrl= m_sHome + *il; OUString usAbsUrl= m_sHome + ld_path;
// convert to system path // convert to system path
OUString usSysPath; OUString usSysPath;
if(File::getSystemPathFromFileURL(usAbsUrl, usSysPath) == File::E_None) if(File::getSystemPathFromFileURL(usAbsUrl, usSysPath) == File::E_None)
...@@ -280,6 +277,7 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props) ...@@ -280,6 +277,7 @@ bool GnuInfo::initialize(vector<pair<OUString, OUString> > props)
bLdPath = false; bLdPath = false;
break; break;
} }
++c;
} }
return bLdPath; return bLdPath;
} }
......
...@@ -313,31 +313,28 @@ javaPluginError jfw_plugin_getAllJavaInfos( ...@@ -313,31 +313,28 @@ javaPluginError jfw_plugin_getAllJavaInfos(
addAllJREInfos(checkJavaHomeAndPath, infos); addAllJREInfos(checkJavaHomeAndPath, infos);
vector<rtl::Reference<VendorBase> > vecVerifiedInfos; vector<rtl::Reference<VendorBase> > vecVerifiedInfos;
typedef vector<rtl::Reference<VendorBase> >::iterator it; for (auto const& vecInfo : vecInfos)
for (it i= vecInfos.begin(); i != vecInfos.end(); ++i)
{ {
const rtl::Reference<VendorBase>& cur = *i;
if (sVendor != cur->getVendor()) if (sVendor != vecInfo->getVendor())
continue; continue;
javaPluginError err = checkJavaVersionRequirements( javaPluginError err = checkJavaVersionRequirements(
cur, sMinVersion, sMaxVersion, arExcludeList); vecInfo, sMinVersion, sMaxVersion, arExcludeList);
if (err == javaPluginError::FailedVersion || err == javaPluginError::WrongArch) if (err == javaPluginError::FailedVersion || err == javaPluginError::WrongArch)
continue; continue;
else if (err == javaPluginError::WrongVersionFormat) else if (err == javaPluginError::WrongVersionFormat)
return err; return err;
vecVerifiedInfos.push_back(*i); vecVerifiedInfos.push_back(vecInfo);
} }
//Now vecVerifiedInfos contains all those JREs which meet the version requirements //Now vecVerifiedInfos contains all those JREs which meet the version requirements
//Transfer them into the array that is passed out. //Transfer them into the array that is passed out.
parJavaInfo->clear(); parJavaInfo->clear();
typedef vector<rtl::Reference<VendorBase> >::const_iterator cit; for (auto const& vecVerifiedInfo : vecVerifiedInfos)
for (cit ii = vecVerifiedInfos.begin(); ii != vecVerifiedInfos.end(); ++ii)
{ {
parJavaInfo->push_back(createJavaInfo(*ii)); parJavaInfo->push_back(createJavaInfo(vecVerifiedInfo));
} }
return javaPluginError::NONE; return javaPluginError::NONE;
...@@ -391,11 +388,10 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome( ...@@ -391,11 +388,10 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
assert(infoJavaHome.size() == 1); assert(infoJavaHome.size() == 1);
//Check if the detected JRE matches the version requirements //Check if the detected JRE matches the version requirements
typedef std::vector<pair<OUString, jfw::VersionInfo>>::const_iterator ci_pl; for (auto const& vendorInfo : vecVendorInfos)
for (ci_pl vendorInfo = vecVendorInfos.begin(); vendorInfo != vecVendorInfos.end(); ++vendorInfo)
{ {
const OUString& vendor = vendorInfo->first; const OUString& vendor = vendorInfo.first;
jfw::VersionInfo versionInfo = vendorInfo->second; jfw::VersionInfo versionInfo = vendorInfo.second;
if (vendor == infoJavaHome[0]->getVendor()) if (vendor == infoJavaHome[0]->getVendor())
{ {
...@@ -428,28 +424,24 @@ javaPluginError jfw_plugin_getJavaInfosFromPath( ...@@ -428,28 +424,24 @@ javaPluginError jfw_plugin_getJavaInfosFromPath(
vector<std::unique_ptr<JavaInfo>> vecVerifiedInfos; vector<std::unique_ptr<JavaInfo>> vecVerifiedInfos;
// copy infos of JREs that meet version requirements to vecVerifiedInfos // copy infos of JREs that meet version requirements to vecVerifiedInfos
typedef vector<rtl::Reference<VendorBase> >::iterator it; for (auto const& infosFromPath : vecInfosFromPath)
for (it i= vecInfosFromPath.begin(); i != vecInfosFromPath.end(); ++i)
{ {
const rtl::Reference<VendorBase>& currentInfo = *i; for (auto const& vendorInfo : vecVendorInfos)
typedef std::vector<pair<OUString, jfw::VersionInfo>>::const_iterator ci_pl;
for (ci_pl vendorInfo = vecVendorInfos.begin(); vendorInfo != vecVendorInfos.end(); ++vendorInfo)
{ {
const OUString& vendor = vendorInfo->first; const OUString& vendor = vendorInfo.first;
jfw::VersionInfo const & versionInfo = vendorInfo->second; jfw::VersionInfo const & versionInfo = vendorInfo.second;
if (vendor == currentInfo->getVendor()) if (vendor == infosFromPath->getVendor())
{ {
javaPluginError errorcode = checkJavaVersionRequirements( javaPluginError errorcode = checkJavaVersionRequirements(
currentInfo, infosFromPath,
versionInfo.sMinVersion, versionInfo.sMinVersion,
versionInfo.sMaxVersion, versionInfo.sMaxVersion,
versionInfo.vecExcludeVersions); versionInfo.vecExcludeVersions);
if (errorcode == javaPluginError::NONE) if (errorcode == javaPluginError::NONE)
{ {
vecVerifiedInfos.push_back(createJavaInfo(currentInfo)); vecVerifiedInfos.push_back(createJavaInfo(infosFromPath));
} }
} }
} }
......
...@@ -584,22 +584,18 @@ void addJavaInfoFromWinReg( ...@@ -584,22 +584,18 @@ void addJavaInfoFromWinReg(
if(getSDKInfoFromRegistry(vecJavaHome)) if(getSDKInfoFromRegistry(vecJavaHome))
{ {
// create impl objects // create impl objects
typedef std::vector<OUString>::iterator ItHome; for (auto const& javaHome : vecJavaHome)
for(ItHome it_home= vecJavaHome.begin(); it_home != vecJavaHome.end();
++it_home)
{ {
getAndAddJREInfoByPath(*it_home, allInfos, addedInfos); getAndAddJREInfoByPath(javaHome, allInfos, addedInfos);
} }
} }
vecJavaHome.clear(); vecJavaHome.clear();
if(getJREInfoFromRegistry(vecJavaHome)) if(getJREInfoFromRegistry(vecJavaHome))
{ {
typedef std::vector<OUString>::iterator ItHome; for (auto const& javaHome : vecJavaHome)
for(ItHome it_home= vecJavaHome.begin(); it_home != vecJavaHome.end();
++it_home)
{ {
getAndAddJREInfoByPath(*it_home, allInfos, addedInfos); getAndAddJREInfoByPath(javaHome, allInfos, addedInfos);
} }
} }
} }
...@@ -765,13 +761,12 @@ void addJREInfoFromBinPath( ...@@ -765,13 +761,12 @@ void addJREInfoFromBinPath(
if (path.endsWith("/")) if (path.endsWith("/"))
sBinPath = path.copy(0, path.getLength() - 1); sBinPath = path.copy(0, path.getLength() - 1);
typedef vector<OUString>::const_iterator c_it; for (auto const& looppath : vecPaths)
for (c_it i = vecPaths.begin(); i != vecPaths.end(); ++i)
{ {
//the map contains e.g. jre/bin/java.exe //the map contains e.g. jre/bin/java.exe
//get the directory where the executable is contained //get the directory where the executable is contained
OUString sHome; OUString sHome;
sal_Int32 index = i->lastIndexOf('/'); sal_Int32 index = looppath.lastIndexOf('/');
if (index == -1) if (index == -1)
{ {
//map contained only : "java.exe, then the argument //map contained only : "java.exe, then the argument
...@@ -781,7 +776,7 @@ void addJREInfoFromBinPath( ...@@ -781,7 +776,7 @@ void addJREInfoFromBinPath(
else else
{ {
// jre/bin/jre -> jre/bin // jre/bin/jre -> jre/bin
OUString sMapPath = i->copy(0, index); OUString sMapPath = looppath.copy(0, index);
index = sBinPath.lastIndexOf(sMapPath); index = sBinPath.lastIndexOf(sMapPath);
if (index != -1 if (index != -1
&& (index + sMapPath.getLength() == sBinPath.getLength()) && (index + sMapPath.getLength() == sBinPath.getLength())
...@@ -926,8 +921,7 @@ rtl::Reference<VendorBase> getJREInfoByPath( ...@@ -926,8 +921,7 @@ rtl::Reference<VendorBase> getJREInfoByPath(
vecPaths = getVectorFromCharArray(arExePaths, size); vecPaths = getVectorFromCharArray(arExePaths, size);
bool bBreak = false; bool bBreak = false;
typedef vector<OUString>::const_iterator c_it; for (auto const& looppath : vecPaths)
for (c_it i = vecPaths.begin(); i != vecPaths.end(); ++i)
{ {
//if the path is a link, then resolve it //if the path is a link, then resolve it
//check if the executable exists at all //check if the executable exists at all
...@@ -936,9 +930,9 @@ rtl::Reference<VendorBase> getJREInfoByPath( ...@@ -936,9 +930,9 @@ rtl::Reference<VendorBase> getJREInfoByPath(
//sizeof counts the terminating 0 //sizeof counts the terminating 0
OUString sFullPath; OUString sFullPath;
if (path.getLength() == sizeof("file:///") - 1) if (path.getLength() == sizeof("file:///") - 1)
sFullPath = sResolvedDir + (*i); sFullPath = sResolvedDir + looppath;
else else
sFullPath = sResolvedDir + "/" + (*i); sFullPath = sResolvedDir + "/" + looppath;
sFilePath = resolveFilePath(sFullPath); sFilePath = resolveFilePath(sFullPath);
...@@ -1026,14 +1020,13 @@ rtl::Reference<VendorBase> getJREInfoByPath( ...@@ -1026,14 +1020,13 @@ rtl::Reference<VendorBase> getJREInfoByPath(
} }
//find java.vendor property //find java.vendor property
typedef vector<pair<OUString, OUString> >::const_iterator c_ip;
OUString sVendorName; OUString sVendorName;
for (c_ip i = props.begin(); i != props.end(); ++i) for (auto const& prop : props)
{ {
if (i->first == "java.vendor") if (prop.first == "java.vendor")
{ {
sVendorName = i->second; sVendorName = prop.second;
break; break;
} }
} }
......
...@@ -58,32 +58,29 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props) ...@@ -58,32 +58,29 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props)
//get java.vendor, java.version, java.home, //get java.vendor, java.version, java.home,
//javax.accessibility.assistive_technologies from system properties //javax.accessibility.assistive_technologies from system properties
typedef vector<pair<OUString, OUString> >::const_iterator it_prop;
bool bVersion = false; bool bVersion = false;
bool bVendor = false; bool bVendor = false;
bool bHome = false; bool bHome = false;
bool bAccess = false; bool bAccess = false;
bool bArch = false; bool bArch = false;
typedef vector<pair<OUString, OUString> >::const_iterator it_prop; for (auto const& prop : props)
for (it_prop i = props.begin(); i != props.end(); ++i)
{ {
if(! bVendor && i->first == "java.vendor") if(! bVendor && prop.first == "java.vendor")
{ {
m_sVendor = i->second; m_sVendor = prop.second;
bVendor = true; bVendor = true;
} }
else if (!bVersion && i->first == "java.version") else if (!bVersion && prop.first == "java.version")
{ {
m_sVersion = i->second; m_sVersion = prop.second;
bVersion = true; bVersion = true;
} }
else if (!bHome && i->first == "java.home") else if (!bHome && prop.first == "java.home")
{ {
#ifndef JVM_ONE_PATH_CHECK #ifndef JVM_ONE_PATH_CHECK
OUString fileURL; OUString fileURL;
if (osl_getFileURLFromSystemPath(i->second.pData,& fileURL.pData) == if (osl_getFileURLFromSystemPath(prop.second.pData,& fileURL.pData) ==
osl_File_E_None) osl_File_E_None)
{ {
//make sure that the drive letter have all the same case //make sure that the drive letter have all the same case
...@@ -96,19 +93,19 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props) ...@@ -96,19 +93,19 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props)
} }
} }
#else #else
m_sHome = i->second; m_sHome = prop.second;
bHome = true; bHome = true;
#endif #endif
} }
else if (!bArch && i->first == "os.arch") else if (!bArch && prop.first == "os.arch")
{ {
m_sArch = i->second; m_sArch = prop.second;
bArch = true; bArch = true;
} }
else if (!bAccess else if (!bAccess
&& i->first == "javax.accessibility.assistive_technologies") && prop.first == "javax.accessibility.assistive_technologies")
{ {
if (!i->second.isEmpty()) if (!prop.second.isEmpty())
{ {
m_bAccessibility = true; m_bAccessibility = true;
bAccess = true; bAccess = true;
...@@ -130,11 +127,10 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props) ...@@ -130,11 +127,10 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props)
vector<OUString> libpaths = getVectorFromCharArray(arRtPaths, size); vector<OUString> libpaths = getVectorFromCharArray(arRtPaths, size);
bool bRt = false; bool bRt = false;
typedef vector<OUString>::const_iterator i_path; for (auto const& libpath : libpaths)
for(i_path ip = libpaths.begin(); ip != libpaths.end(); ++ip)
{ {
//Construct an absolute path to the possible runtime //Construct an absolute path to the possible runtime
OUString usRt= m_sHome + *ip; OUString usRt= m_sHome + libpath;
DirectoryItem item; DirectoryItem item;
if(DirectoryItem::get(usRt, item) == File::E_None) if(DirectoryItem::get(usRt, item) == File::E_None)
{ {
...@@ -155,9 +151,9 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props) ...@@ -155,9 +151,9 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props)
bool bLdPath = true; bool bLdPath = true;
int c = 0; int c = 0;
for(i_path il = ld_paths.begin(); il != ld_paths.end(); ++il, ++c) for (auto const& ld_path : ld_paths)
{ {
OUString usAbsUrl= m_sHome + *il; OUString usAbsUrl= m_sHome + ld_path;
// convert to system path // convert to system path
OUString usSysPath; OUString usSysPath;
if(File::getSystemPathFromFileURL(usAbsUrl, usSysPath) == File::E_None) if(File::getSystemPathFromFileURL(usAbsUrl, usSysPath) == File::E_None)
...@@ -172,6 +168,7 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props) ...@@ -172,6 +168,7 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props)
bLdPath = false; bLdPath = false;
break; break;
} }
++c;
} }
return bLdPath; return bLdPath;
} }
......
...@@ -493,11 +493,10 @@ void NodeJava::write() const ...@@ -493,11 +493,10 @@ void NodeJava::write() const
xmlAddChild(vmParameters, nodeCrLf); xmlAddChild(vmParameters, nodeCrLf);
} }
typedef std::vector<OUString>::const_iterator cit; for (auto const & vmParameter : *m_vmParameters)
for (cit i = m_vmParameters->begin(); i != m_vmParameters->end(); ++i)
{ {
xmlNewTextChild(vmParameters, nullptr, reinterpret_cast<xmlChar const *>("param"), xmlNewTextChild(vmParameters, nullptr, reinterpret_cast<xmlChar const *>("param"),
CXmlCharPtr(*i)); CXmlCharPtr(vmParameter));
//add a new line //add a new line
xmlNode * nodeCrLf = xmlNewText(reinterpret_cast<xmlChar const *>("\n")); xmlNode * nodeCrLf = xmlNewText(reinterpret_cast<xmlChar const *>("\n"));
xmlAddChild(vmParameters, nodeCrLf); xmlAddChild(vmParameters, nodeCrLf);
...@@ -534,11 +533,10 @@ void NodeJava::write() const ...@@ -534,11 +533,10 @@ void NodeJava::write() const
xmlAddChild(jreLocationsNode, nodeCrLf); xmlAddChild(jreLocationsNode, nodeCrLf);
} }
typedef std::vector<OUString>::const_iterator cit; for (auto const & JRELocation : *m_JRELocations)
for (cit i = m_JRELocations->begin(); i != m_JRELocations->end(); ++i)
{ {
xmlNewTextChild(jreLocationsNode, nullptr, reinterpret_cast<xmlChar const *>("location"), xmlNewTextChild(jreLocationsNode, nullptr, reinterpret_cast<xmlChar const *>("location"),
CXmlCharPtr(*i)); CXmlCharPtr(JRELocation));
//add a new line //add a new line
xmlNode * nodeCrLf = xmlNewText(reinterpret_cast<xmlChar const *>("\n")); xmlNode * nodeCrLf = xmlNewText(reinterpret_cast<xmlChar const *>("\n"));
xmlAddChild(jreLocationsNode, nodeCrLf); xmlAddChild(jreLocationsNode, nodeCrLf);
...@@ -986,10 +984,9 @@ void MergedSettings::merge(const NodeJava & share, const NodeJava & user) ...@@ -986,10 +984,9 @@ void MergedSettings::merge(const NodeJava & share, const NodeJava & user)
::std::vector< OString> MergedSettings::getVmParametersUtf8() const ::std::vector< OString> MergedSettings::getVmParametersUtf8() const
{ {
::std::vector< OString> ret; ::std::vector< OString> ret;
typedef ::std::vector< OUString>::const_iterator cit; for (auto const & vmParam : m_vmParams)
for (cit i = m_vmParams.begin(); i != m_vmParams.end(); ++i)
{ {
ret.push_back( OUStringToOString(*i, RTL_TEXTENCODING_UTF8)); ret.push_back( OUStringToOString(vmParam, RTL_TEXTENCODING_UTF8));
} }
return ret; return ret;
} }
......
...@@ -263,10 +263,9 @@ javaFrameworkError jfw_startVM( ...@@ -263,10 +263,9 @@ javaFrameworkError jfw_startVM(
//add the options set by options dialog //add the options set by options dialog
int index = 2; int index = 2;
typedef std::vector<OString>::const_iterator cit; for (auto const & vmParam : vmParams)
for (cit i = vmParams.begin(); i != vmParams.end(); ++i)
{ {
arOpt[index].optionString = const_cast<sal_Char*>(i->getStr()); arOpt[index].optionString = const_cast<sal_Char*>(vmParam.getStr());
arOpt[index].extraInfo = nullptr; arOpt[index].extraInfo = nullptr;
index ++; index ++;
} }
...@@ -342,10 +341,8 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo) ...@@ -342,10 +341,8 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo)
// save vendors and respective version requirements pair-wise in a vector // save vendors and respective version requirements pair-wise in a vector
std::vector<std::pair<OUString, jfw::VersionInfo>> versionInfos; std::vector<std::pair<OUString, jfw::VersionInfo>> versionInfos;
typedef std::vector<OUString>::const_iterator ciVendor; for (auto const & vendor : vecVendors)
for (ciVendor i = vecVendors.begin(); i != vecVendors.end(); ++i)
{ {
const OUString & vendor = *i;
jfw::VersionInfo versionInfo = jfw::VersionInfo versionInfo =
aVendorSettings.getVersionInformation(vendor); aVendorSettings.getVersionInformation(vendor);
...@@ -407,10 +404,8 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo) ...@@ -407,10 +404,8 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo)
{ {
//Use every vendor to get Java installations. At the first usable //Use every vendor to get Java installations. At the first usable
//Java the loop will break //Java the loop will break
typedef std::vector<OUString>::const_iterator ci_pl; for (auto const & vendor : vecVendors)
for (ci_pl i = vecVendors.begin(); i != vecVendors.end(); ++i)
{ {
const OUString & vendor = *i;
jfw::VersionInfo versionInfo = jfw::VersionInfo versionInfo =
aVendorSettings.getVersionInformation(vendor); aVendorSettings.getVersionInformation(vendor);
...@@ -465,19 +460,16 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo) ...@@ -465,19 +460,16 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo)
const std::vector<OUString> & vecJRELocations = const std::vector<OUString> & vecJRELocations =
settings.getJRELocations(); settings.getJRELocations();
//use every plug-in to determine the JavaInfo objects //use every plug-in to determine the JavaInfo objects
for (ci_pl i = vecVendors.begin(); i != vecVendors.end(); ++i) for (auto const & vendor : vecVendors)
{ {
const OUString & vendor = *i;
jfw::VersionInfo versionInfo = jfw::VersionInfo versionInfo =
aVendorSettings.getVersionInformation(vendor); aVendorSettings.getVersionInformation(vendor);
typedef std::vector<OUString>::const_iterator citLoc; for (auto const & JRELocation : vecJRELocations)
for (citLoc it = vecJRELocations.begin();
it != vecJRELocations.end(); ++it)
{ {
std::unique_ptr<JavaInfo> aInfo; std::unique_ptr<JavaInfo> aInfo;
javaPluginError err = jfw_plugin_getJavaInfoByPath( javaPluginError err = jfw_plugin_getJavaInfoByPath(
*it, JRELocation,
vendor, vendor,
versionInfo.sMinVersion, versionInfo.sMinVersion,
versionInfo.sMaxVersion, versionInfo.sMaxVersion,
...@@ -629,10 +621,8 @@ javaFrameworkError jfw_getJavaInfoByPath(OUString const & pPath, std::unique_ptr ...@@ -629,10 +621,8 @@ javaFrameworkError jfw_getJavaInfoByPath(OUString const & pPath, std::unique_ptr
//Use every plug-in library to determine if the path represents a //Use every plug-in library to determine if the path represents a
//JRE. If a plugin recognized it then the loop will break //JRE. If a plugin recognized it then the loop will break
typedef std::vector<OUString>::const_iterator ci_pl; for (auto const & vendor : vecVendors)
for (ci_pl i = vecVendors.begin(); i != vecVendors.end(); ++i)
{ {
const OUString & vendor = *i;
jfw::VersionInfo versionInfo = jfw::VersionInfo versionInfo =
aVendorSettings.getVersionInformation(vendor); aVendorSettings.getVersionInformation(vendor);
......
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