From bdba64bd4d1d6d30eed3a907bb10b30c520dd5d6 Mon Sep 17 00:00:00 2001 From: Willem Deconinck Date: Fri, 19 Mar 2021 09:48:06 +0000 Subject: [PATCH] clang-format --- src/atlas/io/detail/Base64.cc | 42 +++++++++++++---------------------- src/atlas/io/types/scalar.cc | 5 ++--- 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/src/atlas/io/detail/Base64.cc b/src/atlas/io/detail/Base64.cc index 10eba5609..2d1d415b8 100644 --- a/src/atlas/io/detail/Base64.cc +++ b/src/atlas/io/detail/Base64.cc @@ -21,30 +21,20 @@ namespace { static std::array b64_decode_table{ /* ASCII table */ - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64, - 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64, - 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 - }; + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 64, 64, 64, 64, 64, 64, 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 64, 64, 64, 64, 64, 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64}; static std::array b64_encode_table{ - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', - 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', - 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', - 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' - }; + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', + 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', + 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'}; } // namespace @@ -63,7 +53,7 @@ std::string Base64::encode( const void* data, size_t len ) { std::string str; str.resize( out_len ); - out = reinterpret_cast(const_cast(str.data())); + out = reinterpret_cast( const_cast( str.data() ) ); end = src + len; in = src; @@ -96,9 +86,9 @@ std::string Base64::encode( const void* data, size_t len ) { std::string Base64::decode( const void* data, size_t len ) { const auto& table = b64_decode_table; - const unsigned char* p = reinterpret_cast(data); - int pad = len > 0 && ( len % 4 || p[len - 1] == '=' ); - const size_t L = ( ( len + 3 ) / 4 - pad ) * 4; + const unsigned char* p = reinterpret_cast( data ); + int pad = len > 0 && ( len % 4 || p[len - 1] == '=' ); + const size_t L = ( ( len + 3 ) / 4 - pad ) * 4; std::string str( L / 4 * 3 + pad, '\0' ); for ( size_t i = 0, j = 0; i < L; i += 4 ) { diff --git a/src/atlas/io/types/scalar.cc b/src/atlas/io/types/scalar.cc index 31d64a1ad..a8743884c 100644 --- a/src/atlas/io/types/scalar.cc +++ b/src/atlas/io/types/scalar.cc @@ -18,7 +18,6 @@ #include #include -#include #include "eckit/utils/ByteSwap.h" @@ -69,13 +68,13 @@ void encode_scalar_metadata( const T& value, atlas::io::Metadata& out ) { inline void encode_scalar_metadata( const unsigned long& value, atlas::io::Metadata& out ) { out.set( "type", "scalar" ); out.set( "datatype", array::DataType::str() ); - out.set( "value", size_t(value) ); + out.set( "value", size_t( value ) ); } inline void encode_scalar_metadata( const unsigned long long& value, atlas::io::Metadata& out ) { out.set( "type", "scalar" ); out.set( "datatype", array::DataType::str() ); - out.set( "value", size_t(value) ); + out.set( "value", size_t( value ) ); } template