summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbug/dbug.c2
-rw-r--r--libmysqld/lib_sql.cc15
-rw-r--r--sql/item_func.cc7
-rw-r--r--sql/mysqld.cc3
-rw-r--r--sql/protocol.cc22
-rw-r--r--sql/sql_class.h8
-rw-r--r--sql/sql_load.cc4
-rw-r--r--storage/innobase/btr/btr0cur.c8
-rw-r--r--storage/perfschema/pfs.cc3
-rw-r--r--tests/mysql_client_test.c6
-rw-r--r--unittest/mysys/lf-t.c5
11 files changed, 35 insertions, 48 deletions
diff --git a/dbug/dbug.c b/dbug/dbug.c
index 2c06eeff95a..2dadf7bb2d5 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -1873,7 +1873,6 @@ static void DBUGOpenFile(CODE_STATE *cs,
const char *name,const char *end,int append)
{
REGISTER FILE *fp;
- REGISTER BOOLEAN newfile;
if (name != NULL)
{
@@ -1902,7 +1901,6 @@ static void DBUGOpenFile(CODE_STATE *cs,
}
else
{
- newfile= !EXISTS(name);
if (!(fp= fopen(name, append ? "a+" : "w")))
{
(void) fprintf(stderr, ERR_OPEN, cs->process, name);
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index eed5e90edcd..93790082fba 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -1144,8 +1144,7 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
const char *sqlstate)
{
uint error;
- uchar converted_err[MYSQL_ERRMSG_SIZE];
- uint32 converted_err_len;
+ char converted_err[MYSQL_ERRMSG_SIZE];
MYSQL_DATA *data= thd->cur_data;
struct embedded_query_result *ei;
@@ -1160,12 +1159,12 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
ei= data->embedded_info;
ei->last_errno= sql_errno;
- converted_err_len= convert_error_message((char*)converted_err,
- sizeof(converted_err),
- thd->variables.character_set_results,
- err, strlen(err),
- system_charset_info, &error);
- strmake(ei->info, (const char*) converted_err, sizeof(ei->info)-1);
+ convert_error_message(converted_err, sizeof(converted_err),
+ thd->variables.character_set_results,
+ err, strlen(err),
+ system_charset_info, &error);
+ /* Converted error message is always null-terminated. */
+ strmake(ei->info, converted_err, sizeof(ei->info)-1);
strmov(ei->sqlstate, sqlstate);
ei->server_status= thd->server_status;
thd->cur_data= 0;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 754eae6d55b..19fc313a675 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -4965,8 +4965,9 @@ longlong Item_func_get_user_var::val_int()
*/
-int get_var_with_binlog(THD *thd, enum_sql_command sql_command,
- LEX_STRING &name, user_var_entry **out_entry)
+static int
+get_var_with_binlog(THD *thd, enum_sql_command sql_command,
+ LEX_STRING &name, user_var_entry **out_entry)
{
BINLOG_USER_VAR_EVENT *user_var_event;
user_var_entry *var_entry;
@@ -5096,7 +5097,7 @@ void Item_func_get_user_var::fix_length_and_dec()
'var_entry' is NULL only if there occured an error during the call to
get_var_with_binlog.
*/
- if (var_entry)
+ if (!error && var_entry)
{
m_cached_result_type= var_entry->type;
unsigned_flag= var_entry->unsigned_flag;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 3d06fd0c4d6..e2a1f694aee 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -5161,6 +5161,9 @@ void handle_connections_sockets()
DBUG_ENTER("handle_connections_sockets");
+ (void) ip_flags;
+ (void) socket_flags;
+
#ifndef HAVE_POLL
FD_ZERO(&clientFDs);
#endif
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 00ce5701756..b563925f612 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -368,9 +368,8 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
buff[]: sql_errno:2 + ('#':1 + SQLSTATE_LENGTH:5) + MYSQL_ERRMSG_SIZE:512
*/
uint error;
- uchar converted_err[MYSQL_ERRMSG_SIZE];
- uint32 converted_err_len;
- uchar buff[2+1+SQLSTATE_LENGTH+MYSQL_ERRMSG_SIZE], *pos;
+ char converted_err[MYSQL_ERRMSG_SIZE];
+ char buff[2+1+SQLSTATE_LENGTH+MYSQL_ERRMSG_SIZE], *pos;
DBUG_ENTER("send_error_packet");
@@ -390,19 +389,16 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
{
/* The first # is to make the protocol backward compatible */
buff[2]= '#';
- pos= (uchar*) strmov((char*) buff+3, sqlstate);
+ pos= strmov(buff+3, sqlstate);
}
- converted_err_len= convert_error_message((char*)converted_err,
- sizeof(converted_err),
- thd->variables.character_set_results,
- err, strlen(err),
- system_charset_info, &error);
- length= (uint) (strmake((char*) pos, (char*)converted_err,
- MYSQL_ERRMSG_SIZE - 1) - (char*) buff);
- err= (char*) buff;
+ convert_error_message(converted_err, sizeof(converted_err),
+ thd->variables.character_set_results,
+ err, strlen(err), system_charset_info, &error);
+ /* Converted error message is always null-terminated. */
+ length= (uint) (strmake(pos, converted_err, MYSQL_ERRMSG_SIZE - 1) - buff);
- DBUG_RETURN(net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) err,
+ DBUG_RETURN(net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) buff,
length));
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 8a427057d83..fafbab07979 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -3642,14 +3642,6 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
STATUS_VAR *dec_var);
void mark_transaction_to_rollback(THD *thd, bool all);
-/*
- This prototype is placed here instead of in item_func.h because it
- depends on the definition of enum_sql_command, which is in this
- file.
- */
-int get_var_with_binlog(THD *thd, enum_sql_command sql_command,
- LEX_STRING &name, user_var_entry **out_entry);
-
/* Inline functions */
inline bool add_item_to_list(THD *thd, Item *item)
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 1261568f212..1819102aa34 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -177,6 +177,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
#ifndef EMBEDDED_LIBRARY
LOAD_FILE_INFO lf_info;
THD::killed_state killed_status= THD::NOT_KILLED;
+ bool is_concurrent;
#endif
char *db = table_list->db; // This is never null
/*
@@ -187,7 +188,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
char *tdb= thd->db ? thd->db : db; // Result is never null
ulong skip_lines= ex->skip_lines;
bool transactional_table;
- bool is_concurrent;
DBUG_ENTER("mysql_load");
/*
@@ -256,7 +256,9 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
table= table_list->table;
transactional_table= table->file->has_transactions();
+#ifndef EMBEDDED_LIBRARY
is_concurrent= (table_list->lock_type == TL_WRITE_CONCURRENT_INSERT);
+#endif
if (!fields_vars.elements)
{
diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
index e1060af525c..46a52b549af 100644
--- a/storage/innobase/btr/btr0cur.c
+++ b/storage/innobase/btr/btr0cur.c
@@ -3575,7 +3575,6 @@ static
void
btr_record_not_null_field_in_rec(
/*=============================*/
- rec_t* rec, /*!< in: physical record */
ulint n_unique, /*!< in: dict_index_get_n_unique(index),
number of columns uniquely determine
an index entry */
@@ -3595,9 +3594,8 @@ btr_record_not_null_field_in_rec(
for (i = 0; i < n_unique; i++) {
ulint rec_len;
- byte* field;
- field = rec_get_nth_field(rec, offsets, i, &rec_len);
+ rec_get_nth_field_offs(offsets, i, &rec_len);
if (rec_len != UNIV_SQL_NULL) {
n_not_null[i]++;
@@ -3712,7 +3710,7 @@ btr_estimate_number_of_different_key_vals(
if (n_not_null) {
btr_record_not_null_field_in_rec(
- rec, n_cols, offsets_rec, n_not_null);
+ n_cols, offsets_rec, n_not_null);
}
}
@@ -3747,7 +3745,7 @@ btr_estimate_number_of_different_key_vals(
if (n_not_null) {
btr_record_not_null_field_in_rec(
- next_rec, n_cols, offsets_next_rec,
+ n_cols, offsets_next_rec,
n_not_null);
}
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index 139064ab212..27350c59604 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -1574,6 +1574,9 @@ static void unlock_rwlock_v1(PSI_rwlock *rwlock)
aggregate_single_stat_chain(&pfs_rwlock->m_read_lock_stat, locked_time);
}
}
+#else
+ (void) last_reader;
+ (void) last_writer;
#endif
}
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 5401e360f33..b3da65485dd 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -18596,11 +18596,8 @@ static void test_bug38486(void)
static void test_bug33831(void)
{
MYSQL *l_mysql;
- my_bool error;
DBUG_ENTER("test_bug33831");
-
- error= 0;
if (!(l_mysql= mysql_client_init(NULL)))
{
@@ -18623,9 +18620,8 @@ static void test_bug33831(void)
DIE_UNLESS(0);
}
-
mysql_close(l_mysql);
-
+
DBUG_VOID_RETURN;
}
diff --git a/unittest/mysys/lf-t.c b/unittest/mysys/lf-t.c
index 16821c862b0..573a56cc1d6 100644
--- a/unittest/mysys/lf-t.c
+++ b/unittest/mysys/lf-t.c
@@ -34,8 +34,7 @@ int with_my_thread_init=0;
*/
pthread_handler_t test_lf_pinbox(void *arg)
{
- int m= *(int *)arg;
- int32 x= 0;
+ int m= *(int *)arg;
LF_PINS *pins;
if (with_my_thread_init)
@@ -43,7 +42,7 @@ pthread_handler_t test_lf_pinbox(void *arg)
pins= lf_pinbox_get_pins(&lf_allocator.pinbox);
- for (x= ((int)(intptr)(&m)); m ; m--)
+ for (; m ; m--)
{
lf_pinbox_put_pins(pins);
pins= lf_pinbox_get_pins(&lf_allocator.pinbox);