diff options
author | unknown <tsmith@quadxeon.mysql.com> | 2007-06-05 17:51:30 +0200 |
---|---|---|
committer | unknown <tsmith@quadxeon.mysql.com> | 2007-06-05 17:51:30 +0200 |
commit | 72ba6bba75564d90fc3beafda900e1356776a631 (patch) | |
tree | 50b7ef6b918f2c9add6a6f5f3237ef8e777f57e8 /server-tools | |
parent | 14835ef95e307701e3c60790b4f007941cee842b (diff) | |
parent | f42bcd7774b09cd05fcb4a9e29496de5b8ebb33a (diff) | |
download | mariadb-git-72ba6bba75564d90fc3beafda900e1356776a631.tar.gz |
Merge quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/51
into quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/jun05/51
client/mysqldump.c:
Auto merged
include/m_string.h:
Auto merged
include/mysql_com.h:
Auto merged
include/violite.h:
Auto merged
libmysql/libmysql.c:
Auto merged
mysql-test/include/mix1.inc:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/r/innodb_mysql.result:
Auto merged
mysql-test/r/ps.result:
Auto merged
mysql-test/t/mysqltest.test:
Auto merged
mysql-test/t/ps.test:
Auto merged
mysys/my_init.c:
Auto merged
server-tools/instance-manager/mysql_connection.cc:
Auto merged
sql/field.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/net_serv.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_connect.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/sql_repl.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql-common/client.c:
Auto merged
sql/sql_yacc.yy:
Auto merged
strings/ctype-mb.c:
Auto merged
strings/ctype-ucs2.c:
Auto merged
strings/strtod.c:
Auto merged
vio/vio_priv.h:
Auto merged
vio/viosocket.c:
Auto merged
client/mysqltest.c:
SCCS merged
include/my_global.h:
SCCS merged
sql/field.h:
SCCS merged
sql/sql_table.cc:
Manual merge
strings/ctype-bin.c:
Manual merge
Diffstat (limited to 'server-tools')
-rw-r--r-- | server-tools/instance-manager/buffer.cc | 10 | ||||
-rw-r--r-- | server-tools/instance-manager/buffer.h | 8 | ||||
-rw-r--r-- | server-tools/instance-manager/commands.cc | 37 | ||||
-rw-r--r-- | server-tools/instance-manager/instance_map.cc | 28 | ||||
-rw-r--r-- | server-tools/instance-manager/instance_options.cc | 12 | ||||
-rw-r--r-- | server-tools/instance-manager/mysql_connection.cc | 19 | ||||
-rw-r--r-- | server-tools/instance-manager/options.cc | 74 | ||||
-rw-r--r-- | server-tools/instance-manager/parse.cc | 10 | ||||
-rw-r--r-- | server-tools/instance-manager/parse.h | 10 | ||||
-rw-r--r-- | server-tools/instance-manager/protocol.cc | 28 | ||||
-rw-r--r-- | server-tools/instance-manager/protocol.h | 7 | ||||
-rw-r--r-- | server-tools/instance-manager/user_map.cc | 16 |
12 files changed, 131 insertions, 128 deletions
diff --git a/server-tools/instance-manager/buffer.cc b/server-tools/instance-manager/buffer.cc index 67be2382523..1c50b11609e 100644 --- a/server-tools/instance-manager/buffer.cc +++ b/server-tools/instance-manager/buffer.cc @@ -44,12 +44,12 @@ const uint Buffer::MAX_BUFFER_SIZE= 16777216; 1 - got an error in reserve() */ -int Buffer::append(uint position, const char *string, uint len_arg) +int Buffer::append(size_t position, const char *string, size_t len_arg) { if (reserve(position, len_arg)) return 1; - strnmov(buffer + position, string, len_arg); + strnmov((char*) buffer + position, string, len_arg); return 0; } @@ -75,20 +75,20 @@ int Buffer::append(uint position, const char *string, uint len_arg) 1 - realloc error or we have come to the 16Mb barrier */ -int Buffer::reserve(uint position, uint len_arg) +int Buffer::reserve(size_t position, size_t len_arg) { if (position + len_arg >= MAX_BUFFER_SIZE) goto err; if (position + len_arg >= buffer_size) { - buffer= (char*) my_realloc(buffer, + buffer= (uchar*) my_realloc(buffer, min(MAX_BUFFER_SIZE, max((uint) (buffer_size*1.5), position + len_arg)), MYF(0)); if (!(buffer)) goto err; - buffer_size= (uint) (buffer_size*1.5); + buffer_size= (size_t) (buffer_size*1.5); } return 0; diff --git a/server-tools/instance-manager/buffer.h b/server-tools/instance-manager/buffer.h index a551dd98a25..3bd7a714437 100644 --- a/server-tools/instance-manager/buffer.h +++ b/server-tools/instance-manager/buffer.h @@ -45,7 +45,7 @@ public: /* As append() will invokes realloc() anyway, it's ok if malloc returns 0 */ - if (!(buffer= (char*) my_malloc(buffer_size, MYF(0)))) + if (!(buffer= (uchar*) my_malloc(buffer_size, MYF(0)))) buffer_size= 0; } @@ -55,11 +55,11 @@ public: } public: - char *buffer; + uchar *buffer; int get_size(); int is_error(); - int append(uint position, const char *string, uint len_arg); - int reserve(uint position, uint len_arg); + int append(size_t position, const char *string, size_t len_arg); + int reserve(size_t position, size_t len_arg); }; #endif /* INCLUDES_MYSQL_INSTANCE_MANAGER_BUFFER_H */ diff --git a/server-tools/instance-manager/commands.cc b/server-tools/instance-manager/commands.cc index 393aceadca9..56bd720b3e9 100644 --- a/server-tools/instance-manager/commands.cc +++ b/server-tools/instance-manager/commands.cc @@ -170,7 +170,7 @@ int Show_instances::write_data(st_net *net) while ((instance= iterator.next())) { Buffer send_buf; /* buffer for packets */ - uint pos= 0; + size_t pos= 0; instance->lock(); @@ -356,7 +356,7 @@ int Show_instance_status::write_data(st_net *net, Instance *instance) { Buffer send_buf; /* buffer for packets */ char version_num_buf[MAX_VERSION_LENGTH]; - uint pos= 0; + size_t pos= 0; const char *state_name= instance->get_state_name(); const char *version_tag= "unknown"; @@ -379,7 +379,7 @@ int Show_instance_status::write_data(st_net *net, Instance *instance) store_to_protocol_packet(&send_buf, version_num, &pos) || store_to_protocol_packet(&send_buf, version_tag, &pos) || store_to_protocol_packet(&send_buf, mysqld_compatible_status, &pos) || - my_net_write(net, send_buf.buffer, (uint) pos)) + my_net_write(net, send_buf.buffer, pos)) { return ER_OUT_OF_RESOURCES; } @@ -455,7 +455,7 @@ int Show_instance_options::write_header(st_net *net) int Show_instance_options::write_data(st_net *net, Instance *instance) { Buffer send_buff; /* buffer for packets */ - uint pos= 0; + size_t pos= 0; if (store_to_protocol_packet(&send_buff, "instance_name", &pos) || store_to_protocol_packet(&send_buff, get_instance_name()->str, &pos) || @@ -618,7 +618,7 @@ bool Create_instance::init(const char **text) bool Create_instance::parse_args(const char **text) { - uint len; + size_t len; /* Check if we have something (and trim leading spaces). */ @@ -991,13 +991,13 @@ int Show_instance_log::write_header(st_net *net) int Show_instance_log::write_data(st_net *net, Instance *instance) { Buffer send_buff; /* buffer for packets */ - uint pos= 0; + size_t pos= 0; const char *logpath= instance->options.logs[log_type]; File fd; size_t buff_size; - int read_len; + size_t read_len; MY_STAT file_stat; Buffer read_buff; @@ -1020,8 +1020,8 @@ int Show_instance_log::write_data(st_net *net, Instance *instance) /* read in one chunk */ read_len= (int)my_seek(fd, file_stat.st_size - size, MY_SEEK_SET, MYF(0)); - if ((read_len= my_read(fd, (byte*) read_buff.buffer, - buff_size, MYF(0))) < 0) + if ((read_len= my_read(fd, read_buff.buffer, buff_size, MYF(0))) == + MY_FILE_ERROR) { close(fd); return ER_READ_FILE; @@ -1029,7 +1029,8 @@ int Show_instance_log::write_data(st_net *net, Instance *instance) close(fd); - if (store_to_protocol_packet(&send_buff, read_buff.buffer, &pos, read_len) || + if (store_to_protocol_packet(&send_buff, (char*) read_buff.buffer, &pos, + read_len) || my_net_write(net, send_buff.buffer, pos)) { return ER_OUT_OF_RESOURCES; @@ -1142,7 +1143,7 @@ int Show_instance_log_files::write_data(st_net *net, Instance *instance) enum { LOG_NAME_BUFFER_SIZE= 20 }; char buff[LOG_NAME_BUFFER_SIZE]; - uint pos= 0; + size_t pos= 0; const char *log_path= ""; const char *log_size= "0"; @@ -1227,12 +1228,12 @@ bool Instance_options_list::init() C_MODE_START -static byte* get_item_key(const byte* item, uint* len, - my_bool __attribute__((unused)) t) +static uchar* get_item_key(const uchar* item, size_t* len, + my_bool __attribute__((unused)) t) { const Instance_options_list *lst= (const Instance_options_list *) item; *len= lst->get_instance_name()->length; - return (byte *) lst->get_instance_name()->str; + return (uchar *) lst->get_instance_name()->str; } static void delete_item(void *item) @@ -1358,7 +1359,7 @@ Abstract_option_cmd::get_instance_options_list(const LEX_STRING *instance_name) { Instance_options_list *lst= (Instance_options_list *) hash_search(&instance_options_map, - (byte *) instance_name->str, + (uchar *) instance_name->str, instance_name->length); if (!lst) @@ -1368,7 +1369,7 @@ Abstract_option_cmd::get_instance_options_list(const LEX_STRING *instance_name) if (!lst) return NULL; - if (lst->init() || my_hash_insert(&instance_options_map, (byte *) lst)) + if (lst->init() || my_hash_insert(&instance_options_map, (uchar *) lst)) { delete lst; return NULL; @@ -1458,7 +1459,7 @@ int Abstract_option_cmd::execute_impl(st_net *net, ulong connection_id) bool Set_option::parse_args(const char **text) { - uint len; + size_t len; /* Check if we have something (and trim leading spaces). */ @@ -1632,7 +1633,7 @@ int Set_option::process_option(Instance *instance, Named_value *option) bool Unset_option::parse_args(const char **text) { - uint len; + size_t len; /* Check if we have something (and trim leading spaces). */ diff --git a/server-tools/instance-manager/instance_map.cc b/server-tools/instance-manager/instance_map.cc index 5d492fe5c11..d7328d51cfe 100644 --- a/server-tools/instance-manager/instance_map.cc +++ b/server-tools/instance-manager/instance_map.cc @@ -37,12 +37,12 @@ C_MODE_START HASH-routines: get key of instance for storing in hash. */ -static byte* get_instance_key(const byte* u, uint* len, - my_bool __attribute__((unused)) t) +static uchar* get_instance_key(const uchar* u, size_t* len, + my_bool __attribute__((unused)) t) { const Instance *instance= (const Instance *) u; *len= instance->options.instance_name.length; - return (byte *) instance->options.instance_name.str; + return (uchar *) instance->options.instance_name.str; } /** @@ -165,7 +165,7 @@ int Instance_map::process_one_option(const LEX_STRING *group, return 0; } - if (!(instance= (Instance *) hash_search(&hash, (byte *) group->str, + if (!(instance= (Instance *) hash_search(&hash, (uchar *) group->str, group->length))) { if (!(instance= new Instance())) @@ -332,7 +332,7 @@ bool Instance_map::is_there_active_instance() int Instance_map::add_instance(Instance *instance) { - return my_hash_insert(&hash, (byte *) instance); + return my_hash_insert(&hash, (uchar *) instance); } @@ -344,7 +344,7 @@ int Instance_map::add_instance(Instance *instance) int Instance_map::remove_instance(Instance *instance) { - return hash_delete(&hash, (byte *) instance); + return hash_delete(&hash, (uchar *) instance); } @@ -425,7 +425,7 @@ int Instance_map::create_instance(const LEX_STRING *instance_name, Instance * Instance_map::find(const LEX_STRING *name) { - return (Instance *) hash_search(&hash, (byte *) name->str, name->length); + return (Instance *) hash_search(&hash, (uchar *) name->str, name->length); } @@ -603,12 +603,12 @@ int create_instance_in_file(const LEX_STRING *instance_name, return ER_ACCESS_OPTION_FILE; } - if (my_write(cnf_file, (byte*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP)) || - my_write(cnf_file, (byte*)"[", 1, MYF(MY_NABP)) || - my_write(cnf_file, (byte*)instance_name->str, instance_name->length, + if (my_write(cnf_file, (uchar*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP)) || + my_write(cnf_file, (uchar*)"[", 1, MYF(MY_NABP)) || + my_write(cnf_file, (uchar*)instance_name->str, instance_name->length, MYF(MY_NABP)) || - my_write(cnf_file, (byte*)"]", 1, MYF(MY_NABP)) || - my_write(cnf_file, (byte*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP))) + my_write(cnf_file, (uchar*)"]", 1, MYF(MY_NABP)) || + my_write(cnf_file, (uchar*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP))) { log_error("Can not write to configuration file (%s): %s.", (const char *) Options::Main::config_file, @@ -631,8 +631,8 @@ int create_instance_in_file(const LEX_STRING *instance_name, option_str_len= ptr - option_str; - if (my_write(cnf_file, (byte*)option_str, option_str_len, MYF(MY_NABP)) || - my_write(cnf_file, (byte*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP))) + if (my_write(cnf_file, (uchar*)option_str, option_str_len, MYF(MY_NABP)) || + my_write(cnf_file, (uchar*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP))) { log_error("Can not write to configuration file (%s): %s.", (const char *) Options::Main::config_file, diff --git a/server-tools/instance-manager/instance_options.cc b/server-tools/instance-manager/instance_options.cc index 6b23df97f7f..5665c6f8670 100644 --- a/server-tools/instance-manager/instance_options.cc +++ b/server-tools/instance-manager/instance_options.cc @@ -156,7 +156,7 @@ int Instance_options::get_default_option(char *result, size_t result_len, goto err; /* +2 eats first "--" from the option string (E.g. "--datadir") */ - rc= parse_output_and_get_value(cmd.buffer, option_name + 2, + rc= parse_output_and_get_value((char*) cmd.buffer, option_name + 2, result, result_len, GET_VALUE); err: return rc; @@ -194,7 +194,7 @@ bool Instance_options::fill_instance_version() bzero(result, MAX_VERSION_LENGTH); - if (parse_output_and_get_value(cmd.buffer, "Ver", result, + if (parse_output_and_get_value((char*) cmd.buffer, "Ver", result, MAX_VERSION_LENGTH, GET_LINE)) { log_error("Failed to get version of '%s': unexpected output.", @@ -255,7 +255,7 @@ bool Instance_options::fill_mysqld_real_path() bzero(result, FN_REFLEN); - if (parse_output_and_get_value(cmd.buffer, "Usage: ", + if (parse_output_and_get_value((char*) cmd.buffer, "Usage: ", result, FN_REFLEN, GET_LINE)) { @@ -466,13 +466,9 @@ bool Instance_options::complete_initialization() Need to copy the path to allocated memory, as convert_dirname() might need to change it */ - mysqld_path.str= - alloc_root(&alloc, strlen(Options::Main::default_mysqld_path) + 1); - + mysqld_path.str= strdup_root(&alloc, Options::Main::default_mysqld_path); if (!mysqld_path.str) return TRUE; - - strcpy(mysqld_path.str, Options::Main::default_mysqld_path); } mysqld_path.length= strlen(mysqld_path.str); diff --git a/server-tools/instance-manager/mysql_connection.cc b/server-tools/instance-manager/mysql_connection.cc index 91629adfd51..bf08f963aa3 100644 --- a/server-tools/instance-manager/mysql_connection.cc +++ b/server-tools/instance-manager/mysql_connection.cc @@ -147,12 +147,12 @@ int Mysql_connection::check_connection() ulong pkt_len=0; // to hold client reply length /* buffer for the first packet */ /* packet contains: */ - char buff[MAX_VERSION_LENGTH + 1 + // server version, 0-ended - 4 + // connection id - SCRAMBLE_LENGTH + 2 + // scramble (in 2 pieces) - 18]; // server variables: flags, + uchar buff[MAX_VERSION_LENGTH + 1 + // server version, 0-ended + 4 + // connection id + SCRAMBLE_LENGTH + 2 + // scramble (in 2 pieces) + 18]; // server variables: flags, // charset number, status, - char *pos= buff; + uchar *pos= buff; ulong server_flags; memcpy(pos, mysqlmanager_version.str, mysqlmanager_version.length + 1); @@ -195,7 +195,8 @@ int Mysql_connection::check_connection() /* write connection message and read reply */ enum { MIN_HANDSHAKE_SIZE= 2 }; - if (net_write_command(&net, protocol_version, "", 0, buff, pos - buff) || + if (net_write_command(&net, protocol_version, (uchar*) "", 0, + buff, pos - buff) || (pkt_len= my_net_read(&net)) == packet_error || pkt_len < MIN_HANDSHAKE_SIZE) { @@ -211,17 +212,17 @@ int Mysql_connection::check_connection() } client_capabilities|= ((ulong) uint2korr(net.read_pos + 2)) << 16; - pos= (char*) net.read_pos + 32; + pos= net.read_pos + 32; /* At least one byte for username and one byte for password */ - if (pos >= (char*) net.read_pos + pkt_len + 2) + if (pos >= net.read_pos + pkt_len + 2) { /*TODO add user and password handling in error messages*/ net_send_error(&net, ER_HANDSHAKE_ERROR); return 1; } - const char *user= pos; + const char *user= (char*) pos; const char *password= strend(user)+1; ulong password_len= *password++; LEX_STRING user_name= { (char *) user, password - user - 2 }; diff --git a/server-tools/instance-manager/options.cc b/server-tools/instance-manager/options.cc index 74e7812ea72..7eba3187dd9 100644 --- a/server-tools/instance-manager/options.cc +++ b/server-tools/instance-manager/options.cc @@ -152,14 +152,14 @@ static struct my_option my_long_options[] = #ifndef __WIN__ { "angel-pid-file", OPT_ANGEL_PID_FILE, "Pid file for angel process.", - (gptr *) &Options::Daemon::angel_pid_file_name, - (gptr *) &Options::Daemon::angel_pid_file_name, + (uchar* *) &Options::Daemon::angel_pid_file_name, + (uchar* *) &Options::Daemon::angel_pid_file_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, #endif { "bind-address", OPT_BIND_ADDRESS, "Bind address to use for connection.", - (gptr *) &Options::Main::bind_address, - (gptr *) &Options::Main::bind_address, + (uchar* *) &Options::Main::bind_address, + (uchar* *) &Options::Main::bind_address, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "check-password-file", OPT_CHECK_PASSWORD_FILE, @@ -172,15 +172,15 @@ static struct my_option my_long_options[] = #ifndef DBUG_OFF {"debug", '#', "Debug log.", - (gptr *) &Options::Debug::config_str, - (gptr *) &Options::Debug::config_str, + (uchar* *) &Options::Debug::config_str, + (uchar* *) &Options::Debug::config_str, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif { "default-mysqld-path", OPT_MYSQLD_PATH, "Where to look for MySQL" " Server binary.", - (gptr *) &Options::Main::default_mysqld_path, - (gptr *) &Options::Main::default_mysqld_path, + (uchar* *) &Options::Main::default_mysqld_path, + (uchar* *) &Options::Main::default_mysqld_path, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, { "drop-user", OPT_DROP_USER, @@ -193,8 +193,8 @@ static struct my_option my_long_options[] = #ifdef __WIN__ { "install", OPT_INSTALL_SERVICE, "Install as system service.", - (gptr *) &Options::Service::install_as_service, - (gptr *) &Options::Service::install_as_service, + (uchar* *) &Options::Service::install_as_service, + (uchar* *) &Options::Service::install_as_service, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 }, #endif @@ -204,22 +204,22 @@ static struct my_option my_long_options[] = #ifndef __WIN__ { "log", OPT_LOG, "Path to log file. Used only with --run-as-service.", - (gptr *) &Options::Daemon::log_file_name, - (gptr *) &Options::Daemon::log_file_name, + (uchar* *) &Options::Daemon::log_file_name, + (uchar* *) &Options::Daemon::log_file_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, #endif { "monitoring-interval", OPT_MONITORING_INTERVAL, "Interval to monitor" " instances in seconds.", - (gptr *) &Options::Main::monitoring_interval, - (gptr *) &Options::Main::monitoring_interval, + (uchar* *) &Options::Main::monitoring_interval, + (uchar* *) &Options::Main::monitoring_interval, 0, GET_UINT, REQUIRED_ARG, DEFAULT_MONITORING_INTERVAL, 0, 0, 0, 0, 0 }, { "mysqld-safe-compatible", OPT_MYSQLD_SAFE_COMPATIBLE, "Start Instance Manager in mysqld_safe compatible manner", - (gptr *) &Options::Main::mysqld_safe_compatible, - (gptr *) &Options::Main::mysqld_safe_compatible, + (uchar* *) &Options::Main::mysqld_safe_compatible, + (uchar* *) &Options::Main::mysqld_safe_compatible, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 }, { "print-password-line", OPT_PRINT_PASSWORD_LINE, @@ -227,61 +227,61 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "password", OPT_PASSWORD, "Password to update the password file", - (gptr *) &Options::User_management::password, - (gptr *) &Options::User_management::password, + (uchar* *) &Options::User_management::password, + (uchar* *) &Options::User_management::password, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "password-file", OPT_PASSWORD_FILE, "Look for Instance Manager users and passwords here.", - (gptr *) &Options::Main::password_file_name, - (gptr *) &Options::Main::password_file_name, + (uchar* *) &Options::Main::password_file_name, + (uchar* *) &Options::Main::password_file_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "pid-file", OPT_PID_FILE, "Pid file to use.", - (gptr *) &Options::Main::pid_file_name, - (gptr *) &Options::Main::pid_file_name, + (uchar* *) &Options::Main::pid_file_name, + (uchar* *) &Options::Main::pid_file_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "port", OPT_PORT, "Port number to use for connections", - (gptr *) &Options::Main::port_number, - (gptr *) &Options::Main::port_number, + (uchar* *) &Options::Main::port_number, + (uchar* *) &Options::Main::port_number, 0, GET_UINT, REQUIRED_ARG, DEFAULT_PORT, 0, 0, 0, 0, 0 }, #ifdef __WIN__ { "remove", OPT_REMOVE_SERVICE, "Remove system service.", - (gptr *) &Options::Service::remove_service, - (gptr *) &Options::Service::remove_service, + (uchar* *) &Options::Service::remove_service, + (uchar* *) &Options::Service::remove_service, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0}, #else { "run-as-service", OPT_RUN_AS_SERVICE, "Daemonize and start angel process.", - (gptr *) &Options::Daemon::run_as_service, + (uchar* *) &Options::Daemon::run_as_service, 0, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 }, #endif #ifndef __WIN__ { "socket", OPT_SOCKET, "Socket file to use for connection.", - (gptr *) &Options::Main::socket_file_name, - (gptr *) &Options::Main::socket_file_name, + (uchar* *) &Options::Main::socket_file_name, + (uchar* *) &Options::Main::socket_file_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, #endif #ifdef __WIN__ { "standalone", OPT_STAND_ALONE, "Run the application in stand alone mode.", - (gptr *) &Options::Service::stand_alone, - (gptr *) &Options::Service::stand_alone, + (uchar* *) &Options::Service::stand_alone, + (uchar* *) &Options::Service::stand_alone, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0}, #else { "user", OPT_USER, "Username to start mysqlmanager", - (gptr *) &Options::Daemon::user, - (gptr *) &Options::Daemon::user, + (uchar* *) &Options::Daemon::user, + (uchar* *) &Options::Daemon::user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, #endif { "username", OPT_USERNAME, "Username to update the password file", - (gptr *) &Options::User_management::user_name, - (gptr *) &Options::User_management::user_name, + (uchar* *) &Options::User_management::user_name, + (uchar* *) &Options::User_management::user_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "version", 'V', "Output version information and exit.", 0, 0, 0, @@ -289,8 +289,8 @@ static struct my_option my_long_options[] = { "wait-timeout", OPT_WAIT_TIMEOUT, "The number of seconds IM waits " "for activity on a connection before closing it.", - (gptr *) &net_read_timeout, - (gptr *) &net_read_timeout, + (uchar* *) &net_read_timeout, + (uchar* *) &net_read_timeout, 0, GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 } diff --git a/server-tools/instance-manager/parse.cc b/server-tools/instance-manager/parse.cc index 3995a265e96..cd20e3bc7ab 100644 --- a/server-tools/instance-manager/parse.cc +++ b/server-tools/instance-manager/parse.cc @@ -105,7 +105,7 @@ Named_value_arr::~Named_value_arr() TOK_NOT_FOUND */ -inline Token find_token(const char *word, uint word_len) +inline Token find_token(const char *word, size_t word_len) { int i= 0; do @@ -119,7 +119,7 @@ inline Token find_token(const char *word, uint word_len) } -Token get_token(const char **text, uint *word_len) +Token get_token(const char **text, size_t *word_len) { get_word(text, word_len); if (*word_len) @@ -128,7 +128,7 @@ Token get_token(const char **text, uint *word_len) } -Token shift_token(const char **text, uint *word_len) +Token shift_token(const char **text, size_t *word_len) { Token save= get_token(text, word_len); (*text)+= *word_len; @@ -157,7 +157,7 @@ static bool parse_long(const LEX_STRING *token, long *value) } -bool parse_option_value(const char *text, uint *text_len, char **value) +bool parse_option_value(const char *text, size_t *text_len, char **value) { char beginning_quote; const char *text_start_ptr; @@ -270,7 +270,7 @@ void skip_spaces(const char **text) Command *parse_command(const char *text) { - uint word_len; + size_t word_len; LEX_STRING instance_name; Command *command= 0; diff --git a/server-tools/instance-manager/parse.h b/server-tools/instance-manager/parse.h index 02bb81749f0..00f7aa237b8 100644 --- a/server-tools/instance-manager/parse.h +++ b/server-tools/instance-manager/parse.h @@ -30,7 +30,7 @@ enum Log_type Command *parse_command(const char *text); -bool parse_option_value(const char *text, uint *text_len, char **value); +bool parse_option_value(const char *text, size_t *text_len, char **value); void skip_spaces(const char **text); @@ -138,7 +138,7 @@ inline Named_value Named_value_arr::get_element(int idx) const DBUG_ASSERT(0 <= idx && (uint) idx < arr.elements); Named_value option; - get_dynamic((DYNAMIC_ARRAY *) &arr, (gptr) &option, idx); + get_dynamic((DYNAMIC_ARRAY *) &arr, (uchar*) &option, idx); return option; } @@ -156,7 +156,7 @@ inline void Named_value_arr::remove_element(int idx) inline bool Named_value_arr::add_element(Named_value *option) { - return insert_dynamic(&arr, (gptr) option); + return insert_dynamic(&arr, (uchar*) option); } @@ -166,7 +166,7 @@ inline bool Named_value_arr::replace_element(int idx, Named_value *option) get_element(idx).free(); - return set_dynamic(&arr, (gptr) option, idx); + return set_dynamic(&arr, (uchar*) option, idx); } /************************************************************************/ @@ -177,7 +177,7 @@ inline bool Named_value_arr::replace_element(int idx, Named_value *option) if not found returns pointer to first non-space or to '\0', word_len == 0 */ -inline void get_word(const char **text, uint *word_len, +inline void get_word(const char **text, size_t *word_len, enum_seek_method seek_method= ALPHANUM) { const char *word_end; diff --git a/server-tools/instance-manager/protocol.cc b/server-tools/instance-manager/protocol.cc index 05099b59064..8d71fcb8026 100644 --- a/server-tools/instance-manager/protocol.cc +++ b/server-tools/instance-manager/protocol.cc @@ -21,7 +21,7 @@ #include <m_string.h> -static char eof_buff[1]= { (char) 254 }; /* Marker for end of fields */ +static uchar eof_buff[1]= { (char) 254 }; /* Marker for end of fields */ static const char ERROR_PACKET_CODE= (char) 255; @@ -38,7 +38,7 @@ int net_send_ok(struct st_net *net, unsigned long connection_id, 1-9 + message length message to send (isn't stored if no message) */ Buffer buff; - char *pos= buff.buffer; + uchar *pos= buff.buffer; /* check that we have space to hold mandatory fields */ buff.reserve(0, 23); @@ -53,7 +53,7 @@ int net_send_ok(struct st_net *net, unsigned long connection_id, int2store(pos, 0); pos+= 2; - uint position= pos - buff.buffer; /* we might need it for message */ + size_t position= pos - buff.buffer; /* we might need it for message */ if (message != NULL) { @@ -82,7 +82,8 @@ int net_send_error(struct st_net *net, uint sql_errno) memcpy(pos, errno_to_sqlstate(sql_errno), SQLSTATE_LENGTH); pos+= SQLSTATE_LENGTH; pos= strmake(pos, err, MYSQL_ERRMSG_SIZE - 1) + 1; - return my_net_write(net, buff, pos - buff) || net_flush(net); + return (my_net_write(net, (uchar*) buff, (size_t) (pos - buff)) || + net_flush(net)); } @@ -98,7 +99,8 @@ int net_send_error_323(struct st_net *net, uint sql_errno) int2store(pos, sql_errno); pos+= 2; pos= strmake(pos, err, MYSQL_ERRMSG_SIZE - 1) + 1; - return my_net_write(net, buff, pos - buff) || net_flush(net); + return (my_net_write(net, (uchar*) buff, (size_t) (pos - buff)) || + net_flush(net)); } char *net_store_length(char *pkg, uint length) @@ -115,8 +117,8 @@ char *net_store_length(char *pkg, uint length) } -int store_to_protocol_packet(Buffer *buf, const char *string, uint *position, - uint string_len) +int store_to_protocol_packet(Buffer *buf, const char *string, size_t *position, + size_t string_len) { uint currpos; @@ -135,9 +137,10 @@ err: } -int store_to_protocol_packet(Buffer *buf, const char *string, uint *position) +int store_to_protocol_packet(Buffer *buf, const char *string, + size_t *position) { - uint string_len; + size_t string_len; string_len= strlen(string); return store_to_protocol_packet(buf, string, position, string_len); @@ -153,15 +156,16 @@ int send_eof(struct st_net *net) buff[0]=254; int2store(buff+1, 0); int2store(buff+3, 0); - return my_net_write(net, (char*) buff, sizeof buff); + return my_net_write(net, buff, sizeof(buff)); } + int send_fields(struct st_net *net, LIST *fields) { LIST *tmp= fields; Buffer send_buff; - char small_buff[4]; - uint position= 0; + uchar small_buff[4]; + size_t position= 0; LEX_STRING *field; /* send the number of fileds */ diff --git a/server-tools/instance-manager/protocol.h b/server-tools/instance-manager/protocol.h index 520b6d4c92c..b06ae4dfdb2 100644 --- a/server-tools/instance-manager/protocol.h +++ b/server-tools/instance-manager/protocol.h @@ -36,10 +36,11 @@ int send_fields(struct st_net *net, LIST *fields); char *net_store_length(char *pkg, uint length); -int store_to_protocol_packet(Buffer *buf, const char *string, uint *position); +int store_to_protocol_packet(Buffer *buf, const char *string, + size_t *position); -int store_to_protocol_packet(Buffer *buf, const char *string, uint *position, - uint string_len); +int store_to_protocol_packet(Buffer *buf, const char *string, size_t *position, + size_t string_len); int send_eof(struct st_net *net); diff --git a/server-tools/instance-manager/user_map.cc b/server-tools/instance-manager/user_map.cc index 832a8cee6b9..49c35c16ca9 100644 --- a/server-tools/instance-manager/user_map.cc +++ b/server-tools/instance-manager/user_map.cc @@ -97,12 +97,12 @@ int User::init(const char *line) C_MODE_START -static byte* get_user_key(const byte* u, uint* len, - my_bool __attribute__((unused)) t) +static uchar* get_user_key(const uchar* u, size_t* len, + my_bool __attribute__((unused)) t) { const User *user= (const User *) u; *len= user->user_length; - return (byte *) user->user; + return (uchar *) user->user; } static void delete_user(void *u) @@ -133,7 +133,7 @@ int User_map::init() { enum { START_HASH_SIZE= 16 }; if (hash_init(&hash, default_charset_info, START_HASH_SIZE, 0, 0, - get_user_key, delete_user, 0)) + get_user_key, delete_user, 0)) return 1; initialized= TRUE; @@ -274,7 +274,7 @@ int User_map::load(const char *password_file_name, const char **err_msg) return ERR_PASSWORD_FILE_CORRUPTED; } - if (my_hash_insert(&hash, (byte *) user)) + if (my_hash_insert(&hash, (uchar *) user)) { delete user; my_fclose(file, MYF(0)); @@ -374,7 +374,7 @@ int User_map::authenticate(const LEX_STRING *user_name, User *User_map::find_user(const LEX_STRING *user_name) { - return (User*) hash_search(&hash, (byte*) user_name->str, user_name->length); + return (User*) hash_search(&hash, (uchar*) user_name->str, user_name->length); } const User *User_map::find_user(const LEX_STRING *user_name) const @@ -385,11 +385,11 @@ const User *User_map::find_user(const LEX_STRING *user_name) const bool User_map::add_user(User *user) { - return my_hash_insert(&hash, (byte*) user) == 0 ? FALSE : TRUE; + return my_hash_insert(&hash, (uchar*) user) == 0 ? FALSE : TRUE; } bool User_map::remove_user(User *user) { - return hash_delete(&hash, (byte*) user) == 0 ? FALSE : TRUE; + return hash_delete(&hash, (uchar*) user) == 0 ? FALSE : TRUE; } |