@@ -845,7 +845,7 @@ bool Base64UnescapeInternal(absl::Nullable<const char*> src, size_t slen,
845845}
846846
847847/* clang-format off */
848- constexpr std::array<char , 256 > kHexValueLenient = {
848+ constexpr std::array<uint8_t , 256 > kHexValueLenient = {
849849 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
850850 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
851851 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
@@ -864,7 +864,7 @@ constexpr std::array<char, 256> kHexValueLenient = {
864864 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
865865};
866866
867- constexpr std::array<signed char , 256 > kHexValueStrict = {
867+ constexpr std::array<int8_t , 256 > kHexValueStrict = {
868868 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
869869 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
870870 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
@@ -892,7 +892,7 @@ void HexStringToBytesInternal(absl::Nullable<const char*> from, T to,
892892 size_t num) {
893893 for (size_t i = 0 ; i < num; i++) {
894894 to[i] = static_cast <char >(kHexValueLenient [from[i * 2 ] & 0xFF ] << 4 ) +
895- (kHexValueLenient [from[i * 2 + 1 ] & 0xFF ]);
895+ static_cast < char > (kHexValueLenient [from[i * 2 + 1 ] & 0xFF ]);
896896 }
897897}
898898
@@ -989,8 +989,10 @@ bool HexStringToBytes(absl::string_view hex,
989989 auto hex_p = hex.cbegin ();
990990 for (std::string::iterator bin_p = output.begin (); bin_p != output.end ();
991991 ++bin_p) {
992- int h1 = absl::kHexValueStrict [static_cast <size_t >(*hex_p++)];
993- int h2 = absl::kHexValueStrict [static_cast <size_t >(*hex_p++)];
992+ int h1 = absl::kHexValueStrict [static_cast <size_t >(
993+ static_cast <uint8_t >(*hex_p++))];
994+ int h2 = absl::kHexValueStrict [static_cast <size_t >(
995+ static_cast <uint8_t >(*hex_p++))];
994996 if (h1 == -1 || h2 == -1 ) {
995997 output.resize (static_cast <size_t >(bin_p - output.begin ()));
996998 return false ;
0 commit comments