Fixed compiler warnings found by gcc 4.3.2

- Added braces around expressions with &&, ||, & and |
- Added empty line before ; for empty while and for loops
- Added () around if with assignments
- Removed const before function returning simple type

Changed BUILD scripts to not build with NDB 


BUILD/SETUP.sh:
  By default, don't build ndb with --max in Maria tree.
  NDB is not kept up to date anyway in 5.1
client/mysql.cc:
  Added braces around && to get rid of compiler warnings
sql/event_db_repository.cc:
  Added braces around && to get rid of compiler warnings
sql/events.cc:
  Added braces around && to get rid of compiler warnings
sql/field.cc:
  Added braces around && to get rid of compiler warnings
  Fixed for loops
sql/field.h:
  Added braces around & to get rid of compiler warnings
sql/field_conv.cc:
  Added braces around && to get rid of compiler warnings
  Fixed bug when copying between DATETIME fields and strict dates are used
  Removed not needeed else
sql/gstream.cc:
  Added braces around && to get rid of compiler warnings
sql/ha_ndbcluster.cc:
  Added braces around && to get rid of compiler warnings
  Added {} to get rid of compiler warnings
sql/handler.cc:
  Added braces around && to get rid of compiler warnings
sql/item.cc:
  Added braces around && to get rid of compiler warnings
sql/item_cmpfunc.cc:
  Added braces around && to get rid of compiler warnings
  Removed some not needed space
sql/item_func.cc:
  Added braces around && to get rid of compiler warnings
sql/item_strfunc.cc:
  Added braces around && to get rid of compiler warnings
sql/item_subselect.cc:
  Added braces around && to get rid of compiler warnings
sql/item_sum.cc:
  Added braces around && to get rid of compiler warnings
sql/item_timefunc.cc:
  Added braces around && to get rid of compiler warnings
sql/item_xmlfunc.cc:
  Added empty line before ; for empty while and for loops
sql/log.cc:
  Added braces around && to get rid of compiler warnings
sql/log_event.cc:
  Added braces around && to get rid of compiler warnings
  Removed not needed else
sql/log_event_old.cc:
  Added braces around && to get rid of compiler warnings
sql/opt_range.cc:
  Added braces around && to get rid of compiler warnings
sql/opt_sum.cc:
  Added braces around && to get rid of compiler warnings
sql/set_var.cc:
  Added empty line before ; for empty while and for loops
  Added () around if with assignments
sql/slave.cc:
  Added braces around && to get rid of compiler warnings
  Added empty line before ; for empty while and for loops
sql/spatial.h:
  Added braces around && to get rid of compiler warnings
sql/sql_acl.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_analyse.cc:
  Added empty line before ; for empty while and for loops
sql/sql_base.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_connect.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_db.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_delete.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_help.cc:
  Added empty line before ; for empty while and for loops
sql/sql_insert.cc:
  Added braces around && to get rid of compiler warnings
  Added () around if with assignments
sql/sql_lex.cc:
  Cast char array references to uchar; Fixed wrong array referencing when using characters > ASCII 128 in SQL statments
  Added empty line before ; for empty while and for loops
  Trivial indent fixes
  Added braces around && to get rid of compiler warnings
sql/sql_load.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_parse.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_partition.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_plugin.cc:
  Fixed bug in detecing if option variable should be readonly
  Added empty line before ; for empty while and for loops
sql/sql_prepare.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_select.cc:
  Added braces around && to get rid of compiler warnings
  Added () around if with assignments
  Added empty line before ; for empty while and for loops
sql/sql_show.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_table.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_trigger.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_update.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_yacc.yy:
  Added braces around && to get rid of compiler warnings
sql/table.cc:
  Added braces around && to get rid of compiler warnings
sql/table.h:
  Added braces around && to get rid of compiler warnings
sql/time.cc:
  Added braces around && to get rid of compiler warnings
sql/tztime.cc:
  Added braces around && to get rid of compiler warnings
sql/uniques.cc:
  Added braces around && to get rid of compiler warnings
storage/federated/ha_federated.cc:
  Fixed bug in testing of variable to ha_info() (Not critical)
storage/heap/ha_heap.cc:
  Added braces around && to get rid of compiler warnings
storage/maria/ha_maria.cc:
  Fixed bug: Mark that maria_log_dir_path is readonly
  Added braces around && to get rid of compiler warnings
storage/ndb/include/ndbapi/NdbEventOperation.hpp:
  Removed const before function returning simple type
storage/ndb/include/ndbapi/NdbOperation.hpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/Ndb.cpp:
  Added empty line before ; for empty while and for loops
storage/ndb/src/ndbapi/NdbEventOperation.cpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/NdbRecAttr.cpp:
  Added empty line before ; for empty while and for loops
storage/ndb/src/ndbapi/TransporterFacade.hpp:
  Added braces around && to get rid of compiler warnings
This commit is contained in:
Michael Widenius 2009-01-31 23:22:44 +02:00
parent 37db97b0e2
commit bd4e65515f
62 changed files with 409 additions and 366 deletions

View File

@ -168,6 +168,8 @@ local_infile_configs="--enable-local-infile"
max_no_embedded_configs="$SSL_LIBRARY --with-plugins=max"
max_no_ndb_configs="$SSL_LIBRARY --with-plugins=max-no-ndb --with-embedded-server"
max_configs="$SSL_LIBRARY --with-plugins=max --with-embedded-server"
# Disable NDB in maria max builds
max_configs=$max_no_ndb_configs
#
# CPU and platform specific compilation flags.

View File

@ -1990,12 +1990,13 @@ static COMMANDS *find_command(char *name,char cmd_char)
for (uint i= 0; commands[i].name; i++)
{
if (commands[i].func &&
((name &&
!my_strnncoll(charset_info,(uchar*)name,len,
(uchar*)commands[i].name,len) &&
!commands[i].name[len] &&
(!end || (end && commands[i].takes_params))) ||
!name && commands[i].cmd_char == cmd_char))
(((name &&
!my_strnncoll(charset_info,
(uchar*) name, len,
(uchar*) commands[i].name, len) &&
!commands[i].name[len] &&
(!end || (end && commands[i].takes_params)))) ||
(!name && commands[i].cmd_char == cmd_char)))
{
DBUG_PRINT("exit",("found command: %s", commands[i].name));
DBUG_RETURN(&commands[i]);
@ -2183,16 +2184,18 @@ static bool add_line(String &buffer,char *line,char *in_string,
}
buffer.length(0);
}
else if (!*ml_comment && (!*in_string && (inchar == '#' ||
inchar == '-' && pos[1] == '-' &&
/*
The third byte is either whitespace or is the
end of the line -- which would occur only
because of the user sending newline -- which is
itself whitespace and should also match.
*/
(my_isspace(charset_info,pos[2]) ||
!pos[2]))))
else if (!*ml_comment &&
(!*in_string &&
(inchar == '#' ||
(inchar == '-' && pos[1] == '-' &&
/*
The third byte is either whitespace or is the end of
the line -- which would occur only because of the
user sending newline -- which is itself whitespace
and should also match.
*/
(my_isspace(charset_info,pos[2]) ||
!pos[2])))))
{
// Flush previously accepted characters
if (out != line)
@ -3506,7 +3509,7 @@ static void print_warnings()
messages. To be safe, skip printing the duplicate only if it is the only
warning.
*/
if (!cur || num_rows == 1 && error == (uint) strtoul(cur[1], NULL, 10))
if (!cur || (num_rows == 1 && error == (uint) strtoul(cur[1], NULL, 10)))
goto end;
/* Print the warnings */

View File

@ -711,7 +711,7 @@ Event_db_repository::update_event(THD *thd, Event_parse_data *parse_data,
DBUG_ENTER("Event_db_repository::update_event");
/* None or both must be set */
DBUG_ASSERT(new_dbname && new_name || new_dbname == new_name);
DBUG_ASSERT((new_dbname && new_name) || new_dbname == new_name);
/* Reset sql_mode during data dictionary operations. */
thd->variables.sql_mode= 0;

View File

@ -932,7 +932,7 @@ Events::init(my_bool opt_noacl)
}
if (event_queue->init_queue(thd) || load_events_from_db(thd) ||
opt_event_scheduler == EVENTS_ON && scheduler->start())
(opt_event_scheduler == EVENTS_ON && scheduler->start()))
{
sql_print_error("Event Scheduler: Error while loading from disk.");
res= TRUE; /* fatal error: request unireg_abort */

View File

@ -1165,7 +1165,8 @@ 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;
@ -1350,7 +1351,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));
}
}
@ -4081,8 +4082,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);
@ -4343,8 +4344,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);
@ -5196,7 +5197,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,
@ -5361,7 +5362,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;
@ -5405,7 +5406,7 @@ int Field_year::store(double nr)
int Field_year::store(longlong nr, bool unsigned_val)
{
ASSERT_COLUMN_MARKED_FOR_WRITE;
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);
@ -6427,16 +6428,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;
@ -8831,7 +8838,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;
@ -8972,7 +8979,8 @@ int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs)
ASSERT_COLUMN_MARKED_FOR_WRITE;
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 ||
@ -9304,7 +9312,7 @@ Field_bit::unpack(uchar *to, const uchar *from, uint param_data,
and slave have the same sizes, then use the old unpack() method.
*/
if (param_data == 0 ||
(from_bit_len == bit_len) && (from_len == bytes_in_rec))
((from_bit_len == bit_len) && (from_len == bytes_in_rec)))
{
if (bit_len > 0)
{
@ -9383,7 +9391,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 ||

View File

@ -209,7 +209,7 @@ public:
memcpy(ptr, ptr + l_offset, pack_length());
if (null_ptr)
*null_ptr= ((*null_ptr & (uchar) ~null_bit) |
null_ptr[l_offset] & null_bit);
(null_ptr[l_offset] & null_bit));
}
virtual bool binary() const { return 1; }
virtual bool zero_pack() const { return 1; }

View File

