X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/38d2959ffb8c6f5f291b2910014a67b1b352ab4c..9d02c1ac77717a2a8055e56dad4974abb15c800b:/apt-pkg/cacheiterators.h diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index 2fdf8404d..12a03eb07 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -159,8 +159,12 @@ class pkgCache::PkgIterator: public Iterator { enum OkState {NeedsNothing,NeedsUnpack,NeedsConfigure}; // Accessors - inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;} - inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;} + inline const char *Name() const { return Group().Name(); } + // Versions have sections - and packages can have different versions with different sections + // so this interface is broken by design. It used to return the section of the "first parsed + // package stanza", but as this can potentially be anything it now returns the section of the + // newest version instead (if any). aka: Run as fast as you can to Version.Section(). + APT_DEPRECATED const char *Section() const; inline bool Purge() const {return S->CurrentState == pkgCache::State::Purge || (S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);} inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;} @@ -332,7 +336,7 @@ class pkgCache::PrvIterator : public Iterator { inline void operator ++() {operator ++(0);} // Accessors - inline const char *Name() const {return Owner->StrP + Owner->PkgP[S->ParentPkg].Name;} + inline const char *Name() const {return ParentPkg().Name();} inline const char *ProvideVersion() const {return S->ProvideVersion == 0?0:Owner->StrP + S->ProvideVersion;} inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);} inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);}