mirror of
https://github.com/MariaDB/server.git
synced 2025-03-21 14:38:38 +01:00
cleanup: octet2hex takes an uchar* argument
char is a character, uchar is an octet. casts removed (or added) as needed
This commit is contained in:
parent
d7699c51eb
commit
03094bbc8a
11 changed files with 19 additions and 19 deletions
|
@ -717,7 +717,7 @@ void scramble(char *to, const char *message, const char *password);
|
|||
my_bool check_scramble(const unsigned char *reply, const char *message,
|
||||
const unsigned char *hash_stage2);
|
||||
void get_salt_from_password(unsigned char *res, const char *password);
|
||||
char *octet2hex(char *to, const char *str, size_t len);
|
||||
char *octet2hex(char *to, const unsigned char *str, size_t len);
|
||||
|
||||
/* end of password.c */
|
||||
|
||||
|
|
|
@ -6547,7 +6547,7 @@ String *Item::check_well_formed_result(String *str, bool send_error)
|
|||
char hexbuf[7];
|
||||
uint diff= str->length() - wlen;
|
||||
set_if_smaller(diff, 3);
|
||||
octet2hex(hexbuf, str->ptr() + wlen, diff);
|
||||
octet2hex(hexbuf, (uchar*)str->ptr() + wlen, diff);
|
||||
if (send_error)
|
||||
{
|
||||
my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
|
||||
|
@ -6599,7 +6599,7 @@ String_copier_for_item::copy_with_warn(CHARSET_INFO *dstcs, String *dst,
|
|||
char buf[16];
|
||||
int mblen= srccs->charlen(pos, src + src_length);
|
||||
DBUG_ASSERT(mblen > 0 && mblen * 2 + 1 <= (int) sizeof(buf));
|
||||
octet2hex(buf, pos, mblen);
|
||||
octet2hex(buf, (uchar*)pos, mblen);
|
||||
push_warning_printf(m_thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_CANNOT_CONVERT_CHARACTER,
|
||||
ER_THD(m_thd, ER_CANNOT_CONVERT_CHARACTER),
|
||||
|
|
|
@ -259,7 +259,7 @@ static inline bool read_str(const uchar **buf, const uchar *buf_end,
|
|||
Transforms a string into "" or its expression in X'HHHH' form.
|
||||
*/
|
||||
|
||||
char *str_to_hex(char *to, const char *from, size_t len)
|
||||
char *str_to_hex(char *to, const uchar *from, size_t len)
|
||||
{
|
||||
if (len)
|
||||
{
|
||||
|
|
|
@ -3746,7 +3746,7 @@ public:
|
|||
bool is_valid() const { return 1; }
|
||||
};
|
||||
#endif
|
||||
char *str_to_hex(char *to, const char *from, size_t len);
|
||||
char *str_to_hex(char *to, const uchar *from, size_t len);
|
||||
|
||||
/**
|
||||
@class Annotate_rows_log_event
|
||||
|
|
|
@ -1541,7 +1541,7 @@ bool Rows_log_event::print_verbose(IO_CACHE *file,
|
|||
*/
|
||||
const int buff_len= 2 + (256 * 2) + 1;
|
||||
char buff[buff_len];
|
||||
str_to_hex(buff, (const char*) &m_extra_row_data[EXTRA_ROW_INFO_HDR_BYTES],
|
||||
str_to_hex(buff, &m_extra_row_data[EXTRA_ROW_INFO_HDR_BYTES],
|
||||
extra_payload_len);
|
||||
if (my_b_printf(file, "%s", buff))
|
||||
goto err;
|
||||
|
@ -2540,7 +2540,7 @@ bool User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
|||
hex_str= (char *) my_malloc(PSI_NOT_INSTRUMENTED, 2 * val_len + 1 + 3, MYF(MY_WME));
|
||||
if (!hex_str)
|
||||
goto err;
|
||||
str_to_hex(hex_str, val, val_len);
|
||||
str_to_hex(hex_str, (uchar*)val, val_len);
|
||||
/*
|
||||
For proper behaviour when mysqlbinlog|mysql, we need to explicitly
|
||||
specify the variable's collation. It will however cause problems when
|
||||
|
|
|
@ -503,7 +503,7 @@ int append_query_string(CHARSET_INFO *csinfo, String *to,
|
|||
beg= (char*) to->ptr() + to->length();
|
||||
ptr= beg;
|
||||
if (csinfo->escape_with_backslash_is_dangerous)
|
||||
ptr= str_to_hex(ptr, str, len);
|
||||
ptr= str_to_hex(ptr, (uchar*)str, len);
|
||||
else
|
||||
{
|
||||
*ptr++= '\'';
|
||||
|
@ -3885,7 +3885,7 @@ void User_var_log_event::pack_info(Protocol* protocol)
|
|||
MY_CS_COLLATION_NAME_SIZE))
|
||||
return;
|
||||
beg= const_cast<char *>(buf.ptr()) + old_len;
|
||||
end= str_to_hex(beg, val, val_len);
|
||||
end= str_to_hex(beg, (uchar*)val, val_len);
|
||||
buf.length(old_len + (end - beg));
|
||||
if (buf.append(STRING_WITH_LEN(" COLLATE ")) ||
|
||||
buf.append(cs->coll_name))
|
||||
|
|
|
@ -296,13 +296,13 @@ void make_password_from_salt_323(char *to, const ulong *salt)
|
|||
buf+len*2
|
||||
*/
|
||||
|
||||
char *octet2hex(char *to, const char *str, size_t len)
|
||||
char *octet2hex(char *to, const uchar *str, size_t len)
|
||||
{
|
||||
const char *str_end= str + len;
|
||||
const uchar *str_end= str + len;
|
||||
for (; str != str_end; ++str)
|
||||
{
|
||||
*to++= _dig_vec_upper[((uchar) *str) >> 4];
|
||||
*to++= _dig_vec_upper[((uchar) *str) & 0x0F];
|
||||
*to++= _dig_vec_upper[*str >> 4];
|
||||
*to++= _dig_vec_upper[*str & 0x0F];
|
||||
}
|
||||
*to= '\0';
|
||||
return to;
|
||||
|
@ -399,7 +399,7 @@ void my_make_scrambled_password(char *to, const char *password,
|
|||
|
||||
/* convert hash_stage2 to hex string */
|
||||
*to++= PVERSION41_CHAR;
|
||||
octet2hex(to, (const char*) hash_stage2, MY_SHA1_HASH_SIZE);
|
||||
octet2hex(to, hash_stage2, MY_SHA1_HASH_SIZE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -519,6 +519,6 @@ void get_salt_from_password(uint8 *hash_stage2, const char *password)
|
|||
void make_password_from_salt(char *to, const uint8 *hash_stage2)
|
||||
{
|
||||
*to++= PVERSION41_CHAR;
|
||||
octet2hex(to, (const char*) hash_stage2, MY_SHA1_HASH_SIZE);
|
||||
octet2hex(to, hash_stage2, MY_SHA1_HASH_SIZE);
|
||||
}
|
||||
|
||||
|
|
|
@ -603,7 +603,7 @@ l_end:
|
|||
if (result == -1)
|
||||
{
|
||||
char buf[256];
|
||||
octet2hex(buf, (const char*) packet, std::min(static_cast<ulong>(sizeof(buf)-1),
|
||||
octet2hex(buf, packet, std::min(static_cast<ulong>(sizeof(buf)-1),
|
||||
packet_len));
|
||||
sql_print_information("First bytes of the packet from semisync slave "
|
||||
"server-id %d: %s", server_id, buf);
|
||||
|
|
|
@ -922,7 +922,7 @@ static bool pack_header(THD *thd, uchar *forminfo,
|
|||
hex_length= length * 2;
|
||||
tmpint->type_lengths[pos]= (uint) hex_length;
|
||||
tmpint->type_names[pos]= dst= (char*) thd->alloc(hex_length + 1);
|
||||
octet2hex(dst, src, length);
|
||||
octet2hex(dst, (uchar*)src, length);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1008,7 +1008,7 @@ static bool emit_key_part_element(String *to, KEY_PART_INFO *part,
|
|||
|
||||
*buf++= '0';
|
||||
*buf++= 'x';
|
||||
buf= octet2hex(buf, (char*) ptr, len);
|
||||
buf= octet2hex(buf, ptr, len);
|
||||
if (to->append((char*) buff, (uint)(buf - buff)))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
|
|
@ -952,7 +952,7 @@ static bool emit_key_part_element(String *to, KEY_PART_INFO *part,
|
|||
|
||||
*buf++= '0';
|
||||
*buf++= 'x';
|
||||
buf= octet2hex(buf, (char*) ptr, len);
|
||||
buf= octet2hex(buf, ptr, len);
|
||||
if (to->append((char*) buff, (uint)(buf - buff)))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue