summaryrefslogtreecommitdiff
path: root/apt-pkg/edsp.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-06-04 18:14:13 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2017-06-26 23:31:15 +0200
commitfc2055e1e08e4e3b662b0c5f67a0d0a57267acd3 (patch)
treebf071ffd9f1beb27847ec62d7186e7f2902cad41 /apt-pkg/edsp.cc
parentd0eb158be03f15139eee65c4162c9c6e3be10718 (diff)
avoid explicit types for pkg counts by auto
Changes nothing on the program front and as the datatypes are sufficently comparable fixes no bug either, but problems later on if we ever change the types of those and prevent us using types which are too large for the values we want to store waste (a tiny bit of) resources. Gbp-Dch: Ignore
Diffstat (limited to 'apt-pkg/edsp.cc')
-rw-r--r--apt-pkg/edsp.cc32
1 files changed, 16 insertions, 16 deletions
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc
index a2520441b..fb23c1c55 100644
--- a/apt-pkg/edsp.cc
+++ b/apt-pkg/edsp.cc
@@ -396,7 +396,7 @@ bool EDSP::WriteScenario(pkgDepCache &Cache, FILE* output, OpProgress *Progress)
{
if (Progress != NULL)
Progress->SubProgress(Cache.Head().VersionCount, _("Send scenario to solver"));
- unsigned long p = 0;
+ decltype(Cache.Head().VersionCount) p = 0;
std::vector<std::string> archs = APT::Configuration::getArchitectures();
for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); Pkg.end() == false; ++Pkg)
{
@@ -420,7 +420,7 @@ bool EDSP::WriteScenario(pkgDepCache &Cache, FileFd &output, OpProgress *Progres
{
if (Progress != NULL)
Progress->SubProgress(Cache.Head().VersionCount, _("Send scenario to solver"));
- unsigned long p = 0;
+ decltype(Cache.Head().VersionCount) p = 0;
bool Okay = output.Failed() == false;
std::vector<std::string> archs = APT::Configuration::getArchitectures();
for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); Pkg.end() == false && likely(Okay); ++Pkg)
@@ -450,7 +450,7 @@ bool EDSP::WriteLimitedScenario(pkgDepCache &Cache, FILE* output,
{
if (Progress != NULL)
Progress->SubProgress(Cache.Head().VersionCount, _("Send scenario to solver"));
- unsigned long p = 0;
+ decltype(Cache.Head().PackageCount) p = 0;
for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg, ++p)
for (pkgCache::VerIterator Ver = Pkg.VersionList(); Ver.end() == false; ++Ver)
{
@@ -472,7 +472,7 @@ bool EDSP::WriteLimitedScenario(pkgDepCache &Cache, FileFd &output,
{
if (Progress != NULL)
Progress->SubProgress(Cache.Head().VersionCount, _("Send scenario to solver"));
- unsigned long p = 0;
+ decltype(Cache.Head().PackageCount) p = 0;
bool Okay = output.Failed() == false;
for (auto Pkg = Cache.PkgBegin(); Pkg.end() == false && likely(Okay); ++Pkg, ++p)
{
@@ -502,7 +502,7 @@ bool EDSP::WriteRequest(pkgDepCache &Cache, FILE* output, bool const Upgrade,
{
if (Progress != NULL)
Progress->SubProgress(Cache.Head().PackageCount, _("Send request to solver"));
- unsigned long p = 0;
+ decltype(Cache.Head().PackageCount) p = 0;
string del, inst;
for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); Pkg.end() == false; ++Pkg, ++p)
{
@@ -556,7 +556,7 @@ bool EDSP::WriteRequest(pkgDepCache &Cache, FileFd &output,
{
if (Progress != NULL)
Progress->SubProgress(Cache.Head().PackageCount, _("Send request to solver"));
- unsigned long p = 0;
+ decltype(Cache.Head().PackageCount) p = 0;
string del, inst;
for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); Pkg.end() == false; ++Pkg, ++p)
{
@@ -618,8 +618,8 @@ bool EDSP::ReadResponse(int const input, pkgDepCache &Cache, OpProgress *Progres
In theory we could use the offset as ID, but then VersionCount
couldn't be used to create other versionmappings anymore and it
would be too easy for a (buggy) solver to segfault APT… */
- unsigned long long const VersionCount = Cache.Head().VersionCount;
- unsigned long VerIdx[VersionCount];
+ auto VersionCount = Cache.Head().VersionCount;
+ decltype(VersionCount) VerIdx[VersionCount];
for (pkgCache::PkgIterator P = Cache.PkgBegin(); P.end() == false; ++P) {
for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; ++V)
VerIdx[V->ID] = V.Index();
@@ -675,11 +675,11 @@ bool EDSP::ReadResponse(int const input, pkgDepCache &Cache, OpProgress *Progres
continue;
}
- size_t const id = section.FindULL(type.c_str(), VersionCount);
+ decltype(VersionCount) const id = section.FindULL(type.c_str(), VersionCount);
if (id == VersionCount) {
_error->Warning("Unable to parse %s request with id value '%s'!", type.c_str(), section.FindS(type.c_str()).c_str());
continue;
- } else if (id > Cache.Head().VersionCount) {
+ } else if (id > VersionCount) {
_error->Warning("ID value '%s' in %s request stanza is to high to refer to a known version!", section.FindS(type.c_str()).c_str(), type.c_str());
continue;
}
@@ -1163,7 +1163,7 @@ bool EIPP::WriteRequest(pkgDepCache &Cache, FileFd &output, /*{{{*/
{
if (Progress != NULL)
Progress->SubProgress(Cache.Head().PackageCount, _("Send request to planner"));
- unsigned long p = 0;
+ decltype(Cache.Head().PackageCount) p = 0;
string del, inst, reinst;
for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); Pkg.end() == false; ++Pkg, ++p)
{
@@ -1253,7 +1253,7 @@ bool EIPP::WriteScenario(pkgDepCache &Cache, FileFd &output, OpProgress * const
{
if (Progress != NULL)
Progress->SubProgress(Cache.Head().PackageCount, _("Send scenario to planner"));
- unsigned long p = 0;
+ decltype(Cache.Head().PackageCount) p = 0;
bool Okay = output.Failed() == false;
std::vector<std::string> archs = APT::Configuration::getArchitectures();
std::vector<bool> pkgset(Cache.Head().PackageCount, false);
@@ -1328,8 +1328,8 @@ bool EIPP::ReadResponse(int const input, pkgPackageManager * const PM, OpProgres
In theory we could use the offset as ID, but then VersionCount
couldn't be used to create other versionmappings anymore and it
would be too easy for a (buggy) solver to segfault APT… */
- unsigned long long const VersionCount = PM->Cache.Head().VersionCount;
- unsigned long VerIdx[VersionCount];
+ auto VersionCount = PM->Cache.Head().VersionCount;
+ decltype(VersionCount) VerIdx[VersionCount];
for (pkgCache::PkgIterator P = PM->Cache.PkgBegin(); P.end() == false; ++P) {
for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; ++V)
VerIdx[V->ID] = V.Index();
@@ -1384,11 +1384,11 @@ bool EIPP::ReadResponse(int const input, pkgPackageManager * const PM, OpProgres
if (type == nullptr)
continue;
- size_t const id = section.FindULL(type, VersionCount);
+ decltype(VersionCount) const id = section.FindULL(type, VersionCount);
if (id == VersionCount) {
_error->Warning("Unable to parse %s request with id value '%s'!", type, section.FindS(type).c_str());
continue;
- } else if (id > PM->Cache.Head().VersionCount) {
+ } else if (id > VersionCount) {
_error->Warning("ID value '%s' in %s request stanza is to high to refer to a known version!", section.FindS(type).c_str(), type);
continue;
}