diff options
author | monty@mysql.com <> | 2005-02-25 16:53:22 +0200 |
---|---|---|
committer | monty@mysql.com <> | 2005-02-25 16:53:22 +0200 |
commit | 0a6b7aedb2cec716b98349765bfa369354787b25 (patch) | |
tree | 9b48fa5a8476d449ea4512314b86f9704517cd0c | |
parent | cd78e701a5c83394c360f6ba9a1783c7b950e8ee (diff) | |
download | mariadb-git-0a6b7aedb2cec716b98349765bfa369354787b25.tar.gz |
Remove compiler warnings and remove not used variables
(Found during build process)
46 files changed, 115 insertions, 179 deletions
diff --git a/extra/comp_err.c b/extra/comp_err.c index a554fc2437e..85833999d5c 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -332,13 +332,13 @@ static int create_sys_files(struct languages *lang_head, head[30]= csnum; my_fseek(to, 0l, MY_SEEK_SET, MYF(0)); - if (my_fwrite(to, head, HEADER_LENGTH, MYF(MY_WME | MY_FNABP))) + if (my_fwrite(to, (byte*) head, HEADER_LENGTH, MYF(MY_WME | MY_FNABP))) goto err; for (i= 0; i < row_count; i++) { int2store(head, file_pos[i]); - if (my_fwrite(to, head, 2, MYF(MY_WME | MY_FNABP))) + if (my_fwrite(to, (byte*) head, 2, MYF(MY_WME | MY_FNABP))) goto err; } my_fclose(to, MYF(0)); diff --git a/extra/perror.c b/extra/perror.c index 6e632b20d96..d68f5230e4a 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -250,7 +250,8 @@ int main(int argc,char *argv[]) 'Unknown Error' (without regard to case). */ if (msg && - my_strnncoll(&my_charset_latin1, msg, 13, "Unknown Error", 13) && + my_strnncoll(&my_charset_latin1, (const uchar*) msg, 13, + (const uchar*) "Unknown Error", 13) && (!unknown_error || strcmp(msg, unknown_error))) { found=1; diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index 6ec4809790e..035c84621ab 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -2472,7 +2472,7 @@ dict_scan_id( my_isspace(). Only after that, convert id names to UTF-8. */ b = (byte*)(*id); - id_len = strlen(b); + id_len = strlen((char*) b); if (id_len >= 3 && b[id_len - 1] == 0xA0 && b[id_len - 2] == 0xC2) { diff --git a/innobase/dict/dict0load.c b/innobase/dict/dict0load.c index 7fd1ca08c04..1f4ebe810b4 100644 --- a/innobase/dict/dict0load.c +++ b/innobase/dict/dict0load.c @@ -184,7 +184,7 @@ loop: if (table == NULL) { fputs("InnoDB: Failed to load table ", stderr); - ut_print_namel(stderr, NULL, field, len); + ut_print_namel(stderr, NULL, (char*) field, len); putc('\n', stderr); } else { /* The table definition was corrupt if there diff --git a/innobase/pars/pars0sym.c b/innobase/pars/pars0sym.c index 194e6677183..8ade5579e47 100644 --- a/innobase/pars/pars0sym.c +++ b/innobase/pars/pars0sym.c @@ -220,7 +220,7 @@ sym_tab_add_id( node->resolved = FALSE; node->indirection = NULL; - node->name = mem_heap_strdupl(sym_tab->heap, name, len + 1); + node->name = mem_heap_strdupl(sym_tab->heap, (char*) name, len + 1); node->name_len = len; UT_LIST_ADD_LAST(sym_list, sym_tab->sym_list, node); diff --git a/innobase/row/row0row.c b/innobase/row/row0row.c index 43d0cd41b0a..438e54757cd 100644 --- a/innobase/row/row0row.c +++ b/innobase/row/row0row.c @@ -430,7 +430,7 @@ row_build_row_ref( dfield_set_len(dfield, dtype_get_at_most_n_mbchars( dfield_get_type(dfield), - clust_col_prefix_len, len, field)); + clust_col_prefix_len, len, (char*) field)); } } } @@ -525,7 +525,7 @@ row_build_row_ref_in_tuple( dfield_set_len(dfield, dtype_get_at_most_n_mbchars( dfield_get_type(dfield), - clust_col_prefix_len, len, field)); + clust_col_prefix_len, len, (char*) field)); } } } diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index 22cece487a0..e0995c589d1 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -112,7 +112,7 @@ row_sel_sec_rec_is_for_clust_rec( clust_len = dtype_get_at_most_n_mbchars( cur_type, ifield->prefix_len, - clust_len, clust_field); + clust_len, (char*) clust_field); } if (0 != cmp_data_data(dict_col_get_type(col), diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 353f8cd6430..79fe36615b9 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -28,10 +28,6 @@ extern "C" extern unsigned long max_allowed_packet, net_buffer_length; } -static int fake_argc= 1; -static char *fake_argv[]= {(char *)"", 0}; -static const char *fake_groups[] = { "server", "embedded", 0 }; - #if defined (__WIN__) #include "../sql/mysqld.cpp" #else diff --git a/myisam/mi_key.c b/myisam/mi_key.c index 6ac04d562e0..ab5ddd3a378 100644 --- a/myisam/mi_key.c +++ b/myisam/mi_key.c @@ -186,7 +186,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, FIX_LENGTH(cs, pos, length, char_length); memcpy((byte*) key, pos, char_length); if (length > char_length) - cs->cset->fill(cs, key+char_length, length-char_length, ' '); + cs->cset->fill(cs, (char*) key+char_length, length-char_length, ' '); key+= length; } _mi_dpointer(info,key,filepos); @@ -296,7 +296,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, FIX_LENGTH(cs, pos, length, char_length); memcpy((byte*) key, pos, char_length); if (length > char_length) - cs->cset->fill(cs,key+char_length, length-char_length, ' '); + cs->cset->fill(cs, (char*) key+char_length, length-char_length, ' '); key+= length; k_length-=length; } diff --git a/regex/engine.c b/regex/engine.c index 6734560b9bf..c4c4efe7e2f 100644 --- a/regex/engine.c +++ b/regex/engine.c @@ -256,7 +256,7 @@ sopno stopst; register char *ssp; /* start of string matched by subsubRE */ register char *sep; /* end of string matched by subsubRE */ register char *oldssp; /* previous ssp */ - register char *dp; + register char *dp; /* used in debug mode to check asserts */ AT("diss", start, stop, startst, stopst); sp = start; diff --git a/sql/derror.cc b/sql/derror.cc index 4690e76d0e3..bee818a14c1 100644 --- a/sql/derror.cc +++ b/sql/derror.cc @@ -78,7 +78,6 @@ static bool read_texts(const char *file_name,const char ***point, char name[FN_REFLEN]; const char *buff; uchar head[32],*pos; - CHARSET_INFO *cset; // For future DBUG_ENTER("read_texts"); *point=0; // If something goes wrong @@ -104,7 +103,7 @@ Please install the latest version of this file.",name); } /* TODO: Convert the character set to server system character set */ - if (!(cset= get_charset(head[30],MYF(MY_WME)))) + if (!get_charset(head[30],MYF(MY_WME))) { sql_print_error("Character set #%d is not supported for messagefile '%s'", (int)head[30],name); diff --git a/sql/examples/ha_archive.cc b/sql/examples/ha_archive.cc index 98ed65fc786..c519b411a24 100644 --- a/sql/examples/ha_archive.cc +++ b/sql/examples/ha_archive.cc @@ -600,13 +600,13 @@ int ha_archive::write_row(byte * buf) ptr != end ; ptr++) { - char *ptr; + char *data_ptr; uint32 size= ((Field_blob*) table->field[*ptr])->get_length(); if (size) { - ((Field_blob*) table->field[*ptr])->get_ptr(&ptr); - written= gzwrite(share->archive_write, ptr, (unsigned)size); + ((Field_blob*) table->field[*ptr])->get_ptr(&data_ptr); + written= gzwrite(share->archive_write, data_ptr, (unsigned)size); if (written != size) goto error; } @@ -630,7 +630,6 @@ error: int ha_archive::rnd_init(bool scan) { DBUG_ENTER("ha_archive::rnd_init"); - int read; // gzread() returns int, and we use this to check the header if (share->crashed) DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); diff --git a/sql/field.cc b/sql/field.cc index 194f4522851..1538edc59a3 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -797,7 +797,7 @@ bool Field::needs_quotes(void) { DBUG_ENTER("Field::type_quote"); - switch(type()) { + switch (type()) { //FIX this when kernel is fixed case MYSQL_TYPE_VARCHAR : case FIELD_TYPE_STRING : @@ -827,10 +827,9 @@ bool Field::needs_quotes(void) case FIELD_TYPE_SET : case FIELD_TYPE_ENUM : DBUG_RETURN(0); - - default: DBUG_RETURN(0); + default: + DBUG_RETURN(0); } - DBUG_RETURN(0); } @@ -5034,7 +5033,7 @@ int Field_str::store(double nr) double anr= fabs(nr); int neg= (nr < 0.0) ? 1 : 0; if (field_length > 4 && field_length < 32 && - (anr < 1.0 ? anr > 1/(log_10[max(0,field_length-neg-2)]) /* -2 for "0." */ + (anr < 1.0 ? anr > 1/(log_10[max(0,(int) field_length-neg-2)]) /* -2 for "0." */ : anr < log_10[field_length-neg]-1)) use_scientific_notation= FALSE; @@ -5453,7 +5452,6 @@ int Field_varstring::cmp(const char *a_ptr, const char *b_ptr) int Field_varstring::key_cmp(const byte *key_ptr, uint max_key_length) { - char *blob1; uint length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr); uint char_length= max_key_length / field_charset->mbmaxlen; @@ -5752,8 +5750,6 @@ void Field_varstring::set_key_image(char *buff,uint length) int Field_varstring::cmp_binary(const char *a_ptr, const char *b_ptr, uint32 max_length) { - char *a,*b; - uint diff; uint32 a_length,b_length; if (length_bytes == 1) @@ -7202,11 +7198,12 @@ uint32 calc_pack_length(enum_field_types type,uint32 length) case FIELD_TYPE_GEOMETRY: return 4+portable_sizeof_char_ptr; case FIELD_TYPE_SET: case FIELD_TYPE_ENUM: - case FIELD_TYPE_NEWDECIMAL: abort(); return 0; // This shouldn't happen + case FIELD_TYPE_NEWDECIMAL: + abort(); return 0; // This shouldn't happen case FIELD_TYPE_BIT: return length / 8; - default: return 0; + default: + return 0; } - return 0; // Keep compiler happy } diff --git a/sql/filesort.cc b/sql/filesort.cc index de14287003b..57ac113cfd5 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -772,7 +772,7 @@ static void make_sortkey(register SORTPARAM *param, */ SORT_ADDON_FIELD *addonf= param->addon_field; uchar *nulls= to; - DBUG_ASSERT(addonf); + DBUG_ASSERT(addonf != 0); bzero((char *) nulls, addonf->offset); to+= addonf->offset; for ( ; (field= addonf->field) ; addonf++) diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index d30435310dc..b5884b17093 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -494,7 +494,6 @@ int ha_heap::create(const char *name, TABLE *table_arg, for (; key_part != key_part_end; key_part++, seg++) { - uint flag= key_part->key_type; Field *field= key_part->field; if (pos->algorithm == HA_KEY_ALG_BTREE) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index eddc7616e66..f68ad99ac44 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -2594,8 +2594,6 @@ ha_innobase::write_row( int error; longlong auto_inc; longlong dummy; - ibool incremented_auto_inc_for_stat = FALSE; - ibool incremented_auto_inc_counter = FALSE; ibool auto_inc_used= FALSE; DBUG_ENTER("ha_innobase::write_row"); @@ -5098,17 +5096,16 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) while (tmp_buff[i] != '/') i++; tmp_buff+= i + 1; - f_key_info.forein_id= make_lex_string(thd, f_key_info.forein_id, + f_key_info.forein_id= make_lex_string(thd, 0, tmp_buff, strlen(tmp_buff), 1); tmp_buff= foreign->referenced_table_name; i= 0; while (tmp_buff[i] != '/') i++; - f_key_info.referenced_db= make_lex_string(thd, f_key_info.referenced_db, + f_key_info.referenced_db= make_lex_string(thd, 0, tmp_buff, i, 1); tmp_buff+= i + 1; - f_key_info.referenced_table= make_lex_string(thd, - f_key_info.referenced_table, + f_key_info.referenced_table= make_lex_string(thd, 0, tmp_buff, strlen(tmp_buff), 1); for (i= 0;;) @@ -5717,15 +5714,12 @@ innodb_mutex_show_status( Protocol *protocol= thd->protocol; List<Item> field_list; mutex_t* mutex; - const char* file_name; - ulint line; ulint rw_lock_count= 0; ulint rw_lock_count_spin_loop= 0; ulint rw_lock_count_spin_rounds= 0; ulint rw_lock_count_os_wait= 0; ulint rw_lock_count_os_yield= 0; ulonglong rw_lock_wait_time= 0; - DBUG_ENTER("innodb_mutex_show_status"); field_list.push_back(new Item_empty_string("Mutex", FN_REFLEN)); diff --git a/sql/handler.cc b/sql/handler.cc index b76fbe5ccd5..cd3656c6f0d 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -735,7 +735,7 @@ int ha_commit_or_rollback_by_xid(LEX_STRING *ident, bool commit) */ int ha_recover(HASH *commit_list) { - int error= 0, len, got; + int len, got; handlerton **ht= handlertons, **end_ht=ht+total_ha; XID *list=0; DBUG_ENTER("ha_recover"); @@ -907,7 +907,7 @@ int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv) for (; ht < end_ht; ht++) { int err; - DBUG_ASSERT((*ht)->savepoint_set); + DBUG_ASSERT((*ht)->savepoint_set != 0); if ((err= (*(*ht)->savepoint_rollback)(thd, (byte *)(sv+1)+(*ht)->savepoint_offset))) { // cannot happen my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err); @@ -2219,7 +2219,7 @@ TYPELIB *ha_known_exts(void) (found_exts.elements+1), MYF(MY_WME | MY_FAE)); - DBUG_ASSERT(ext); + DBUG_ASSERT(ext != 0); known_extensions.count= found_exts.elements; known_extensions.type_names= ext; diff --git a/sql/item.cc b/sql/item.cc index da9c98862b7..d192e174828 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -131,7 +131,6 @@ my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value) { String *res; char *end_ptr; - int error; if (!(res= val_str(&str_value))) return 0; // NULL or EOM @@ -1102,6 +1101,7 @@ bool Item_field::val_bool_result() case ROW_RESULT: default: DBUG_ASSERT(0); + return 0; // Shut up compiler } } @@ -2173,7 +2173,7 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list) else return NULL; - DBUG_ASSERT(field_name); + DBUG_ASSERT(field_name != 0); for (ORDER *cur_group= group_list ; cur_group ; cur_group= cur_group->next) { @@ -2182,7 +2182,7 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list) cur_field= (Item_field*) *cur_group->item; cur_match_degree= 0; - DBUG_ASSERT(cur_field->field_name); + DBUG_ASSERT(cur_field->field_name != 0); if (!my_strcasecmp(system_charset_info, cur_field->field_name, field_name)) @@ -2311,7 +2311,7 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select) { if (select_ref != not_found_item && !ambiguous_fields) { - DBUG_ASSERT(*select_ref); + DBUG_ASSERT(*select_ref != 0); if (!select->ref_pointer_array[counter]) { my_error(ER_ILLEGAL_REFERENCE, MYF(0), @@ -2488,7 +2488,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference) } } - DBUG_ASSERT(ref); + DBUG_ASSERT(ref != 0); if (!from_field) return TRUE; if (ref == not_found_item && from_field == not_found_field) @@ -2932,7 +2932,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table) void Item_field::make_field(Send_field *tmp_field) { field->make_field(tmp_field); - DBUG_ASSERT(tmp_field->table_name); + DBUG_ASSERT(tmp_field->table_name != 0); if (name) tmp_field->col_name=name; // Use user supplied name } @@ -3429,7 +3429,7 @@ Item_ref::Item_ref(Item **item, const char *table_name_par, /* This constructor used to create some internals references over fixed items */ - DBUG_ASSERT(ref); + DBUG_ASSERT(ref != 0); if (*ref) set_properties(); } @@ -3500,9 +3500,6 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference) { SELECT_LEX_UNIT *prev_unit= current_sel->master_unit(); SELECT_LEX *outer_sel= prev_unit->outer_select(); - ORDER *group_list= (ORDER*) current_sel->group_list.first; - bool ambiguous_fields= FALSE; - Item **group_by_ref= NULL; if (!(ref= resolve_ref_in_select_and_group(thd, this, current_sel))) return TRUE; /* Some error occurred (e.g. ambiguous names). */ @@ -3600,7 +3597,7 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference) break; /* Do not consider derived tables. */ } - DBUG_ASSERT(ref); + DBUG_ASSERT(ref != 0); if (!from_field) return TRUE; if (ref == not_found_item && from_field == not_found_field) @@ -4551,7 +4548,7 @@ void Item_cache_row::bring_value() Field *get_holder_example_field(THD *thd, Item *item, TABLE *table) { - DBUG_ASSERT(table); + DBUG_ASSERT(table != 0); Item_func *tmp_item= 0; if (item->type() == Item::FIELD_ITEM) diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index fe849bd213a..46b2770a12a 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1514,7 +1514,7 @@ int subselect_indexsubquery_engine::exec() uint subselect_single_select_engine::cols() { - DBUG_ASSERT(select_lex->join); // should be called after fix_fields() + DBUG_ASSERT(select_lex->join != 0); // should be called after fix_fields() return select_lex->join->fields_list.elements; } diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 9a4798b9dc9..3df985b6c99 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -532,7 +532,7 @@ bool Item_sum_sum_distinct::setup(THD *thd) void Item_sum_sum_distinct::clear() { DBUG_ENTER("Item_sum_sum_distinct::clear"); - DBUG_ASSERT(tree); /* we always have a tree */ + DBUG_ASSERT(tree != 0); /* we always have a tree */ null_value= 1; tree->reset(); DBUG_VOID_RETURN; @@ -554,7 +554,7 @@ bool Item_sum_sum_distinct::add() my_decimal value, *val= args[0]->val_decimal(&value); if (!args[0]->null_value) { - DBUG_ASSERT(tree); + DBUG_ASSERT(tree != 0); null_value= 0; my_decimal2binary(E_DEC_FATAL_ERROR, val, (char *) dec_bin_buff, args[0]->max_length, args[0]->decimals); @@ -567,7 +567,7 @@ bool Item_sum_sum_distinct::add() double val= args[0]->val_real(); if (!args[0]->null_value) { - DBUG_ASSERT(tree); + DBUG_ASSERT(tree != 0); null_value= 0; DBUG_PRINT("info", ("real: %lg, tree 0x%lx", val, (ulong)tree)); if (val) @@ -1179,7 +1179,6 @@ double Item_sum_hybrid::val_real() DBUG_ASSERT(0); return 0; } - return 0; // Keep compiler happy } longlong Item_sum_hybrid::val_int() diff --git a/sql/item_sum.h b/sql/item_sum.h index eca2ae188db..3faf4914eac 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -701,7 +701,6 @@ public: int err_not_used; char *end; String *res; - longlong value; CHARSET_INFO *cs; if (!(res= val_str(&str_value))) diff --git a/sql/log.cc b/sql/log.cc index a873d75def9..63e8df66881 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -606,7 +606,7 @@ bool MYSQL_LOG::open(const char *log_name, write_file_name_to_index_file= 1; } - DBUG_ASSERT(my_b_inited(&index_file)); + DBUG_ASSERT(my_b_inited(&index_file) != 0); reinit_io_cache(&index_file, WRITE_CACHE, my_b_filelength(&index_file), 0, 0); if (need_start_event && !no_auto_events) @@ -2454,7 +2454,7 @@ void sql_print_information(const char *format, ...) */ #define TC_LOG_HEADER_SIZE (sizeof(tc_log_magic)+1) -static const char tc_log_magic[]={254, 0x23, 0x05, 0x74}; +static const char tc_log_magic[]={(char) 254, 0x23, 0x05, 0x74}; uint opt_tc_log_size=TC_LOG_MIN_SIZE; ulong tc_log_max_pages_used=0, tc_log_page_size=0, @@ -2921,7 +2921,6 @@ int TC_LOG_BINLOG::open(const char *opt_name) { const char *errmsg; - char last_event_type=UNKNOWN_EVENT; IO_CACHE log; File file; Log_event *ev=0; diff --git a/sql/log_event.cc b/sql/log_event.cc index 75d682fa6cd..c8a69b06380 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -673,7 +673,7 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, #endif { DBUG_ENTER("Log_event::read_log_event(IO_CACHE *, Format_description_log_event *"); - DBUG_ASSERT(description_event); + DBUG_ASSERT(description_event != 0); char head[LOG_EVENT_MINIMAL_HEADER_LEN]; /* First we only want to read at most LOG_EVENT_MINIMAL_HEADER_LEN, just to @@ -741,7 +741,7 @@ err: UNLOCK_MUTEX; if (!res) { - DBUG_ASSERT(error); + DBUG_ASSERT(error != 0); sql_print_error("Error in Log_event::read_log_event(): " "'%s', data_len: %d, event_type: %d", error,data_len,head[EVENT_TYPE_OFFSET]); @@ -772,7 +772,7 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len, { Log_event* ev; DBUG_ENTER("Log_event::read_log_event(char*,...)"); - DBUG_ASSERT(description_event); + DBUG_ASSERT(description_event != 0); DBUG_PRINT("info", ("binlog_version: %d", description_event->binlog_version)); if (event_len < EVENT_LEN_OFFSET || (uint) event_len != uint4korr(buf+EVENT_LEN_OFFSET)) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ed5fbd34ea7..2f1ab052cbd 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -838,9 +838,9 @@ static void __cdecl kill_server(int sig_ptr) #define RETURN_FROM_KILL_SERVER DBUG_VOID_RETURN #endif { - int sig=(int) (long) sig_ptr; // This is passed a int DBUG_ENTER("kill_server"); #ifndef EMBEDDED_LIBRARY + int sig=(int) (long) sig_ptr; // This is passed a int // if there is a signal during the kill in progress, ignore the other if (kill_in_progress) // Safety RETURN_FROM_KILL_SERVER; @@ -1166,7 +1166,7 @@ err: static void set_user(const char *user, struct passwd *user_info) { #if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) - DBUG_ASSERT(user_info); + DBUG_ASSERT(user_info != 0); #ifdef HAVE_INITGROUPS /* We can get a SIGSEGV when calling initgroups() on some systems when NSS @@ -1195,7 +1195,7 @@ static void set_user(const char *user, struct passwd *user_info) static void set_effective_user(struct passwd *user_info) { #if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) - DBUG_ASSERT(user_info); + DBUG_ASSERT(user_info != 0); if (setregid((gid_t)-1, user_info->pw_gid) == -1) { sql_perror("setregid"); @@ -2334,8 +2334,11 @@ const char *load_default_groups[]= { "mysql_cluster", #endif "mysqld","server", MYSQL_BASE_VERSION, 0, 0}; + +#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) static const int load_default_groups_sz= sizeof(load_default_groups)/sizeof(load_default_groups[0]); +#endif /* Initialize one of the global date/time format variables @@ -3391,7 +3394,6 @@ int main(int argc, char **argv) static void bootstrap(FILE *file) { - int error= 0; DBUG_ENTER("bootstrap"); THD *thd= new THD; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 0418225965a..8200b2ab584 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2011,7 +2011,6 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, TABLE_READ_PLAN **roru_read_plans; TABLE_READ_PLAN **cur_roru_plan; double roru_index_costs; - double blocks_in_index_read; ha_rows roru_total_records; double roru_intersect_part= 1.0; DBUG_ENTER("get_best_disjunct_quick"); @@ -2077,7 +2076,6 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, roru_read_plans= (TABLE_READ_PLAN**)range_scans; goto skip_to_ror_scan; } - blocks_in_index_read= imerge_cost; if (cpk_scan) { /* @@ -5654,7 +5652,7 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() cur_quick_it.rewind(); cur_quick= cur_quick_it++; - DBUG_ASSERT(cur_quick); + DBUG_ASSERT(cur_quick != 0); /* We reuse the same instance of handler so we need to call both init and @@ -6099,7 +6097,7 @@ int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length, byte *cur_prefix) if (range) { /* Read the next record in the same range with prefix after cur_prefix. */ - DBUG_ASSERT(cur_prefix); + DBUG_ASSERT(cur_prefix != 0); result= file->index_read(record, cur_prefix, prefix_length, HA_READ_AFTER_KEY); if (result || (file->compare_key(file->end_range) <= 0)) diff --git a/sql/slave.cc b/sql/slave.cc index 629a4590858..9849feaf6fa 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1556,7 +1556,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db, save_db = thd->db; save_db_length= thd->db_length; thd->db = (char*)db; - DBUG_ASSERT(thd->db); + DBUG_ASSERT(thd->db != 0); thd->db_length= strlen(thd->db); mysql_parse(thd, thd->query, packet_len); // run create table thd->db = save_db; // leave things the way the were before @@ -4031,7 +4031,7 @@ static int queue_binlog_ver_1_event(MASTER_INFO *mi, const char *buf, */ { /* We come here when and only when tmp_buf != 0 */ - DBUG_ASSERT(tmp_buf); + DBUG_ASSERT(tmp_buf != 0); inc_pos=event_len; ev->log_pos+= inc_pos; int error = process_io_create_file(mi,(Create_file_log_event*)ev); diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc index 3b60f0936f9..43d85165e02 100644 --- a/sql/sp_pcontext.cc +++ b/sql/sp_pcontext.cc @@ -105,7 +105,6 @@ sp_pcontext::diff_handlers(sp_pcontext *ctx) uint sp_pcontext::diff_cursors(sp_pcontext *ctx) { - uint n= 0; sp_pcontext *pctx= this; while (pctx && pctx != ctx) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 651fa947694..b3b913cda5c 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -877,7 +877,6 @@ int acl_getroot(THD *thd, USER_RESOURCES *mqh, */ int acl_getroot_no_password(THD *thd) { - ulong user_access= NO_ACCESS; int res= 1; uint i; ACL_USER *acl_user= 0; @@ -1660,7 +1659,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, Check that the user isn't trying to change a password for another user if he doesn't have UPDATE privilege to the MySQL database */ - DBUG_ASSERT(combo.host.str); + DBUG_ASSERT(combo.host.str != 0); if (thd->user && combo.password.str && (strcmp(thd->user,combo.user.str) || my_strcasecmp(system_charset_info, @@ -2634,7 +2633,6 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list, { class LEX_COLUMN *column; List_iterator <LEX_COLUMN> column_iter(columns); - int res; if (open_and_lock_tables(thd, table_list)) DBUG_RETURN(TRUE); @@ -3473,7 +3471,6 @@ bool check_grant_all_columns(THD *thd, ulong want_access, GRANT_INFO *grant, { GRANT_TABLE *grant_table; GRANT_COLUMN *grant_column; - Field *field=0; want_access &= ~grant->privilege; if (!want_access) @@ -4796,7 +4793,6 @@ static void append_user(String *str, LEX_USER *user) bool mysql_create_user(THD *thd, List <LEX_USER> &list) { int result; - int found; String wrong_users; ulong sql_mode; LEX_USER *user_name; @@ -4817,7 +4813,7 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list) Search all in-memory structures and grant tables for a mention of the new user name. */ - if ((found= handle_grant_data(tables, 0, user_name, NULL))) + if (handle_grant_data(tables, 0, user_name, NULL)) { append_user(&wrong_users, user_name); result= TRUE; @@ -4859,7 +4855,6 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list) bool mysql_drop_user(THD *thd, List <LEX_USER> &list) { int result; - int found; String wrong_users; LEX_USER *user_name; List_iterator <LEX_USER> user_list(list); @@ -4875,7 +4870,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list) while ((user_name= user_list++)) { - if ((found= handle_grant_data(tables, 1, user_name, NULL)) <= 0) + if (handle_grant_data(tables, 1, user_name, NULL) <= 0) { append_user(&wrong_users, user_name); result= TRUE; @@ -4907,7 +4902,6 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list) bool mysql_rename_user(THD *thd, List <LEX_USER> &list) { int result= 0; - int found; String wrong_users; LEX_USER *user_from; LEX_USER *user_to; @@ -4925,7 +4919,7 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list) while ((user_from= user_list++)) { user_to= user_list++; - DBUG_ASSERT(user_to); /* Syntax enforces pairs of users. */ + DBUG_ASSERT(user_to != 0); /* Syntax enforces pairs of users. */ /* Search all in-memory structures and grant tables @@ -5137,7 +5131,6 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name) { uint counter, revoked; int result; - ACL_DB *acl_db; TABLE_LIST tables[GRANT_TABLES]; DBUG_ENTER("sp_revoke_privileges"); @@ -5148,10 +5141,10 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name) VOID(pthread_mutex_lock(&acl_cache->lock)); /* Remove procedure access */ - do { + do + { for (counter= 0, revoked= 0 ; counter < proc_priv_hash.records ; ) { - const char *db,*name; GRANT_NAME *grant_proc= (GRANT_NAME*) hash_element(&proc_priv_hash, counter); if (!my_strcasecmp(system_charset_info, grant_proc->db, sp_db) && diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 642de13039e..1056bff4315 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -467,7 +467,7 @@ void field_real::add() void field_decimal::add() { my_decimal dec_buf, *dec= item->val_decimal(&dec_buf); - uint length, zero_count, decs; + uint length; TREE_ELEMENT *element; if (item->null_value) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 68a43f71e55..6b75fd1847b 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -149,7 +149,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild) TABLE *entry=(TABLE*) hash_element(&open_cache,idx); TABLE_SHARE *share= entry->s; - DBUG_ASSERT(share->table_name); + DBUG_ASSERT(share->table_name != 0); if ((!share->table_name)) // To be removed continue; // Shouldn't happen if (wild) @@ -962,7 +962,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, } else { - DBUG_ASSERT(table_list->view); + DBUG_ASSERT(table_list->view != 0); VOID(pthread_mutex_unlock(&LOCK_open)); DBUG_RETURN(0); // VIEW } @@ -1188,7 +1188,7 @@ bool reopen_table(TABLE *table,bool locked) table->s= &table->share_not_to_be_used; table->file->change_table_ptr(table); - DBUG_ASSERT(table->alias); + DBUG_ASSERT(table->alias != 0); for (field=table->field ; *field ; field++) { (*field)->table= (*field)->orig_table= table; @@ -2781,7 +2781,6 @@ bool setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, { reg2 Item *item; List_iterator<Item> it(fields); - SELECT_LEX *select_lex= thd->lex->current_select; DBUG_ENTER("setup_fields"); thd->set_query_id=set_query_id; @@ -2839,7 +2838,7 @@ TABLE_LIST **make_leaves_list(TABLE_LIST **list, TABLE_LIST *tables) if (table->view && !table->table) { /* it is for multi table views only, check it */ - DBUG_ASSERT(table->ancestor->next_local); + DBUG_ASSERT(table->ancestor->next_local != 0); list= make_leaves_list(list, table->ancestor); } else @@ -3255,7 +3254,6 @@ err: int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves, COND **conds) { - table_map not_null_tables= 0; SELECT_LEX *select_lex= thd->lex->current_select; Item_arena *arena= thd->current_arena, backup; bool save_wrapper= thd->lex->current_select->no_wrap_view_item; diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 1705a25c124..2a421800ddb 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -773,11 +773,10 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, file->name[2] == 'c' && file->name[3] == '\0') { /* .frm archive */ - char newpath[FN_REFLEN], *copy_of_path; + char newpath[FN_REFLEN]; MY_DIR *new_dirp; - uint length; strxmov(newpath, org_path, "/", "arc", NullS); - length= unpack_filename(newpath, newpath); + (void) unpack_filename(newpath, newpath); if ((new_dirp = my_dir(newpath, MYF(MY_DONT_SORT)))) { DBUG_PRINT("my",("Archive subdir found: %s", newpath)); diff --git a/sql/sql_help.cc b/sql/sql_help.cc index 759b535da53..f5490da7e85 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -640,7 +640,7 @@ bool mysqld_help(THD *thd, const char *mask) List<String> topics_list, categories_list, subcategories_list; String name, description, example; - int res, count_topics, count_categories, error; + int count_topics, count_categories, error; uint mlen= strlen(mask); MEM_ROOT *mem_root= thd->mem_root; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 892e7746353..e08838886ae 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1726,7 +1726,6 @@ bool mysql_insert_select_prepare(THD *thd) { LEX *lex= thd->lex; TABLE_LIST *first_select_leaf_table; - int res; DBUG_ENTER("mysql_insert_select_prepare"); /* SELECT_LEX do not belong to INSERT statement, so we can't add WHERE @@ -1744,7 +1743,7 @@ bool mysql_insert_select_prepare(THD *thd) exclude first table from leaf tables list, because it belong to INSERT */ - DBUG_ASSERT(lex->select_lex.leaf_tables); + DBUG_ASSERT(lex->select_lex.leaf_tables != 0); lex->leaf_tables_insert= lex->select_lex.leaf_tables; /* skip all leaf tables belonged to view where we are insert */ for (first_select_leaf_table= lex->select_lex.leaf_tables->next_leaf; diff --git a/sql/sql_load.cc b/sql/sql_load.cc index efd914003dc..174ccdfab5b 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -104,7 +104,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, */ char *tdb= thd->db ? thd->db : db; // Result is never null ulong skip_lines= ex->skip_lines; - int res; bool transactional_table; DBUG_ENTER("mysql_load"); @@ -144,8 +143,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, { // Part field list thd->dupp_field=0; /* TODO: use this conds for 'WITH CHECK OPTIONS' */ - Item *unused_conds= 0; - TABLE_LIST *leaves= 0; if (setup_fields(thd, 0, table_list, fields, 1, 0, 0)) DBUG_RETURN(TRUE); if (thd->dupp_field) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 63d92ca0e5f..03cbb087a12 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -622,7 +622,6 @@ bool is_update_query(enum enum_sql_command command) static void time_out_user_resource_limits(THD *thd, USER_CONN *uc) { - bool error= 0; time_t check_time = thd->start_time ? thd->start_time : time(NULL); DBUG_ENTER("time_out_user_resource_limits"); @@ -1327,7 +1326,6 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion) { bool do_release= 0; int res= 0; - LEX *lex= thd->lex; DBUG_ENTER("end_trans"); switch (completion) { @@ -1788,9 +1786,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd, { statistic_increment(thd->status_var.com_stat[SQLCOM_DROP_DB], &LOCK_status); - char *db=thd->strdup(packet), *alias; + char *db=thd->strdup(packet); /* null test to handle EOM */ - if (!db || !(alias= thd->strdup(db)) || check_db_name(db)) + if (!db || check_db_name(db)) { my_error(ER_WRONG_DB_NAME, MYF(0), db ? db : "NULL"); break; @@ -3539,8 +3537,7 @@ unsent_create_error: } case SQLCOM_DROP_DB: { - char *alias; - if (!(alias=thd->strdup(lex->name)) || check_db_name(lex->name)) + if (check_db_name(lex->name)) { my_error(ER_WRONG_DB_NAME, MYF(0), lex->name); break; @@ -3989,7 +3986,7 @@ unsent_create_error: char *name, *db; int result; - DBUG_ASSERT(lex->sphead); + DBUG_ASSERT(lex->sphead != 0); if (check_access(thd, CREATE_PROC_ACL, lex->sphead->m_db.str, 0, 0, 0)) { diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 93197b1a2eb..7da5c13e18a 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -849,7 +849,7 @@ static bool insert_params_from_vars_with_log(Prepared_statement *stmt, varname= var_it++; if (get_var_with_binlog(stmt->thd, *varname, &entry)) DBUG_RETURN(1); - DBUG_ASSERT(entry); + DBUG_ASSERT(entry != 0); if (param->set_from_user_var(stmt->thd, entry)) DBUG_RETURN(1); @@ -1008,7 +1008,7 @@ static int mysql_test_update(Prepared_statement *stmt, { if (table_list->ancestor && table_list->ancestor->next_local) { - DBUG_ASSERT(table_list->view); + DBUG_ASSERT(table_list->view != 0); DBUG_PRINT("info", ("Switch to multi-update")); /* pass counter value */ thd->lex->table_count= table_count; @@ -1661,7 +1661,6 @@ error: static bool init_param_array(Prepared_statement *stmt) { LEX *lex= stmt->lex; - THD *thd= stmt->thd; if ((stmt->param_count= lex->param_list.elements)) { if (stmt->param_count > (uint) UINT_MAX16) @@ -2165,7 +2164,6 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length) ulong stmt_id= uint4korr(packet); ulong num_rows= uint4korr(packet+=4); Statement *stmt; - int error; DBUG_ENTER("mysql_stmt_fetch"); if (!(stmt= thd->stmt_map.find(stmt_id)) || @@ -2183,7 +2181,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length) my_pthread_setprio(pthread_self(), QUERY_PRIOR); thd->protocol= &thd->protocol_prep; // Switch to binary protocol - error= stmt->cursor->fetch(num_rows); + (void) stmt->cursor->fetch(num_rows); thd->protocol= &thd->protocol_simple; // Use normal protocol if (!(specialflag & SPECIAL_NO_PRIOR)) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index f7ff9254f64..41c321d78d7 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1940,7 +1940,6 @@ Cursor::close() { DBUG_ASSERT(lock || open_tables || derived_tables); - TABLE *tmp_open_tables= thd->open_tables; TABLE *tmp_derived_tables= thd->derived_tables; MYSQL_LOCK *tmp_lock= thd->lock; @@ -7743,7 +7742,6 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, case Item::SUM_FUNC_ITEM: { Item_sum *item_sum=(Item_sum*) item; - bool maybe_null=item_sum->maybe_null; Field *result= item_sum->create_tmp_field(group, table, convert_blob_length); if (!result) thd->fatal_error(); @@ -8884,12 +8882,10 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records) int error; JOIN_TAB *first_unmatched; JOIN_TAB *tab; - bool found= 0; /* Cache variables for faster loop */ COND *select_cond= join_tab->select_cond; - JOIN_TAB *first_inner_tab= join_tab->first_inner; - my_bool *report_error= &(join->thd->net.report_error); + join->return_tab= join_tab; if (join_tab->last_inner) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ae0b591a403..1339b5e5ed0 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -341,7 +341,6 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) Protocol *protocol= thd->protocol; char buff[2048]; String buffer(buff, sizeof(buff), system_charset_info); - int res; DBUG_ENTER("mysqld_show_create"); DBUG_PRINT("enter",("db: %s table: %s",table_list->db, table_list->table_name)); @@ -535,7 +534,6 @@ void mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild) { TABLE *table; - int res; DBUG_ENTER("mysqld_list_fields"); DBUG_PRINT("enter",("table: %s",table_list->table_name)); @@ -1951,7 +1949,7 @@ void store_schema_shemata(TABLE *table, const char *db_name, int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond) { - char path[FN_REFLEN],*end; + char path[FN_REFLEN]; bool found_libchar; INDEX_FIELD_VALUES idx_field_vals; List<char> files; @@ -2193,7 +2191,6 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, const char *base_name, const char *file_name) { - TIME time; LEX *lex= thd->lex; const char *wild= lex->wild ? lex->wild->ptr() : NullS; CHARSET_INFO *cs= system_charset_info; @@ -2225,14 +2222,12 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, if (!wild || !wild[0] || !wild_case_compare(system_charset_info, field->field_name,wild)) { - uint tmp_length; const char *tmp_buff; byte *pos; uint flags=field->flags; char tmp[MAX_FIELD_WIDTH]; char tmp1[MAX_FIELD_WIDTH]; String type(tmp,sizeof(tmp), system_charset_info); - char tmp_buffer[128]; count++; restore_record(table, s->default_values); table->field[1]->store(base_name, strlen(base_name), cs); @@ -2339,7 +2334,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, (field->flags & MULTIPLE_KEY_FLAG) ? "MUL":""); table->field[15]->store((const char*) pos, strlen((const char*) pos), cs); - char *end=tmp; + char *end= tmp; if (field->unireg_check == Field::NEXT_NUMBER) end=strmov(tmp,"auto_increment"); table->field[16]->store(tmp, (uint) (end-tmp), cs); @@ -2444,7 +2439,6 @@ int fill_schema_collation(THD *thd, TABLE_LIST *tables, COND *cond) int fill_schema_coll_charset_app(THD *thd, TABLE_LIST *tables, COND *cond) { CHARSET_INFO **cs; - const char *wild= NullS; TABLE *table= tables->table; CHARSET_INFO *scs= system_charset_info; for ( cs= all_charsets ; cs < all_charsets+255 ; cs++ ) @@ -2797,7 +2791,6 @@ static int get_schema_key_column_usage_record(THD *thd, const char *file_name) { DBUG_ENTER("get_schema_key_column_usage_record"); - CHARSET_INFO *cs= system_charset_info; if (res) { if (!tables->view) @@ -2823,7 +2816,6 @@ static int get_schema_key_column_usage_record(THD *thd, KEY_PART_INFO *key_part= key_info->key_part; for (uint j=0 ; j < key_info->key_parts ; j++,key_part++) { - uint f_idx= 0; if (key_part->field) { f_idx++; @@ -2844,13 +2836,13 @@ static int get_schema_key_column_usage_record(THD *thd, List_iterator_fast<FOREIGN_KEY_INFO> it(f_key_list); while ((f_key_info= it++)) { - LEX_STRING *f_info, *r_info; + LEX_STRING *f_info; List_iterator_fast<LEX_STRING> it(f_key_info->foreign_fields), it1(f_key_info->referenced_fields); uint f_idx= 0; while ((f_info= it++)) { - r_info= it1++; + it1++; // Ignore r_info f_idx++; restore_record(table, s->default_values); store_key_column_usage(table, base_name, file_name, diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f87a60c4fda..7ab1a0a3777 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -688,7 +688,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, it.rewind(); while ((sql_field=it++)) { - DBUG_ASSERT(sql_field->charset); + DBUG_ASSERT(sql_field->charset != 0); switch (sql_field->sql_type) { case FIELD_TYPE_BLOB: diff --git a/sql/sql_union.cc b/sql/sql_union.cc index c2d401d3a7f..455c83e1718 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -379,7 +379,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, for (Field **field= table->field; *field; field++) { Item_field *item_field= (Item_field*) it++; - DBUG_ASSERT(item_field); + DBUG_ASSERT(item_field != 0); item_field->reset_field(*field); } } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 80ad13195c8..54a976fe2b0 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -141,7 +141,7 @@ int mysql_update(THD *thd, if (table_list->ancestor && table_list->ancestor->next_local) { - DBUG_ASSERT(table_list->view); + DBUG_ASSERT(table_list->view != 0); DBUG_PRINT("info", ("Switch to multi-update")); /* pass counter value */ thd->lex->table_count= table_count; @@ -191,6 +191,7 @@ int mysql_update(THD *thd, table_list->grant.want_privilege= table->grant.want_privilege= want_privilege; #endif { + bool res; select_lex->no_wrap_view_item= 1; res= setup_fields(thd, 0, table_list, fields, 1, 0, 0); select_lex->no_wrap_view_item= 0; @@ -815,7 +816,6 @@ bool mysql_multi_update(THD *thd, enum enum_duplicates handle_duplicates, bool ignore, SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex) { - bool res= FALSE; multi_update *result; DBUG_ENTER("mysql_multi_update"); @@ -834,14 +834,14 @@ bool mysql_multi_update(THD *thd, MODE_STRICT_ALL_TABLES)); List<Item> total_list; - res= mysql_select(thd, &select_lex->ref_pointer_array, - table_list, select_lex->with_wild, - total_list, - conds, 0, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL, - (ORDER *)NULL, - options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK | - OPTION_SETUP_TABLES_DONE, - result, unit, select_lex); + (void) mysql_select(thd, &select_lex->ref_pointer_array, + table_list, select_lex->with_wild, + total_list, + conds, 0, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL, + (ORDER *)NULL, + options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK | + OPTION_SETUP_TABLES_DONE, + result, unit, select_lex); delete result; thd->abort_on_warning= 0; DBUG_RETURN(TRUE); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index ba1b999b240..3b03b66c61e 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3235,7 +3235,6 @@ alter: } sp_a_chistics { - THD *thd= YYTHD; LEX *lex=Lex; lex->sql_command= SQLCOM_ALTER_PROCEDURE; @@ -3249,7 +3248,6 @@ alter: } sp_a_chistics { - THD *thd= YYTHD; LEX *lex=Lex; lex->sql_command= SQLCOM_ALTER_FUNCTION; @@ -4480,7 +4478,6 @@ simple_expr: { $$= new Item_int((char*) "TRUE",1,1); } | ident '.' ident '(' udf_expr_list ')' { - LEX *lex= Lex; sp_name *name= new sp_name($1, $3); name->init_qname(YYTHD); @@ -6429,24 +6426,24 @@ field_term_list: field_term: TERMINATED BY text_string { - DBUG_ASSERT(Lex->exchange); + DBUG_ASSERT(Lex->exchange != 0); Lex->exchange->field_term= $3; } | OPTIONALLY ENCLOSED BY text_string { LEX *lex= Lex; - DBUG_ASSERT(lex->exchange); + DBUG_ASSERT(lex->exchange != 0); lex->exchange->enclosed= $4; lex->exchange->opt_enclosed= 1; } | ENCLOSED BY text_string { - DBUG_ASSERT(Lex->exchange); + DBUG_ASSERT(Lex->exchange != 0); Lex->exchange->enclosed= $3; } | ESCAPED BY text_string { - DBUG_ASSERT(Lex->exchange); + DBUG_ASSERT(Lex->exchange != 0); Lex->exchange->escaped= $3; }; @@ -6461,12 +6458,12 @@ line_term_list: line_term: TERMINATED BY text_string { - DBUG_ASSERT(Lex->exchange); + DBUG_ASSERT(Lex->exchange != 0); Lex->exchange->line_term= $3; } | STARTING BY text_string { - DBUG_ASSERT(Lex->exchange); + DBUG_ASSERT(Lex->exchange != 0); Lex->exchange->line_start= $3; }; @@ -6474,7 +6471,7 @@ opt_ignore_lines: /* empty */ | IGNORE_SYM NUM LINES { - DBUG_ASSERT(Lex->exchange); + DBUG_ASSERT(Lex->exchange != 0); Lex->exchange->skip_lines= atol($2.str); }; @@ -7306,7 +7303,6 @@ option_value: } | NAMES_SYM charset_name_or_default opt_collate { - THD *thd= YYTHD; LEX *lex= Lex; $2= $2 ? $2 : global_system_variables.character_set_client; $3= $3 ? $3 : $2; diff --git a/sql/strfunc.cc b/sql/strfunc.cc index ca1a4b64af9..c822d10af46 100644 --- a/sql/strfunc.cc +++ b/sql/strfunc.cc @@ -147,7 +147,7 @@ uint find_type(TYPELIB *lib, const char *find, uint length, bool part_match) uint find_type2(TYPELIB *typelib, const char *x, uint length, CHARSET_INFO *cs) { - int find,pos; + int pos; const char *j; DBUG_ENTER("find_type2"); DBUG_PRINT("enter",("x: '%.*s' lib: 0x%lx", length, x, typelib)); @@ -158,7 +158,7 @@ uint find_type2(TYPELIB *typelib, const char *x, uint length, CHARSET_INFO *cs) DBUG_RETURN(0); } - for (find=0, pos=0 ; (j=typelib->type_names[pos]) ; pos++) + for (pos=0 ; (j=typelib->type_names[pos]) ; pos++) { if (!my_strnncoll(cs, (const uchar*) x, length, (const uchar*) j, typelib->type_lengths[pos])) diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index a3f96a947a7..797bc9f9047 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -372,7 +372,7 @@ static int my_strnxfrm_ucs2(CHARSET_INFO *cs, dst+=res; } if (dst < de) - cs->cset->fill(cs, dst, de - dst, ' '); + cs->cset->fill(cs, (char*) dst, de - dst, ' '); return dstlen; } @@ -1385,7 +1385,7 @@ int my_strnxfrm_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), if (dst != src) memcpy(dst,src,srclen= min(dstlen,srclen)); if (dstlen > srclen) - cs->cset->fill(cs, dst + srclen, dstlen - srclen, ' '); + cs->cset->fill(cs, (char*) dst + srclen, dstlen - srclen, ' '); return dstlen; } diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 1eb0151767d..c3f44dc7263 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -3351,7 +3351,7 @@ static void test_bind_result() MYSQL_STMT *stmt; int rc; int nData; - ulong length, length1; + ulong length1; char szData[100]; MYSQL_BIND bind[2]; my_bool is_null[2]; @@ -3416,7 +3416,6 @@ static void test_bind_result() DIE_UNLESS(strcmp(szData, "MySQL") == 0); DIE_UNLESS(length1 == 5); - length= 99; rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); @@ -5350,7 +5349,6 @@ static void test_prepare_alter() { MYSQL_STMT *stmt; int rc, id; - long length; MYSQL_BIND bind[1]; my_bool is_null; @@ -5385,7 +5383,6 @@ static void test_prepare_alter() check_execute(stmt, rc); id= 30; - length= 0; rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); @@ -11620,14 +11617,13 @@ static void test_bug6059() { MYSQL_STMT *stmt; const char *stmt_text; - int rc; myheader("test_bug6059"); stmt_text= "SELECT 'foo' INTO OUTFILE 'x.3'"; stmt= mysql_stmt_init(mysql); - rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + (void) mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); DIE_UNLESS(mysql_stmt_field_count(stmt) == 0); mysql_stmt_close(stmt); } diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c index 1be0242c505..1ae8f908dc2 100644 --- a/tools/mysqlmanager.c +++ b/tools/mysqlmanager.c @@ -557,14 +557,13 @@ HANDLE_DECL(handle_set_exec_stderr) static int set_exec_param(struct manager_thd* thd, char* args_start, char* args_end, PARAM_TYPE param_type) { - int num_args; const char* error=0; struct manager_exec* e; char* arg_p; char* param; int param_size; - if ((num_args=tokenize_args(args_start,&args_end))<2) + if (tokenize_args(args_start,&args_end) < 2) { error="Too few arguments"; goto err; @@ -607,12 +606,11 @@ err: HANDLE_DECL(handle_start_exec) { - int num_args; struct manager_exec* e; int ident_len; const char* error=0; struct timespec t; - if ((num_args=tokenize_args(args_start,&args_end))<1) + if (tokenize_args(args_start,&args_end) < 1) { error="Too few arguments"; goto err; @@ -656,12 +654,11 @@ err: HANDLE_DECL(handle_stop_exec) { - int num_args; struct timespec abstime; struct manager_exec* e; int ident_len; const char* error=0; - if ((num_args=tokenize_args(args_start,&args_end))<2) + if (tokenize_args(args_start,&args_end) <2) { error="Too few arguments"; goto err; |