X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/012b102ad1baf9f24601cbec6365fe43aad2d521..f8477782df203e1998a8704e71a1a3cc699e9e3a:/apt-pkg/pkgcache.cc?ds=sidebyside diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 4452079a2..9926befe9 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -26,7 +26,6 @@ #endif #include -#include #include #include #include @@ -44,7 +43,6 @@ using std::string; - // Cache::Header::Header - Constructor /*{{{*/ // --------------------------------------------------------------------- /* Simply initialize the header */ @@ -54,7 +52,7 @@ pkgCache::Header::Header() /* Whenever the structures change the major version should be bumped, whenever the generator changes the minor version should be bumped. */ - MajorVersion = 5; + MajorVersion = 4; MinorVersion = 0; Dirty = false; @@ -62,22 +60,17 @@ pkgCache::Header::Header() PackageSz = sizeof(pkgCache::Package); PackageFileSz = sizeof(pkgCache::PackageFile); VersionSz = sizeof(pkgCache::Version); - DescriptionSz = sizeof(pkgCache::Description); DependencySz = sizeof(pkgCache::Dependency); ProvidesSz = sizeof(pkgCache::Provides); VerFileSz = sizeof(pkgCache::VerFile); - DescFileSz = sizeof(pkgCache::DescFile); PackageCount = 0; VersionCount = 0; - DescriptionCount = 0; DependsCount = 0; PackageFileCount = 0; VerFileCount = 0; - DescFileCount = 0; ProvidesCount = 0; MaxVerFileSize = 0; - MaxDescFileSize = 0; FileList = 0; StringList = 0; @@ -96,10 +89,8 @@ bool pkgCache::Header::CheckSizes(Header &Against) const PackageSz == Against.PackageSz && PackageFileSz == Against.PackageFileSz && VersionSz == Against.VersionSz && - DescriptionSz == Against.DescriptionSz && DependencySz == Against.DependencySz && VerFileSz == Against.VerFileSz && - DescFileSz == Against.DescFileSz && ProvidesSz == Against.ProvidesSz) return true; return false; @@ -124,10 +115,8 @@ bool pkgCache::ReMap() HeaderP = (Header *)Map.Data(); PkgP = (Package *)Map.Data(); VerFileP = (VerFile *)Map.Data(); - DescFileP = (DescFile *)Map.Data(); PkgFileP = (PackageFile *)Map.Data(); VerP = (Version *)Map.Data(); - DescP = (Description *)Map.Data(); ProvideP = (Provides *)Map.Data(); DepP = (Dependency *)Map.Data(); StringItemP = (StringItem *)Map.Data(); @@ -164,7 +153,7 @@ bool pkgCache::ReMap() /* This is used to generate the hash entries for the HashTable. With my package list from bo this function gets 94% table usage on a 512 item table (480 used items) */ -unsigned long pkgCache::sHash(string Str) const +unsigned long pkgCache::sHash(const string &Str) const { unsigned long Hash = 0; for (string::const_iterator I = Str.begin(); I != Str.end(); I++) @@ -184,7 +173,7 @@ unsigned long pkgCache::sHash(const char *Str) const // Cache::FindPkg - Locate a package by name /*{{{*/ // --------------------------------------------------------------------- /* Returns 0 on error, pointer to the package otherwise */ -pkgCache::PkgIterator pkgCache::FindPkg(string Name) +pkgCache::PkgIterator pkgCache::FindPkg(const string &Name) { // Look at the hash bucket Package *Pkg = PkgP + HeaderP->HashTable[Hash(Name)]; @@ -246,11 +235,11 @@ const char *pkgCache::Priority(unsigned char Prio) return 0; } /*}}}*/ + // Bases for iterator classes /*{{{*/ void pkgCache::VerIterator::_dummy() {} void pkgCache::DepIterator::_dummy() {} void pkgCache::PrvIterator::_dummy() {} -void pkgCache::DescIterator::_dummy() {} /*}}}*/ // PkgIterator::operator ++ - Postfix incr /*{{{*/ // --------------------------------------------------------------------- @@ -610,20 +599,3 @@ string pkgCache::PkgFileIterator::RelStr() return Res; } /*}}}*/ -// VerIterator::TranslatedDescription - Return the a DescIter for locale/*{{{*/ -// --------------------------------------------------------------------- -/* return a DescIter for the current locale or the default if none is - * found - */ -pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const -{ - pkgCache::DescIterator DescDefault = DescriptionList(); - pkgCache::DescIterator Desc = DescDefault; - for (; Desc.end() == false; Desc++) - if (pkgIndexFile::LanguageCode() == Desc.LanguageCode()) - break; - if (Desc.end() == true) Desc = DescDefault; - return Desc; -}; - - /*}}}*/