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
This commit is contained in:
unknown 2008-02-13 21:27:12 +02:00
parent 3056d07a86
commit 8170b22b5c
44 changed files with 244 additions and 250 deletions

View File

@ -113,7 +113,7 @@ static void get_password(char *to,uint length,int fd,bool echo)
for (;;)
{
char tmp;
uchar tmp;
if (my_read(fd,&tmp,1,MYF(0)) != 1)
break;
if (tmp == '\b' || (int) tmp == 127)
@ -138,7 +138,7 @@ static void get_password(char *to,uint length,int fd,bool echo)
fputc('*',stderr);
fflush(stderr);
}
*(pos++) = tmp;
*(pos++)= (char) tmp;
}
while (pos != to && isspace(pos[-1]) == ' ')
pos--; /* Allow dummy space at end */

View File

@ -701,7 +701,7 @@ rl_function_of_keyseq (keyseq, map, type)
{
unsigned char ic = keyseq[i];
if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii)
if (META_CHAR_FOR_UCHAR(ic) && _rl_convert_meta_chars_to_ascii)
{
if (map[ESC].type == ISKMAP)
{

View File

@ -60,6 +60,7 @@
#define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0))
#define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char)
#define META_CHAR_FOR_UCHAR(c) ((c) > meta_character_threshold)
#define CTRL(c) ((c) & control_character_mask)
#define META(c) ((c) | meta_character_bit)

View File

@ -191,8 +191,6 @@ static int visible_first_line_len;
(or is equal to) _rl_screenwidth. */
static int prompt_invis_chars_first_line;
static int prompt_last_screen_line;
static int prompt_physical_chars;
/* Variables to save and restore prompt and display information. */
@ -458,7 +456,7 @@ rl_redisplay ()
{
register int in, out, c, linenum, cursor_linenum;
register char *line;
int inv_botlin, lb_botlin, lb_linenum, o_cpos;
int inv_botlin, lb_linenum, o_cpos;
int newlines, lpos, temp, modmark, n0, num;
char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE)
@ -671,11 +669,9 @@ rl_redisplay ()
lpos -= _rl_screenwidth;
}
prompt_last_screen_line = newlines;
/* Draw the rest of the line (after the prompt) into invisible_line, keeping
track of where the cursor is (cpos_buffer_position), the number of the line containing
the cursor (lb_linenum), the last line number (lb_botlin and inv_botlin).
the cursor (lb_linenum), the last line number (inv_botlin).
It maintains an array of line breaks for display (inv_lbreaks).
This handles expanding tabs for display and displaying meta characters. */
lb_linenum = 0;
@ -858,7 +854,7 @@ rl_redisplay ()
lb_linenum = newlines;
}
inv_botlin = lb_botlin = newlines;
inv_botlin = newlines;
CHECK_INV_LBREAKS ();
inv_lbreaks[newlines+1] = out;
cursor_linenum = lb_linenum;
@ -1888,7 +1884,7 @@ rl_character_len (c, pos)
uc = (unsigned char)c;
if (META_CHAR (uc))
if (META_CHAR_FOR_UCHAR(uc))
return ((_rl_output_meta_chars == 0) ? 4 : 1);
if (uc == '\t')

View File

@ -693,7 +693,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
case 's':
{
char *new_event;
int delimiter, failed, si, l_temp, ws, we;
int delimiter, failed, si, l_temp, we;
if (c == 's')
{
@ -792,7 +792,6 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
{
for (; temp[si] && whitespace (temp[si]); si++)
;
ws = si;
we = history_tokenize_word (temp, si);
}

View File

@ -306,7 +306,7 @@ add_history (string)
}
}
temp = alloc_history_entry (string, hist_inittime ());
temp = alloc_history_entry ((char*) string, hist_inittime ());
the_history[history_length] = (HIST_ENTRY *)NULL;
the_history[history_length - 1] = temp;

View File

@ -1169,7 +1169,7 @@ rl_insert_comment (count, key)
int rl_comment_len;
rl_beg_of_line (1, key);
rl_comment_text = _rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT;
rl_comment_text = _rl_comment_begin ? _rl_comment_begin : (char*) RL_COMMENT_BEGIN_DEFAULT;
if (rl_explicit_arg == 0)
rl_insert_text (rl_comment_text);
@ -1386,10 +1386,11 @@ rl_transpose_chars (count, key)
#if defined (HANDLE_MULTIBYTE)
char *dummy;
int i;
int prev_point;
#else
char dummy[2];
#endif
int char_length, prev_point;
int char_length;
if (count == 0)
return 0;
@ -1408,7 +1409,9 @@ rl_transpose_chars (count, key)
count = 1;
}
#if defined (HANDLE_MULTIBYTE)
prev_point = rl_point;
#endif
rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_NONZERO);
#if defined (HANDLE_MULTIBYTE)

