diff options
author | unknown <monty@hundin.mysql.fi> | 2001-09-15 16:22:34 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2001-09-15 16:22:34 +0300 |
commit | 7dc2f1a69e61a4370ae06edc77de0fd5bf98e6fb (patch) | |
tree | 8783b1d57a27183a301b7fdfaaf671cf498a7e8e | |
parent | ef2e750842f4f913ef93c404e4d2d05e95a4cfd0 (diff) | |
download | mariadb-git-7dc2f1a69e61a4370ae06edc77de0fd5bf98e6fb.tar.gz |
Portability fixes
libmysql/libmysql.c:
Cleanup & portability fixes
-rw-r--r-- | libmysql/libmysql.c | 67 | ||||
-rw-r--r-- | myisam/ft_boolean_search.c | 4 | ||||
-rw-r--r-- | myisam/ft_dump.c | 1 | ||||
-rw-r--r-- | sql/ha_myisam.cc | 1 | ||||
-rw-r--r-- | sql/item_sum.cc | 4 | ||||
-rw-r--r-- | sql/log_event.cc | 64 | ||||
-rw-r--r-- | sql/log_event.h | 4 | ||||
-rw-r--r-- | sql/mini_client.cc | 2 | ||||
-rw-r--r-- | sql/net_serv.cc | 4 | ||||
-rw-r--r-- | sql/opt_range.cc | 6 | ||||
-rw-r--r-- | sql/slave.cc | 3 | ||||
-rw-r--r-- | sql/sql_base.cc | 1 | ||||
-rw-r--r-- | sql/sql_class.h | 2 | ||||
-rw-r--r-- | sql/sql_db.cc | 2 | ||||
-rw-r--r-- | sql/sql_delete.cc | 4 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 | ||||
-rw-r--r-- | sql/sql_repl.cc | 21 | ||||
-rw-r--r-- | sql/sql_select.cc | 2 | ||||
-rw-r--r-- | sql/sql_union.cc | 5 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 6 | ||||
-rw-r--r-- | sql/uniques.cc | 3 |
21 files changed, 103 insertions, 105 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index c1bc589e9d4..cb2407efdd0 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1018,7 +1018,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) int STDCALL mysql_master_query(MYSQL *mysql, const char *q, unsigned int length) { - if(mysql_master_send_query(mysql, q, length)) + if (mysql_master_send_query(mysql, q, length)) return 1; return mysql_read_query_result(mysql); } @@ -1040,7 +1040,7 @@ int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q, int STDCALL mysql_slave_query(MYSQL *mysql, const char *q, unsigned int length) { - if(mysql_slave_send_query(mysql, q, length)) + if (mysql_slave_send_query(mysql, q, length)) return 1; return mysql_read_query_result(mysql); } @@ -1050,7 +1050,7 @@ int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q, { MYSQL* last_used_slave, *slave_to_use = 0; - if((last_used_slave = mysql->last_used_slave)) + if ((last_used_slave = mysql->last_used_slave)) slave_to_use = last_used_slave->next_slave; else slave_to_use = mysql->next_slave; @@ -1058,9 +1058,9 @@ int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q, if there are no slaves, mysql->next_slave == mysql */ mysql->last_used_con = mysql->last_used_slave = slave_to_use; - if(!length) + if (!length) length = strlen(q); - if(!slave_to_use->net.vio && !mysql_real_connect(slave_to_use, 0,0,0, + if (!slave_to_use->net.vio && !mysql_real_connect(slave_to_use, 0,0,0, 0,0,0,0)) return 1; return simple_command(slave_to_use, COM_QUERY, q, length, 1); @@ -1122,11 +1122,11 @@ static inline void expand_error(MYSQL* mysql, int error) static inline int get_master(MYSQL* mysql, MYSQL_RES* res, MYSQL_ROW row) { MYSQL* master; - if(mysql_num_fields(res) < 3) + if (mysql_num_fields(res) < 3) return 1; /* safety */ /* use the same username and password as the original connection */ - if(!(master = spawn_init(mysql, row[0], atoi(row[2]), 0, 0))) + if (!(master = spawn_init(mysql, row[0], atoi(row[2]), 0, 0))) return 1; mysql->master = master; return 0; @@ -1178,7 +1178,7 @@ static inline int get_slaves_from_master(MYSQL* mysql) tmp_pass = mysql->passwd; } - if(!(slave = spawn_init(mysql, row[1], atoi(row[2]), + if (!(slave = spawn_init(mysql, row[1], atoi(row[2]), tmp_user, tmp_pass))) goto err; @@ -1188,7 +1188,7 @@ static inline int get_slaves_from_master(MYSQL* mysql) } error = 0; err: - if(res) + if (res) mysql_free_result(res); return error; } @@ -1231,7 +1231,7 @@ int STDCALL mysql_rpl_probe(MYSQL* mysql) error = 0; err: - if(res) + if (res) mysql_free_result(res); return error; } @@ -1255,7 +1255,7 @@ STDCALL mysql_rpl_query_type(const char* q, int len) for(; q < q_end; ++q) { char c; - if(isalpha(c=*q)) + if (isalpha(c=*q)) switch(tolower(c)) { case 'i': /* insert */ @@ -2013,7 +2013,7 @@ mysql_close(MYSQL *mysql) tmp = tmp1; } } - if(mysql != mysql->master) + if (mysql != mysql->master) mysql_close(mysql->master); if (mysql->free_me) my_free((gptr) mysql,MYF(0)); @@ -2033,10 +2033,10 @@ mysql_query(MYSQL *mysql, const char *query) return mysql_real_query(mysql,query, (uint) strlen(query)); } + static MYSQL* spawn_init(MYSQL* parent, const char* host, - unsigned int port, - const char* user, - const char* passwd) + unsigned int port, const char* user, + const char* passwd) { MYSQL* child; if (!(child = mysql_init(0))) @@ -2044,17 +2044,19 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host, child->options.user = my_strdup((user) ? user : (parent->user ? parent->user : - parent->options.user), MYF(0)); - child->options.password = my_strdup((passwd) ? passwd : (parent->passwd ? - parent->passwd : + parent->options.user), MYF(0)); + child->options.password = my_strdup((passwd) ? passwd : + (parent->passwd ? + parent->passwd : parent->options.password), MYF(0)); child->options.port = port; - child->options.host = my_strdup((host) ? host : (parent->host ? - parent->host : - parent->options.host), MYF(0)); - if(parent->db) + child->options.host = my_strdup((host) ? host : + (parent->host ? + parent->host : + parent->options.host), MYF(0)); + if (parent->db) child->options.db = my_strdup(parent->db, MYF(0)); - else if(parent->options.db) + else if (parent->options.db) child->options.db = my_strdup(parent->options.db, MYF(0)); child->options.rpl_parse = child->options.rpl_probe = child->rpl_pivot = 0; @@ -2065,13 +2067,12 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host, int STDCALL mysql_set_master(MYSQL* mysql, const char* host, - unsigned int port, - const char* user, - const char* passwd) + unsigned int port, const char* user, + const char* passwd) { if (mysql->master != mysql && !mysql->master->rpl_pivot) mysql_close(mysql->master); - if(!(mysql->master = spawn_init(mysql, host, port, user, passwd))) + if (!(mysql->master = spawn_init(mysql, host, port, user, passwd))) return 1; mysql->master->rpl_pivot = 0; mysql->master->options.rpl_parse = 0; @@ -2086,7 +2087,7 @@ STDCALL mysql_add_slave(MYSQL* mysql, const char* host, const char* passwd) { MYSQL* slave; - if(!(slave = spawn_init(mysql, host, port, user, passwd))) + if (!(slave = spawn_init(mysql, host, port, user, passwd))) return 1; slave->next_slave = mysql->next_slave; mysql->next_slave = slave; @@ -2105,21 +2106,21 @@ mysql_send_query(MYSQL* mysql, const char* query, uint length) { if (mysql->options.rpl_parse && mysql->rpl_pivot) { - switch (mysql_rpl_query_type(query, length)) - { + switch (mysql_rpl_query_type(query, length)) { case MYSQL_RPL_MASTER: return mysql_master_send_query(mysql, query, length); case MYSQL_RPL_SLAVE: return mysql_slave_send_query(mysql, query, length); - case MYSQL_RPL_ADMIN: /*fall through */ + case MYSQL_RPL_ADMIN: + break; /* fall through */ } } mysql->last_used_con = mysql; - return simple_command(mysql, COM_QUERY, query, length, 1); } + int STDCALL mysql_read_query_result(MYSQL *mysql) { uchar *pos; @@ -2173,6 +2174,7 @@ get_info: DBUG_RETURN(0); } + int STDCALL mysql_real_query(MYSQL *mysql, const char *query, uint length) { @@ -2185,6 +2187,7 @@ mysql_real_query(MYSQL *mysql, const char *query, uint length) DBUG_RETURN(mysql_read_query_result(mysql)); } + static int send_file_to_server(MYSQL *mysql, const char *filename) { diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c index 3562e05006a..ef248b5d62b 100644 --- a/myisam/ft_boolean_search.c +++ b/myisam/ft_boolean_search.c @@ -153,7 +153,9 @@ int do_boolean(ALL_IN_ONE *aio, uint nested __attribute__((unused)), if (selem->count==1) /* document's first match */ { - sptr->yes=sptr->no=sptr->doc.weight=0; + sptr->yes=0; + sptr->no=0; + sptr->doc.weight=0; sptr->aio=aio; sptr->wno=0; } diff --git a/myisam/ft_dump.c b/myisam/ft_dump.c index bb308188969..42439085132 100644 --- a/myisam/ft_dump.c +++ b/myisam/ft_dump.c @@ -17,6 +17,7 @@ /* Written by Sergei A. Golubchik, who has a shared copyright to this code */ #include "ftdefs.h" +#include <getopt.h> static void get_options(int argc,char *argv[]); static void usage(char *argv[]); diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index c192443da0a..62ba76ab792 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -937,7 +937,6 @@ THR_LOCK_DATA **ha_myisam::store_lock(THD *thd, void ha_myisam::update_create_info(HA_CREATE_INFO *create_info) { - MI_ISAMINFO info; table->file->info(HA_STATUS_AUTO | HA_STATUS_CONST); if (!(create_info->used_fields & HA_CREATE_USED_AUTO)) { diff --git a/sql/item_sum.cc b/sql/item_sum.cc index a7e608855ee..812fc636fef 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -795,7 +795,7 @@ static int simple_raw_key_cmp(void* arg, byte* key1, byte* key2) static int simple_str_key_cmp(void* arg, byte* key1, byte* key2) { - return my_sortcmp(key1, key2, *(uint*) arg); + return my_sortcmp((char*) key1, (char*) key2, *(uint*) arg); } /* @@ -832,7 +832,7 @@ int composite_key_cmp(void* arg, byte* key1, byte* key2) int dump_leaf(byte* key, uint32 count __attribute__((unused)), Item_sum_count_distinct* item) { - char* buf = item->table->record[0]; + byte* buf = item->table->record[0]; int error; /* The first item->rec_offset bytes are taken care of with diff --git a/sql/log_event.cc b/sql/log_event.cc index 9076d141f0d..83fac4a7706 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -320,7 +320,7 @@ void Log_event::init_show_field_list(List<Item>* field_list) field_list->push_back(new Item_empty_string("Info", 20)); } -int Log_event::net_send(THD* thd, const char* log_name, ulong pos) +int Log_event::net_send(THD* thd, const char* log_name, my_off_t pos) { String* packet = &thd->packet; const char* p = strrchr(log_name, FN_LIBCHAR); @@ -330,7 +330,7 @@ int Log_event::net_send(THD* thd, const char* log_name, ulong pos) packet->length(0); net_store_data(packet, log_name, strlen(log_name)); - net_store_data(packet, (longlong)pos); + net_store_data(packet, (longlong) pos); event_type = get_type_str(); net_store_data(packet, event_type, strlen(event_type)); net_store_data(packet, server_id); @@ -907,16 +907,16 @@ Load_log_event::Load_log_event(THD* thd, sql_exchange* ex, db_len = (db) ? (uint32) strlen(db) : 0; table_name_len = (table_name) ? (uint32) strlen(table_name) : 0; fname_len = (fname) ? (uint) strlen(fname) : 0; - sql_ex.field_term = (char*)ex->field_term->ptr(); - sql_ex.field_term_len = ex->field_term->length(); - sql_ex.enclosed = (char*)ex->enclosed->ptr(); - sql_ex.enclosed_len = ex->enclosed->length(); - sql_ex.line_term = (char*)ex->line_term->ptr(); - sql_ex.line_term_len = ex->line_term->length(); - sql_ex.line_start = (char*)ex->line_start->ptr(); - sql_ex.line_start_len = ex->line_start->length(); - sql_ex.escaped = (char*)ex->escaped->ptr(); - sql_ex.escaped_len = ex->escaped->length(); + sql_ex.field_term = (char*) ex->field_term->ptr(); + sql_ex.field_term_len = (uint8) ex->field_term->length(); + sql_ex.enclosed = (char*) ex->enclosed->ptr(); + sql_ex.enclosed_len = (uint8) ex->enclosed->length(); + sql_ex.line_term = (char*) ex->line_term->ptr(); + sql_ex.line_term_len = (uint8) ex->line_term->length(); + sql_ex.line_start = (char*) ex->line_start->ptr(); + sql_ex.line_start_len = (uint8) ex->line_start->length(); + sql_ex.escaped = (char*) ex->escaped->ptr(); + sql_ex.escaped_len = (uint8) ex->escaped->length(); sql_ex.opt_flags = 0; sql_ex.cached_new_format = -1; @@ -991,7 +991,7 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len) num_fields = uint4korr(buf + L_NUM_FIELDS_OFFSET + LOG_EVENT_HEADER_LEN); int body_offset = get_data_body_offset(); - if ((int)event_len < body_offset) + if ((int) event_len < body_offset) return 1; //sql_ex.init() on success returns the pointer to the first byte after //the sql_ex structure, which is the start of field lengths array @@ -1233,7 +1233,8 @@ int Create_file_log_event::write_data_body(IO_CACHE* file) int res; if ((res = Load_log_event::write_data_body(file)) || fake_base) return res; - return my_b_write(file, "", 1) || my_b_write(file, block, block_len); + return (my_b_write(file, (byte*) "", 1) || + my_b_write(file, (byte*) block, block_len)); } int Create_file_log_event::write_data_header(IO_CACHE* file) @@ -1241,7 +1242,7 @@ int Create_file_log_event::write_data_header(IO_CACHE* file) int res; if ((res = Load_log_event::write_data_header(file)) || fake_base) return res; - char buf[CREATE_FILE_HEADER_LEN]; + byte buf[CREATE_FILE_HEADER_LEN]; int4store(buf + CF_FILE_ID_OFFSET, file_id); return my_b_write(file, buf, CREATE_FILE_HEADER_LEN); } @@ -1321,10 +1322,10 @@ Append_block_log_event::Append_block_log_event(const char* buf, int len): int Append_block_log_event::write_data(IO_CACHE* file) { - char buf[APPEND_BLOCK_HEADER_LEN]; + byte buf[APPEND_BLOCK_HEADER_LEN]; int4store(buf + AB_FILE_ID_OFFSET, file_id); - return my_b_write(file, buf, APPEND_BLOCK_HEADER_LEN) || - my_b_write(file, block, block_len); + return (my_b_write(file, buf, APPEND_BLOCK_HEADER_LEN) || + my_b_write(file, (byte*) block, block_len)); } #ifdef MYSQL_CLIENT @@ -1371,7 +1372,7 @@ Delete_file_log_event::Delete_file_log_event(const char* buf, int len): int Delete_file_log_event::write_data(IO_CACHE* file) { - char buf[DELETE_FILE_HEADER_LEN]; + byte buf[DELETE_FILE_HEADER_LEN]; int4store(buf + DF_FILE_ID_OFFSET, file_id); return my_b_write(file, buf, DELETE_FILE_HEADER_LEN); } @@ -1418,9 +1419,9 @@ Execute_load_log_event::Execute_load_log_event(const char* buf,int len): int Execute_load_log_event::write_data(IO_CACHE* file) { - char buf[EXEC_LOAD_HEADER_LEN]; - int4store(buf + EL_FILE_ID_OFFSET, file_id); - return my_b_write(file, buf, EXEC_LOAD_HEADER_LEN); + byte buf[EXEC_LOAD_HEADER_LEN]; + int4store(buf + EL_FILE_ID_OFFSET, file_id); + return my_b_write(file, buf, EXEC_LOAD_HEADER_LEN); } #ifdef MYSQL_CLIENT @@ -1711,13 +1712,14 @@ int Slave_log_event::exec_event(struct st_master_info* mi) int Create_file_log_event::exec_event(struct st_master_info* mi) { char fname_buf[FN_REFLEN+10]; - char* p,*p1; + char *p; int fd = -1; IO_CACHE file; int error = 1; - p = slave_load_file_stem(fname_buf, file_id, server_id); - memcpy(p, ".info", 6); + bzero((char*)&file, sizeof(file)); + p = slave_load_file_stem(fname_buf, file_id, server_id); + strmov(p, ".info"); // strmov takes less code than memcpy if ((fd = my_open(fname_buf, O_WRONLY|O_CREAT|O_BINARY|O_TRUNC, MYF(MY_WME))) < 0 || init_io_cache(&file, fd, IO_SIZE, WRITE_CACHE, (my_off_t)0, 0, @@ -1728,12 +1730,12 @@ int Create_file_log_event::exec_event(struct st_master_info* mi) } // a trick to avoid allocating another buffer - memcpy(p, ".data", 6); + strmov(p, ".data"); fname = fname_buf; fname_len = (uint)(p-fname) + 5; if (write_base(&file)) { - memcpy(p, ".info", 6); // to have it right in the error message + strmov(p, ".info"); // to have it right in the error message slave_print_error(my_errno, "Could not write to file '%s'", fname_buf); goto err; } @@ -1747,7 +1749,7 @@ int Create_file_log_event::exec_event(struct st_master_info* mi) slave_print_error(my_errno, "Could not open file '%s'", fname_buf); goto err; } - if (my_write(fd, block, block_len, MYF(MY_WME+MY_NABP))) + if (my_write(fd, (byte*) block, block_len, MYF(MY_WME+MY_NABP))) { slave_print_error(my_errno, "Write to '%s' failed", fname_buf); goto err; @@ -1790,7 +1792,7 @@ int Append_block_log_event::exec_event(struct st_master_info* mi) slave_print_error(my_errno, "Could not open file '%s'", fname); goto err; } - if (my_write(fd, block, block_len, MYF(MY_WME+MY_NABP))) + if (my_write(fd, (byte*) block, block_len, MYF(MY_WME+MY_NABP))) { slave_print_error(my_errno, "Write to '%s' failed", fname); goto err; @@ -1810,7 +1812,7 @@ int Execute_load_log_event::exec_event(struct st_master_info* mi) char* p; int fd = -1; int error = 1; - int save_options; + ulong save_options; IO_CACHE file; Load_log_event* lev = 0; p = slave_load_file_stem(fname, file_id, server_id); @@ -1835,7 +1837,7 @@ int Execute_load_log_event::exec_event(struct st_master_info* mi) // can preserve ascending order of log sequence numbers - needed // to handle failover save_options = thd->options; - thd->options &= ~ (ulong) OPTION_BIN_LOG; + thd->options &= ~ (ulong) (OPTION_BIN_LOG); lev->thd = thd; if (lev->exec_event(0,0)) { diff --git a/sql/log_event.h b/sql/log_event.h index ef795e75e2c..d938bced742 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -72,7 +72,7 @@ struct sql_ex_info char* line_term; char* line_start; char* escaped; - uchar field_term_len,enclosed_len,line_term_len,line_start_len, + uint8 field_term_len,enclosed_len,line_term_len,line_start_len, escaped_len; char opt_flags; char empty_flags; @@ -280,7 +280,7 @@ public: pthread_mutex_t* log_lock); void set_log_seq(THD* thd, MYSQL_LOG* log); virtual void pack_info(String* packet); - int net_send(THD* thd, const char* log_name, ulong pos); + int net_send(THD* thd, const char* log_name, my_off_t pos); static void init_show_field_list(List<Item>* field_list); virtual int exec_event(struct st_master_info* mi); virtual const char* get_db() diff --git a/sql/mini_client.cc b/sql/mini_client.cc index 24c414a8f8b..1afe4c97b8e 100644 --- a/sql/mini_client.cc +++ b/sql/mini_client.cc @@ -1076,7 +1076,7 @@ static int mc_send_file_to_server(MYSQL *mysql, const char *filename) DBUG_RETURN(-1); } - while ((readcount = (int) my_read(fd,buf,sizeof(buf),MYF(0))) > 0) + while ((readcount = (int) my_read(fd,(byte*) buf,sizeof(buf),MYF(0))) > 0) { if (my_net_write(&mysql->net,buf,readcount)) { diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 960ff5cc7bf..43650f365bb 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -42,8 +42,6 @@ #include <sys/types.h> #include <assert.h> -extern "C" { - #ifdef MYSQL_SERVER ulong max_allowed_packet=65536; extern ulong net_read_timeout,net_write_timeout; @@ -832,5 +830,3 @@ my_net_read(NET *net) #endif /* HAVE_COMPRESS */ return len; } - -} diff --git a/sql/opt_range.cc b/sql/opt_range.cc index c1911e002a3..0831634a9a6 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2534,7 +2534,9 @@ QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_SELECT *q, uint used_key_parts) : QUICK_SELECT(*q), rev_it(rev_ranges) { bool not_read_after_key = file->option_flag() & HA_NOT_READ_AFTER_KEY; - for (QUICK_RANGE *r = it++; r; r = it++) + QUICK_RANGE *r; + + for (r = it++; r; r = it++) { rev_ranges.push_front(r); if (not_read_after_key && range_reads_after_key(r) || @@ -2547,7 +2549,7 @@ QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_SELECT *q, uint used_key_parts) } } /* Remove EQ_RANGE flag for keys that are not using the full key */ - for (QUICK_RANGE *r = rev_it++; r; r = rev_it++) + for (r = rev_it++; r; r = rev_it++) { if ((r->flag & EQ_RANGE) && head->key_info[index].key_length != r->max_length) diff --git a/sql/slave.cc b/sql/slave.cc index 6b79e639a90..c70dc34a389 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -593,7 +593,6 @@ error: int register_slave_on_master(MYSQL* mysql) { String packet; - uint len; char buf[4]; if(!report_host) @@ -937,8 +936,6 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) { Log_event * ev = Log_event::read_log_event((const char*)net->read_pos + 1, event_len); - char llbuff[22]; - if (ev) { int type_code = ev->get_type_code(); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 425c81964bc..83be3c1ade1 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -412,7 +412,6 @@ void close_thread_tables(THD *thd, bool locked) DBUG_VOID_RETURN; // LOCK TABLES in use } - TABLE *table,*next; bool found_old_table=0; if (thd->lock) diff --git a/sql/sql_class.h b/sql/sql_class.h index 085ea3d7b34..0104a251f2c 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -606,7 +606,7 @@ class Unique :public Sql_alloc ulong max_elements, max_in_memory_size; IO_CACHE file; TREE tree; - char *record_pointers; + byte *record_pointers; bool flush(); public: diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 2100b3f8318..cacb154fe6b 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -241,7 +241,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, continue; } strxmov(filePath,org_path,"/",file->name,NullS); - if (db && !strcasecmp(fn_ext(file->name), reg_ext)) + if (db && !my_strcasecmp(fn_ext(file->name), reg_ext)) { /* Drop the table nicely */ *fn_ext(file->name)=0; // Remove extension diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index afaa310cbfb..00ebef89fa5 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -324,7 +324,7 @@ bool multi_delete::send_data(List<Item> &values) } else { - error=tempfiles[secure_counter]->unique_add(table->file->ref); + error=tempfiles[secure_counter]->unique_add((char*) table->file->ref); if (error) { error=-1; @@ -378,7 +378,7 @@ void multi_delete::send_error(uint errcode,const char *err) int multi_delete::do_deletes (bool from_send_error) { - int error = 0, counter = 0, count; + int error = 0, counter = 0; if (from_send_error) { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 251906cf0c5..e1131a9ac40 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2913,7 +2913,7 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result) { /* Add not used table to the total table list */ aux->lock_type= lex->lock_option; - if (!(cursor = (TABLE_LIST *) thd->memdup((byte*) aux, + if (!(cursor = (TABLE_LIST *) thd->memdup((char*) aux, sizeof(*aux)))) { send_error(&thd->net,0); diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 1bd84c11c56..f274d1ff91e 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -51,7 +51,7 @@ static uint32* slave_list_key(SLAVE_INFO* si, uint* len, static void slave_info_free(void *s) { - my_free((byte*)s, MYF(MY_WME)); + my_free((gptr) s, MYF(MY_WME)); } void init_slave_list() @@ -109,7 +109,6 @@ static int fake_rotate_event(NET* net, String* packet, char* log_file_name, int register_slave(THD* thd, uchar* packet, uint packet_length) { - uint len; SLAVE_INFO *si, *old_si; int res = 1; uchar* p = packet, *p_end = packet + packet_length; @@ -138,7 +137,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length) err: if (si) - my_free((byte*)si, MYF(MY_WME)); + my_free((gptr) si, MYF(MY_WME)); return res; } @@ -935,7 +934,7 @@ int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg) { LOG_INFO linfo; char search_file_name[FN_REFLEN],last_log_name[FN_REFLEN]; - IO_CACHE log, last_log; + IO_CACHE log; File file = -1, last_file = -1; pthread_mutex_t *log_lock; const char* errmsg_p; @@ -1149,7 +1148,7 @@ int show_binlog_events(THD* thd) uint event_count, limit_start, limit_end; const char* log_file_name = lex_mi->log_file_name; Log_event* ev; - ulong pos = (ulong) lex_mi->pos; + my_off_t pos = lex_mi->pos; limit_start = thd->lex.select->offset_limit; limit_end = thd->lex.select->select_limit + limit_start; @@ -1258,7 +1257,7 @@ int show_slave_hosts(THD* thd) net_store_data(packet, si->user); net_store_data(packet, si->password); } - net_store_data(packet, (uint)si->port); + net_store_data(packet, (uint32) si->port); if (my_net_write(net, (char*)packet->ptr(), packet->length())) { pthread_mutex_unlock(&LOCK_slave_list); @@ -1466,7 +1465,6 @@ int load_master_data(THD* thd) { MYSQL_RES *db_res, **table_res, **table_res_end, **cur_table_res; uint num_dbs; - MYSQL_ROW row; if (mc_mysql_query(&mysql, "show databases", 0) || !(db_res = mc_mysql_store_result(&mysql))) @@ -1476,7 +1474,7 @@ int load_master_data(THD* thd) goto err; } - if (!(num_dbs = mc_mysql_num_rows(db_res))) + if (!(num_dbs = (uint) mc_mysql_num_rows(db_res))) goto err; // in theory, the master could have no databases at all // and run with skip-grant @@ -1511,7 +1509,6 @@ int load_master_data(THD* thd) // since we know how many rows we have, this can never be NULL MYSQL_ROW row = mc_mysql_fetch_row(db_res); char* db = row[0]; - int drop_error; /* Do not replicate databases excluded by rules @@ -1615,15 +1612,15 @@ int log_loaded_block(IO_CACHE* file) lf_info->last_pos_in_file = file->pos_in_file; if (lf_info->wrote_create_file) { - Append_block_log_event a(lf_info->thd, file->buffer,block_len); + Append_block_log_event a(lf_info->thd, (char*) file->buffer, block_len); mysql_bin_log.write(&a); } else { Create_file_log_event c(lf_info->thd,lf_info->ex,lf_info->db, lf_info->table_name, *lf_info->fields, - lf_info->handle_dup, file->buffer, - block_len); + lf_info->handle_dup, (char*) file->buffer, + block_len); mysql_bin_log.write(&c); lf_info->wrote_create_file = 1; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 38aedbb4193..3ae337c47ed 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4859,7 +4859,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), DBUG_RETURN(1); // Not a table_is_full error table->uniques=0; // To ensure rows are the same } - if (++join->send_records >= join->tmp_table_param.end_write_records & + if (++join->send_records >= join->tmp_table_param.end_write_records && join->do_send_rows) { if (!(join->select_options & OPTION_FOUND_ROWS)) diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 8d0c2e6b1e6..5afef6b390d 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -211,9 +211,8 @@ bool select_union::send_eof() bool select_union::flush() { - int error,error2; - error=table->file->extra(HA_EXTRA_NO_CACHE); - if (error) + int error; + if ((error=table->file->extra(HA_EXTRA_NO_CACHE))) { table->file->print_error(error,MYF(0)); ::send_error(&thd->net); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 6a54c3cdd36..5be1b86e8ab 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2053,14 +2053,14 @@ delete_limit_clause: ULONG_NUM: NUM { $$= strtoul($1.str,NULL,10); } - | ULONGLONG_NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } + | ULONGLONG_NUM { $$= (ulong) strtoull($1.str,NULL,10); } | REAL_NUM { $$= strtoul($1.str,NULL,10); } | FLOAT_NUM { $$= strtoul($1.str,NULL,10); } ulonglong_num: NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } - | ULONGLONG_NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } - | LONG_NUM { $$= strtoull($1.str,NULL,10); } + | ULONGLONG_NUM { $$= strtoull($1.str,NULL,10); } + | LONG_NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } | REAL_NUM { $$= strtoull($1.str,NULL,10); } | FLOAT_NUM { $$= strtoull($1.str,NULL,10); } diff --git a/sql/uniques.cc b/sql/uniques.cc index ee1da0f661b..bd3ca6db0d0 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -75,7 +75,8 @@ bool Unique::flush() int unique_write_to_file(gptr key, element_count count, Unique *unique) { - return my_b_write(&unique->file, key, unique->tree.size_of_element) ? 1 : 0; + return my_b_write(&unique->file, (byte*) key, + unique->tree.size_of_element) ? 1 : 0; } int unique_write_to_ptrs(gptr key, element_count count, Unique *unique) |