summaryrefslogtreecommitdiff
path: root/apt-pkg/policy.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-04-25 16:30:43 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-04-25 16:30:43 +0200
commitfd2e438b24f4ce153ee35a691ae5bcb7eb28cc98 (patch)
tree4fbbb481a8d3f93479041df67f0a86dd0e5342d1 /apt-pkg/policy.cc
parent69cea1ef2cfda3c4da79fd756a8edaf2be26998e (diff)
restore pinning to min/max value of short
Broken in the previous commit (69cea1ef2cfda3c4da79fd756a8edaf2be26998e). Adding a test and a comment to avoid future embarrassment. Git-Dch: Ignore Reported-By: Julian Andres Klode on IRC
Diffstat (limited to 'apt-pkg/policy.cc')
-rw-r--r--apt-pkg/policy.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index 7c57f9dea..7059b0a79 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -374,7 +374,8 @@ APT_PURE signed short pkgPolicy::GetPriority(pkgCache::VerIterator const &Ver, b
if (!ConsiderFiles)
return 0;
- signed short priority = std::numeric_limits<signed short>::min();
+ // priorities are short ints, but we want to pick a value outside the valid range here
+ auto priority = std::numeric_limits<signed int>::min();
for (pkgCache::VerFileIterator file = Ver.FileList(); file.end() == false; file++)
{
/* If this is the status file, and the current version is not the
@@ -385,7 +386,7 @@ APT_PURE signed short pkgPolicy::GetPriority(pkgCache::VerIterator const &Ver, b
if (file.File().Flagged(pkgCache::Flag::NotSource) && Ver.ParentPkg().CurrentVer() != Ver)
priority = std::max(priority, static_cast<decltype(priority)>(-1));
else
- priority = std::max(priority, GetPriority(file.File()));
+ priority = std::max(priority, static_cast<decltype(priority)>(GetPriority(file.File())));
}
return priority == std::numeric_limits<decltype(priority)>::min() ? 0 : priority;