/* Whenever the structures change the major version should be bumped,
whenever the generator changes the minor version should be bumped. */
- APT_HEADER_SET(MajorVersion, 10);
- APT_HEADER_SET(MinorVersion, 4);
+ APT_HEADER_SET(MajorVersion, 11);
+ APT_HEADER_SET(MinorVersion, 0);
APT_HEADER_SET(Dirty, false);
APT_HEADER_SET(HeaderSz, sizeof(pkgCache::Header));
// ---------------------------------------------------------------------
/* */
APT_IGNORE_DEPRECATED_PUSH
-pkgCache::pkgCache(MMap *Map, bool DoMap) : Map(*Map), d(NULL)
+pkgCache::pkgCache(MMap *Map, bool DoMap) : Map(*Map), VS(nullptr), d(NULL)
{
// call getArchitectures() with cached=false to ensure that the
// architectures cache is re-evaulated. this is needed in cases
// Check the architecture
std::vector<std::string> archs = APT::Configuration::getArchitectures();
- std::vector<std::string>::const_iterator a = archs.begin();
- std::string list = *a;
- for (++a; a != archs.end(); ++a)
- list.append(",").append(*a);
+ std::string list = "";
+ for (auto const & arch : archs) {
+ if (!list.empty())
+ list.append(",");
+ list.append(arch);
+ }
if (_config->Find("APT::Architecture") != StrP + HeaderP->Architecture ||
list != StrP + HeaderP->GetArchitectures())
return _error->Error(_("The package cache was built for different architectures: %s vs %s"), StrP + HeaderP->GetArchitectures(), list.c_str());
{
uint32_t Hash = 5381;
for (auto I = Str.begin(); I != Str.end(); ++I)
- Hash = 33 * Hash + tolower_ascii(*I);
+ Hash = 33 * Hash + tolower_ascii_unsafe(*I);
return Hash % HeaderP->GetHashTableSize();
}
map_id_t pkgCache::sHash(const string &Str) const
{
uint32_t Hash = 5381;
for (string::const_iterator I = Str.begin(); I != Str.end(); ++I)
- Hash = 33 * Hash + tolower_ascii((signed char)*I);
+ Hash = 33 * Hash + tolower_ascii_unsafe((signed char)*I);
return Hash % HeaderP->GetHashTableSize();
}
{
uint32_t Hash = 5381;
for (const char *I = Str; *I != 0; ++I)
- Hash = 33 * Hash + tolower_ascii((signed char)*I);
+ Hash = 33 * Hash + tolower_ascii_unsafe((signed char)*I);
return Hash % HeaderP->GetHashTableSize();
}
}
pkgCache::PkgIterator pkgCache::FindPkg(StringView Name) {
- auto const found = Name.find(':');
+ auto const found = Name.rfind(':');
if (found == string::npos)
return FindPkg(Name, "native");
auto const Arch = Name.substr(found+1);
// Look at the hash bucket for the group
Group *Grp = GrpP + HeaderP->GrpHashTableP()[sHash(Name)];
for (; Grp != GrpP; Grp = GrpP + Grp->Next) {
- int const cmp = Name.compare(ViewString(Grp->Name));
+ int const cmp = StringViewCompareFast(Name, ViewString(Grp->Name));
if (cmp == 0)
return GrpIterator(*this, Grp);
else if (cmp < 0)
if (S->CurrentState == pkgCache::State::UnPacked ||
S->CurrentState == pkgCache::State::HalfConfigured)
- // we leave triggers alone complettely. dpkg deals with
+ // we leave triggers alone completely. dpkg deals with
// them in a hard-to-predict manner and if they get
// resolved by dpkg before apt run dpkg --configure on
// the TriggersPending package dpkg returns a error
return out << "invalid package";
string current = string(Pkg.CurVersion() == 0 ? "none" : Pkg.CurVersion());
+APT_IGNORE_DEPRECATED_PUSH
string candidate = string(Pkg.CandVersion() == 0 ? "none" : Pkg.CandVersion());
+APT_IGNORE_DEPRECATED_POP
string newest = string(Pkg.VersionList().end() ? "none" : Pkg.VersionList().VerStr());
out << Pkg.Name() << " [ " << Pkg.Arch() << " ] < " << current;
return false;
}
/*}}}*/
-// ostream operator to handle string representation of a dependecy /*{{{*/
+// ostream operator to handle string representation of a dependency /*{{{*/
// ---------------------------------------------------------------------
/* */
std::ostream& operator<<(std::ostream& out, pkgCache::DepIterator D)
out << (P.end() ? "invalid pkg" : P.FullName(false)) << " " << D.DepType()
<< " on ";
+APT_IGNORE_DEPRECATED_PUSH
if (T.end() == true)
out << "invalid pkg";
else
out << T;
+APT_IGNORE_DEPRECATED_POP
if (D->Version != 0)
out << " (" << D.CompType() << " " << D.TargetVer() << ")";