diff options
author | Jeffrey Walton <noloader@gmail.com> | 2017-11-12 12:37:20 -0500 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2017-11-12 12:37:20 -0500 |
commit | f87696b7a5e89e5e98ac7a14cff2e0edeae23197 (patch) | |
tree | b77eefcae84f5528ab34056c52ca582165851963 /hex.cpp | |
parent | bf717f47e6b4ffcf6935a9d5512d5e211d96b59e (diff) | |
download | cryptopp-git-f87696b7a5e89e5e98ac7a14cff2e0edeae23197.tar.gz |
Cleanup use of unnamed namespaces in encoders and decoders
Diffstat (limited to 'hex.cpp')
-rw-r--r-- | hex.cpp | 47 |
1 files changed, 22 insertions, 25 deletions
@@ -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 ¶meters)
-{
- 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 ¶meters)
-{
- 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 ¶meters)
+{
+ 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 ¶meters)
+{
+ 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
|