diff options
author | unknown <monty@mysql.com/nosik.monty.fi> | 2008-02-13 21:27:12 +0200 |
---|---|---|
committer | unknown <monty@mysql.com/nosik.monty.fi> | 2008-02-13 21:27:12 +0200 |
commit | 8170b22b5ca69386fb2fcab479e989d084ca8774 (patch) | |
tree | c9f42ae47947ad30ffb90ccbff93062277e8f846 /sql | |
parent | 3056d07a86d86dc35925c1de12b9d432816517c8 (diff) | |
download | mariadb-git-8170b22b5ca69386fb2fcab479e989d084ca8774.tar.gz |
Fixed compiler warnings in a lot of files
Added IMPOSSIBLE_RESULT to avoid compiler warnings when using (Item_result) -1 as a dummy value
Changed PAGE_SIZE to TEST_PAGE_SIZE to avoid compiler errors on systems where PAGE_SIZE is defined
client/get_password.c:
Fixed compiler warning
cmd-line-utils/readline/bind.c:
Fixed compiler warning
cmd-line-utils/readline/chardefs.h:
Fixed compiler warning by adding marco to be used when largest_char is 255
cmd-line-utils/readline/display.c:
Fixed compiler warnings by removing not accessed variables
cmd-line-utils/readline/histexpand.c:
Fixed compiler warnings by removing not accessed variables
cmd-line-utils/readline/history.c:
Fixed compiler warnings by adding cast
cmd-line-utils/readline/text.c:
Fixed compiler warnings by removing not accessed variables and adding casts
dbug/dbug.c:
Fixed compiler warnings by changing types
include/mysql_com.h:
Added IMPOSSIBLE_RESULT to avoid compiler warnings when using (Item_result) -1 as a dummy value
libmysql/libmysql.c:
Fixed compiler warning
mysql-test/t/query_cache_debug.test:
Mark test as BIG as it uses a lot of memory
mysys/mf_iocache2.c:
Fixed compiler warnings by adding cast
sql/event_data_objects.cc:
Fixed compiler warnings by removing not used code
sql/events.cc:
Fixed compiler warnings by removing not used code
sql/field.cc:
Fixed compiler warnings by adding cast and removed not accessed variables
sql/ha_partition.cc:
Fixed compiler warnings by removing not used code
sql/item.cc:
Fixed compiler warnings by removing not accessed variables
Use IMPOSSIBLE_RESULT instead of (Item_result)-1
sql/item_cmpfunc.cc:
Fixed compiler warnings by removing not accessed variables
sql/item_func.cc:
Fixed compiler warnings by removing not used code and not accessed variables
Added IMPOSSIBLE_RESULT
sql/item_subselect.cc:
Fixed compiler warnings by removing not accessed variables
sql/item_xmlfunc.cc:
Fixed forgotten setting of xpath->error
sql/log.cc:
Fixed compiler warnings by removing not accessed variables
sql/log_event.cc:
Added IMPOSSIBLE_RESULT into switch
Fixed wrong usage of DBUG_ASSERT(1)
Removed always true DBUG_ASSERT()
sql/mysqld.cc:
Fixed compiler warnings by adding casts for ULONG_MAX
sql/opt_sum.cc:
Fixed compiler warnings by removing not used code
Removed wrong DBUG_ASSERT()
sql/partition_info.cc:
Fixed compiler warnings by removing not accessed variables
sql/rpl_injector.h:
Removed always true part from DBUG_ASSERT() to remove compiler warning
sql/spatial.cc:
Fixed compiler warnings by removing not accessed variables
sql/sql_acl.cc:
Fixed compiler warnings by removing not accessed variables
sql/sql_base.cc:
Fixed compiler warnings by removing not accessed variables
sql/sql_cache.cc:
Fixed compiler warnings by removing not accessed variables
sql/sql_class.cc:
Fixed compiler warnings by:
- Removing always true part from DBUG_ASSERT()
- Removing not used code
- Added IMPOSSIBLE_RESULT into switch
sql/sql_load.cc:
Fixed compiler warnings by removing not accessed variables
sql/sql_parse.cc:
Fixed compiler warnings by:
- Removing not accessed variables
- Removing always true part from DBUG_ASSERT()
- Removing not used code
sql/sql_plugin.cc:
Added comment
sql/sql_prepare.cc:
Fixed compiler warnings by removing not accessed variables
sql/sql_show.cc:
Fixed compiler warnings by using correct cast
sql/sql_table.cc:
Fixed compiler warnings by removing not used code and removing not accessed variables
sql/table.cc:
Fixed compiler warnings by removing not accessed variables
sql/time.cc:
Fixed wrong DBUG_ASSERT(1)
storage/maria/unittest/Makefile.am:
Changed PAGE_SIZE to TEST_PAGE_SIZE to avoid compiler errors on systems where PAGE_SIZE is defined
storage/maria/unittest/ma_pagecache_consist.c:
Changed PAGE_SIZE to TEST_PAGE_SIZE to avoid compiler errors on systems where PAGE_SIZE is defined
storage/maria/unittest/ma_pagecache_single.c:
Changed PAGE_SIZE to TEST_PAGE_SIZE to avoid compiler errors on systems where PAGE_SIZE is defined
tests/mysql_client_test.c:
Fixed compiler warnings by removing not accessed variables and changing types
Diffstat (limited to 'sql')
-rw-r--r-- | sql/event_data_objects.cc | 1 | ||||
-rw-r--r-- | sql/events.cc | 1 | ||||
-rw-r--r-- | sql/field.cc | 10 | ||||
-rw-r--r-- | sql/ha_partition.cc | 1 | ||||
-rw-r--r-- | sql/item.cc | 8 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 3 | ||||
-rw-r--r-- | sql/item_func.cc | 17 | ||||
-rw-r--r-- | sql/item_subselect.cc | 12 | ||||
-rw-r--r-- | sql/item_xmlfunc.cc | 2 | ||||
-rw-r--r-- | sql/log.cc | 6 | ||||
-rw-r--r-- | sql/log_event.cc | 12 | ||||
-rw-r--r-- | sql/mysqld.cc | 70 | ||||
-rw-r--r-- | sql/opt_sum.cc | 10 | ||||
-rw-r--r-- | sql/partition_info.cc | 2 | ||||
-rw-r--r-- | sql/rpl_injector.h | 2 | ||||
-rw-r--r-- | sql/spatial.cc | 2 | ||||
-rw-r--r-- | sql/sql_acl.cc | 2 | ||||
-rw-r--r-- | sql/sql_base.cc | 8 | ||||
-rw-r--r-- | sql/sql_cache.cc | 10 | ||||
-rw-r--r-- | sql/sql_class.cc | 7 | ||||
-rw-r--r-- | sql/sql_load.cc | 5 | ||||
-rw-r--r-- | sql/sql_parse.cc | 41 | ||||
-rw-r--r-- | sql/sql_plugin.cc | 2 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 3 | ||||
-rw-r--r-- | sql/sql_show.cc | 6 | ||||
-rw-r--r-- | sql/sql_table.cc | 3 | ||||
-rw-r--r-- | sql/table.cc | 3 | ||||
-rw-r--r-- | sql/time.cc | 2 |
28 files changed, 119 insertions, 132 deletions
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index f4b64ab3012..f4962fb35ff 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -1246,7 +1246,6 @@ bool get_next_time(const Time_zone *time_zone, my_time_t *next, would give an error then. */ DBUG_RETURN(1); - break; case INTERVAL_LAST: DBUG_ASSERT(0); } diff --git a/sql/events.cc b/sql/events.cc index 87385082a82..f32b23a23eb 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -319,7 +319,6 @@ common_1_lev_code: case INTERVAL_MICROSECOND: my_error(ER_NOT_SUPPORTED_YET, MYF(0), "MICROSECOND"); return 1; - break; case INTERVAL_QUARTER: expr/= 3; close_quote= FALSE; diff --git a/sql/field.cc b/sql/field.cc index 7c4f6c9ff5f..6e521c05778 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2951,18 +2951,18 @@ int Field_tiny::store(double nr) } else if (nr > 255.0) { - *ptr=(char) 255; + *ptr= (uchar) 255; set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); error= 1; } else - *ptr=(char) nr; + *ptr= (uchar) nr; } else { if (nr < -128.0) { - *ptr= (char) -128; + *ptr= (uchar) -128; set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); error= 1; } @@ -2973,7 +2973,7 @@ int Field_tiny::store(double nr) error= 1; } else - *ptr=(char) (int) nr; + *ptr=(uchar) (int) nr; } return error; } @@ -5514,7 +5514,6 @@ int Field_date::store(const char *from, uint len,CHARSET_INFO *cs) int Field_date::store(double nr) { longlong tmp; - int error= 0; if (nr >= 19000000000000.0 && nr <= 99991231235959.0) nr=floor(nr/1000000.0); // Timestamp to date if (nr < 0.0 || nr > 99991231.0) @@ -5523,7 +5522,6 @@ int Field_date::store(double nr) set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, nr, MYSQL_TIMESTAMP_DATE); - error= 1; } else tmp= (longlong) rint(nr); diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index a74322acee1..8c6ed76ddff 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4923,7 +4923,6 @@ int ha_partition::extra(enum ha_extra_function operation) /* Category 3), used by MyISAM handlers */ case HA_EXTRA_PREPARE_FOR_RENAME: DBUG_RETURN(prepare_for_rename()); - break; case HA_EXTRA_NORMAL: case HA_EXTRA_QUICK: case HA_EXTRA_NO_READCHECK: diff --git a/sql/item.cc b/sql/item.cc index c546badd8e7..021decd9e75 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -254,11 +254,9 @@ my_decimal *Item::val_decimal_from_int(my_decimal *decimal_value) my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value) { String *res; - char *end_ptr; if (!(res= val_str(&str_value))) return 0; // NULL or EOM - end_ptr= (char*) res->ptr()+ res->length(); if (str2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM, res->ptr(), res->length(), res->charset(), decimal_value) & E_DEC_BAD_NUM) @@ -382,7 +380,7 @@ Item::Item(): maybe_null=null_value=with_sum_func=unsigned_flag=0; decimals= 0; max_length= 0; with_subselect= 0; - cmp_context= (Item_result)-1; + cmp_context= IMPOSSIBLE_RESULT; /* Put item in free list so that we can free all items at end */ THD *thd= current_thd; @@ -4188,7 +4186,7 @@ Item *Item_field::equal_fields_propagator(uchar *arg) DATE/TIME represented as an int and as a string. */ if (!item || - (cmp_context != (Item_result)-1 && item->cmp_context != cmp_context)) + (cmp_context != IMPOSSIBLE_RESULT && item->cmp_context != cmp_context)) item= this; return item; } @@ -4240,7 +4238,7 @@ Item *Item_field::replace_equal_field(uchar *arg) Item *const_item= item_equal->get_const(); if (const_item) { - if (cmp_context != (Item_result)-1 && + if (cmp_context != IMPOSSIBLE_RESULT && const_item->cmp_context != cmp_context) return this; return const_item; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index dc868376796..d28b4e172f3 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -845,12 +845,11 @@ int Arg_comparator::set_cmp_func(Item_bool_func2 *owner_arg, Item **a1, Item **a2, Item_result type) { - enum enum_date_cmp_type cmp_type; ulonglong const_value= (ulonglong)-1; a= a1; b= a2; - if ((cmp_type= can_compare_as_dates(*a, *b, &const_value))) + if (can_compare_as_dates(*a, *b, &const_value)) { thd= current_thd; owner= owner_arg; diff --git a/sql/item_func.cc b/sql/item_func.cc index 748624c0357..47db346023a 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -450,7 +450,6 @@ Field *Item_func::tmp_table_field(TABLE *table) break; case STRING_RESULT: return make_string_field(table); - break; case DECIMAL_RESULT: field= new Field_new_decimal(my_decimal_precision_to_length(decimal_precision(), decimals, @@ -2710,8 +2709,7 @@ longlong Item_func_find_in_set::val_int() } null_value=0; - int diff; - if ((diff=buffer->length() - find->length()) >= 0) + if ((int) (buffer->length() - find->length()) >= 0) { my_wc_t wc; CHARSET_INFO *cs= cmp_collation.collation; @@ -3973,7 +3971,8 @@ double user_var_entry::val_real(my_bool *null_value) case STRING_RESULT: return my_atof(value); // This is null terminated case ROW_RESULT: - DBUG_ASSERT(1); // Impossible + case IMPOSSIBLE_RESULT: + DBUG_ASSERT(0); // Impossible break; } return 0.0; // Impossible @@ -4004,7 +4003,8 @@ longlong user_var_entry::val_int(my_bool *null_value) return my_strtoll10(value, (char**) 0, &error);// String is null terminated } case ROW_RESULT: - DBUG_ASSERT(1); // Impossible + case IMPOSSIBLE_RESULT: + DBUG_ASSERT(0); // Impossible break; } return LL(0); // Impossible @@ -4035,8 +4035,10 @@ String *user_var_entry::val_str(my_bool *null_value, String *str, case STRING_RESULT: if (str->copy(value, length, collation.collation)) str= 0; // EOM error + break; case ROW_RESULT: - DBUG_ASSERT(1); // Impossible + case IMPOSSIBLE_RESULT: + DBUG_ASSERT(0); // Impossible break; } return(str); @@ -4063,7 +4065,8 @@ my_decimal *user_var_entry::val_decimal(my_bool *null_value, my_decimal *val) str2my_decimal(E_DEC_FATAL_ERROR, value, length, collation.collation, val); break; case ROW_RESULT: - DBUG_ASSERT(1); // Impossible + case IMPOSSIBLE_RESULT: + DBUG_ASSERT(0); // Impossible break; } return(val); diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 46b8d2e46cc..9dd41ff3770 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1021,9 +1021,9 @@ Item_in_subselect::single_value_transformer(JOIN *join, SELECT_LEX_UNIT *master_unit= select_lex->master_unit(); substitution= optimizer; - SELECT_LEX *current= thd->lex->current_select, *up; + SELECT_LEX *current= thd->lex->current_select; - thd->lex->current_select= up= current->return_after_parsing(); + thd->lex->current_select= current->return_after_parsing(); //optimizer never use Item **ref => we can pass 0 as parameter if (!optimizer || optimizer->fix_left(thd, 0)) { @@ -1244,8 +1244,8 @@ Item_in_subselect::row_value_transformer(JOIN *join) SELECT_LEX_UNIT *master_unit= select_lex->master_unit(); substitution= optimizer; - SELECT_LEX *current= thd->lex->current_select, *up; - thd->lex->current_select= up= current->return_after_parsing(); + SELECT_LEX *current= thd->lex->current_select; + thd->lex->current_select= current->return_after_parsing(); //optimizer never use Item **ref => we can pass 0 as parameter if (!optimizer || optimizer->fix_left(thd, 0)) { @@ -1483,7 +1483,7 @@ Item_subselect::trans_res Item_in_subselect::select_in_like_transformer(JOIN *join, Comp_creator *func) { Query_arena *arena, backup; - SELECT_LEX *current= thd->lex->current_select, *up; + SELECT_LEX *current= thd->lex->current_select; const char *save_where= thd->where; Item_subselect::trans_res res= RES_ERROR; bool result; @@ -1512,7 +1512,7 @@ Item_in_subselect::select_in_like_transformer(JOIN *join, Comp_creator *func) goto err; } - thd->lex->current_select= up= current->return_after_parsing(); + thd->lex->current_select= current->return_after_parsing(); result= (!left_expr->fixed && left_expr->fix_fields(thd, optimizer->arguments())); /* fix_fields can change reference to left_expr, we need reassign it */ diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index 68d85418324..0e13830a3b1 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -2024,8 +2024,8 @@ static int my_xpath_parse_OrExpr(MY_XPATH *xpath) Item *prev= xpath->item; if (!my_xpath_parse_AndExpr(xpath)) { - return 0; xpath->error= 1; + return 0; } xpath->item= new Item_cond_or(nodeset2bool(xpath, prev), nodeset2bool(xpath, xpath->item)); diff --git a/sql/log.cc b/sql/log.cc index c027c9343a1..550285026b2 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -4476,10 +4476,12 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer) int vprint_msg_to_log(enum loglevel level, const char *format, va_list args) { char buff[1024]; - size_t length; DBUG_ENTER("vprint_msg_to_log"); - length= my_vsnprintf(buff, sizeof(buff), format, args); +#ifdef __NT__ + size_t length= +#endif + my_vsnprintf(buff, sizeof(buff), format, args); print_buffer_to_file(level, buff); #ifdef __NT__ diff --git a/sql/log_event.cc b/sql/log_event.cc index 2c89f8cbba6..33a74a3ce31 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -4602,8 +4602,9 @@ void User_var_log_event::pack_info(Protocol* protocol) } break; case ROW_RESULT: + case IMPOSSIBLE_RESULT: default: - DBUG_ASSERT(1); + DBUG_ASSERT(0); return; } } @@ -4690,8 +4691,9 @@ bool User_var_log_event::write(IO_CACHE* file) pos= (uchar*) val; break; case ROW_RESULT: + case IMPOSSIBLE_RESULT: default: - DBUG_ASSERT(1); + DBUG_ASSERT(0); return 0; } int4store(buf1 + 2 + UV_CHARSET_NUMBER_SIZE, val_len); @@ -4809,7 +4811,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) break; case ROW_RESULT: default: - DBUG_ASSERT(1); + DBUG_ASSERT(0); return; } } @@ -4871,8 +4873,9 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli) it= new Item_string(val, val_len, charset); break; case ROW_RESULT: + case IMPOSSIBLE_RESULT: default: - DBUG_ASSERT(1); + DBUG_ASSERT(0); return 0; } } @@ -8566,7 +8569,6 @@ Incident_log_event::description() const DBUG_PRINT("info", ("m_incident: %d", m_incident)); - DBUG_ASSERT(0 <= m_incident); DBUG_ASSERT((size_t) m_incident <= sizeof(description)/sizeof(*description)); return description[m_incident]; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 3a1ef0b237c..36dda2a4178 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5418,7 +5418,8 @@ struct my_option my_long_options[] = (uchar**) &opt_binlog_rows_event_max_size, (uchar**) &opt_binlog_rows_event_max_size, 0, GET_ULONG, REQUIRED_ARG, - /* def_value */ 1024, /* min_value */ 256, /* max_value */ ULONG_MAX, + /* def_value */ 1024, /* min_value */ 256, + /* max_value */ (longlong) ULONG_MAX, /* sub_size */ 0, /* block_size */ 256, /* app_type */ 0 }, @@ -5665,7 +5666,7 @@ Disable with --skip-large-pages.", #ifdef HAVE_MMAP {"log-tc-size", OPT_LOG_TC_SIZE, "Size of transaction coordinator log.", (uchar**) &opt_tc_log_size, (uchar**) &opt_tc_log_size, 0, GET_ULONG, - REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, ULONG_MAX, 0, + REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, (longlong) ULONG_MAX, 0, TC_LOG_PAGE_SIZE, 0}, #endif {"log-update", OPT_UPDATE_LOG, @@ -6132,7 +6133,7 @@ log and this option does nothing anymore.", {"warnings", 'W', "Deprecated; use --log-warnings instead.", (uchar**) &global_system_variables.log_warnings, (uchar**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, - 1, 0, ULONG_MAX, 0, 0, 0}, + 1, 0, (longlong) ULONG_MAX, 0, 0, 0}, { "back_log", OPT_BACK_LOG, "The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.", (uchar**) &back_log, (uchar**) &back_log, 0, GET_ULONG, @@ -6140,12 +6141,12 @@ log and this option does nothing anymore.", {"binlog_cache_size", OPT_BINLOG_CACHE_SIZE, "The size of the cache to hold the SQL statements for the binary log during a transaction. If you often use big, multi-statement transactions you can increase this to get more performance.", (uchar**) &binlog_cache_size, (uchar**) &binlog_cache_size, 0, GET_ULONG, - REQUIRED_ARG, 32*1024L, IO_SIZE, ULONG_MAX, 0, IO_SIZE, 0}, + REQUIRED_ARG, 32*1024L, IO_SIZE, (longlong) ULONG_MAX, 0, IO_SIZE, 0}, {"bulk_insert_buffer_size", OPT_BULK_INSERT_BUFFER_SIZE, "Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread!", (uchar**) &global_system_variables.bulk_insert_buff_size, (uchar**) &max_system_variables.bulk_insert_buff_size, - 0, GET_ULONG, REQUIRED_ARG, 8192*1024, 0, ULONG_MAX, 0, 1, 0}, + 0, GET_ULONG, REQUIRED_ARG, 8192*1024, 0, (longlong) ULONG_MAX, 0, 1, 0}, {"connect_timeout", OPT_CONNECT_TIMEOUT, "The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake'.", (uchar**) &connect_timeout, (uchar**) &connect_timeout, @@ -6168,7 +6169,7 @@ log and this option does nothing anymore.", {"delayed_insert_limit", OPT_DELAYED_INSERT_LIMIT, "After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT statements pending. If so, it allows these to execute before continuing.", (uchar**) &delayed_insert_limit, (uchar**) &delayed_insert_limit, 0, GET_ULONG, - REQUIRED_ARG, DELAYED_LIMIT, 1, ULONG_MAX, 0, 1, 0}, + REQUIRED_ARG, DELAYED_LIMIT, 1, (longlong) ULONG_MAX, 0, 1, 0}, {"delayed_insert_timeout", OPT_DELAYED_INSERT_TIMEOUT, "How long a INSERT DELAYED thread should wait for INSERT statements before terminating.", (uchar**) &delayed_insert_timeout, (uchar**) &delayed_insert_timeout, 0, @@ -6176,7 +6177,7 @@ log and this option does nothing anymore.", { "delayed_queue_size", OPT_DELAYED_QUEUE_SIZE, "What size queue (in rows) should be allocated for handling INSERT DELAYED. If the queue becomes full, any client that does INSERT DELAYED will wait until there is room in the queue again.", (uchar**) &delayed_queue_size, (uchar**) &delayed_queue_size, 0, GET_ULONG, - REQUIRED_ARG, DELAYED_QUEUE_SIZE, 1, ULONG_MAX, 0, 1, 0}, + REQUIRED_ARG, DELAYED_QUEUE_SIZE, 1, (longlong) ULONG_MAX, 0, 1, 0}, {"div_precision_increment", OPT_DIV_PRECINCREMENT, "Precision of the result of '/' operator will be increased on that value.", (uchar**) &global_system_variables.div_precincrement, @@ -6216,7 +6217,7 @@ log and this option does nothing anymore.", "The maximum length of the result of function group_concat.", (uchar**) &global_system_variables.group_concat_max_len, (uchar**) &max_system_variables.group_concat_max_len, 0, GET_ULONG, - REQUIRED_ARG, 1024, 4, ULONG_MAX, 0, 1, 0}, + REQUIRED_ARG, 1024, 4, (longlong) ULONG_MAX, 0, 1, 0}, {"interactive_timeout", OPT_INTERACTIVE_TIMEOUT, "The number of seconds the server waits for activity on an interactive connection before closing it.", (uchar**) &global_system_variables.net_interactive_timeout, @@ -6226,7 +6227,7 @@ log and this option does nothing anymore.", "The size of the buffer that is used for full joins.", (uchar**) &global_system_variables.join_buff_size, (uchar**) &max_system_variables.join_buff_size, 0, GET_ULONG, - REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ULONG_MAX, + REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, (longlong) ULONG_MAX, MALLOC_OVERHEAD, IO_SIZE, 0}, {"keep_files_on_create", OPT_KEEP_FILES_ON_CREATE, "Don't overwrite stale .MYD and .MYI even if no directory is specified.", @@ -6245,7 +6246,7 @@ log and this option does nothing anymore.", (uchar**) &dflt_key_cache_var.param_age_threshold, (uchar**) 0, 0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG, - 300, 100, ULONG_MAX, 0, 100, 0}, + 300, 100, (longlong) ULONG_MAX, 0, 100, 0}, {"key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE, "The default size of key cache blocks", (uchar**) &dflt_key_cache_var.param_block_size, @@ -6281,7 +6282,8 @@ log and this option does nothing anymore.", {"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE, "Can be used to restrict the total size used to cache a multi-transaction query.", (uchar**) &max_binlog_cache_size, (uchar**) &max_binlog_cache_size, 0, - GET_ULONG, REQUIRED_ARG, ULONG_MAX, IO_SIZE, ULONG_MAX, 0, IO_SIZE, 0}, + GET_ULONG, REQUIRED_ARG, (longlong) ULONG_MAX, IO_SIZE, + (longlong) ULONG_MAX, 0, IO_SIZE, 0}, {"max_binlog_size", OPT_MAX_BINLOG_SIZE, "Binary log will be rotated automatically when the size exceeds this \ value. Will also apply to relay logs if max_relay_log_size is 0. \ @@ -6291,7 +6293,7 @@ The minimum value for this variable is 4096.", {"max_connect_errors", OPT_MAX_CONNECT_ERRORS, "If there is more than this number of interrupted connections from a host this host will be blocked from further connections.", (uchar**) &max_connect_errors, (uchar**) &max_connect_errors, 0, GET_ULONG, - REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, ULONG_MAX, 0, 1, 0}, + REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, (longlong) ULONG_MAX, 0, 1, 0}, // Default max_connections of 151 is larger than Apache's default max // children, to avoid "too many connections" error in a common setup {"max_connections", OPT_MAX_CONNECTIONS, @@ -6336,7 +6338,7 @@ The minimum value for this variable is 4096.", "Limit assumed max number of seeks when looking up rows based on a key", (uchar**) &global_system_variables.max_seeks_for_key, (uchar**) &max_system_variables.max_seeks_for_key, 0, GET_ULONG, - REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0 }, + REQUIRED_ARG, (longlong) ULONG_MAX, 1, (longlong) ULONG_MAX, 0, 1, 0 }, {"max_sort_length", OPT_MAX_SORT_LENGTH, "The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored).", (uchar**) &global_system_variables.max_sort_length, @@ -6351,7 +6353,7 @@ The minimum value for this variable is 4096.", "Maximum number of temporary tables a client can keep open at a time.", (uchar**) &global_system_variables.max_tmp_tables, (uchar**) &max_system_variables.max_tmp_tables, 0, GET_ULONG, - REQUIRED_ARG, 32, 1, ULONG_MAX, 0, 1, 0}, + REQUIRED_ARG, 32, 1, (longlong) ULONG_MAX, 0, 1, 0}, {"max_user_connections", OPT_MAX_USER_CONNECTIONS, "The maximum number of active connections for a single user (0 = no limit).", (uchar**) &max_user_connections, (uchar**) &max_user_connections, 0, GET_UINT, @@ -6359,17 +6361,17 @@ The minimum value for this variable is 4096.", {"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT, "After this many write locks, allow some read locks to run in between.", (uchar**) &max_write_lock_count, (uchar**) &max_write_lock_count, 0, GET_ULONG, - REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0}, + REQUIRED_ARG, (longlong) ULONG_MAX, 1, (longlong) ULONG_MAX, 0, 1, 0}, {"min_examined_row_limit", OPT_MIN_EXAMINED_ROW_LIMIT, "Don't log queries which examine less than min_examined_row_limit rows to file.", (uchar**) &global_system_variables.min_examined_row_limit, (uchar**) &max_system_variables.min_examined_row_limit, 0, GET_ULONG, - REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1L, 0}, + REQUIRED_ARG, 0, 0, (longlong) ULONG_MAX, 0, 1L, 0}, {"multi_range_count", OPT_MULTI_RANGE_COUNT, "Number of key ranges to request at once.", (uchar**) &global_system_variables.multi_range_count, (uchar**) &max_system_variables.multi_range_count, 0, - GET_ULONG, REQUIRED_ARG, 256, 1, ULONG_MAX, 0, 1, 0}, + GET_ULONG, REQUIRED_ARG, 256, 1, (longlong) ULONG_MAX, 0, 1, 0}, {"myisam_block_size", OPT_MYISAM_BLOCK_SIZE, "Block size to be used for MyISAM index pages.", (uchar**) &opt_myisam_block_size, @@ -6391,12 +6393,12 @@ The minimum value for this variable is 4096.", "Number of threads to use when repairing MyISAM tables. The value of 1 disables parallel repair.", (uchar**) &global_system_variables.myisam_repair_threads, (uchar**) &max_system_variables.myisam_repair_threads, 0, - GET_ULONG, REQUIRED_ARG, 1, 1, ULONG_MAX, 0, 1, 0}, + GET_ULONG, REQUIRED_ARG, 1, 1, (longlong) ULONG_MAX, 0, 1, 0}, {"myisam_sort_buffer_size", OPT_MYISAM_SORT_BUFFER_SIZE, "The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE.", (uchar**) &global_system_variables.myisam_sort_buff_size, (uchar**) &max_system_variables.myisam_sort_buff_size, 0, - GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ULONG_MAX, 0, 1, 0}, + GET_ULONG, REQUIRED_ARG, 8192*1024, 4, (longlong) ULONG_MAX, 0, 1, 0}, {"myisam_use_mmap", OPT_MYISAM_USE_MMAP, "Use memory mapping for reading and writing MyISAM tables", (uchar**) &opt_myisam_use_mmap, @@ -6422,7 +6424,8 @@ The minimum value for this variable is 4096.", "If a read on a communication port is interrupted, retry this many times before giving up.", (uchar**) &global_system_variables.net_retry_count, (uchar**) &max_system_variables.net_retry_count,0, - GET_ULONG, REQUIRED_ARG, MYSQLD_NET_RETRY_COUNT, 1, ULONG_MAX, 0, 1, 0}, + GET_ULONG, REQUIRED_ARG, MYSQLD_NET_RETRY_COUNT, 1, (longlong) ULONG_MAX, + 0, 1, 0}, {"net_write_timeout", OPT_NET_WRITE_TIMEOUT, "Number of seconds to wait for a block to be written to a connection before aborting the write.", (uchar**) &global_system_variables.net_write_timeout, @@ -6464,17 +6467,18 @@ The minimum value for this variable is 4096.", "Allocation block size for query parsing and execution", (uchar**) &global_system_variables.query_alloc_block_size, (uchar**) &max_system_variables.query_alloc_block_size, 0, GET_ULONG, - REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ULONG_MAX, 0, 1024, 0}, + REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, (longlong) ULONG_MAX, 0, 1024, + 0}, #ifdef HAVE_QUERY_CACHE {"query_cache_limit", OPT_QUERY_CACHE_LIMIT, "Don't cache results that are bigger than this.", (uchar**) &query_cache_limit, (uchar**) &query_cache_limit, 0, GET_ULONG, - REQUIRED_ARG, 1024*1024L, 0, ULONG_MAX, 0, 1, 0}, + REQUIRED_ARG, 1024*1024L, 0, (longlong) ULONG_MAX, 0, 1, 0}, {"query_cache_min_res_unit", OPT_QUERY_CACHE_MIN_RES_UNIT, "minimal size of unit in wich space for results is allocated (last unit will be trimed after writing all result data.", (uchar**) &query_cache_min_res_unit, (uchar**) &query_cache_min_res_unit, 0, GET_ULONG, REQUIRED_ARG, QUERY_CACHE_MIN_RESULT_DATA_SIZE, - 0, ULONG_MAX, 0, 1, 0}, + 0, (longlong) ULONG_MAX, 0, 1, 0}, #endif /*HAVE_QUERY_CACHE*/ {"query_cache_size", OPT_QUERY_CACHE_SIZE, "The memory allocated to store results from old queries.", @@ -6497,13 +6501,13 @@ The minimum value for this variable is 4096.", (uchar**) &global_system_variables.query_prealloc_size, (uchar**) &max_system_variables.query_prealloc_size, 0, GET_ULONG, REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, QUERY_ALLOC_PREALLOC_SIZE, - ULONG_MAX, 0, 1024, 0}, + (longlong) ULONG_MAX, 0, 1024, 0}, {"range_alloc_block_size", OPT_RANGE_ALLOC_BLOCK_SIZE, "Allocation block size for storing ranges during optimization", (uchar**) &global_system_variables.range_alloc_block_size, (uchar**) &max_system_variables.range_alloc_block_size, 0, GET_ULONG, - REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, RANGE_ALLOC_BLOCK_SIZE, ULONG_MAX, - 0, 1024, 0}, + REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, RANGE_ALLOC_BLOCK_SIZE, + (longlong) ULONG_MAX, 0, 1024, 0}, {"read_buffer_size", OPT_RECORD_BUFFER, "Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value.", (uchar**) &global_system_variables.read_buff_size, @@ -6561,13 +6565,13 @@ The minimum value for this variable is 4096.", "Each thread that needs to do a sort allocates a buffer of this size.", (uchar**) &global_system_variables.sortbuff_size, (uchar**) &max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG, - MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, ULONG_MAX, MALLOC_OVERHEAD, - 1, 0}, + MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, (longlong) ULONG_MAX, + MALLOC_OVERHEAD, 1, 0}, {"sync-binlog", OPT_SYNC_BINLOG, "Synchronously flush binary log to disk after every #th event. " "Use 0 (default) to disable synchronous flushing.", (uchar**) &sync_binlog_period, (uchar**) &sync_binlog_period, 0, GET_ULONG, - REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1, 0}, + REQUIRED_ARG, 0, 0, (longlong) ULONG_MAX, 0, 1, 0}, {"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default.", (uchar**) &opt_sync_frm, (uchar**) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, @@ -6605,7 +6609,7 @@ The minimum value for this variable is 4096.", {"thread_stack", OPT_THREAD_STACK, "The stack size for each thread.", (uchar**) &my_thread_stack_size, (uchar**) &my_thread_stack_size, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK, - 1024L*128L, ULONG_MAX, 0, 1024, 0}, + 1024L*128L, (longlong) ULONG_MAX, 0, 1024, 0}, { "time_format", OPT_TIME_FORMAT, "The TIME format (for future).", (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME], @@ -6621,12 +6625,14 @@ The minimum value for this variable is 4096.", "Allocation block size for transactions to be stored in binary log", (uchar**) &global_system_variables.trans_alloc_block_size, (uchar**) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG, - REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ULONG_MAX, 0, 1024, 0}, + REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, (longlong) ULONG_MAX, 0, 1024, + 0}, {"transaction_prealloc_size", OPT_TRANS_PREALLOC_SIZE, "Persistent buffer for transactions to be stored in binary log", (uchar**) &global_system_variables.trans_prealloc_size, (uchar**) &max_system_variables.trans_prealloc_size, 0, GET_ULONG, - REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ULONG_MAX, 0, 1024, 0}, + REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, (longlong) ULONG_MAX, 0, + 1024, 0}, {"thread_handling", OPT_THREAD_HANDLING, "Define threads usage for handling queries: " "one-thread-per-connection or no-threads", 0, 0, diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index 42d36756845..334eae55265 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -966,15 +966,11 @@ static int maxmin_in_range(bool max_fl, Field* field, COND *cond) SELECT MAX(b) FROM t1 WHERE a=const AND b<const */ if (max_fl != less_fl) - return cond->val_int() == 0; // Return 1 if WHERE is false + return cond->val_int() == 0; // Return 1 if WHERE is false return 0; } - case Item_func::EQ_FUNC: - case Item_func::EQUAL_FUNC: - break; - default: // Keep compiler happy - DBUG_ASSERT(1); // Impossible - break; + default: + break; // Ignore } return 0; } diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 3b580422da1..1ce5a0c2206 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -987,13 +987,11 @@ bool partition_info::set_up_charset_field_preps() i= 0; while ((field= *(ptr++))) { - CHARSET_INFO *cs; uchar *field_buf; LINT_INIT(field_buf); if (!field_is_partition_charset(field)) continue; - cs= ((Field_str*)field)->charset(); size= field->pack_length(); if (!(field_buf= (uchar*) sql_calloc(size))) goto error; diff --git a/sql/rpl_injector.h b/sql/rpl_injector.h index 4ece092c5b8..a31ff31a44f 100644 --- a/sql/rpl_injector.h +++ b/sql/rpl_injector.h @@ -290,7 +290,7 @@ public: "START_STATE", "TABLE_STATE", "ROW_STATE", "STATE_COUNT" }; - DBUG_ASSERT(0 <= target_state && target_state <= STATE_COUNT); + DBUG_ASSERT(target_state <= STATE_COUNT); DBUG_PRINT("info", ("In state %s", state_name[m_state])); #endif diff --git a/sql/spatial.cc b/sql/spatial.cc index 97e5fcfa27a..9e59a5ee0de 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -150,11 +150,9 @@ Geometry *Geometry::construct(Geometry_buffer *buffer, { uint32 geom_type; Geometry *result; - char byte_order; if (data_len < SRID_SIZE + WKB_HEADER_SIZE) // < 4 + (1 + 4) return NULL; - byte_order= data[SRID_SIZE]; geom_type= uint4korr(data + SRID_SIZE + 1); if (!(result= create_by_typeid(buffer, (int) geom_type))) return NULL; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 0d563ab9051..5b64c684223 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -5575,7 +5575,6 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list) { int result; String wrong_users; - ulong sql_mode; LEX_USER *user_name, *tmp_user_name; List_iterator <LEX_USER> user_list(list); TABLE_LIST tables[GRANT_TABLES]; @@ -5616,7 +5615,6 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list) } some_users_created= TRUE; - sql_mode= thd->variables.sql_mode; if (replace_user_table(thd, tables[0].table, *user_name, 0, 0, 1, 0)) { append_user(&wrong_users, user_name); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 799cb673a0e..646ab8a4346 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -5431,7 +5431,7 @@ static void update_field_dependencies(THD *thd, Field *field, TABLE *table) DBUG_ENTER("update_field_dependencies"); if (thd->mark_used_columns != MARK_COLUMNS_NONE) { - MY_BITMAP *current_bitmap, *other_bitmap; + MY_BITMAP *current_bitmap; /* We always want to register the used keys, as the column bitmap may have @@ -5442,15 +5442,9 @@ static void update_field_dependencies(THD *thd, Field *field, TABLE *table) table->merge_keys.merge(field->part_of_key); if (thd->mark_used_columns == MARK_COLUMNS_READ) - { current_bitmap= table->read_set; - other_bitmap= table->write_set; - } else - { current_bitmap= table->write_set; - other_bitmap= table->read_set; - } if (bitmap_fast_test_and_set(current_bitmap, field->field_index)) { diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 7e54f87fe14..2ce9cb951fe 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1177,7 +1177,10 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) { ulonglong engine_data; Query_cache_query *query; - Query_cache_block *first_result_block, *result_block; +#ifndef EMBEDDED_LIBRARY + Query_cache_block *first_result_block; +#endif + Query_cache_block *result_block; Query_cache_block_table *block_table, *block_table_end; ulong tot_length; Query_cache_query_flags flags; @@ -1322,7 +1325,10 @@ def_week_frmt: %lu", BLOCK_LOCK_RD(query_block); query = query_block->query(); - result_block= first_result_block= query->result(); + result_block= query->result(); +#ifndef EMBEDDED_LIBRARY + first_result_block= result_block; +#endif if (result_block == 0 || result_block->type != Query_cache_block::RESULT) { diff --git a/sql/sql_class.cc b/sql/sql_class.cc index b1f6dd0e564..31641f78fbb 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2046,8 +2046,7 @@ bool select_max_min_finder_subselect::send_data(List<Item> &items) if (!cache) { cache= Item_cache::get_cache(val_item); - switch (val_item->result_type()) - { + switch (val_item->result_type()) { case REAL_RESULT: op= &select_max_min_finder_subselect::cmp_real; break; @@ -2061,6 +2060,7 @@ bool select_max_min_finder_subselect::send_data(List<Item> &items) op= &select_max_min_finder_subselect::cmp_decimal; break; case ROW_RESULT: + case IMPOSSIBLE_RESULT: // This case should never be choosen DBUG_ASSERT(0); op= 0; @@ -3544,11 +3544,10 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg, binlog_table_maps= 0; DBUG_RETURN(error); } - break; case THD::QUERY_TYPE_COUNT: default: - DBUG_ASSERT(0 <= qtype && qtype < QUERY_TYPE_COUNT); + DBUG_ASSERT(qtype < QUERY_TYPE_COUNT); } DBUG_RETURN(0); } diff --git a/sql/sql_load.cc b/sql/sql_load.cc index c96fbb80b0c..d27244ee5c6 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -564,12 +564,9 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, List_iterator_fast<Item> it(fields_vars); Item_field *sql_field; TABLE *table= table_list->table; - ulonglong id; bool err; DBUG_ENTER("read_fixed_length"); - id= 0; - while (!read_info.read_fixed_length()) { if (thd->killed) @@ -695,12 +692,10 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, Item *item; TABLE *table= table_list->table; uint enclosed_length; - ulonglong id; bool err; DBUG_ENTER("read_sep_field"); enclosed_length=enclosed.length(); - id= 0; for (;;it.rewind()) { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 25584797549..fa7f8dad6bb 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -302,7 +302,7 @@ void init_update_queries(void) bool is_update_query(enum enum_sql_command command) { - DBUG_ASSERT(command >= 0 && command <= SQLCOM_END); + DBUG_ASSERT(command <= SQLCOM_END); return (sql_command_flags[command] & CF_CHANGES_DATA) != 0; } @@ -313,7 +313,7 @@ bool is_update_query(enum enum_sql_command command) */ bool is_log_table_write_query(enum enum_sql_command command) { - DBUG_ASSERT(command >= 0 && command <= SQLCOM_END); + DBUG_ASSERT(command <= SQLCOM_END); return (sql_command_flags[command] & CF_WRITE_LOGS_COMMAND) != 0; } @@ -1367,7 +1367,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd, { STATUS_VAR current_global_status_var; ulong uptime; +#if defined(SAFEMALLOC) || !defined(EMBEDDED_LIBRARY) uint length; +#endif ulonglong queries_per_second1000; char buff[250]; uint buff_len= sizeof(buff); @@ -1380,22 +1382,21 @@ bool dispatch_command(enum enum_server_command command, THD *thd, else queries_per_second1000= thd->query_id * LL(1000) / uptime; - length= my_snprintf((char*) buff, buff_len - 1, - "Uptime: %lu Threads: %d Questions: %lu " - "Slow queries: %lu Opens: %lu Flush tables: %lu " - "Open tables: %u Queries per second avg: %u.%u", - uptime, - (int) thread_count, (ulong) thd->query_id, - current_global_status_var.long_query_count, - current_global_status_var.opened_tables, - refresh_version, - cached_open_tables(), - (uint) (queries_per_second1000 / 1000), - (uint) (queries_per_second1000 % 1000)); -#ifdef EMBEDDED_LIBRARY - /* Store the buffer in permanent memory */ - send_ok(thd, 0, 0, buff); +#if defined(SAFEMALLOC) || !defined(EMBEDDED_LIBRARY) + length= #endif + my_snprintf((char*) buff, buff_len - 1, + "Uptime: %lu Threads: %d Questions: %lu " + "Slow queries: %lu Opens: %lu Flush tables: %lu " + "Open tables: %u Queries per second avg: %u.%u", + uptime, + (int) thread_count, (ulong) thd->query_id, + current_global_status_var.long_query_count, + current_global_status_var.opened_tables, + refresh_version, + cached_open_tables(), + (uint) (queries_per_second1000 / 1000), + (uint) (queries_per_second1000 % 1000)); #ifdef SAFEMALLOC if (sf_malloc_cur_memory) // Using SAFEMALLOC { @@ -1406,7 +1407,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd, (sf_malloc_max_memory+1023L)/1024L); } #endif -#ifndef EMBEDDED_LIBRARY +#ifdef EMBEDDED_LIBRARY + /* Store the buffer in permanent memory */ + send_ok(thd, 0, 0, buff); +#else VOID(my_net_write(net, (uchar*) buff, length)); VOID(net_flush(net)); thd->main_da.disable_status(); @@ -2153,7 +2157,6 @@ mysql_execute_command(THD *thd) my_error(ER_FEATURE_DISABLED, MYF(0), "SHOW PROFILES", "enable-profiling"); goto error; #endif - break; } case SQLCOM_SHOW_NEW_MASTER: { diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 7ed3cd057d5..714b2964aa1 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -2597,7 +2597,7 @@ TYPELIB* sys_var_pluginvar::plugin_var_typelib(void) default: return NULL; } - return NULL; + return NULL; /* Keep compiler happy */ } diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index c0178a231c9..9d1865becff 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2273,7 +2273,6 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length) uchar *packet_end= packet + packet_length; #endif Prepared_statement *stmt; - bool error; DBUG_ENTER("mysql_stmt_execute"); packet+= 9; /* stmt_id + 5 bytes of flags */ @@ -2321,7 +2320,7 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length) */ DBUG_ASSERT(thd->free_list == NULL); - error= stmt->execute(&expanded_query, + (void) stmt->execute(&expanded_query, test(flags & (ulong) CURSOR_TYPE_READ_ONLY)); if (!(specialflag & SPECIAL_NO_PRIOR)) my_pthread_setprio(pthread_self(), WAIT_PRIOR); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 4643aff95c4..57562f4d982 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2113,20 +2113,20 @@ static bool show_status_array(THD *thd, const char *wild, */ switch (show_type) { case SHOW_DOUBLE_STATUS: - value= ((char *) status_var + (ulong) value); + value= ((char *) status_var + (intptr) value); /* fall through */ case SHOW_DOUBLE: end= buff + my_sprintf(buff, (buff, "%f", *(double*) value)); break; case SHOW_LONG_STATUS: - value= ((char *) status_var + (ulong) value); + value= ((char *) status_var + (intptr) value); /* fall through */ case SHOW_LONG: case SHOW_LONG_NOFLUSH: // the difference lies in refresh_status() end= int10_to_str(*(long*) value, buff, 10); break; case SHOW_LONGLONG_STATUS: - value= ((char *) status_var + (ulonglong) value); + value= ((char *) status_var + (intptr) value); /* fall through */ case SHOW_LONGLONG: end= longlong10_to_str(*(longlong*) value, buff, 10); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 0b4d8e14efc..b1d4e6e20c4 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3478,7 +3478,6 @@ bool mysql_create_table_no_lock(THD *thd, goto warn; my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); goto unlock_and_end; - break; default: DBUG_PRINT("info", ("error: %u from storage engine", retcode)); my_error(retcode, MYF(0),table_name); @@ -5865,7 +5864,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, uint *index_drop_buffer; uint index_add_count; uint *index_add_buffer; - bool committed= 0; DBUG_ENTER("mysql_alter_table"); LINT_INIT(index_add_count); @@ -6631,7 +6629,6 @@ view_err: DBUG_PRINT("info", ("Committing before unlocking table")); if (ha_commit_stmt(thd) || ha_commit(thd)) goto err1; - committed= 1; } /*end of if (! new_table) for add/drop index*/ diff --git a/sql/table.cc b/sql/table.cc index 4a9b8d6ca5f..3d03d05d209 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -514,7 +514,7 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags) int error, table_type; bool error_given; File file; - uchar head[288], *disk_buff; + uchar head[288]; char path[FN_REFLEN]; MEM_ROOT **root_ptr, *old_root; DBUG_ENTER("open_table_def"); @@ -523,7 +523,6 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags) error= 1; error_given= 0; - disk_buff= NULL; strxmov(path, share->normalized_path.str, reg_ext, NullS); if ((file= my_open(path, O_RDONLY | O_SHARE, MYF(0))) < 0) diff --git a/sql/time.cc b/sql/time.cc index a6619cf4cee..687bb09e0f0 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -561,7 +561,7 @@ bool parse_date_time_format(timestamp_type format_type, return 0; break; default: - DBUG_ASSERT(1); + DBUG_ASSERT(0); break; } return 1; // Error |