summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2020-02-24 17:46:10 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2020-02-24 18:29:07 +0100
commit4fad7262291a8af1415fb9a3693678bd9610f0d6 (patch)
tree39226545753b5f0910547747fb5c691398c7341a /cmdline
parent1f4e2ab7462f5e05e452fb8505185895d91651c2 (diff)
Make map_pointer<T> typesafe
Instead of just using uint32_t, which would allow you to assign e.g. a map_pointer<Version> to a map_pointer<Package>, use our own smarter struct that has strict type checking. We allow creating a map_pointer from a nullptr, and we allow comparing map_pointer to nullptr, which also deals with comparisons against 0 which are often used, as 0 will be implictly converted to nullptr.
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-cache.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 2d6c1a91e..23ab7e47f 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -467,7 +467,7 @@ static bool DumpAvail(CommandLine &)
char *Buffer = new char[Cache->HeaderP->MaxVerFileSize+10];
for (pkgCache::VerFile **J = VFList; *J != 0;)
{
- pkgCache::PkgFileIterator File(*Cache,(*J)->File + Cache->PkgFileP);
+ pkgCache::PkgFileIterator File(*Cache, Cache->PkgFileP + (*J)->File);
// FIXME: Add support for volatile/with-source files
FileFd PkgF(File.FileName(),FileFd::ReadOnly, FileFd::Extension);
if (_error->PendingError() == true)
@@ -481,7 +481,7 @@ static bool DumpAvail(CommandLine &)
unsigned long Pos = 0;
for (; *J != 0; J++)
{
- if ((*J)->File + Cache->PkgFileP != File)
+ if (Cache->PkgFileP + (*J)->File != File)
break;
const pkgCache::VerFile &VF = **J;