@ -99,7 +99,7 @@ static void do_field_to_null_str(Copy_field *copy)
static void do_outer_field_to_null_str(Copy_field *copy)
{
if (*copy->null_row ||
copy->from_null_ptr && (*copy->from_null_ptr & copy->from_bit))
(copy->from_null_ptr && (*copy->from_null_ptr & copy->from_bit)))
{
bzero(copy->to_ptr,copy->from_length);
copy->to_null_ptr[0]=1; // Always bit 1
@ -212,7 +212,7 @@ static void do_copy_null(Copy_field *copy)
static void do_outer_field_null(Copy_field *copy)
{
if (*copy->null_row ||
copy->from_null_ptr && (*copy->from_null_ptr & copy->from_bit))
(copy->from_null_ptr && (*copy->from_null_ptr & copy->from_bit)))
{
*copy->to_null_ptr|=copy->to_bit;
copy->to_field->reset();
@ -667,8 +667,8 @@ Copy_field::get_copy_func(Field *to,Field *from)
!compatible_db_low_byte_first ||
((to->table->in_use->variables.sql_mode &
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) &&
to->type() == MYSQL_TYPE_DATE ||
to->type() == MYSQL_TYPE_DATETIME))
(to->type() == MYSQL_TYPE_DATE ||
to->type() == MYSQL_TYPE_DATETIME)))
{
if (from->real_type() == MYSQL_TYPE_ENUM ||
from->real_type() == MYSQL_TYPE_SET)
@ -684,8 +684,7 @@ Copy_field::get_copy_func(Field *to,Field *from)
if (from->real_type() == MYSQL_TYPE_ENUM &&
to->real_type() == MYSQL_TYPE_ENUM)
return do_field_enum;
else
return do_field_string;
return do_field_string;
}
}
else if (to->charset() != from->charset())
@ -709,10 +708,8 @@ Copy_field::get_copy_func(Field *to,Field *from)
{
if (to->charset() == &my_charset_bin)
return do_expand_binary;
else
return do_expand_string;
return do_expand_string;
}
}
else if (to->real_type() != from->real_type() ||
to_length != from_length ||
@ -738,7 +735,7 @@ Copy_field::get_copy_func(Field *to,Field *from)
}
}
}
/* Eq fields */
/* Identical field types */
switch (to_length) {
case 1: return do_field_1;
case 2: return do_field_2;
@ -764,14 +761,14 @@ int field_conv(Field *to,Field *from)
to->real_type() != MYSQL_TYPE_SET &&
to->real_type() != MYSQL_TYPE_BIT &&
(to->real_type() != MYSQL_TYPE_NEWDECIMAL ||
(to->field_length == from->field_length &&
(((Field_num*)to)->dec == ((Field_num*)from)->dec))) &&
((to->field_length == from->field_length &&
(((Field_num*)to)->dec == ((Field_num*)from)->dec)))) &&
from->charset() == to->charset() &&
to->table->s->db_low_byte_first == from->table->s->db_low_byte_first &&
(!(to->table->in_use->variables.sql_mode &
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) ||
to->type() != MYSQL_TYPE_DATE &&
to->type() != MYSQL_TYPE_DATETIME) &&
(to->type() != MYSQL_TYPE_DATE &&
to->type() != MYSQL_TYPE_DATETIME)) &&
(from->real_type() != MYSQL_TYPE_VARCHAR ||
((Field_varstring*)from)->length_bytes ==
((Field_varstring*)to)->length_bytes))

View File