View File

@ -210,10 +210,10 @@ struct link {
*/
struct settings {
int flags; /* Current settings flags */
int maxdepth; /* Current maximum trace depth */
uint flags; /* Current settings flags */
uint maxdepth; /* Current maximum trace depth */
uint delay; /* Delay after each output line */
int sub_level; /* Sub this from code_state->level */
uint sub_level; /* Sub this from code_state->level */
FILE *out_file; /* Current output stream */
FILE *prof_file; /* Current profiling stream */
char name[FN_REFLEN]; /* Name of output file */
@ -245,7 +245,7 @@ typedef struct _db_code_state_ {
const char *jmpfunc; /* Remember current function for setjmp */
const char *jmpfile; /* Remember current file for setjmp */
int lineno; /* Current debugger output line number */
int level; /* Current function nesting level */
uint level; /* Current function nesting level */
int jmplevel; /* Remember nesting level at setjmp() */
/*
@ -1204,7 +1204,7 @@ void _db_enter_(const char *_func_, const char *_file_,
void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_)
{
int save_errno=errno;
int _slevel_=_stack_frame_->level & ~TRACE_ON;
uint _slevel_= _stack_frame_->level & ~TRACE_ON;
CODE_STATE *cs;
get_code_state_or_return;

View File

@ -373,8 +373,13 @@ struct my_rnd_struct;
/* The following is for user defined functions */
enum Item_result {STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT,
DECIMAL_RESULT};
enum Item_result
{
STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, DECIMAL_RESULT
#ifdef MYSQL_SERVER
,IMPOSSIBLE_RESULT /* Yes, we know this is ugly, don't tell us */
#endif
};
typedef struct st_udf_args
{

View File

@ -4375,7 +4375,6 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
field->max_length= 10; /* 2003-11-11 */
param->skip_result= skip_result_with_length;
break;
break;
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
param->skip_result= skip_result_with_length;

View File

@ -1,4 +1,5 @@
--source include/not_embedded.inc
--source include/big_test.inc
--source include/have_query_cache.inc
--source include/have_debug.inc

View File

@ -420,9 +420,9 @@ process_flags:
/* minimum width padding */
if (minimum_width > length2)
{
char *buffz;
uchar *buffz;
buffz= my_alloca(minimum_width - length2);
buffz= (uchar*) my_alloca(minimum_width - length2);
if (is_zero_padded)
memset(buffz, '0', minimum_width - length2);
else

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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:

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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 */

View File

@ -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));

View File

@ -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__

View File

@ -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];

View File

@ -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,

View File

@ -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;
}

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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))
{

View File

@ -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)
{

View File

@ -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);
}

View File

@ -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())
{

View File

@ -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:
{

View File

@ -2597,7 +2597,7 @@ TYPELIB* sys_var_pluginvar::plugin_var_typelib(void)
default:
return NULL;
}
return NULL;
return NULL; /* Keep compiler happy */
}

View File

@ -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);

View File

@ -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);

View File

@ -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*/

View File

@ -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)

View File

@ -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

View File

