summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc10
-rw-r--r--apt-pkg/acquire-item.h214
-rw-r--r--apt-pkg/algorithms.h10
-rw-r--r--apt-pkg/cachefilter.h64
-rw-r--r--apt-pkg/cacheset.h25
-rw-r--r--apt-pkg/contrib/fileutl.cc467
-rw-r--r--apt-pkg/contrib/macros.h16
-rw-r--r--apt-pkg/contrib/progress.h4
-rw-r--r--apt-pkg/deb/debfile.h11
-rw-r--r--apt-pkg/deb/debindexfile.cc10
-rw-r--r--apt-pkg/deb/debindexfile.h114
-rw-r--r--apt-pkg/deb/deblistparser.h46
-rw-r--r--apt-pkg/deb/debmetaindex.cc4
-rw-r--r--apt-pkg/deb/debmetaindex.h30
-rw-r--r--apt-pkg/deb/debrecords.h40
-rw-r--r--apt-pkg/deb/debsrcrecords.h27
-rw-r--r--apt-pkg/deb/debsystem.h20
-rw-r--r--apt-pkg/deb/debversion.h12
-rw-r--r--apt-pkg/deb/dpkgpm.h14
-rw-r--r--apt-pkg/depcache.cc4
-rw-r--r--apt-pkg/depcache.h4
-rw-r--r--apt-pkg/edsp/edspindexfile.cc16
-rw-r--r--apt-pkg/edsp/edspindexfile.h32
-rw-r--r--apt-pkg/edsp/edsplistparser.h18
-rw-r--r--apt-pkg/edsp/edspsystem.h40
-rw-r--r--apt-pkg/indexcopy.h22
-rw-r--r--apt-pkg/indexfile.h47
-rw-r--r--apt-pkg/install-progress.h95
-rw-r--r--apt-pkg/policy.h6
-rw-r--r--apt-pkg/solver3.cc4
30 files changed, 713 insertions, 713 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 69644883b..afd81b944 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -727,8 +727,8 @@ class APT_HIDDEN NoActionItem final : public pkgAcquire::Item /*{{{*/
{
IndexTarget const Target;
public:
- virtual std::string DescURI() const APT_OVERRIDE {return Target.URI;};
- virtual HashStringList GetExpectedHashes() const APT_OVERRIDE {return HashStringList();};
+ [[nodiscard]] std::string DescURI() const override {return Target.URI;};
+ [[nodiscard]] HashStringList GetExpectedHashes() const override {return {};};
NoActionItem(pkgAcquire * const Owner, IndexTarget const &Target) :
pkgAcquire::Item(Owner), Target(Target)
@@ -751,8 +751,8 @@ class APT_HIDDEN CleanupItem final : public pkgAcqTransactionItem /*{{{*/
even if the lists-cleanup is deactivated. */
{
public:
- virtual std::string DescURI() const APT_OVERRIDE {return Target.URI;};
- virtual HashStringList GetExpectedHashes() const APT_OVERRIDE {return HashStringList();};
+ [[nodiscard]] std::string DescURI() const override {return Target.URI;};
+ [[nodiscard]] HashStringList GetExpectedHashes() const override {return {};};
CleanupItem(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager, IndexTarget const &Target) :
pkgAcqTransactionItem(Owner, TransactionManager, Target)
@@ -760,7 +760,7 @@ class APT_HIDDEN CleanupItem final : public pkgAcqTransactionItem /*{{{*/
Status = StatDone;
DestFile = GetFinalFileNameFromURI(Target.URI);
}
- bool TransactionState(TransactionStates const state) APT_OVERRIDE
+ bool TransactionState(TransactionStates const state) override
{
switch (state)
{
diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h
index 70620163a..5861d48be 100644
--- a/apt-pkg/acquire-item.h
+++ b/apt-pkg/acquire-item.h
@@ -212,7 +212,7 @@ class APT_PUBLIC pkgAcquire::Item : public WeakPointable /*{{{*/
* \sa pkgAcqMethod
*/
virtual void Done(std::string const &Message, HashStringList const &Hashes,
- pkgAcquire::MethodConfig const * const Cnf);
+ pkgAcquire::MethodConfig const *const Cnf);
/** \brief Invoked when the worker starts to fetch this object.
*
@@ -372,7 +372,7 @@ class APT_HIDDEN pkgAcqTransactionItem: public pkgAcquire::Item /*{{{*/
protected:
HashStringList GetExpectedHashesFor(std::string const &MetaKey) const;
- bool QueueURI(pkgAcquire::ItemDesc &Item) APT_OVERRIDE;
+ bool QueueURI(pkgAcquire::ItemDesc &Item) override;
public:
IndexTarget const Target;
@@ -390,14 +390,14 @@ class APT_HIDDEN pkgAcqTransactionItem: public pkgAcquire::Item /*{{{*/
};
virtual bool TransactionState(TransactionStates const state);
- virtual std::string DescURI() const APT_OVERRIDE { return Target.URI; }
- virtual HashStringList GetExpectedHashes() const APT_OVERRIDE;
- virtual std::string GetMetaKey() const;
- virtual bool HashesRequired() const APT_OVERRIDE;
- virtual bool AcquireByHash() const;
+ [[nodiscard]] std::string DescURI() const override { return Target.URI; }
+ [[nodiscard]] HashStringList GetExpectedHashes() const override;
+ [[nodiscard]] virtual std::string GetMetaKey() const;
+ [[nodiscard]] bool HashesRequired() const override;
+ [[nodiscard]] virtual bool AcquireByHash() const;
pkgAcqTransactionItem(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager, IndexTarget const &Target) APT_NONNULL(2, 3);
- virtual ~pkgAcqTransactionItem();
+ ~pkgAcqTransactionItem() override;
friend class pkgAcqMetaBase;
friend class pkgAcqMetaClearSig;
@@ -428,7 +428,7 @@ class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem /*{{{*/
/** \brief Queue the downloaded Signature for verification */
void QueueForSignatureVerify(pkgAcqTransactionItem * const I, std::string const &File, std::string const &Signature);
- virtual std::string Custom600Headers() const APT_OVERRIDE;
+ [[nodiscard]] std::string Custom600Headers() const override;
/** \brief Called when authentication succeeded.
*
@@ -452,7 +452,7 @@ class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem /*{{{*/
*/
bool VerifyVendor(std::string const &Message);
- virtual bool TransactionState(TransactionStates const state) APT_OVERRIDE;
+ bool TransactionState(TransactionStates state) override;
public:
// This refers more to the Transaction-Manager than the actual file
@@ -460,9 +460,9 @@ class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem /*{{{*/
TransactionStates State;
std::string BaseURI;
- virtual bool QueueURI(pkgAcquire::ItemDesc &Item) APT_OVERRIDE;
- virtual HashStringList GetExpectedHashes() const APT_OVERRIDE;
- virtual bool HashesRequired() const APT_OVERRIDE;
+ bool QueueURI(pkgAcquire::ItemDesc &Item) override;
+ [[nodiscard]] HashStringList GetExpectedHashes() const override;
+ [[nodiscard]] bool HashesRequired() const override;
// transaction code
void Add(pkgAcqTransactionItem * const I);
@@ -480,11 +480,11 @@ class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem /*{{{*/
void TransactionStageRemoval(pkgAcqTransactionItem * const I, const std::string &FinalFile);
/** \brief Get the full pathname of the final file for the current URI */
- virtual std::string GetFinalFilename() const APT_OVERRIDE;
+ [[nodiscard]] std::string GetFinalFilename() const override;
pkgAcqMetaBase(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
IndexTarget const &DataTarget) APT_NONNULL(2, 3);
- virtual ~pkgAcqMetaBase();
+ ~pkgAcqMetaBase() override;
};
/*}}}*/
/** \brief An item that is responsible for downloading the meta-index {{{
@@ -507,17 +507,17 @@ class APT_HIDDEN pkgAcqMetaIndex : public pkgAcqMetaBase
void Init(std::string const &URIDesc, std::string const &ShortDesc);
public:
- virtual std::string DescURI() const APT_OVERRIDE;
+ [[nodiscard]] std::string DescURI() const override;
// Specialized action members
- virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual void Done(std::string const &Message, HashStringList const &Hashes,
- pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
+ void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
+ void Done(std::string const &Message, HashStringList const &Hashes,
+ pkgAcquire::MethodConfig const *Cnf) override;
/** \brief Create a new pkgAcqMetaIndex. */
pkgAcqMetaIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
IndexTarget const &DataTarget, IndexTarget const &DetachedSigTarget) APT_NONNULL(2, 3);
- virtual ~pkgAcqMetaIndex();
+ ~pkgAcqMetaIndex() override;
friend class pkgAcqMetaSig;
};
@@ -542,21 +542,21 @@ class APT_HIDDEN pkgAcqMetaSig final : public pkgAcqTransactionItem
protected:
/** \brief Get the full pathname of the final file for the current URI */
- virtual std::string GetFinalFilename() const APT_OVERRIDE;
+ [[nodiscard]] std::string GetFinalFilename() const override;
public:
- virtual bool HashesRequired() const APT_OVERRIDE { return false; }
+ [[nodiscard]] bool HashesRequired() const override { return false; }
// Specialized action members
- virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual void Done(std::string const &Message, HashStringList const &Hashes,
- pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual std::string Custom600Headers() const APT_OVERRIDE;
+ void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
+ void Done(std::string const &Message, HashStringList const &Hashes,
+ pkgAcquire::MethodConfig const *Cnf) override;
+ [[nodiscard]] std::string Custom600Headers() const override;
/** \brief Create a new pkgAcqMetaSig. */
pkgAcqMetaSig(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
IndexTarget const &Target, pkgAcqMetaIndex * const MetaIndex) APT_NONNULL(2, 3, 5);
- virtual ~pkgAcqMetaSig();
+ ~pkgAcqMetaSig() override;
};
/*}}}*/
/** \brief An item responsible for downloading clearsigned metaindexes {{{*/
@@ -570,12 +570,12 @@ class APT_HIDDEN pkgAcqMetaClearSig final : public pkgAcqMetaIndex
metaIndex *MetaIndexParser;
metaIndex *LastMetaIndexParser;
- virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual std::string Custom600Headers() const APT_OVERRIDE;
- virtual bool VerifyDone(std::string const &Message, pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual void Done(std::string const &Message, HashStringList const &Hashes,
- pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual void Finished() APT_OVERRIDE;
+ void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
+ [[nodiscard]] std::string Custom600Headers() const override;
+ bool VerifyDone(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
+ void Done(std::string const &Message, HashStringList const &Hashes,
+ pkgAcquire::MethodConfig const *Cnf) override;
+ void Finished() override;
/** \brief Starts downloading the individual index files.
*
@@ -593,7 +593,7 @@ class APT_HIDDEN pkgAcqMetaClearSig final : public pkgAcqMetaIndex
IndexTarget const &DetachedDataTarget,
IndexTarget const &DetachedSigTarget,
metaIndex * const MetaIndexParser);
- virtual ~pkgAcqMetaClearSig();
+ ~pkgAcqMetaClearSig() override;
};
/*}}}*/
/** \brief Common base class for all classes that deal with fetching indexes {{{*/
@@ -603,12 +603,12 @@ class APT_HIDDEN pkgAcqBaseIndex : public pkgAcqTransactionItem
public:
/** \brief Get the full pathname of the final file for the current URI */
- virtual std::string GetFinalFilename() const APT_OVERRIDE;
- virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
+ [[nodiscard]] std::string GetFinalFilename() const override;
+ void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
pkgAcqBaseIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
IndexTarget const &Target) APT_NONNULL(2, 3);
- virtual ~pkgAcqBaseIndex();
+ ~pkgAcqBaseIndex() override;
};
/*}}}*/
/** \brief An acquire item that is responsible for fetching an index {{{
@@ -660,22 +660,22 @@ class APT_HIDDEN pkgAcqIndex : public pkgAcqBaseIndex
void InitByHashIfNeeded();
/** \brief Get the full pathname of the final file for the current URI */
- virtual std::string GetFinalFilename() const APT_OVERRIDE;
+ [[nodiscard]] std::string GetFinalFilename() const override;
- virtual bool TransactionState(TransactionStates const state) APT_OVERRIDE;
+ bool TransactionState(TransactionStates state) override;
public:
// Specialized action members
- virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual void Done(std::string const &Message, HashStringList const &Hashes,
- pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual std::string Custom600Headers() const APT_OVERRIDE;
- virtual std::string DescURI() const APT_OVERRIDE {return Desc.URI;};
- virtual std::string GetMetaKey() const APT_OVERRIDE;
+ void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
+ void Done(std::string const &Message, HashStringList const &Hashes,
+ pkgAcquire::MethodConfig const *Cnf) override;
+ [[nodiscard]] std::string Custom600Headers() const override;
+ [[nodiscard]] std::string DescURI() const override { return Desc.URI; };
+ [[nodiscard]] std::string GetMetaKey() const override;
pkgAcqIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
IndexTarget const &Target, bool const Derived = false) APT_NONNULL(2, 3);
- virtual ~pkgAcqIndex();
+ ~pkgAcqIndex() override;
protected:
APT_HIDDEN void Init(std::string const &URI, std::string const &URIDesc,
@@ -719,19 +719,20 @@ class APT_HIDDEN pkgAcqDiffIndex final : public pkgAcqIndex
bool Debug;
/** \brief Get the full pathname of the final file for the current URI */
- virtual std::string GetFinalFilename() const APT_OVERRIDE;
+ [[nodiscard]] std::string GetFinalFilename() const override;
- virtual bool QueueURI(pkgAcquire::ItemDesc &Item) APT_OVERRIDE;
+ bool QueueURI(pkgAcquire::ItemDesc &Item) override;
- virtual bool TransactionState(TransactionStates const state) APT_OVERRIDE;
- public:
+ bool TransactionState(TransactionStates state) override;
+
+ public:
// Specialized action members
- virtual void Failed(std::string const &Message, pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual bool VerifyDone(std::string const &Message, pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual void Done(std::string const &Message, HashStringList const &Hashes,
- pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual std::string DescURI() const APT_OVERRIDE {return Target.URI + "Index";};
- virtual std::string GetMetaKey() const APT_OVERRIDE;
+ void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
+ bool VerifyDone(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
+ void Done(std::string const &Message, HashStringList const &Hashes,
+ pkgAcquire::MethodConfig const *Cnf) override;
+ [[nodiscard]] std::string DescURI() const override { return Target.URI + "Index"; };
+ [[nodiscard]] std::string GetMetaKey() const override;
/** \brief Parse the Index file for a set of Packages diffs.
*
@@ -757,7 +758,7 @@ class APT_HIDDEN pkgAcqDiffIndex final : public pkgAcqIndex
*/
pkgAcqDiffIndex(pkgAcquire * const Owner, pkgAcqMetaClearSig * const TransactionManager,
IndexTarget const &Target) APT_NONNULL(2, 3);
- virtual ~pkgAcqDiffIndex();
+ ~pkgAcqDiffIndex() override;
private:
APT_HIDDEN void QueueOnIMSHit() const;
};
@@ -810,14 +811,14 @@ class APT_HIDDEN pkgAcqIndexMergeDiffs final : public pkgAcqBaseIndex
* This method will fall back to downloading the whole index file
* outright; its arguments are ignored.
*/
- virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual void Done(std::string const &Message, HashStringList const &Hashes,
- pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual std::string Custom600Headers() const APT_OVERRIDE;
- virtual std::string DescURI() const APT_OVERRIDE {return Target.URI + "Index";};
- virtual HashStringList GetExpectedHashes() const APT_OVERRIDE;
- virtual bool HashesRequired() const APT_OVERRIDE;
- virtual bool AcquireByHash() const APT_OVERRIDE;
+ void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
+ void Done(std::string const &Message, HashStringList const &Hashes,
+ pkgAcquire::MethodConfig const *Cnf) override;
+ [[nodiscard]] std::string Custom600Headers() const override;
+ [[nodiscard]] std::string DescURI() const override { return Target.URI + "Index"; };
+ [[nodiscard]] HashStringList GetExpectedHashes() const override;
+ [[nodiscard]] bool HashesRequired() const override;
+ [[nodiscard]] bool AcquireByHash() const override;
/** \brief Create an index merge-diff item.
*
@@ -834,7 +835,7 @@ class APT_HIDDEN pkgAcqIndexMergeDiffs final : public pkgAcqBaseIndex
pkgAcqIndexMergeDiffs(pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager,
IndexTarget const &Target, DiffInfo const &patch,
std::vector<pkgAcqIndexMergeDiffs *> const *const allPatches) APT_NONNULL(2, 3, 6);
- virtual ~pkgAcqIndexMergeDiffs();
+ ~pkgAcqIndexMergeDiffs() override;
};
/*}}}*/
/** \brief An item that is responsible for fetching server-merge patches {{{
@@ -910,15 +911,15 @@ class APT_HIDDEN pkgAcqIndexDiffs final : public pkgAcqBaseIndex
* This method will fall back to downloading the whole index file
* outright; its arguments are ignored.
*/
- virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
+ void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
- virtual void Done(std::string const &Message, HashStringList const &Hashes,
- pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual std::string Custom600Headers() const APT_OVERRIDE;
- virtual std::string DescURI() const APT_OVERRIDE {return Target.URI + "IndexDiffs";};
- virtual HashStringList GetExpectedHashes() const APT_OVERRIDE;
- virtual bool HashesRequired() const APT_OVERRIDE;
- virtual bool AcquireByHash() const APT_OVERRIDE;
+ void Done(std::string const &Message, HashStringList const &Hashes,
+ pkgAcquire::MethodConfig const * Cnf) override;
+ [[nodiscard]] std::string Custom600Headers() const override;
+ [[nodiscard]] std::string DescURI() const override { return Target.URI + "IndexDiffs"; };
+ [[nodiscard]] HashStringList GetExpectedHashes() const override;
+ [[nodiscard]] bool HashesRequired() const override;
+ [[nodiscard]] bool AcquireByHash() const override;
/** \brief Create an index diff item.
*
@@ -936,7 +937,7 @@ class APT_HIDDEN pkgAcqIndexDiffs final : public pkgAcqBaseIndex
pkgAcqIndexDiffs(pkgAcquire *const Owner, pkgAcqMetaClearSig *const TransactionManager,
IndexTarget const &Target,
std::vector<DiffInfo> const &diffs = std::vector<DiffInfo>()) APT_NONNULL(2, 3);
- virtual ~pkgAcqIndexDiffs();
+ ~pkgAcqIndexDiffs() override;
};
/*}}}*/
/** \brief An item that is responsible for fetching a package file. {{{
@@ -979,19 +980,18 @@ class APT_PUBLIC pkgAcqArchive : public pkgAcquire::Item
bool QueueNext();
/** \brief Get the full pathname of the final file for the current URI */
- virtual std::string GetFinalFilename() const APT_OVERRIDE;
+ [[nodiscard]] std::string GetFinalFilename() const override;
public:
-
- virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual void Done(std::string const &Message, HashStringList const &Hashes,
- pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual std::string DescURI() const APT_OVERRIDE;
- virtual std::string ShortDesc() const APT_OVERRIDE;
- virtual void Finished() APT_OVERRIDE;
- virtual bool IsTrusted() const APT_OVERRIDE;
- virtual HashStringList GetExpectedHashes() const APT_OVERRIDE;
- virtual bool HashesRequired() const APT_OVERRIDE;
+ void Failed(std::string const &Message, pkgAcquire::MethodConfig const * Cnf) override;
+ void Done(std::string const &Message, HashStringList const &Hashes,
+ pkgAcquire::MethodConfig const *Cnf) override;
+ [[nodiscard]] std::string DescURI() const override;
+ [[nodiscard]] std::string ShortDesc() const override;
+ void Finished() override;
+ [[nodiscard]] bool IsTrusted() const override;
+ [[nodiscard]] HashStringList GetExpectedHashes() const override;
+ [[nodiscard]] bool HashesRequired() const override;
/** \brief Create a new pkgAcqArchive.
*
@@ -1014,7 +1014,7 @@ class APT_PUBLIC pkgAcqArchive : public pkgAcquire::Item
pkgAcqArchive(pkgAcquire * const Owner,pkgSourceList * const Sources,
pkgRecords * const Recs,pkgCache::VerIterator const &Version,
std::string &StoreFilename);
- virtual ~pkgAcqArchive();
+ ~pkgAcqArchive() override;
};
/*}}}*/
/** \brief Retrieve the changelog for the given version {{{
@@ -1033,14 +1033,14 @@ class APT_PUBLIC pkgAcqChangelog : public pkgAcquire::Item
public:
// we will never have hashes for changelogs.
// If you need verified ones, download the deb and extract the changelog.
- virtual HashStringList GetExpectedHashes() const APT_OVERRIDE { return HashStringList(); }
- virtual bool HashesRequired() const APT_OVERRIDE { return false; }
+ [[nodiscard]] HashStringList GetExpectedHashes() const override { return {}; }
+ [[nodiscard]] bool HashesRequired() const override { return false; }
// Specialized action members
- virtual void Failed(std::string const &Message,pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual void Done(std::string const &Message, HashStringList const &CalcHashes,
- pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual std::string DescURI() const APT_OVERRIDE {return Desc.URI;};
+ void Failed(std::string const &Message, pkgAcquire::MethodConfig const *Cnf) override;
+ void Done(std::string const &Message, HashStringList const &CalcHashes,
+ pkgAcquire::MethodConfig const *Cnf) override;
+ [[nodiscard]] std::string DescURI() const override { return Desc.URI; };
/** returns the URI to the changelog of this version
*
@@ -1126,7 +1126,7 @@ class APT_PUBLIC pkgAcqChangelog : public pkgAcquire::Item
char const * const SrcName, char const * const SrcVersion,
std::string const &DestDir="", std::string const &DestFilename="");
- virtual ~pkgAcqChangelog();
+ ~pkgAcqChangelog() override;
private:
APT_HIDDEN void Init(std::string const &DestDir, std::string const &DestFilename);
@@ -1147,14 +1147,14 @@ class APT_PUBLIC pkgAcqFile : public pkgAcquire::Item
HashStringList const ExpectedHashes;
public:
- virtual HashStringList GetExpectedHashes() const APT_OVERRIDE;
- virtual bool HashesRequired() const APT_OVERRIDE;
+ [[nodiscard]] HashStringList GetExpectedHashes() const override;
+ [[nodiscard]] bool HashesRequired() const override;
// Specialized action members
- virtual void Done(std::string const &Message, HashStringList const &CalcHashes,
- pkgAcquire::MethodConfig const * const Cnf) APT_OVERRIDE;
- virtual std::string DescURI() const APT_OVERRIDE {return Desc.URI;};
- virtual std::string Custom600Headers() const APT_OVERRIDE;
+ void Done(std::string const &Message, HashStringList const &CalcHashes,
+ pkgAcquire::MethodConfig const *Cnf) override;
+ [[nodiscard]] std::string DescURI() const override { return Desc.URI; };
+ [[nodiscard]] std::string Custom600Headers() const override;
/** \brief Create a new pkgAcqFile object.
*
@@ -1191,7 +1191,7 @@ class APT_PUBLIC pkgAcqFile : public pkgAcquire::Item
std::string const &Desc, std::string const &ShortDesc,
std::string const &DestDir="", std::string const &DestFilename="",
bool const IsIndexFile=false);
- virtual ~pkgAcqFile();
+ ~pkgAcqFile() override;
};
/*}}}*/
class APT_HIDDEN pkgAcqAuxFile final : public pkgAcqFile /*{{{*/
@@ -1201,16 +1201,16 @@ class APT_HIDDEN pkgAcqAuxFile final : public pkgAcqFile /*{{{*/
unsigned long long MaximumSize;
public:
- virtual void Failed(std::string const &Message, pkgAcquire::MethodConfig const *const Cnf) APT_OVERRIDE;
- virtual void Done(std::string const &Message, HashStringList const &CalcHashes,
- pkgAcquire::MethodConfig const *const Cnf) APT_OVERRIDE;
- virtual std::string Custom600Headers() const APT_OVERRIDE;
- virtual void Finished() APT_OVERRIDE;
+ void Failed(std::string const &Message, pkgAcquire::MethodConfig const * Cnf) override;
+ void Done(std::string const &Message, HashStringList const &CalcHashes,
+ pkgAcquire::MethodConfig const *Cnf) override;
+ [[nodiscard]] std::string Custom600Headers() const override;
+ void Finished() override;
pkgAcqAuxFile(pkgAcquire::Item *const Owner, pkgAcquire::Worker *const Worker,
std::string const &ShortDesc, std::string const &Desc, std::string const &URI,
HashStringList const &Hashes, unsigned long long const MaximumSize);
- virtual ~pkgAcqAuxFile();
+ ~pkgAcqAuxFile() override;
};
/*}}}*/
/** @} */
diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h
index 558beecd3..038015049 100644
--- a/apt-pkg/algorithms.h
+++ b/apt-pkg/algorithms.h
@@ -54,7 +54,7 @@ class APT_PUBLIC pkgSimulate : public pkgPackageManager /*{{{*/
pkgDepCache *Cache;
public:
- virtual VerIterator GetCandidateVer(PkgIterator const &Pkg) APT_OVERRIDE
+ VerIterator GetCandidateVer(PkgIterator const &Pkg) override
{
return (*Cache)[Pkg].CandidateVerIter(*Cache);
}
@@ -69,11 +69,11 @@ class APT_PUBLIC pkgSimulate : public pkgPackageManager /*{{{*/
pkgDepCache::ActionGroup group;
// The Actual installation implementation
- virtual bool Install(PkgIterator Pkg,std::string File) APT_OVERRIDE;
- virtual bool Configure(PkgIterator Pkg) APT_OVERRIDE;
- virtual bool Remove(PkgIterator Pkg,bool Purge) APT_OVERRIDE;
+ bool Install(PkgIterator Pkg, std::string File) override;
+ bool Configure(PkgIterator Pkg) override;
+ bool Remove(PkgIterator Pkg, bool Purge) override;
-public:
+ public:
bool Go(APT::Progress::PackageManager * progress) override;
private:
diff --git a/apt-pkg/cachefilter.h b/apt-pkg/cachefilter.h
index 4027178bf..6d5858b28 100644
--- a/apt-pkg/cachefilter.h
+++ b/apt-pkg/cachefilter.h
@@ -29,35 +29,35 @@ public:
class APT_PUBLIC PackageMatcher : public Matcher {
public:
- bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE = 0;
- bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE { return (*this)(Ver.ParentPkg()); }
- bool operator() (pkgCache::GrpIterator const &/*Grp*/) APT_OVERRIDE { return false; }
- ~PackageMatcher() APT_OVERRIDE;
+ bool operator() (pkgCache::PkgIterator const &Pkg) override = 0;
+ bool operator() (pkgCache::VerIterator const &Ver) override { return (*this)(Ver.ParentPkg()); }
+ bool operator() (pkgCache::GrpIterator const &/*Grp*/) override { return false; }
+ ~PackageMatcher() override;
};
// Generica like True, False, NOT, AND, OR /*{{{*/
class APT_PUBLIC TrueMatcher : public Matcher {
public:
- bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
- bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE;
- bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE;
+ bool operator() (pkgCache::PkgIterator const &Pkg) override;
+ bool operator() (pkgCache::GrpIterator const &Grp) override;
+ bool operator() (pkgCache::VerIterator const &Ver) override;
};
class APT_PUBLIC FalseMatcher : public Matcher {
public:
- bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
- bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE;
- bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE;
+ bool operator() (pkgCache::PkgIterator const &Pkg) override;
+ bool operator() (pkgCache::GrpIterator const &Grp) override;
+ bool operator() (pkgCache::VerIterator const &Ver) override;
};
class APT_PUBLIC NOTMatcher : public Matcher {
Matcher * const matcher;
public:
explicit NOTMatcher(Matcher * const matcher);
- bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
- bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE;
- bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE;
- ~NOTMatcher() APT_OVERRIDE;
+ bool operator() (pkgCache::PkgIterator const &Pkg) override;
+ bool operator() (pkgCache::GrpIterator const &Grp) override;
+ bool operator() (pkgCache::VerIterator const &Ver) override;
+ ~NOTMatcher() override;
};
class APT_PUBLIC ANDMatcher : public Matcher {
@@ -71,10 +71,10 @@ public:
ANDMatcher(Matcher * const matcher1, Matcher * const matcher2, Matcher * const matcher3, Matcher * const matcher4);
ANDMatcher(Matcher * const matcher1, Matcher * const matcher2, Matcher * const matcher3, Matcher * const matcher4, Matcher * const matcher5);
ANDMatcher& AND(Matcher * const matcher);
- bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
- bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE;
- bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE;
- ~ANDMatcher() APT_OVERRIDE;
+ bool operator() (pkgCache::PkgIterator const &Pkg) override;
+ bool operator() (pkgCache::GrpIterator const &Grp) override;
+ bool operator() (pkgCache::VerIterator const &Ver) override;
+ ~ANDMatcher() override;
};
class APT_PUBLIC ORMatcher : public Matcher {
std::vector<Matcher *> matchers;
@@ -87,28 +87,28 @@ public:
ORMatcher(Matcher * const matcher1, Matcher * const matcher2, Matcher * const matcher3, Matcher * const matcher4);
ORMatcher(Matcher * const matcher1, Matcher * const matcher2, Matcher * const matcher3, Matcher * const matcher4, Matcher * const matcher5);
ORMatcher& OR(Matcher * const matcher);
- bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
- bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE;
- bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE;
- ~ORMatcher() APT_OVERRIDE;
+ bool operator() (pkgCache::PkgIterator const &Pkg) override;
+ bool operator() (pkgCache::GrpIterator const &Grp) override;
+ bool operator() (pkgCache::VerIterator const &Ver) override;
+ ~ORMatcher() override;
};
/*}}}*/
class APT_PUBLIC PackageNameMatchesRegEx : public PackageMatcher { /*{{{*/
regex_t* pattern;
public:
explicit PackageNameMatchesRegEx(std::string const &Pattern);
- bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
- bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE;
- ~PackageNameMatchesRegEx() APT_OVERRIDE;
+ bool operator() (pkgCache::PkgIterator const &Pkg) override;
+ bool operator() (pkgCache::GrpIterator const &Grp) override;
+ ~PackageNameMatchesRegEx() override;
};
/*}}}*/
class APT_PUBLIC PackageNameMatchesFnmatch : public PackageMatcher { /*{{{*/
const std::string Pattern;
public:
explicit PackageNameMatchesFnmatch(std::string const &Pattern);
- bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
- bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE;
- ~PackageNameMatchesFnmatch() APT_OVERRIDE = default;
+ bool operator() (pkgCache::PkgIterator const &Pkg) override;
+ bool operator() (pkgCache::GrpIterator const &Grp) override;
+ ~PackageNameMatchesFnmatch() override = default;
};
/*}}}*/
class APT_PUBLIC PackageArchitectureMatchesSpecification : public PackageMatcher { /*{{{*/
@@ -134,8 +134,8 @@ public:
PackageArchitectureMatchesSpecification(std::string const &pattern, bool const isPattern = true);
bool operator() (char const * const &arch);
using PackageMatcher::operator();
- bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
- ~PackageArchitectureMatchesSpecification() APT_OVERRIDE;
+ bool operator() (pkgCache::PkgIterator const &Pkg) override;
+ ~PackageArchitectureMatchesSpecification() override;
};
/*}}}*/
class APT_PUBLIC PackageIsNewInstall : public PackageMatcher { /*{{{*/
@@ -143,8 +143,8 @@ class APT_PUBLIC PackageIsNewInstall : public PackageMatcher { /*{{{*/
public:
explicit PackageIsNewInstall(pkgCacheFile * const Cache);
using PackageMatcher::operator();
- bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
- ~PackageIsNewInstall() APT_OVERRIDE;
+ bool operator() (pkgCache::PkgIterator const &Pkg) override;
+ ~PackageIsNewInstall() override;
};
/*}}}*/
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h
index 1c67a65d6..f3f3e967f 100644
--- a/apt-pkg/cacheset.h
+++ b/apt-pkg/cacheset.h
@@ -366,13 +366,13 @@ public: /*{{{*/
typedef typename Container::size_type size_type;
typedef typename Container::allocator_type allocator_type;
- bool insert(pkgCache::PkgIterator const &P) APT_OVERRIDE { if (P.end() == true) return false; _cont.insert(P); return true; }
+ bool insert(pkgCache::PkgIterator const &P) override { if (P.end() == true) return false; _cont.insert(P); return true; }
template<class Cont> void insert(PackageContainer<Cont> const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); }
void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }
- bool empty() const APT_OVERRIDE { return _cont.empty(); }
- void clear() APT_OVERRIDE { return _cont.clear(); }
- size_t size() const APT_OVERRIDE { return _cont.size(); }
+ [[nodiscard]] bool empty() const override { return _cont.empty(); }
+ void clear() override { return _cont.clear(); }
+ [[nodiscard]] size_t size() const override { return _cont.size(); }
#if __GNUC__ >= 5 || (__GNUC_MINOR__ >= 9 && __GNUC__ >= 4)
iterator erase( const_iterator pos ) { return iterator(_cont.erase(pos._iter)); }
iterator erase( const_iterator first, const_iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); }
@@ -658,9 +658,8 @@ public:
typedef const_iterator::difference_type difference_type;
typedef std::make_unsigned<const_iterator::difference_type>::type size_type;
-
- bool empty() const APT_OVERRIDE { return false; }
- size_t size() const APT_OVERRIDE { return _cont->Head().PackageCount; }
+ [[nodiscard]] bool empty() const override { return false; }
+ [[nodiscard]] size_t size() const override { return _cont->Head().PackageCount; }
const_iterator begin() const { return const_iterator(_cont->PkgBegin()); }
const_iterator end() const { return const_iterator(_cont->PkgEnd()); }
@@ -676,11 +675,11 @@ public:
virtual ~PackageUniverse();
private:
- APT_HIDDEN bool insert(pkgCache::PkgIterator const &) APT_OVERRIDE { return true; }
+ APT_HIDDEN bool insert(pkgCache::PkgIterator const &/*P*/) override { return true; }
template<class Cont> APT_HIDDEN void insert(PackageContainer<Cont> const &) { }
APT_HIDDEN void insert(const_iterator, const_iterator) { }
- APT_HIDDEN void clear() APT_OVERRIDE { }
+ APT_HIDDEN void clear() override { }
APT_HIDDEN iterator erase( const_iterator pos );
APT_HIDDEN iterator erase( const_iterator first, const_iterator last );
};
@@ -821,12 +820,12 @@ public: /*{{{*/
typedef typename Container::size_type size_type;
typedef typename Container::allocator_type allocator_type;
- bool insert(pkgCache::VerIterator const &V) APT_OVERRIDE { if (V.end() == true) return false; _cont.insert(V); return true; }
+ bool insert(pkgCache::VerIterator const &V) override { if (V.end() == true) return false; _cont.insert(V); return true; }
template<class Cont> void insert(VersionContainer<Cont> const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); }
void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }
- bool empty() const APT_OVERRIDE { return _cont.empty(); }
- void clear() APT_OVERRIDE { return _cont.clear(); }
- size_t size() const APT_OVERRIDE { return _cont.size(); }
+ [[nodiscard]] bool empty() const override { return _cont.empty(); }
+ void clear() override { return _cont.clear(); }
+ [[nodiscard]] size_t size() const override { return _cont.size(); }
#if APT_GCC_VERSION >= 0x409
iterator erase( const_iterator pos ) { return iterator(_cont.erase(pos._iter)); }
iterator erase( const_iterator first, const_iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); }
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 67c5acee2..a72766e8d 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1298,63 +1298,63 @@ public:
explicit BufferedWriteFileFdPrivate(FileFdPrivate *Priv) :
FileFdPrivate(Priv->filefd), wrapped(Priv) {};
- virtual APT::Configuration::Compressor get_compressor() const APT_OVERRIDE
+ [[nodiscard]] APT::Configuration::Compressor get_compressor() const override
{
return wrapped->get_compressor();
}
- virtual void set_compressor(APT::Configuration::Compressor const &compressor) APT_OVERRIDE
+ void set_compressor(APT::Configuration::Compressor const &compressor) override
{
return wrapped->set_compressor(compressor);
}
- virtual unsigned int get_openmode() const APT_OVERRIDE
+ [[nodiscard]] unsigned int get_openmode() const override
{
return wrapped->get_openmode();
}
- virtual void set_openmode(unsigned int openmode) APT_OVERRIDE
+ void set_openmode(unsigned int openmode) override
{
return wrapped->set_openmode(openmode);
}
- virtual bool get_is_pipe() const APT_OVERRIDE
+ [[nodiscard]] bool get_is_pipe() const override
{
return wrapped->get_is_pipe();
}
- virtual void set_is_pipe(bool is_pipe) APT_OVERRIDE
+ void set_is_pipe(bool is_pipe) override
{
FileFdPrivate::set_is_pipe(is_pipe);
wrapped->set_is_pipe(is_pipe);
}
- virtual unsigned long long get_seekpos() const APT_OVERRIDE
+ [[nodiscard]] unsigned long long get_seekpos() const override
{
return wrapped->get_seekpos();
}
- virtual void set_seekpos(unsigned long long seekpos) APT_OVERRIDE
+ void set_seekpos(unsigned long long seekpos) override
{
return wrapped->set_seekpos(seekpos);
}
- virtual bool InternalOpen(int const iFd, unsigned int const Mode) APT_OVERRIDE
+ bool InternalOpen(int const iFd, unsigned int const Mode) override
{
if (InternalFlush() == false)
return false;
return wrapped->InternalOpen(iFd, Mode);
}
- virtual ssize_t InternalUnbufferedRead(void * const To, unsigned long long const Size) APT_OVERRIDE
+ ssize_t InternalUnbufferedRead(void *const To, unsigned long long const Size) override
{
if (InternalFlush() == false)
return -1;
return wrapped->InternalUnbufferedRead(To, Size);
}
- virtual bool InternalReadError() APT_OVERRIDE
+ bool InternalReadError() override
{
return wrapped->InternalReadError();
}
- virtual char * InternalReadLine(char * To, unsigned long long Size) APT_OVERRIDE
+ char *InternalReadLine(char *To, unsigned long long Size) override
{
if (InternalFlush() == false)
return nullptr;
return wrapped->InternalReadLine(To, Size);
}
- virtual bool InternalFlush() APT_OVERRIDE
+ bool InternalFlush() override
{
while (writebuffer.empty() == false) {
auto written = wrapped->InternalWrite(writebuffer.get(),
@@ -1370,7 +1370,7 @@ public:
writebuffer.reset();
return wrapped->InternalFlush();
}
- virtual ssize_t InternalWrite(void const * const From, unsigned long long const Size) APT_OVERRIDE
+ ssize_t InternalWrite(void const *const From, unsigned long long const Size) override
{
// Optimisation: If the buffer is empty and we have more to write than
// would fit in the buffer (or equal number of bytes), write directly.
@@ -1385,45 +1385,45 @@ public:
return written;
}
- virtual bool InternalWriteError() APT_OVERRIDE
+ bool InternalWriteError() override
{
return wrapped->InternalWriteError();
}
- virtual bool InternalSeek(unsigned long long const To) APT_OVERRIDE
+ bool InternalSeek(unsigned long long const To) override
{
if (InternalFlush() == false)
return false;
return wrapped->InternalSeek(To);
}
- virtual bool InternalSkip(unsigned long long Over) APT_OVERRIDE
+ bool InternalSkip(unsigned long long Over) override
{
if (InternalFlush() == false)
return false;
return wrapped->InternalSkip(Over);
}
- virtual bool InternalTruncate(unsigned long long const Size) APT_OVERRIDE
+ bool InternalTruncate(unsigned long long const Size) override
{
if (InternalFlush() == false)
return false;
return wrapped->InternalTruncate(Size);
}
- virtual unsigned long long InternalTell() APT_OVERRIDE
+ unsigned long long InternalTell() override
{
if (InternalFlush() == false)
return -1;
return wrapped->InternalTell();
}
- virtual unsigned long long InternalSize() APT_OVERRIDE
+ unsigned long long InternalSize() override
{
if (InternalFlush() == false)
return -1;
return wrapped->InternalSize();
}
- virtual bool InternalClose(std::string const &FileName) APT_OVERRIDE
+ bool InternalClose(std::string const &FileName) override
{
return wrapped->InternalClose(FileName);
}
- virtual bool InternalAlwaysAutoClose() const APT_OVERRIDE
+ [[nodiscard]] bool InternalAlwaysAutoClose() const override
{
return wrapped->InternalAlwaysAutoClose();
}
@@ -1437,7 +1437,7 @@ class APT_HIDDEN GzipFileFdPrivate: public FileFdPrivate { /*{{{*/
#ifdef HAVE_ZLIB
public:
gzFile gz;
- virtual bool InternalOpen(int const iFd, unsigned int const Mode) APT_OVERRIDE
+ bool InternalOpen(int const iFd, unsigned int const Mode) override
{
if ((Mode & FileFd::ReadWrite) == FileFd::ReadWrite)
gz = gzdopen(iFd, "r+");
@@ -1448,11 +1448,11 @@ public:
filefd->Flags |= FileFd::Compressed;
return gz != nullptr;
}
- virtual ssize_t InternalUnbufferedRead(void * const To, unsigned long long const Size) APT_OVERRIDE
+ ssize_t InternalUnbufferedRead(void *const To, unsigned long long const Size) override
{
return gzread(gz, To, Size);
}
- virtual bool InternalReadError() APT_OVERRIDE
+ bool InternalReadError() override
{
int err;
char const * const errmsg = gzerror(gz, &err);
@@ -1460,15 +1460,15 @@ public:
return filefd->FileFdError("gzread: %s (%d: %s)", _("Read error"), err, errmsg);
return FileFdPrivate::InternalReadError();
}
- virtual char * InternalReadLine(char * To, unsigned long long Size) APT_OVERRIDE
+ char *InternalReadLine(char *To, unsigned long long Size) override
{
return gzgets(gz, To, Size);
}
- virtual ssize_t InternalWrite(void const * const From, unsigned long long const Size) APT_OVERRIDE
+ ssize_t InternalWrite(void const *const From, unsigned long long const Size) override
{
return gzwrite(gz,From,Size);
}
- virtual bool InternalWriteError() APT_OVERRIDE
+ bool InternalWriteError() override
{
int err;
char const * const errmsg = gzerror(gz, &err);
@@ -1476,7 +1476,7 @@ public:
return filefd->FileFdError("gzwrite: %s (%d: %s)", _("Write error"), err, errmsg);
return FileFdPrivate::InternalWriteError();
}
- virtual bool InternalSeek(unsigned long long const To) APT_OVERRIDE
+ bool InternalSeek(unsigned long long const To) override
{
off_t const res = gzseek(gz, To, SEEK_SET);
if (res != (off_t)To)
@@ -1485,7 +1485,7 @@ public:
buffer.reset();
return true;
}
- virtual bool InternalSkip(unsigned long long Over) APT_OVERRIDE
+ bool InternalSkip(unsigned long long Over) override
{
if (Over >= buffer.size())
{
@@ -1505,11 +1505,11 @@ public:
seekpos = res;
return true;
}
- virtual unsigned long long InternalTell() APT_OVERRIDE
+ unsigned long long InternalTell() override
{
return gztell(gz) - buffer.size();
}
- virtual unsigned long long InternalSize() APT_OVERRIDE
+ unsigned long long InternalSize() override
{
unsigned long long filesize = FileFdPrivate::InternalSize();
// only check gzsize if we are actually a gzip file, just checking for
@@ -1543,7 +1543,7 @@ public:
}
return size;
}
- virtual bool InternalClose(std::string const &FileName) APT_OVERRIDE
+ bool InternalClose(std::string const &FileName) override
{
if (gz == nullptr)
return true;
@@ -1564,22 +1564,22 @@ class APT_HIDDEN Bz2FileFdPrivate: public FileFdPrivate { /*{{{*/
#ifdef HAVE_BZ2
BZFILE* bz2;
public:
- virtual bool InternalOpen(int const iFd, unsigned int const Mode) APT_OVERRIDE
- {
- if ((Mode & FileFd::ReadWrite) == FileFd::ReadWrite)
- bz2 = BZ2_bzdopen(iFd, "r+");
- else if ((Mode & FileFd::WriteOnly) == FileFd::WriteOnly)
- bz2 = BZ2_bzdopen(iFd, "w");
- else
- bz2 = BZ2_bzdopen(iFd, "r");
- filefd->Flags |= FileFd::Compressed;
- return bz2 != nullptr;
+bool InternalOpen(int const iFd, unsigned int const Mode) override
+{
+ if ((Mode & FileFd::ReadWrite) == FileFd::ReadWrite)
+ bz2 = BZ2_bzdopen(iFd, "r+");
+ else if ((Mode & FileFd::WriteOnly) == FileFd::WriteOnly)
+ bz2 = BZ2_bzdopen(iFd, "w");
+ else
+ bz2 = BZ2_bzdopen(iFd, "r");
+ filefd->Flags |= FileFd::Compressed;
+ return bz2 != nullptr;
}
- virtual ssize_t InternalUnbufferedRead(void * const To, unsigned long long const Size) APT_OVERRIDE
+ ssize_t InternalUnbufferedRead(void *const To, unsigned long long const Size) override
{
return BZ2_bzread(bz2, To, Size);
}
- virtual bool InternalReadError() APT_OVERRIDE
+ bool InternalReadError() override
{
int err;
char const * const errmsg = BZ2_bzerror(bz2, &err);
@@ -1587,11 +1587,11 @@ public:
return filefd->FileFdError("BZ2_bzread: %s %s (%d: %s)", filefd->FileName.c_str(), _("Read error"), err, errmsg);
return FileFdPrivate::InternalReadError();
}
- virtual ssize_t InternalWrite(void const * const From, unsigned long long const Size) APT_OVERRIDE
+ ssize_t InternalWrite(void const *const From, unsigned long long const Size) override
{
return BZ2_bzwrite(bz2, (void*)From, Size);
}
- virtual bool InternalWriteError() APT_OVERRIDE
+ bool InternalWriteError() override
{
int err;
char const * const errmsg = BZ2_bzerror(bz2, &err);
@@ -1599,8 +1599,8 @@ public:
return filefd->FileFdError("BZ2_bzwrite: %s %s (%d: %s)", filefd->FileName.c_str(), _("Write error"), err, errmsg);
return FileFdPrivate::InternalWriteError();
}
- virtual bool InternalStream() const APT_OVERRIDE { return true; }
- virtual bool InternalClose(std::string const &) APT_OVERRIDE
+ [[nodiscard]] bool InternalStream() const override { return true; }
+ bool InternalClose(std::string const &/*FileName*/) override
{
if (bz2 == nullptr)
return true;
@@ -1626,40 +1626,42 @@ class APT_HIDDEN Lz4FileFdPrivate: public FileFdPrivate { /*{{{*/
// Count of bytes that the decompressor expects to read next, or buffer size.
size_t next_to_load = APT_BUFFER_SIZE;
public:
- virtual bool InternalOpen(int const iFd, unsigned int const Mode) APT_OVERRIDE
+bool InternalOpen(int const iFd, unsigned int const Mode) override
+{
+ if ((Mode & FileFd::ReadWrite) == FileFd::ReadWrite)
+ return _error->Error("lz4 only supports write or read mode");
+
+ if ((Mode & FileFd::WriteOnly) == FileFd::WriteOnly)
{
- if ((Mode & FileFd::ReadWrite) == FileFd::ReadWrite)
- return _error->Error("lz4 only supports write or read mode");
+ res = LZ4F_createCompressionContext(&cctx, LZ4F_VERSION);
+ lz4_buffer.reset(LZ4F_compressBound(APT_BUFFER_SIZE, nullptr) + LZ4_HEADER_SIZE + LZ4_FOOTER_SIZE);
+ }
+ else
+ {
+ res = LZ4F_createDecompressionContext(&dctx, LZ4F_VERSION);
+ lz4_buffer.reset(APT_BUFFER_SIZE);
+ }
- if ((Mode & FileFd::WriteOnly) == FileFd::WriteOnly) {
- res = LZ4F_createCompressionContext(&cctx, LZ4F_VERSION);
- lz4_buffer.reset(LZ4F_compressBound(APT_BUFFER_SIZE, nullptr)
- + LZ4_HEADER_SIZE + LZ4_FOOTER_SIZE);
- } else {
- res = LZ4F_createDecompressionContext(&dctx, LZ4F_VERSION);
- lz4_buffer.reset(APT_BUFFER_SIZE);
- }
+ filefd->Flags |= FileFd::Compressed;
- filefd->Flags |= FileFd::Compressed;
+ if (LZ4F_isError(res))
+ return false;
- if (LZ4F_isError(res))
- return false;
+ unsigned int flags = (Mode & (FileFd::WriteOnly | FileFd::ReadOnly));
+ if (backend.OpenDescriptor(iFd, flags, FileFd::None, true) == false)
+ return false;
- unsigned int flags = (Mode & (FileFd::WriteOnly|FileFd::ReadOnly));
- if (backend.OpenDescriptor(iFd, flags, FileFd::None, true) == false)
+ // Write the file header
+ if ((Mode & FileFd::WriteOnly) == FileFd::WriteOnly)
+ {
+ res = LZ4F_compressBegin(cctx, lz4_buffer.buffer, lz4_buffer.buffersize_max, nullptr);
+ if (LZ4F_isError(res) || backend.Write(lz4_buffer.buffer, res) == false)
return false;
+ }
- // Write the file header
- if ((Mode & FileFd::WriteOnly) == FileFd::WriteOnly)
- {
- res = LZ4F_compressBegin(cctx, lz4_buffer.buffer, lz4_buffer.buffersize_max, nullptr);
- if (LZ4F_isError(res) || backend.Write(lz4_buffer.buffer, res) == false)
- return false;
- }
-
- return true;
+ return true;
}
- virtual ssize_t InternalUnbufferedRead(void * const To, unsigned long long const Size) APT_OVERRIDE
+ ssize_t InternalUnbufferedRead(void *const To, unsigned long long const Size) override
{
/* Keep reading as long as the compressor still wants to read */
while (next_to_load) {
@@ -1697,13 +1699,13 @@ public:
return 0;
}
- virtual bool InternalReadError() APT_OVERRIDE
+ bool InternalReadError() override
{
char const * const errmsg = LZ4F_getErrorName(res);
return filefd->FileFdError("LZ4F: %s %s (%zu: %s)", filefd->FileName.c_str(), _("Read error"), res, errmsg);
}
- virtual ssize_t InternalWrite(void const * const From, unsigned long long const Size) APT_OVERRIDE
+ ssize_t InternalWrite(void const *const From, unsigned long long const Size) override
{
unsigned long long const towrite = std::min(APT_BUFFER_SIZE, Size);
@@ -1716,20 +1718,20 @@ public:
return towrite;
}
- virtual bool InternalWriteError() APT_OVERRIDE
+ bool InternalWriteError() override
{
char const * const errmsg = LZ4F_getErrorName(res);
return filefd->FileFdError("LZ4F: %s %s (%zu: %s)", filefd->FileName.c_str(), _("Write error"), res, errmsg);
}
- virtual bool InternalStream() const APT_OVERRIDE { return true; }
+ [[nodiscard]] bool InternalStream() const override { return true; }
- virtual bool InternalFlush() APT_OVERRIDE
+ bool InternalFlush() override
{
return backend.Flush();
}
- virtual bool InternalClose(std::string const &) APT_OVERRIDE
+ bool InternalClose(std::string const &/*FileName*/) override
{
/* Reset variables */
res = 0;
@@ -1785,7 +1787,7 @@ class APT_HIDDEN ZstdFileFdPrivate : public FileFdPrivate /*{{{*/
size_t next_to_load = APT_BUFFER_SIZE;
public:
- virtual bool InternalOpen(int const iFd, unsigned int const Mode) APT_OVERRIDE
+ bool InternalOpen(int const iFd, unsigned int const Mode) override
{
if ((Mode & FileFd::ReadWrite) == FileFd::ReadWrite)
return _error->Error("zstd only supports write or read mode");
@@ -1814,7 +1816,7 @@ class APT_HIDDEN ZstdFileFdPrivate : public FileFdPrivate /*{{{*/
return true;
}
- virtual ssize_t InternalUnbufferedRead(void *const To, unsigned long long const Size) APT_OVERRIDE
+ ssize_t InternalUnbufferedRead(void *const To, unsigned long long const Size) override
{
/* Keep reading as long as the compressor still wants to read */
while (true)
@@ -1872,13 +1874,13 @@ class APT_HIDDEN ZstdFileFdPrivate : public FileFdPrivate /*{{{*/
return 0;
}
- virtual bool InternalReadError() APT_OVERRIDE
+ bool InternalReadError() override
{
char const *const errmsg = ZSTD_getErrorName(res);
return filefd->FileFdError("ZSTD: %s %s (%zu: %s)", filefd->FileName.c_str(), _("Read error"), res, errmsg);
}
- virtual ssize_t InternalWrite(void const *const From, unsigned long long const Size) APT_OVERRIDE
+ ssize_t InternalWrite(void const *const From, unsigned long long const Size) override
{
// Drain compressed buffer as far as possible.
ZSTD_outBuffer out = {
@@ -1900,20 +1902,20 @@ class APT_HIDDEN ZstdFileFdPrivate : public FileFdPrivate /*{{{*/
return in.pos;
}
- virtual bool InternalWriteError() APT_OVERRIDE
+ bool InternalWriteError() override
{
char const *const errmsg = ZSTD_getErrorName(res);
return filefd->FileFdError("ZSTD: %s %s (%zu: %s)", filefd->FileName.c_str(), _("Write error"), res, errmsg);
}
- virtual bool InternalStream() const APT_OVERRIDE { return true; }
+ [[nodiscard]] bool InternalStream() const override { return true; }
- virtual bool InternalFlush() APT_OVERRIDE
+ bool InternalFlush() override
{
return backend.Flush();
}
- virtual bool InternalClose(std::string const &) APT_OVERRIDE
+ bool InternalClose(std::string const &/*FileName*/) override
{
/* Reset variables */
res = 0;
@@ -2052,51 +2054,51 @@ class APT_HIDDEN LzmaFileFdPrivate: public FileFdPrivate { /*{{{*/
return 6;
}
public:
- virtual bool InternalOpen(int const iFd, unsigned int const Mode) APT_OVERRIDE
- {
- if ((Mode & FileFd::ReadWrite) == FileFd::ReadWrite)
- return filefd->FileFdError("ReadWrite mode is not supported for lzma/xz files %s", filefd->FileName.c_str());
+bool InternalOpen(int const iFd, unsigned int const Mode) override
+{
+ if ((Mode & FileFd::ReadWrite) == FileFd::ReadWrite)
+ return filefd->FileFdError("ReadWrite mode is not supported for lzma/xz files %s", filefd->FileName.c_str());
- if (lzma == nullptr)
- lzma = new LzmaFileFdPrivate::LZMAFILE(filefd);
- if ((Mode & FileFd::WriteOnly) == FileFd::WriteOnly)
- lzma->file = fdopen(iFd, "w");
- else
- lzma->file = fdopen(iFd, "r");
- filefd->Flags |= FileFd::Compressed;
- if (lzma->file == nullptr)
- return false;
+ if (lzma == nullptr)
+ lzma = new LzmaFileFdPrivate::LZMAFILE(filefd);
+ if ((Mode & FileFd::WriteOnly) == FileFd::WriteOnly)
+ lzma->file = fdopen(iFd, "w");
+ else
+ lzma->file = fdopen(iFd, "r");
+ filefd->Flags |= FileFd::Compressed;
+ if (lzma->file == nullptr)
+ return false;
- lzma_stream tmp_stream = LZMA_STREAM_INIT;
- lzma->stream = tmp_stream;
+ lzma_stream tmp_stream = LZMA_STREAM_INIT;
+ lzma->stream = tmp_stream;
- if ((Mode & FileFd::WriteOnly) == FileFd::WriteOnly)
+ if ((Mode & FileFd::WriteOnly) == FileFd::WriteOnly)
+ {
+ uint32_t const xzlevel = findXZlevel(compressor.CompressArgs);
+ if (compressor.Name == "xz")
{
- uint32_t const xzlevel = findXZlevel(compressor.CompressArgs);
- if (compressor.Name == "xz")
- {
- if (lzma_easy_encoder(&lzma->stream, xzlevel, LZMA_CHECK_CRC64) != LZMA_OK)
- return false;
- }
- else
- {
- lzma_options_lzma options;
- lzma_lzma_preset(&options, xzlevel);
- if (lzma_alone_encoder(&lzma->stream, &options) != LZMA_OK)
- return false;
- }
- lzma->compressing = true;
+ if (lzma_easy_encoder(&lzma->stream, xzlevel, LZMA_CHECK_CRC64) != LZMA_OK)
+ return false;
}
else
{
- uint64_t constexpr memlimit = 1024 * 1024 * 500;
- if (lzma_auto_decoder(&lzma->stream, memlimit, 0) != LZMA_OK)
+ lzma_options_lzma options;
+ lzma_lzma_preset(&options, xzlevel);
+ if (lzma_alone_encoder(&lzma->stream, &options) != LZMA_OK)
return false;
- lzma->compressing = false;
}
- return true;
+ lzma->compressing = true;
+ }
+ else
+ {
+ uint64_t constexpr memlimit = 1024 * 1024 * 500;
+ if (lzma_auto_decoder(&lzma->stream, memlimit, 0) != LZMA_OK)
+ return false;
+ lzma->compressing = false;
+ }
+ return true;
}
- virtual ssize_t InternalUnbufferedRead(void * const To, unsigned long long const Size) APT_OVERRIDE
+ ssize_t InternalUnbufferedRead(void *const To, unsigned long long const Size) override
{
ssize_t Res;
if (lzma->eof == true)
@@ -2132,11 +2134,11 @@ public:
}
return Res;
}
- virtual bool InternalReadError() APT_OVERRIDE
+ bool InternalReadError() override
{
return filefd->FileFdError("lzma_read: %s (%d)", _("Read error"), lzma->err);
}
- virtual ssize_t InternalWrite(void const * const From, unsigned long long const Size) APT_OVERRIDE
+ ssize_t InternalWrite(void const *const From, unsigned long long const Size) override
{
ssize_t Res;
lzma->stream.next_in = (uint8_t *)From;
@@ -2165,12 +2167,12 @@ public:
}
return Res;
}
- virtual bool InternalWriteError() APT_OVERRIDE
+ bool InternalWriteError() override
{
return filefd->FileFdError("lzma_write: %s (%d)", _("Write error"), lzma->err);
}
- virtual bool InternalStream() const APT_OVERRIDE { return true; }
- virtual bool InternalClose(std::string const &) APT_OVERRIDE
+ [[nodiscard]] bool InternalStream() const override { return true; }
+ bool InternalClose(std::string const &/*FileName*/) override
{
delete lzma;
lzma = nullptr;
@@ -2187,117 +2189,118 @@ class APT_HIDDEN PipedFileFdPrivate: public FileFdPrivate /*{{{*/
by executing a specified binary and pipe in/out what we need */
{
public:
- virtual bool InternalOpen(int const, unsigned int const Mode) APT_OVERRIDE
+bool InternalOpen(int const /*iFd*/, unsigned int const Mode) override
+{
+ // collect zombies here in case we reopen
+ if (compressor_pid > 0)
+ ExecWait(compressor_pid, "FileFdCompressor", true);
+
+ if ((Mode & FileFd::ReadWrite) == FileFd::ReadWrite)
+ return filefd->FileFdError("ReadWrite mode is not supported for file %s", filefd->FileName.c_str());
+ if (compressor.Binary == "false")
+ return filefd->FileFdError("libapt has inbuilt support for the %s compression,"
+ " but was forced to ignore it in favor of an external binary – which isn't installed.",
+ compressor.Name.c_str());
+
+ bool const Comp = (Mode & FileFd::WriteOnly) == FileFd::WriteOnly;
+ if (Comp == false && filefd->iFd != -1)
{
- // collect zombies here in case we reopen
- if (compressor_pid > 0)
- ExecWait(compressor_pid, "FileFdCompressor", true);
+ // Handle 'decompression' of empty files
+ struct stat Buf;
+ if (fstat(filefd->iFd, &Buf) != 0)
+ return filefd->FileFdErrno("fstat", "Could not stat fd %d for file %s", filefd->iFd, filefd->FileName.c_str());
+ if (Buf.st_size == 0 && S_ISFIFO(Buf.st_mode) == false)
+ return true;
- if ((Mode & FileFd::ReadWrite) == FileFd::ReadWrite)
- return filefd->FileFdError("ReadWrite mode is not supported for file %s", filefd->FileName.c_str());
- if (compressor.Binary == "false")
- return filefd->FileFdError("libapt has inbuilt support for the %s compression,"
- " but was forced to ignore it in favor of an external binary – which isn't installed.", compressor.Name.c_str());
-
- bool const Comp = (Mode & FileFd::WriteOnly) == FileFd::WriteOnly;
- if (Comp == false && filefd->iFd != -1)
- {
- // Handle 'decompression' of empty files
- struct stat Buf;
- if (fstat(filefd->iFd, &Buf) != 0)
- return filefd->FileFdErrno("fstat", "Could not stat fd %d for file %s", filefd->iFd, filefd->FileName.c_str());
- if (Buf.st_size == 0 && S_ISFIFO(Buf.st_mode) == false)
- return true;
-
- // We don't need the file open - instead let the compressor open it
- // as he properly knows better how to efficiently read from 'his' file
- if (filefd->FileName.empty() == false)
- {
- close(filefd->iFd);
- filefd->iFd = -1;
- }
+ // We don't need the file open - instead let the compressor open it
+ // as he properly knows better how to efficiently read from 'his' file
+ if (filefd->FileName.empty() == false)
+ {
+ close(filefd->iFd);
+ filefd->iFd = -1;
}
+ }
- // Create a data pipe
- int Pipe[2] = {-1,-1};
- if (pipe(Pipe) != 0)
- return filefd->FileFdErrno("pipe",_("Failed to create subprocess IPC"));
- for (int J = 0; J != 2; J++)
- SetCloseExec(Pipe[J],true);
+ // Create a data pipe
+ int Pipe[2] = {-1, -1};
+ if (pipe(Pipe) != 0)
+ return filefd->FileFdErrno("pipe", _("Failed to create subprocess IPC"));
+ for (int J = 0; J != 2; J++)
+ SetCloseExec(Pipe[J], true);
- compressed_fd = filefd->iFd;
- set_is_pipe(true);
+ compressed_fd = filefd->iFd;
+ set_is_pipe(true);
+ if (Comp == true)
+ filefd->iFd = Pipe[1];
+ else
+ filefd->iFd = Pipe[0];
+
+ // The child..
+ compressor_pid = ExecFork();
+ if (compressor_pid == 0)
+ {
if (Comp == true)
- filefd->iFd = Pipe[1];
+ {
+ dup2(compressed_fd, STDOUT_FILENO);
+ dup2(Pipe[0], STDIN_FILENO);
+ }
else
- filefd->iFd = Pipe[0];
-
- // The child..
- compressor_pid = ExecFork();
- if (compressor_pid == 0)
{
- if (Comp == true)
- {
- dup2(compressed_fd,STDOUT_FILENO);
- dup2(Pipe[0],STDIN_FILENO);
- }
- else
- {
- if (compressed_fd != -1)
- dup2(compressed_fd,STDIN_FILENO);
- dup2(Pipe[1],STDOUT_FILENO);
- }
- int const nullfd = open("/dev/null", O_WRONLY);
- if (nullfd != -1)
- {
- dup2(nullfd,STDERR_FILENO);
- close(nullfd);
- }
+ if (compressed_fd != -1)
+ dup2(compressed_fd, STDIN_FILENO);
+ dup2(Pipe[1], STDOUT_FILENO);
+ }
+ int const nullfd = open("/dev/null", O_WRONLY);
+ if (nullfd != -1)
+ {
+ dup2(nullfd, STDERR_FILENO);
+ close(nullfd);
+ }
- SetCloseExec(STDOUT_FILENO,false);
- SetCloseExec(STDIN_FILENO,false);
-
- std::vector<char const*> Args;
- Args.push_back(compressor.Binary.c_str());
- std::vector<std::string> const * const addArgs =
- (Comp == true) ? &(compressor.CompressArgs) : &(compressor.UncompressArgs);
- for (std::vector<std::string>::const_iterator a = addArgs->begin();
- a != addArgs->end(); ++a)
- Args.push_back(a->c_str());
- if (Comp == false && filefd->FileName.empty() == false)
- {
- // commands not needing arguments, do not need to be told about using standard output
- // in reality, only testcases with tools like cat, rev, rot13, … are able to trigger this
- if (compressor.CompressArgs.empty() == false && compressor.UncompressArgs.empty() == false)
- Args.push_back("--stdout");
- if (filefd->TemporaryFileName.empty() == false)
- Args.push_back(filefd->TemporaryFileName.c_str());
- else
- Args.push_back(filefd->FileName.c_str());
- }
- Args.push_back(NULL);
+ SetCloseExec(STDOUT_FILENO, false);
+ SetCloseExec(STDIN_FILENO, false);
- execvp(Args[0],(char **)&Args[0]);
- cerr << _("Failed to exec compressor ") << Args[0] << endl;
- _exit(100);
+ std::vector<char const *> Args;
+ Args.push_back(compressor.Binary.c_str());
+ std::vector<std::string> const *const addArgs =
+ (Comp == true) ? &(compressor.CompressArgs) : &(compressor.UncompressArgs);
+ for (std::vector<std::string>::const_iterator a = addArgs->begin();
+ a != addArgs->end(); ++a)
+ Args.push_back(a->c_str());
+ if (Comp == false && filefd->FileName.empty() == false)
+ {
+ // commands not needing arguments, do not need to be told about using standard output
+ // in reality, only testcases with tools like cat, rev, rot13, … are able to trigger this
+ if (compressor.CompressArgs.empty() == false && compressor.UncompressArgs.empty() == false)
+ Args.push_back("--stdout");
+ if (filefd->TemporaryFileName.empty() == false)
+ Args.push_back(filefd->TemporaryFileName.c_str());
+ else
+ Args.push_back(filefd->FileName.c_str());
}
- if (Comp == true)
- close(Pipe[0]);
- else
- close(Pipe[1]);
+ Args.push_back(NULL);
- return true;
+ execvp(Args[0], (char **)&Args[0]);
+ cerr << _("Failed to exec compressor ") << Args[0] << endl;
+ _exit(100);
}
- virtual ssize_t InternalUnbufferedRead(void * const To, unsigned long long const Size) APT_OVERRIDE
+ if (Comp == true)
+ close(Pipe[0]);
+ else
+ close(Pipe[1]);
+
+ return true;
+ }
+ ssize_t InternalUnbufferedRead(void *const To, unsigned long long const Size) override
{
return read(filefd->iFd, To, Size);
}
- virtual ssize_t InternalWrite(void const * const From, unsigned long long const Size) APT_OVERRIDE
+ ssize_t InternalWrite(void const *const From, unsigned long long const Size) override
{
return write(filefd->iFd, From, Size);
}
- virtual bool InternalClose(std::string const &) APT_OVERRIDE
+ bool InternalClose(std::string const &/*FileName*/) override
{
bool Ret = true;
if (filefd->iFd != -1)
@@ -2317,12 +2320,12 @@ public:
class APT_HIDDEN DirectFileFdPrivate: public FileFdPrivate /*{{{*/
{
public:
- virtual bool InternalOpen(int const, unsigned int const) APT_OVERRIDE { return true; }
- virtual ssize_t InternalUnbufferedRead(void * const To, unsigned long long const Size) APT_OVERRIDE
- {
- return read(filefd->iFd, To, Size);
+bool InternalOpen(int const /*iFd*/, unsigned int const /*Mode*/) override { return true; }
+ssize_t InternalUnbufferedRead(void *const To, unsigned long long const Size) override
+{
+ return read(filefd->iFd, To, Size);
}
- virtual ssize_t InternalWrite(void const * const From, unsigned long long const Size) APT_OVERRIDE
+ ssize_t InternalWrite(void const *const From, unsigned long long const Size) override
{
// files opened read+write are strange and only really "supported" for direct files
if (buffer.size() != 0)
@@ -2332,7 +2335,7 @@ public:
}
return write(filefd->iFd, From, Size);
}
- virtual bool InternalSeek(unsigned long long const To) APT_OVERRIDE
+ bool InternalSeek(unsigned long long const To) override
{
off_t const res = lseek(filefd->iFd, To, SEEK_SET);
if (res != (off_t)To)
@@ -2341,7 +2344,7 @@ public:
buffer.reset();
return true;
}
- virtual bool InternalSkip(unsigned long long Over) APT_OVERRIDE
+ bool InternalSkip(unsigned long long Over) override
{
if (Over >= buffer.size())
{
@@ -2361,7 +2364,7 @@ public:
seekpos = res;
return true;
}
- virtual bool InternalTruncate(unsigned long long const To) APT_OVERRIDE
+ bool InternalTruncate(unsigned long long const To) override
{
if (buffer.size() != 0)
{
@@ -2377,16 +2380,16 @@ public:
return filefd->FileFdError("Unable to truncate to %llu",To);
return true;
}
- virtual unsigned long long InternalTell() APT_OVERRIDE
+ unsigned long long InternalTell() override
{
return lseek(filefd->iFd,0,SEEK_CUR) - buffer.size();
}
- virtual unsigned long long InternalSize() APT_OVERRIDE
+ unsigned long long InternalSize() override
{
return filefd->FileSize();
}
- virtual bool InternalClose(std::string const &) APT_OVERRIDE { return true; }
- virtual bool InternalAlwaysAutoClose() const APT_OVERRIDE { return false; }
+ bool InternalClose(std::string const &/*FileName*/) override { return true; }
+ [[nodiscard]] bool InternalAlwaysAutoClose() const override { return false; }
explicit DirectFileFdPrivate(FileFd * const filefd) : FileFdPrivate(filefd) {}
virtual ~DirectFileFdPrivate() { InternalClose(""); }
diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h
index 7a4c863d7..e0c23b99b 100644
--- a/apt-pkg/contrib/macros.h
+++ b/apt-pkg/contrib/macros.h
@@ -109,12 +109,6 @@
#define APT_IGNORE_DEPRECATED(XXX) XXX
#endif
-#if __cplusplus >= 201103L
- #define APT_OVERRIDE override
-#else
- #define APT_OVERRIDE /* no c++11 standard */
-#endif
-
// These lines are extracted by the makefiles and the buildsystem
// Increasing MAJOR or MINOR results in the need of recompiling all
// reverse-dependencies of libapt-pkg against the new SONAME.
@@ -139,4 +133,14 @@ AptScopeWrapper(F) -> AptScopeWrapper<F>;
#define APT_PASTE(a, b) APT_PASTE2(a, b)
#define DEFER(lambda) AptScopeWrapper APT_PASTE(defer, __LINE__){lambda};
+
+#ifndef APT_COMPILING_APT
+#if APT_PKG_ABI <= 600
+#if __cplusplus >= 201103L
+ #define APT_OVERRIDE override
+#else
+ #define APT_OVERRIDE /* no c++11 standard */
+#endif
+#endif
+#endif
#endif
diff --git a/apt-pkg/contrib/progress.h b/apt-pkg/contrib/progress.h
index d6a698af3..7721530b8 100644
--- a/apt-pkg/contrib/progress.h
+++ b/apt-pkg/contrib/progress.h
@@ -71,12 +71,12 @@ class APT_PUBLIC OpTextProgress : public OpProgress
bool NoUpdate;
bool NoDisplay;
unsigned long LastLen;
- virtual void Update() APT_OVERRIDE;
+ void Update() override;
void Write(const char *S);
public:
- virtual void Done() APT_OVERRIDE;
+ void Done() override;
explicit OpTextProgress(bool NoUpdate = false) : NoUpdate(NoUpdate),
NoDisplay(false), LastLen(0) {};
diff --git a/apt-pkg/deb/debfile.h b/apt-pkg/deb/debfile.h
index 48a75ae55..887ee7142 100644
--- a/apt-pkg/deb/debfile.h
+++ b/apt-pkg/deb/debfile.h
@@ -56,8 +56,7 @@ class APT_PUBLIC debDebFile
class APT_PUBLIC debDebFile::ControlExtract : public pkgDirStream
{
public:
-
- virtual bool DoItem(Item &Itm,int &Fd) APT_OVERRIDE;
+ bool DoItem(Item &Itm, int &Fd) override;
};
class APT_PUBLIC debDebFile::MemControlExtract : public pkgDirStream
@@ -72,9 +71,9 @@ class APT_PUBLIC debDebFile::MemControlExtract : public pkgDirStream
std::string Member;
// Members from DirStream
- virtual bool DoItem(Item &Itm,int &Fd) APT_OVERRIDE;
- virtual bool Process(Item &Itm,const unsigned char *Data,
- unsigned long long Size,unsigned long long Pos) APT_OVERRIDE;
+ bool DoItem(Item &Itm, int &Fd) override;
+ bool Process(Item &Itm, const unsigned char *Data,
+ unsigned long long Size, unsigned long long Pos) override;
// Helpers
bool Read(debDebFile &Deb);
@@ -82,7 +81,7 @@ class APT_PUBLIC debDebFile::MemControlExtract : public pkgDirStream
MemControlExtract() : IsControl(false), Control(0), Length(0), Member("control") {};
explicit MemControlExtract(std::string Member) : IsControl(false), Control(0), Length(0), Member(Member) {};
- ~MemControlExtract() {delete [] Control;};
+ ~MemControlExtract() override { delete[] Control; };
};
/*}}}*/
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index c4115e53e..306018858 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -325,7 +325,7 @@ class APT_HIDDEN debIFTypeSrc : public pkgIndexFile::Type
class APT_HIDDEN debIFTypePkg : public pkgIndexFile::Type
{
public:
- virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &File) const APT_OVERRIDE
+ [[nodiscard]] pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &File) const override
{
return new debRecordParser(File.FileName(),*File.Cache());
};
@@ -339,7 +339,7 @@ class APT_HIDDEN debIFTypeTrans : public debIFTypePkg
class APT_HIDDEN debIFTypeStatus : public pkgIndexFile::Type
{
public:
- virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &File) const APT_OVERRIDE
+ [[nodiscard]] pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &File) const override
{
return new debRecordParser(File.FileName(),*File.Cache());
};
@@ -348,7 +348,7 @@ class APT_HIDDEN debIFTypeStatus : public pkgIndexFile::Type
class APT_HIDDEN debIFTypeDebPkgFile : public pkgIndexFile::Type
{
public:
- virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &File) const APT_OVERRIDE
+ [[nodiscard]] pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &File) const override
{
return new debDebFileRecordParser(File.FileName());
};
@@ -357,7 +357,7 @@ class APT_HIDDEN debIFTypeDebPkgFile : public pkgIndexFile::Type
class APT_HIDDEN debIFTypeDscFile : public pkgIndexFile::Type
{
public:
- virtual pkgSrcRecords::Parser *CreateSrcPkgParser(std::string const &DscFile) const APT_OVERRIDE
+ [[nodiscard]] pkgSrcRecords::Parser *CreateSrcPkgParser(std::string const &DscFile) const override
{
return new debDscRecordParser(DscFile, NULL);
};
@@ -366,7 +366,7 @@ class APT_HIDDEN debIFTypeDscFile : public pkgIndexFile::Type
class APT_HIDDEN debIFTypeDebianSourceDir : public pkgIndexFile::Type
{
public:
- virtual pkgSrcRecords::Parser *CreateSrcPkgParser(std::string const &SourceDir) const APT_OVERRIDE
+ [[nodiscard]] pkgSrcRecords::Parser *CreateSrcPkgParser(std::string const &SourceDir) const override
{
return new debDscRecordParser(SourceDir + std::string("/debian/control"), NULL);
};
diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h
index 57b37385e..e9b22ff29 100644
--- a/apt-pkg/deb/debindexfile.h
+++ b/apt-pkg/deb/debindexfile.h
@@ -29,87 +29,85 @@ class debStatusIndex : public pkgDebianIndexRealFile
{
void * const d;
protected:
- virtual std::string GetArchitecture() const APT_OVERRIDE;
- virtual std::string GetComponent() const APT_OVERRIDE;
- virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
+ [[nodiscard]] std::string GetArchitecture() const override;
+ [[nodiscard]] std::string GetComponent() const override;
+ [[nodiscard]] uint8_t GetIndexFlags() const override;
public:
- virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
+ [[nodiscard]] const Type *GetType() const override APT_PURE;
// Interface for the Cache Generator
- virtual bool HasPackages() const APT_OVERRIDE {return true;};
+ [[nodiscard]] bool HasPackages() const override { return true; };
// Abort if the file does not exist.
- virtual bool Exists() const APT_OVERRIDE {return true;};
+ [[nodiscard]] bool Exists() const override { return true; };
- virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
+ pkgCacheListParser *CreateListParser(FileFd &Pkg) override;
explicit debStatusIndex(std::string const &File);
- virtual ~debStatusIndex();
+ ~debStatusIndex() override;
};
class debPackagesIndex : public pkgDebianIndexTargetFile
{
void * const d;
protected:
- virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
+ [[nodiscard]] uint8_t GetIndexFlags() const override;
public:
- virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
+ [[nodiscard]] const Type *GetType() const override APT_PURE;
// Stuff for accessing files on remote items
- virtual std::string ArchiveInfo(pkgCache::VerIterator const &Ver) const APT_OVERRIDE;
+ [[nodiscard]] std::string ArchiveInfo(pkgCache::VerIterator const &Ver) const override;
// Interface for the Cache Generator
- virtual bool HasPackages() const APT_OVERRIDE {return true;};
+ [[nodiscard]] bool HasPackages() const override {return true;};
debPackagesIndex(IndexTarget const &Target, bool const Trusted);
- virtual ~debPackagesIndex();
+ ~debPackagesIndex() override;
};
class debTranslationsIndex : public pkgDebianIndexTargetFile
{
void * const d;
protected:
- virtual std::string GetArchitecture() const APT_OVERRIDE;
- virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
- virtual bool OpenListFile(FileFd &Pkg, std::string const &FileName) APT_OVERRIDE;
- APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
+ [[nodiscard]] std::string GetArchitecture() const override;
+ [[nodiscard]] uint8_t GetIndexFlags() const override;
+ bool OpenListFile(FileFd &Pkg, std::string const &FileName) override;
+ APT_HIDDEN pkgCacheListParser *CreateListParser(FileFd &Pkg) override;
public:
-
- virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
+ [[nodiscard]] const Type *GetType() const override APT_PURE;
// Interface for the Cache Generator
- virtual bool HasPackages() const APT_OVERRIDE;
+ [[nodiscard]] bool HasPackages() const override;
explicit debTranslationsIndex(IndexTarget const &Target);
- virtual ~debTranslationsIndex();
+ ~debTranslationsIndex() override;
};
class debSourcesIndex : public pkgDebianIndexTargetFile
{
void * const d;
- virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
- virtual bool OpenListFile(FileFd &Pkg, std::string const &FileName) APT_OVERRIDE;
- APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
-
- public:
+ [[nodiscard]] uint8_t GetIndexFlags() const override;
+ bool OpenListFile(FileFd &Pkg, std::string const &FileName) override;
+ APT_HIDDEN pkgCacheListParser *CreateListParser(FileFd &Pkg) override;
- virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
+public:
+ [[nodiscard]] const Type *GetType() const override APT_PURE;
// Stuff for accessing files on remote items
- virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
- pkgSrcRecords::File const &File) const APT_OVERRIDE;
+ [[nodiscard]] std::string SourceInfo(pkgSrcRecords::Parser const &Record,
+ pkgSrcRecords::File const &File) const override;
// Interface for the record parsers
- virtual pkgSrcRecords::Parser *CreateSrcParser() const APT_OVERRIDE;
+ [[nodiscard]] pkgSrcRecords::Parser *CreateSrcParser() const override;
// Interface for the Cache Generator
- virtual bool HasPackages() const APT_OVERRIDE {return false;};
+ [[nodiscard]] bool HasPackages() const override { return false; };
debSourcesIndex(IndexTarget const &Target, bool const Trusted);
- virtual ~debSourcesIndex();
+ ~debSourcesIndex() override;
};
class debDebPkgFileIndex : public pkgDebianIndexRealFile
@@ -118,14 +116,14 @@ class debDebPkgFileIndex : public pkgDebianIndexRealFile
std::string DebFile;
protected:
- virtual std::string GetComponent() const APT_OVERRIDE;
- virtual std::string GetArchitecture() const APT_OVERRIDE;
- virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
- virtual bool OpenListFile(FileFd &Pkg, std::string const &FileName) APT_OVERRIDE;
- APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
+ [[nodiscard]] std::string GetComponent() const override;
+ [[nodiscard]] std::string GetArchitecture() const override;
+ [[nodiscard]] uint8_t GetIndexFlags() const override;
+ bool OpenListFile(FileFd &Pkg, std::string const &FileName) override;
+ APT_HIDDEN pkgCacheListParser *CreateListParser(FileFd &Pkg) override;
public:
- virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
+ [[nodiscard]] const Type *GetType() const override APT_PURE;
/** get the control (file) content of the deb file
*
@@ -136,15 +134,15 @@ public:
static bool GetContent(std::ostream &content, std::string const &debfile);
// Interface for the Cache Generator
- virtual bool HasPackages() const APT_OVERRIDE {return true;}
- virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const APT_OVERRIDE;
+ [[nodiscard]] bool HasPackages() const override { return true; }
+ pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const override;
// Interface for acquire
explicit debDebPkgFileIndex(std::string const &DebFile);
- virtual ~debDebPkgFileIndex();
+ ~debDebPkgFileIndex() override;
- std::string ArchiveInfo(pkgCache::VerIterator const &Ver) const override;
+ [[nodiscard]] std::string ArchiveInfo(pkgCache::VerIterator const &Ver) const override;
};
class APT_PUBLIC debDscFileIndex : public pkgDebianIndexRealFile
@@ -152,14 +150,14 @@ class APT_PUBLIC debDscFileIndex : public pkgDebianIndexRealFile
void * const d;
protected:
- virtual std::string GetComponent() const APT_OVERRIDE;
- virtual std::string GetArchitecture() const APT_OVERRIDE;
- virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
+ [[nodiscard]] std::string GetComponent() const override;
+ [[nodiscard]] std::string GetArchitecture() const override;
+ [[nodiscard]] uint8_t GetIndexFlags() const override;
public:
- virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
- virtual pkgSrcRecords::Parser *CreateSrcParser() const APT_OVERRIDE;
- virtual bool HasPackages() const APT_OVERRIDE {return false;};
+ [[nodiscard]] const Type *GetType() const override APT_PURE;
+ [[nodiscard]] pkgSrcRecords::Parser *CreateSrcParser() const override;
+ [[nodiscard]] bool HasPackages() const override { return false; };
explicit debDscFileIndex(std::string const &DscFile);
virtual ~debDscFileIndex();
@@ -168,29 +166,29 @@ public:
class debDebianSourceDirIndex : public debDscFileIndex
{
protected:
- virtual std::string GetComponent() const APT_OVERRIDE;
+ [[nodiscard]] std::string GetComponent() const override;
public:
- virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
+[[nodiscard]] const Type *GetType() const override APT_PURE;
};
class APT_PUBLIC debStringPackageIndex : public pkgDebianIndexRealFile
{
void * const d;
protected:
- virtual std::string GetArchitecture() const APT_OVERRIDE;
- virtual std::string GetComponent() const APT_OVERRIDE;
- virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
+ [[nodiscard]] std::string GetArchitecture() const override;
+ [[nodiscard]] std::string GetComponent() const override;
+ [[nodiscard]] uint8_t GetIndexFlags() const override;
-public:
- virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
+ public:
+ [[nodiscard]] const Type *GetType() const override APT_PURE;
// Interface for the Cache Generator
- virtual bool HasPackages() const APT_OVERRIDE {return true;};
+ [[nodiscard]] bool HasPackages() const override { return true; };
// Abort if the file does not exist.
- virtual bool Exists() const APT_OVERRIDE {return true;};
+ [[nodiscard]] bool Exists() const override { return true; };
explicit debStringPackageIndex(std::string const &content);
- virtual ~debStringPackageIndex();
+ ~debStringPackageIndex() override;
};
#endif
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h
index 637063f94..200e04036 100644
--- a/apt-pkg/deb/deblistparser.h
+++ b/apt-pkg/deb/deblistparser.h
@@ -59,21 +59,21 @@ class APT_HIDDEN debListParser : public pkgCacheListParser
APT_PUBLIC static unsigned char GetPrio(std::string Str);
// These all operate against the current section
- virtual std::string Package() APT_OVERRIDE;
- virtual bool ArchitectureAll() APT_OVERRIDE;
- virtual std::string_view Architecture() APT_OVERRIDE;
- virtual std::string_view Version() APT_OVERRIDE;
- virtual bool NewVersion(pkgCache::VerIterator &Ver) APT_OVERRIDE;
- virtual std::vector<std::string> AvailableDescriptionLanguages() APT_OVERRIDE;
- virtual std::string_view Description_md5() APT_OVERRIDE;
- virtual uint32_t VersionHash() APT_OVERRIDE;
- virtual bool SameVersion(uint32_t Hash, pkgCache::VerIterator const &Ver) APT_OVERRIDE;
- virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
- pkgCache::VerIterator &Ver) APT_OVERRIDE;
- virtual map_filesize_t Offset() APT_OVERRIDE {return iOffset;};
- virtual map_filesize_t Size() APT_OVERRIDE {return Section.size();};
-
- virtual bool Step() APT_OVERRIDE;
+ std::string Package() override;
+ bool ArchitectureAll() override;
+ std::string_view Architecture() override;
+ std::string_view Version() override;
+ bool NewVersion(pkgCache::VerIterator &Ver) override;
+ std::vector<std::string> AvailableDescriptionLanguages() override;
+ std::string_view Description_md5() override;
+ uint32_t VersionHash() override;
+ bool SameVersion(uint32_t Hash, pkgCache::VerIterator const &Ver) override;
+ bool UsePackage(pkgCache::PkgIterator &Pkg,
+ pkgCache::VerIterator &Ver) override;
+ map_filesize_t Offset() override { return iOffset; };
+ map_filesize_t Size() override { return Section.size(); };
+
+ bool Step() override;
APT_PUBLIC static const char *ParseDepends(const char *Start, const char *Stop,
std::string &Package, std::string &Ver, unsigned int &Op,
@@ -99,7 +99,7 @@ class APT_HIDDEN debListParser : public pkgCacheListParser
APT_PUBLIC static const char *ConvertRelation(const char *I,unsigned int &Op);
explicit debListParser(FileFd *File);
- virtual ~debListParser();
+ ~debListParser() override;
#ifdef APT_COMPILING_APT
std::string_view SHA256() const
@@ -116,25 +116,25 @@ class APT_HIDDEN debDebFileParser : public debListParser
public:
debDebFileParser(FileFd *File, std::string const &DebFile);
- virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
- pkgCache::VerIterator &Ver) APT_OVERRIDE;
+ bool UsePackage(pkgCache::PkgIterator &Pkg,
+ pkgCache::VerIterator &Ver) override;
};
class APT_HIDDEN debTranslationsParser : public debListParser
{
public:
// a translation can never be a real package
- virtual std::string_view Architecture() APT_OVERRIDE { return ""; }
- virtual std::string_view Version() APT_OVERRIDE { return ""; }
+ std::string_view Architecture() override { return {}; }
+ std::string_view Version() override { return {}; }
- explicit debTranslationsParser(FileFd *File)
- : debListParser(File) {};
+ explicit debTranslationsParser(FileFd *File)
+ : debListParser(File) {};
};
class APT_HIDDEN debStatusListParser : public debListParser
{
public:
- virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver) APT_OVERRIDE;
+ bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver) override;
explicit debStatusListParser(FileFd *File)
: debListParser(File) {};
};
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index b9369a898..191be05d6 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -1475,7 +1475,7 @@ class APT_HIDDEN debSLTypeDeb : public debSLTypeDebian /*{{{*/
bool CreateItem(std::vector<metaIndex *> &List, std::string const &URI,
std::string const &Dist, std::string const &Section,
- std::map<std::string, std::string> const &Options) const APT_OVERRIDE
+ std::map<std::string, std::string> const &Options) const override
{
return CreateItemInternal(List, URI, Dist, Section, false, Options);
}
@@ -1491,7 +1491,7 @@ class APT_HIDDEN debSLTypeDebSrc : public debSLTypeDebian /*{{{*/
bool CreateItem(std::vector<metaIndex *> &List, std::string const &URI,
std::string const &Dist, std::string const &Section,
- std::map<std::string, std::string> const &Options) const APT_OVERRIDE
+ std::map<std::string, std::string> const &Options) const override
{
return CreateItemInternal(List, URI, Dist, Section, true, Options);
}
diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h
index a1a9c41b5..7a6f1fbb4 100644
--- a/apt-pkg/deb/debmetaindex.h
+++ b/apt-pkg/deb/debmetaindex.h
@@ -30,20 +30,20 @@ class APT_HIDDEN debReleaseIndex : public metaIndex
debReleaseIndex(std::string const &URI, std::string const &Dist, std::map<std::string,std::string> const &Options);
debReleaseIndex(std::string const &URI, std::string const &Dist, bool const Trusted, std::map<std::string,std::string> const &Options);
- virtual ~debReleaseIndex();
+ ~debReleaseIndex() override;
- virtual std::string ArchiveURI(std::string const &File) const APT_OVERRIDE;
- virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) APT_OVERRIDE;
- virtual std::vector<IndexTarget> GetIndexTargets() const APT_OVERRIDE;
+ [[nodiscard]] std::string ArchiveURI(std::string const &File) const override;
+ bool GetIndexes(pkgAcquire *Owner, bool const &GetAll = false) override;
+ [[nodiscard]] std::vector<IndexTarget> GetIndexTargets() const override;
- virtual std::string Describe() const APT_OVERRIDE;
- virtual pkgCache::RlsFileIterator FindInCache(pkgCache &Cache, bool const ModifyCheck) const APT_OVERRIDE;
- virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const APT_OVERRIDE;
+ [[nodiscard]] std::string Describe() const override;
+ pkgCache::RlsFileIterator FindInCache(pkgCache &Cache, bool ModifyCheck) const override;
+ bool Merge(pkgCacheGenerator &Gen, OpProgress *Prog) const override;
- virtual bool Load(std::string const &Filename, std::string * const ErrorText) APT_OVERRIDE;
- virtual metaIndex * UnloadedClone() const APT_OVERRIDE;
+ bool Load(std::string const &Filename, std::string *ErrorText) override;
+ [[nodiscard]] metaIndex *UnloadedClone() const override;
- virtual std::vector <pkgIndexFile *> *GetIndexFiles() APT_OVERRIDE;
+ std::vector<pkgIndexFile *> *GetIndexFiles() override;
bool SetTrusted(TriState const Trusted);
bool SetCheckValidUntil(TriState const Trusted);
@@ -56,12 +56,12 @@ class APT_HIDDEN debReleaseIndex : public metaIndex
bool SetSignedBy(std::string const &SignedBy);
std::map<std::string, std::string> GetReleaseOptions();
- virtual bool IsTrusted() const APT_OVERRIDE;
- bool IsArchitectureSupported(std::string const &arch) const override;
- bool IsArchitectureAllSupportedFor(IndexTarget const &target) const override;
- bool HasSupportForComponent(std::string const &component) const override;
+ [[nodiscard]] bool IsTrusted() const override;
+ [[nodiscard]] bool IsArchitectureSupported(std::string const &arch) const override;
+ [[nodiscard]] bool IsArchitectureAllSupportedFor(IndexTarget const &target) const override;
+ [[nodiscard]] bool HasSupportForComponent(std::string const &component) const override;
- APT_PURE time_t GetNotBefore() const override;
+ [[nodiscard]] time_t GetNotBefore() const override APT_PURE;
void AddComponent(std::string const &sourcesEntry,
bool const isSrc, std::string const &Name,
diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h
index 10ef91768..050f0399f 100644
--- a/apt-pkg/deb/debrecords.h
+++ b/apt-pkg/deb/debrecords.h
@@ -29,26 +29,26 @@ class APT_HIDDEN debRecordParserBase : public pkgRecords::Parser
public:
// These refer to the archive file for the Version
- virtual std::string FileName() APT_OVERRIDE;
- virtual std::string SourcePkg() APT_OVERRIDE;
- virtual std::string SourceVer() APT_OVERRIDE;
+ std::string FileName() override;
+ std::string SourcePkg() override;
+ std::string SourceVer() override;
- virtual HashStringList Hashes() const APT_OVERRIDE;
+ [[nodiscard]] HashStringList Hashes() const override;
// These are some general stats about the package
- virtual std::string Maintainer() APT_OVERRIDE;
- virtual std::string ShortDesc(std::string const &lang) APT_OVERRIDE;
- virtual std::string LongDesc(std::string const &lang) APT_OVERRIDE;
- virtual std::string Name() APT_OVERRIDE;
- virtual std::string Homepage() APT_OVERRIDE;
+ std::string Maintainer() override;
+ std::string ShortDesc(std::string const &lang) override;
+ std::string LongDesc(std::string const &lang) override;
+ std::string Name() override;
+ std::string Homepage() override;
// An arbitrary custom field
- virtual std::string RecordField(const char *fieldName) APT_OVERRIDE;
+ std::string RecordField(const char *fieldName) override;
- virtual void GetRec(const char *&Start,const char *&Stop) APT_OVERRIDE;
+ void GetRec(const char *&Start, const char *&Stop) override;
debRecordParserBase();
- virtual ~debRecordParserBase();
+ ~debRecordParserBase() override;
};
class APT_HIDDEN debRecordParser : public debRecordParserBase
@@ -58,12 +58,12 @@ class APT_HIDDEN debRecordParser : public debRecordParserBase
FileFd File;
pkgTagFile Tags;
- virtual bool Jump(pkgCache::VerFileIterator const &Ver) APT_OVERRIDE;
- virtual bool Jump(pkgCache::DescFileIterator const &Desc) APT_OVERRIDE;
+ bool Jump(pkgCache::VerFileIterator const &Ver) override;
+ bool Jump(pkgCache::DescFileIterator const &Desc) override;
public:
debRecordParser(std::string FileName,pkgCache &Cache);
- virtual ~debRecordParser();
+ ~debRecordParser() override;
};
// custom record parser that reads deb files directly
@@ -76,14 +76,14 @@ class APT_HIDDEN debDebFileRecordParser : public debRecordParserBase
APT_HIDDEN bool LoadContent();
protected:
// single file files, so no jumping whatsoever
- bool Jump(pkgCache::VerFileIterator const &) APT_OVERRIDE;
- bool Jump(pkgCache::DescFileIterator const &) APT_OVERRIDE;
+ bool Jump(pkgCache::VerFileIterator const &/*Ver*/) override;
+ bool Jump(pkgCache::DescFileIterator const & /*Desc*/) override;
public:
- virtual std::string FileName() APT_OVERRIDE;
+ std::string FileName() override;
- explicit debDebFileRecordParser(std::string FileName);
- virtual ~debDebFileRecordParser();
+ explicit debDebFileRecordParser(std::string FileName);
+ ~debDebFileRecordParser() override;
};
#endif
diff --git a/apt-pkg/deb/debsrcrecords.h b/apt-pkg/deb/debsrcrecords.h
index dedcb6dbe..a439efa82 100644
--- a/apt-pkg/deb/debsrcrecords.h
+++ b/apt-pkg/deb/debsrcrecords.h
@@ -35,28 +35,27 @@ class APT_HIDDEN debSrcRecordParser : public pkgSrcRecords::Parser
char *Buffer;
public:
+ bool Restart() override { return Jump(0); }
+ bool Step() override {iOffset = Tags.Offset(); return Tags.Step(Sect);}
+ bool Jump(unsigned long const &Off) override {iOffset = Off; return Tags.Jump(Sect,Off);}
- virtual bool Restart() APT_OVERRIDE {return Jump(0);};
- virtual bool Step() APT_OVERRIDE {iOffset = Tags.Offset(); return Tags.Step(Sect);};
- virtual bool Jump(unsigned long const &Off) APT_OVERRIDE {iOffset = Off; return Tags.Jump(Sect,Off);};
-
- virtual std::string Package() const APT_OVERRIDE;
- virtual std::string Version() const APT_OVERRIDE {return std::string{Sect.Find(pkgTagSection::Key::Version)};};
- virtual std::string Maintainer() const APT_OVERRIDE {return std::string{Sect.Find(pkgTagSection::Key::Maintainer)};};
- virtual std::string Section() const APT_OVERRIDE {return std::string{Sect.Find(pkgTagSection::Key::Section)};};
- virtual const char **Binaries() APT_OVERRIDE;
- virtual bool BuildDepends(std::vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true) APT_OVERRIDE;
- virtual unsigned long Offset() APT_OVERRIDE {return iOffset;};
- virtual std::string AsStr() APT_OVERRIDE
+ [[nodiscard]] std::string Package() const override;
+ [[nodiscard]] std::string Version() const override { return std::string{Sect.Find(pkgTagSection::Key::Version)}; }
+ [[nodiscard]] std::string Maintainer() const override { return std::string{Sect.Find(pkgTagSection::Key::Maintainer)}; }
+ [[nodiscard]] std::string Section() const override { return std::string{Sect.Find(pkgTagSection::Key::Section)}; }
+ const char **Binaries() override;
+ bool BuildDepends(std::vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true) override;
+ unsigned long Offset() override { return iOffset; }
+ std::string AsStr() override
{
const char *Start=0,*Stop=0;
Sect.GetSection(Start,Stop);
return std::string(Start,Stop);
};
- virtual bool Files(std::vector<pkgSrcRecords::File> &F) APT_OVERRIDE;
+ bool Files(std::vector<pkgSrcRecords::File> &F) override;
debSrcRecordParser(std::string const &File,pkgIndexFile const *Index);
- virtual ~debSrcRecordParser();
+ ~debSrcRecordParser() override;
};
class APT_HIDDEN debDscRecordParser : public debSrcRecordParser
diff --git a/apt-pkg/deb/debsystem.h b/apt-pkg/deb/debsystem.h
index c426faf81..294ae1819 100644
--- a/apt-pkg/deb/debsystem.h
+++ b/apt-pkg/deb/debsystem.h
@@ -27,18 +27,18 @@ class debSystem : public pkgSystem
APT_HIDDEN bool CheckUpdates();
public:
- virtual bool Lock(OpProgress *const Progress) APT_OVERRIDE;
- virtual bool UnLock(bool NoErrors = false) APT_OVERRIDE;
- virtual pkgPackageManager *CreatePM(pkgDepCache *Cache) const APT_OVERRIDE;
- virtual bool Initialize(Configuration &Cnf) APT_OVERRIDE;
- virtual bool ArchiveSupported(const char *Type) APT_OVERRIDE;
- virtual signed Score(Configuration const &Cnf) APT_OVERRIDE;
- virtual bool AddStatusFiles(std::vector<pkgIndexFile *> &List) APT_OVERRIDE;
- virtual bool FindIndex(pkgCache::PkgFileIterator File,
- pkgIndexFile *&Found) const APT_OVERRIDE;
+ bool Lock(OpProgress *Progress) override;
+ bool UnLock(bool NoErrors = false) override;
+ pkgPackageManager *CreatePM(pkgDepCache *Cache) const override;
+ bool Initialize(Configuration &Cnf) override;
+ bool ArchiveSupported(const char *Type) override;
+ signed Score(Configuration const &Cnf) override;
+ bool AddStatusFiles(std::vector<pkgIndexFile *> &List) override;
+ bool FindIndex(pkgCache::PkgFileIterator File,
+ pkgIndexFile *&Found) const override;
debSystem();
- virtual ~debSystem();
+ ~debSystem() override;
APT_HIDDEN static std::string GetDpkgExecutable();
APT_HIDDEN static std::vector<std::string> GetDpkgBaseCommand();
diff --git a/apt-pkg/deb/debversion.h b/apt-pkg/deb/debversion.h
index 5c328a985..6d82e5889 100644
--- a/apt-pkg/deb/debversion.h
+++ b/apt-pkg/deb/debversion.h
@@ -23,15 +23,15 @@ class APT_PUBLIC debVersioningSystem : public pkgVersioningSystem
const char *BEnd) APT_PURE;
// Compare versions..
- virtual int DoCmpVersion(const char *A,const char *Aend,
- const char *B,const char *Bend) APT_OVERRIDE APT_PURE;
- virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) APT_OVERRIDE APT_PURE;
- virtual APT_PURE int DoCmpReleaseVer(const char *A,const char *Aend,
- const char *B,const char *Bend) APT_OVERRIDE
+ int DoCmpVersion(const char *A, const char *Aend,
+ const char *B, const char *Bend) override APT_PURE;
+ bool CheckDep(const char *PkgVer, int Op, const char *DepVer) override APT_PURE;
+ int DoCmpReleaseVer(const char *A, const char *Aend,
+ const char *B, const char *Bend) override APT_PURE
{
return DoCmpVersion(A,Aend,B,Bend);
}
- virtual std::string UpstreamVersion(const char *A) APT_OVERRIDE;
+ std::string UpstreamVersion(const char *A) override;
debVersioningSystem();
};
diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h
index ed0b67b31..5ce9dc110 100644
--- a/apt-pkg/deb/dpkgpm.h
+++ b/apt-pkg/deb/dpkgpm.h
@@ -113,18 +113,18 @@ class APT_PUBLIC pkgDPkgPM : public pkgPackageManager
void ProcessDpkgStatusLine(char *line);
// The Actual installation implementation
- virtual bool Install(PkgIterator Pkg,std::string File) APT_OVERRIDE;
- virtual bool Configure(PkgIterator Pkg) APT_OVERRIDE;
- virtual bool Remove(PkgIterator Pkg,bool Purge = false) APT_OVERRIDE;
+ bool Install(PkgIterator Pkg,std::string File) override;
+ bool Configure(PkgIterator Pkg) override;
+ bool Remove(PkgIterator Pkg, bool Purge = false) override;
- virtual bool Go(APT::Progress::PackageManager *progress) APT_OVERRIDE;
+ bool Go(APT::Progress::PackageManager *progress) override;
+
+ void Reset() override;
- virtual void Reset() APT_OVERRIDE;
-
public:
explicit pkgDPkgPM(pkgDepCache *Cache);
- virtual ~pkgDPkgPM();
+ ~pkgDPkgPM() override;
APT_HIDDEN static bool ExpandPendingCalls(std::vector<Item> &List, pkgDepCache &Cache);
};
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 4e8f5222a..fcc974ae3 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -62,9 +62,9 @@ class DefaultRootSetFunc2 : public pkgDepCache::DefaultRootSetFunc
public:
DefaultRootSetFunc2(pkgCache *cache) : Kernels(APT::KernelAutoRemoveHelper::GetProtectedKernelsFilter(cache)){};
- virtual ~DefaultRootSetFunc2(){};
+ ~DefaultRootSetFunc2() override = default;
- bool InRootSet(const pkgCache::PkgIterator &pkg) APT_OVERRIDE { return pkg.end() == false && ((*Kernels)(pkg) || DefaultRootSetFunc::InRootSet(pkg)); };
+ bool InRootSet(const pkgCache::PkgIterator &pkg) override { return pkg.end() == false && ((*Kernels)(pkg) || DefaultRootSetFunc::InRootSet(pkg)); };
};
/*}}}*/
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index 23047b97a..49ef4f441 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -178,9 +178,9 @@ class APT_PUBLIC pkgDepCache : protected pkgCache::Namespace
{
public:
DefaultRootSetFunc() : Configuration::MatchAgainstConfig("APT::NeverAutoRemove") {};
- virtual ~DefaultRootSetFunc() {};
+ ~DefaultRootSetFunc() override = default;
- bool InRootSet(const pkgCache::PkgIterator &pkg) APT_OVERRIDE { return pkg.end() == false && Match(pkg.Name()); };
+ bool InRootSet(const pkgCache::PkgIterator &pkg) override { return pkg.end() == false && Match(pkg.Name()); };
};
struct APT_PUBLIC StateCache
diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc
index e97f16894..99947f4fb 100644
--- a/apt-pkg/edsp/edspindexfile.cc
+++ b/apt-pkg/edsp/edspindexfile.cc
@@ -28,7 +28,7 @@ edspLikeIndex::edspLikeIndex(std::string const &File) : pkgDebianIndexRealFile(F
}
std::string edspLikeIndex::GetArchitecture() const
{
- return std::string();
+ return {};
}
bool edspLikeIndex::HasPackages() const
{
@@ -94,10 +94,10 @@ pkgCacheListParser * eippIndex::CreateListParser(FileFd &Pkg)
class APT_HIDDEN edspIFType: public pkgIndexFile::Type
{
public:
- virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &) const APT_OVERRIDE
+ [[nodiscard]] pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &/*PkgFile*/) const override
{
// we don't have a record parser for this type as the file is not persistent
- return NULL;
+ return nullptr;
};
edspIFType() {Label = "EDSP scenario file";};
};
@@ -110,10 +110,10 @@ const pkgIndexFile::Type *edspIndex::GetType() const
class APT_HIDDEN eippIFType: public pkgIndexFile::Type
{
public:
- virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &) const APT_OVERRIDE
+ [[nodiscard]] pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &/*PkgFile*/) const override
{
// we don't have a record parser for this type as the file is not persistent
- return NULL;
+ return nullptr;
};
eippIFType() {Label = "EIPP scenario file";};
};
@@ -124,6 +124,6 @@ const pkgIndexFile::Type *eippIndex::GetType() const
}
/*}}}*/
-edspLikeIndex::~edspLikeIndex() {}
-edspIndex::~edspIndex() {}
-eippIndex::~eippIndex() {}
+edspLikeIndex::~edspLikeIndex() = default;
+edspIndex::~edspIndex() = default;
+eippIndex::~eippIndex() = default;
diff --git a/apt-pkg/edsp/edspindexfile.h b/apt-pkg/edsp/edspindexfile.h
index 42ef3fea3..ee1079aa4 100644
--- a/apt-pkg/edsp/edspindexfile.h
+++ b/apt-pkg/edsp/edspindexfile.h
@@ -18,42 +18,42 @@ class pkgCacheGenerator;
class APT_HIDDEN edspLikeIndex : public pkgDebianIndexRealFile
{
protected:
- virtual bool OpenListFile(FileFd &Pkg, std::string const &File) APT_OVERRIDE;
- virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
- virtual std::string GetArchitecture() const APT_OVERRIDE;
+ bool OpenListFile(FileFd &Pkg, std::string const &File) override;
+ [[nodiscard]] uint8_t GetIndexFlags() const override;
+ [[nodiscard]] std::string GetArchitecture() const override;
-public:
- virtual bool Exists() const APT_OVERRIDE;
- virtual bool HasPackages() const APT_OVERRIDE;
+ public:
+ [[nodiscard]] bool Exists() const override;
+ [[nodiscard]] bool HasPackages() const override;
explicit edspLikeIndex(std::string const &File);
- virtual ~edspLikeIndex();
+ ~edspLikeIndex() override;
};
class APT_HIDDEN edspIndex : public edspLikeIndex
{
protected:
- APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
- virtual std::string GetComponent() const APT_OVERRIDE;
+ APT_HIDDEN pkgCacheListParser *CreateListParser(FileFd &Pkg) override;
+ [[nodiscard]] std::string GetComponent() const override;
public:
- virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
+ [[nodiscard]] const Type *GetType() const override APT_PURE;
explicit edspIndex(std::string const &File);
- virtual ~edspIndex();
+ ~edspIndex() override;
};
class APT_HIDDEN eippIndex : public edspLikeIndex
{
protected:
- APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
- virtual std::string GetComponent() const APT_OVERRIDE;
+ APT_HIDDEN pkgCacheListParser *CreateListParser(FileFd &Pkg) override;
+ [[nodiscard]] std::string GetComponent() const override;
-public:
- virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
+ public:
+ [[nodiscard]] const Type *GetType() const override APT_PURE;
explicit eippIndex(std::string const &File);
- virtual ~eippIndex();
+ ~eippIndex() override;
};
#endif
diff --git a/apt-pkg/edsp/edsplistparser.h b/apt-pkg/edsp/edsplistparser.h
index 3f0f3e64c..a7ad9830c 100644
--- a/apt-pkg/edsp/edsplistparser.h
+++ b/apt-pkg/edsp/edsplistparser.h
@@ -21,13 +21,13 @@
class APT_HIDDEN edspLikeListParser : public debListParser
{
public:
- virtual bool NewVersion(pkgCache::VerIterator &Ver) APT_OVERRIDE;
- virtual std::vector<std::string> AvailableDescriptionLanguages() APT_OVERRIDE;
- virtual std::string_view Description_md5() APT_OVERRIDE;
- virtual uint32_t VersionHash() APT_OVERRIDE;
+ bool NewVersion(pkgCache::VerIterator &Ver) override;
+ std::vector<std::string> AvailableDescriptionLanguages() override;
+ std::string_view Description_md5() override;
+ uint32_t VersionHash() override;
explicit edspLikeListParser(FileFd *File);
- virtual ~edspLikeListParser();
+ ~edspLikeListParser() override;
};
class APT_HIDDEN edspListParser : public edspLikeListParser
@@ -36,20 +36,20 @@ class APT_HIDDEN edspListParser : public edspLikeListParser
FileFd preferences;
protected:
- virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver) APT_OVERRIDE;
+ bool ParseStatus(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver) override;
public:
explicit edspListParser(FileFd *File);
- virtual ~edspListParser();
+ ~edspListParser() override;
};
class APT_HIDDEN eippListParser : public edspLikeListParser
{
protected:
- virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver) APT_OVERRIDE;
+ bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver) override;
public:
explicit eippListParser(FileFd *File);
- virtual ~eippListParser();
+ ~eippListParser() override;
};
#endif
diff --git a/apt-pkg/edsp/edspsystem.h b/apt-pkg/edsp/edspsystem.h
index 97c2d66e2..e34c4ecce 100644
--- a/apt-pkg/edsp/edspsystem.h
+++ b/apt-pkg/edsp/edspsystem.h
@@ -29,24 +29,24 @@ protected:
std::unique_ptr<pkgIndexFile> StatusFile;
public:
- virtual bool Lock(OpProgress * const Progress) APT_OVERRIDE APT_PURE;
- virtual bool UnLock(bool NoErrors = false) APT_OVERRIDE APT_PURE;
- virtual pkgPackageManager *CreatePM(pkgDepCache *Cache) const APT_OVERRIDE APT_PURE;
- virtual bool Initialize(Configuration &Cnf) APT_OVERRIDE;
- virtual bool ArchiveSupported(const char *Type) APT_OVERRIDE APT_PURE;
- virtual signed Score(Configuration const &Cnf) APT_OVERRIDE;
- virtual bool FindIndex(pkgCache::PkgFileIterator File,
- pkgIndexFile *&Found) const APT_OVERRIDE;
-
- bool MultiArchSupported() const override { return true; }
- std::vector<std::string> ArchitecturesSupported() const override { return {}; };
-
- bool LockInner(OpProgress * const, int) override { return _error->Error("LockInner is not implemented"); };
- bool UnLockInner(bool) override { return _error->Error("UnLockInner is not implemented"); };
+ bool Lock(OpProgress *Progress) override APT_PURE;
+ bool UnLock(bool NoErrors = false) override APT_PURE;
+ pkgPackageManager *CreatePM(pkgDepCache *Cache) const override APT_PURE;
+ bool Initialize(Configuration &Cnf) override;
+ bool ArchiveSupported(const char *Type) override APT_PURE;
+ signed Score(Configuration const &Cnf) override;
+ bool FindIndex(pkgCache::PkgFileIterator File,
+ pkgIndexFile *&Found) const override;
+
+ [[nodiscard]] bool MultiArchSupported() const override { return true; }
+ [[nodiscard]] std::vector<std::string> ArchitecturesSupported() const override { return {}; };
+
+ bool LockInner(OpProgress * const /*Progress*/, int /*timeOutSec*/) override { return _error->Error("LockInner is not implemented"); };
+ bool UnLockInner(bool /*NoErrors*/) override { return _error->Error("UnLockInner is not implemented"); };
bool IsLocked() override { return true; };
explicit edspLikeSystem(char const * const Label);
- virtual ~edspLikeSystem();
+ ~edspLikeSystem() override;
};
class APT_HIDDEN edspSystem : public edspLikeSystem
@@ -56,20 +56,20 @@ class APT_HIDDEN edspSystem : public edspLikeSystem
std::string tempPrefsFile;
public:
- virtual bool Initialize(Configuration &Cnf) APT_OVERRIDE;
- virtual bool AddStatusFiles(std::vector<pkgIndexFile *> &List) APT_OVERRIDE;
+ bool Initialize(Configuration &Cnf) override;
+ bool AddStatusFiles(std::vector<pkgIndexFile *> &List) override;
edspSystem();
- virtual ~edspSystem();
+ ~edspSystem() override;
};
class APT_HIDDEN eippSystem : public edspLikeSystem
{
public:
- virtual bool AddStatusFiles(std::vector<pkgIndexFile *> &List) APT_OVERRIDE;
+ bool AddStatusFiles(std::vector<pkgIndexFile *> &List) override;
eippSystem();
- virtual ~eippSystem();
+ ~eippSystem() override;
};
#endif
diff --git a/apt-pkg/indexcopy.h b/apt-pkg/indexcopy.h
index 5fcce20d0..d81bc092f 100644
--- a/apt-pkg/indexcopy.h
+++ b/apt-pkg/indexcopy.h
@@ -55,30 +55,28 @@ class APT_PUBLIC PackageCopy : public IndexCopy /*{{{*/
{
void * const d;
protected:
-
- virtual bool GetFile(std::string &Filename,unsigned long long &Size) APT_OVERRIDE;
- virtual bool RewriteEntry(FileFd &Target, std::string const &File) APT_OVERRIDE;
- virtual const char *GetFileName() APT_OVERRIDE {return "Packages";};
- virtual const char *Type() APT_OVERRIDE {return "Package";};
+ bool GetFile(std::string &Filename, unsigned long long &Size) override;
+ bool RewriteEntry(FileFd &Target, std::string const &File) override;
+ const char *GetFileName() override { return "Packages"; }
+ const char *Type() override { return "Package"; }
public:
PackageCopy();
- virtual ~PackageCopy();
+ ~PackageCopy() override;
};
/*}}}*/
class APT_PUBLIC SourceCopy : public IndexCopy /*{{{*/
{
void * const d;
protected:
-
- virtual bool GetFile(std::string &Filename,unsigned long long &Size) APT_OVERRIDE;
- virtual bool RewriteEntry(FileFd &Target, std::string const &File) APT_OVERRIDE;
- virtual const char *GetFileName() APT_OVERRIDE {return "Sources";};
- virtual const char *Type() APT_OVERRIDE {return "Source";};
+ bool GetFile(std::string &Filename, unsigned long long &Size) override;
+ bool RewriteEntry(FileFd &Target, std::string const &File) override;
+ const char *GetFileName() override { return "Sources"; }
+ const char *Type() override { return "Source"; };
public:
SourceCopy();
- virtual ~SourceCopy();
+ ~SourceCopy() override;
};
/*}}}*/
class APT_PUBLIC TranslationsCopy /*{{{*/
diff --git a/apt-pkg/indexfile.h b/apt-pkg/indexfile.h
index 95cee5dbc..ce57745ea 100644
--- a/apt-pkg/indexfile.h
+++ b/apt-pkg/indexfile.h
@@ -163,11 +163,11 @@ protected:
APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg);
public:
- virtual bool Merge(pkgCacheGenerator &Gen, OpProgress* const Prog) APT_OVERRIDE;
- virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const APT_OVERRIDE;
+ bool Merge(pkgCacheGenerator &Gen, OpProgress *Prog) override;
+ pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const override;
explicit pkgDebianIndexFile(bool const Trusted);
- virtual ~pkgDebianIndexFile();
+ ~pkgDebianIndexFile() override;
};
class APT_PUBLIC pkgDebianIndexTargetFile : public pkgDebianIndexFile
@@ -176,21 +176,21 @@ class APT_PUBLIC pkgDebianIndexTargetFile : public pkgDebianIndexFile
protected:
IndexTarget const Target;
- virtual std::string IndexFileName() const APT_OVERRIDE;
- virtual std::string GetComponent() const APT_OVERRIDE;
- virtual std::string GetArchitecture() const APT_OVERRIDE;
- virtual std::string GetProgressDescription() const APT_OVERRIDE;
- virtual bool OpenListFile(FileFd &Pkg, std::string const &FileName) APT_OVERRIDE;
+ std::string IndexFileName() const override;
+ [[nodiscard]] std::string GetComponent() const override;
+ [[nodiscard]] std::string GetArchitecture() const override;
+ [[nodiscard]] std::string GetProgressDescription() const override;
+ bool OpenListFile(FileFd &Pkg, std::string const &FileName) override;
-public:
- virtual std::string ArchiveURI(std::string const &File) const APT_OVERRIDE;
- virtual std::string Describe(bool const Short = false) const APT_OVERRIDE;
- virtual bool Exists() const APT_OVERRIDE;
- virtual unsigned long Size() const APT_OVERRIDE;
+ public:
+ [[nodiscard]] std::string ArchiveURI(std::string const &File) const override;
+ [[nodiscard]] std::string Describe(bool Short = false) const override;
+ [[nodiscard]] bool Exists() const override;
+ [[nodiscard]] unsigned long Size() const override;
IndexTarget GetIndexTarget() const APT_HIDDEN;
pkgDebianIndexTargetFile(IndexTarget const &Target, bool const Trusted);
- virtual ~pkgDebianIndexTargetFile();
+ ~pkgDebianIndexTargetFile() override;
};
class APT_PUBLIC pkgDebianIndexRealFile : public pkgDebianIndexFile
@@ -199,17 +199,18 @@ class APT_PUBLIC pkgDebianIndexRealFile : public pkgDebianIndexFile
protected:
std::string File;
- virtual std::string IndexFileName() const APT_OVERRIDE;
- virtual std::string GetProgressDescription() const APT_OVERRIDE;
- virtual bool OpenListFile(FileFd &Pkg, std::string const &FileName) APT_OVERRIDE;
-public:
- virtual std::string Describe(bool const /*Short*/ = false) const APT_OVERRIDE;
- virtual bool Exists() const APT_OVERRIDE;
- virtual unsigned long Size() const APT_OVERRIDE;
- virtual std::string ArchiveURI(std::string const &/*File*/) const APT_OVERRIDE;
+ [[nodiscard]] std::string IndexFileName() const override;
+ [[nodiscard]] std::string GetProgressDescription() const override;
+ bool OpenListFile(FileFd &Pkg, std::string const &FileName) override;
+
+ public:
+ [[nodiscard]] std::string Describe(bool /*Short*/ = false) const override;
+ [[nodiscard]] bool Exists() const override;
+ [[nodiscard]] unsigned long Size() const override;
+ [[nodiscard]] std::string ArchiveURI(std::string const & /*File*/) const override;
pkgDebianIndexRealFile(std::string const &File, bool const Trusted);
- virtual ~pkgDebianIndexRealFile();
+ ~pkgDebianIndexRealFile() override;
};
#endif
diff --git a/apt-pkg/install-progress.h b/apt-pkg/install-progress.h
index db060b3bc..499ac238f 100644
--- a/apt-pkg/install-progress.h
+++ b/apt-pkg/install-progress.h
@@ -70,24 +70,23 @@ namespace Progress {
public:
explicit PackageManagerProgressFd(int progress_fd);
- virtual ~PackageManagerProgressFd();
-
- virtual void StartDpkg() APT_OVERRIDE;
- virtual void Stop() APT_OVERRIDE;
-
- virtual bool StatusChanged(std::string PackageName,
- unsigned int StepsDone,
- unsigned int TotalSteps,
- std::string HumanReadableAction) APT_OVERRIDE;
- virtual void Error(std::string PackageName,
- unsigned int StepsDone,
- unsigned int TotalSteps,
- std::string ErrorMessage) APT_OVERRIDE;
- virtual void ConffilePrompt(std::string PackageName,
- unsigned int StepsDone,
- unsigned int TotalSteps,
- std::string ConfMessage) APT_OVERRIDE;
-
+ ~PackageManagerProgressFd() override;
+
+ void StartDpkg() override;
+ void Stop() override;
+
+ bool StatusChanged(std::string PackageName,
+ unsigned int StepsDone,
+ unsigned int TotalSteps,
+ std::string HumanReadableAction) override;
+ void Error(std::string PackageName,
+ unsigned int StepsDone,
+ unsigned int TotalSteps,
+ std::string ErrorMessage) override;
+ void ConffilePrompt(std::string PackageName,
+ unsigned int StepsDone,
+ unsigned int TotalSteps,
+ std::string ConfMessage) override;
};
class APT_PUBLIC PackageManagerProgressDeb822Fd : public PackageManager
@@ -101,23 +100,23 @@ namespace Progress {
public:
explicit PackageManagerProgressDeb822Fd(int progress_fd);
- virtual ~PackageManagerProgressDeb822Fd();
-
- virtual void StartDpkg() APT_OVERRIDE;
- virtual void Stop() APT_OVERRIDE;
-
- virtual bool StatusChanged(std::string PackageName,
- unsigned int StepsDone,
- unsigned int TotalSteps,
- std::string HumanReadableAction) APT_OVERRIDE;
- virtual void Error(std::string PackageName,
- unsigned int StepsDone,
- unsigned int TotalSteps,
- std::string ErrorMessage) APT_OVERRIDE;
- virtual void ConffilePrompt(std::string PackageName,
- unsigned int StepsDone,
- unsigned int TotalSteps,
- std::string ConfMessage) APT_OVERRIDE;
+ ~PackageManagerProgressDeb822Fd() override;
+
+ void StartDpkg() override;
+ void Stop() override;
+
+ bool StatusChanged(std::string PackageName,
+ unsigned int StepsDone,
+ unsigned int TotalSteps,
+ std::string HumanReadableAction) override;
+ void Error(std::string PackageName,
+ unsigned int StepsDone,
+ unsigned int TotalSteps,
+ std::string ErrorMessage) override;
+ void ConffilePrompt(std::string PackageName,
+ unsigned int StepsDone,
+ unsigned int TotalSteps,
+ std::string ConfMessage) override;
};
class APT_PUBLIC PackageManagerFancy : public PackageManager
@@ -146,14 +145,14 @@ namespace Progress {
public:
PackageManagerFancy();
- virtual ~PackageManagerFancy();
- virtual void Pulse() APT_OVERRIDE;
- virtual void Start(int child_pty=-1) APT_OVERRIDE;
- virtual void Stop() APT_OVERRIDE;
- virtual bool StatusChanged(std::string PackageName,
- unsigned int StepsDone,
- unsigned int TotalSteps,
- std::string HumanReadableAction) APT_OVERRIDE;
+ ~PackageManagerFancy() override;
+ void Pulse() override;
+ void Start(int child_pty = -1) override;
+ void Stop() override;
+ bool StatusChanged(std::string PackageName,
+ unsigned int StepsDone,
+ unsigned int TotalSteps,
+ std::string HumanReadableAction) override;
// return a progress bar of the given size for the given progress
// percent between 0.0 and 1.0 in the form "[####...]"
@@ -164,13 +163,13 @@ namespace Progress {
{
void * const d;
public:
- virtual bool StatusChanged(std::string PackageName,
- unsigned int StepsDone,
- unsigned int TotalSteps,
- std::string HumanReadableAction) APT_OVERRIDE;
+ bool StatusChanged(std::string PackageName,
+ unsigned int StepsDone,
+ unsigned int TotalSteps,
+ std::string HumanReadableAction) override;
PackageManagerText();
- virtual ~PackageManagerText();
+ ~PackageManagerText() override;
};
diff --git a/apt-pkg/policy.h b/apt-pkg/policy.h
index 589cebcde..3a377fe25 100644
--- a/apt-pkg/policy.h
+++ b/apt-pkg/policy.h
@@ -72,9 +72,9 @@ class APT_PUBLIC pkgPolicy : public pkgDepCache::Policy
std::string Data,signed short Priority);
// Things for the cache interface.
- virtual pkgCache::VerIterator GetCandidateVer(pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
- virtual signed short GetPriority(pkgCache::VerIterator const &Ver, bool ConsiderFiles = true) APT_OVERRIDE;
- virtual signed short GetPriority(pkgCache::PkgFileIterator const &File) APT_OVERRIDE;
+ pkgCache::VerIterator GetCandidateVer(pkgCache::PkgIterator const &Pkg) override;
+ signed short GetPriority(pkgCache::VerIterator const &Ver, bool ConsiderFiles = true) override;
+ signed short GetPriority(pkgCache::PkgFileIterator const &File) override;
void SetPriority(pkgCache::VerIterator const &Ver, signed short Priority);
void SetPriority(pkgCache::PkgFileIterator const &File, signed short Priority);
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc
index 00663ddca..da80222e8 100644
--- a/apt-pkg/solver3.cc
+++ b/apt-pkg/solver3.cc
@@ -162,9 +162,9 @@ class DefaultRootSetFunc2 : public pkgDepCache::DefaultRootSetFunc
public:
DefaultRootSetFunc2(pkgCache *cache) : Kernels(APT::KernelAutoRemoveHelper::GetProtectedKernelsFilter(cache)) {};
- virtual ~DefaultRootSetFunc2() {};
+ ~DefaultRootSetFunc2() override = default;
- bool InRootSet(const pkgCache::PkgIterator &pkg) APT_OVERRIDE { return pkg.end() == false && ((*Kernels)(pkg) || DefaultRootSetFunc::InRootSet(pkg)); };
+ bool InRootSet(const pkgCache::PkgIterator &pkg) override { return pkg.end() == false && ((*Kernels)(pkg) || DefaultRootSetFunc::InRootSet(pkg)); };
}; // FIXME: DEDUP with pkgDepCache.
/*}}}*/