1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Bug #43414 Parenthesis (and other) warnings compiling MySQL

with gcc 4.3.2
      
Compiling MySQL with gcc 4.3.2 and later produces a number of 
warnings, many of which are new with the recent compiler
versions.
      
This bug will be resolved in more than one patch to limit the
size of changesets. This is the first patch, fixing a number 
of the warnings, predominantly "suggest using parentheses 
around && in ||", and empty for and while bodies.
This commit is contained in:
Staale Smedseng
2009-06-09 18:11:21 +02:00
parent 0b7fecf9e4
commit a073ee45c2
15 changed files with 61 additions and 60 deletions

View File

@@ -1157,7 +1157,7 @@ bool Field_num::get_int(CHARSET_INFO *cs, const char *from, uint len,
if (unsigned_flag)
{
if (((ulonglong) *rnd > unsigned_max) && (*rnd= (longlong) unsigned_max) ||
if ((((ulonglong) *rnd > unsigned_max) && (*rnd= (longlong) unsigned_max)) ||
error == MY_ERRNO_ERANGE)
{
goto out_of_range;
@@ -1324,7 +1324,7 @@ void Field::copy_from_tmp(int row_offset)
if (null_ptr)
{
*null_ptr= (uchar) ((null_ptr[0] & (uchar) ~(uint) null_bit) |
null_ptr[row_offset] & (uchar) null_bit);
(null_ptr[row_offset] & (uchar) null_bit));
}
}
@@ -3674,8 +3674,8 @@ int Field_float::store(const char *from,uint len,CHARSET_INFO *cs)
int error;
char *end;
double nr= my_strntod(cs,(char*) from,len,&end,&error);
if (error || (!len || (uint) (end-from) != len &&
table->in_use->count_cuted_fields))
if (error || (!len || ((uint) (end-from) != len &&
table->in_use->count_cuted_fields)))
{
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
(error ? ER_WARN_DATA_OUT_OF_RANGE : WARN_DATA_TRUNCATED), 1);
@@ -3915,8 +3915,8 @@ int Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
int error;
char *end;
double nr= my_strntod(cs,(char*) from, len, &end, &error);
if (error || (!len || (uint) (end-from) != len &&
table->in_use->count_cuted_fields))
if (error || (!len || ((uint) (end-from) != len &&
table->in_use->count_cuted_fields)))
{
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
(error ? ER_WARN_DATA_OUT_OF_RANGE : WARN_DATA_TRUNCATED), 1);
@@ -4771,7 +4771,7 @@ int Field_time::store(longlong nr, bool unsigned_val)
MYSQL_TIMESTAMP_TIME, 1);
error= 1;
}
else if (nr > (longlong) TIME_MAX_VALUE || nr < 0 && unsigned_val)
else if (nr > (longlong) TIME_MAX_VALUE || (nr < 0 && unsigned_val))
{
tmp= TIME_MAX_VALUE;
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
@@ -4930,7 +4930,7 @@ int Field_year::store(const char *from, uint len,CHARSET_INFO *cs)
int error;
longlong nr= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155 ||
if (nr < 0 || (nr >= 100 && nr <= 1900) || nr > 2155 ||
error == MY_ERRNO_ERANGE)
{
*ptr=0;
@@ -4973,7 +4973,7 @@ int Field_year::store(double nr)
int Field_year::store(longlong nr, bool unsigned_val)
{
if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155)
if (nr < 0 || (nr >= 100 && nr <= 1900) || nr > 2155)
{
*ptr= 0;
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
@@ -5968,16 +5968,16 @@ int Field_str::store(double nr)
/* Calculate the exponent from the 'e'-format conversion */
if (anr < 1.0 && anr > 0)
{
for (exp= 0; anr < 1e-100; exp-= 100, anr*= 1e100);
for (; anr < 1e-10; exp-= 10, anr*= 1e10);
for (i= 1; anr < 1 / log_10[i]; exp--, i++);
for (exp= 0; anr < 1e-100; exp-= 100, anr*= 1e100) ;
for (; anr < 1e-10; exp-= 10, anr*= 1e10) ;
for (i= 1; anr < 1 / log_10[i]; exp--, i++) ;
exp--;
}
else
{
for (exp= 0; anr > 1e100; exp+= 100, anr/= 1e100);
for (; anr > 1e10; exp+= 10, anr/= 1e10);
for (i= 1; anr > log_10[i]; exp++, i++);
for (exp= 0; anr > 1e100; exp+= 100, anr/= 1e100) ;
for (; anr > 1e10; exp+= 10, anr/= 1e10) ;
for (i= 1; anr > log_10[i]; exp++, i++) ;
}
max_length= local_char_length - neg;
@@ -7986,7 +7986,7 @@ bool Field_num::eq_def(Field *field)
Field_num *from_num= (Field_num*) field;
if (unsigned_flag != from_num->unsigned_flag ||
zerofill && !from_num->zerofill && !zero_pack() ||
(zerofill && !from_num->zerofill && !zero_pack()) ||
dec != from_num->dec)
return 0;
return 1;
@@ -8065,7 +8065,7 @@ int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs)
{
int delta;
for (; length && !*from; from++, length--); // skip left 0's
for (; length && !*from; from++, length--) ; // skip left 0's
delta= bytes_in_rec - length;
if (delta < -1 ||
@@ -8284,7 +8284,7 @@ int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
int delta;
uchar bits= (uchar) (field_length & 7);
for (; length && !*from; from++, length--); // skip left 0's
for (; length && !*from; from++, length--) ; // skip left 0's
delta= bytes_in_rec - length;
if (delta < 0 ||