@ -71,29 +71,29 @@ ma_pagecache_common_cppflags = -DEXTRA_DEBUG -DPAGECACHE_DEBUG -DMAIN
ma_pagecache_single_1k_t_SOURCES = $(ma_pagecache_single_src)
ma_pagecache_single_8k_t_SOURCES = $(ma_pagecache_single_src)
ma_pagecache_single_64k_t_SOURCES = $(ma_pagecache_single_src)
ma_pagecache_single_1k_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DPAGE_SIZE=1024
ma_pagecache_single_8k_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DPAGE_SIZE=8192
ma_pagecache_single_64k_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DPAGE_SIZE=65536 -DBIG
ma_pagecache_single_1k_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DTEST_PAGE_SIZE=1024
ma_pagecache_single_8k_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DTEST_PAGE_SIZE=8192
ma_pagecache_single_64k_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DTEST_PAGE_SIZE=65536 -DBIG
ma_pagecache_consist_1k_t_SOURCES = $(ma_pagecache_consist_src)
ma_pagecache_consist_1k_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DPAGE_SIZE=1024
ma_pagecache_consist_1k_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DTEST_PAGE_SIZE=1024
ma_pagecache_consist_64k_t_SOURCES = $(ma_pagecache_consist_src)
ma_pagecache_consist_64k_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DPAGE_SIZE=65536
ma_pagecache_consist_64k_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DTEST_PAGE_SIZE=65536
ma_pagecache_consist_1kHC_t_SOURCES = $(ma_pagecache_consist_src)
ma_pagecache_consist_1kHC_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DPAGE_SIZE=1024 -DTEST_HIGH_CONCURENCY
ma_pagecache_consist_1kHC_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DTEST_PAGE_SIZE=1024 -DTEST_HIGH_CONCURENCY
ma_pagecache_consist_64kHC_t_SOURCES = $(ma_pagecache_consist_src)
ma_pagecache_consist_64kHC_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DPAGE_SIZE=65536 -DTEST_HIGH_CONCURENCY
ma_pagecache_consist_64kHC_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DTEST_PAGE_SIZE=65536 -DTEST_HIGH_CONCURENCY
ma_pagecache_consist_1kRD_t_SOURCES = $(ma_pagecache_consist_src)
ma_pagecache_consist_1kRD_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DPAGE_SIZE=1024 -DTEST_READERS
ma_pagecache_consist_1kRD_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DTEST_PAGE_SIZE=1024 -DTEST_READERS
ma_pagecache_consist_64kRD_t_SOURCES = $(ma_pagecache_consist_src)
ma_pagecache_consist_64kRD_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DPAGE_SIZE=65536 -DTEST_READERS
ma_pagecache_consist_64kRD_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DTEST_PAGE_SIZE=65536 -DTEST_READERS
ma_pagecache_consist_1kWR_t_SOURCES = $(ma_pagecache_consist_src)
ma_pagecache_consist_1kWR_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DPAGE_SIZE=1024 -DTEST_WRITERS
ma_pagecache_consist_1kWR_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DTEST_PAGE_SIZE=1024 -DTEST_WRITERS
ma_pagecache_consist_64kWR_t_SOURCES = $(ma_pagecache_consist_src)
ma_pagecache_consist_64kWR_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DPAGE_SIZE=65536 -DTEST_WRITERS
ma_pagecache_consist_64kWR_t_CPPFLAGS = $(ma_pagecache_common_cppflags) -DTEST_PAGE_SIZE=65536 -DTEST_WRITERS
# the generic lock manager may not be used in the end and lockman1-t crashes,
# so we don't build lockman-t and lockman1-t

View File

@ -9,7 +9,7 @@
#include "test_file.h"
#include <tap.h>
#define PCACHE_SIZE (PAGE_SIZE*1024*8)
#define PCACHE_SIZE (TEST_PAGE_SIZE*1024*8)
#ifndef DBUG_OFF
static const char* default_dbug_option;
@ -26,7 +26,7 @@ static PAGECACHE pagecache;
static uint number_of_readers= 10;
static uint number_of_writers= 20;
static uint number_of_tests= 30000;
static uint record_length_limit= PAGE_SIZE/200;
static uint record_length_limit= TEST_PAGE_SIZE/200;
static uint number_of_pages= 20;
static uint flush_divider= 1000;
#else /*TEST_HIGH_CONCURENCY*/
@ -34,7 +34,7 @@ static uint flush_divider= 1000;
static uint number_of_readers= 10;
static uint number_of_writers= 1;
static uint number_of_tests= 30000;
static uint record_length_limit= PAGE_SIZE/200;
static uint record_length_limit= TEST_PAGE_SIZE/200;
static uint number_of_pages= 20;
static uint flush_divider= 1000;
#undef SKIP_BIG_TESTS
@ -44,7 +44,7 @@ static uint flush_divider= 1000;
static uint number_of_readers= 0;
static uint number_of_writers= 10;
static uint number_of_tests= 30000;
static uint record_length_limit= PAGE_SIZE/200;
static uint record_length_limit= TEST_PAGE_SIZE/200;
static uint number_of_pages= 20;
static uint flush_divider= 1000;
#undef SKIP_BIG_TESTS
@ -53,7 +53,7 @@ static uint flush_divider= 1000;
static uint number_of_readers= 10;
static uint number_of_writers= 10;
static uint number_of_tests= 50000;
static uint record_length_limit= PAGE_SIZE/200;
static uint record_length_limit= TEST_PAGE_SIZE/200;
static uint number_of_pages= 20000;
static uint flush_divider= 1000;
#endif /*TEST_WRITERS*/
@ -116,7 +116,7 @@ uint check_page(uchar *buff, ulong offset, int page_locked, int page_no,
uint len= *((uint *)(buff + end));
uint j;
end+= sizeof(uint) + sizeof(uint);
if (len + end > PAGE_SIZE)
if (len + end > TEST_PAGE_SIZE)
{
diag("incorrect field header #%u by offset %lu\n", i, offset + end);
goto err;
@ -131,7 +131,7 @@ uint check_page(uchar *buff, ulong offset, int page_locked, int page_no,
}
end+= len;
}
for(i= end; i < PAGE_SIZE; i++)
for(i= end; i < TEST_PAGE_SIZE; i++)
{
if (buff[i] != 0)
{
@ -146,7 +146,7 @@ uint check_page(uchar *buff, ulong offset, int page_locked, int page_no,
(page_locked ? "locked" : "unlocked"),
end, num, tag);
h= my_open("wrong_page", O_CREAT | O_TRUNC | O_RDWR, MYF(0));
my_pwrite(h, (uchar*) buff, PAGE_SIZE, 0, MYF(0));
my_pwrite(h, (uchar*) buff, TEST_PAGE_SIZE, 0, MYF(0));
my_close(h, MYF(0));
goto err;
}
@ -172,7 +172,7 @@ void put_rec(uchar *buff, uint end, uint len, uint tag)
uint num= *((uint *)buff);
if (!len)
len= 1;
if (end + sizeof(uint)*2 + len > PAGE_SIZE)
if (end + sizeof(uint)*2 + len > TEST_PAGE_SIZE)
return;
*((uint *)(buff + end))= len;
end+= sizeof(uint);
@ -217,7 +217,7 @@ void reset_file(PAGECACHE_FILE file, char *file_name)
void reader(int num)
{
unsigned char *buffr= malloc(PAGE_SIZE);
unsigned char *buffr= malloc(TEST_PAGE_SIZE);
uint i;
for (i= 0; i < number_of_tests; i++)
@ -227,7 +227,7 @@ void reader(int num)
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED,
0);
check_page(buffr, page * PAGE_SIZE, 0, page, -num);
check_page(buffr, page * TEST_PAGE_SIZE, 0, page, -num);
}
free(buffr);
@ -236,7 +236,7 @@ void reader(int num)
void writer(int num)
{
unsigned char *buffr= malloc(PAGE_SIZE);
unsigned char *buffr= malloc(TEST_PAGE_SIZE);
uint i;
for (i= 0; i < number_of_tests; i++)
@ -247,7 +247,7 @@ void writer(int num)
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_WRITE,
0);
end= check_page(buffr, page * PAGE_SIZE, 1, page, num);
end= check_page(buffr, page * TEST_PAGE_SIZE, 1, page, num);
put_rec(buffr, end, get_len(record_length_limit), num);
pagecache_write(&pagecache, &file1, page, 3, buffr,
PAGECACHE_PLAIN_PAGE,
@ -381,7 +381,7 @@ int main(int argc __attribute__((unused)),
#endif
if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0,
PAGE_SIZE, 0)) == 0)
TEST_PAGE_SIZE, 0)) == 0)
{
diag("Got error: init_pagecache() (errno: %d)\n",
errno);
@ -389,9 +389,9 @@ int main(int argc __attribute__((unused)),
}
DBUG_PRINT("info", ("Page cache %d pages", pagen));
{
unsigned char *buffr= malloc(PAGE_SIZE);
unsigned char *buffr= malloc(TEST_PAGE_SIZE);
uint i;
memset(buffr, '\0', PAGE_SIZE);
memset(buffr, '\0', TEST_PAGE_SIZE);
for (i= 0; i < number_of_pages; i++)
{
pagecache_write(&pagecache, &file1, i, 3, buffr,

View File

@ -9,7 +9,7 @@
#include "test_file.h"
#include <tap.h>
#define PCACHE_SIZE (PAGE_SIZE*1024*10)
#define PCACHE_SIZE (TEST_PAGE_SIZE*1024*10)
#ifndef DBUG_OFF
static const char* default_dbug_option;
@ -33,50 +33,50 @@ static PAGECACHE pagecache;
*/
static struct file_desc simple_read_write_test_file[]=
{
{PAGE_SIZE, '\1'},
{ TEST_PAGE_SIZE, '\1'},
{0, 0}
};
static struct file_desc simple_read_change_write_read_test_file[]=
{
{PAGE_SIZE/2, '\65'},
{PAGE_SIZE/2, '\1'},
{ TEST_PAGE_SIZE/2, '\65'},
{ TEST_PAGE_SIZE/2, '\1'},
{0, 0}
};
static struct file_desc simple_pin_test_file1[]=
{
{PAGE_SIZE*2, '\1'},
{ TEST_PAGE_SIZE*2, '\1'},
{0, 0}
};
static struct file_desc simple_pin_test_file2[]=
{
{PAGE_SIZE/2, '\1'},
{PAGE_SIZE/2, (unsigned char)129},
{PAGE_SIZE, '\1'},
{ TEST_PAGE_SIZE/2, '\1'},
{ TEST_PAGE_SIZE/2, (unsigned char)129},
{ TEST_PAGE_SIZE, '\1'},
{0, 0}
};
static struct file_desc simple_pin_no_lock_test_file1[]=
{
{PAGE_SIZE, '\4'},
{ TEST_PAGE_SIZE, '\4'},
{0, 0}
};
static struct file_desc simple_pin_no_lock_test_file2[]=
{
{PAGE_SIZE, '\5'},
{ TEST_PAGE_SIZE, '\5'},
{0, 0}
};
static struct file_desc simple_pin_no_lock_test_file3[]=
{
{PAGE_SIZE, '\6'},
{ TEST_PAGE_SIZE, '\6'},
{0, 0}
};
static struct file_desc simple_delete_forget_test_file[]=
{
{PAGE_SIZE, '\1'},
{ TEST_PAGE_SIZE, '\1'},
{0, 0}
};
static struct file_desc simple_delete_flush_test_file[]=
{
{PAGE_SIZE, '\2'},
{ TEST_PAGE_SIZE, '\2'},
{0, 0}
};
@ -135,11 +135,11 @@ void reset_file(PAGECACHE_FILE *file, const char *file_name)
int simple_read_write_test()
{
unsigned char *buffw= malloc(PAGE_SIZE);
unsigned char *buffr= malloc(PAGE_SIZE);
unsigned char *buffw= malloc(TEST_PAGE_SIZE);
unsigned char *buffr= malloc(TEST_PAGE_SIZE);
int res;
DBUG_ENTER("simple_read_write_test");
bfill(buffw, PAGE_SIZE, '\1');
bfill(buffw, TEST_PAGE_SIZE, '\1');
pagecache_write(&pagecache, &file1, 0, 3, buffw,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED,
@ -150,14 +150,14 @@ int simple_read_write_test()
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED,
0);
ok((res= test(memcmp(buffr, buffw, PAGE_SIZE) == 0)),
ok((res= test(memcmp(buffr, buffw, TEST_PAGE_SIZE) == 0)),
"Simple write-read page ");
if (flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE))
{
diag("Got error during flushing pagecache\n");
exit(1);
}
ok((res&= test(test_file(file1, file1_name, PAGE_SIZE, PAGE_SIZE,
ok((res&= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE,
simple_read_write_test_file))),
"Simple write-read page file");
if (res)
@ -174,13 +174,13 @@ int simple_read_write_test()
*/
int simple_read_change_write_read_test()
{
unsigned char *buffw= malloc(PAGE_SIZE);
unsigned char *buffr= malloc(PAGE_SIZE);
unsigned char *buffw= malloc(TEST_PAGE_SIZE);
unsigned char *buffr= malloc(TEST_PAGE_SIZE);
int res, res2;
DBUG_ENTER("simple_read_change_write_read_test");
/* prepare the file */
bfill(buffw, PAGE_SIZE, '\1');
bfill(buffw, TEST_PAGE_SIZE, '\1');
pagecache_write(&pagecache, &file1, 0, 3, buffw,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED,
@ -197,7 +197,7 @@ int simple_read_change_write_read_test()
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_WRITE,
0);
bfill(buffw, PAGE_SIZE/2, '\65');
bfill(buffw, TEST_PAGE_SIZE/2, '\65');
pagecache_write(&pagecache, &file1, 0, 3, buffw,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_WRITE_UNLOCK,
@ -209,7 +209,7 @@ int simple_read_change_write_read_test()
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED,
0);
ok((res= test(memcmp(buffr, buffw, PAGE_SIZE) == 0)),
ok((res= test(memcmp(buffr, buffw, TEST_PAGE_SIZE) == 0)),
"Simple read-change-write-read page ");
DBUG_ASSERT(pagecache.blocks_changed == 1);
if (flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE))
@ -218,7 +218,7 @@ int simple_read_change_write_read_test()
exit(1);
}
DBUG_ASSERT(pagecache.blocks_changed == 0);
ok((res2= test(test_file(file1, file1_name, PAGE_SIZE, PAGE_SIZE,
ok((res2= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE,
simple_read_change_write_read_test_file))),
"Simple read-change-write-read page file");
if (res && res2)
@ -239,11 +239,11 @@ int simple_read_change_write_read_test()
*/
int simple_pin_test()
{
unsigned char *buffw= malloc(PAGE_SIZE);
unsigned char *buffw= malloc(TEST_PAGE_SIZE);
int res;
DBUG_ENTER("simple_pin_test");
/* prepare the file */
bfill(buffw, PAGE_SIZE, '\1');
bfill(buffw, TEST_PAGE_SIZE, '\1');
pagecache_write(&pagecache, &file1, 0, 3, buffw,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED,
@ -266,7 +266,7 @@ int simple_pin_test()
PAGECACHE_PIN_LEFT_UNPINNED,
PAGECACHE_WRITE_DELAY,
0, LSN_IMPOSSIBLE);
bfill(buffw + PAGE_SIZE/2, PAGE_SIZE/2, ((unsigned char) 129));
bfill(buffw + TEST_PAGE_SIZE/2, TEST_PAGE_SIZE/2, ((unsigned char) 129));
pagecache_write(&pagecache, &file1, 0, 3, buffw,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_WRITE_TO_READ,
@ -283,7 +283,7 @@ int simple_pin_test()
res= 0;
goto err;
}
ok((res= test(test_file(file1, file1_name, PAGE_SIZE*2, PAGE_SIZE*2,
ok((res= test(test_file(file1, file1_name, TEST_PAGE_SIZE*2, TEST_PAGE_SIZE*2,
simple_pin_test_file1))),
"Simple pin page file with pin");
pagecache_unlock(&pagecache,
@ -298,7 +298,7 @@ int simple_pin_test()
res= 0;
goto err;
}
ok((res&= test(test_file(file1, file1_name, PAGE_SIZE*2, PAGE_SIZE,
ok((res&= test(test_file(file1, file1_name, TEST_PAGE_SIZE*2, TEST_PAGE_SIZE,
simple_pin_test_file2))),
"Simple pin page result file");
if (res)
@ -313,12 +313,12 @@ err:
*/
int simple_pin_no_lock_test()
{
unsigned char *buffw= malloc(PAGE_SIZE);
unsigned char *buffw= malloc(TEST_PAGE_SIZE);
PAGECACHE_BLOCK_LINK *link;
int res;
DBUG_ENTER("simple_pin_no_lock_test");
/* prepare the file */
bfill(buffw, PAGE_SIZE, '\4');
bfill(buffw, TEST_PAGE_SIZE, '\4');
pagecache_write(&pagecache, &file1, 0, 3, buffw,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED,
@ -331,7 +331,7 @@ int simple_pin_no_lock_test()
diag("Got error during flushing pagecache 2\n");
exit(1);
}
bfill(buffw, PAGE_SIZE, '\5');
bfill(buffw, TEST_PAGE_SIZE, '\5');
pagecache_write(&pagecache, &file1, 0, 3, buffw,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED,
@ -348,7 +348,7 @@ int simple_pin_no_lock_test()
res= 0;
goto err;
}
ok((res= test(test_file(file1, file1_name, PAGE_SIZE, PAGE_SIZE,
ok((res= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE,
simple_pin_no_lock_test_file1))),
"Simple pin (no lock) page file with pin 2");
pagecache_unlock(&pagecache,
@ -363,11 +363,11 @@ int simple_pin_no_lock_test()
res= 0;
goto err;
}
ok((res&= test(test_file(file1, file1_name, PAGE_SIZE, PAGE_SIZE,
ok((res&= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE,
simple_pin_no_lock_test_file2))),
"Simple pin (no lock) page result file 2");
bfill(buffw, PAGE_SIZE, '\6');
bfill(buffw, TEST_PAGE_SIZE, '\6');
pagecache_write(&pagecache, &file1, 0, 3, buffw,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_WRITE,
@ -383,7 +383,7 @@ int simple_pin_no_lock_test()
res= 0;
goto err;
}
ok((res= test(test_file(file1, file1_name, PAGE_SIZE, PAGE_SIZE,
ok((res= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE,
simple_pin_no_lock_test_file2))),
"Simple pin (no lock) page file with pin 3");
pagecache_unpin_by_link(&pagecache, link, 0);
@ -393,7 +393,7 @@ int simple_pin_no_lock_test()
res= 0;
goto err;
}
ok((res&= test(test_file(file1, file1_name, PAGE_SIZE, PAGE_SIZE,
ok((res&= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE,
simple_pin_no_lock_test_file3))),
"Simple pin (no lock) page result file 3");
if (res)
@ -409,12 +409,12 @@ err:
int simple_delete_forget_test()
{
unsigned char *buffw= malloc(PAGE_SIZE);
unsigned char *buffr= malloc(PAGE_SIZE);
unsigned char *buffw= malloc(TEST_PAGE_SIZE);
unsigned char *buffr= malloc(TEST_PAGE_SIZE);
int res;
DBUG_ENTER("simple_delete_forget_test");
/* prepare the file */
bfill(buffw, PAGE_SIZE, '\1');
bfill(buffw, TEST_PAGE_SIZE, '\1');
pagecache_write(&pagecache, &file1, 0, 3, buffw,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED,
@ -423,7 +423,7 @@ int simple_delete_forget_test()
0, LSN_IMPOSSIBLE);
flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE);
/* test */
bfill(buffw, PAGE_SIZE, '\2');
bfill(buffw, TEST_PAGE_SIZE, '\2');
pagecache_write(&pagecache, &file1, 0, 3, buffw,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED,
@ -433,7 +433,7 @@ int simple_delete_forget_test()
pagecache_delete(&pagecache, &file1, 0,
PAGECACHE_LOCK_WRITE, 0);
flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE);
ok((res= test(test_file(file1, file1_name, PAGE_SIZE, PAGE_SIZE,
ok((res= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE,
simple_delete_forget_test_file))),
"Simple delete-forget page file");
if (res)
@ -451,13 +451,13 @@ int simple_delete_forget_test()
int simple_delete_flush_test()
{
unsigned char *buffw= malloc(PAGE_SIZE);
unsigned char *buffr= malloc(PAGE_SIZE);
unsigned char *buffw= malloc(TEST_PAGE_SIZE);
unsigned char *buffr= malloc(TEST_PAGE_SIZE);
PAGECACHE_BLOCK_LINK *link;
int res;
DBUG_ENTER("simple_delete_flush_test");
/* prepare the file */
bfill(buffw, PAGE_SIZE, '\1');
bfill(buffw, TEST_PAGE_SIZE, '\1');
pagecache_write(&pagecache, &file1, 0, 3, buffw,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_WRITE,
@ -466,7 +466,7 @@ int simple_delete_flush_test()
&link, LSN_IMPOSSIBLE);
flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE);
/* test */
bfill(buffw, PAGE_SIZE, '\2');
bfill(buffw, TEST_PAGE_SIZE, '\2');
pagecache_write(&pagecache, &file1, 0, 3, buffw,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_WRITELOCKED,
@ -480,7 +480,7 @@ int simple_delete_flush_test()
exit(1);
}
flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE);
ok((res= test(test_file(file1, file1_name, PAGE_SIZE, PAGE_SIZE,
ok((res= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE,
simple_delete_flush_test_file))),
"Simple delete flush (link) page file");
if (res)
@ -497,19 +497,19 @@ int simple_delete_flush_test()
int simple_big_test()
{
unsigned char *buffw= (unsigned char *) my_malloc(PAGE_SIZE, MYF(MY_WME));
unsigned char *buffr= (unsigned char *) my_malloc(PAGE_SIZE, MYF(MY_WME));
unsigned char *buffw= (unsigned char *) my_malloc(TEST_PAGE_SIZE, MYF(MY_WME));
unsigned char *buffr= (unsigned char *) my_malloc(TEST_PAGE_SIZE, MYF(MY_WME));
struct file_desc *desc= ((struct file_desc *)
my_malloc((PCACHE_SIZE/(PAGE_SIZE/2) + 1) *
my_malloc((PCACHE_SIZE/(TEST_PAGE_SIZE/2) + 1) *
sizeof(struct file_desc), MYF(MY_WME)));
int res, i;
DBUG_ENTER("simple_big_test");
/* prepare the file twice larger then cache */
for (i= 0; i < PCACHE_SIZE/(PAGE_SIZE/2); i++)
for (i= 0; i < PCACHE_SIZE/(TEST_PAGE_SIZE/2); i++)
{
bfill(buffw, PAGE_SIZE, (unsigned char) (i & 0xff));
desc[i].length= PAGE_SIZE;
bfill(buffw, TEST_PAGE_SIZE, (unsigned char) (i & 0xff));
desc[i].length= TEST_PAGE_SIZE;
desc[i].content= (i & 0xff);
pagecache_write(&pagecache, &file1, i, 3, buffw,
PAGECACHE_PLAIN_PAGE,
@ -522,14 +522,14 @@ int simple_big_test()
desc[i].content= '\0';
ok(1, "Simple big file write");
/* check written pages sequentally read */
for (i= 0; i < PCACHE_SIZE/(PAGE_SIZE/2); i++)
for (i= 0; i < PCACHE_SIZE/(TEST_PAGE_SIZE/2); i++)
{
int j;
pagecache_read(&pagecache, &file1, i, 3, buffr,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED,
0);
for(j= 0; j < PAGE_SIZE; j++)
for(j= 0; j < TEST_PAGE_SIZE; j++)
{
if (buffr[j] != (i & 0xff))
{
@ -541,15 +541,15 @@ int simple_big_test()
}
ok(1, "Simple big file sequential read");
/* chack random reads */
for (i= 0; i < PCACHE_SIZE/(PAGE_SIZE); i++)
for (i= 0; i < PCACHE_SIZE/(TEST_PAGE_SIZE); i++)
{
int j, page;
page= rand() % (PCACHE_SIZE/(PAGE_SIZE/2));
page= rand() % (PCACHE_SIZE/(TEST_PAGE_SIZE/2));
pagecache_read(&pagecache, &file1, page, 3, buffr,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED,
0);
for(j= 0; j < PAGE_SIZE; j++)
for(j= 0; j < TEST_PAGE_SIZE; j++)
{
if (buffr[j] != (page & 0xff))
{
@ -562,7 +562,7 @@ int simple_big_test()
ok(1, "Simple big file random read");
flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE);
ok((res= test(test_file(file1, file1_name, PCACHE_SIZE*2, PAGE_SIZE,
ok((res= test(test_file(file1, file1_name, PCACHE_SIZE*2, TEST_PAGE_SIZE,
desc))),
"Simple big file");
if (res)
@ -699,7 +699,7 @@ int main(int argc __attribute__((unused)),
#endif
if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0,
PAGE_SIZE, MYF(MY_WME))) == 0)
TEST_PAGE_SIZE, MYF(MY_WME))) == 0)
{
fprintf(stderr,"Got error: init_pagecache() (errno: %d)\n",
errno);

View File

@ -40,7 +40,9 @@
#define MAX_SERVER_ARGS 64
/* set default options */
#ifdef NOT_USED
static int opt_testcase = 0;
#endif
static char *opt_db= 0;
static char *opt_user= 0;
static char *opt_password= 0;
@ -12643,7 +12645,7 @@ static void test_conversion()
const char *stmt_text;
int rc;
MYSQL_BIND my_bind[1];
char buff[4];
uchar buff[4];
ulong length;
myheader("test_conversion");
@ -12666,7 +12668,7 @@ static void test_conversion()
check_execute(stmt, rc);
bzero((char*) my_bind, sizeof(my_bind));
my_bind[0].buffer= buff;
my_bind[0].buffer= (char*) buff;
my_bind[0].length= &length;
my_bind[0].buffer_type= MYSQL_TYPE_STRING;
@ -12691,7 +12693,7 @@ static void test_conversion()
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc == 0);
DIE_UNLESS(length == 1);
DIE_UNLESS((uchar) buff[0] == 0xE0);
DIE_UNLESS(buff[0] == 0xE0);
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc == MYSQL_NO_DATA);
@ -15865,11 +15867,10 @@ static void test_bug21206()
static void test_status()
{
const char *status;
DBUG_ENTER("test_status");
myheader("test_status");
if (!(status= mysql_stat(mysql)))
if (!mysql_stat(mysql))
{
myerror("mysql_stat failed"); /* purecov: inspected */
die(__FILE__, __LINE__, "mysql_stat failed"); /* purecov: inspected */
@ -17548,7 +17549,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
DBUG_PUSH(argument ? argument : default_dbug_option);
break;
case 'c':
#ifdef NOT_USED
opt_testcase = 1;
#endif
break;
case 'p':
if (argument)