X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/4fc6b7570c3e97b65c118b58cdf6729fa94c9b03..6c55f07a5fa3612a5d59c61a17da5fe640eadc8b:/apt-pkg/indexrecords.cc diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc index de2617833..5a93d826f 100644 --- a/apt-pkg/indexrecords.cc +++ b/apt-pkg/indexrecords.cc @@ -42,7 +42,7 @@ APT_PURE bool indexRecords::GetSupportsAcquireByHash() const return this->SupportsAcquireByHash; } -APT_PURE bool indexRecords::CheckDist(const string MaybeDist) const +APT_PURE bool indexRecords::CheckDist(string const &MaybeDist) const { return (this->Dist == MaybeDist || this->Suite == MaybeDist); @@ -63,7 +63,7 @@ APT_PURE time_t indexRecords::GetDate() const return this->Date; } -APT_PURE indexRecords::checkSum *indexRecords::Lookup(const string MetaKey) +APT_PURE indexRecords::checkSum *indexRecords::Lookup(string const &MetaKey) { std::map::const_iterator sum = Entries.find(MetaKey); if (sum == Entries.end()) @@ -73,10 +73,10 @@ APT_PURE indexRecords::checkSum *indexRecords::Lookup(const string MetaKey) APT_PURE bool indexRecords::Exists(string const &MetaKey) const { - return Entries.count(MetaKey) == 1; + return Entries.find(MetaKey) != Entries.end(); } -bool indexRecords::Load(const string Filename) /*{{{*/ +bool indexRecords::Load(string const &Filename) /*{{{*/ { FileFd Fd; if (OpenMaybeClearSignedFile(Filename, Fd) == false) @@ -121,9 +121,7 @@ bool indexRecords::Load(const string Filename) /*{{{*/ indexRecords::checkSum *Sum = new indexRecords::checkSum; Sum->MetaKeyFilename = Name; Sum->Size = Size; - std::string SizeStr; - strprintf(SizeStr, "%llu", Size); - Sum->Hashes.push_back(HashString("Checksum-FileSize", SizeStr)); + Sum->Hashes.FileSize(Size); APT_IGNORE_DEPRECATED(Sum->Hash = HashString(HashString::SupportedHashes()[i],Hash);) Entries[Name] = Sum; } @@ -274,23 +272,10 @@ void indexRecords::SetTrusted(bool const Trusted) this->Trusted = NEVER_TRUSTED; } -#if APT_PKG_ABI >= 413 indexRecords::indexRecords(const string &ExpectedDist) : Trusted(CHECK_TRUST), d(NULL), ExpectedDist(ExpectedDist), ValidUntil(0), SupportsAcquireByHash(false) { } -#else -indexRecords::indexRecords() : - Trusted(CHECK_TRUST), d(NULL), ExpectedDist(""), ValidUntil(0), - SupportsAcquireByHash(false) -{ -} -indexRecords::indexRecords(const string ExpectedDist) : - Trusted(CHECK_TRUST), d(NULL), ExpectedDist(ExpectedDist), ValidUntil(0), - SupportsAcquireByHash(false) -{ -} -#endif indexRecords::~indexRecords() {}