Skip to content

Commit f13c305

Browse files
committed
Bug#13945257 NEW COMPILATION ERRORS/WARNINGS WITH XCODE 4.3.2
Fix various new compiler warnings and one compiler error reported by Clang 3.1 / XCode 4.3.2 of Mac OSX. See per-file messages for details.
1 parent bff1515 commit f13c305

18 files changed

Lines changed: 78 additions & 72 deletions

File tree

libmysqld/lib_sql.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,8 @@ static MYSQL_RES * emb_store_result(MYSQL *mysql)
448448
int emb_read_change_user_result(MYSQL *mysql)
449449
{
450450
mysql->net.read_pos= (uchar*)""; // fake an OK packet
451-
return mysql_errno(mysql) ? packet_error : 1 /* length of the OK packet */;
451+
return mysql_errno(mysql) ? static_cast<int>packet_error :
452+
1 /* length of the OK packet */;
452453
}
453454

454455
MYSQL_METHODS embedded_methods=

sql/field.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5565,7 +5565,7 @@ Field_time_common::convert_number_to_TIME(longlong nr, bool unsigned_val,
55655565
Both number_to_time() call and negative nanoseconds value
55665566
affect ltime->neg, hence "|=" to combine them:
55675567
*/
5568-
if (ltime->neg|= (nanoseconds < 0))
5568+
if ((ltime->neg|= (nanoseconds < 0)))
55695569
nanoseconds= -nanoseconds;
55705570
ltime->second_part= 0;
55715571
return time_add_nanoseconds_with_round(ltime, nanoseconds, warnings);

sql/item_buff.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ bool Cached_item_int::cmp(void)
129129
{
130130
DBUG_ENTER("Cached_item_int::cmp");
131131
longlong nr=item->val_int();
132-
DBUG_PRINT("info", ("old: %Ld, new: %Ld", value, nr));
132+
DBUG_PRINT("info", ("old: %lld, new: %lld", value, nr));
133133
if (null_value != item->null_value || nr != value)
134134
{
135135
null_value= item->null_value;

sql/item_timefunc.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2792,7 +2792,7 @@ bool Item_func_timediff::get_time(MYSQL_TIME *l_time3)
27922792
if (l_time1.neg != l_time2.neg)
27932793
l_sign= -l_sign;
27942794

2795-
memset(l_time3, 0, sizeof(l_time3));
2795+
memset(l_time3, 0, sizeof(*l_time3));
27962796

27972797
l_time3->neg= calc_time_diff(&l_time1, &l_time2, l_sign,
27982798
&seconds, &microseconds);

sql/log.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ static int find_uniq_filename(char *name)
14231423
my_dirend(dir_info);
14241424

14251425
/* check if reached the maximum possible extension number */
1426-
if ((max_found == MAX_LOG_UNIQUE_FN_EXT))
1426+
if (max_found == MAX_LOG_UNIQUE_FN_EXT)
14271427
{
14281428
sql_print_error("Log filename extension number exhausted: %06lu. \
14291429
Please fix this by archiving old logs and \

sql/log_event.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,8 @@ Log_event* Log_event::read_log_event(IO_CACHE* file,
13161316
Log_event *res= 0;
13171317
#ifndef max_allowed_packet
13181318
THD *thd=current_thd;
1319-
uint max_allowed_packet= thd ? thd->variables.max_allowed_packet : ~(ulong)0;
1319+
ulong max_allowed_packet= thd ? thd->variables.max_allowed_packet :
1320+
~(ulong)0;
13201321
#endif
13211322

13221323
ulong const max_size=

sql/opt_sum.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static ulonglong get_exact_record_count(TABLE_LIST *tables)
8181
for (TABLE_LIST *tl= tables; tl; tl= tl->next_leaf)
8282
{
8383
ha_rows tmp= tl->table->file->records();
84-
if ((tmp == HA_POS_ERROR))
84+
if (tmp == HA_POS_ERROR)
8585
return ULONGLONG_MAX;
8686
count*= tmp;
8787
}

sql/sql_time.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ static bool lldiv_t_to_time(lldiv_t lld, MYSQL_TIME *ltime, int *warnings)
528528
Both lld.quot and lld.rem can give negative result value,
529529
thus combine them using "|=".
530530
*/
531-
if (ltime->neg|= (lld.rem < 0))
531+
if ((ltime->neg|= (lld.rem < 0)))
532532
lld.rem= -lld.rem;
533533
ltime->second_part= lld.rem / 1000;
534534
return time_add_nanoseconds_with_round(ltime, lld.rem % 1000, warnings);

sql/table.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,11 @@ typedef Bitmap<MAX_FIELDS> Field_map;
900900
struct TABLE
901901
{
902902
TABLE() {} /* Remove gcc warning */
903-
virtual ~TABLE() {}
903+
/*
904+
Since TABLE instances are often cleared using memset(), do not
905+
add virtual members and do not inherit from TABLE.
906+
Otherwise memset() will start overwriting the vtable pointer.
907+
*/
904908

905909
TABLE_SHARE *s;
906910
handler *file;

storage/csv/ha_tina.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,9 +1417,9 @@ int ha_tina::rnd_end()
14171417
DBUG_RETURN(-1);
14181418

14191419
/* Open the file again */
1420-
if (((data_file= mysql_file_open(csv_key_file_data,
1421-
share->data_file_name,
1422-
O_RDONLY, MYF(MY_WME))) == -1))
1420+
if ((data_file= mysql_file_open(csv_key_file_data,
1421+
share->data_file_name,
1422+
O_RDONLY, MYF(MY_WME))) == -1)
14231423
DBUG_RETURN(my_errno ? my_errno : -1);
14241424
/*
14251425
As we reopened the data file, increase share->data_file_version

0 commit comments

Comments
 (0)