@ -75,7 +75,7 @@ bool Gis_read_stream::get_next_number(double *d)
skip_space();
if ((m_cur >= m_limit) ||
(*m_cur < '0' || *m_cur > '9') && *m_cur != '-' && *m_cur != '+')
((*m_cur < '0' || *m_cur > '9') && *m_cur != '-' && *m_cur != '+'))
{
set_error_msg("Numeric constant expected");
return 1;

View File

@ -1293,10 +1293,12 @@ int ha_ndbcluster::open_indexes(Ndb *ndb, TABLE *tab, bool ignore_error)
for (i= 0; i < tab->s->keys; i++, key_info++, key_name++)
{
if ((error= add_index_handle(thd, dict, key_info, *key_name, i)))
{
if (ignore_error)
m_index[i].index= m_index[i].unique_index= NULL;
else
break;
}
m_index[i].null_in_unique_index= FALSE;
if (check_index_fields_not_null(key_info))
m_index[i].null_in_unique_index= TRUE;
@ -6261,9 +6263,10 @@ void ha_ndbcluster::get_auto_increment(ulonglong offset, ulonglong increment,
for (;;)
{
Ndb_tuple_id_range_guard g(m_share);
if (m_skip_auto_increment &&
ndb->readAutoIncrementValue(m_table, g.range, auto_value) ||
ndb->getAutoIncrementValue(m_table, g.range, auto_value, cache_size, increment, offset))
if ((m_skip_auto_increment &&
ndb->readAutoIncrementValue(m_table, g.range, auto_value)) ||
ndb->getAutoIncrementValue(m_table, g.range, auto_value, cache_size,
increment, offset))
{
if (--retries &&
ndb->getNdbError().status == NdbError::TemporaryError)
@ -9914,8 +9917,10 @@ bool ha_ndbcluster::check_if_incompatible_data(HA_CREATE_INFO *create_info,
{
Field *field= table->field[i];
const NDBCOL *col= tab->getColumn(i);
if (col->getStorageType() == NDB_STORAGETYPE_MEMORY && create_info->storage_media != HA_SM_MEMORY ||
col->getStorageType() == NDB_STORAGETYPE_DISK && create_info->storage_media != HA_SM_DISK)
if ((col->getStorageType() == NDB_STORAGETYPE_MEMORY &&
create_info->storage_media != HA_SM_MEMORY) ||
(col->getStorageType() == NDB_STORAGETYPE_DISK &&
create_info->storage_media != HA_SM_DISK))
{
DBUG_PRINT("info", ("Column storage media is changed"));
DBUG_RETURN(COMPATIBLE_DATA_NO);

View File

@ -2266,8 +2266,8 @@ int handler::update_auto_increment()
DBUG_ASSERT(next_insert_id >= auto_inc_interval_for_cur_row.minimum());
if ((nr= table->next_number_field->val_int()) != 0 ||
table->auto_increment_field_not_null &&
thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO)
(table->auto_increment_field_not_null &&
thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO))
{
/*
Update next_insert_id if we had already generated a value in this

View File

@ -2624,7 +2624,7 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type,
if (value.time.year > 9999 || value.time.month > 12 ||
value.time.day > 31 ||
time_type != MYSQL_TIMESTAMP_TIME && value.time.hour > 23 ||
(time_type != MYSQL_TIMESTAMP_TIME && value.time.hour > 23) ||
value.time.minute > 59 || value.time.second > 59)
{
char buff[MAX_DATE_STRING_REP_LENGTH];
@ -4836,8 +4836,8 @@ int Item::save_in_field(Field *field, bool no_conversions)
{
int error;
if (result_type() == STRING_RESULT ||
result_type() == REAL_RESULT &&
field->result_type() == STRING_RESULT)
(result_type() == REAL_RESULT &&
field->result_type() == STRING_RESULT))
{
String *result;
CHARSET_INFO *cs= collation.collation;

View File

@ -1478,8 +1478,8 @@ longlong Item_func_truth::val_int()
bool Item_in_optimizer::fix_left(THD *thd, Item **ref)
{
if (!args[0]->fixed && args[0]->fix_fields(thd, args) ||
!cache && !(cache= Item_cache::get_cache(args[0])))
if ((!args[0]->fixed && args[0]->fix_fields(thd, args)) ||
(!cache && !(cache= Item_cache::get_cache(args[0]))))
return 1;
cache->setup(args[0]);
@ -2990,19 +2990,19 @@ int cmp_longlong(void *cmp_arg,
One of the args is unsigned and is too big to fit into the
positive signed range. Report no match.
*/
if (a->unsigned_flag && ((ulonglong) a->val) > (ulonglong) LONGLONG_MAX ||
b->unsigned_flag && ((ulonglong) b->val) > (ulonglong) LONGLONG_MAX)
if ((a->unsigned_flag && ((ulonglong) a->val) > (ulonglong) LONGLONG_MAX)
||
(b->unsigned_flag && ((ulonglong) b->val) > (ulonglong) LONGLONG_MAX))
return a->unsigned_flag ? 1 : -1;
/*
Although the signedness differs both args can fit into the signed
positive range. Make them signed and compare as usual.
*/
return cmp_longs (a->val, b->val);
return cmp_longs(a->val, b->val);
}
if (a->unsigned_flag)
return cmp_ulongs ((ulonglong) a->val, (ulonglong) b->val);
else
return cmp_longs (a->val, b->val);
return cmp_ulongs((ulonglong) a->val, (ulonglong) b->val);
return cmp_longs(a->val, b->val);
}
static int cmp_double(void *cmp_arg, double *a,double *b)

View File

@ -4405,8 +4405,8 @@ int Item_func_set_user_var::save_in_field(Field *field, bool no_conversions,
update();
if (result_type() == STRING_RESULT ||
result_type() == REAL_RESULT &&
field->result_type() == STRING_RESULT)
(result_type() == REAL_RESULT &&
field->result_type() == STRING_RESULT))
{
String *result;
CHARSET_INFO *cs= collation.collation;

View File

@ -510,7 +510,7 @@ String *Item_func_des_encrypt::val_str(String *str)
tail= (8-(res_length) % 8); // 1..8 marking extra length
res_length+=tail;
code= ER_OUT_OF_RESOURCES;
if (tail && res->append(append_str, tail) || tmp_value.alloc(res_length+1))
if ((tail && res->append(append_str, tail)) || tmp_value.alloc(res_length+1))
goto error;
(*res)[res_length-1]=tail; // save extra length
tmp_value.length(res_length+1);

View File

@ -1314,8 +1314,8 @@ Item_in_subselect::row_value_transformer(JOIN *join)
Item *item_having_part2= 0;
for (uint i= 0; i < cols_num; i++)
{
DBUG_ASSERT(left_expr->fixed &&
select_lex->ref_pointer_array[i]->fixed ||
DBUG_ASSERT((left_expr->fixed &&
select_lex->ref_pointer_array[i]->fixed) ||
(select_lex->ref_pointer_array[i]->type() == REF_ITEM &&
((Item_ref*)(select_lex->ref_pointer_array[i]))->ref_type() ==
Item_ref::OUTER_REF));
@ -1392,8 +1392,8 @@ Item_in_subselect::row_value_transformer(JOIN *join)
for (uint i= 0; i < cols_num; i++)
{
Item *item, *item_isnull;
DBUG_ASSERT(left_expr->fixed &&
select_lex->ref_pointer_array[i]->fixed ||
DBUG_ASSERT((left_expr->fixed &&
select_lex->ref_pointer_array[i]->fixed) ||
(select_lex->ref_pointer_array[i]->type() == REF_ITEM &&
((Item_ref*)(select_lex->ref_pointer_array[i]))->ref_type() ==
Item_ref::OUTER_REF));

View File

@ -654,8 +654,8 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
return TRUE;
// 'item' can be changed during fix_fields
if (!item->fixed &&
item->fix_fields(thd, args) ||
if ((!item->fixed &&
item->fix_fields(thd, args)) ||
(item= args[0])->check_cols(1))
return TRUE;
decimals=item->decimals;
@ -981,8 +981,8 @@ void Item_sum_distinct::fix_length_and_dec()
integers each <= 2^32.
*/
if (table_field_type == MYSQL_TYPE_INT24 ||
table_field_type >= MYSQL_TYPE_TINY &&
table_field_type <= MYSQL_TYPE_LONG)
(table_field_type >= MYSQL_TYPE_TINY &&
table_field_type <= MYSQL_TYPE_LONG))
{
val.traits= Hybrid_type_traits_fast_decimal::instance();
break;
@ -2640,8 +2640,8 @@ bool Item_sum_count_distinct::setup(THD *thd)
enum enum_field_types f_type= f->type();
tree_key_length+= f->pack_length();
if ((f_type == MYSQL_TYPE_VARCHAR) ||
!f->binary() && (f_type == MYSQL_TYPE_STRING ||
f_type == MYSQL_TYPE_VAR_STRING))
(!f->binary() && (f_type == MYSQL_TYPE_STRING ||
f_type == MYSQL_TYPE_VAR_STRING)))
{
all_binary= FALSE;
break;

View File

@ -446,7 +446,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
strict_week_number= (*ptr=='V' || *ptr=='v');
tmp= (char*) val + min(val_len, 2);
if ((week_number= (int) my_strtoll10(val, &tmp, &error)) < 0 ||
strict_week_number && !week_number ||
(strict_week_number && !week_number) ||
week_number > 53)
goto err;
val= tmp;
@ -542,10 +542,11 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
%V,%v require %X,%x resprectively,
%U,%u should be used with %Y and not %X or %x
*/
if (strict_week_number &&
(strict_week_number_year < 0 ||
strict_week_number_year_type != sunday_first_n_first_week_non_iso) ||
!strict_week_number && strict_week_number_year >= 0)
if ((strict_week_number &&
(strict_week_number_year < 0 ||
strict_week_number_year_type !=
sunday_first_n_first_week_non_iso)) ||
(!strict_week_number && strict_week_number_year >= 0))
goto err;
/* Number of days since year 0 till 1st Jan of this year */

View File

@ -1354,7 +1354,8 @@ my_xpath_lex_scan(MY_XPATH *xpath,
MY_XPATH_LEX *lex, const char *beg, const char *end)
{
int ch, ctype, length;
for ( ; beg < end && *beg == ' ' ; beg++); // skip leading spaces
for ( ; beg < end && *beg == ' ' ; beg++) // skip leading spaces
;
lex->beg= beg;
if (beg >= end)
@ -1423,7 +1424,8 @@ my_xpath_lex_scan(MY_XPATH *xpath,
if (my_xdigit(ch)) // a sequence of digits
{
for ( ; beg < end && my_xdigit(*beg) ; beg++);
for ( ; beg < end && my_xdigit(*beg) ; beg++)
;
lex->end= beg;
lex->term= MY_XPATH_LEX_DIGITS;
return;
@ -1431,7 +1433,8 @@ my_xpath_lex_scan(MY_XPATH *xpath,
if (ch == '"' || ch == '\'') // a string: either '...' or "..."
{
for ( ; beg < end && *beg != ch ; beg++);
for ( ; beg < end && *beg != ch ; beg++)
;
if (beg < end)
{
lex->end= beg+1;

View File

@ -1546,11 +1546,11 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all)
YESNO(thd->transaction.stmt.modified_non_trans_table)));
if (thd->options & OPTION_BIN_LOG)
{
if (in_transaction &&
(all ||
(!trx_data->at_least_one_stmt &&
thd->transaction.stmt.modified_non_trans_table)) ||
!in_transaction && !all)
if ((in_transaction &&
(all ||
(!trx_data->at_least_one_stmt &&
thd->transaction.stmt.modified_non_trans_table))) ||
(!in_transaction && !all))
{
Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE);
qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
@ -1596,8 +1596,8 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
YESNO(all),
YESNO(thd->transaction.all.modified_non_trans_table),
YESNO(thd->transaction.stmt.modified_non_trans_table)));
if (all && thd->transaction.all.modified_non_trans_table ||
!all && thd->transaction.stmt.modified_non_trans_table ||
if ((all && thd->transaction.all.modified_non_trans_table) ||
(!all && thd->transaction.stmt.modified_non_trans_table) ||
(thd->options & OPTION_KEEP_LOG))
{
/*
@ -1612,8 +1612,8 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
error= binlog_end_trans(thd, trx_data, &qev, all);
}
else if (all && !thd->transaction.all.modified_non_trans_table ||
!all && !thd->transaction.stmt.modified_non_trans_table)
else if ((all && !thd->transaction.all.modified_non_trans_table) ||
(!all && !thd->transaction.stmt.modified_non_trans_table))
{
/*
If we have modified only transactional tables, we can truncate

View File

@ -725,13 +725,12 @@ Log_event::do_shall_skip(Relay_log_info *rli)
(ulong) server_id, (ulong) ::server_id,
rli->replicate_same_server_id,
rli->slave_skip_counter));
if (server_id == ::server_id && !rli->replicate_same_server_id ||
rli->slave_skip_counter == 1 && rli->is_in_group())
if ((server_id == ::server_id && !rli->replicate_same_server_id) ||
(rli->slave_skip_counter == 1 && rli->is_in_group()))
return EVENT_SKIP_IGNORE;
else if (rli->slave_skip_counter > 0)
if (rli->slave_skip_counter > 0)
return EVENT_SKIP_COUNT;
else
return EVENT_SKIP_NOT;
return EVENT_SKIP_NOT;
}
@ -6758,8 +6757,8 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
solution, to be able to terminate a started statement in the
binary log: the extraneous events will be removed in the future.
*/
DBUG_ASSERT(tbl_arg && tbl_arg->s && tid != ~0UL ||
!tbl_arg && !cols && tid == ~0UL);
DBUG_ASSERT((tbl_arg && tbl_arg->s && tid != ~0UL) ||
(!tbl_arg && !cols && tid == ~0UL));
if (thd_arg->options & OPTION_NO_FOREIGN_KEY_CHECKS)
set_flags(NO_FOREIGN_KEY_CHECKS_F);
@ -6951,7 +6950,7 @@ int Rows_log_event::do_add_row_data(uchar *row_data, size_t length)
#endif
DBUG_ASSERT(m_rows_buf <= m_rows_cur);
DBUG_ASSERT(!m_rows_buf || m_rows_end && m_rows_buf < m_rows_end);
DBUG_ASSERT(!m_rows_buf || (m_rows_end && m_rows_buf < m_rows_end));
DBUG_ASSERT(m_rows_cur <= m_rows_end);
/* The cast will always work since m_rows_cur <= m_rows_end */

View File

@ -1245,8 +1245,8 @@ Old_rows_log_event::Old_rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
solution, to be able to terminate a started statement in the
binary log: the extraneous events will be removed in the future.
*/
DBUG_ASSERT(tbl_arg && tbl_arg->s && tid != ~0UL ||
!tbl_arg && !cols && tid == ~0UL);
DBUG_ASSERT((tbl_arg && tbl_arg->s && tid != ~0UL) ||
(!tbl_arg && !cols && tid == ~0UL));
if (thd_arg->options & OPTION_NO_FOREIGN_KEY_CHECKS)
set_flags(NO_FOREIGN_KEY_CHECKS_F);
@ -1409,7 +1409,7 @@ int Old_rows_log_event::do_add_row_data(uchar *row_data, size_t length)
#endif
DBUG_ASSERT(m_rows_buf <= m_rows_cur);
DBUG_ASSERT(!m_rows_buf || m_rows_end && m_rows_buf < m_rows_end);
DBUG_ASSERT(!m_rows_buf || (m_rows_end && m_rows_buf < m_rows_end));
DBUG_ASSERT(m_rows_cur <= m_rows_end);
/* The cast will always work since m_rows_cur <= m_rows_end */

View File

@ -3754,8 +3754,9 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
DBUG_PRINT("info", ("index_merge scans cost %g", imerge_cost));
if (imerge_too_expensive || (imerge_cost > read_time) ||
(non_cpk_scan_records+cpk_scan_records >= param->table->file->stats.records) &&
read_time != DBL_MAX)
((non_cpk_scan_records+cpk_scan_records >=
param->table->file->stats.records) &&
read_time != DBL_MAX))
{
/*
Bail out if it is obvious that both index_merge and ROR-union will be
@ -7927,7 +7928,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
goto err;
quick->records= records;
if (cp_buffer_from_ref(thd, table, ref) && thd->is_fatal_error ||
if ((cp_buffer_from_ref(thd, table, ref) && thd->is_fatal_error) ||
!(range= new(alloc) QUICK_RANGE()))
goto err; // out of memory
@ -8803,7 +8804,7 @@ int QUICK_RANGE_SELECT::cmp_prev(QUICK_RANGE *range_arg)
cmp= key_cmp(key_part_info, range_arg->min_key,
range_arg->min_length);
if (cmp > 0 || cmp == 0 && !(range_arg->flag & NEAR_MIN))
if (cmp > 0 || (cmp == 0 && !(range_arg->flag & NEAR_MIN)))
return 0;
return 1; // outside of range
}
@ -10856,7 +10857,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min_in_range()
/* Compare the found key with max_key. */
int cmp_res= key_cmp(index_info->key_part, max_key,
real_prefix_len + min_max_arg_len);
if (!((cur_range->flag & NEAR_MAX) && (cmp_res == -1) ||
if (!(((cur_range->flag & NEAR_MAX) && (cmp_res == -1)) ||
(cmp_res <= 0)))
{
result= HA_ERR_KEY_NOT_FOUND;
@ -10974,7 +10975,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range()
/* Compare the found key with min_key. */
int cmp_res= key_cmp(index_info->key_part, min_key,
real_prefix_len + min_max_arg_len);
if (!((cur_range->flag & NEAR_MIN) && (cmp_res == 1) ||
if (!(((cur_range->flag & NEAR_MIN) && (cmp_res == 1)) ||
(cmp_res >= 0)))
continue;
}

View File

@ -744,8 +744,8 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
}
else if (eq_type)
{
if (!is_null && !cond->val_int() ||
is_null && !test(part->field->is_null()))
if ((!is_null && !cond->val_int()) ||
(is_null && !test(part->field->is_null())))
return 0; // Impossible test
}
else if (is_field_part)

View File

@ -3263,7 +3263,8 @@ int set_var_init()
uint count= 0;
DBUG_ENTER("set_var_init");
for (sys_var *var=vars.first; var; var= var->next, count++);
for (sys_var *var=vars.first; var; var= var->next, count++)
;
if (hash_init(&system_variable_hash, system_charset_info, count, 0,
0, (hash_get_key) get_sys_var_length, 0, HASH_UNIQUE))
@ -4000,10 +4001,10 @@ bool sys_var_opt_readonly::update(THD *thd, set_var *var)
can cause to wait on a read lock, it's required for the client application
to unlock everything, and acceptable for the server to wait on all locks.
*/
if (result= close_cached_tables(thd, NULL, FALSE, TRUE, TRUE))
if ((result= close_cached_tables(thd, NULL, FALSE, TRUE, TRUE)))
goto end_with_read_lock;
if (result= make_global_read_lock_block_commit(thd))
if ((result= make_global_read_lock_block_commit(thd)))
goto end_with_read_lock;
/* Change the opt_readonly system variable, safe because the lock is held */

View File

@ -773,7 +773,8 @@ int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
up to and including newline.
*/
int c;
while (((c=my_b_get(f)) != '\n' && c != my_b_EOF));
while (((c=my_b_get(f)) != '\n' && c != my_b_EOF))
;
}
DBUG_RETURN(0);
}
@ -2187,7 +2188,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli)
"the slave_transaction_retries variable.",
slave_trans_retries);
}
else if (exec_res && !temp_err ||
else if ((exec_res && !temp_err) ||
(opt_using_transactions &&
rli->group_relay_log_pos == rli->event_relay_log_pos))
{

View File

@ -116,12 +116,12 @@ struct MBR
int touches(const MBR *mbr)
{
/* The following should be safe, even if we compare doubles */
return ((((mbr->xmin == xmax) || (mbr->xmax == xmin)) &&
((mbr->ymin >= ymin) && (mbr->ymin <= ymax) ||
(mbr->ymax >= ymin) && (mbr->ymax <= ymax))) ||
return ((((mbr->xmin == xmax) || (mbr->xmax == xmin)) &&
(((mbr->ymin >= ymin) && (mbr->ymin <= ymax)) ||
((mbr->ymax >= ymin) && (mbr->ymax <= ymax)))) ||
(((mbr->ymin == ymax) || (mbr->ymax == ymin)) &&
((mbr->xmin >= xmin) && (mbr->xmin <= xmax) ||
(mbr->xmax >= xmin) && (mbr->xmax <= xmax))));
(((mbr->xmin >= xmin) && (mbr->xmin <= xmax)) ||
((mbr->xmax >= xmin) && (mbr->xmax <= xmax)))));
}
int within(const MBR *mbr)

View File

@ -1185,12 +1185,12 @@ static void acl_update_user(const char *user, const char *host,
for (uint i=0 ; i < acl_users.elements ; i++)
{
ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*);
if (!acl_user->user && !user[0] ||
acl_user->user && !strcmp(user,acl_user->user))
if ((!acl_user->user && !user[0]) ||
(acl_user->user && !strcmp(user,acl_user->user)))
{
if (!acl_user->host.hostname && !host[0] ||
acl_user->host.hostname &&
!my_strcasecmp(system_charset_info, host, acl_user->host.hostname))
if ((!acl_user->host.hostname && !host[0]) ||
(acl_user->host.hostname &&
!my_strcasecmp(system_charset_info, host, acl_user->host.hostname)))
{
acl_user->access=privileges;
if (mqh->specified_limits & USER_RESOURCES::QUERIES_PER_HOUR)
@ -1268,16 +1268,15 @@ static void acl_update_db(const char *user, const char *host, const char *db,
for (uint i=0 ; i < acl_dbs.elements ; i++)
{
ACL_DB *acl_db=dynamic_element(&acl_dbs,i,ACL_DB*);
if (!acl_db->user && !user[0] ||
acl_db->user &&
!strcmp(user,acl_db->user))
if ((!acl_db->user && !user[0]) ||
(acl_db->user && !strcmp(user,acl_db->user)))
{
if (!acl_db->host.hostname && !host[0] ||
acl_db->host.hostname &&
!strcmp(host, acl_db->host.hostname))
if ((!acl_db->host.hostname && !host[0]) ||
(acl_db->host.hostname &&
!strcmp(host, acl_db->host.hostname)))
{
if (!acl_db->db && !db[0] ||
acl_db->db && !strcmp(db,acl_db->db))
if ((!acl_db->db && !db[0]) ||
(acl_db->db && !strcmp(db,acl_db->db)))
{
if (privileges)
acl_db->access=privileges;
@ -1486,8 +1485,8 @@ bool acl_check_host(const char *host, const char *ip)
return 0;
VOID(pthread_mutex_lock(&acl_cache->lock));
if (host && hash_search(&acl_check_hosts,(uchar*) host,strlen(host)) ||
ip && hash_search(&acl_check_hosts,(uchar*) ip, strlen(ip)))
if ((host && hash_search(&acl_check_hosts,(uchar*) host,strlen(host))) ||
(ip && hash_search(&acl_check_hosts,(uchar*) ip, strlen(ip))))
{
VOID(pthread_mutex_unlock(&acl_cache->lock));
return 0; // Found host
@ -1703,8 +1702,8 @@ find_acl_user(const char *host, const char *user, my_bool exact)
host,
acl_user->host.hostname ? acl_user->host.hostname :
""));
if (!acl_user->user && !user[0] ||
acl_user->user && !strcmp(user,acl_user->user))
if ((!acl_user->user && !user[0]) ||
(acl_user->user && !strcmp(user,acl_user->user)))
{
if (exact ? !my_strcasecmp(system_charset_info, host,
acl_user->host.hostname ?

View File

@ -246,7 +246,8 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
}
DBUG_RETURN(0);
}
for (str++; *(end - 1) == '0'; end--); // jump over zeros at the end
for (str++; *(end - 1) == '0'; end--) // jump over zeros at the end
;
if (str == end) // number was something like '123.000'
{
char *endpos= (char*) str;

View File

@ -473,8 +473,8 @@ static TABLE_SHARE
@todo Rework alternative ways to deal with ER_NO_SUCH TABLE.
*/
if (share || thd->is_error() && thd->main_da.sql_errno() != ER_NO_SUCH_TABLE)
if (share ||
(thd->is_error() && thd->main_da.sql_errno() != ER_NO_SUCH_TABLE))
DBUG_RETURN(share);
/* Table didn't exist. Check if some engine can provide it */
@ -2625,8 +2625,8 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
distance > 0 - we have lock mode higher then we require
distance == 0 - we have lock mode exactly which we need
*/
if (best_distance < 0 && distance > best_distance ||
distance >= 0 && distance < best_distance)
if ((best_distance < 0 && distance > best_distance) ||
(distance >= 0 && distance < best_distance))
{
best_distance= distance;
best_table= table;
@ -7409,7 +7409,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
thd->lex->current_select->cur_pos_in_select_list= 0;
while ((item= it++))
{
if (!item->fixed && item->fix_fields(thd, it.ref()) ||
if ((!item->fixed && item->fix_fields(thd, it.ref())) ||
(item= *(it.ref()))->check_cols(1))
{
thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup;
@ -7723,8 +7723,8 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
DBUG_ASSERT(tables->is_leaf_for_name_resolution());
if (table_name && my_strcasecmp(table_alias_charset, table_name,
tables->alias) ||
if ((table_name && my_strcasecmp(table_alias_charset, table_name,
tables->alias)) ||
(db_name && strcmp(tables->db,db_name)))
continue;
@ -7755,8 +7755,8 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
information_schema table, or a nested table reference. See the comment
for TABLE_LIST.
*/
if (!(table && !tables->view && (table->grant.privilege & SELECT_ACL) ||
tables->view && (tables->grant.privilege & SELECT_ACL)) &&
if (!((table && !tables->view && (table->grant.privilege & SELECT_ACL)) ||
(tables->view && (tables->grant.privilege & SELECT_ACL))) &&
!any_privileges)
{
field_iterator.set(tables);
@ -7810,7 +7810,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
*/
if (any_privileges)
{
DBUG_ASSERT(tables->field_translation == NULL && table ||
DBUG_ASSERT((tables->field_translation == NULL && table) ||
tables->is_natural_join);
DBUG_ASSERT(item->type() == Item::FIELD_ITEM);
Item_field *fld= (Item_field*) item;
@ -7949,7 +7949,7 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
if (*conds)
{
thd->where="where clause";
if (!(*conds)->fixed && (*conds)->fix_fields(thd, conds) ||
if ((!(*conds)->fixed && (*conds)->fix_fields(thd, conds)) ||
(*conds)->check_cols(1))
goto err_no_arena;
}
@ -7969,8 +7969,8 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
{
/* Make a join an a expression */
thd->where="on clause";
if (!embedded->on_expr->fixed &&
embedded->on_expr->fix_fields(thd, &embedded->on_expr) ||
if ((!embedded->on_expr->fixed &&
embedded->on_expr->fix_fields(thd, &embedded->on_expr)) ||
embedded->on_expr->check_cols(1))
goto err_no_arena;
select_lex->cond_count++;
@ -8125,8 +8125,8 @@ fill_record_n_invoke_before_triggers(THD *thd, List<Item> &fields,
enum trg_event_type event)
{
return (fill_record(thd, fields, values, ignore_errors) ||
triggers && triggers->process_triggers(thd, event,
TRG_ACTION_BEFORE, TRUE));
(triggers && triggers->process_triggers(thd, event,
TRG_ACTION_BEFORE, TRUE)));
}
@ -8220,8 +8220,8 @@ fill_record_n_invoke_before_triggers(THD *thd, Field **ptr,
enum trg_event_type event)
{
return (fill_record(thd, ptr, values, ignore_errors) ||
triggers && triggers->process_triggers(thd, event,
TRG_ACTION_BEFORE, TRUE));
(triggers && triggers->process_triggers(thd, event,
TRG_ACTION_BEFORE, TRUE)));
}

View File

@ -985,7 +985,7 @@ static void end_connection(THD *thd)
if (thd->user_connect)
decrease_user_connections(thd->user_connect);
if (thd->killed || net->error && net->vio != 0)
if (thd->killed || (net->error && net->vio != 0))
{
statistic_increment(aborted_threads,&LOCK_status);
}

View File

@ -1444,13 +1444,9 @@ static inline bool
cmp_db_names(const char *db1_name,
const char *db2_name)
{
return
/* db1 is NULL and db2 is NULL */
!db1_name && !db2_name ||
/* db1 is not-NULL, db2 is not-NULL, db1 == db2. */
db1_name && db2_name &&
my_strcasecmp(system_charset_info, db1_name, db2_name) == 0;
return ((!db1_name && !db2_name) || /* db1 is NULL and db2 is NULL */
(db1_name && db2_name &&
my_strcasecmp(system_charset_info, db1_name, db2_name) == 0));
}

View File

@ -760,7 +760,7 @@ void multi_delete::abort()
/* the error was handled or nothing deleted and no side effects return */
if (error_handled ||
!thd->transaction.stmt.modified_non_trans_table && !deleted)
(!thd->transaction.stmt.modified_non_trans_table && !deleted))
DBUG_VOID_RETURN;
/* Something already deleted so we have to invalidate cache */

View File

@ -526,7 +526,8 @@ int send_variant_2_list(MEM_ROOT *mem_root, Protocol *protocol,
String **end= pointers + names->elements;
List_iterator<String> it(*names);
for (pos= pointers; pos!=end; (*pos++= it++));
for (pos= pointers; pos!=end; (*pos++= it++))
;
my_qsort(pointers,names->elements,sizeof(String*),string_ptr_cmp);

View File

@ -413,7 +413,7 @@ void upgrade_lock_type_for_insert(THD *thd, thr_lock_type *lock_type,
bool is_multi_insert)
{
if (duplic == DUP_UPDATE ||
duplic == DUP_REPLACE && *lock_type == TL_WRITE_CONCURRENT_INSERT)
(duplic == DUP_REPLACE && *lock_type == TL_WRITE_CONCURRENT_INSERT))
{
*lock_type= TL_WRITE_DEFAULT;
return;
@ -882,8 +882,9 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
*/
query_cache_invalidate3(thd, table_list, 1);
}
if (changed && error <= 0 || thd->transaction.stmt.modified_non_trans_table
|| was_insert_delayed)
if ((changed && error <= 0) ||
thd->transaction.stmt.modified_non_trans_table ||
was_insert_delayed)
{
if (mysql_bin_log.is_open())
{
@ -3187,7 +3188,7 @@ bool select_insert::send_eof()
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
if (changed= (info.copied || info.deleted || info.updated))
if ((changed= (info.copied || info.deleted || info.updated)))
{
/*
We must invalidate the table in the query cache before binlog writing

View File

@ -801,7 +801,8 @@ int MYSQLlex(void *arg, void *yythd)
its value in a query for the binlog, the query must stay
grammatically correct.
*/
if (c == '?' && lip->stmt_prepare_mode && !ident_map[lip->yyPeek()])
if (c == '?' && lip->stmt_prepare_mode &&
!ident_map[(uchar) lip->yyPeek()])
return(PARAM_MARKER);
}
@ -869,7 +870,10 @@ int MYSQLlex(void *arg, void *yythd)
else
#endif
{
for (result_state= c; ident_map[c= lip->yyGet()]; result_state|= c);
for (result_state= c;
ident_map[(uchar) (c= lip->yyGet())];
result_state|= c)
;
/* If there were non-ASCII characters, mark that we must convert */
result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT;
}
@ -881,9 +885,11 @@ int MYSQLlex(void *arg, void *yythd)
If we find a space then this can't be an identifier. We notice this
below by checking start != lex->ptr.
*/
for (; state_map[c] == MY_LEX_SKIP ; c= lip->yyGet());
for (; state_map[(uchar) c] == MY_LEX_SKIP ; c= lip->yyGet())
;
}
if (start == lip->get_ptr() && c == '.' && ident_map[lip->yyPeek()])
if (start == lip->get_ptr() && c == '.' &&
ident_map[(uchar) lip->yyPeek()])
lip->next_state=MY_LEX_IDENT_SEP;
else
{ // '(' must follow directly if function
@ -926,12 +932,12 @@ int MYSQLlex(void *arg, void *yythd)
return(result_state); // IDENT or IDENT_QUOTED
case MY_LEX_IDENT_SEP: // Found ident and now '.'
case MY_LEX_IDENT_SEP: // Found ident and now '.'
yylval->lex_str.str= (char*) lip->get_ptr();
yylval->lex_str.length= 1;
c= lip->yyGet(); // should be '.'
lip->next_state= MY_LEX_IDENT_START;// Next is an ident (not a keyword)
if (!ident_map[lip->yyPeek()]) // Probably ` or "
c= lip->yyGet(); // should be '.'
lip->next_state= MY_LEX_IDENT_START; // Next is ident (not keyword)
if (!ident_map[(uchar) lip->yyPeek()]) // Probably ` or "
lip->next_state= MY_LEX_START;
return((int) c);
@ -954,7 +960,8 @@ int MYSQLlex(void *arg, void *yythd)
}
else if (c == 'b')
{
while ((c= lip->yyGet()) == '0' || c == '1');
while ((c= lip->yyGet()) == '0' || c == '1')
;
if ((lip->yyLength() >= 3) && !ident_map[c])
{
/* Skip '0b' */
@ -1013,11 +1020,12 @@ int MYSQLlex(void *arg, void *yythd)
else
#endif
{
for (result_state=0; ident_map[c= lip->yyGet()]; result_state|= c);
for (result_state=0; ident_map[c= lip->yyGet()]; result_state|= c)
;
/* If there were non-ASCII characters, mark that we must convert */
result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT;
}
if (c == '.' && ident_map[lip->yyPeek()])
if (c == '.' && ident_map[(uchar) lip->yyPeek()])
lip->next_state=MY_LEX_IDENT_SEP;// Next is '.'
yylval->lex_str= get_token(lip, 0, lip->yyLength());
@ -1113,7 +1121,8 @@ int MYSQLlex(void *arg, void *yythd)
case MY_LEX_BIN_NUMBER: // Found b'bin-string'
lip->yySkip(); // Accept opening '
while ((c= lip->yyGet()) == '0' || c == '1');
while ((c= lip->yyGet()) == '0' || c == '1')
;
if (c != '\'')
return(ABORT_SYM); // Illegal hex constant
lip->yySkip(); // Accept closing '
@ -1124,8 +1133,8 @@ int MYSQLlex(void *arg, void *yythd)
return (BIN_NUM);
case MY_LEX_CMP_OP: // Incomplete comparison operator
if (state_map[lip->yyPeek()] == MY_LEX_CMP_OP ||
state_map[lip->yyPeek()] == MY_LEX_LONG_CMP_OP)
if (state_map[(uchar) lip->yyPeek()] == MY_LEX_CMP_OP ||
state_map[(uchar) lip->yyPeek()] == MY_LEX_LONG_CMP_OP)
lip->yySkip();
if ((tokval = find_keyword(lip, lip->yyLength() + 1, 0)))
{
@ -1136,11 +1145,11 @@ int MYSQLlex(void *arg, void *yythd)
break;
case MY_LEX_LONG_CMP_OP: // Incomplete comparison operator
if (state_map[lip->yyPeek()] == MY_LEX_CMP_OP ||
state_map[lip->yyPeek()] == MY_LEX_LONG_CMP_OP)
if (state_map[(uchar) lip->yyPeek()] == MY_LEX_CMP_OP ||
state_map[(uchar) lip->yyPeek()] == MY_LEX_LONG_CMP_OP)
{
lip->yySkip();
if (state_map[lip->yyPeek()] == MY_LEX_CMP_OP)
if (state_map[(uchar) lip->yyPeek()] == MY_LEX_CMP_OP)
lip->yySkip();
}
if ((tokval = find_keyword(lip, lip->yyLength() + 1, 0)))
@ -1351,7 +1360,7 @@ int MYSQLlex(void *arg, void *yythd)
}
break;
case MY_LEX_USER_END: // end '@' of user@hostname
switch (state_map[lip->yyPeek()]) {
switch (state_map[(uchar) lip->yyPeek()]) {
case MY_LEX_STRING:
case MY_LEX_USER_VARIABLE_DELIMITER:
case MY_LEX_STRING_OR_DELIMITER:
@ -1376,7 +1385,7 @@ int MYSQLlex(void *arg, void *yythd)
yylval->lex_str.str=(char*) lip->get_ptr();
yylval->lex_str.length=1;
lip->yySkip(); // Skip '@'
lip->next_state= (state_map[lip->yyPeek()] ==
lip->next_state= (state_map[(uchar) lip->yyPeek()] ==
MY_LEX_USER_VARIABLE_DELIMITER ?
MY_LEX_OPERATOR_OR_IDENT :
MY_LEX_IDENT_OR_KEYWORD);
@ -1388,7 +1397,8 @@ int MYSQLlex(void *arg, void *yythd)
[(global | local | session) .]variable_name
*/
for (result_state= 0; ident_map[c= lip->yyGet()]; result_state|= c);
for (result_state= 0; ident_map[c= lip->yyGet()]; result_state|= c)
;
/* If there were non-ASCII characters, mark that we must convert */
result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT;
@ -2002,7 +2012,7 @@ void st_select_lex::print_limit(THD *thd,
item->substype() == Item_subselect::ALL_SUBS))
{
DBUG_ASSERT(!item->fixed ||
select_limit->val_int() == LL(1) && offset_limit == 0);
(select_limit->val_int() == LL(1) && offset_limit == 0));
return;
}

View File

@ -719,12 +719,11 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
real_item= item->real_item();
if (!read_info.enclosed &&
(enclosed_length && length == 4 &&
!memcmp(pos, STRING_WITH_LEN("NULL"))) ||
if ((!read_info.enclosed &&
(enclosed_length && length == 4 &&
!memcmp(pos, STRING_WITH_LEN("NULL")))) ||
(length == 1 && read_info.found_null))
{
if (real_item->type() == Item::FIELD_ITEM)
{
Field *field= ((Item_field *)real_item)->field;
@ -1120,9 +1119,10 @@ int READ_INFO::read_field()
}
// End of enclosed field if followed by field_term or line_term
if (chr == my_b_EOF ||
chr == line_term_char && terminator(line_term_ptr,
line_term_length))
{ // Maybe unexpected linefeed
(chr == line_term_char && terminator(line_term_ptr,
line_term_length)))
{
/* Maybe unexpected linefeed */
enclosed=1;
found_end_of_line=1;
row_start=buffer+1;

View File

@ -5069,7 +5069,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
if (schema_db)
{
if (!(sctx->master_access & FILE_ACL) && (want_access & FILE_ACL) ||
if ((!(sctx->master_access & FILE_ACL) && (want_access & FILE_ACL)) ||
(want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL)))
{
if (!no_errors)
@ -5103,7 +5103,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
DBUG_RETURN(FALSE);
}
if (((want_access & ~sctx->master_access) & ~(DB_ACLS | EXTRA_ACL)) ||
! db && dont_check_global_grants)
(! db && dont_check_global_grants))
{ // We can never grant this
DBUG_PRINT("error",("No possible access"));
if (!no_errors)
@ -7670,7 +7670,7 @@ bool parse_sql(THD *thd,
/* Check that if MYSQLparse() failed, thd->is_error() is set. */
DBUG_ASSERT(!mysql_parse_status ||
mysql_parse_status && thd->is_error());
(mysql_parse_status && thd->is_error()));
/* Reset parser state. */

View File

@ -7013,9 +7013,9 @@ static uint32 get_next_partition_via_walking(PARTITION_ITERATOR *part_iter)
longlong dummy;
field->store(part_iter->field_vals.cur++,
((Field_num*)field)->unsigned_flag);
if (part_iter->part_info->is_sub_partitioned() &&
!part_iter->part_info->get_part_partition_id(part_iter->part_info,
&part_id, &dummy) ||
if ((part_iter->part_info->is_sub_partitioned() &&
!part_iter->part_info->get_part_partition_id(part_iter->part_info,
&part_id, &dummy)) ||
!part_iter->part_info->get_partition_id(part_iter->part_info,
&part_id, &dummy))
return part_id;

View File

@ -3004,7 +3004,7 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
if (!opt->update)
{
opt->update= update_func_str;
if (!(opt->flags & PLUGIN_VAR_MEMALLOC | PLUGIN_VAR_READONLY))
if (!(opt->flags & (PLUGIN_VAR_MEMALLOC | PLUGIN_VAR_READONLY)))
{
opt->flags|= PLUGIN_VAR_READONLY;
sql_print_warning("Server variable %s of plugin %s was forced "
@ -3109,7 +3109,8 @@ static my_option *construct_help_options(MEM_ROOT *mem_root,
uint count= EXTRA_OPTIONS;
DBUG_ENTER("construct_help_options");
for (opt= p->plugin->system_vars; opt && *opt; opt++, count+= 2);
for (opt= p->plugin->system_vars; opt && *opt; opt++, count+= 2)
;
if (!(opts= (my_option*) alloc_root(mem_root, sizeof(my_option) * count)))
DBUG_RETURN(NULL);

View File

@ -1436,7 +1436,8 @@ static bool mysql_test_set_fields(Prepared_statement *stmt,
THD *thd= stmt->thd;
set_var_base *var;
if (tables && check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE) ||
if ((tables &&
check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE)) ||
open_normal_and_derived_tables(thd, tables, 0))
goto error;
@ -1472,13 +1473,14 @@ static bool mysql_test_call_fields(Prepared_statement *stmt,
THD *thd= stmt->thd;
Item *item;
if (tables && check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE) ||
if ((tables &&
check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE)) ||
open_normal_and_derived_tables(thd, tables, 0))
goto err;
while ((item= it++))
{
if (!item->fixed && item->fix_fields(thd, it.ref()) ||
if ((!item->fixed && item->fix_fields(thd, it.ref())) ||
item->check_cols(1))
goto err;
}
@ -2844,7 +2846,7 @@ void Prepared_statement::setup_set_params()
Decide if we have to expand the query (because we must write it to logs or
because we want to look it up in the query cache) or not.
*/
if (mysql_bin_log.is_open() && is_update_query(lex->sql_command) ||
if ((mysql_bin_log.is_open() && is_update_query(lex->sql_command)) ||
opt_log || opt_slow_log ||
query_cache_is_cacheable_query(lex))
{
@ -3295,7 +3297,7 @@ Prepared_statement::reprepare()
&cur_db_changed))
return TRUE;
error= (name.str && copy.set_name(&name) ||
error= ((name.str && copy.set_name(&name)) ||
copy.prepare(query, query_length) ||
validate_metadata(&copy));

View File

@ -1361,7 +1361,7 @@ JOIN::optimize()
join_tab[const_tables].type != JT_ALL &&
join_tab[const_tables].type != JT_FT &&
join_tab[const_tables].type != JT_REF_OR_NULL &&
(order && simple_order || group_list && simple_group))
((order && simple_order) || (group_list && simple_group)))
{
if (add_ref_to_table_cond(thd,&join_tab[const_tables])) {
DBUG_RETURN(1);
@ -1879,9 +1879,9 @@ JOIN::exec()
like SEC_TO_TIME(SUM(...)).
*/
if (curr_join->group_list && (!test_if_subpart(curr_join->group_list,
curr_join->order) ||
curr_join->select_distinct) ||
if ((curr_join->group_list && (!test_if_subpart(curr_join->group_list,
curr_join->order) ||
curr_join->select_distinct)) ||
(curr_join->select_distinct &&
curr_join->tmp_table_param.using_indirect_summary_function))
{ /* Must copy to another table */
@ -2352,9 +2352,9 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
}
else
{
if (err= join->prepare(rref_pointer_array, tables, wild_num,
conds, og_num, order, group, having, proc_param,
select_lex, unit))
if ((err= join->prepare(rref_pointer_array, tables, wild_num,
conds, og_num, order, group, having,
proc_param, select_lex, unit)))
{
goto err;
}
@ -2369,9 +2369,9 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
DBUG_RETURN(TRUE);
thd_proc_info(thd, "init");
thd->used_tables=0; // Updated by setup_fields
if (err= join->prepare(rref_pointer_array, tables, wild_num,
conds, og_num, order, group, having, proc_param,
select_lex, unit))
if ((err= join->prepare(rref_pointer_array, tables, wild_num,
conds, og_num, order, group, having, proc_param,
select_lex, unit)))
{
goto err;
}
@ -3824,7 +3824,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
if (use->key == prev->key && use->table == prev->table)
{
if (prev->keypart+1 < use->keypart ||
prev->keypart == use->keypart && found_eq_constant)
(prev->keypart == use->keypart && found_eq_constant))
continue; /* remove */
}
else if (use->keypart != 0) // First found must be 0
@ -5117,8 +5117,8 @@ best_extension_by_limited_search(JOIN *join,
{
if (best_record_count > current_record_count ||
best_read_time > current_read_time ||
idx == join->const_tables && // 's' is the first table in the QEP
s->table == join->sort_by_table)
(idx == join->const_tables && // 's' is the first table in the QEP
s->table == join->sort_by_table))
{
if (best_record_count >= current_record_count &&
best_read_time >= current_read_time &&
@ -5244,7 +5244,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
double current_read_time=read_time+best;
if (best_record_count > current_record_count ||
best_read_time > current_read_time ||
idx == join->const_tables && s->table == join->sort_by_table)
(idx == join->const_tables && s->table == join->sort_by_table))
{
if (best_record_count >= current_record_count &&
best_read_time >= current_read_time &&
@ -6197,8 +6197,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
the index if we are using limit and this is the first table
*/
if (cond &&
(!tab->keys.is_subset(tab->const_keys) && i > 0) ||
if ((cond &&
(!tab->keys.is_subset(tab->const_keys) && i > 0)) ||
(!tab->const_keys.is_clear_all() && i == join->const_tables &&
join->unit->select_limit_cnt <
join->best_positions[i].records_read &&
@ -7329,7 +7329,8 @@ static bool check_simple_equality(Item *left_item, Item *right_item,
left_item_equal->merge(right_item_equal);
/* Remove the merged multiple equality from the list */
List_iterator<Item_equal> li(cond_equal->current_level);
while ((li++) != right_item_equal);
while ((li++) != right_item_equal)
;
li.remove();
}
}
@ -10004,9 +10005,9 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
reclength=1; // Dummy select
/* Use packed rows if there is blobs or a lot of space to gain */
if (blob_count ||
string_total_length >= STRING_TOTAL_LENGTH_TO_PACK_ROWS &&
(reclength / string_total_length <= RATIO_TO_PACK_ROWS ||
string_total_length / string_count >= AVG_STRING_LENGTH_TO_PACK_ROWS))
(string_total_length >= STRING_TOTAL_LENGTH_TO_PACK_ROWS &&
(reclength / string_total_length <= RATIO_TO_PACK_ROWS ||
string_total_length / string_count >= AVG_STRING_LENGTH_TO_PACK_ROWS)))
use_packed_rows= 1;
share->reclength= reclength;
@ -13274,9 +13275,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
if (keys.is_set(nr) &&
(direction= test_if_order_by_key(order, table, nr, &used_key_parts)))
{
bool is_covering= table->covering_keys.is_set(nr) ||
nr == table->s->primary_key &&
table->file->primary_key_is_clustered();
bool is_covering= (table->covering_keys.is_set(nr) ||
(nr == table->s->primary_key &&
table->file->primary_key_is_clustered()));
/*
Don't use an index scan with ORDER BY without limit.
@ -13289,7 +13290,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
*/
if (is_covering ||
select_limit != HA_POS_ERROR ||
ref_key < 0 && (group || table->force_index))
(ref_key < 0 && (group || table->force_index)))
{
double rec_per_key;
double index_scan_time;
@ -13354,12 +13355,12 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
index_scan_time= select_limit/rec_per_key *
min(rec_per_key, table->file->scan_time());
if (is_covering ||
ref_key < 0 && (group || table->force_index) ||
(ref_key < 0 && (group || table->force_index)) ||
index_scan_time < read_time)
{
ha_rows quick_records= table_records;
if (is_best_covering && !is_covering ||
is_covering && ref_key_quick_rows < select_limit)
if ((is_best_covering && !is_covering) ||
(is_covering && ref_key_quick_rows < select_limit))
continue;
if (table->quick_keys.is_set(nr))
quick_records= table->quick_rows[nr];
@ -13567,10 +13568,11 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
*/
if ((order != join->group_list ||
!(join->select_options & SELECT_BIG_RESULT) ||
select && select->quick &&
select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX) &&
test_if_skip_sort_order(tab,order,select_limit,0,
is_order_by ? &table->keys_in_use_for_order_by :
(select && select->quick &&
select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)) &&
test_if_skip_sort_order(tab,order,select_limit, 0,
is_order_by ?
&table->keys_in_use_for_order_by :
&table->keys_in_use_for_group_by))
DBUG_RETURN(0);
for (ORDER *ord= join->order; ord; ord= ord->next)
@ -14390,8 +14392,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
/* Lookup the current GROUP field in the FROM clause. */
order_item_type= order_item->type();
from_field= (Field*) not_found_field;
if (is_group_field &&
order_item_type == Item::FIELD_ITEM ||
if ((is_group_field && order_item_type == Item::FIELD_ITEM) ||
order_item_type == Item::REF_ITEM)
{
from_field= find_field_in_tables(thd, (Item_ident*) order_item, tables,
@ -14826,7 +14827,8 @@ get_sort_by_table(ORDER *a,ORDER *b,TABLE_LIST *tables)
if (!map || (map & (RAND_TABLE_BIT | OUTER_REF_TABLE_BIT)))
DBUG_RETURN(0);
for (; !(map & tables->table->map); tables= tables->next_leaf);
for (; !(map & tables->table->map); tables= tables->next_leaf)
;
if (map != tables->table->map)
DBUG_RETURN(0); // More than one table
DBUG_PRINT("exit",("sort by table: %d",tables->table->tablenr));

View File

@ -587,7 +587,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
if (open_normal_and_derived_tables(thd, table_list, 0))
{
if (!table_list->view ||
thd->is_error() && thd->main_da.sql_errno() != ER_VIEW_INVALID)
(thd->is_error() && thd->main_da.sql_errno() != ER_VIEW_INVALID))
DBUG_RETURN(TRUE);
/*
@ -3207,10 +3207,10 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
if lookup value is empty string then
it's impossible table name or db name
*/
if (lookup_field_vals.db_value.str &&
!lookup_field_vals.db_value.str[0] ||
lookup_field_vals.table_value.str &&
!lookup_field_vals.table_value.str[0])
if ((lookup_field_vals.db_value.str &&
!lookup_field_vals.db_value.str[0]) ||
(lookup_field_vals.table_value.str &&
!lookup_field_vals.table_value.str[0]))
{
error= 0;
goto err;
@ -4037,10 +4037,10 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
TYPE_ENUM_PROCEDURE))
return 0;
if (lex->sql_command == SQLCOM_SHOW_STATUS_PROC &&
proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE ||
lex->sql_command == SQLCOM_SHOW_STATUS_FUNC &&
proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION ||
if ((lex->sql_command == SQLCOM_SHOW_STATUS_PROC &&
proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE) ||
(lex->sql_command == SQLCOM_SHOW_STATUS_FUNC &&
proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION) ||
(sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0)
{
restore_record(table, s->default_values);

View File

@ -1675,13 +1675,13 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
FN_IS_TMP : 0);
}
if (drop_temporary ||
(table_type == NULL &&
(access(path, F_OK) &&
ha_create_table_from_engine(thd, db, alias)) ||
((table_type == NULL &&
(access(path, F_OK) &&
ha_create_table_from_engine(thd, db, alias))) ||
(!drop_view &&
mysql_frm_type(thd, path, &frm_db_type) != FRMTYPE_TABLE)))
{
// Table was not found on disk and table can't be created from engine
/* Table was not found on disk and table can't be created from engine */
if (if_exists)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR),
@ -1758,7 +1758,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
if (!dont_log_query)
{
if (!thd->current_stmt_binlog_row_based ||
non_temp_tables_count > 0 && !tmp_table_deleted)
(non_temp_tables_count > 0 && !tmp_table_deleted))
{
/*
In this case, we are either using statement-based
@ -2467,8 +2467,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
}
/* Don't pack rows in old tables if the user has requested this */
if ((sql_field->flags & BLOB_FLAG) ||
sql_field->sql_type == MYSQL_TYPE_VARCHAR &&
create_info->row_type != ROW_TYPE_FIXED)
(sql_field->sql_type == MYSQL_TYPE_VARCHAR &&
create_info->row_type != ROW_TYPE_FIXED))
(*db_options)|= HA_OPTION_PACK_RECORD;
it2.rewind();
}
@ -2937,7 +2937,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->sql_type == MYSQL_TYPE_VARCHAR ||
sql_field->pack_flag & FIELDFLAG_BLOB)))
{
if (column_nr == 0 && (sql_field->pack_flag & FIELDFLAG_BLOB) ||
if ((column_nr == 0 && (sql_field->pack_flag & FIELDFLAG_BLOB)) ||
sql_field->sql_type == MYSQL_TYPE_VARCHAR)
key_info->flags|= HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY;
else
@ -5342,9 +5342,9 @@ compare_tables(TABLE *table,
/* Don't pack rows in old tables if the user has requested this. */
if (create_info->row_type == ROW_TYPE_DYNAMIC ||
(tmp_new_field->flags & BLOB_FLAG) ||
tmp_new_field->sql_type == MYSQL_TYPE_VARCHAR &&
create_info->row_type != ROW_TYPE_FIXED)
(tmp_new_field->flags & BLOB_FLAG) ||
(tmp_new_field->sql_type == MYSQL_TYPE_VARCHAR &&
create_info->row_type != ROW_TYPE_FIXED))
create_info->table_options|= HA_OPTION_PACK_RECORD;
/* Check if field was renamed */
@ -6958,12 +6958,12 @@ view_err:
}
else if (mysql_rename_table(new_db_type, new_db, tmp_name, new_db,
new_alias, FN_FROM_IS_TMP) ||
(new_name != table_name || new_db != db) && // we also do rename
(need_copy_table != ALTER_TABLE_METADATA_ONLY ||
mysql_rename_table(save_old_db_type, db, table_name, new_db,
new_alias, NO_FRM_RENAME)) &&
Table_triggers_list::change_table_name(thd, db, table_name,
new_db, new_alias))
((new_name != table_name || new_db != db) && // we also do rename
(need_copy_table != ALTER_TABLE_METADATA_ONLY ||
mysql_rename_table(save_old_db_type, db, table_name, new_db,
new_alias, NO_FRM_RENAME)) &&
Table_triggers_list::change_table_name(thd, db, table_name,
new_db, new_alias)))
{
/* Try to get everything back. */
error=1;

View File

@ -344,7 +344,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
need second part of condition below, since check_access() function also
checks that db is specified.
*/
if (!thd->lex->spname->m_db.length || create && !tables->db_length)
if (!thd->lex->spname->m_db.length || (create && !tables->db_length))
{
my_error(ER_NO_DB_ERROR, MYF(0));
DBUG_RETURN(TRUE);

View File

@ -1773,7 +1773,7 @@ void multi_update::abort()
{
/* the error was handled or nothing deleted and no side effects return */
if (error_handled ||
!thd->transaction.stmt.modified_non_trans_table && !updated)
(!thd->transaction.stmt.modified_non_trans_table && !updated))
return;
/* Something already updated so we have to invalidate cache */

View File

@ -5922,7 +5922,7 @@ alter_list_item:
MYSQL_YYABORT;
}
if (check_table_name($3->table.str,$3->table.length) ||
$3->db.str && check_db_name(&$3->db))
($3->db.str && check_db_name(&$3->db)))
{
my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str);
MYSQL_YYABORT;
@ -6076,8 +6076,8 @@ slave_until:
| UNTIL_SYM slave_until_opts
{
LEX *lex=Lex;
if ((lex->mi.log_file_name || lex->mi.pos) &&
(lex->mi.relay_log_name || lex->mi.relay_log_pos) ||
if (((lex->mi.log_file_name || lex->mi.pos) &&
(lex->mi.relay_log_name || lex->mi.relay_log_pos)) ||
!((lex->mi.log_file_name && lex->mi.pos) ||
(lex->mi.relay_log_name && lex->mi.relay_log_pos)))
{

View File

@ -453,33 +453,34 @@ inline bool is_system_table_name(const char *name, uint length)
return (
/* mysql.proc table */
length == 4 &&
my_tolower(ci, name[0]) == 'p' &&
my_tolower(ci, name[1]) == 'r' &&
my_tolower(ci, name[2]) == 'o' &&
my_tolower(ci, name[3]) == 'c' ||
(length == 4 &&
my_tolower(ci, name[0]) == 'p' &&
my_tolower(ci, name[1]) == 'r' &&
my_tolower(ci, name[2]) == 'o' &&
my_tolower(ci, name[3]) == 'c') ||
length > 4 &&
(
/* one of mysql.help* tables */
my_tolower(ci, name[0]) == 'h' &&
my_tolower(ci, name[1]) == 'e' &&
my_tolower(ci, name[2]) == 'l' &&
my_tolower(ci, name[3]) == 'p' ||
(length > 4 &&
(
/* one of mysql.help* tables */
(my_tolower(ci, name[0]) == 'h' &&
my_tolower(ci, name[1]) == 'e' &&
my_tolower(ci, name[2]) == 'l' &&
my_tolower(ci, name[3]) == 'p') ||
/* one of mysql.time_zone* tables */
my_tolower(ci, name[0]) == 't' &&
my_tolower(ci, name[1]) == 'i' &&
my_tolower(ci, name[2]) == 'm' &&
my_tolower(ci, name[3]) == 'e' ||
/* one of mysql.time_zone* tables */
(my_tolower(ci, name[0]) == 't' &&
my_tolower(ci, name[1]) == 'i' &&
my_tolower(ci, name[2]) == 'm' &&
my_tolower(ci, name[3]) == 'e') ||
/* mysql.event table */
my_tolower(ci, name[0]) == 'e' &&
my_tolower(ci, name[1]) == 'v' &&
my_tolower(ci, name[2]) == 'e' &&
my_tolower(ci, name[3]) == 'n' &&
my_tolower(ci, name[4]) == 't'
)
/* mysql.event table */
(my_tolower(ci, name[0]) == 'e' &&
my_tolower(ci, name[1]) == 'v' &&
my_tolower(ci, name[2]) == 'e' &&
my_tolower(ci, name[3]) == 'n' &&
my_tolower(ci, name[4]) == 't')
)
)
);
}
@ -3314,8 +3315,8 @@ bool TABLE_LIST::prep_check_option(THD *thd, uint8 check_opt_type)
{
const char *save_where= thd->where;
thd->where= "check option";
if (!check_option->fixed &&
check_option->fix_fields(thd, &check_option) ||
if ((!check_option->fixed &&
check_option->fix_fields(thd, &check_option)) ||
check_option->check_cols(1))
{
DBUG_RETURN(TRUE);
@ -4030,16 +4031,16 @@ void Field_iterator_table_ref::set_field_iterator()
/* Necesary, but insufficient conditions. */
DBUG_ASSERT(table_ref->is_natural_join ||
table_ref->nested_join ||
table_ref->join_columns &&
/* This is a merge view. */
((table_ref->field_translation &&
table_ref->join_columns->elements ==
(ulong)(table_ref->field_translation_end -
table_ref->field_translation)) ||
/* This is stored table or a tmptable view. */
(!table_ref->field_translation &&
table_ref->join_columns->elements ==
table_ref->table->s->fields)));
(table_ref->join_columns &&
/* This is a merge view. */
((table_ref->field_translation &&
table_ref->join_columns->elements ==
(ulong)(table_ref->field_translation_end -
table_ref->field_translation)) ||
/* This is stored table or a tmptable view. */
(!table_ref->field_translation &&
table_ref->join_columns->elements ==
table_ref->table->s->fields))));
field_it= &natural_join_it;
DBUG_PRINT("info",("field_it for '%s' is Field_iterator_natural_join",
table_ref->alias));

View File

@ -1363,8 +1363,8 @@ struct TABLE_LIST
void cleanup_items();
bool placeholder()
{
return derived || view || schema_table || create && !table->db_stat ||
!table;
return (derived || view || schema_table || (create && !table->db_stat) ||
!table);
}
void print(THD *thd, String *str, enum_query_type query_type);
bool check_single_table(TABLE_LIST **table, table_map map,

View File

@ -111,8 +111,8 @@ uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year)
if (l_time->month == 1 && l_time->day <= 7-weekday)
{
if (!week_year &&
(first_weekday && weekday != 0 ||
!first_weekday && weekday >= 4))
((first_weekday && weekday != 0) ||
(!first_weekday && weekday >= 4)))
return 0;
week_year= 1;
(*year)--;
@ -129,8 +129,8 @@ uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year)
if (week_year && days >= 52*7)
{
weekday= (weekday + calc_days_in_year(*year)) % 7;
if (!first_weekday && weekday < 4 ||
first_weekday && weekday == 0)
if ((!first_weekday && weekday < 4) ||
(first_weekday && weekday == 0))
{
(*year)++;
return 1;

View File

@ -447,8 +447,8 @@ prepare_tz_info(TIME_ZONE_INFO *sp, MEM_ROOT *storage)
}
if (end_t == MY_TIME_T_MAX ||
(cur_off_and_corr > 0) &&
(end_t >= MY_TIME_T_MAX - cur_off_and_corr))
((cur_off_and_corr > 0) &&
(end_t >= MY_TIME_T_MAX - cur_off_and_corr)))
/* end of t space */
break;

View File

@ -603,9 +603,10 @@ bool Unique::get(TABLE *table)
outfile=table->sort.io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE),
MYF(MY_ZEROFILL));
if (!outfile || ! my_b_inited(outfile) &&
open_cached_file(outfile,mysql_tmpdir,TEMP_PREFIX,READ_RECORD_BUFFER,
MYF(MY_WME)))
if (!outfile ||
(! my_b_inited(outfile) &&
open_cached_file(outfile,mysql_tmpdir,TEMP_PREFIX,READ_RECORD_BUFFER,
MYF(MY_WME))))
return 1;
reinit_io_cache(outfile,WRITE_CACHE,0L,0,0);

View File

@ -2828,7 +2828,7 @@ int ha_federated::info(uint flag)
if (!(row= mysql_fetch_row(result)))
goto error;
if (flag & HA_STATUS_VARIABLE | HA_STATUS_CONST)
if (flag & (HA_STATUS_VARIABLE | HA_STATUS_CONST))
{
/*
deleted is set in ha_federated::info

View File

@ -91,7 +91,7 @@ const char **ha_heap::bas_ext() const
int ha_heap::open(const char *name, int mode, uint test_if_locked)
{
if ((test_if_locked & HA_OPEN_INTERNAL_TABLE) ||
!(file= heap_open(name, mode)) && my_errno == ENOENT)
(!(file= heap_open(name, mode)) && my_errno == ENOENT))
{
HA_CREATE_INFO create_info;
internal_table= test(test_if_locked & HA_OPEN_INTERNAL_TABLE);

View File

@ -152,7 +152,7 @@ static MYSQL_SYSVAR_BOOL(page_checksum, maria_page_checksums, 0,
/* It is only command line argument */
static MYSQL_SYSVAR_STR(log_dir_path, maria_data_root,
PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_RQCMDARG,
PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Path to the directory where to store transactional log",
NULL, NULL, mysql_real_data_home);
@ -1370,12 +1370,13 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
}
if (!do_optimize ||
((share->data_file_type == BLOCK_RECORD) ?
(share->state.changed & STATE_NOT_OPTIMIZED_ROWS) :
(file->state->del || share->state.split != file->state->records)) &&
(!(param->testflag & T_QUICK) ||
(share->state.changed & (STATE_NOT_OPTIMIZED_KEYS |
STATE_NOT_OPTIMIZED_ROWS))))
(((share->data_file_type == BLOCK_RECORD) ?
(share->state.changed & STATE_NOT_OPTIMIZED_ROWS) :
(file->state->del ||
share->state.split != file->state->records)) &&
(!(param->testflag & T_QUICK) ||
(share->state.changed & (STATE_NOT_OPTIMIZED_KEYS |
STATE_NOT_OPTIMIZED_ROWS)))))
{
ulonglong key_map= ((local_testflag & T_CREATE_MISSING_KEYS) ?
maria_get_mask_all_keys_active(share->base.keys) :

View File

@ -178,22 +178,22 @@ public:
/**
* Check if table name has changed, for event TE_ALTER
*/
const bool tableNameChanged() const;
bool tableNameChanged() const;
/**
* Check if table frm has changed, for event TE_ALTER
*/
const bool tableFrmChanged() const;
bool tableFrmChanged() const;
/**
* Check if table fragmentation has changed, for event TE_ALTER
*/
const bool tableFragmentationChanged() const;
bool tableFragmentationChanged() const;
/**
* Check if table range partition list name has changed, for event TE_ALTER
*/
const bool tableRangeListChanged() const;
bool tableRangeListChanged() const;
/**
* Retrieve the GCI of the latest retrieved event

View File

@ -779,7 +779,7 @@ public:
/**
* Get the type of access for this operation
*/
const Type getType() const;
Type getType() const;
/** @} *********************************************************************/
@ -1135,7 +1135,7 @@ Return Value Return the Type.
Remark: Gets type of access.
******************************************************************************/
inline
const NdbOperation::Type
NdbOperation::Type
NdbOperation::getType() const
{
return m_type;

View File

@ -1569,9 +1569,11 @@ Ndb::externalizeTableName(const char * internalTableName, bool fullyQualifiedNam
register const char *ptr = internalTableName;
// Skip database name
while (*ptr && *ptr++ != table_name_separator);
while (*ptr && *ptr++ != table_name_separator)
;
// Skip schema name
while (*ptr && *ptr++ != table_name_separator);
while (*ptr && *ptr++ != table_name_separator)
;
return ptr;
}
else
@ -1591,7 +1593,9 @@ Ndb::externalizeIndexName(const char * internalIndexName, bool fullyQualifiedNam
register const char *ptr = internalIndexName;
// Scan name from the end
while (*ptr++); ptr--; // strend
while (*ptr++)
;
ptr--; // strend
while (ptr >= internalIndexName && *ptr != table_name_separator)
ptr--;

View File

@ -96,22 +96,22 @@ NdbEventOperation::hasError() const
return m_impl.m_has_error;
}
const bool NdbEventOperation::tableNameChanged() const
bool NdbEventOperation::tableNameChanged() const
{
return m_impl.tableNameChanged();
}
const bool NdbEventOperation::tableFrmChanged() const
bool NdbEventOperation::tableFrmChanged() const
{
return m_impl.tableFrmChanged();
}
const bool NdbEventOperation::tableFragmentationChanged() const
bool NdbEventOperation::tableFragmentationChanged() const
{
return m_impl.tableFragmentationChanged();
}
const bool NdbEventOperation::tableRangeListChanged() const
bool NdbEventOperation::tableRangeListChanged() const
{
return m_impl.tableRangeListChanged();
}

View File

@ -658,22 +658,22 @@ NdbEventOperationImpl::stop()
DBUG_RETURN(r);
}
const bool NdbEventOperationImpl::tableNameChanged() const
bool NdbEventOperationImpl::tableNameChanged() const
{
return (bool)AlterTableReq::getNameFlag(m_change_mask);
}
const bool NdbEventOperationImpl::tableFrmChanged() const
bool NdbEventOperationImpl::tableFrmChanged() const
{
return (bool)AlterTableReq::getFrmFlag(m_change_mask);
}
const bool NdbEventOperationImpl::tableFragmentationChanged() const
bool NdbEventOperationImpl::tableFragmentationChanged() const
{
return (bool)AlterTableReq::getFragDataFlag(m_change_mask);
}
const bool NdbEventOperationImpl::tableRangeListChanged() const
bool NdbEventOperationImpl::tableRangeListChanged() const
{
return (bool)AlterTableReq::getRangeListFlag(m_change_mask);
}

View File

@ -361,10 +361,10 @@ public:
NdbBlob *getBlobHandle(const NdbColumnImpl *, int n);
int readBlobParts(char* buf, NdbBlob* blob, Uint32 part, Uint32 count);
int receive_event();
const bool tableNameChanged() const;
const bool tableFrmChanged() const;
const bool tableFragmentationChanged() const;
const bool tableRangeListChanged() const;
bool tableNameChanged() const;
bool tableFrmChanged() const;
bool tableFragmentationChanged() const;
bool tableRangeListChanged() const;
Uint64 getGCI();
Uint32 getAnyValue() const;
Uint64 getLatestGCI();

View File

@ -248,7 +248,8 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
{
const Uint32 *buf = (Uint32 *)r.aRef();
int k = (length+31)/32;
while (k > 0 && (buf[--k] == 0));
while (k > 0 && (buf[--k] == 0))
;
out.print("%X", buf[k]);
while (k > 0)
out.print("%.8X", buf[--k]);

View File

@ -365,8 +365,8 @@ inline
bool
TransporterFacade::get_node_stopping(NodeId n) const {
const ClusterMgr::Node & node = theClusterMgr->getNodeInfo(n);
return (!node.m_state.getSingleUserMode() &&
(node.m_state.startLevel == NodeState::SL_STOPPING_1) ||
return ((!node.m_state.getSingleUserMode() &&
(node.m_state.startLevel == NodeState::SL_STOPPING_1)) ||
(node.m_state.startLevel == NodeState::SL_STOPPING_2));
}