From 66e210e406ce3bab2b76658c0ee4630ce6f4bce3 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 11 Jul 2023 13:49:08 -0400 Subject: [PATCH] Everywhere: Use nested namespace qualifiers --- Userland/Libraries/LibCrypto/Authentication/GHash.cpp | 4 +--- Userland/Libraries/LibCrypto/Authentication/GHash.h | 5 +---- Userland/Libraries/LibCrypto/Authentication/HMAC.h | 4 +--- Userland/Libraries/LibCrypto/Cipher/AES.cpp | 4 +--- Userland/Libraries/LibCrypto/Cipher/AES.h | 4 +--- Userland/Libraries/LibCrypto/Cipher/Cipher.h | 4 +--- Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h | 5 +---- Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h | 4 +--- Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h | 5 +---- Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h | 5 +---- Userland/Libraries/LibCrypto/Hash/HashManager.h | 4 +--- .../Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp | 4 +--- .../Libraries/LibCrypto/NumberTheory/ModularFunctions.h | 4 +--- Userland/Libraries/LibCrypto/PK/Code/Code.h | 4 +--- Userland/Libraries/LibCrypto/PK/Code/EMSA_PKCS1_V1_5.h | 4 +--- Userland/Libraries/LibCrypto/PK/Code/EMSA_PSS.h | 4 +--- Userland/Libraries/LibCrypto/PK/PK.h | 4 +--- Userland/Libraries/LibCrypto/PK/RSA.cpp | 4 +--- Userland/Libraries/LibCrypto/PK/RSA.h | 5 ++--- Userland/Libraries/LibEDID/Definitions.h | 4 +--- Userland/Libraries/LibGUI/Layout.h | 8 ++------ Userland/Libraries/LibGUI/Widget.h | 8 ++------ Userland/Libraries/LibLine/VT.h | 4 +--- Userland/Libraries/LibWeb/HTML/AttributeNames.cpp | 4 +--- Userland/Libraries/LibWeb/HTML/AttributeNames.h | 4 +--- Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp | 4 +--- Userland/Libraries/LibWeb/HTML/Parser/Entities.h | 4 +--- 27 files changed, 30 insertions(+), 91 deletions(-) diff --git a/Userland/Libraries/LibCrypto/Authentication/GHash.cpp b/Userland/Libraries/LibCrypto/Authentication/GHash.cpp index abbab417ed..d173bf4623 100644 --- a/Userland/Libraries/LibCrypto/Authentication/GHash.cpp +++ b/Userland/Libraries/LibCrypto/Authentication/GHash.cpp @@ -25,8 +25,7 @@ static void to_u8s(u8* b, u32 const* w) } -namespace Crypto { -namespace Authentication { +namespace Crypto::Authentication { GHash::TagType GHash::process(ReadonlyBytes aad, ReadonlyBytes cipher) { @@ -118,4 +117,3 @@ void galois_multiply(u32 (&z)[4], const u32 (&_x)[4], const u32 (&_y)[4]) } } -} diff --git a/Userland/Libraries/LibCrypto/Authentication/GHash.h b/Userland/Libraries/LibCrypto/Authentication/GHash.h index 5924fcec7a..6b1f955ceb 100644 --- a/Userland/Libraries/LibCrypto/Authentication/GHash.h +++ b/Userland/Libraries/LibCrypto/Authentication/GHash.h @@ -15,8 +15,7 @@ # include #endif -namespace Crypto { -namespace Authentication { +namespace Crypto::Authentication { void galois_multiply(u32 (&z)[4], const u32 (&x)[4], const u32 (&y)[4]); @@ -62,5 +61,3 @@ private: }; } - -} diff --git a/Userland/Libraries/LibCrypto/Authentication/HMAC.h b/Userland/Libraries/LibCrypto/Authentication/HMAC.h index 3685c908e5..71b4e9732a 100644 --- a/Userland/Libraries/LibCrypto/Authentication/HMAC.h +++ b/Userland/Libraries/LibCrypto/Authentication/HMAC.h @@ -19,8 +19,7 @@ constexpr static auto IPAD = 0x36; constexpr static auto OPAD = 0x5c; -namespace Crypto { -namespace Authentication { +namespace Crypto::Authentication { template class HMAC { @@ -121,4 +120,3 @@ private: }; } -} diff --git a/Userland/Libraries/LibCrypto/Cipher/AES.cpp b/Userland/Libraries/LibCrypto/Cipher/AES.cpp index 9f1ca0f2d2..3f5d899453 100644 --- a/Userland/Libraries/LibCrypto/Cipher/AES.cpp +++ b/Userland/Libraries/LibCrypto/Cipher/AES.cpp @@ -8,8 +8,7 @@ #include #include -namespace Crypto { -namespace Cipher { +namespace Crypto::Cipher { template constexpr u32 get_key(T pt) @@ -405,4 +404,3 @@ void AESCipherBlock::overwrite(ReadonlyBytes bytes) } } -} diff --git a/Userland/Libraries/LibCrypto/Cipher/AES.h b/Userland/Libraries/LibCrypto/Cipher/AES.h index 16747cd5a3..3221b53eea 100644 --- a/Userland/Libraries/LibCrypto/Cipher/AES.h +++ b/Userland/Libraries/LibCrypto/Cipher/AES.h @@ -17,8 +17,7 @@ # include #endif -namespace Crypto { -namespace Cipher { +namespace Crypto::Cipher { struct AESCipherBlock : public CipherBlock { public: @@ -132,4 +131,3 @@ protected: }; } -} diff --git a/Userland/Libraries/LibCrypto/Cipher/Cipher.h b/Userland/Libraries/LibCrypto/Cipher/Cipher.h index bcf5db362d..6a9dee84b8 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Cipher.h +++ b/Userland/Libraries/LibCrypto/Cipher/Cipher.h @@ -11,8 +11,7 @@ #include #include -namespace Crypto { -namespace Cipher { +namespace Crypto::Cipher { enum class Intent { Encryption, @@ -123,4 +122,3 @@ private: PaddingMode m_padding_mode; }; } -} diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h b/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h index 405a4ffba6..69519d7f98 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/CBC.h @@ -14,8 +14,7 @@ # include #endif -namespace Crypto { -namespace Cipher { +namespace Crypto::Cipher { template class CBC : public Mode { @@ -126,5 +125,3 @@ private: }; } - -} diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h b/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h index 5e51fede44..4c002f66a2 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/CTR.h @@ -14,8 +14,7 @@ # include #endif -namespace Crypto { -namespace Cipher { +namespace Crypto::Cipher { /* * Heads up: CTR is a *family* of modes, because the "counter" function is @@ -194,4 +193,3 @@ protected: }; } -} diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h b/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h index cb738056ad..8f295a9f5f 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/GCM.h @@ -18,8 +18,7 @@ # include #endif -namespace Crypto { -namespace Cipher { +namespace Crypto::Cipher { using IncrementFunction = IncrementInplace; @@ -148,5 +147,3 @@ private: }; } - -} diff --git a/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h b/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h index cd0c5db97c..63074bb9ef 100644 --- a/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h +++ b/Userland/Libraries/LibCrypto/Cipher/Mode/Mode.h @@ -10,8 +10,7 @@ #include #include -namespace Crypto { -namespace Cipher { +namespace Crypto::Cipher { template class Mode { @@ -99,5 +98,3 @@ private: T m_cipher; }; } - -} diff --git a/Userland/Libraries/LibCrypto/Hash/HashManager.h b/Userland/Libraries/LibCrypto/Hash/HashManager.h index e23a14dbdf..053d49332f 100644 --- a/Userland/Libraries/LibCrypto/Hash/HashManager.h +++ b/Userland/Libraries/LibCrypto/Hash/HashManager.h @@ -14,8 +14,7 @@ #include #include -namespace Crypto { -namespace Hash { +namespace Crypto::Hash { enum class HashKind { Unknown, @@ -219,4 +218,3 @@ private: }; } -} diff --git a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp index b2884c9f98..caa28f480b 100644 --- a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp +++ b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp @@ -8,8 +8,7 @@ #include #include -namespace Crypto { -namespace NumberTheory { +namespace Crypto::NumberTheory { UnsignedBigInteger ModularInverse(UnsignedBigInteger const& a_, UnsignedBigInteger const& b) { @@ -232,4 +231,3 @@ UnsignedBigInteger random_big_prime(size_t bits) } } -} diff --git a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.h b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.h index b77d2c0db4..21cabcb0ce 100644 --- a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.h +++ b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.h @@ -9,8 +9,7 @@ #include #include -namespace Crypto { -namespace NumberTheory { +namespace Crypto::NumberTheory { UnsignedBigInteger ModularInverse(UnsignedBigInteger const& a_, UnsignedBigInteger const& b); UnsignedBigInteger ModularPower(UnsignedBigInteger const& b, UnsignedBigInteger const& e, UnsignedBigInteger const& m); @@ -47,4 +46,3 @@ bool is_probably_prime(UnsignedBigInteger const& p); UnsignedBigInteger random_big_prime(size_t bits); } -} diff --git a/Userland/Libraries/LibCrypto/PK/Code/Code.h b/Userland/Libraries/LibCrypto/PK/Code/Code.h index 6835c4d7b5..e720d37b4e 100644 --- a/Userland/Libraries/LibCrypto/PK/Code/Code.h +++ b/Userland/Libraries/LibCrypto/PK/Code/Code.h @@ -9,8 +9,7 @@ #include #include -namespace Crypto { -namespace PK { +namespace Crypto::PK { template class Code { @@ -34,4 +33,3 @@ protected: }; } -} diff --git a/Userland/Libraries/LibCrypto/PK/Code/EMSA_PKCS1_V1_5.h b/Userland/Libraries/LibCrypto/PK/Code/EMSA_PKCS1_V1_5.h index 1de4d73b99..794652ccf0 100644 --- a/Userland/Libraries/LibCrypto/PK/Code/EMSA_PKCS1_V1_5.h +++ b/Userland/Libraries/LibCrypto/PK/Code/EMSA_PKCS1_V1_5.h @@ -12,8 +12,7 @@ #include #include -namespace Crypto { -namespace PK { +namespace Crypto::PK { template class EMSA_PKCS1_V1_5 : public Code { @@ -135,4 +134,3 @@ inline ReadonlyBytes EMSA_PKCS1_V1_5::hash_function_diges } } -} diff --git a/Userland/Libraries/LibCrypto/PK/Code/EMSA_PSS.h b/Userland/Libraries/LibCrypto/PK/Code/EMSA_PSS.h index 5b082a921d..980c9d11cb 100644 --- a/Userland/Libraries/LibCrypto/PK/Code/EMSA_PSS.h +++ b/Userland/Libraries/LibCrypto/PK/Code/EMSA_PSS.h @@ -13,8 +13,7 @@ #include #include -namespace Crypto { -namespace PK { +namespace Crypto::PK { template class EMSA_PSS : public Code { @@ -168,4 +167,3 @@ private: }; } -} diff --git a/Userland/Libraries/LibCrypto/PK/PK.h b/Userland/Libraries/LibCrypto/PK/PK.h index 8769e1ebc7..6a4ffaad24 100644 --- a/Userland/Libraries/LibCrypto/PK/PK.h +++ b/Userland/Libraries/LibCrypto/PK/PK.h @@ -12,8 +12,7 @@ # include #endif -namespace Crypto { -namespace PK { +namespace Crypto::PK { // FIXME: Fixing name up for grabs template @@ -50,4 +49,3 @@ protected: }; } -} diff --git a/Userland/Libraries/LibCrypto/PK/RSA.cpp b/Userland/Libraries/LibCrypto/PK/RSA.cpp index c5343a5613..9a0fb95603 100644 --- a/Userland/Libraries/LibCrypto/PK/RSA.cpp +++ b/Userland/Libraries/LibCrypto/PK/RSA.cpp @@ -12,8 +12,7 @@ #include #include -namespace Crypto { -namespace PK { +namespace Crypto::PK { static constexpr Array pkcs8_rsa_key_oid { 1, 2, 840, 113549, 1, 1, 1 }; @@ -418,4 +417,3 @@ void RSA_PKCS1_EME::verify(ReadonlyBytes, Bytes&) dbgln("FIXME: RSA_PKCS_EME::verify"); } } -} diff --git a/Userland/Libraries/LibCrypto/PK/RSA.h b/Userland/Libraries/LibCrypto/PK/RSA.h index d42dba737b..bfc7c9a368 100644 --- a/Userland/Libraries/LibCrypto/PK/RSA.h +++ b/Userland/Libraries/LibCrypto/PK/RSA.h @@ -13,8 +13,8 @@ #include #include -namespace Crypto { -namespace PK { +namespace Crypto::PK { + template class RSAPublicKey { public: @@ -225,4 +225,3 @@ public: } }; } -} diff --git a/Userland/Libraries/LibEDID/Definitions.h b/Userland/Libraries/LibEDID/Definitions.h index c8ff3d02ec..97db776983 100644 --- a/Userland/Libraries/LibEDID/Definitions.h +++ b/Userland/Libraries/LibEDID/Definitions.h @@ -8,8 +8,7 @@ #include -namespace EDID { -namespace Definitions { +namespace EDID::Definitions { struct [[gnu::packed]] StandardTimings { u8 horizontal_8_pixels; @@ -157,4 +156,3 @@ struct [[gnu::packed]] ExtensionBlock { static_assert(AssertSize()); } -} diff --git a/Userland/Libraries/LibGUI/Layout.h b/Userland/Libraries/LibGUI/Layout.h index da01aac212..79fa68d42f 100644 --- a/Userland/Libraries/LibGUI/Layout.h +++ b/Userland/Libraries/LibGUI/Layout.h @@ -15,18 +15,14 @@ #include #include -namespace Core { -namespace Registration { +namespace Core::Registration { extern Core::ObjectClassRegistration registration_Layout; } -} #define REGISTER_LAYOUT(namespace_, class_name) \ - namespace Core { \ - namespace Registration { \ + namespace Core::Registration { \ Core::ObjectClassRegistration registration_##class_name( \ #namespace_ "::" #class_name##sv, []() { return static_ptr_cast(namespace_::class_name::construct()); }, ®istration_Layout); \ - } \ } namespace GUI { diff --git a/Userland/Libraries/LibGUI/Widget.h b/Userland/Libraries/LibGUI/Widget.h index 28f56d6a8c..2d4c45992b 100644 --- a/Userland/Libraries/LibGUI/Widget.h +++ b/Userland/Libraries/LibGUI/Widget.h @@ -27,18 +27,14 @@ #include #include -namespace Core { -namespace Registration { +namespace Core::Registration { extern Core::ObjectClassRegistration registration_Widget; } -} #define REGISTER_WIDGET(namespace_, class_name) \ - namespace Core { \ - namespace Registration { \ + namespace Core::Registration { \ Core::ObjectClassRegistration registration_##class_name( \ #namespace_ "::" #class_name##sv, []() -> ErrorOr> { return static_ptr_cast(TRY(namespace_::class_name::try_create())); }, ®istration_Widget); \ - } \ } namespace GUI { diff --git a/Userland/Libraries/LibLine/VT.h b/Userland/Libraries/LibLine/VT.h index 77190153ad..d7f1c50e11 100644 --- a/Userland/Libraries/LibLine/VT.h +++ b/Userland/Libraries/LibLine/VT.h @@ -9,8 +9,7 @@ #include #include -namespace Line { -namespace VT { +namespace Line::VT { ErrorOr save_cursor(Stream&); ErrorOr restore_cursor(Stream&); @@ -21,4 +20,3 @@ ErrorOr move_absolute(u32 x, u32 y, Stream&); ErrorOr apply_style(Style const&, Stream&, bool is_starting = true); } -} diff --git a/Userland/Libraries/LibWeb/HTML/AttributeNames.cpp b/Userland/Libraries/LibWeb/HTML/AttributeNames.cpp index ead23b4133..1f4d23a1c8 100644 --- a/Userland/Libraries/LibWeb/HTML/AttributeNames.cpp +++ b/Userland/Libraries/LibWeb/HTML/AttributeNames.cpp @@ -6,8 +6,7 @@ #include -namespace Web { -namespace HTML { +namespace Web::HTML { namespace AttributeNames { #define __ENUMERATE_HTML_ATTRIBUTE(name) DeprecatedFlyString name; @@ -73,4 +72,3 @@ bool is_boolean_attribute(DeprecatedFlyString const& attribute) } } -} diff --git a/Userland/Libraries/LibWeb/HTML/AttributeNames.h b/Userland/Libraries/LibWeb/HTML/AttributeNames.h index 15ff739eb0..2d723d7082 100644 --- a/Userland/Libraries/LibWeb/HTML/AttributeNames.h +++ b/Userland/Libraries/LibWeb/HTML/AttributeNames.h @@ -9,8 +9,7 @@ #include #include -namespace Web { -namespace HTML { +namespace Web::HTML { namespace AttributeNames { #define ENUMERATE_HTML_ATTRIBUTES \ @@ -250,4 +249,3 @@ ErrorOr initialize_strings(); bool is_boolean_attribute(DeprecatedFlyString const& attribute); } -} diff --git a/Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp b/Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp index d4852639db..258485a4bc 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp @@ -7,8 +7,7 @@ #include #include -namespace Web { -namespace HTML { +namespace Web::HTML { Optional code_points_from_entity(StringView entity) { @@ -2278,4 +2277,3 @@ Optional code_points_from_entity(StringView entity) } } -} diff --git a/Userland/Libraries/LibWeb/HTML/Parser/Entities.h b/Userland/Libraries/LibWeb/HTML/Parser/Entities.h index 1b56616acb..9ac6ac6c8e 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/Entities.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/Entities.h @@ -9,8 +9,7 @@ #include #include -namespace Web { -namespace HTML { +namespace Web::HTML { struct EntityMatch { Vector code_points; @@ -20,4 +19,3 @@ struct EntityMatch { Optional code_points_from_entity(StringView); } -}