@@ -827,7 +827,7 @@ bool Base64UnescapeInternal(const char* absl_nullable src, size_t slen,
827827}
828828
829829/* clang-format off */
830- constexpr std::array<char , 256 > kHexValueLenient = {
830+ constexpr std::array<uint8_t , 256 > kHexValueLenient = {
831831 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
832832 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
833833 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
@@ -846,7 +846,7 @@ constexpr std::array<char, 256> kHexValueLenient = {
846846 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
847847};
848848
849- constexpr std::array<signed char , 256 > kHexValueStrict = {
849+ constexpr std::array<int8_t , 256 > kHexValueStrict = {
850850 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
851851 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
852852 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
@@ -874,7 +874,7 @@ void HexStringToBytesInternal(const char* absl_nullable from, T to,
874874 size_t num) {
875875 for (size_t i = 0 ; i < num; i++) {
876876 to[i] = static_cast <char >(kHexValueLenient [from[i * 2 ] & 0xFF ] << 4 ) +
877- (kHexValueLenient [from[i * 2 + 1 ] & 0xFF ]);
877+ static_cast < char > (kHexValueLenient [from[i * 2 + 1 ] & 0xFF ]);
878878 }
879879}
880880
@@ -970,8 +970,10 @@ bool HexStringToBytes(absl::string_view hex, std::string* absl_nonnull bytes) {
970970 auto hex_p = hex.cbegin ();
971971 for (std::string::iterator bin_p = output.begin (); bin_p != output.end ();
972972 ++bin_p) {
973- int h1 = absl::kHexValueStrict [static_cast <size_t >(*hex_p++)];
974- int h2 = absl::kHexValueStrict [static_cast <size_t >(*hex_p++)];
973+ int h1 = absl::kHexValueStrict [static_cast <size_t >(
974+ static_cast <uint8_t >(*hex_p++))];
975+ int h2 = absl::kHexValueStrict [static_cast <size_t >(
976+ static_cast <uint8_t >(*hex_p++))];
975977 if (h1 == -1 || h2 == -1 ) {
976978 output.resize (static_cast <size_t >(bin_p - output.begin ()));
977979 return false ;
0 commit comments