From 9891ee5a2aadd2672d8d7f6b217e852344ff86eb Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 12 Jan 2018 18:25:02 +0000 Subject: Fix and reenable Windows compiler warning C4800 (size_t conversion). --- strings/ctype-bin.c | 8 ++++---- strings/ctype-mb.c | 4 ++-- strings/ctype-simple.c | 10 +++++----- strings/ctype-tis620.c | 10 +++++----- strings/ctype-uca.c | 8 ++++---- strings/ctype-ucs2.c | 4 ++-- strings/ctype.c | 4 ++-- strings/my_vsnprintf.c | 6 +++--- 8 files changed, 27 insertions(+), 27 deletions(-) (limited to 'strings') diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 0bbbd282530..612fdbab38c 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -402,7 +402,7 @@ my_strnxfrm_8bit_bin(CHARSET_INFO *cs, if (dst != src) memcpy(dst, src, srclen); return my_strxfrm_pad_desc_and_reverse(cs, dst, dst + srclen, dst + dstlen, - nweights - srclen, flags, 0); + (uint)(nweights - srclen), flags, 0); } @@ -416,7 +416,7 @@ my_strnxfrm_8bit_nopad_bin(CHARSET_INFO *cs, if (dst != src) memcpy(dst, src, srclen); return my_strxfrm_pad_desc_and_reverse_nopad(cs, dst, dst + srclen, - dst + dstlen, nweights - srclen, + dst + dstlen,(uint)(nweights - srclen), flags, 0); } @@ -464,13 +464,13 @@ skip: if (nmatch > 0) { match[0].beg= 0; - match[0].end= (size_t) (str- (const uchar*)b-1); + match[0].end= (uint) (str- (const uchar*)b-1); match[0].mb_len= match[0].end; if (nmatch > 1) { match[1].beg= match[0].end; - match[1].end= match[0].end+s_length; + match[1].end= (uint)(match[0].end+s_length); match[1].mb_len= match[1].end-match[1].beg; } } diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index bfd533e6f98..19caa22edb4 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -528,12 +528,12 @@ uint my_instr_mb(CHARSET_INFO *cs, if (nmatch) { match[0].beg= 0; - match[0].end= (size_t) (b-b0); + match[0].end= (uint) (b-b0); match[0].mb_len= res; if (nmatch > 1) { match[1].beg= match[0].end; - match[1].end= match[0].end+s_length; + match[1].end= (uint)(match[0].end+s_length); match[1].mb_len= 0; /* Not computed */ } } diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index fc5218caba1..d6e5f02d463 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -78,8 +78,8 @@ size_t my_strnxfrm_simple_internal(CHARSET_INFO * cs, const uchar *map= cs->sort_order; uchar *d0= dst; uint frmlen; - if ((frmlen= MY_MIN(dstlen, *nweights)) > srclen) - frmlen= srclen; + if ((frmlen= (uint)MY_MIN(dstlen, *nweights)) > srclen) + frmlen= (uint)srclen; if (dst != src) { const uchar *end; @@ -321,7 +321,7 @@ size_t my_snprintf_8bit(CHARSET_INFO *cs __attribute__((unused)), const char* fmt, ...) { va_list args; - int result; + size_t result; va_start(args,fmt); result= my_vsnprintf(to, n, fmt, args); va_end(args); @@ -1226,13 +1226,13 @@ skip: if (nmatch > 0) { match[0].beg= 0; - match[0].end= (size_t) (str- (const uchar*)b-1); + match[0].end= (uint) (str- (const uchar*)b-1); match[0].mb_len= match[0].end; if (nmatch > 1) { match[1].beg= match[0].end; - match[1].end= match[0].end+s_length; + match[1].end= (uint)(match[0].end+s_length); match[1].mb_len= match[1].end-match[1].beg; } } diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index 5e24c84056c..bfd8b0db1d5 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -449,7 +449,7 @@ static const uchar sort_order_tis620[]= static size_t thai2sortable(uchar *tstr, size_t len) { uchar *p; - int tlen; + size_t tlen; uchar l2bias; tlen= len; @@ -609,10 +609,10 @@ my_strnxfrm_tis620(CHARSET_INFO *cs, set_if_smaller(dstlen, nweights); set_if_smaller(len, dstlen); len= my_strxfrm_pad_desc_and_reverse(cs, dst, dst + len, dst + dstlen, - dstlen - len, flags, 0); + (uint)(dstlen - len), flags, 0); if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && len < dstlen0) { - uint fill_length= dstlen0 - len; + size_t fill_length= dstlen0 - len; cs->cset->fill(cs, (char*) dst + len, fill_length, cs->pad_char); len= dstlen0; } @@ -632,10 +632,10 @@ my_strnxfrm_tis620_nopad(CHARSET_INFO *cs, set_if_smaller(dstlen, nweights); set_if_smaller(len, dstlen); len= my_strxfrm_pad_desc_and_reverse_nopad(cs, dst, dst + len, dst + dstlen, - dstlen - len, flags, 0); + (uint)(dstlen - len), flags, 0); if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && len < dstlen0) { - uint fill_length= dstlen0 - len; + size_t fill_length= dstlen0 - len; memset(dst + len, 0x00, fill_length); len= dstlen0; } diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index e3ed531df93..f75b5c7c7a4 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -31260,7 +31260,7 @@ static my_bool my_uca_alloc_contractions(MY_CONTRACTIONS *contractions, MY_CHARSET_LOADER *loader, size_t n) { - uint size= n * sizeof(MY_CONTRACTION); + size_t size= n * sizeof(MY_CONTRACTION); if (!(contractions->item= (loader->once_alloc)(size)) || !(contractions->flags= (char *) (loader->once_alloc)(MY_UCA_CNT_FLAG_SIZE))) return 1; @@ -34005,7 +34005,7 @@ apply_one_rule(MY_CHARSET_LOADER *loader, { MY_CONTRACTIONS *contractions= &dst->contractions; to= my_uca_init_one_contraction(contractions, - r->curr, nshift, r->with_context); + r->curr, (uint)nshift, r->with_context); /* Store weights of the "reset to" character */ dst->contractions.nitems--; /* Temporarily hide - it's incomplete */ rc= my_char_weight_put(dst, @@ -34202,9 +34202,9 @@ init_weight_level(MY_CHARSET_LOADER *loader, MY_COLL_RULES *rules, ncontractions++; } - ncontractions += src->contractions.nitems; + ncontractions += (int)src->contractions.nitems; - if ((my_uca_generate_pages(loader, dst, src, npages))) + if ((my_uca_generate_pages(loader, dst, src, (uint)npages))) return TRUE; if (ncontractions) diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index cba44afc926..80bb6745b19 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1078,7 +1078,7 @@ my_fill_mb2(CHARSET_INFO *cs, char *s, size_t slen, int fill) } -static int +static size_t my_vsnprintf_mb2(char *dst, size_t n, const char* fmt, va_list ap) { char *start=dst, *end= dst + n - 1; @@ -2327,7 +2327,7 @@ my_charlen_utf32(CHARSET_INFO *cs __attribute__((unused)), /* Defines my_well_formed_char_length_utf32 */ -static int +static size_t my_vsnprintf_utf32(char *dst, size_t n, const char* fmt, va_list ap) { char *start= dst, *end= dst + n; diff --git a/strings/ctype.c b/strings/ctype.c index 0aed6c8bf52..64ebd51676f 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -904,11 +904,11 @@ my_string_metadata_get(MY_STRING_METADATA *metadata, if (cs->mbmaxlen == 1 && !(cs->state & MY_CS_NONASCII)) { metadata->char_length= length; - metadata->repertoire= my_string_repertoire_8bit(cs, str, length); + metadata->repertoire= my_string_repertoire_8bit(cs, str, (ulong)length); } else { - my_string_metadata_get_mb(metadata, cs, str, length); + my_string_metadata_get_mb(metadata, cs, str, (ulong)length); } } diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 34ec811adac..c6d9e8530dd 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -92,10 +92,10 @@ static const char *get_length(const char *fmt, size_t *length, uint *pre_zero) */ static const char *get_length_arg(const char *fmt, ARGS_INFO *args_arr, - uint *arg_count, size_t *length, uint *flags) + size_t *arg_count, size_t *length, uint *flags) { fmt= get_length(fmt+1, length, flags); - *arg_count= MY_MAX(*arg_count, (uint) *length); + *arg_count= MY_MAX(*arg_count, *length); (*length)--; DBUG_ASSERT(*fmt == '$' && *length < MAX_ARGS); args_arr[*length].arg_type= 'd'; @@ -330,7 +330,7 @@ static char *process_args(CHARSET_INFO *cs, char *to, char *end, { ARGS_INFO args_arr[MAX_ARGS]; PRINT_INFO print_arr[MAX_PRINT_INFO]; - uint idx= 0, arg_count= arg_index; + size_t idx= 0, arg_count= arg_index; start: /* Here we are at the beginning of positional argument, right after $ */ -- cgit v1.2.1