From f73593a4034d9eec0ec4466b8e173d4a4daece1f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 26 Dec 2024 19:41:53 +0000 Subject: Drop usage of macro APT_OVERRIDE for simple override We were rather inconsistent in using it and as our public headers contain deduction guides (a c++17 feature) it seems silly to try to hide a c++11 feature in a macro, so lets stop this charade and drop the macro and while we are changing all these lines lets apply [[nodiscard]] (another c++17 feature) and other suggestions from clang-tidy and formatting for a little more consistency. --- methods/aptmethod.h | 4 ++-- methods/basehttp.h | 4 ++-- methods/cdrom.cc | 6 +++--- methods/connect.cc | 8 ++++---- methods/copy.cc | 2 +- methods/file.cc | 2 +- methods/gpgv.cc | 2 +- methods/http.cc | 10 +++++----- methods/http.h | 38 +++++++++++++++++++------------------- methods/mirror.cc | 10 +++++----- methods/rred.cc | 2 +- methods/sqv.cc | 2 +- methods/store.cc | 2 +- 13 files changed, 46 insertions(+), 46 deletions(-) (limited to 'methods') diff --git a/methods/aptmethod.h b/methods/aptmethod.h index 1ea173075..f564499f0 100644 --- a/methods/aptmethod.h +++ b/methods/aptmethod.h @@ -120,7 +120,7 @@ protected: }; public: - virtual bool Configuration(std::string Message) APT_OVERRIDE + bool Configuration(std::string Message) override { if (pkgAcqMethod::Configuration(Message) == false) return false; @@ -540,7 +540,7 @@ class aptAuthConfMethod : public aptMethod std::vector> authconfs; public: - virtual bool Configuration(std::string Message) APT_OVERRIDE + bool Configuration(std::string Message) override { if (pkgAcqMethod::Configuration(Message) == false) return false; diff --git a/methods/basehttp.h b/methods/basehttp.h index c077ea384..ee4a84d3d 100644 --- a/methods/basehttp.h +++ b/methods/basehttp.h @@ -126,7 +126,7 @@ struct ServerState class BaseHttpMethod : public aptAuthConfMethod { protected: - virtual bool Fetch(FetchItem *) APT_OVERRIDE; + bool Fetch(FetchItem *) override; std::unique_ptr Server; std::string NextURI; @@ -170,7 +170,7 @@ class BaseHttpMethod : public aptAuthConfMethod virtual void SendReq(FetchItem *Itm) = 0; virtual std::unique_ptr CreateServerState(URI const &uri) = 0; virtual void RotateDNS() = 0; - virtual bool Configuration(std::string Message) APT_OVERRIDE; + bool Configuration(std::string Message) override; bool AddProxyAuth(URI &Proxy, URI const &Server); diff --git a/methods/cdrom.cc b/methods/cdrom.cc index f534a06f5..88a10c0f0 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -42,10 +42,10 @@ class CDROMMethod : public aptMethod bool IsCorrectCD(URI want, string MountPath, string& NewID); bool AutoDetectAndMount(const URI, string &NewID); - virtual bool Fetch(FetchItem *Itm) APT_OVERRIDE; + bool Fetch(FetchItem *Itm) override; std::string GetID(std::string const &Name); - virtual void Exit() APT_OVERRIDE; - virtual bool Configuration(std::string Message) APT_OVERRIDE; + void Exit() override; + bool Configuration(std::string Message) override; public: diff --git a/methods/connect.cc b/methods/connect.cc index b00e73eb7..ff2e39260 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -89,10 +89,10 @@ static bool ConnectionAllowed(char const * const Service, std::string const &Hos struct FdFd final : public MethodFd { int fd = -1; - int Fd() APT_OVERRIDE { return fd; } - ssize_t Read(void *buf, size_t count) APT_OVERRIDE { return ::read(fd, buf, count); } - ssize_t Write(void *buf, size_t count) APT_OVERRIDE { return ::write(fd, buf, count); } - int Close() APT_OVERRIDE + int Fd() override { return fd; } + ssize_t Read(void *buf, size_t count) override { return ::read(fd, buf, count); } + ssize_t Write(void *buf, size_t count) override { return ::write(fd, buf, count); } + int Close() override { int result = 0; if (fd != -1) diff --git a/methods/copy.cc b/methods/copy.cc index 9c9c6572d..e3f2a29a2 100644 --- a/methods/copy.cc +++ b/methods/copy.cc @@ -26,7 +26,7 @@ class CopyMethod final : public aptMethod { - bool URIAcquire(std::string const &Message, FetchItem *Itm) APT_OVERRIDE; + bool URIAcquire(std::string const &Message, FetchItem *Itm) override; public: CopyMethod() : aptMethod("copy", "1.0", SingleInstance | SendConfig | SendURIEncoded) diff --git a/methods/file.cc b/methods/file.cc index 111440ce1..2a17336fc 100644 --- a/methods/file.cc +++ b/methods/file.cc @@ -29,7 +29,7 @@ class FileMethod final : public aptMethod { - bool URIAcquire(std::string const &Message, FetchItem *Itm) APT_OVERRIDE; + bool URIAcquire(std::string const &Message, FetchItem *Itm) override; public: FileMethod() : aptMethod("file", "1.0", SingleInstance | SendConfig | LocalOnly | SendURIEncoded) diff --git a/methods/gpgv.cc b/methods/gpgv.cc index e5554b1e2..736cfbde2 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -130,7 +130,7 @@ class GPGVMethod : public aptMethod SignersStorage &Signers); protected: - virtual bool URIAcquire(std::string const &Message, FetchItem *Itm) APT_OVERRIDE; + bool URIAcquire(std::string const &Message, FetchItem *Itm) override; public: GPGVMethod() : aptMethod("gpgv", "1.1", SingleInstance | SendConfig | SendURIEncoded){}; }; diff --git a/methods/http.cc b/methods/http.cc index 3574bcad5..f2514eb9d 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -284,9 +284,9 @@ struct HttpConnectFd final : public MethodFd std::unique_ptr UnderlyingFd; std::string Buffer; - int Fd() APT_OVERRIDE { return UnderlyingFd->Fd(); } + int Fd() override { return UnderlyingFd->Fd(); } - ssize_t Read(void *buf, size_t count) APT_OVERRIDE + ssize_t Read(void *buf, size_t count) override { if (!Buffer.empty()) { @@ -299,17 +299,17 @@ struct HttpConnectFd final : public MethodFd return UnderlyingFd->Read(buf, count); } - ssize_t Write(void *buf, size_t count) APT_OVERRIDE + ssize_t Write(void *buf, size_t count) override { return UnderlyingFd->Write(buf, count); } - int Close() APT_OVERRIDE + int Close() override { return UnderlyingFd->Close(); } - bool HasPending() APT_OVERRIDE + bool HasPending() override { return !Buffer.empty(); } diff --git a/methods/http.h b/methods/http.h index 5bfcbc8a2..5d6a8aad1 100644 --- a/methods/http.h +++ b/methods/http.h @@ -98,37 +98,37 @@ struct HttpServerState final : public ServerState std::unique_ptr ServerFd; protected: - virtual bool ReadHeaderLines(std::string &Data) APT_OVERRIDE; - virtual ResultState LoadNextResponse(bool const ToFile, RequestState &Req) APT_OVERRIDE; - virtual bool WriteResponse(std::string const &Data) APT_OVERRIDE; + bool ReadHeaderLines(std::string &Data) override; + ResultState LoadNextResponse(bool ToFile, RequestState &Req) override; + bool WriteResponse(std::string const &Data) override; public: - virtual void Reset() APT_OVERRIDE; + void Reset() override; - virtual ResultState RunData(RequestState &Req) APT_OVERRIDE; - virtual ResultState RunDataToDevNull(RequestState &Req) APT_OVERRIDE; + ResultState RunData(RequestState &Req) override; + ResultState RunDataToDevNull(RequestState &Req) override; - virtual ResultState Open() APT_OVERRIDE; - virtual bool IsOpen() APT_OVERRIDE; - virtual bool Close() APT_OVERRIDE; - virtual bool InitHashes(HashStringList const &ExpectedHashes) APT_OVERRIDE; - virtual Hashes * GetHashes() APT_OVERRIDE; - virtual ResultState Die(RequestState &Req) APT_OVERRIDE; - virtual bool Flush(FileFd *const File, bool MustComplete = true) APT_OVERRIDE; - virtual ResultState Go(bool ToFile, RequestState &Req) APT_OVERRIDE; + ResultState Open() override; + bool IsOpen() override; + bool Close() override; + bool InitHashes(HashStringList const &ExpectedHashes) override; + Hashes * GetHashes() override; + ResultState Die(RequestState &Req) override; + bool Flush(FileFd *File, bool MustComplete = true) override; + ResultState Go(bool ToFile, RequestState &Req) override; HttpServerState(URI Srv, HttpMethod *Owner); - virtual ~HttpServerState() {Close();}; + ~HttpServerState() override {Close();}; }; class HttpMethod final : public BaseHttpMethod { public: - virtual void SendReq(FetchItem *Itm) APT_OVERRIDE; + void SendReq(FetchItem *Itm) override; - virtual std::unique_ptr CreateServerState(URI const &uri) APT_OVERRIDE; - virtual void RotateDNS() APT_OVERRIDE; - virtual DealWithHeadersResult DealWithHeaders(FetchResult &Res, RequestState &Req) APT_OVERRIDE; + std::unique_ptr CreateServerState(URI const &uri) override; + void RotateDNS() override; + DealWithHeadersResult DealWithHeaders(FetchResult &Res, RequestState &Req) override; protected: std::string AutoDetectProxyCmd; diff --git a/methods/mirror.cc b/methods/mirror.cc index 5781ebcf0..dfdd550b7 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -89,12 +89,12 @@ class MirrorMethod : public aptMethod /*{{{*/ }; std::unordered_map mirrorfilestate; - virtual bool URIAcquire(std::string const &Message, FetchItem *Itm) APT_OVERRIDE; + bool URIAcquire(std::string const &Message, FetchItem *Itm) override; - void RedirectItem(MirrorListInfo const &info, FetchItem *const Itm, std::string const &Message); - bool MirrorListFileReceived(MirrorListInfo &info, FetchItem *const Itm); - std::string GetMirrorFileURI(std::string const &Message, FetchItem *const Itm); - void DealWithPendingItems(std::vector const &baseuris, MirrorListInfo const &info, FetchItem *const Itm, std::function handler); + void RedirectItem(MirrorListInfo const &info, FetchItem *Itm, std::string const &Message); + bool MirrorListFileReceived(MirrorListInfo &info, FetchItem *Itm); + std::string GetMirrorFileURI(std::string const &Message, FetchItem *Itm); + void DealWithPendingItems(std::vector const &baseuris, MirrorListInfo const &info, FetchItem *Itm, std::function handler); public: explicit MirrorMethod(std::string &&pProg) : aptMethod(std::move(pProg), "2.0", SingleInstance | Pipeline | SendConfig | AuxRequests | SendURIEncoded), genrng(clock()) diff --git a/methods/rred.cc b/methods/rred.cc index bef2e969e..836697a11 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -624,7 +624,7 @@ class RredMethod final : public aptMethod { } protected: - virtual bool URIAcquire(std::string const &Message, FetchItem *Itm) APT_OVERRIDE { + bool URIAcquire(std::string const &Message, FetchItem *Itm) override { Debug = DebugEnabled(); URI Get(Itm->Uri); std::string Path = DecodeSendURI(Get.Host + Get.Path); // rred:/path - no host diff --git a/methods/sqv.cc b/methods/sqv.cc index 716081f8e..45d001af1 100644 --- a/methods/sqv.cc +++ b/methods/sqv.cc @@ -21,7 +21,7 @@ class SQVMethod : public aptMethod vector &signers); protected: - virtual bool URIAcquire(std::string const &Message, FetchItem *Itm) APT_OVERRIDE; + bool URIAcquire(std::string const &Message, FetchItem *Itm) override; public: SQVMethod(); diff --git a/methods/store.cc b/methods/store.cc index ed2eb3fe1..bfd748e23 100644 --- a/methods/store.cc +++ b/methods/store.cc @@ -33,7 +33,7 @@ class StoreMethod final : public aptMethod { - virtual bool Fetch(FetchItem *Itm) APT_OVERRIDE; + bool Fetch(FetchItem *Itm) override; public: -- cgit v1.2.3-70-g09d2