1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Fixed compiler warnings detected by option -Wshadow and -Wunused:

- Removed not used variables and functions
- Added #ifdef around code that is not used
- Renamed variables and functions to avoid conflicts
- Removed some not used arguments

Fixed some class/struct warnings in ndb
Added define IS_LONGDATA() to simplify code in libmysql.c

I did run gcov on the changes and added 'purecov' comments on almost all lines that was not just variable name changes
This commit is contained in:
monty@mysql.com/narttu.mysql.fi
2006-12-15 00:51:37 +02:00
parent 601e6f4b2a
commit 88dd873de0
227 changed files with 3249 additions and 3058 deletions

View File

@@ -371,16 +371,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;
@@ -900,7 +900,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 */
{
@@ -910,18 +911,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;
@@ -2063,7 +2064,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;
@@ -2146,7 +2147,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;
@@ -2237,7 +2238,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++;