diff options
author | Staale Smedseng <staale.smedseng@sun.com> | 2009-06-09 14:55:30 +0200 |
---|---|---|
committer | Staale Smedseng <staale.smedseng@sun.com> | 2009-06-09 14:55:30 +0200 |
commit | a092ed1afe3c3c7889810f45d591cfb2633c87f9 (patch) | |
tree | 6cee8c2084e348d45fc326e9557d2f4148c4ab1a /sql/field.cc | |
parent | 0b7fecf9e486990d173cc87b2c94aee06b0f7dbb (diff) | |
download | mariadb-git-a092ed1afe3c3c7889810f45d591cfb2633c87f9.tar.gz |
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.
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/sql/field.cc b/sql/field.cc index c7dd2afd934..fc54c9ab4c0 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -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,22 @@ 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 +7992,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 +8071,8 @@ 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 +8291,8 @@ 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 || |