From 4fad7262291a8af1415fb9a3693678bd9610f0d6 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 24 Feb 2020 17:46:10 +0100 Subject: Make map_pointer typesafe Instead of just using uint32_t, which would allow you to assign e.g. a map_pointer to a map_pointer, 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. --- apt-pkg/deb/deblistparser.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg/deb/deblistparser.cc') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index eaa9dfda9..ab957a01a 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -208,7 +208,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver) // Link into by source package group. Ver->SourcePkgName = G->Name; Ver->NextInSource = G->VersionsInSource; - G->VersionsInSource = Ver.Index(); + G->VersionsInSource = Ver.MapPointer(); Ver->MultiArch = ParseMultiArch(true); // Archive Size @@ -469,7 +469,7 @@ bool debStatusListParser::ParseStatus(pkgCache::PkgIterator &Pkg, if (Ver.end() == true) _error->Warning("Encountered status field in a non-version description"); else - Pkg->CurrentVer = Ver.Index(); + Pkg->CurrentVer = Ver.MapPointer(); } return true; -- cgit v1.2.3