From e689fbc4582de1b5f81cb69d98f5fe54b7064db1 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Jan 2008 19:39:43 +0200 Subject: [PATCH] Fixed compiler warnings by adding casts and changing variable types Fixed bug that caused change_user.test to fail Fixed bug that caused mysql_client_test to fail include/myisam.h: Fixed prototypes mysql-test/r/create.result: Fix that test works even if Maria is not used for temporary tables mysql-test/t/create.test: Fix that test works even if Maria is not used for temporary tables sql/mysqld.cc: Fixed that default value of max_join_size is set correctly; It needs to match usage in set_var.cc sql/set_var.cc: Fixed test, now when max_join_size is initialized correctly sql/sql_select.cc: Fixed that one can compile without -DUSE_MARIA_FOR_TMP_TABLES storage/maria/ma_blockrec.c: Fixed compiler warnings by adding casts storage/maria/ma_checkpoint.c: Fixed compiler warnings by adding casts storage/maria/ma_create.c: Fixed compiler warnings by adding casts storage/maria/ma_delete_table.c: Fixed compiler warnings by adding casts storage/maria/ma_loghandler.c: Fixed compiler warnings by adding casts and changing types for variables Changed translog_new_page_header to use changing integer instead of calling time() as time() is a slow call and will give same results when calling many times withing one second storage/maria/ma_pagecrc.c: Fixed compiler warnings by adding casts storage/maria/ma_recovery.c: Fixed indentation storage/myisam/ha_myisam.cc: Fixed wrong types for variables Changed chk_data_link() and repair*() functions to take my_bool as argument storage/myisam/mi_check.c: Fixes to handle that param.test_flag is now ulonglong storage/myisam/myisamchk.c: Fixes to handle that param.test_flag is now ulonglong support-files/compiler_warnings.supp: Fixed line numbers --- include/myisam.h | 4 +-- mysql-test/r/create.result | 4 +-- mysql-test/t/create.test | 2 ++ sql/mysqld.cc | 2 +- sql/set_var.cc | 2 +- sql/sql_select.cc | 2 +- storage/maria/ma_blockrec.c | 13 +++---- storage/maria/ma_checkpoint.c | 2 +- storage/maria/ma_create.c | 2 +- storage/maria/ma_delete_table.c | 1 + storage/maria/ma_loghandler.c | 51 +++++++++++++++------------- storage/maria/ma_pagecrc.c | 14 ++++---- storage/maria/ma_recovery.c | 4 +-- storage/myisam/ha_myisam.cc | 14 ++++---- storage/myisam/mi_check.c | 8 ++--- storage/myisam/myisamchk.c | 8 ++--- support-files/compiler_warnings.supp | 2 +- 17 files changed, 71 insertions(+), 64 deletions(-) diff --git a/include/myisam.h b/include/myisam.h index 292a0015964..8452b25098a 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -372,10 +372,10 @@ typedef struct st_mi_sort_param /* functions in mi_check */ void myisamchk_init(HA_CHECK *param); int chk_status(HA_CHECK *param, MI_INFO *info); -int chk_del(HA_CHECK *param, register MI_INFO *info, uint test_flag); +int chk_del(HA_CHECK *param, register MI_INFO *info, ulonglong test_flag); int chk_size(HA_CHECK *param, MI_INFO *info); int chk_key(HA_CHECK *param, MI_INFO *info); -int chk_data_link(HA_CHECK *param, MI_INFO *info,int extend); +int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend); int mi_repair(HA_CHECK *param, register MI_INFO *info, char * name, int rep_quick); int mi_sort_index(HA_CHECK *param, register MI_INFO *info, char * name); diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 3fbec9e4a1d..2a5b2e92bb2 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1717,7 +1717,7 @@ t1 CREATE TABLE `t1` ( `TIME` bigint(7) NOT NULL DEFAULT '0', `STATE` varchar(64) DEFAULT NULL, `INFO` longtext -) ENGINE=MARIA DEFAULT CHARSET=utf8 PAGE_CHECKSUM=1 +) ENGINE=MARIA DEFAULT CHARSET=utf8 drop table t1; create temporary table t1 like information_schema.processlist; show create table t1; @@ -1731,7 +1731,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( `TIME` bigint(7) NOT NULL DEFAULT '0', `STATE` varchar(64) DEFAULT NULL, `INFO` longtext -) ENGINE=MARIA DEFAULT CHARSET=utf8 +) DEFAULT CHARSET=utf8 drop table t1; create table t1 like information_schema.character_sets; show create table t1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index dff6bf3fcff..60540e0066a 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -1332,9 +1332,11 @@ drop function f1; # Bug#25629 CREATE TABLE LIKE does not work with INFORMATION_SCHEMA # create table t1 like information_schema.processlist; +--replace_result ENGINE=MyISAM "" ENGINE=Maria "" " PAGE_CHECKSUM=1" "" show create table t1; drop table t1; create temporary table t1 like information_schema.processlist; +--replace_result ENGINE=MyISAM "" ENGINE=MARIA "" " PAGE_CHECKSUM=1" "" show create table t1; drop table t1; create table t1 like information_schema.character_sets; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 02ea1f7c73e..f2a36042b94 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6312,7 +6312,7 @@ The minimum value for this variable is 4096.", "Joins that are probably going to read more than max_join_size records return an error.", (uchar**) &global_system_variables.max_join_size, (uchar**) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG, - ULONG_MAX, 1, ULONG_MAX, 0, 1, 0}, + HA_POS_ERROR, 1, HA_POS_ERROR, 0, 1, 0}, {"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA, "Max number of bytes in sorted records.", (uchar**) &global_system_variables.max_length_for_sort_data, diff --git a/sql/set_var.cc b/sql/set_var.cc index d3ee3bf6c67..144abbb9a2d 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -873,7 +873,7 @@ static void fix_max_join_size(THD *thd, enum_var_type type) { if (type != OPT_GLOBAL) { - if (thd->variables.max_join_size == ULONG_MAX) + if (thd->variables.max_join_size == HA_POS_ERROR) thd->options|= OPTION_BIG_SELECTS; else thd->options&= ~OPTION_BIG_SELECTS; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index d8b06f978bd..3a286a69e20 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -10418,7 +10418,7 @@ static bool open_tmp_table(TABLE *table) } -#ifdef WITH_MARIA_STORAGE_ENGINE +#if defined(WITH_MARIA_STORAGE_ENGINE) && defined(USE_MARIA_FOR_TMP_TABLES) /* Create internal Maria temporary table */ diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c index 00c5511e9d3..002d48e0b9e 100644 --- a/storage/maria/ma_blockrec.c +++ b/storage/maria/ma_blockrec.c @@ -1987,7 +1987,7 @@ static uchar *store_page_range(uchar *to, MARIA_BITMAP_BLOCK *block, to+= SUB_RANGE_SIZE; /* Store number of unused bytes at last page */ - empty_space= pages_left * data_size - length; + empty_space= (uint) (pages_left * data_size - length); int2store(to, empty_space); to+= BLOCK_FILLER_SIZE; @@ -2946,9 +2946,10 @@ static my_bool write_block_record(MARIA_HA *info, if (tmp_data_used) { /* Full head page */ - size_t block_length= (ulong) (tmp_data - info->rec_buff); + translog_size_t block_length= (translog_size_t) (tmp_data - + info->rec_buff); log_pos= store_page_range(log_pos, head_block+1, block_size, - block_length, &extents); + (ulong) block_length, &extents); log_array_pos->str= (char*) info->rec_buff; log_array_pos->length= block_length; log_entry_length+= block_length; @@ -3104,9 +3105,9 @@ static my_bool write_block_record(MARIA_HA *info, if (translog_write_record(&lsn, LOGREC_UNDO_ROW_UPDATE, info->trn, info, (translog_size_t) - log_array[TRANSLOG_INTERNAL_PARTS + - 0].length + extents_length + - row_length, + (log_array[TRANSLOG_INTERNAL_PARTS + + 0].length + extents_length + + row_length), TRANSLOG_INTERNAL_PARTS + 2 + row_parts_count, log_array, log_data + LSN_STORE_SIZE, diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c index 14816b7f154..98b302a4c62 100644 --- a/storage/maria/ma_checkpoint.c +++ b/storage/maria/ma_checkpoint.c @@ -228,7 +228,7 @@ static int really_execute_checkpoint(void) for (i= 0; i < (sizeof(record_pieces)/sizeof(record_pieces[0])); i++) { log_array[TRANSLOG_INTERNAL_PARTS + 1 + i]= record_pieces[i]; - total_rec_length+= record_pieces[i].length; + total_rec_length+= (translog_size_t) record_pieces[i].length; } if (unlikely(translog_write_record(&lsn, LOGREC_CHECKPOINT, &dummy_transaction_object, NULL, diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c index baecc61de37..d6fe9840aec 100644 --- a/storage/maria/ma_create.c +++ b/storage/maria/ma_create.c @@ -1037,7 +1037,7 @@ int maria_create(const char *name, enum data_file_type datafile_type, strlen(log_array[TRANSLOG_INTERNAL_PARTS + 3].str) + 1; for (k= TRANSLOG_INTERNAL_PARTS; k < (sizeof(log_array)/sizeof(log_array[0])); k++) - total_rec_length+= log_array[k].length; + total_rec_length+= (translog_size_t) log_array[k].length; /** For this record to be of any use for Recovery, we need the upper MySQL layer to be crash-safe, which it is not now (that would require diff --git a/storage/maria/ma_delete_table.c b/storage/maria/ma_delete_table.c index e6cbd961b7a..bdfece7ada7 100644 --- a/storage/maria/ma_delete_table.c +++ b/storage/maria/ma_delete_table.c @@ -89,6 +89,7 @@ int maria_delete_table(const char *name) log_array[TRANSLOG_INTERNAL_PARTS + 0].length= strlen(name) + 1; if (unlikely(translog_write_record(&lsn, LOGREC_REDO_DROP_TABLE, &dummy_transaction_object, NULL, + (translog_size_t) log_array[TRANSLOG_INTERNAL_PARTS + 0].length, sizeof(log_array)/sizeof(log_array[0]), diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index d21ff7b091c..5b91ca9fa4a 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -1538,6 +1538,8 @@ static void translog_buffer_unlock(struct st_translog_buffer *buffer) - space for page header should be checked before */ +static uchar translog_sector_random; + static void translog_new_page_header(TRANSLOG_ADDRESS *horizon, struct st_buffer_cursor *cursor) { @@ -1572,11 +1574,11 @@ static void translog_new_page_header(TRANSLOG_ADDRESS *horizon, if (log_descriptor.flags & TRANSLOG_SECTOR_PROTECTION) { /* - The time() works like "random" values producer because it is enough to - have such "random" for this purpose and it will not interfere with - higher level pseudo random value generator + translog_sector_randmo works like "random" values producer because + it is enough to have such "random" for this purpose and it will + not interfere with higher level pseudo random value generator */ - ptr[0]= (uchar)time(NULL); + ptr[0]= translog_sector_random++; ptr+= TRANSLOG_PAGE_SIZE / DISK_DRIVE_SECTOR_SIZE; } { @@ -4025,7 +4027,7 @@ static my_bool translog_write_parts_on_page(TRANSLOG_ADDRESS *horizon, } else { - len= part->length; + len= (translog_size_t) part->length; cur++; DBUG_PRINT("info", ("moved to next part (len: %lu)", (ulong) len)); } @@ -4088,7 +4090,7 @@ translog_write_variable_record_1group_header(struct st_translog_parts *parts, LEX_STRING *part; DBUG_ASSERT(parts->current != 0); /* first part is left for header */ part= parts->parts + (--parts->current); - parts->total_record_length+= (part->length= header_length); + parts->total_record_length+= (translog_size_t) (part->length= header_length); part->str= (char*)chunk0_header; /* puts chunk type */ *chunk0_header= (uchar) (type | TRANSLOG_CHUNK_LSN); @@ -4239,7 +4241,7 @@ translog_write_variable_record_chunk3_page(struct st_translog_parts *parts, DBUG_ASSERT(parts->current != 0); /* first part is left for header */ part= parts->parts + (--parts->current); - parts->total_record_length+= (part->length= 1 + 2); + parts->total_record_length+= (translog_size_t) (part->length= 1 + 2); part->str= (char*)chunk3_header; /* Puts chunk type */ *chunk3_header= (uchar) (TRANSLOG_CHUNK_LNGTH); @@ -5643,7 +5645,7 @@ static my_bool translog_write_fixed_record(LSN *lsn, */ DBUG_ASSERT(parts->current != 0); /* first part is left for header */ part= parts->parts + (--parts->current); - parts->total_record_length+= (part->length= 1 + 2); + parts->total_record_length+= (translog_size_t) (part->length= 1 + 2); part->str= (char*)chunk1_header; *chunk1_header= (uchar) (type | TRANSLOG_CHUNK_FIXED); int2store(chunk1_header + 1, short_trid); @@ -5783,7 +5785,7 @@ my_bool translog_write_record(LSN *lsn, part < parts_data + part_no; part++) { - rec_len+= part->length; + rec_len+= (translog_size_t) part->length; } } parts.record_length= rec_len; @@ -5890,9 +5892,8 @@ static int translog_fixed_length_header(uchar *page, uchar *src= page + page_offset + 3; uchar *dst= buff->header; uchar *start= src; - uint lsns= desc->compressed_LSN; + int lsns= desc->compressed_LSN; uint length= desc->fixed_length; - DBUG_ENTER("translog_fixed_length_header"); buff->record_length= length; @@ -5904,14 +5905,15 @@ static int translog_fixed_length_header(uchar *page, lsns*= LSN_STORE_SIZE; dst+= lsns; length-= lsns; - buff->compressed_LSN_economy= (lsns - (src - start)); + buff->compressed_LSN_economy= (lsns - (int) (src - start)); } else buff->compressed_LSN_economy= 0; memcpy(dst, src, length); - buff->non_header_data_start_offset= page_offset + - ((src + length) - (page + page_offset)); + buff->non_header_data_start_offset= (uint16) (page_offset + + ((src + length) - + (page + page_offset))); buff->non_header_data_len= 0; DBUG_RETURN(buff->record_length); } @@ -6305,7 +6307,7 @@ translog_variable_length_header(uchar *page, translog_size_t page_offset, uint16 page_rest; DBUG_PRINT("info", ("1 group")); src+= 2; - page_rest= TRANSLOG_PAGE_SIZE - (src - page); + page_rest= (uint16) (TRANSLOG_PAGE_SIZE - (src - page)); base_lsn= buff->lsn; body_len= min(page_rest, buff->record_length); @@ -6324,7 +6326,7 @@ translog_variable_length_header(uchar *page, translog_size_t page_offset, DBUG_RETURN(RECHEADER_READ_ERROR); DBUG_PRINT("info", ("Groups: %u", (uint) grp_no)); src+= (2 + 2); - page_rest= TRANSLOG_PAGE_SIZE - (src - page); + page_rest= (uint16) (TRANSLOG_PAGE_SIZE - (src - page)); curr= 0; header_to_skip= src - (page + page_offset); buff->chunk0_pages= 0; @@ -6395,7 +6397,7 @@ translog_variable_length_header(uchar *page, translog_size_t page_offset, src= page + page_offset + header_to_skip; chunk_len= uint2korr(src - 2 - 2); DBUG_PRINT("info", ("Chunk len: %u", (uint) chunk_len)); - page_rest= TRANSLOG_PAGE_SIZE - (src - page); + page_rest= (uint16) (TRANSLOG_PAGE_SIZE - (src - page)); } if (scanner == NULL) @@ -6413,7 +6415,7 @@ translog_variable_length_header(uchar *page, translog_size_t page_offset, page= scanner->page; page_offset= scanner->page_offset; src= page + page_offset + 1; - page_rest= TRANSLOG_PAGE_SIZE - (src - page); + page_rest= (uint16) (TRANSLOG_PAGE_SIZE - (src - page)); body_len= page_rest; if (scanner == &internal_scanner) translog_destroy_scanner(scanner); @@ -6426,12 +6428,12 @@ translog_variable_length_header(uchar *page, translog_size_t page_offset, dst+= lsns; length-= lsns; buff->record_length+= (buff->compressed_LSN_economy= - (lsns - (src - start))); + (int) (lsns - (src - start))); DBUG_PRINT("info", ("lsns: %u length: %u economy: %d new length: %lu", lsns / LSN_STORE_SIZE, (uint) length, (int) buff->compressed_LSN_economy, (ulong) buff->record_length)); - body_len-= (src - start); + body_len-= (uint16) (src - start); } else buff->compressed_LSN_economy= 0; @@ -6439,7 +6441,7 @@ translog_variable_length_header(uchar *page, translog_size_t page_offset, DBUG_ASSERT(body_len >= length); body_len-= length; memcpy(dst, src, length); - buff->non_header_data_start_offset= src + length - page; + buff->non_header_data_start_offset= (uint16) (src + length - page); buff->non_header_data_len= body_len; DBUG_PRINT("info", ("non_header_data_start_offset: %u len: %u buffer: %u", buff->non_header_data_start_offset, @@ -7333,9 +7335,10 @@ int translog_assign_id_to_share(MARIA_HA *tbl_info, TRN *trn) log_array[TRANSLOG_INTERNAL_PARTS + 1].length= strlen(share->open_file_name) + 1; if (unlikely(translog_write_record(&lsn, LOGREC_FILE_ID, trn, tbl_info, - sizeof(log_data) + - log_array[TRANSLOG_INTERNAL_PARTS + - 1].length, + (translog_size_t) + (sizeof(log_data) + + log_array[TRANSLOG_INTERNAL_PARTS + + 1].length), sizeof(log_array)/sizeof(log_array[0]), log_array, log_data, NULL))) return 1; diff --git a/storage/maria/ma_pagecrc.c b/storage/maria/ma_pagecrc.c index 51cc712a112..357527c6faa 100644 --- a/storage/maria/ma_pagecrc.c +++ b/storage/maria/ma_pagecrc.c @@ -73,7 +73,7 @@ static my_bool maria_page_crc_check(uchar *page, } DBUG_RETURN(0); } - new_crc= maria_page_crc(page_no & UINT_MAX32, page, data_length); + new_crc= maria_page_crc((uint32) page_no, page, data_length); DBUG_ASSERT(new_crc != no_crc_val); res= test(new_crc != crc); if (res) @@ -121,7 +121,7 @@ my_bool maria_page_crc_set_normal(uchar *page, { MARIA_SHARE *share= (MARIA_SHARE *)data_ptr; int data_length= share->block_size - CRC_SIZE; - uint32 crc= maria_page_crc(page_no & UINT_MAX32, page, data_length); + uint32 crc= maria_page_crc((uint32) page_no, page, data_length); DBUG_ENTER("maria_page_crc_set_normal"); DBUG_PRINT("info", ("Page %lu crc: %lu", (ulong) page_no, (ulong)crc)); @@ -147,7 +147,7 @@ my_bool maria_page_crc_set_index(uchar *page, { MARIA_SHARE *share= (MARIA_SHARE *)data_ptr; int data_length= _ma_get_page_used(share, page); - uint32 crc= maria_page_crc(page_no & UINT_MAX32, page, data_length); + uint32 crc= maria_page_crc((uint32) page_no, page, data_length); DBUG_ENTER("maria_page_crc_set"); DBUG_PRINT("info", ("Page %lu crc: %lu", (ulong) page_no, (ulong) crc)); @@ -177,7 +177,7 @@ my_bool maria_page_crc_check_data(uchar *page, uchar *data_ptr) { MARIA_SHARE *share= (MARIA_SHARE *)data_ptr; - return (maria_page_crc_check(page, page_no & UINT_MAX32, share, + return (maria_page_crc_check(page, (uint32) page_no, share, MARIA_NO_CRC_NORMAL_PAGE, share->block_size - CRC_SIZE)); } @@ -199,7 +199,7 @@ my_bool maria_page_crc_check_bitmap(uchar *page, uchar *data_ptr) { MARIA_SHARE *share= (MARIA_SHARE *)data_ptr; - return (maria_page_crc_check(page, page_no & UINT_MAX32, share, + return (maria_page_crc_check(page, (uint32) page_no, share, MARIA_NO_CRC_BITMAP_PAGE, share->block_size - CRC_SIZE)); } @@ -227,7 +227,7 @@ my_bool maria_page_crc_check_index(uchar *page, DBUG_PRINT("error", ("Wrong page length: %u", length)); return (my_errno= HA_ERR_WRONG_CRC); } - return maria_page_crc_check(page, page_no & UINT_MAX32, share, + return maria_page_crc_check(page, (uint32) page_no, share, MARIA_NO_CRC_NORMAL_PAGE, length); } @@ -335,7 +335,7 @@ void maria_page_write_failure(uchar* data_ptr) my_bool maria_flush_log_for_page(uchar *page, pgcache_page_no_t page_no __attribute__((unused)), - uchar *data_ptr) + uchar *data_ptr __attribute__((unused))) { LSN lsn; #ifndef DBUG_OFF diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c index 2d97d97f9da..8170d393434 100644 --- a/storage/maria/ma_recovery.c +++ b/storage/maria/ma_recovery.c @@ -2842,8 +2842,8 @@ static LSN parse_checkpoint_record(LSN lsn) nb_dirty_pages= uint8korr(ptr); /* Ensure casts later will not loose significant bits. */ - DBUG_ASSERT((nb_dirty_pages <= SIZE_T_MAX/sizeof(struct st_dirty_page)) - && (nb_dirty_pages <= ULONG_MAX)); + DBUG_ASSERT((nb_dirty_pages <= SIZE_T_MAX/sizeof(struct st_dirty_page)) && + (nb_dirty_pages <= ULONG_MAX)); ptr+= 8; tprint(tracef, "%lu dirty pages\n", (ulong) nb_dirty_pages); diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 70116b80c1f..42e3215403c 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -767,13 +767,13 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt) (param.testflag & (T_EXTEND | T_MEDIUM)))) || mi_is_crashed(file)) { - uint old_testflag=param.testflag; + ulonglong old_testflag= param.testflag; param.testflag|=T_MEDIUM; if (!(error= init_io_cache(¶m.read_cache, file->dfile, my_default_record_cache_size, READ_CACHE, share->pack.header_length, 1, MYF(MY_WME)))) { - error= chk_data_link(¶m, file, param.testflag & T_EXTEND); + error= chk_data_link(¶m, file, test(param.testflag & T_EXTEND)); end_io_cache(&(param.read_cache)); } param.testflag= old_testflag; @@ -1030,7 +1030,7 @@ int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt) int ha_myisam::repair(THD *thd, HA_CHECK ¶m, bool do_optimize) { int error=0; - uint local_testflag=param.testflag; + ulonglong local_testflag= param.testflag; bool optimize_done= !do_optimize, statistics_done=0; const char *old_proc_info=thd->proc_info; char fixed_name[FN_REFLEN]; @@ -1079,7 +1079,7 @@ int ha_myisam::repair(THD *thd, HA_CHECK ¶m, bool do_optimize) ulonglong key_map= ((local_testflag & T_CREATE_MISSING_KEYS) ? mi_get_mask_all_keys_active(share->base.keys) : share->state.key_map); - uint testflag=param.testflag; + ulonglong testflag= param.testflag; if (mi_test_if_sort_rep(file,file->state->records,key_map,0) && (local_testflag & T_REP_BY_SORT)) { @@ -1093,7 +1093,7 @@ int ha_myisam::repair(THD *thd, HA_CHECK ¶m, bool do_optimize) my_snprintf(buf, 40, "Repair with %d threads", my_count_bits(key_map)); thd_proc_info(thd, buf); error = mi_repair_parallel(¶m, file, fixed_name, - param.testflag & T_QUICK); + test(param.testflag & T_QUICK)); thd_proc_info(thd, "Repair done"); // to reset proc_info, as // it was pointing to local buffer } @@ -1101,7 +1101,7 @@ int ha_myisam::repair(THD *thd, HA_CHECK ¶m, bool do_optimize) { thd_proc_info(thd, "Repair by sorting"); error = mi_repair_by_sort(¶m, file, fixed_name, - param.testflag & T_QUICK); + test(param.testflag & T_QUICK)); } } else @@ -1109,7 +1109,7 @@ int ha_myisam::repair(THD *thd, HA_CHECK ¶m, bool do_optimize) thd_proc_info(thd, "Repair with keycache"); param.testflag &= ~T_REP_BY_SORT; error= mi_repair(¶m, file, fixed_name, - param.testflag & T_QUICK); + test(param.testflag & T_QUICK)); } param.testflag=testflag; optimize_done=1; diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index fc9d3a346dd..e45fe872d2d 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -136,7 +136,7 @@ int chk_status(HA_CHECK *param, register MI_INFO *info) /* Check delete links */ -int chk_del(HA_CHECK *param, register MI_INFO *info, uint test_flag) +int chk_del(HA_CHECK *param, register MI_INFO *info, ulonglong test_flag) { reg2 ha_rows i; uint delete_link_length; @@ -934,7 +934,7 @@ static uint isam_key_length(MI_INFO *info, register MI_KEYDEF *keyinfo) /* Check that record-link is ok */ -int chk_data_link(HA_CHECK *param, MI_INFO *info,int extend) +int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) { int error,got_error,flag; uint key,left_length,b_type,field; @@ -2494,7 +2494,7 @@ int mi_repair_by_sort(HA_CHECK *param, register MI_INFO *info, goto err; } - if (rep_quick & T_FORCE_UNIQUENESS) + if (rep_quick && (param->testflag & T_FORCE_UNIQUENESS)) { my_off_t skr=info->state->data_file_length+ (share->options & HA_OPTION_COMPRESS_RECORD ? @@ -3014,7 +3014,7 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info, goto err; } - if (rep_quick & T_FORCE_UNIQUENESS) + if (rep_quick && (param->testflag & T_FORCE_UNIQUENESS)) { my_off_t skr=info->state->data_file_length+ (share->options & HA_OPTION_COMPRESS_RECORD ? diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 9f86f14d2ba..694ebeb7f5d 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -103,7 +103,7 @@ int main(int argc, char **argv) (!(check_param.testflag & (T_REP | T_REP_BY_SORT | T_SORT_RECORDS | T_SORT_INDEX)))) { - uint old_testflag=check_param.testflag; + ulonglong old_testflag=check_param.testflag; if (!(check_param.testflag & T_REP)) check_param.testflag|= T_REP_BY_SORT; check_param.testflag&= ~T_EXTEND; /* Don't needed */ @@ -795,7 +795,7 @@ static void get_options(register int *argc,register char ***argv) static int myisamchk(HA_CHECK *param, char * filename) { int error,lock_type,recreate; - int rep_quick= param->testflag & (T_QUICK | T_FORCE_UNIQUENESS); + int rep_quick= test(param->testflag & (T_QUICK | T_FORCE_UNIQUENESS)); uint raid_chunks; MI_INFO *info; File datafile; @@ -935,7 +935,7 @@ static int myisamchk(HA_CHECK *param, char * filename) param->testflag|=T_REP_BY_SORT; /* if only STATISTICS */ if (!(param->testflag & T_SILENT)) printf("- '%s' has old table-format. Recreating index\n",filename); - rep_quick|=T_QUICK; + rep_quick= 1; } share=info->s; share->tot_locks-= share->r_locks; @@ -1111,7 +1111,7 @@ static int myisamchk(HA_CHECK *param, char * filename) if ((info->s->options & (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) || (param->testflag & (T_EXTEND | T_MEDIUM))) - error|=chk_data_link(param, info, param->testflag & T_EXTEND); + error|=chk_data_link(param, info, test(param->testflag & T_EXTEND)); error|=flush_blocks(param, share->key_cache, share->kfile); VOID(end_io_cache(¶m->read_cache)); } diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp index 99e57da25b0..fbe4b3d21c9 100644 --- a/support-files/compiler_warnings.supp +++ b/support-files/compiler_warnings.supp @@ -82,7 +82,7 @@ net_serv.cc : .*conversion from 'SOCKET' to 'int'.* # allow a little moving space for the warning below mi_packrec.c : .*result of 32-bit shift implicitly converted to 64 bits.* : 560-600 -ma_packrec.c : .*result of 32-bit shift implicitly converted to 64 bits.* : 560-600 +ma_packrec.c : .*result of 32-bit shift implicitly converted to 64 bits.* : 550-650 # # Wrong compiler warnings