summaryrefslogtreecommitdiff
path: root/hex.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-11-12 12:37:20 -0500
committerJeffrey Walton <noloader@gmail.com>2017-11-12 12:37:20 -0500
commitf87696b7a5e89e5e98ac7a14cff2e0edeae23197 (patch)
treeb77eefcae84f5528ab34056c52ca582165851963 /hex.cpp
parentbf717f47e6b4ffcf6935a9d5512d5e211d96b59e (diff)
downloadcryptopp-git-f87696b7a5e89e5e98ac7a14cff2e0edeae23197.tar.gz
Cleanup use of unnamed namespaces in encoders and decoders
Diffstat (limited to 'hex.cpp')
-rw-r--r--hex.cpp47
1 files changed, 22 insertions, 25 deletions
diff --git a/hex.cpp b/hex.cpp
index 3871c4bd..d347241b 100644
--- a/hex.cpp
+++ b/hex.cpp
@@ -7,30 +7,11 @@
#include "hex.h"
NAMESPACE_BEGIN(CryptoPP)
-
-namespace
-{
- const byte s_vecUpper[] = "0123456789ABCDEF";
- const byte s_vecLower[] = "0123456789abcdef";
-}
-
-void HexEncoder::IsolatedInitialize(const NameValuePairs &parameters)
-{
- bool uppercase = parameters.GetValueWithDefault(Name::Uppercase(), true);
- m_filter->Initialize(CombinedNameValuePairs(
- parameters,
- MakeParameters(Name::EncodingLookupArray(), uppercase ? &s_vecUpper[0] : &s_vecLower[0], false)(Name::Log2Base(), 4, true)));
-}
-
-void HexDecoder::IsolatedInitialize(const NameValuePairs &parameters)
-{
- BaseN_Decoder::IsolatedInitialize(CombinedNameValuePairs(
- parameters,
- MakeParameters(Name::DecodingLookupArray(), GetDefaultDecodingLookupArray(), false)(Name::Log2Base(), 4, true)));
-}
-
ANONYMOUS_NAMESPACE_BEGIN
-static const int s_array[256] = {
+
+const byte s_vecUpper[] = "0123456789ABCDEF";
+const byte s_vecLower[] = "0123456789abcdef";
+const int s_array[256] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -48,7 +29,23 @@ static const int s_array[256] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
-NAMESPACE_END
+
+ANONYMOUS_NAMESPACE_END
+
+void HexEncoder::IsolatedInitialize(const NameValuePairs &parameters)
+{
+ bool uppercase = parameters.GetValueWithDefault(Name::Uppercase(), true);
+ m_filter->Initialize(CombinedNameValuePairs(
+ parameters,
+ MakeParameters(Name::EncodingLookupArray(), uppercase ? &s_vecUpper[0] : &s_vecLower[0], false)(Name::Log2Base(), 4, true)));
+}
+
+void HexDecoder::IsolatedInitialize(const NameValuePairs &parameters)
+{
+ BaseN_Decoder::IsolatedInitialize(CombinedNameValuePairs(
+ parameters,
+ MakeParameters(Name::DecodingLookupArray(), GetDefaultDecodingLookupArray(), false)(Name::Log2Base(), 4, true)));
+}
// Unrolled initialization, http://github.com/weidai11/cryptopp/issues/376
const int *HexDecoder::GetDefaultDecodingLookupArray()
@@ -58,4 +55,4 @@ const int *HexDecoder::GetDefaultDecodingLookupArray()
NAMESPACE_END
-#endif
+#endif // CRYPTOPP_IMPORTS