@@ -837,7 +837,7 @@ bool Base64UnescapeInternal(absl::Nullable<const char*> src, size_t slen,
837837}
838838
839839/* clang-format off */
840- constexpr char kHexValueLenient [ 256 ] = {
840+ constexpr std::array< uint8_t , 256 > kHexValueLenient = {
841841 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
842842 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
843843 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
@@ -856,7 +856,7 @@ constexpr char kHexValueLenient[256] = {
856856 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
857857};
858858
859- constexpr signed char kHexValueStrict [ 256 ] = {
859+ constexpr std::array< int8_t , 256 > kHexValueStrict = {
860860 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
861861 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
862862 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
@@ -884,7 +884,7 @@ void HexStringToBytesInternal(absl::Nullable<const char*> from, T to,
884884 size_t num) {
885885 for (size_t i = 0 ; i < num; i++) {
886886 to[i] = static_cast <char >(kHexValueLenient [from[i * 2 ] & 0xFF ] << 4 ) +
887- (kHexValueLenient [from[i * 2 + 1 ] & 0xFF ]);
887+ static_cast < char > (kHexValueLenient [from[i * 2 + 1 ] & 0xFF ]);
888888 }
889889}
890890
@@ -981,8 +981,10 @@ bool HexStringToBytes(absl::string_view hex,
981981 auto hex_p = hex.cbegin ();
982982 for (std::string::iterator bin_p = output.begin (); bin_p != output.end ();
983983 ++bin_p) {
984- int h1 = absl::kHexValueStrict [static_cast <size_t >(*hex_p++)];
985- int h2 = absl::kHexValueStrict [static_cast <size_t >(*hex_p++)];
984+ int h1 = absl::kHexValueStrict [static_cast <size_t >(
985+ static_cast <uint8_t >(*hex_p++))];
986+ int h2 = absl::kHexValueStrict [static_cast <size_t >(
987+ static_cast <uint8_t >(*hex_p++))];
986988 if (h1 == -1 || h2 == -1 ) {
987989 output.resize (static_cast <size_t >(bin_p - output.begin ()));
988990 return false ;
0 commit comments