diff options
author | monty@narttu.mysql.fi <> | 2007-01-27 03:46:45 +0200 |
---|---|---|
committer | monty@narttu.mysql.fi <> | 2007-01-27 03:46:45 +0200 |
commit | 8a80e36ac3facdfba626fd758b6e4490d3ea9ddf (patch) | |
tree | 7a54aa50f6bf549d049cd400fe056d244cfc7eb8 /strings | |
parent | c022454e7c5690330ed78664443e65b3511649b8 (diff) | |
parent | 120e3f5ee1a5f2d62f6a4ff10db0797c5ac42287 (diff) | |
download | mariadb-git-8a80e36ac3facdfba626fd758b6e4490d3ea9ddf.tar.gz |
Merge mysql.com:/home/my/mysql-5.0
into mysql.com:/home/my/mysql-5.1
Merge of 'remove compiler warnings when using -Wshadow'
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-bin.c | 6 | ||||
-rw-r--r-- | strings/ctype-cp932.c | 4 | ||||
-rw-r--r-- | strings/ctype-eucjpms.c | 4 | ||||
-rw-r--r-- | strings/ctype-mb.c | 64 | ||||
-rw-r--r-- | strings/ctype-simple.c | 14 | ||||
-rw-r--r-- | strings/ctype-sjis.c | 4 | ||||
-rw-r--r-- | strings/ctype-uca.c | 26 | ||||
-rw-r--r-- | strings/ctype-ujis.c | 4 | ||||
-rw-r--r-- | strings/ctype-utf8.c | 4 | ||||
-rw-r--r-- | strings/decimal.c | 27 | ||||
-rw-r--r-- | strings/my_vsnprintf.c | 7 | ||||
-rw-r--r-- | strings/strtod.c | 27 |
12 files changed, 100 insertions, 91 deletions
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 62e3dfbad13..69f712c5c44 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -415,7 +415,7 @@ uint my_instr_bin(CHARSET_INFO *cs __attribute__((unused)), { match->beg= 0; match->end= 0; - match->mblen= 0; + match->mb_len= 0; } return 1; /* Empty string is always found */ } @@ -443,13 +443,13 @@ skip: { match[0].beg= 0; match[0].end= (uint) (str- (const uchar*)b-1); - match[0].mblen= match[0].end; + 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].mblen= match[1].end-match[1].beg; + match[1].mb_len= match[1].end-match[1].beg; } } return 2; diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c index afd9dd48646..dc8d1d7cb22 100644 --- a/strings/ctype-cp932.c +++ b/strings/ctype-cp932.c @@ -5379,11 +5379,11 @@ my_mb_wc_cp932(CHARSET_INFO *cs __attribute__((unused)), static uint my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)), - const char *str, const char *strend) + const char *str, const char *str_end) { uint clen= 0; const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) strend; + const unsigned char *e= (const unsigned char *) str_end; for (clen= 0; b < e; ) { diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c index 4e264d43b69..eb1811b19bf 100644 --- a/strings/ctype-eucjpms.c +++ b/strings/ctype-eucjpms.c @@ -8435,11 +8435,11 @@ uint my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)), static uint my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), - const char *str, const char *strend) + const char *str, const char *str_end) { uint clen= 0; const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) strend; + const unsigned char *e= (const unsigned char *) str_end; for (clen= 0; b < e; ) { diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 629d68b30e0..4234ac091cd 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -185,7 +185,7 @@ int my_wildcmp_mb(CHARSET_INFO *cs, { /* Found w_many */ uchar cmp; const char* mb = wildstr; - int mblen=0; + int mb_len=0; wildstr++; /* Remove any '%' and '_' from the wild search string */ @@ -211,7 +211,7 @@ int my_wildcmp_mb(CHARSET_INFO *cs, cmp= *++wildstr; mb=wildstr; - mblen= my_ismbchar(cs, wildstr, wildend); + mb_len= my_ismbchar(cs, wildstr, wildend); INC_PTR(cs,wildstr,wildend); /* This is compared trough cmp */ cmp=likeconv(cs,cmp); do @@ -220,11 +220,11 @@ int my_wildcmp_mb(CHARSET_INFO *cs, { if (str >= str_end) return -1; - if (mblen) + if (mb_len) { - if (str+mblen <= str_end && memcmp(str, mb, mblen) == 0) + if (str+mb_len <= str_end && memcmp(str, mb, mb_len) == 0) { - str += mblen; + str += mb_len; break; } } @@ -256,8 +256,8 @@ uint my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)), register uint32 count=0; while (pos < end) { - uint mblen; - pos+= (mblen= my_ismbchar(cs,pos,end)) ? mblen : 1; + uint mb_len; + pos+= (mb_len= my_ismbchar(cs,pos,end)) ? mb_len : 1; count++; } return count; @@ -271,8 +271,8 @@ uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)), while (length && pos < end) { - uint mblen; - pos+= (mblen= my_ismbchar(cs, pos, end)) ? mblen : 1; + uint mb_len; + pos+= (mb_len= my_ismbchar(cs, pos, end)) ? mb_len : 1; length--; } return (uint) (length ? end+2-start : pos-start); @@ -287,14 +287,14 @@ uint my_well_formed_len_mb(CHARSET_INFO *cs, const char *b, const char *e, while (pos) { my_wc_t wc; - int mblen; + int mb_len; - if ((mblen= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <= 0) + if ((mb_len= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <= 0) { *error= b < e ? 1 : 0; break; } - b+= mblen; + b+= mb_len; pos--; } return (uint) (b - b_start); @@ -318,7 +318,7 @@ uint my_instr_mb(CHARSET_INFO *cs, { match->beg= 0; match->end= 0; - match->mblen= 0; + match->mb_len= 0; } return 1; /* Empty string is always found */ } @@ -328,7 +328,7 @@ uint my_instr_mb(CHARSET_INFO *cs, while (b < end) { - int mblen; + int mb_len; if (!cs->coll->strnncoll(cs, (unsigned char*) b, s_length, (unsigned char*) s, s_length, 0)) @@ -337,19 +337,19 @@ uint my_instr_mb(CHARSET_INFO *cs, { match[0].beg= 0; match[0].end= (uint) (b-b0); - match[0].mblen= res; + match[0].mb_len= res; if (nmatch > 1) { match[1].beg= match[0].end; match[1].end= match[0].end+s_length; - match[1].mblen= 0; /* Not computed */ + match[1].mb_len= 0; /* Not computed */ } } return 2; } - mblen= (mblen= my_ismbchar(cs, b, end)) ? mblen : 1; - b+= mblen; - b_length-= mblen; + mb_len= (mb_len= my_ismbchar(cs, b, end)) ? mb_len : 1; + b+= mb_len; + b_length-= mb_len; res++; } } @@ -550,7 +550,7 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, char *min_str,char *max_str, uint *min_length,uint *max_length) { - uint mblen; + uint mb_len; const char *end= ptr + ptr_length; char *min_org= min_str; char *min_end= min_str + res_length; @@ -587,11 +587,11 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, pad_max_char(cs, max_str, max_end); return 0; } - if ((mblen= my_ismbchar(cs, ptr, end)) > 1) + if ((mb_len= my_ismbchar(cs, ptr, end)) > 1) { - if (ptr+mblen > end || min_str+mblen > min_end) + if (ptr+mb_len > end || min_str+mb_len > min_end) break; - while (mblen--) + while (mb_len--) *min_str++= *max_str++= *ptr++; } else @@ -649,7 +649,7 @@ static int my_wildcmp_mb_bin(CHARSET_INFO *cs, { /* Found w_many */ uchar cmp; const char* mb = wildstr; - int mblen=0; + int mb_len=0; wildstr++; /* Remove any '%' and '_' from the wild search string */ @@ -675,7 +675,7 @@ static int my_wildcmp_mb_bin(CHARSET_INFO *cs, cmp= *++wildstr; mb=wildstr; - mblen= my_ismbchar(cs, wildstr, wildend); + mb_len= my_ismbchar(cs, wildstr, wildend); INC_PTR(cs,wildstr,wildend); /* This is compared trough cmp */ do { @@ -683,11 +683,11 @@ static int my_wildcmp_mb_bin(CHARSET_INFO *cs, { if (str >= str_end) return -1; - if (mblen) + if (mb_len) { - if (str+mblen <= str_end && memcmp(str, mb, mblen) == 0) + if (str+mb_len <= str_end && memcmp(str, mb, mb_len) == 0) { - str += mblen; + str += mb_len; break; } } @@ -926,15 +926,15 @@ uint my_numcells_mb(CHARSET_INFO *cs, const char *b, const char *e) while (b < e) { - int mblen; + int mb_len; uint pg; - if ((mblen= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <= 0) + if ((mb_len= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <= 0) { - mblen= 1; /* Let's think a wrong sequence takes 1 dysplay cell */ + mb_len= 1; /* Let's think a wrong sequence takes 1 dysplay cell */ b++; continue; } - b+= mblen; + b+= mb_len; pg= (wc >> 8) & 0xFF; clen+= utr11_data[pg].p ? utr11_data[pg].p[wc & 0xFF] : utr11_data[pg].page; clen++; diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 2145e604832..c129f117744 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -1173,7 +1173,7 @@ uint my_instr_simple(CHARSET_INFO *cs, { match->beg= 0; match->end= 0; - match->mblen= 0; + match->mb_len= 0; } return 1; /* Empty string is always found */ } @@ -1201,13 +1201,13 @@ skip: { match[0].beg= 0; match[0].end= (uint) (str- (const uchar*)b-1); - match[0].mblen= match[0].end; + 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].mblen= match[1].end-match[1].beg; + match[1].mb_len= match[1].end-match[1].beg; } } return 2; @@ -1598,19 +1598,19 @@ exp: /* [ E [ <sign> ] <unsigned integer> ] */ str++; if (str < end) { - int negative_exp, exp; + int negative_exp, exponent; if ((negative_exp= (*str == '-')) || *str=='+') { if (++str == end) goto ret_sign; } - for (exp= 0 ; + for (exponent= 0 ; str < end && (ch= (unsigned char) (*str - '0')) < 10; str++) { - exp= exp * 10 + ch; + exponent= exponent * 10 + ch; } - shift+= negative_exp ? -exp : exp; + shift+= negative_exp ? -exponent : exponent; } } diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index de622b7f4af..8f7158cc9c9 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4554,11 +4554,11 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)), static uint my_numcells_sjis(CHARSET_INFO *cs __attribute__((unused)), - const char *str, const char *strend) + const char *str, const char *str_end) { uint clen= 0; const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) strend; + const unsigned char *e= (const unsigned char *) str_end; for (clen= 0; b < e; ) { diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index d1de758c797..1292d7f5ede 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -6929,23 +6929,23 @@ static int my_uca_scanner_next_any(my_uca_scanner *scanner) uint16 **ucaw= scanner->uca_weight; uchar *ucal= scanner->uca_length; my_wc_t wc; - int mblen; + int mb_len; - if (((mblen= scanner->cs->cset->mb_wc(scanner->cs, &wc, + if (((mb_len= scanner->cs->cset->mb_wc(scanner->cs, &wc, scanner->sbeg, scanner->send)) <= 0)) return -1; scanner->page= wc >> 8; scanner->code= wc & 0xFF; - scanner->sbeg+= mblen; + scanner->sbeg+= mb_len; if (scanner->contractions && !scanner->page && (scanner->code > 0x40) && (scanner->code < 0x80)) { uint page1, code1, cweight; - if (((mblen= scanner->cs->cset->mb_wc(scanner->cs, &wc, + if (((mb_len= scanner->cs->cset->mb_wc(scanner->cs, &wc, scanner->sbeg, scanner->send)) >=0) && (!(page1= (wc >> 8))) && @@ -6955,7 +6955,7 @@ static int my_uca_scanner_next_any(my_uca_scanner *scanner) { scanner->implicit[0]= 0; scanner->wbeg= scanner->implicit; - scanner->sbeg+= mblen; + scanner->sbeg+= mb_len; return cweight; } } @@ -7314,8 +7314,8 @@ int my_wildcmp_uca(CHARSET_INFO *cs, int result= -1; /* Not found, using wildcards */ my_wc_t s_wc, w_wc; int scan; - int (*mb_wc)(struct charset_info_st *cs, my_wc_t *wc, - const unsigned char *s,const unsigned char *e); + int (*mb_wc)(struct charset_info_st *, my_wc_t *, + const unsigned char *, const unsigned char *); mb_wc= cs->cset->mb_wc; while (wildstr != wildend) @@ -7508,7 +7508,7 @@ typedef struct my_coll_lexem_st my_coll_lexem_init lexem Lex analizer to init str Const string to parse - strend End of the string + str_end End of the string USAGE RETURN VALUES @@ -7516,11 +7516,11 @@ typedef struct my_coll_lexem_st */ static void my_coll_lexem_init(MY_COLL_LEXEM *lexem, - const char *str, const char *strend) + const char *str, const char *str_end) { lexem->beg= str; lexem->prev= str; - lexem->end= strend; + lexem->end= str_end; lexem->diff= 0; lexem->code= 0; } @@ -7677,7 +7677,7 @@ typedef struct my_coll_rule_item_st my_coll_rule_parse rule Collation rule list to load to. str A string containin collation language expression. - strend End of the string. + str_end End of the string. USAGE RETURN VALUES @@ -7686,7 +7686,7 @@ typedef struct my_coll_rule_item_st */ static int my_coll_rule_parse(MY_COLL_RULE *rule, size_t mitems, - const char *str, const char *strend, + const char *str, const char *str_end, char *errstr, size_t errsize) { MY_COLL_LEXEM lexem; @@ -7699,7 +7699,7 @@ static int my_coll_rule_parse(MY_COLL_RULE *rule, size_t mitems, /* Init all variables */ errstr[0]= '\0'; bzero(&item, sizeof(item)); - my_coll_lexem_init(&lexem, str, strend); + my_coll_lexem_init(&lexem, str, str_end); while ((lexnum= my_coll_lexem_next(&lexem))) { diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 7d8a8877995..d1e11071886 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -8303,11 +8303,11 @@ uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), static uint my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), - const char *str, const char *strend) + const char *str, const char *str_end) { uint clen= 0; const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) strend; + const unsigned char *e= (const unsigned char *) str_end; for (clen= 0; b < e; ) { diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 3083d8e9ade..87f984c21b5 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1721,8 +1721,8 @@ int my_wildcmp_unicode(CHARSET_INFO *cs, int result= -1; /* Not found, using wildcards */ my_wc_t s_wc, w_wc; int scan, plane; - int (*mb_wc)(struct charset_info_st *cs, my_wc_t *wc, - const unsigned char *s,const unsigned char *e); + int (*mb_wc)(struct charset_info_st *, my_wc_t *, + const unsigned char *, const unsigned char *); mb_wc= cs->cset->mb_wc; while (wildstr != wildend) diff --git a/strings/decimal.c b/strings/decimal.c index 4bc1a5e76db..659550ce375 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -376,16 +376,16 @@ int decimal2string(decimal_t *from, char *to, int *to_len, } else if (unlikely(len > --*to_len)) /* reserve one byte for \0 */ { - int i=len-*to_len; - error= (frac && i <= frac + 1) ? E_DEC_TRUNCATED : E_DEC_OVERFLOW; - if (frac && i >= frac + 1) i--; - if (i > frac) + int j= len-*to_len; + error= (frac && j <= frac + 1) ? E_DEC_TRUNCATED : E_DEC_OVERFLOW; + if (frac && j >= frac + 1) j--; + if (j > frac) { - intg-= i-frac; + intg-= j-frac; frac= 0; } else - frac-=i; + frac-=j; len= from->sign + intg_len + test(frac) + frac_len; } *to_len=len; @@ -905,7 +905,8 @@ internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed) if (endp+1 < end_of_string && (*endp == 'e' || *endp == 'E')) { int str_error; - longlong exp= my_strtoll10(endp+1, (char**) &end_of_string, &str_error); + longlong exponent= my_strtoll10(endp+1, (char**) &end_of_string, + &str_error); if (end_of_string != endp +1) /* If at least one digit */ { @@ -915,18 +916,18 @@ internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed) error= E_DEC_BAD_NUM; goto fatal_error; } - if (exp > INT_MAX/2 || (str_error == 0 && exp < 0)) + if (exponent > INT_MAX/2 || (str_error == 0 && exponent < 0)) { error= E_DEC_OVERFLOW; goto fatal_error; } - if (exp < INT_MIN/2 && error != E_DEC_OVERFLOW) + if (exponent < INT_MIN/2 && error != E_DEC_OVERFLOW) { error= E_DEC_TRUNCATED; goto fatal_error; } if (error != E_DEC_OVERFLOW) - error= decimal_shift(to, (int) exp); + error= decimal_shift(to, (int) exponent); } } return error; @@ -2094,7 +2095,7 @@ static int do_div_mod(decimal_t *from1, decimal_t *from2, { int frac1=ROUND_UP(from1->frac)*DIG_PER_DEC1, prec1=from1->intg+frac1, frac2=ROUND_UP(from2->frac)*DIG_PER_DEC1, prec2=from2->intg+frac2, - error, i, intg0, frac0, len1, len2, dintg, div=(!mod); + error, i, intg0, frac0, len1, len2, dintg, div_mod=(!mod); dec1 *buf0, *buf1=from1->buf, *buf2=from2->buf, *tmp1, *start2, *stop2, *stop1, *stop0, norm2, carry, *start1, dcarry; dec2 norm_factor, x, guess, y; @@ -2177,7 +2178,7 @@ static int do_div_mod(decimal_t *from1, decimal_t *from2, } buf0=to->buf; stop0=buf0+intg0+frac0; - if (likely(div)) + if (likely(div_mod)) while (dintg++ < 0) *buf0++=0; @@ -2268,7 +2269,7 @@ static int do_div_mod(decimal_t *from1, decimal_t *from2, } } } - if (likely(div)) + if (likely(div_mod)) *buf0=(dec1)guess; dcarry= *start1; start1++; diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 22410f552d1..93d228a1954 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -21,6 +21,13 @@ /* Limited snprintf() implementations + SYNOPSIS + my_vsnprintf() + to Store result here + n Store up to n-1 characters, followed by an end 0 + fmt printf format + ap Arguments + IMPLEMENTION: Supports following formats: %#[l]d diff --git a/strings/strtod.c b/strings/strtod.c index 932a34f921d..15707a9b944 100644 --- a/strings/strtod.c +++ b/strings/strtod.c @@ -57,7 +57,7 @@ double my_strtod(const char *str, char **end_ptr, int *error) { double result= 0.0; uint negative= 0, ndigits, dec_digits= 0, neg_exp= 0; - int exp= 0, digits_after_dec_point= 0, tmp_exp; + int exponent= 0, digits_after_dec_point= 0, tmp_exp; const char *old_str, *end= *end_ptr, *start_of_number; char next_char; my_bool overflow=0; @@ -130,24 +130,25 @@ double my_strtod(const char *str, char **end_ptr, int *error) if ((next_char == 'e' || next_char == 'E') && dec_digits + ndigits != 0 && str < end-1) { - const char *old_str= str++; + const char *old_str2= str++; if ((neg_exp= (*str == '-')) || *str == '+') str++; if (str == end || !my_isdigit(&my_charset_latin1, *str)) - str= old_str; + str= old_str2; else { do { - if (exp < 9999) /* prot. against exp overfl. */ - exp= exp*10 + (*str - '0'); + if (exponent < 9999) /* prot. against exp overfl. */ + exponent= exponent*10 + (*str - '0'); str++; } while (str < end && my_isdigit(&my_charset_latin1, *str)); } } - tmp_exp= neg_exp ? exp + digits_after_dec_point : exp - digits_after_dec_point; + tmp_exp= (neg_exp ? exponent + digits_after_dec_point : + exponent - digits_after_dec_point); if (tmp_exp) { int order; @@ -157,7 +158,7 @@ double my_strtod(const char *str, char **end_ptr, int *error) where f is the resulting floating point number and 1 <= C < 10. Here we compute the modulus */ - order= exp + (neg_exp ? -1 : 1) * (ndigits - 1); + order= exponent + (neg_exp ? -1 : 1) * (ndigits - 1); if (order < 0) order= -order; if (order >= MAX_DBL_EXP && !neg_exp && result) @@ -172,18 +173,18 @@ double my_strtod(const char *str, char **end_ptr, int *error) } } - exp= tmp_exp; - if (exp < 0) + exponent= tmp_exp; + if (exponent < 0) { - exp= -exp; + exponent= -exponent; neg_exp= 1; /* neg_exp was 0 before */ } - while (exp >= 100) + while (exponent >= 100) { result= neg_exp ? result/1.0e100 : result*1.0e100; - exp-= 100; + exponent-= 100; } - scaler= scaler10[exp/10]*scaler1[exp%10]; + scaler= scaler10[exponent/10]*scaler1[exponent%10]; if (neg_exp) result/= scaler; else |