Commit 4bdb3d87 authored by Davi Arnaut's avatar Davi Arnaut

Fix warnings and bug spotted by gcc-4.3.

Related to operator precedence and associativity.
Make the expressions as explicit as possible.
parent 6e36c50b
......@@ -209,7 +209,7 @@ class Field
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; }
......
......@@ -2628,7 +2628,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];
......@@ -4840,8 +4840,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;
......
......@@ -654,8 +654,7 @@ 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 +980,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;
......
......@@ -2680,7 +2680,7 @@ void Query_log_event::print_query_header(IO_CACHE* file,
if (!(flags & LOG_EVENT_SUPPRESS_USE_F) && db)
{
if (different_db= memcmp(print_event_info->db, db, db_len + 1))
if ((different_db= memcmp(print_event_info->db, db, db_len + 1)))
memcpy(print_event_info->db, db, db_len + 1);
if (db[0] && different_db)
my_b_printf(file, "use %s%s\n", db, print_event_info->delimiter);
......
......@@ -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)
......
......@@ -2002,7 +2002,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;
}
......
......@@ -1363,7 +1363,7 @@ struct TABLE_LIST
void cleanup_items();
bool placeholder()
{
return derived || view || schema_table || create && !table->db_stat ||
return derived || view || schema_table || (create && !table->db_stat) ||
!table;
}
void print(THD *thd, String *str, enum_query_type query_type);
......
......@@ -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
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment