summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
Diffstat (limited to 'methods')
-rw-r--r--methods/aptmethod.h4
-rw-r--r--methods/basehttp.h6
-rw-r--r--methods/cdrom.cc6
-rw-r--r--methods/connect.cc8
-rw-r--r--methods/copy.cc2
-rw-r--r--methods/file.cc2
-rw-r--r--methods/gpgv.cc23
-rw-r--r--methods/http.cc10
-rw-r--r--methods/http.h38
-rw-r--r--methods/mirror.cc10
-rw-r--r--methods/rred.cc2
-rw-r--r--methods/sqv.cc4
-rw-r--r--methods/store.cc2
13 files changed, 57 insertions, 60 deletions
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<std::unique_ptr<FileFd>> 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..1d3ed1ace 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<ServerState> Server;
std::string NextURI;
@@ -163,14 +163,14 @@ class BaseHttpMethod : public aptAuthConfMethod
static std::string FailFile;
static int FailFd;
static time_t FailTime;
- static APT_NORETURN void SigTerm(int);
+ [[noreturn]] static void SigTerm(int);
int Loop();
virtual void SendReq(FetchItem *Itm) = 0;
virtual std::unique_ptr<ServerState> 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 eeee7c509..ec0a5c1f9 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..1a6356dee 100644
--- a/methods/gpgv.cc
+++ b/methods/gpgv.cc
@@ -68,7 +68,7 @@ struct Digest {
}
};
-static constexpr Digest Digests[] = {
+static constexpr std::array<Digest,12> Digests = {{
{Digest::State::Untrusted, "Invalid digest"},
{Digest::State::Untrusted, "MD5"},
{Digest::State::Untrusted, "SHA1"},
@@ -81,17 +81,14 @@ static constexpr Digest Digests[] = {
{Digest::State::Trusted, "SHA384"},
{Digest::State::Trusted, "SHA512"},
{Digest::State::Trusted, "SHA224"},
-};
+}};
-static Digest FindDigest(std::string const & Digest)
+static Digest FindDigest(std::string const &Digest)
{
int id = atoi(Digest.c_str());
- if (id >= 0 && static_cast<unsigned>(id) < APT_ARRAY_SIZE(Digests))
- {
+ if (id >= 0 && static_cast<unsigned>(id) < Digests.size())
return Digests[id];
- } else {
- return Digests[0];
- }
+ return Digests[0];
}
struct Signer {
@@ -130,7 +127,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){};
};
@@ -214,7 +211,7 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile,
FILE *pipein = fdopen(fd[0], "r");
- // Loop over the output of apt-key (which really is gnupg), and check the signatures.
+ // Loop over the output of gpgv, and check the signatures.
std::vector<std::string> ErrSigners;
std::map<std::string, std::vector<std::string>> SubKeyMapping;
size_t buffersize = 0;
@@ -340,7 +337,7 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile,
for (auto errSigner : ErrSigners)
Signers.Worthless.push_back({errSigner, ""});
- // apt-key has a --keyid parameter, but this requires gpg, so we call it without it
+ // gpgv has no --keyid parameter, so we call it without it
// and instead check after the fact which keyids where used for verification
if (keyFpts.empty() == false)
{
@@ -565,7 +562,7 @@ bool GPGVMethod::URIAcquire(std::string const &Message, FetchItem *Itm)
keyFpts.emplace_back(std::move(key));
}
- // Run apt-key on file, extract contents and get the key ID of the signer
+ // Run gpgv on file, extract contents and get the key ID of the signer
string const msg = VerifyGetSignersWithLegacy(Path.c_str(), Itm->DestFile.c_str(), keyFpts, keyFiles, Signers);
if (_error->PendingError())
return false;
@@ -660,7 +657,7 @@ bool GPGVMethod::URIAcquire(std::string const &Message, FetchItem *Itm)
Dequeue();
if (DebugEnabled())
- std::clog << "apt-key succeeded\n";
+ std::clog << "gpgv succeeded\n";
return true;
}
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<MethodFd> 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<MethodFd> 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<ServerState> CreateServerState(URI const &uri) APT_OVERRIDE;
- virtual void RotateDNS() APT_OVERRIDE;
- virtual DealWithHeadersResult DealWithHeaders(FetchResult &Res, RequestState &Req) APT_OVERRIDE;
+ std::unique_ptr<ServerState> 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<std::string, MirrorListInfo> 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<std::string> const &baseuris, MirrorListInfo const &info, FetchItem *const Itm, std::function<void()> 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<std::string> const &baseuris, MirrorListInfo const &info, FetchItem *Itm, std::function<void()> 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..ce7e36657 100644
--- a/methods/sqv.cc
+++ b/methods/sqv.cc
@@ -21,7 +21,7 @@ class SQVMethod : public aptMethod
vector<string> &signers);
protected:
- virtual bool URIAcquire(std::string const &Message, FetchItem *Itm) APT_OVERRIDE;
+ bool URIAcquire(std::string const &Message, FetchItem *Itm) override;
public:
SQVMethod();
@@ -296,7 +296,7 @@ bool SQVMethod::URIAcquire(std::string const &Message, FetchItem *Itm)
if (_error->PendingError())
return false;
- // Run apt-key on file, extract contents and get the key ID of the signer
+ // Run sqv on file, extract contents and get the key ID of the signer
VerifyGetSigners(Path.c_str(), Itm->DestFile.c_str(), keyFiles, Signers);
if (_error->PendingError())
{
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: