// Cache::pkgCache - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
// Cache::pkgCache - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
pkgCache::pkgCache(MMap *Map, bool DoMap) : Map(*Map)
{
// call getArchitectures() with cached=false to ensure that the
pkgCache::pkgCache(MMap *Map, bool DoMap) : Map(*Map)
{
// call getArchitectures() with cached=false to ensure that the
/*}}}*/
// Cache::ReMap - Reopen the cache file /*{{{*/
// ---------------------------------------------------------------------
/*}}}*/
// Cache::ReMap - Reopen the cache file /*{{{*/
// ---------------------------------------------------------------------
if (Map.Size() < HeaderP->CacheFileSize)
return _error->Error(_("The package cache file is corrupted, it is too small"));
if (Map.Size() < HeaderP->CacheFileSize)
return _error->Error(_("The package cache file is corrupted, it is too small"));
for (++a; a != archs.end(); ++a)
list.append(",").append(*a);
if (_config->Find("APT::Architecture") != StrP + HeaderP->Architecture ||
for (++a; a != archs.end(); ++a)
list.append(",").append(*a);
if (_config->Find("APT::Architecture") != StrP + HeaderP->Architecture ||
- list != StrP + HeaderP->Architectures)
- return _error->Error(_("The package cache was built for different architectures: %s vs %s"), StrP + HeaderP->Architectures, list.c_str());
+ list != StrP + HeaderP->GetArchitectures())
+ return _error->Error(_("The package cache was built for different architectures: %s vs %s"), StrP + HeaderP->GetArchitectures(), list.c_str());
unsigned long Hash = 0;
for (string::const_iterator I = Str.begin(); I != Str.end(); ++I)
Hash = 41 * Hash + tolower_ascii(*I);
unsigned long Hash = 0;
for (string::const_iterator I = Str.begin(); I != Str.end(); ++I)
Hash = 41 * Hash + tolower_ascii(*I);
unsigned long Hash = tolower_ascii(*Str);
for (const char *I = Str + 1; *I != 0; ++I)
Hash = 41 * Hash + tolower_ascii(*I);
unsigned long Hash = tolower_ascii(*Str);
for (const char *I = Str + 1; *I != 0; ++I)
Hash = 41 * Hash + tolower_ascii(*I);
- Package *Pkg = PkgP + HeaderP->PkgHashTable()[Hash(Name)];
- for (; Pkg != PkgP; Pkg = PkgP + Pkg->Next)
+ Package *Pkg = PkgP + HeaderP->PkgHashTableP()[Hash(Name)];
+ for (; Pkg != PkgP; Pkg = PkgP + Pkg->NextPackage)
return GrpIterator(*this,0);
// Look at the hash bucket for the group
return GrpIterator(*this,0);
// Look at the hash bucket for the group
for (; Grp != GrpP; Grp = GrpP + Grp->Next) {
int const cmp = strcmp(Name.c_str(), StrP + Grp->Name);
if (cmp == 0)
for (; Grp != GrpP; Grp = GrpP + Grp->Next) {
int const cmp = strcmp(Name.c_str(), StrP + Grp->Name);
if (cmp == 0)
// Iterate over the list to find the matching arch
for (pkgCache::Package *Pkg = PackageList(); Pkg != Owner->PkgP;
// Iterate over the list to find the matching arch
for (pkgCache::Package *Pkg = PackageList(); Pkg != Owner->PkgP;
if (stringcmp(Arch, Owner->StrP + Pkg->Arch) == 0)
return PkgIterator(*Owner, Pkg);
if ((Owner->PkgP + S->LastPackage) == Pkg)
if (stringcmp(Arch, Owner->StrP + Pkg->Arch) == 0)
return PkgIterator(*Owner, Pkg);
if ((Owner->PkgP + S->LastPackage) == Pkg)
if (S->LastPackage == LastPkg.Index())
return PkgIterator(*Owner, 0);
if (S->LastPackage == LastPkg.Index())
return PkgIterator(*Owner, 0);