diff options
author | Alexander Barkov <bar@mariadb.com> | 2019-12-07 18:17:08 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-12-07 19:12:04 +0400 |
commit | d30dbaa20d6fd5fae7027e8d69d8921037614ae2 (patch) | |
tree | f57bb9c3da7eecfacb08feb0058c5a306793c4cd /sql | |
parent | 3c6065a270f547d160e11bbcaa653930ec5ff90f (diff) | |
download | mariadb-git-d30dbaa20d6fd5fae7027e8d69d8921037614ae2.tar.gz |
A cleanup for MDEV-8844: Fixing compilation failure on Windows
Fixing lossy type conversions:
- from int64 to int
- from size_t to uint
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_string.cc | 7 | ||||
-rw-r--r-- | sql/sql_string.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 024f9330c84..71425e0caf6 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -781,13 +781,14 @@ void Static_binary_string::qs_append(ulonglong i) bool Binary_string::copy_printable_hhhh(CHARSET_INFO *to_cs, CHARSET_INFO *from_cs, const char *from, - uint32 from_length) + size_t from_length) { + DBUG_ASSERT(from_length < UINT_MAX32); uint errors; uint one_escaped_char_length= MY_CS_PRINTABLE_CHAR_LENGTH * to_cs->mbminlen; uint one_char_length= MY_MAX(one_escaped_char_length, to_cs->mbmaxlen); - uint32 bytes_needed= (uint32) from_length * one_char_length; - if (alloc(bytes_needed)) + ulonglong bytes_needed= from_length * one_char_length; + if (bytes_needed >= UINT_MAX32 || alloc((size_t) bytes_needed)) return true; str_length= my_convert_using_func(Ptr, Alloced_length, to_cs, my_wc_to_printable_generic, diff --git a/sql/sql_string.h b/sql/sql_string.h index 36a5a5d5e84..617fcda5fee 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -531,7 +531,7 @@ public: */ bool copy_printable_hhhh(CHARSET_INFO *to_cs, CHARSET_INFO *from_cs, - const char *from, uint32 from_length); + const char *from, size_t from_length); bool append_ulonglong(ulonglong val); bool append_longlong(longlong val); |