From c2fb49ca1783b9ea2dd8b7cb90a2284750076c65 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Tue, 31 Jan 2017 05:53:50 -0800 Subject: Port TagIterator to correctly support ReMap (doh). --- apt-pkg/pkgcachegen.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'apt-pkg/pkgcachegen.cc') diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 8ee682db8..7152f04e2 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -175,6 +175,10 @@ void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newM i != Dynamic::toReMap.end(); ++i) if (std::get<1>(seen.insert(*i)) == true) (*i)->ReMap(oldMap, newMap); + for (std::vector::const_iterator i = Dynamic::toReMap.begin(); + i != Dynamic::toReMap.end(); ++i) + if (std::get<1>(seen.insert(*i)) == true) + (*i)->ReMap(oldMap, newMap); for (std::vector::const_iterator i = Dynamic::toReMap.begin(); i != Dynamic::toReMap.end(); ++i) if (std::get<1>(seen.insert(*i)) == true) @@ -1290,18 +1294,20 @@ bool pkgCacheGenerator::NewTag(pkgCache::VerIterator &Ver, unsigned int NameSize) { // Get a structure - unsigned long Tagg = AllocateInMap(sizeof(pkgCache::Tag)); - if (Tagg == 0) + map_pointer_t const idxTag = AllocateInMap(sizeof(pkgCache::Tag)); + if (unlikely(idxTag == 0)) return false; - Cache.HeaderP->TagCount++; // Fill it in - pkgCache::TagIterator Tg(Cache,Cache.TagP + Tagg); - Tg->Name = WriteStringInMap(NameStart,NameSize); - if (Tg->Name == 0) + pkgCache::TagIterator Tg(Cache,Cache.TagP + idxTag); + map_pointer_t const idxName = WriteStringInMap(NameStart,NameSize); + if (idxName == 0) return false; + Tg->Name = idxName; + Tg->NextTag = Ver->TagList; Ver->TagList = Tg.Index(); + Cache.HeaderP->TagCount++; return true; } -- cgit v1.2.3