Commit 0d72e544 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Portability fixes

parent c55cde7c
...@@ -1018,7 +1018,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) ...@@ -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, int STDCALL mysql_master_query(MYSQL *mysql, const char *q,
unsigned int length) unsigned int length)
{ {
if(mysql_master_send_query(mysql, q, length)) if (mysql_master_send_query(mysql, q, length))
return 1; return 1;
return mysql_read_query_result(mysql); return mysql_read_query_result(mysql);
} }
...@@ -1040,7 +1040,7 @@ int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q, ...@@ -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, int STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
unsigned int length) unsigned int length)
{ {
if(mysql_slave_send_query(mysql, q, length)) if (mysql_slave_send_query(mysql, q, length))
return 1; return 1;
return mysql_read_query_result(mysql); return mysql_read_query_result(mysql);
} }
...@@ -1050,7 +1050,7 @@ int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q, ...@@ -1050,7 +1050,7 @@ int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
{ {
MYSQL* last_used_slave, *slave_to_use = 0; 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; slave_to_use = last_used_slave->next_slave;
else else
slave_to_use = mysql->next_slave; slave_to_use = mysql->next_slave;
...@@ -1058,9 +1058,9 @@ int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q, ...@@ -1058,9 +1058,9 @@ int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
if there are no slaves, mysql->next_slave == mysql if there are no slaves, mysql->next_slave == mysql
*/ */
mysql->last_used_con = mysql->last_used_slave = slave_to_use; mysql->last_used_con = mysql->last_used_slave = slave_to_use;
if(!length) if (!length)
length = strlen(q); 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)) 0,0,0,0))
return 1; return 1;
return simple_command(slave_to_use, COM_QUERY, q, length, 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) ...@@ -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) static inline int get_master(MYSQL* mysql, MYSQL_RES* res, MYSQL_ROW row)
{ {
MYSQL* master; MYSQL* master;
if(mysql_num_fields(res) < 3) if (mysql_num_fields(res) < 3)
return 1; /* safety */ return 1; /* safety */
/* use the same username and password as the original connection */ /* 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; return 1;
mysql->master = master; mysql->master = master;
return 0; return 0;
...@@ -1178,7 +1178,7 @@ static inline int get_slaves_from_master(MYSQL* mysql) ...@@ -1178,7 +1178,7 @@ static inline int get_slaves_from_master(MYSQL* mysql)
tmp_pass = mysql->passwd; 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))) tmp_user, tmp_pass)))
goto err; goto err;
...@@ -1188,7 +1188,7 @@ static inline int get_slaves_from_master(MYSQL* mysql) ...@@ -1188,7 +1188,7 @@ static inline int get_slaves_from_master(MYSQL* mysql)
} }
error = 0; error = 0;
err: err:
if(res) if (res)
mysql_free_result(res); mysql_free_result(res);
return error; return error;
} }
...@@ -1231,7 +1231,7 @@ int STDCALL mysql_rpl_probe(MYSQL* mysql) ...@@ -1231,7 +1231,7 @@ int STDCALL mysql_rpl_probe(MYSQL* mysql)
error = 0; error = 0;
err: err:
if(res) if (res)
mysql_free_result(res); mysql_free_result(res);
return error; return error;
} }
...@@ -1255,7 +1255,7 @@ STDCALL mysql_rpl_query_type(const char* q, int len) ...@@ -1255,7 +1255,7 @@ STDCALL mysql_rpl_query_type(const char* q, int len)
for(; q < q_end; ++q) for(; q < q_end; ++q)
{ {
char c; char c;
if(isalpha(c=*q)) if (isalpha(c=*q))
switch(tolower(c)) switch(tolower(c))
{ {
case 'i': /* insert */ case 'i': /* insert */
...@@ -2013,7 +2013,7 @@ mysql_close(MYSQL *mysql) ...@@ -2013,7 +2013,7 @@ mysql_close(MYSQL *mysql)
tmp = tmp1; tmp = tmp1;
} }
} }
if(mysql != mysql->master) if (mysql != mysql->master)
mysql_close(mysql->master); mysql_close(mysql->master);
if (mysql->free_me) if (mysql->free_me)
my_free((gptr) mysql,MYF(0)); my_free((gptr) mysql,MYF(0));
...@@ -2033,9 +2033,9 @@ mysql_query(MYSQL *mysql, const char *query) ...@@ -2033,9 +2033,9 @@ mysql_query(MYSQL *mysql, const char *query)
return mysql_real_query(mysql,query, (uint) strlen(query)); return mysql_real_query(mysql,query, (uint) strlen(query));
} }
static MYSQL* spawn_init(MYSQL* parent, const char* host, static MYSQL* spawn_init(MYSQL* parent, const char* host,
unsigned int port, unsigned int port, const char* user,
const char* user,
const char* passwd) const char* passwd)
{ {
MYSQL* child; MYSQL* child;
...@@ -2045,16 +2045,18 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host, ...@@ -2045,16 +2045,18 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host,
child->options.user = my_strdup((user) ? user : child->options.user = my_strdup((user) ? user :
(parent->user ? parent->user : (parent->user ? parent->user :
parent->options.user), MYF(0)); parent->options.user), MYF(0));
child->options.password = my_strdup((passwd) ? passwd : (parent->passwd ? child->options.password = my_strdup((passwd) ? passwd :
(parent->passwd ?
parent->passwd : parent->passwd :
parent->options.password), MYF(0)); parent->options.password), MYF(0));
child->options.port = port; child->options.port = port;
child->options.host = my_strdup((host) ? host : (parent->host ? child->options.host = my_strdup((host) ? host :
(parent->host ?
parent->host : parent->host :
parent->options.host), MYF(0)); parent->options.host), MYF(0));
if(parent->db) if (parent->db)
child->options.db = my_strdup(parent->db, MYF(0)); 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.db = my_strdup(parent->options.db, MYF(0));
child->options.rpl_parse = child->options.rpl_probe = child->rpl_pivot = 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, ...@@ -2065,13 +2067,12 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host,
int int
STDCALL mysql_set_master(MYSQL* mysql, const char* host, STDCALL mysql_set_master(MYSQL* mysql, const char* host,
unsigned int port, unsigned int port, const char* user,
const char* user,
const char* passwd) const char* passwd)
{ {
if (mysql->master != mysql && !mysql->master->rpl_pivot) if (mysql->master != mysql && !mysql->master->rpl_pivot)
mysql_close(mysql->master); 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; return 1;
mysql->master->rpl_pivot = 0; mysql->master->rpl_pivot = 0;
mysql->master->options.rpl_parse = 0; mysql->master->options.rpl_parse = 0;
...@@ -2086,7 +2087,7 @@ STDCALL mysql_add_slave(MYSQL* mysql, const char* host, ...@@ -2086,7 +2087,7 @@ STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
const char* passwd) const char* passwd)
{ {
MYSQL* slave; MYSQL* slave;
if(!(slave = spawn_init(mysql, host, port, user, passwd))) if (!(slave = spawn_init(mysql, host, port, user, passwd)))
return 1; return 1;
slave->next_slave = mysql->next_slave; slave->next_slave = mysql->next_slave;
mysql->next_slave = slave; mysql->next_slave = slave;
...@@ -2105,21 +2106,21 @@ mysql_send_query(MYSQL* mysql, const char* query, uint length) ...@@ -2105,21 +2106,21 @@ mysql_send_query(MYSQL* mysql, const char* query, uint length)
{ {
if (mysql->options.rpl_parse && mysql->rpl_pivot) 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: case MYSQL_RPL_MASTER:
return mysql_master_send_query(mysql, query, length); return mysql_master_send_query(mysql, query, length);
case MYSQL_RPL_SLAVE: case MYSQL_RPL_SLAVE:
return mysql_slave_send_query(mysql, query, length); 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; mysql->last_used_con = mysql;
return simple_command(mysql, COM_QUERY, query, length, 1); return simple_command(mysql, COM_QUERY, query, length, 1);
} }
int STDCALL mysql_read_query_result(MYSQL *mysql) int STDCALL mysql_read_query_result(MYSQL *mysql)
{ {
uchar *pos; uchar *pos;
...@@ -2173,6 +2174,7 @@ get_info: ...@@ -2173,6 +2174,7 @@ get_info:
DBUG_RETURN(0); DBUG_RETURN(0);
} }
int STDCALL int STDCALL
mysql_real_query(MYSQL *mysql, const char *query, uint length) mysql_real_query(MYSQL *mysql, const char *query, uint length)
{ {
...@@ -2185,6 +2187,7 @@ 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)); DBUG_RETURN(mysql_read_query_result(mysql));
} }
static int static int
send_file_to_server(MYSQL *mysql, const char *filename) send_file_to_server(MYSQL *mysql, const char *filename)
{ {
......
...@@ -153,7 +153,9 @@ int do_boolean(ALL_IN_ONE *aio, uint nested __attribute__((unused)), ...@@ -153,7 +153,9 @@ int do_boolean(ALL_IN_ONE *aio, uint nested __attribute__((unused)),
if (selem->count==1) /* document's first match */ 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->aio=aio;
sptr->wno=0; sptr->wno=0;
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */ /* Written by Sergei A. Golubchik, who has a shared copyright to this code */
#include "ftdefs.h" #include "ftdefs.h"
#include <getopt.h>
static void get_options(int argc,char *argv[]); static void get_options(int argc,char *argv[]);
static void usage(char *argv[]); static void usage(char *argv[]);
......
...@@ -937,7 +937,6 @@ THR_LOCK_DATA **ha_myisam::store_lock(THD *thd, ...@@ -937,7 +937,6 @@ THR_LOCK_DATA **ha_myisam::store_lock(THD *thd,
void ha_myisam::update_create_info(HA_CREATE_INFO *create_info) void ha_myisam::update_create_info(HA_CREATE_INFO *create_info)
{ {
MI_ISAMINFO info;
table->file->info(HA_STATUS_AUTO | HA_STATUS_CONST); table->file->info(HA_STATUS_AUTO | HA_STATUS_CONST);
if (!(create_info->used_fields & HA_CREATE_USED_AUTO)) if (!(create_info->used_fields & HA_CREATE_USED_AUTO))
{ {
......
...@@ -795,7 +795,7 @@ static int simple_raw_key_cmp(void* arg, byte* key1, byte* key2) ...@@ -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) 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) ...@@ -832,7 +832,7 @@ int composite_key_cmp(void* arg, byte* key1, byte* key2)
int dump_leaf(byte* key, uint32 count __attribute__((unused)), int dump_leaf(byte* key, uint32 count __attribute__((unused)),
Item_sum_count_distinct* item) Item_sum_count_distinct* item)
{ {
char* buf = item->table->record[0]; byte* buf = item->table->record[0];
int error; int error;
/* /*
The first item->rec_offset bytes are taken care of with The first item->rec_offset bytes are taken care of with
......
...@@ -320,7 +320,7 @@ void Log_event::init_show_field_list(List<Item>* field_list) ...@@ -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)); 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; String* packet = &thd->packet;
const char* p = strrchr(log_name, FN_LIBCHAR); 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) ...@@ -330,7 +330,7 @@ int Log_event::net_send(THD* thd, const char* log_name, ulong pos)
packet->length(0); packet->length(0);
net_store_data(packet, log_name, strlen(log_name)); 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(); event_type = get_type_str();
net_store_data(packet, event_type, strlen(event_type)); net_store_data(packet, event_type, strlen(event_type));
net_store_data(packet, server_id); net_store_data(packet, server_id);
...@@ -907,16 +907,16 @@ Load_log_event::Load_log_event(THD* thd, sql_exchange* ex, ...@@ -907,16 +907,16 @@ Load_log_event::Load_log_event(THD* thd, sql_exchange* ex,
db_len = (db) ? (uint32) strlen(db) : 0; db_len = (db) ? (uint32) strlen(db) : 0;
table_name_len = (table_name) ? (uint32) strlen(table_name) : 0; table_name_len = (table_name) ? (uint32) strlen(table_name) : 0;
fname_len = (fname) ? (uint) strlen(fname) : 0; fname_len = (fname) ? (uint) strlen(fname) : 0;
sql_ex.field_term = (char*)ex->field_term->ptr(); sql_ex.field_term = (char*) ex->field_term->ptr();
sql_ex.field_term_len = ex->field_term->length(); sql_ex.field_term_len = (uint8) ex->field_term->length();
sql_ex.enclosed = (char*)ex->enclosed->ptr(); sql_ex.enclosed = (char*) ex->enclosed->ptr();
sql_ex.enclosed_len = ex->enclosed->length(); sql_ex.enclosed_len = (uint8) ex->enclosed->length();
sql_ex.line_term = (char*)ex->line_term->ptr(); sql_ex.line_term = (char*) ex->line_term->ptr();
sql_ex.line_term_len = ex->line_term->length(); sql_ex.line_term_len = (uint8) ex->line_term->length();
sql_ex.line_start = (char*)ex->line_start->ptr(); sql_ex.line_start = (char*) ex->line_start->ptr();
sql_ex.line_start_len = ex->line_start->length(); sql_ex.line_start_len = (uint8) ex->line_start->length();
sql_ex.escaped = (char*)ex->escaped->ptr(); sql_ex.escaped = (char*) ex->escaped->ptr();
sql_ex.escaped_len = ex->escaped->length(); sql_ex.escaped_len = (uint8) ex->escaped->length();
sql_ex.opt_flags = 0; sql_ex.opt_flags = 0;
sql_ex.cached_new_format = -1; sql_ex.cached_new_format = -1;
...@@ -991,7 +991,7 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len) ...@@ -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); num_fields = uint4korr(buf + L_NUM_FIELDS_OFFSET + LOG_EVENT_HEADER_LEN);
int body_offset = get_data_body_offset(); int body_offset = get_data_body_offset();
if ((int)event_len < body_offset) if ((int) event_len < body_offset)
return 1; return 1;
//sql_ex.init() on success returns the pointer to the first byte after //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 //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) ...@@ -1233,7 +1233,8 @@ int Create_file_log_event::write_data_body(IO_CACHE* file)
int res; int res;
if ((res = Load_log_event::write_data_body(file)) || fake_base) if ((res = Load_log_event::write_data_body(file)) || fake_base)
return res; 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) 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) ...@@ -1241,7 +1242,7 @@ int Create_file_log_event::write_data_header(IO_CACHE* file)
int res; int res;
if ((res = Load_log_event::write_data_header(file)) || fake_base) if ((res = Load_log_event::write_data_header(file)) || fake_base)
return res; return res;
char buf[CREATE_FILE_HEADER_LEN]; byte buf[CREATE_FILE_HEADER_LEN];
int4store(buf + CF_FILE_ID_OFFSET, file_id); int4store(buf + CF_FILE_ID_OFFSET, file_id);
return my_b_write(file, buf, CREATE_FILE_HEADER_LEN); 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): ...@@ -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) 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); int4store(buf + AB_FILE_ID_OFFSET, file_id);
return my_b_write(file, buf, APPEND_BLOCK_HEADER_LEN) || return (my_b_write(file, buf, APPEND_BLOCK_HEADER_LEN) ||
my_b_write(file, block, block_len); my_b_write(file, (byte*) block, block_len));
} }
#ifdef MYSQL_CLIENT #ifdef MYSQL_CLIENT
...@@ -1371,7 +1372,7 @@ Delete_file_log_event::Delete_file_log_event(const char* buf, int len): ...@@ -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) 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); int4store(buf + DF_FILE_ID_OFFSET, file_id);
return my_b_write(file, buf, DELETE_FILE_HEADER_LEN); return my_b_write(file, buf, DELETE_FILE_HEADER_LEN);
} }
...@@ -1418,7 +1419,7 @@ Execute_load_log_event::Execute_load_log_event(const char* buf,int len): ...@@ -1418,7 +1419,7 @@ Execute_load_log_event::Execute_load_log_event(const char* buf,int len):
int Execute_load_log_event::write_data(IO_CACHE* file) int Execute_load_log_event::write_data(IO_CACHE* file)
{ {
char buf[EXEC_LOAD_HEADER_LEN]; byte buf[EXEC_LOAD_HEADER_LEN];
int4store(buf + EL_FILE_ID_OFFSET, file_id); int4store(buf + EL_FILE_ID_OFFSET, file_id);
return my_b_write(file, buf, EXEC_LOAD_HEADER_LEN); return my_b_write(file, buf, EXEC_LOAD_HEADER_LEN);
} }
...@@ -1711,13 +1712,14 @@ int Slave_log_event::exec_event(struct st_master_info* mi) ...@@ -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) int Create_file_log_event::exec_event(struct st_master_info* mi)
{ {
char fname_buf[FN_REFLEN+10]; char fname_buf[FN_REFLEN+10];
char* p,*p1; char *p;
int fd = -1; int fd = -1;
IO_CACHE file; IO_CACHE file;
int error = 1; int error = 1;
p = slave_load_file_stem(fname_buf, file_id, server_id);
memcpy(p, ".info", 6);
bzero((char*)&file, sizeof(file)); 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, if ((fd = my_open(fname_buf, O_WRONLY|O_CREAT|O_BINARY|O_TRUNC,
MYF(MY_WME))) < 0 || MYF(MY_WME))) < 0 ||
init_io_cache(&file, fd, IO_SIZE, WRITE_CACHE, (my_off_t)0, 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) ...@@ -1728,12 +1730,12 @@ int Create_file_log_event::exec_event(struct st_master_info* mi)
} }
// a trick to avoid allocating another buffer // a trick to avoid allocating another buffer
memcpy(p, ".data", 6); strmov(p, ".data");
fname = fname_buf; fname = fname_buf;
fname_len = (uint)(p-fname) + 5; fname_len = (uint)(p-fname) + 5;
if (write_base(&file)) 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); slave_print_error(my_errno, "Could not write to file '%s'", fname_buf);
goto err; goto err;
} }
...@@ -1747,7 +1749,7 @@ int Create_file_log_event::exec_event(struct st_master_info* mi) ...@@ -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); slave_print_error(my_errno, "Could not open file '%s'", fname_buf);
goto err; 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); slave_print_error(my_errno, "Write to '%s' failed", fname_buf);
goto err; goto err;
...@@ -1790,7 +1792,7 @@ int Append_block_log_event::exec_event(struct st_master_info* mi) ...@@ -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); slave_print_error(my_errno, "Could not open file '%s'", fname);
goto err; 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); slave_print_error(my_errno, "Write to '%s' failed", fname);
goto err; goto err;
...@@ -1810,7 +1812,7 @@ int Execute_load_log_event::exec_event(struct st_master_info* mi) ...@@ -1810,7 +1812,7 @@ int Execute_load_log_event::exec_event(struct st_master_info* mi)
char* p; char* p;
int fd = -1; int fd = -1;
int error = 1; int error = 1;
int save_options; ulong save_options;
IO_CACHE file; IO_CACHE file;
Load_log_event* lev = 0; Load_log_event* lev = 0;
p = slave_load_file_stem(fname, file_id, server_id); 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) ...@@ -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 // can preserve ascending order of log sequence numbers - needed
// to handle failover // to handle failover
save_options = thd->options; save_options = thd->options;
thd->options &= ~ (ulong) OPTION_BIN_LOG; thd->options &= ~ (ulong) (OPTION_BIN_LOG);
lev->thd = thd; lev->thd = thd;
if (lev->exec_event(0,0)) if (lev->exec_event(0,0))
{ {
......
...@@ -72,7 +72,7 @@ struct sql_ex_info ...@@ -72,7 +72,7 @@ struct sql_ex_info
char* line_term; char* line_term;
char* line_start; char* line_start;
char* escaped; 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; escaped_len;
char opt_flags; char opt_flags;
char empty_flags; char empty_flags;
...@@ -280,7 +280,7 @@ public: ...@@ -280,7 +280,7 @@ public:
pthread_mutex_t* log_lock); pthread_mutex_t* log_lock);
void set_log_seq(THD* thd, MYSQL_LOG* log); void set_log_seq(THD* thd, MYSQL_LOG* log);
virtual void pack_info(String* packet); 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); static void init_show_field_list(List<Item>* field_list);
virtual int exec_event(struct st_master_info* mi); virtual int exec_event(struct st_master_info* mi);
virtual const char* get_db() virtual const char* get_db()
......
...@@ -1076,7 +1076,7 @@ static int mc_send_file_to_server(MYSQL *mysql, const char *filename) ...@@ -1076,7 +1076,7 @@ static int mc_send_file_to_server(MYSQL *mysql, const char *filename)
DBUG_RETURN(-1); 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)) if (my_net_write(&mysql->net,buf,readcount))
{ {
......
...@@ -42,8 +42,6 @@ ...@@ -42,8 +42,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <assert.h> #include <assert.h>
extern "C" {
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
ulong max_allowed_packet=65536; ulong max_allowed_packet=65536;
extern ulong net_read_timeout,net_write_timeout; extern ulong net_read_timeout,net_write_timeout;
...@@ -832,5 +830,3 @@ my_net_read(NET *net) ...@@ -832,5 +830,3 @@ my_net_read(NET *net)
#endif /* HAVE_COMPRESS */ #endif /* HAVE_COMPRESS */
return len; return len;
} }
}
...@@ -2534,7 +2534,9 @@ QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_SELECT *q, uint used_key_parts) ...@@ -2534,7 +2534,9 @@ QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_SELECT *q, uint used_key_parts)
: QUICK_SELECT(*q), rev_it(rev_ranges) : QUICK_SELECT(*q), rev_it(rev_ranges)
{ {
bool not_read_after_key = file->option_flag() & HA_NOT_READ_AFTER_KEY; 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); rev_ranges.push_front(r);
if (not_read_after_key && range_reads_after_key(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) ...@@ -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 */ /* 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) && if ((r->flag & EQ_RANGE) &&
head->key_info[index].key_length != r->max_length) head->key_info[index].key_length != r->max_length)
......
...@@ -593,7 +593,6 @@ error: ...@@ -593,7 +593,6 @@ error:
int register_slave_on_master(MYSQL* mysql) int register_slave_on_master(MYSQL* mysql)
{ {
String packet; String packet;
uint len;
char buf[4]; char buf[4];
if(!report_host) if(!report_host)
...@@ -937,8 +936,6 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) ...@@ -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, Log_event * ev = Log_event::read_log_event((const char*)net->read_pos + 1,
event_len); event_len);
char llbuff[22];
if (ev) if (ev)
{ {
int type_code = ev->get_type_code(); int type_code = ev->get_type_code();
......
...@@ -412,7 +412,6 @@ void close_thread_tables(THD *thd, bool locked) ...@@ -412,7 +412,6 @@ void close_thread_tables(THD *thd, bool locked)
DBUG_VOID_RETURN; // LOCK TABLES in use DBUG_VOID_RETURN; // LOCK TABLES in use
} }
TABLE *table,*next;
bool found_old_table=0; bool found_old_table=0;
if (thd->lock) if (thd->lock)
......
...@@ -606,7 +606,7 @@ class Unique :public Sql_alloc ...@@ -606,7 +606,7 @@ class Unique :public Sql_alloc
ulong max_elements, max_in_memory_size; ulong max_elements, max_in_memory_size;
IO_CACHE file; IO_CACHE file;
TREE tree; TREE tree;
char *record_pointers; byte *record_pointers;
bool flush(); bool flush();
public: public:
......
...@@ -241,7 +241,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, ...@@ -241,7 +241,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
continue; continue;
} }
strxmov(filePath,org_path,"/",file->name,NullS); 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 */ /* Drop the table nicely */
*fn_ext(file->name)=0; // Remove extension *fn_ext(file->name)=0; // Remove extension
......
...@@ -324,7 +324,7 @@ bool multi_delete::send_data(List<Item> &values) ...@@ -324,7 +324,7 @@ bool multi_delete::send_data(List<Item> &values)
} }
else else
{ {
error=tempfiles[secure_counter]->unique_add(table->file->ref); error=tempfiles[secure_counter]->unique_add((char*) table->file->ref);
if (error) if (error)
{ {
error=-1; error=-1;
...@@ -378,7 +378,7 @@ void multi_delete::send_error(uint errcode,const char *err) ...@@ -378,7 +378,7 @@ void multi_delete::send_error(uint errcode,const char *err)
int multi_delete::do_deletes (bool from_send_error) int multi_delete::do_deletes (bool from_send_error)
{ {
int error = 0, counter = 0, count; int error = 0, counter = 0;
if (from_send_error) if (from_send_error)
{ {
......
...@@ -2913,7 +2913,7 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result) ...@@ -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 */ /* Add not used table to the total table list */
aux->lock_type= lex->lock_option; aux->lock_type= lex->lock_option;
if (!(cursor = (TABLE_LIST *) thd->memdup((byte*) aux, if (!(cursor = (TABLE_LIST *) thd->memdup((char*) aux,
sizeof(*aux)))) sizeof(*aux))))
{ {
send_error(&thd->net,0); send_error(&thd->net,0);
......
...@@ -51,7 +51,7 @@ static uint32* slave_list_key(SLAVE_INFO* si, uint* len, ...@@ -51,7 +51,7 @@ static uint32* slave_list_key(SLAVE_INFO* si, uint* len,
static void slave_info_free(void *s) 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() void init_slave_list()
...@@ -109,7 +109,6 @@ static int fake_rotate_event(NET* net, String* packet, char* log_file_name, ...@@ -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) int register_slave(THD* thd, uchar* packet, uint packet_length)
{ {
uint len;
SLAVE_INFO *si, *old_si; SLAVE_INFO *si, *old_si;
int res = 1; int res = 1;
uchar* p = packet, *p_end = packet + packet_length; uchar* p = packet, *p_end = packet + packet_length;
...@@ -138,7 +137,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length) ...@@ -138,7 +137,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length)
err: err:
if (si) if (si)
my_free((byte*)si, MYF(MY_WME)); my_free((gptr) si, MYF(MY_WME));
return res; return res;
} }
...@@ -935,7 +934,7 @@ int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg) ...@@ -935,7 +934,7 @@ int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg)
{ {
LOG_INFO linfo; LOG_INFO linfo;
char search_file_name[FN_REFLEN],last_log_name[FN_REFLEN]; 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; File file = -1, last_file = -1;
pthread_mutex_t *log_lock; pthread_mutex_t *log_lock;
const char* errmsg_p; const char* errmsg_p;
...@@ -1149,7 +1148,7 @@ int show_binlog_events(THD* thd) ...@@ -1149,7 +1148,7 @@ int show_binlog_events(THD* thd)
uint event_count, limit_start, limit_end; uint event_count, limit_start, limit_end;
const char* log_file_name = lex_mi->log_file_name; const char* log_file_name = lex_mi->log_file_name;
Log_event* ev; Log_event* ev;
ulong pos = (ulong) lex_mi->pos; my_off_t pos = lex_mi->pos;
limit_start = thd->lex.select->offset_limit; limit_start = thd->lex.select->offset_limit;
limit_end = thd->lex.select->select_limit + limit_start; limit_end = thd->lex.select->select_limit + limit_start;
...@@ -1258,7 +1257,7 @@ int show_slave_hosts(THD* thd) ...@@ -1258,7 +1257,7 @@ int show_slave_hosts(THD* thd)
net_store_data(packet, si->user); net_store_data(packet, si->user);
net_store_data(packet, si->password); 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())) if (my_net_write(net, (char*)packet->ptr(), packet->length()))
{ {
pthread_mutex_unlock(&LOCK_slave_list); pthread_mutex_unlock(&LOCK_slave_list);
...@@ -1466,7 +1465,6 @@ int load_master_data(THD* thd) ...@@ -1466,7 +1465,6 @@ int load_master_data(THD* thd)
{ {
MYSQL_RES *db_res, **table_res, **table_res_end, **cur_table_res; MYSQL_RES *db_res, **table_res, **table_res_end, **cur_table_res;
uint num_dbs; uint num_dbs;
MYSQL_ROW row;
if (mc_mysql_query(&mysql, "show databases", 0) || if (mc_mysql_query(&mysql, "show databases", 0) ||
!(db_res = mc_mysql_store_result(&mysql))) !(db_res = mc_mysql_store_result(&mysql)))
...@@ -1476,7 +1474,7 @@ int load_master_data(THD* thd) ...@@ -1476,7 +1474,7 @@ int load_master_data(THD* thd)
goto err; goto err;
} }
if (!(num_dbs = mc_mysql_num_rows(db_res))) if (!(num_dbs = (uint) mc_mysql_num_rows(db_res)))
goto err; goto err;
// in theory, the master could have no databases at all // in theory, the master could have no databases at all
// and run with skip-grant // and run with skip-grant
...@@ -1511,7 +1509,6 @@ int load_master_data(THD* thd) ...@@ -1511,7 +1509,6 @@ int load_master_data(THD* thd)
// since we know how many rows we have, this can never be NULL // since we know how many rows we have, this can never be NULL
MYSQL_ROW row = mc_mysql_fetch_row(db_res); MYSQL_ROW row = mc_mysql_fetch_row(db_res);
char* db = row[0]; char* db = row[0];
int drop_error;
/* /*
Do not replicate databases excluded by rules Do not replicate databases excluded by rules
...@@ -1615,14 +1612,14 @@ int log_loaded_block(IO_CACHE* file) ...@@ -1615,14 +1612,14 @@ int log_loaded_block(IO_CACHE* file)
lf_info->last_pos_in_file = file->pos_in_file; lf_info->last_pos_in_file = file->pos_in_file;
if (lf_info->wrote_create_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); mysql_bin_log.write(&a);
} }
else else
{ {
Create_file_log_event c(lf_info->thd,lf_info->ex,lf_info->db, Create_file_log_event c(lf_info->thd,lf_info->ex,lf_info->db,
lf_info->table_name, *lf_info->fields, lf_info->table_name, *lf_info->fields,
lf_info->handle_dup, file->buffer, lf_info->handle_dup, (char*) file->buffer,
block_len); block_len);
mysql_bin_log.write(&c); mysql_bin_log.write(&c);
lf_info->wrote_create_file = 1; lf_info->wrote_create_file = 1;
......
...@@ -4859,7 +4859,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), ...@@ -4859,7 +4859,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
DBUG_RETURN(1); // Not a table_is_full error DBUG_RETURN(1); // Not a table_is_full error
table->uniques=0; // To ensure rows are the same 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) join->do_send_rows)
{ {
if (!(join->select_options & OPTION_FOUND_ROWS)) if (!(join->select_options & OPTION_FOUND_ROWS))
......
...@@ -211,9 +211,8 @@ bool select_union::send_eof() ...@@ -211,9 +211,8 @@ bool select_union::send_eof()
bool select_union::flush() bool select_union::flush()
{ {
int error,error2; int error;
error=table->file->extra(HA_EXTRA_NO_CACHE); if ((error=table->file->extra(HA_EXTRA_NO_CACHE)))
if (error)
{ {
table->file->print_error(error,MYF(0)); table->file->print_error(error,MYF(0));
::send_error(&thd->net); ::send_error(&thd->net);
......
...@@ -2053,14 +2053,14 @@ delete_limit_clause: ...@@ -2053,14 +2053,14 @@ delete_limit_clause:
ULONG_NUM: ULONG_NUM:
NUM { $$= strtoul($1.str,NULL,10); } 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); } | REAL_NUM { $$= strtoul($1.str,NULL,10); }
| FLOAT_NUM { $$= strtoul($1.str,NULL,10); } | FLOAT_NUM { $$= strtoul($1.str,NULL,10); }
ulonglong_num: ulonglong_num:
NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } NUM { $$= (ulonglong) strtoul($1.str,NULL,10); }
| ULONGLONG_NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } | ULONGLONG_NUM { $$= strtoull($1.str,NULL,10); }
| LONG_NUM { $$= strtoull($1.str,NULL,10); } | LONG_NUM { $$= (ulonglong) strtoul($1.str,NULL,10); }
| REAL_NUM { $$= strtoull($1.str,NULL,10); } | REAL_NUM { $$= strtoull($1.str,NULL,10); }
| FLOAT_NUM { $$= strtoull($1.str,NULL,10); } | FLOAT_NUM { $$= strtoull($1.str,NULL,10); }
......
...@@ -75,7 +75,8 @@ bool Unique::flush() ...@@ -75,7 +75,8 @@ bool Unique::flush()
int unique_write_to_file(gptr key, element_count count, Unique *unique) 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) int unique_write_to_ptrs(gptr key, element_count count, Unique *unique)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment