diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2018-02-06 12:55:58 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2018-02-06 12:55:58 +0000 |
commit | 6c279ad6a71c63cb595fde7c951aadb31c3dbebc (patch) | |
tree | 3603f88e1b3bd1e622edb182cccd882dd31ddc8a /sql/key.cc | |
parent | f271100836d8a91a775894ec36b869a66a3145e5 (diff) | |
download | mariadb-git-6c279ad6a71c63cb595fde7c951aadb31c3dbebc.tar.gz |
MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from 'size_t' to 'type', possible loss of data)
Handle string length as size_t, consistently (almost always:))
Change function prototypes to accept size_t, where in the past
ulong or uint were used. change local/member variables to size_t
when appropriate.
This fix excludes rocksdb, spider,spider, sphinx and connect for now.
Diffstat (limited to 'sql/key.cc')
-rw-r--r-- | sql/key.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sql/key.cc b/sql/key.cc index ab93e8a0437..93500633d08 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -317,7 +317,7 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length) FIELDFLAG_PACK))) { CHARSET_INFO *cs= key_part->field->charset(); - uint char_length= key_part->length / cs->mbmaxlen; + size_t char_length= key_part->length / cs->mbmaxlen; const uchar *pos= table->record[0] + key_part->offset; if (length > char_length) { @@ -383,7 +383,7 @@ void field_unpack(String *to, Field *field, const uchar *rec, uint max_length, which can break a multi-byte characters in the middle. Align, returning not more than "char_length" characters. */ - uint charpos, char_length= max_length / cs->mbmaxlen; + size_t charpos, char_length= max_length / cs->mbmaxlen; if ((charpos= my_charpos(cs, tmp.ptr(), tmp.ptr() + tmp.length(), char_length)) < tmp.length()) @@ -695,7 +695,7 @@ ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key) { uchar *pos= (uchar*)key; CHARSET_INFO *UNINIT_VAR(cs); - uint UNINIT_VAR(length), UNINIT_VAR(pack_length); + size_t UNINIT_VAR(length), UNINIT_VAR(pack_length); bool is_string= TRUE; key+= key_part->length; @@ -752,7 +752,7 @@ ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key) { if (cs->mbmaxlen > 1) { - uint char_length= my_charpos(cs, pos + pack_length, + size_t char_length= my_charpos(cs, pos + pack_length, pos + pack_length + length, length / cs->mbmaxlen); set_if_smaller(length, char_length); @@ -799,7 +799,7 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts, uchar *pos1= (uchar*)key1; uchar *pos2= (uchar*)key2; CHARSET_INFO *UNINIT_VAR(cs); - uint UNINIT_VAR(length1), UNINIT_VAR(length2), UNINIT_VAR(pack_length); + size_t UNINIT_VAR(length1), UNINIT_VAR(length2), UNINIT_VAR(pack_length); bool is_string= TRUE; key1+= key_part->length; @@ -863,13 +863,13 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts, Compare the strings taking into account length in characters and collation */ - uint byte_len1= length1, byte_len2= length2; + size_t byte_len1= length1, byte_len2= length2; if (cs->mbmaxlen > 1) { - uint char_length1= my_charpos(cs, pos1 + pack_length, + size_t char_length1= my_charpos(cs, pos1 + pack_length, pos1 + pack_length + length1, length1 / cs->mbmaxlen); - uint char_length2= my_charpos(cs, pos2 + pack_length, + size_t char_length2= my_charpos(cs, pos2 + pack_length, pos2 + pack_length + length2, length2 / cs->mbmaxlen); set_if_smaller(length1, char_length1); |