summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc44
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 ||