X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/af87ab54430b31a0e1840b2c1673c07d74813447..5d47e7e8587e693050f4d6d39c7d496f12bc49b3:/apt-pkg/pkgcache.cc diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index fa231ef37..6ef7cafb0 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: pkgcache.cc,v 1.34 2001/04/29 05:13:51 jgg Exp $ +// $Id: pkgcache.cc,v 1.37 2003/02/10 01:40:58 doogie Exp $ /* ###################################################################### Package Cache - Accessor code for the cache @@ -37,10 +37,12 @@ #include #include +#include #include - /*}}}*/ +using std::string; + // Cache::Header::Header - Constructor /*{{{*/ // --------------------------------------------------------------------- /* Simply initialize the header */ @@ -50,8 +52,8 @@ pkgCache::Header::Header() /* Whenever the structures change the major version should be bumped, whenever the generator changes the minor version should be bumped. */ - MajorVersion = 3; - MinorVersion = 5; + MajorVersion = 4; + MinorVersion = 0; Dirty = false; HeaderSz = sizeof(pkgCache::Header); @@ -137,12 +139,12 @@ bool pkgCache::ReMap() // Locate our VS.. if (HeaderP->VerSysName == 0 || (VS = pkgVersioningSystem::GetVS(StrP + HeaderP->VerSysName)) == 0) - return _error->Error(_("This APT does not support the Versioning System '%s'"),StrP + HeaderP->VerSysName); + return _error->Error(_("This APT does not support the versioning system '%s'"),StrP + HeaderP->VerSysName); // Chcek the arhcitecture if (HeaderP->Architecture == 0 || _config->Find("APT::Architecture") != StrP + HeaderP->Architecture) - return _error->Error(_("The package cache was build for a different architecture")); + return _error->Error(_("The package cache was built for a different architecture")); return true; } /*}}}*/ @@ -154,7 +156,7 @@ bool pkgCache::ReMap() unsigned long pkgCache::sHash(string Str) const { unsigned long Hash = 0; - for (const char *I = Str.begin(); I != Str.end(); I++) + for (string::const_iterator I = Str.begin(); I != Str.end(); I++) Hash = 5*Hash + tolower(*I); return Hash % _count(HeaderP->HashTable); } @@ -178,7 +180,7 @@ pkgCache::PkgIterator pkgCache::FindPkg(string Name) for (; Pkg != PkgP; Pkg = PkgP + Pkg->NextPackage) { if (Pkg->Name != 0 && StrP[Pkg->Name] == Name[0] && - stringcasecmp(Name.begin(),Name.end(),StrP + Pkg->Name) == 0) + stringcasecmp(Name,StrP + Pkg->Name) == 0) return PkgIterator(*this,Pkg); } return PkgIterator(*this,0);