From 1e2b5197ee350a36fbad006f198bbf8e9a5c8e53 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 26 Dec 2024 20:46:23 +0000 Subject: Drop the remaining usage of APT_ARRAY_SIZE That macro is not that useful as it might perhaps once was. Lets prepare dropping it now in favour of more standard ways of working with arrays now. --- methods/gpgv.cc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'methods') diff --git a/methods/gpgv.cc b/methods/gpgv.cc index 736cfbde2..8eda8d67f 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -68,7 +68,7 @@ struct Digest { } }; -static constexpr Digest Digests[] = { +static constexpr std::array 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(id) < APT_ARRAY_SIZE(Digests)) - { + if (id >= 0 && static_cast(id) < Digests.size()) return Digests[id]; - } else { - return Digests[0]; - } + return Digests[0]; } struct Signer { -- cgit v1.2.3-70-g09d2