Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-single-user

into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-build


mysql-test/t/disabled.def:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
client/mysqlslap.c:
  correct spelling
This commit is contained in:
unknown 2007-06-02 06:33:18 +02:00
commit 20a984930c
509 changed files with 8891 additions and 8515 deletions

View file

@ -489,6 +489,8 @@ dbug/main.r
dbug/output*.r
dbug/user.ps
dbug/user.t
debian/control
debian/defs.mk
depcomp
emacs.h
examples/*.ds?
@ -1071,6 +1073,7 @@ libmysqld/ha_myisam.cc
libmysqld/ha_myisammrg.cc
libmysqld/ha_ndbcluster.cc
libmysqld/ha_ndbcluster_binlog.cc
libmysqld/ha_ndbcluster_cond.cc
libmysqld/ha_partition.cc
libmysqld/ha_tina.cc
libmysqld/handler.cc
@ -2989,4 +2992,3 @@ win/vs71cache.txt
win/vs8cache.txt
zlib/*.ds?
zlib/*.vcproj
libmysqld/ha_ndbcluster_cond.cc

View file

@ -105,6 +105,12 @@ check_cpu () {
*Athlon*64*)
cpu_arg="athlon64";
;;
*Turion*)
cpu_arg="athlon64";
;;
*Opteron*)
cpu_arg="athlon64";
;;
*Athlon*)
cpu_arg="athlon";
;;

View file

@ -157,7 +157,7 @@ IF(EMBED_MANIFESTS)
STRING(REGEX MATCH "MANIFEST:NO" tmp_manifest ${CMAKE_EXE_LINKER_FLAGS})
IF(NOT tmp_manifest)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
ENDIF(tmp_manifest)
ENDIF(NOT tmp_manifest)
# Set the processor architecture.
IF(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64")
SET(PROCESSOR_ARCH "X64")

View file

@ -213,7 +213,7 @@ void completion_hash_clean(HashTable *ht)
void completion_hash_free(HashTable *ht)
{
completion_hash_clean(ht);
my_free((gptr) ht->arBuckets,MYF(0));
my_free(ht->arBuckets, MYF(0));
}

View file

@ -28,6 +28,6 @@ typedef struct st_line_buffer
} LINE_BUFFER;
extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file);
extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, my_string str);
extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, char * str);
extern char *batch_readline(LINE_BUFFER *buffer);
extern void batch_readline_end(LINE_BUFFER *buffer);

View file

@ -51,7 +51,7 @@ const char *VER= "14.13";
/* Buffer to hold 'version' and 'version_comment' */
#define MAX_SERVER_VERSION_LENGTH 128
gptr sql_alloc(unsigned size); // Don't use mysqld alloc for these
void* sql_alloc(unsigned size); // Don't use mysqld alloc for these
void sql_element_free(void *ptr);
#include "sql_string.h"
@ -142,7 +142,7 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
static my_bool column_types_flag;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
static my_string opt_mysql_unix_port=0;
static char * opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE;
static char *current_host,*current_db,*current_user=0,*opt_password=0,
*current_prompt=0, *delimiter_str= 0,
@ -587,7 +587,7 @@ static struct my_option my_long_options[] =
#endif
{"auto-rehash", OPT_AUTO_REHASH,
"Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash.",
(gptr*) &opt_rehash, (gptr*) &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
(uchar**) &opt_rehash, (uchar**) &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
0, 0},
{"no-auto-rehash", 'A',
"No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.",
@ -595,42 +595,42 @@ static struct my_option my_long_options[] =
{"batch", 'B',
"Don't use history file. Disable interactive behavior. (Enables --silent)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Directory where character sets are.", (uchar**) &charsets_dir,
(uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"column-type-info", OPT_COLUMN_TYPES, "Display column type information.",
(gptr*) &column_types_flag, (gptr*) &column_types_flag,
(uchar**) &column_types_flag, (uchar**) &column_types_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
(uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
{"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
(uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-info", 'T', "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use.", (gptr*) &current_db,
(gptr*) &current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", 'T', "Print some debug info at exit.", (uchar**) &info_flag,
(uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use.", (uchar**) &current_db,
(uchar**) &current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delimiter", OPT_DELIMITER, "Delimiter to be used.", (gptr*) &delimiter_str,
(gptr*) &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Set the default character set.", (uchar**) &default_charset,
(uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delimiter", OPT_DELIMITER, "Delimiter to be used.", (uchar**) &delimiter_str,
(uchar**) &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"execute", 'e', "Execute command and quit. (Disables --force and history file)", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"vertical", 'E', "Print the output of a query (rows) vertically.",
(gptr*) &vertical, (gptr*) &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
(uchar**) &vertical, (uchar**) &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"force", 'f', "Continue even if we get an sql error.",
(gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
(uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"named-commands", 'G',
"Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.",
(gptr*) &named_cmds, (gptr*) &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(uchar**) &named_cmds, (uchar**) &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"no-named-commands", 'g',
"Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead.",
@ -638,25 +638,25 @@ static struct my_option my_long_options[] =
{"ignore-spaces", 'i', "Ignore space after function names.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
(gptr*) &opt_local_infile,
(gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"no-beep", 'b', "Turn off beep on error.", (gptr*) &opt_nobeep,
(gptr*) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &current_host,
(gptr*) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"html", 'H', "Produce HTML output.", (gptr*) &opt_html, (gptr*) &opt_html,
(uchar**) &opt_local_infile,
(uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"no-beep", 'b', "Turn off beep on error.", (uchar**) &opt_nobeep,
(uchar**) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (uchar**) &current_host,
(uchar**) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"html", 'H', "Produce HTML output.", (uchar**) &opt_html, (uchar**) &opt_html,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"xml", 'X', "Produce XML output", (gptr*) &opt_xml, (gptr*) &opt_xml, 0,
{"xml", 'X', "Produce XML output", (uchar**) &opt_xml, (uchar**) &opt_xml, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"line-numbers", OPT_LINE_NUMBERS, "Write line numbers for errors.",
(gptr*) &line_numbers, (gptr*) &line_numbers, 0, GET_BOOL,
(uchar**) &line_numbers, (uchar**) &line_numbers, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"unbuffered", 'n', "Flush buffer after each query.", (gptr*) &unbuffered,
(gptr*) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"unbuffered", 'n', "Flush buffer after each query.", (uchar**) &unbuffered,
(uchar**) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"column-names", OPT_COLUMN_NAMES, "Write column names in results.",
(gptr*) &column_names, (gptr*) &column_names, 0, GET_BOOL,
(uchar**) &column_names, (uchar**) &column_names, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-column-names", 'N',
"Don't write column names in results. WARNING: -N is deprecated, use long version of this options instead.",
@ -665,7 +665,7 @@ static struct my_option my_long_options[] =
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"sigint-ignore", OPT_SIGINT_IGNORE, "Ignore SIGINT (CTRL-C)",
(gptr*) &opt_sigint_ignore, (gptr*) &opt_sigint_ignore, 0, GET_BOOL,
(uchar**) &opt_sigint_ignore, (uchar**) &opt_sigint_ignore, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"one-database", 'o',
"Only update the default database. This is useful for skipping updates to other database in the update log.",
@ -685,49 +685,49 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
{"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
(uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
{"prompt", OPT_PROMPT, "Set the mysql prompt to this value.",
(gptr*) &current_prompt, (gptr*) &current_prompt, 0, GET_STR_ALLOC,
(uchar**) &current_prompt, (uchar**) &current_prompt, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"quick", 'q',
"Don't cache result, print it row by row. This may slow down the server if the output is suspended. Doesn't use history file.",
(gptr*) &quick, (gptr*) &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
(uchar**) &quick, (uchar**) &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"raw", 'r', "Write fields without conversion. Used with --batch.",
(gptr*) &opt_raw_data, (gptr*) &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0,
(uchar**) &opt_raw_data, (uchar**) &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"reconnect", OPT_RECONNECT, "Reconnect if the connection is lost. Disable with --disable-reconnect. This option is enabled by default.",
(gptr*) &opt_reconnect, (gptr*) &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
(uchar**) &opt_reconnect, (uchar**) &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"silent", 's', "Be more silent. Print results with a tab as separator, each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
"Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR_ALLOC,
(uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include "sslopt-longopts.h"
{"table", 't', "Output in table format.", (gptr*) &output_tables,
(gptr*) &output_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"table", 't', "Output in table format.", (uchar**) &output_tables,
(uchar**) &output_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"tee", OPT_TEE,
"Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode. Disable with --disable-tee. This option is disabled by default.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: option deprecated; use --disable-tee instead", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", (gptr*) &current_user,
(gptr*) &current_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login if not current user.", (uchar**) &current_user,
(uchar**) &current_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"safe-updates", 'U', "Only allow UPDATE and DELETE that uses keys.",
(gptr*) &safe_updates, (gptr*) &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
(uchar**) &safe_updates, (uchar**) &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"i-am-a-dummy", 'U', "Synonym for option --safe-updates, -U.",
(gptr*) &safe_updates, (gptr*) &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
(uchar**) &safe_updates, (uchar**) &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"verbose", 'v', "Write more. (-v -v -v gives the table output format).", 0,
0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -737,32 +737,32 @@ static struct my_option my_long_options[] =
NO_ARG, 0, 0, 0, 0, 0, 0},
{"connect_timeout", OPT_CONNECT_TIMEOUT,
"Number of seconds before connection timeout.",
(gptr*) &opt_connect_timeout,
(gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
(uchar**) &opt_connect_timeout,
(uchar**) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
0, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
"Max packet length to send to, or receive from server",
(gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0, GET_ULONG,
(uchar**) &opt_max_allowed_packet, (uchar**) &opt_max_allowed_packet, 0, GET_ULONG,
REQUIRED_ARG, 16 *1024L*1024L, 4096, (longlong) 2*1024L*1024L*1024L,
MALLOC_OVERHEAD, 1024, 0},
{"net_buffer_length", OPT_NET_BUFFER_LENGTH,
"Buffer for TCP/IP and socket communication",
(gptr*) &opt_net_buffer_length, (gptr*) &opt_net_buffer_length, 0, GET_ULONG,
(uchar**) &opt_net_buffer_length, (uchar**) &opt_net_buffer_length, 0, GET_ULONG,
REQUIRED_ARG, 16384, 1024, 512*1024*1024L, MALLOC_OVERHEAD, 1024, 0},
{"select_limit", OPT_SELECT_LIMIT,
"Automatic limit for SELECT when using --safe-updates",
(gptr*) &select_limit,
(gptr*) &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ~0L, 0, 1, 0},
(uchar**) &select_limit,
(uchar**) &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ~0L, 0, 1, 0},
{"max_join_size", OPT_MAX_JOIN_SIZE,
"Automatic limit for rows in a join when using --safe-updates",
(gptr*) &max_join_size,
(gptr*) &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L, 1, ~0L, 0, 1,
(uchar**) &max_join_size,
(uchar**) &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L, 1, ~0L, 0, 1,
0},
{"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it"
" uses old (pre-4.1.1) protocol", (gptr*) &opt_secure_auth,
(gptr*) &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
" uses old (pre-4.1.1) protocol", (uchar**) &opt_secure_auth,
(uchar**) &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"show-warnings", OPT_SHOW_WARNINGS, "Show warnings after every statement.",
(gptr*) &show_warnings, (gptr*) &show_warnings, 0, GET_BOOL, NO_ARG,
(uchar**) &show_warnings, (uchar**) &show_warnings, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@ -1079,7 +1079,7 @@ static int read_and_execute(bool interactive)
tmpbuf.alloc(65535);
tmpbuf.length(0);
buffer.length(0);
unsigned long clen;
size_t clen;
do
{
line= my_cgets((char*)tmpbuf.ptr(), tmpbuf.alloced_length()-1, &clen);
@ -2443,7 +2443,7 @@ print_table_data(MYSQL_RES *result)
(void) tee_fputs("\n", PAGER);
}
tee_puts((char*) separator.ptr(), PAGER);
my_afree((gptr) num_flag);
my_afree((uchar*) num_flag);
}
@ -2842,10 +2842,10 @@ com_edit(String *buffer,char *line __attribute__((unused)))
MYF(MY_WME))) < 0)
goto err;
if (buffer->is_empty() && !old_buffer.is_empty())
(void) my_write(fd,(byte*) old_buffer.ptr(),old_buffer.length(),
(void) my_write(fd,(uchar*) old_buffer.ptr(),old_buffer.length(),
MYF(MY_WME));
else
(void) my_write(fd,(byte*) buffer->ptr(),buffer->length(),MYF(MY_WME));
(void) my_write(fd,(uchar*) buffer->ptr(),buffer->length(),MYF(MY_WME));
(void) my_close(fd,MYF(0));
if (!(editor = (char *)getenv("EDITOR")) &&
@ -3893,13 +3893,13 @@ static int com_prompt(String *buffer, char *line)
#ifndef EMBEDDED_LIBRARY
/* Keep sql_string library happy */
gptr sql_alloc(unsigned int Size)
void *sql_alloc(size_t Size)
{
return my_malloc(Size,MYF(MY_WME));
}
void sql_element_free(void *ptr)
{
my_free((gptr) ptr,MYF(0));
my_free(ptr,MYF(0));
}
#endif /* EMBEDDED_LIBRARY */

View file

@ -63,8 +63,8 @@ static struct my_option my_long_options[]=
{"debug", '#', "This is a non-debug version. Catch this and exit",
0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
{"debug", '#', "Output debug log", (gptr *) & default_dbug_option,
(gptr *) & default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log", (uchar* *) & default_dbug_option,
(uchar* *) & default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", 0,
@ -73,16 +73,16 @@ static struct my_option my_long_options[]=
"Directory where character sets are.", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compress", OPT_COMPRESS, "Use compression in server/client protocol.",
(gptr*)&not_used, (gptr*)&not_used, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
(uchar**)&not_used, (uchar**)&not_used, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f', "Force execution of mysqlcheck even if mysql_upgrade "
"has already been executed for the current version of MySQL.",
(gptr*)&opt_force, (gptr*)&opt_force, 0,
(uchar**)&opt_force, (uchar**)&opt_force, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host",'h', "Connect to host.", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given"
" it's solicited on the tty.", (gptr*) &opt_password,(gptr*) &opt_password,
" it's solicited on the tty.", (uchar**) &opt_password,(uchar**) &opt_password,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __WIN__
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0,
@ -100,11 +100,11 @@ static struct my_option my_long_options[]=
#endif
{"socket", 'S', "Socket file to use for connection.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login if not current user.", (gptr*) &opt_user,
(gptr*) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login if not current user.", (uchar**) &opt_user,
(uchar**) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
{"verbose", 'v', "Display more output about the process",
(gptr*) &opt_verbose, (gptr*) &opt_verbose, 0,
(uchar**) &opt_verbose, (uchar**) &opt_verbose, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@ -387,13 +387,14 @@ static void find_tool(char *tool_path, const char *tool_name)
}
do
{
size_t path_len;
DBUG_PRINT("enter", ("path: %s", path));
/* Chop off last char(since it might be a /) */
path[max((strlen(path)-1), 0)]= 0;
/* Chop off last dir part */
dirname_part(path, path);
dirname_part(path, path, &path_len);
/* Format name of the tool to search for */
fn_format(tool_path, tool_name,

View file

@ -44,7 +44,7 @@ static my_bool option_force=0,interrupted=0,new_line=0,
static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations,
opt_count_iterations= 0;
static ulong opt_connect_timeout, opt_shutdown_timeout;
static my_string unix_port=0;
static char * unix_port=0;
#ifdef LATER_HAVE_NDBCLUSTER_DB
static my_bool opt_ndbcluster=0;
static char *opt_ndb_connectstring=0;
@ -132,31 +132,31 @@ static struct my_option my_long_options[] =
#endif
{"count", 'c',
"Number of iterations to make. This works with -i (--sleep) only.",
(gptr*) &nr_iterations, (gptr*) &nr_iterations, 0, GET_UINT,
(uchar**) &nr_iterations, (uchar**) &nr_iterations, 0, GET_UINT,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
(uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f',
"Don't ask for confirmation on drop database; with multiple commands, continue even if an error occurs.",
(gptr*) &option_force, (gptr*) &option_force, 0, GET_BOOL, NO_ARG, 0, 0,
(uchar**) &option_force, (uchar**) &option_force, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
(uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Directory where character sets are.", (uchar**) &charsets_dir,
(uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Set the default character set.", (uchar**) &default_charset,
(uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR,
{"host", 'h', "Connect to host.", (uchar**) &host, (uchar**) &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"no-beep", 'b', "Turn off beep on error.", (gptr*) &opt_nobeep,
(gptr*) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-beep", 'b', "Turn off beep on error.", (uchar**) &opt_nobeep,
(uchar**) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@ -164,58 +164,58 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"port", 'P', "Port number to use for connection.", (gptr*) &tcp_port,
(gptr*) &tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection.", (uchar**) &tcp_port,
(uchar**) &tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"relative", 'r',
"Show difference between current and previous values when used with -i. Currently works only with extended-status.",
(gptr*) &opt_relative, (gptr*) &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0,
(uchar**) &opt_relative, (uchar**) &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
"Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Silently exit if one can't connect to server.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &unix_port, (gptr*) &unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
(uchar**) &unix_port, (uchar**) &unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"sleep", 'i', "Execute commands again and again with a sleep between.",
(gptr*) &interval, (gptr*) &interval, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0,
(uchar**) &interval, (uchar**) &interval, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
#include <sslopt-longopts.h>
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", (gptr*) &user,
(gptr*) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login if not current user.", (uchar**) &user,
(uchar**) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v', "Write more information.", (gptr*) &opt_verbose,
(gptr*) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Write more information.", (uchar**) &opt_verbose,
(uchar**) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"vertical", 'E',
"Print output vertically. Is similar to --relative, but prints output vertically.",
(gptr*) &opt_vertical, (gptr*) &opt_vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0,
(uchar**) &opt_vertical, (uchar**) &opt_vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"wait", 'w', "Wait and retry if connection is down.", 0, 0, 0, GET_UINT,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"connect_timeout", OPT_CONNECT_TIMEOUT, "", (gptr*) &opt_connect_timeout,
(gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 3600*12, 0,
{"connect_timeout", OPT_CONNECT_TIMEOUT, "", (uchar**) &opt_connect_timeout,
(uchar**) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 3600*12, 0,
3600*12, 0, 1, 0},
{"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", (gptr*) &opt_shutdown_timeout,
(gptr*) &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG,
{"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", (uchar**) &opt_shutdown_timeout,
(uchar**) &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG,
SHUTDOWN_DEF_TIMEOUT, 0, 3600*12, 0, 1, 0},
#ifdef LATER_HAVE_NDBCLUSTER_DB
{"ndbcluster", OPT_NDBCLUSTER, ""
"", (gptr*) &opt_ndbcluster,
(gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
"", (uchar**) &opt_ndbcluster,
(uchar**) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"ndb-connectstring", OPT_NDB_CONNECTSTRING, ""
"", (gptr*) &opt_ndb_connectstring,
(gptr*) &opt_ndb_connectstring, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"", (uchar**) &opt_ndb_connectstring,
(uchar**) &opt_ndb_connectstring, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};

View file

@ -296,7 +296,7 @@ File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le,
int Load_log_processor::load_old_format_file(NET* net, const char*server_fname,
uint server_fname_len, File file)
{
char buf[FN_REFLEN+1];
uchar buf[FN_REFLEN+1];
buf[0] = 0;
memcpy(buf + 1, server_fname, server_fname_len + 1);
if (my_net_write(net, buf, server_fname_len +2) || net_flush(net))
@ -310,7 +310,7 @@ int Load_log_processor::load_old_format_file(NET* net, const char*server_fname,
ulong packet_len = my_net_read(net);
if (packet_len == 0)
{
if (my_net_write(net, "", 0) || net_flush(net))
if (my_net_write(net, (uchar*) "", 0) || net_flush(net))
{
sql_print_error("Failed sending the ack packet");
return -1;
@ -334,7 +334,7 @@ int Load_log_processor::load_old_format_file(NET* net, const char*server_fname,
sql_print_error("Illegal length of packet read from net");
return -1;
}
if (my_write(file, (byte*) net->read_pos,
if (my_write(file, (uchar*) net->read_pos,
(uint) packet_len, MYF(MY_WME|MY_NABP)))
return -1;
}
@ -379,7 +379,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
File_name_record rec;
DBUG_ENTER("Load_log_processor::process_first_event");
if (!(fname= my_malloc(full_len,MYF(MY_WME))))
if (!(fname= (char*) my_malloc(full_len,MYF(MY_WME))))
DBUG_RETURN(-1);
memcpy(fname, target_dir_name, target_dir_name_len);
@ -398,7 +398,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
rec.fname= fname;
rec.event= ce;
if (set_dynamic(&file_names, (gptr)&rec, file_id))
if (set_dynamic(&file_names, (uchar*)&rec, file_id))
{
sql_print_error("Could not construct local filename %s%s",
target_dir_name, bname);
@ -408,7 +408,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
if (ce)
ce->set_fname_outside_temp_buf(fname, strlen(fname));
if (my_write(file, (byte*)block, block_len, MYF(MY_WME|MY_NABP)))
if (my_write(file, (uchar*)block, block_len, MYF(MY_WME|MY_NABP)))
error= -1;
if (my_close(file, MYF(MY_WME)))
error= -1;
@ -447,7 +447,7 @@ int Load_log_processor::process(Append_block_log_event *ae)
if (((file= my_open(fname,
O_APPEND|O_BINARY|O_WRONLY,MYF(MY_WME))) < 0))
DBUG_RETURN(-1);
if (my_write(file,(byte*)ae->block,ae->block_len,MYF(MY_WME|MY_NABP)))
if (my_write(file,(uchar*)ae->block,ae->block_len,MYF(MY_WME|MY_NABP)))
error= -1;
if (my_close(file,MYF(MY_WME)))
error= -1;
@ -700,7 +700,7 @@ static struct my_option my_long_options[] =
"Print all binlog entries using base64 encoding. "
"This is for debugging only. Logs produced using this option "
"should not be applied on production systems.",
(gptr*) &opt_base64_output, (gptr*) &opt_base64_output, 0, GET_BOOL,
(uchar**) &opt_base64_output, (uchar**) &opt_base64_output, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
/*
mysqlbinlog needs charsets knowledge, to be able to convert a charset
@ -709,47 +709,47 @@ static struct my_option my_long_options[] =
SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`;
*/
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Directory where character sets are.", (uchar**) &charsets_dir,
(uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'd', "List entries for just this database (local log only).",
(gptr*) &database, (gptr*) &database, 0, GET_STR_ALLOC, REQUIRED_ARG,
(uchar**) &database, (uchar**) &database, 0, GET_STR_ALLOC, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#ifndef DBUG_OFF
{"debug", '#', "Output debug log.", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log.", (uchar**) &default_dbug_option,
(uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
(uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"disable-log-bin", 'D', "Disable binary log. This is useful, if you "
"enabled --to-last-log and are sending the output to the same MySQL server. "
"This way you could avoid an endless loop. You would also like to use it "
"when restoring after a crash to avoid duplication of the statements you "
"already have. NOTE: you will need a SUPER privilege to use this option.",
(gptr*) &disable_log_bin, (gptr*) &disable_log_bin, 0, GET_BOOL,
(uchar**) &disable_log_bin, (uchar**) &disable_log_bin, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"force-if-open", 'F', "Force if binlog was not closed properly.",
(gptr*) &force_if_open_opt, (gptr*) &force_if_open_opt, 0, GET_BOOL, NO_ARG,
(uchar**) &force_if_open_opt, (uchar**) &force_if_open_opt, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"force-read", 'f', "Force reading unknown binlog events.",
(gptr*) &force_opt, (gptr*) &force_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(uchar**) &force_opt, (uchar**) &force_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"hexdump", 'H', "Augment output with hexadecimal and ASCII event dump.",
(gptr*) &opt_hexdump, (gptr*) &opt_hexdump, 0, GET_BOOL, NO_ARG,
(uchar**) &opt_hexdump, (uchar**) &opt_hexdump, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"host", 'h', "Get the binlog from server.", (gptr*) &host, (gptr*) &host,
{"host", 'h', "Get the binlog from server.", (uchar**) &host, (uchar**) &host,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"local-load", 'l', "Prepare local temporary files for LOAD DATA INFILE in the specified directory.",
(gptr*) &dirname_for_local_load, (gptr*) &dirname_for_local_load, 0,
(uchar**) &dirname_for_local_load, (uchar**) &dirname_for_local_load, 0,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"offset", 'o', "Skip the first N entries.", (gptr*) &offset, (gptr*) &offset,
{"offset", 'o', "Skip the first N entries.", (uchar**) &offset, (uchar**) &offset,
0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p', "Password to connect to remote server.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Use port to connect to the remote server.",
(gptr*) &port, (gptr*) &port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
(uchar**) &port, (uchar**) &port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"position", 'j', "Deprecated. Use --start-position instead.",
(gptr*) &start_position, (gptr*) &start_position, 0, GET_ULL,
(uchar**) &start_position, (uchar**) &start_position, 0, GET_ULL,
REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE,
/* COM_BINLOG_DUMP accepts only 4 bytes for the position */
(ulonglong)(~(uint32)0), 0, 0, 0},
@ -757,22 +757,22 @@ static struct my_option my_long_options[] =
"The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"read-from-remote-server", 'R', "Read binary logs from a MySQL server",
(gptr*) &remote_opt, (gptr*) &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(uchar**) &remote_opt, (uchar**) &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"result-file", 'r', "Direct output to a given file.", 0, 0, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-id", OPT_SERVER_ID,
"Extract only binlog entries created by the server having the given id.",
(gptr*) &server_id, (gptr*) &server_id, 0, GET_ULONG,
(uchar**) &server_id, (uchar**) &server_id, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"set-charset", OPT_SET_CHARSET,
"Add 'SET NAMES character_set' to the output.", (gptr*) &charset,
(gptr*) &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Add 'SET NAMES character_set' to the output.", (uchar**) &charset,
(uchar**) &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"short-form", 's', "Just show the queries, no extra info.",
(gptr*) &short_form, (gptr*) &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(uchar**) &short_form, (uchar**) &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &sock, (gptr*) &sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
(uchar**) &sock, (uchar**) &sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"start-datetime", OPT_START_DATETIME,
"Start reading the binlog at first event having a datetime equal or "
@ -780,12 +780,12 @@ static struct my_option my_long_options[] =
"in the local time zone, in any format accepted by the MySQL server "
"for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
"(you should probably use quotes for your shell to set it properly).",
(gptr*) &start_datetime_str, (gptr*) &start_datetime_str,
(uchar**) &start_datetime_str, (uchar**) &start_datetime_str,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"start-position", OPT_START_POSITION,
"Start reading the binlog at position N. Applies to the first binlog "
"passed on the command line.",
(gptr*) &start_position, (gptr*) &start_position, 0, GET_ULL,
(uchar**) &start_position, (uchar**) &start_position, 0, GET_ULL,
REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE,
/* COM_BINLOG_DUMP accepts only 4 bytes for the position */
(ulonglong)(~(uint32)0), 0, 0, 0},
@ -795,28 +795,28 @@ static struct my_option my_long_options[] =
"in the local time zone, in any format accepted by the MySQL server "
"for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
"(you should probably use quotes for your shell to set it properly).",
(gptr*) &stop_datetime_str, (gptr*) &stop_datetime_str,
(uchar**) &stop_datetime_str, (uchar**) &stop_datetime_str,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"stop-position", OPT_STOP_POSITION,
"Stop reading the binlog at position N. Applies to the last binlog "
"passed on the command line.",
(gptr*) &stop_position, (gptr*) &stop_position, 0, GET_ULL,
(uchar**) &stop_position, (uchar**) &stop_position, 0, GET_ULL,
REQUIRED_ARG, (ulonglong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
(ulonglong)(~(my_off_t)0), 0, 0, 0},
{"to-last-log", 't', "Requires -R. Will not stop at the end of the \
requested binlog but rather continue printing until the end of the last \
binlog of the MySQL server. If you send the output to the same MySQL server, \
that may lead to an endless loop.",
(gptr*) &to_last_remote_log, (gptr*) &to_last_remote_log, 0, GET_BOOL,
(uchar**) &to_last_remote_log, (uchar**) &to_last_remote_log, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "Connect to the remote server as username.",
(gptr*) &user, (gptr*) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0,
(uchar**) &user, (uchar**) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
{"open_files_limit", OPT_OPEN_FILES_LIMIT,
"Used to reserve file descriptors for usage by this program",
(gptr*) &open_files_limit, (gptr*) &open_files_limit, 0, GET_ULONG,
(uchar**) &open_files_limit, (uchar**) &open_files_limit, 0, GET_ULONG,
REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@ -1094,7 +1094,7 @@ static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
const char* logname)
{
char buf[128];
uchar buf[128];
ulong len;
uint logname_len;
NET* net;
@ -1130,7 +1130,7 @@ could be out of memory");
int4store(buf, (uint32)start_position);
int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
size_s tlen = strlen(logname);
size_t tlen = strlen(logname);
if (tlen > UINT_MAX)
{
fprintf(stderr,"Log name too long\n");
@ -1278,8 +1278,8 @@ err:
static void check_header(IO_CACHE* file,
Format_description_log_event **description_event)
{
byte header[BIN_LOG_HEADER_SIZE];
byte buf[PROBE_HEADER_LEN];
uchar header[BIN_LOG_HEADER_SIZE];
uchar buf[PROBE_HEADER_LEN];
my_off_t tmp_pos, pos;
*description_event= new Format_description_log_event(3);
@ -1379,7 +1379,7 @@ static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
{
File fd = -1;
IO_CACHE cache,*file= &cache;
byte tmp_buff[BIN_LOG_HEADER_SIZE];
uchar tmp_buff[BIN_LOG_HEADER_SIZE];
int error= 0;
if (logname && logname[0] != '-')
@ -1418,7 +1418,7 @@ static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
if (start_position)
{
/* skip 'start_position' characters from stdin */
byte buff[IO_SIZE];
uchar buff[IO_SIZE];
my_off_t length,tmp;
for (length= start_position_mot ; length > 0 ; length-=tmp)
{

View file

@ -37,7 +37,7 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0,
opt_write_binlog= 1;
static uint verbose = 0, opt_mysql_port=0;
static my_string opt_mysql_unix_port = 0;
static char * opt_mysql_unix_port = 0;
static char *opt_password = 0, *current_user = 0,
*default_charset = (char *)MYSQL_DEFAULT_CHARSET_NAME,
*current_host = 0;
@ -55,13 +55,13 @@ static struct my_option my_long_options[] =
{
{"all-databases", 'A',
"Check all the databases. This will be same as --databases with all databases selected.",
(gptr*) &opt_alldbs, (gptr*) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(uchar**) &opt_alldbs, (uchar**) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"analyze", 'a', "Analyze given tables.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
{"all-in-1", '1',
"Instead of issuing one query for each table, use one query per database, naming all tables in the database in a comma-separated list.",
(gptr*) &opt_all_in_1, (gptr*) &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0,
(uchar**) &opt_all_in_1, (uchar**) &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
#ifdef __NETWARE__
{"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.",
@ -69,11 +69,11 @@ static struct my_option my_long_options[] =
#endif
{"auto-repair", OPT_AUTO_REPAIR,
"If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been checked, if corrupted ones were found.",
(gptr*) &opt_auto_repair, (gptr*) &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0,
(uchar**) &opt_auto_repair, (uchar**) &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0,
0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Directory where character sets are.", (uchar**) &charsets_dir,
(uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"check", 'c', "Check table for errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
{"check-only-changed", 'C',
@ -83,11 +83,11 @@ static struct my_option my_long_options[] =
"Check tables for version-dependent changes. May be used with --auto-repair to correct tables requiring version-dependent updates.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", OPT_COMPRESS, "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
(uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"databases", 'B',
"To check several databases. Note the difference in usage; In this case no tables are given. All name arguments are regarded as databasenames.",
(gptr*) &opt_databases, (gptr*) &opt_databases, 0, GET_BOOL, NO_ARG,
(uchar**) &opt_databases, (uchar**) &opt_databases, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit.",
@ -96,37 +96,37 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
(uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Set the default character set.", (uchar**) &default_charset,
(uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fast",'F', "Check only tables that haven't been closed properly.",
(gptr*) &opt_fast, (gptr*) &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
(uchar**) &opt_fast, (uchar**) &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"fix-db-names", OPT_FIX_DB_NAMES, "Fix database names.",
(gptr*) &opt_fix_db_names, (gptr*) &opt_fix_db_names,
(uchar**) &opt_fix_db_names, (uchar**) &opt_fix_db_names,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"fix-table-names", OPT_FIX_TABLE_NAMES, "Fix table names.",
(gptr*) &opt_fix_table_names, (gptr*) &opt_fix_table_names,
(uchar**) &opt_fix_table_names, (uchar**) &opt_fix_table_names,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f', "Continue even if we get an sql-error.",
(gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
(uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"extended", 'e',
"If you are using this option with CHECK TABLE, it will ensure that the table is 100 percent consistent, but will take a long time. If you are using this option with REPAIR TABLE, it will force using old slow repair with keycache method, instead of much faster repair by sorting.",
(gptr*) &opt_extended, (gptr*) &opt_extended, 0, GET_BOOL, NO_ARG, 0, 0, 0,
(uchar**) &opt_extended, (uchar**) &opt_extended, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"host",'h', "Connect to host.", (gptr*) &current_host,
(gptr*) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"host",'h', "Connect to host.", (uchar**) &current_host,
(uchar**) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"medium-check", 'm',
"Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"write-binlog", OPT_WRITE_BINLOG,
"Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Enabled by default; use --skip-write-binlog when commands should not be sent to replication slaves.",
(gptr*) &opt_write_binlog, (gptr*) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
(uchar**) &opt_write_binlog, (uchar**) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"optimize", 'o', "Optimize table.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
0, 0},
@ -137,38 +137,38 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
{"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
(uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"quick", 'q',
"If you are using this option with CHECK TABLE, it prevents the check from scanning the rows to check for wrong links. This is the fastest check. If you are using this option with REPAIR TABLE, it will try to repair only the index tree. This is the fastest repair method for a table.",
(gptr*) &opt_quick, (gptr*) &opt_quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
(uchar**) &opt_quick, (uchar**) &opt_quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"repair", 'r',
"Can fix almost anything except unique keys that aren't unique.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
"Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Print only error messages.", (gptr*) &opt_silent,
(gptr*) &opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Print only error messages.", (uchar**) &opt_silent,
(uchar**) &opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
(uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
{"tables", OPT_TABLES, "Overrides option --databases (-B).", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"use-frm", OPT_FRM,
"When used with REPAIR, get table structure from .frm file, so the table can be repaired even if .MYI header is corrupted.",
(gptr*) &opt_frm, (gptr*) &opt_frm, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
(uchar**) &opt_frm, (uchar**) &opt_frm, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", (gptr*) &current_user,
(gptr*) &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login if not current user.", (uchar**) &current_user,
(uchar**) &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v', "Print info about the various stages.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},

View file

@ -117,7 +117,7 @@ static ulong opt_compatible_mode= 0;
#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
#define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
static uint opt_mysql_port= 0, opt_master_data;
static my_string opt_mysql_unix_port=0;
static char * opt_mysql_unix_port=0;
static int first_error=0;
static DYNAMIC_STRING extended_row;
#include <sslopt-vars.h>
@ -177,106 +177,106 @@ HASH ignore_table;
static struct my_option my_long_options[] =
{
{"all", 'a', "Deprecated. Use --create-options instead.",
(gptr*) &create_options, (gptr*) &create_options, 0, GET_BOOL, NO_ARG, 1,
(uchar**) &create_options, (uchar**) &create_options, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"all-databases", 'A',
"Dump all the databases. This will be same as --databases with all databases selected.",
(gptr*) &opt_alldbs, (gptr*) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(uchar**) &opt_alldbs, (uchar**) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"all-tablespaces", 'Y',
"Dump all the tablespaces.",
(gptr*) &opt_alltspcs, (gptr*) &opt_alltspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(uchar**) &opt_alltspcs, (uchar**) &opt_alltspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"no-tablespaces", 'y',
"Do not dump any tablespace information.",
(gptr*) &opt_notspcs, (gptr*) &opt_notspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(uchar**) &opt_notspcs, (uchar**) &opt_notspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"add-drop-database", OPT_DROP_DATABASE, "Add a 'DROP DATABASE' before each create.",
(gptr*) &opt_drop_database, (gptr*) &opt_drop_database, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
(uchar**) &opt_drop_database, (uchar**) &opt_drop_database, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"add-drop-table", OPT_DROP, "Add a 'drop table' before each create.",
(gptr*) &opt_drop, (gptr*) &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
(uchar**) &opt_drop, (uchar**) &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
0},
{"add-locks", OPT_LOCKS, "Add locks around insert statements.",
(gptr*) &opt_lock, (gptr*) &opt_lock, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
(uchar**) &opt_lock, (uchar**) &opt_lock, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
0},
{"allow-keywords", OPT_KEYWORDS,
"Allow creation of column names that are keywords.", (gptr*) &opt_keywords,
(gptr*) &opt_keywords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
"Allow creation of column names that are keywords.", (uchar**) &opt_keywords,
(uchar**) &opt_keywords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NETWARE__
{"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Directory where character sets are.", (uchar**) &charsets_dir,
(uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"comments", 'i', "Write additional information.",
(gptr*) &opt_comments, (gptr*) &opt_comments, 0, GET_BOOL, NO_ARG,
(uchar**) &opt_comments, (uchar**) &opt_comments, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"compatible", OPT_COMPATIBLE,
"Change the dump to be compatible with a given mode. By default tables are dumped in a format optimized for MySQL. Legal modes are: ansi, mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, no_table_options, no_field_options. One can use several modes separated by commas. Note: Requires MySQL server version 4.1.0 or higher. This option is ignored with earlier server versions.",
(gptr*) &opt_compatible_mode_str, (gptr*) &opt_compatible_mode_str, 0,
(uchar**) &opt_compatible_mode_str, (uchar**) &opt_compatible_mode_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compact", OPT_COMPACT,
"Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs. Enables options --skip-add-drop-table --no-set-names --skip-disable-keys --skip-add-locks",
(gptr*) &opt_compact, (gptr*) &opt_compact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(uchar**) &opt_compact, (uchar**) &opt_compact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"complete-insert", 'c', "Use complete insert statements.",
(gptr*) &opt_complete_insert, (gptr*) &opt_complete_insert, 0, GET_BOOL,
(uchar**) &opt_complete_insert, (uchar**) &opt_complete_insert, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
(uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"create-options", OPT_CREATE_OPTIONS,
"Include all MySQL specific create options.",
(gptr*) &create_options, (gptr*) &create_options, 0, GET_BOOL, NO_ARG, 1,
(uchar**) &create_options, (uchar**) &create_options, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"databases", 'B',
"To dump several databases. Note the difference in usage; In this case no tables are given. All name arguments are regarded as databasenames. 'USE db_name;' will be included in the output.",
(gptr*) &opt_databases, (gptr*) &opt_databases, 0, GET_BOOL, NO_ARG, 0, 0,
(uchar**) &opt_databases, (uchar**) &opt_databases, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
{"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
(uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
(uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Set the default character set.", (uchar**) &default_charset,
(uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delayed-insert", OPT_DELAYED, "Insert rows with INSERT DELAYED; ",
(gptr*) &opt_delayed, (gptr*) &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(uchar**) &opt_delayed, (uchar**) &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"delete-master-logs", OPT_DELETE_MASTER_LOGS,
"Delete logs on master after backup. This automatically enables --master-data.",
(gptr*) &opt_delete_master_logs, (gptr*) &opt_delete_master_logs, 0,
(uchar**) &opt_delete_master_logs, (uchar**) &opt_delete_master_logs, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"disable-keys", 'K',
"'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put in the output.", (gptr*) &opt_disable_keys,
(gptr*) &opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
"'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put in the output.", (uchar**) &opt_disable_keys,
(uchar**) &opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"events", 'E', "Dump events.",
(gptr*) &opt_events, (gptr*) &opt_events, 0, GET_BOOL,
(uchar**) &opt_events, (uchar**) &opt_events, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"extended-insert", 'e',
"Allows utilization of the new, much faster INSERT syntax.",
(gptr*) &extended_insert, (gptr*) &extended_insert, 0, GET_BOOL, NO_ARG,
(uchar**) &extended_insert, (uchar**) &extended_insert, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"fields-terminated-by", OPT_FTB,
"Fields in the textfile are terminated by ...", (gptr*) &fields_terminated,
(gptr*) &fields_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Fields in the textfile are terminated by ...", (uchar**) &fields_terminated,
(uchar**) &fields_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-enclosed-by", OPT_ENC,
"Fields in the importfile are enclosed by ...", (gptr*) &enclosed,
(gptr*) &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
"Fields in the importfile are enclosed by ...", (uchar**) &enclosed,
(uchar**) &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
{"fields-optionally-enclosed-by", OPT_O_ENC,
"Fields in the i.file are opt. enclosed by ...", (gptr*) &opt_enclosed,
(gptr*) &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
"Fields in the i.file are opt. enclosed by ...", (uchar**) &opt_enclosed,
(uchar**) &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
{"fields-escaped-by", OPT_ESC, "Fields in the i.file are escaped by ...",
(gptr*) &escaped, (gptr*) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
(uchar**) &escaped, (uchar**) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"first-slave", 'x', "Deprecated, renamed to --lock-all-tables.",
(gptr*) &opt_lock_all_tables, (gptr*) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
(uchar**) &opt_lock_all_tables, (uchar**) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"flush-logs", 'F', "Flush logs file in server before starting dump. "
"Note that if you dump many databases at once (using the option "
@ -287,44 +287,44 @@ static struct my_option my_long_options[] =
"to the moment all tables are locked. So if you want your dump and "
"the log flush to happen at the same exact moment you should use "
"--lock-all-tables or --master-data with --flush-logs",
(gptr*) &flush_logs, (gptr*) &flush_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(uchar**) &flush_logs, (uchar**) &flush_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"flush-privileges", OPT_ESC, "Emit a FLUSH PRIVILEGES statement "
"after dumping the mysql database. This option should be used any "
"time the dump contains the mysql database and any other database "
"that depends on the data in the mysql database for proper restore. ",
(gptr*) &flush_privileges, (gptr*) &flush_privileges, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(uchar**) &flush_privileges, (uchar**) &flush_privileges, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"force", 'f', "Continue even if we get an sql-error.",
(gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG,
(uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"hex-blob", OPT_HEXBLOB, "Dump binary strings (BINARY, "
"VARBINARY, BLOB) in hexadecimal format.",
(gptr*) &opt_hex_blob, (gptr*) &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &current_host,
(gptr*) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
(uchar**) &opt_hex_blob, (uchar**) &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (uchar**) &current_host,
(uchar**) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ignore-table", OPT_IGNORE_TABLE,
"Do not dump the specified table. To specify more than one table to ignore, "
"use the directive multiple times, once for each table. Each table must "
"be specified with both database and table names, e.g. --ignore-table=database.table",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"insert-ignore", OPT_INSERT_IGNORE, "Insert rows with INSERT IGNORE.",
(gptr*) &opt_ignore, (gptr*) &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(uchar**) &opt_ignore, (uchar**) &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
(gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR,
(uchar**) &lines_terminated, (uchar**) &lines_terminated, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"lock-all-tables", 'x', "Locks all tables across all databases. This "
"is achieved by taking a global read lock for the duration of the whole "
"dump. Automatically turns --single-transaction and --lock-tables off.",
(gptr*) &opt_lock_all_tables, (gptr*) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
(uchar**) &opt_lock_all_tables, (uchar**) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"lock-tables", 'l', "Lock all tables for read.", (gptr*) &lock_tables,
(gptr*) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"lock-tables", 'l', "Lock all tables for read.", (uchar**) &lock_tables,
(uchar**) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"log-error", OPT_ERROR_LOG_FILE, "Append warnings and errors to given file.",
(gptr*) &log_error_file, (gptr*) &log_error_file, 0, GET_STR,
(uchar**) &log_error_file, (uchar**) &log_error_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"master-data", OPT_MASTER_DATA,
"This causes the binary log position and filename to be appended to the "
@ -336,29 +336,29 @@ static struct my_option my_long_options[] =
"- don't forget to read about --single-transaction below). In all cases "
"any action on logs will happen at the exact moment of the dump."
"Option automatically turns --lock-tables off.",
(gptr*) &opt_master_data, (gptr*) &opt_master_data, 0,
(uchar**) &opt_master_data, (uchar**) &opt_master_data, 0,
GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_MASTER_DATA_COMMENTED_SQL, 0, 0, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
(gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0,
(uchar**) &opt_max_allowed_packet, (uchar**) &opt_max_allowed_packet, 0,
GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096,
(longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
{"net_buffer_length", OPT_NET_BUFFER_LENGTH, "",
(gptr*) &opt_net_buffer_length, (gptr*) &opt_net_buffer_length, 0,
(uchar**) &opt_net_buffer_length, (uchar**) &opt_net_buffer_length, 0,
GET_ULONG, REQUIRED_ARG, 1024*1024L-1025, 4096, 16*1024L*1024L,
MALLOC_OVERHEAD-1024, 1024, 0},
{"no-autocommit", OPT_AUTOCOMMIT,
"Wrap tables with autocommit/commit statements.",
(gptr*) &opt_autocommit, (gptr*) &opt_autocommit, 0, GET_BOOL, NO_ARG,
(uchar**) &opt_autocommit, (uchar**) &opt_autocommit, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"no-create-db", 'n',
"'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;' will not be put in the output. The above line will be added otherwise, if --databases or --all-databases option was given.}.",
(gptr*) &opt_create_db, (gptr*) &opt_create_db, 0, GET_BOOL, NO_ARG, 0, 0,
(uchar**) &opt_create_db, (uchar**) &opt_create_db, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"no-create-info", 't', "Don't write table creation info.",
(gptr*) &opt_no_create_info, (gptr*) &opt_no_create_info, 0, GET_BOOL,
(uchar**) &opt_no_create_info, (uchar**) &opt_no_create_info, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-data", 'd', "No row information.", (gptr*) &opt_no_data,
(gptr*) &opt_no_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-data", 'd', "No row information.", (uchar**) &opt_no_data,
(uchar**) &opt_no_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-set-names", 'N',
"Deprecated. Use --skip-set-charset instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -367,7 +367,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"order-by-primary", OPT_ORDER_BY_PRIMARY,
"Sorts each table's rows by primary key, or first unique key, if such a key exists. Useful when dumping a MyISAM table to be loaded into an InnoDB table, but will make the dump itself take considerably longer.",
(gptr*) &opt_order_by_primary, (gptr*) &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
(uchar**) &opt_order_by_primary, (uchar**) &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's solicited on the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@ -375,35 +375,35 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
{"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
(uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"quick", 'q', "Don't buffer query, dump directly to stdout.",
(gptr*) &quick, (gptr*) &quick, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
(uchar**) &quick, (uchar**) &quick, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"quote-names",'Q', "Quote table and column names with backticks (`).",
(gptr*) &opt_quoted, (gptr*) &opt_quoted, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
(uchar**) &opt_quoted, (uchar**) &opt_quoted, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
0, 0},
{"replace", OPT_MYSQL_REPLACE_INTO, "Use REPLACE INTO instead of INSERT INTO.",
(gptr*) &opt_replace_into, (gptr*) &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(uchar**) &opt_replace_into, (uchar**) &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"result-file", 'r',
"Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"routines", 'R', "Dump stored routines (functions and procedures).",
(gptr*) &opt_routines, (gptr*) &opt_routines, 0, GET_BOOL,
(uchar**) &opt_routines, (uchar**) &opt_routines, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-charset", OPT_SET_CHARSET,
"Add 'SET NAMES default_character_set' to the output. Enabled by default; suppress with --skip-set-charset.",
(gptr*) &opt_set_charset, (gptr*) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
(uchar**) &opt_set_charset, (uchar**) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
"Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
/*
@ -417,37 +417,37 @@ static struct my_option my_long_options[] =
"support multiversioning (currently only InnoDB does); the dump is NOT "
"guaranteed to be consistent for other storage engines. Option "
"automatically turns off --lock-tables.",
(gptr*) &opt_single_transaction, (gptr*) &opt_single_transaction, 0,
(uchar**) &opt_single_transaction, (uchar**) &opt_single_transaction, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-opt", OPT_SKIP_OPTIMIZATION,
"Disable --opt. Disables --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
(uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
{"tab",'T',
"Creates tab separated textfile for each table to given path. (creates .sql and .txt files). NOTE: This only works if mysqldump is run on the same machine as the mysqld daemon.",
(gptr*) &path, (gptr*) &path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
(uchar**) &path, (uchar**) &path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tables", OPT_TABLES, "Overrides option --databases (-B).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"triggers", OPT_TRIGGERS, "Dump triggers for each dumped table",
(gptr*) &opt_dump_triggers, (gptr*) &opt_dump_triggers, 0, GET_BOOL,
(uchar**) &opt_dump_triggers, (uchar**) &opt_dump_triggers, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"tz-utc", OPT_TZ_UTC,
"SET TIME_ZONE='+00:00' at top of dump to allow dumping of TIMESTAMP data when a server has data in different time zones or data is being moved between servers with different time zones.",
(gptr*) &opt_tz_utc, (gptr*) &opt_tz_utc, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
(uchar**) &opt_tz_utc, (uchar**) &opt_tz_utc, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.",
(gptr*) &current_user, (gptr*) &current_user, 0, GET_STR, REQUIRED_ARG,
(uchar**) &current_user, (uchar**) &current_user, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v', "Print info about the various stages.",
(gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
(uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version",'V', "Output version information and exit.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"where", 'w', "Dump only selected records; QUOTES mandatory!",
(gptr*) &where, (gptr*) &where, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
(uchar**) &where, (uchar**) &where, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"xml", 'X', "Dump a database as well formed XML.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
@ -655,18 +655,18 @@ static void write_footer(FILE *sql_file)
}
} /* write_footer */
static void free_table_ent(char *key)
static void free_table_ent(char *key)
{
my_free((gptr) key, MYF(0));
my_free(key, MYF(0));
}
byte* get_table_key(const char *entry, uint *length,
my_bool not_used __attribute__((unused)))
uchar* get_table_key(const char *entry, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length= strlen(entry);
return (byte*) entry;
return (uchar*) entry;
}
@ -753,7 +753,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
fprintf(stderr, "Illegal use of option --ignore-table=<database>.<table>\n");
exit(1);
}
if (my_hash_insert(&ignore_table, (byte*)my_strdup(argument, MYF(0))))
if (my_hash_insert(&ignore_table, (uchar*)my_strdup(argument, MYF(0))))
exit(EX_EOM);
break;
}
@ -832,13 +832,13 @@ static int get_options(int *argc, char ***argv)
return(EX_EOM);
/* Don't copy internal log tables */
if (my_hash_insert(&ignore_table,
(byte*) my_strdup("mysql.apply_status", MYF(MY_WME))) ||
(uchar*) my_strdup("mysql.apply_status", MYF(MY_WME))) ||
my_hash_insert(&ignore_table,
(byte*) my_strdup("mysql.schema", MYF(MY_WME))) ||
(uchar*) my_strdup("mysql.schema", MYF(MY_WME))) ||
my_hash_insert(&ignore_table,
(byte*) my_strdup("mysql.general_log", MYF(MY_WME))) ||
(uchar*) my_strdup("mysql.general_log", MYF(MY_WME))) ||
my_hash_insert(&ignore_table,
(byte*) my_strdup("mysql.slow_log", MYF(MY_WME))))
(uchar*) my_strdup("mysql.slow_log", MYF(MY_WME))))
return(EX_EOM);
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
@ -2287,10 +2287,10 @@ static void dump_triggers_for_table(char *table,
we should check if we have this column before accessing it.
*/
uint user_name_len;
size_t user_name_len;
char user_name_str[USERNAME_LENGTH + 1];
char quoted_user_name_str[USERNAME_LENGTH * 2 + 3];
uint host_name_len;
size_t host_name_len;
char host_name_str[HOSTNAME_LENGTH + 1];
char quoted_host_name_str[HOSTNAME_LENGTH * 2 + 3];
@ -3342,9 +3342,9 @@ static int init_dumping(char *database, int init_func(char*))
/* Return 1 if we should copy the table */
my_bool include_table(byte* hash_key, uint len)
my_bool include_table(uchar* hash_key, uint len)
{
return !hash_search(&ignore_table, (byte*) hash_key, len);
return !hash_search(&ignore_table, (uchar*) hash_key, len);
}
@ -4132,10 +4132,10 @@ static my_bool get_view_structure(char *table, char* db)
Surround it with !50013 comments
*/
{
uint user_name_len;
size_t user_name_len;
char user_name_str[USERNAME_LENGTH + 1];
char quoted_user_name_str[USERNAME_LENGTH * 2 + 3];
uint host_name_len;
size_t host_name_len;
char host_name_str[HOSTNAME_LENGTH + 1];
char quoted_host_name_str[HOSTNAME_LENGTH * 2 + 3];

View file

@ -57,7 +57,7 @@ static char *opt_password=0, *current_user=0,
*escaped=0, *opt_columns=0,
*default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
static uint opt_mysql_port= 0, opt_protocol= 0;
static my_string opt_mysql_unix_port=0;
static char * opt_mysql_unix_port=0;
static longlong opt_ignore_lines= -1;
static CHARSET_INFO *charset_info= &my_charset_latin1;
#include <sslopt-vars.h>
@ -73,59 +73,59 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Directory where character sets are.", (uchar**) &charsets_dir,
(uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Set the default character set.", (uchar**) &default_charset,
(uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"columns", 'c',
"Use only these columns to import the data to. Give the column names in a comma separated list. This is same as giving columns to LOAD DATA INFILE.",
(gptr*) &opt_columns, (gptr*) &opt_columns, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
(uchar**) &opt_columns, (uchar**) &opt_columns, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
(uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"debug",'#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"delete", 'd', "First delete all rows from table.", (gptr*) &opt_delete,
(gptr*) &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
(uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"delete", 'd', "First delete all rows from table.", (uchar**) &opt_delete,
(uchar**) &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"fields-terminated-by", OPT_FTB,
"Fields in the textfile are terminated by ...", (gptr*) &fields_terminated,
(gptr*) &fields_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Fields in the textfile are terminated by ...", (uchar**) &fields_terminated,
(uchar**) &fields_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-enclosed-by", OPT_ENC,
"Fields in the importfile are enclosed by ...", (gptr*) &enclosed,
(gptr*) &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Fields in the importfile are enclosed by ...", (uchar**) &enclosed,
(uchar**) &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-optionally-enclosed-by", OPT_O_ENC,
"Fields in the i.file are opt. enclosed by ...", (gptr*) &opt_enclosed,
(gptr*) &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Fields in the i.file are opt. enclosed by ...", (uchar**) &opt_enclosed,
(uchar**) &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-escaped-by", OPT_ESC, "Fields in the i.file are escaped by ...",
(gptr*) &escaped, (gptr*) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
(uchar**) &escaped, (uchar**) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"force", 'f', "Continue even if we get an sql-error.",
(gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
(uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &current_host,
(gptr*) &current_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (uchar**) &current_host,
(uchar**) &current_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ignore", 'i', "If duplicate unique key was found, keep old row.",
(gptr*) &ignore, (gptr*) &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
(uchar**) &ignore, (uchar**) &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"ignore-lines", OPT_IGN_LINES, "Ignore first n lines of data infile.",
(gptr*) &opt_ignore_lines, (gptr*) &opt_ignore_lines, 0, GET_LL,
(uchar**) &opt_ignore_lines, (uchar**) &opt_ignore_lines, 0, GET_LL,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
(gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR,
(uchar**) &lines_terminated, (uchar**) &lines_terminated, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"local", 'L', "Read all files through the client.", (gptr*) &opt_local_file,
(gptr*) &opt_local_file, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"local", 'L', "Read all files through the client.", (uchar**) &opt_local_file,
(uchar**) &opt_local_file, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"lock-tables", 'l', "Lock all tables for write (this disables threads).",
(gptr*) &lock_tables, (gptr*) &lock_tables, 0, GET_BOOL, NO_ARG,
(uchar**) &lock_tables, (uchar**) &lock_tables, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"low-priority", OPT_LOW_PRIORITY,
"Use LOW_PRIORITY when updating the table.", (gptr*) &opt_low_priority,
(gptr*) &opt_low_priority, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
"Use LOW_PRIORITY when updating the table.", (uchar**) &opt_low_priority,
(uchar**) &opt_low_priority, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@ -133,35 +133,35 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
{"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
(uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replace", 'r', "If duplicate unique key was found, replace old row.",
(gptr*) &replace, (gptr*) &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
(uchar**) &replace, (uchar**) &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
"Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Be more silent.", (gptr*) &silent, (gptr*) &silent, 0,
{"silent", 's', "Be more silent.", (uchar**) &silent, (uchar**) &silent, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
(uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
{"use-threads", OPT_USE_THREADS,
"Load files in parallel. The argument is the number "
"of threads to use for loading data.",
(gptr*) &opt_use_threads, (gptr*) &opt_use_threads, 0,
(uchar**) &opt_use_threads, (uchar**) &opt_use_threads, 0,
GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", (gptr*) &current_user,
(gptr*) &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login if not current user.", (uchar**) &current_user,
(uchar**) &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v', "Print info about the various stages.", (gptr*) &verbose,
(gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Print info about the various stages.", (uchar**) &verbose,
(uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}

View file

@ -26,7 +26,7 @@
#include <stdarg.h>
#include <sslopt-vars.h>
static my_string host=0,opt_password=0,user=0;
static char * host=0, *opt_password=0, *user=0;
static my_bool opt_show_keys= 0, opt_compress= 0, opt_count=0, opt_status= 0;
static my_bool tty_password= 0, opt_table_type= 0, info_flag= 0;
static uint opt_verbose=0;
@ -52,7 +52,7 @@ static void print_res_top(MYSQL_RES *result);
static void print_res_row(MYSQL_RES *result,MYSQL_ROW cur);
static const char *load_default_groups[]= { "mysqlshow","client",0 };
static my_string opt_mysql_unix_port=0;
static char * opt_mysql_unix_port=0;
int main(int argc, char **argv)
{
@ -120,7 +120,8 @@ int main(int argc, char **argv)
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (!(mysql_real_connect(&mysql,host,user,opt_password,
(first_argument_uses_wildcards) ? "" : argv[0],opt_mysql_port,opt_mysql_unix_port,
(first_argument_uses_wildcards) ? "" :
argv[0],opt_mysql_port,opt_mysql_unix_port,
0)))
{
fprintf(stderr,"%s: %s\n",my_progname,mysql_error(&mysql));
@ -161,36 +162,36 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"character-sets-dir", 'c', "Directory where character sets are.",
(gptr*) &charsets_dir, (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0,
(uchar**) &charsets_dir, (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0,
0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Set the default character set.", (uchar**) &default_charset,
(uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"count", OPT_COUNT,
"Show number of rows per table (may be slow for not MyISAM tables)",
(gptr*) &opt_count, (gptr*) &opt_count, 0, GET_BOOL, NO_ARG, 0, 0, 0,
(uchar**) &opt_count, (uchar**) &opt_count, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
(uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
(uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR,
{"host", 'h', "Connect to host.", (uchar**) &host, (uchar**) &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"status", 'i', "Shows a lot of extra information about each table.",
(gptr*) &opt_status, (gptr*) &opt_status, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(uchar**) &opt_status, (uchar**) &opt_status, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"keys", 'k', "Show keys for table.", (gptr*) &opt_show_keys,
(gptr*) &opt_show_keys, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"keys", 'k', "Show keys for table.", (uchar**) &opt_show_keys,
(uchar**) &opt_show_keys, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
{"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
(uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
#ifdef __WIN__
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
@ -200,19 +201,19 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
"Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"show-table-type", 't', "Show table type column.",
(gptr*) &opt_table_type, (gptr*) &opt_table_type, 0, GET_BOOL,
(uchar**) &opt_table_type, (uchar**) &opt_table_type, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
(uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", (gptr*) &user,
(gptr*) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login if not current user.", (uchar**) &user,
(uchar**) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v',
"More verbose output; You can use this multiple times to get even more verbose output.",
@ -733,7 +734,7 @@ print_header(const char *header,uint head_length,...)
for (i=0 ; i < length+2 ; i++)
putchar('-');
putchar('+');
if (!(field=va_arg(args,my_string)))
if (!(field=va_arg(args,char *)))
break;
length=va_arg(args,uint);
}
@ -757,7 +758,7 @@ print_header(const char *header,uint head_length,...)
for (i=0 ; i < length ; i++)
putchar(' ');
putchar('|');
if (!(field=va_arg(args,my_string)))
if (!(field=va_arg(args,char *)))
break;
length=va_arg(args,uint);
}
@ -772,7 +773,7 @@ print_header(const char *header,uint head_length,...)
for (i=0 ; i < length+2 ; i++)
putchar('-');
putchar('+');
if (!(field=va_arg(args,my_string)))
if (!(field=va_arg(args,char *)))
break;
length=va_arg(args,uint);
}
@ -798,7 +799,7 @@ print_row(const char *header,uint head_length,...)
field_length=(uint) strlen(field);
for (i=field_length ; i <= length ; i++)
putchar(' ');
if (!(field=va_arg(args,my_string)))
if (!(field=va_arg(args,char *)))
break;
length=va_arg(args,uint);
}

View file

@ -388,9 +388,9 @@ int main(int argc, char **argv)
/* now free all the strings we created */
if (opt_password)
my_free((gptr)opt_password, MYF(0));
my_free(opt_password, MYF(0));
my_free((gptr)concurrency, MYF(0));
my_free(concurrency, MYF(0));
statement_cleanup(create_statements);
statement_cleanup(query_statements);
@ -400,7 +400,7 @@ int main(int argc, char **argv)
#ifdef HAVE_SMEM
if (shared_memory_base_name)
my_free((gptr)shared_memory_base_name, MYF(MY_ALLOW_ZERO_PTR));
my_free(shared_memory_base_name, MYF(MY_ALLOW_ZERO_PTR));
#endif
free_defaults(defaults_argv);
my_end(0);
@ -474,7 +474,7 @@ void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr)
if (opt_csv_str)
print_conclusions_csv(&conclusion);
my_free((gptr)head_sptr, MYF(0));
my_free(head_sptr, MYF(0));
}
@ -485,94 +485,94 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0, 0},
{"auto-generate-sql", 'a',
"Generate SQL where not supplied by file or command line.",
(gptr*) &auto_generate_sql, (gptr*) &auto_generate_sql,
(uchar**) &auto_generate_sql, (uchar**) &auto_generate_sql,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-add-autoincrement", OPT_SLAP_AUTO_GENERATE_ADD_AUTO,
"Add autoincrement to auto-generated tables.",
(gptr*) &auto_generate_sql_autoincrement,
(gptr*) &auto_generate_sql_autoincrement,
(uchar**) &auto_generate_sql_autoincrement,
(uchar**) &auto_generate_sql_autoincrement,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-execute-number", OPT_SLAP_AUTO_GENERATE_EXECUTE_QUERIES,
"Set this number to generate a set number of queries to run.\n",
(gptr*) &auto_actual_queries, (gptr*) &auto_actual_queries,
(uchar**) &auto_actual_queries, (uchar**) &auto_actual_queries,
0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-guid-primary", OPT_SLAP_AUTO_GENERATE_GUID_PRIMARY,
"Add GUID based primary keys to auto-generated tables.",
(gptr*) &auto_generate_sql_guid_primary,
(gptr*) &auto_generate_sql_guid_primary,
(uchar**) &auto_generate_sql_guid_primary,
(uchar**) &auto_generate_sql_guid_primary,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-load-type", OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE,
"Load types are mixed, update, write, key, or read. Default is mixed\n",
(gptr*) &auto_generate_sql_type, (gptr*) &auto_generate_sql_type,
(uchar**) &auto_generate_sql_type, (uchar**) &auto_generate_sql_type,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-secondary-indexes",
OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES,
"Number of secondary indexes to add auto-generated tables.",
(gptr*) &auto_generate_sql_secondary_indexes,
(gptr*) &auto_generate_sql_secondary_indexes, 0,
(uchar**) &auto_generate_sql_secondary_indexes,
(uchar**) &auto_generate_sql_secondary_indexes, 0,
GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-unique-query-number",
OPT_SLAP_AUTO_GENERATE_UNIQUE_QUERY_NUM,
"Number of unique queries auto tests",
(gptr*) &auto_generate_sql_unique_query_number,
(gptr*) &auto_generate_sql_unique_query_number,
(uchar**) &auto_generate_sql_unique_query_number,
(uchar**) &auto_generate_sql_unique_query_number,
0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
{"auto-generate-sql-unique-write-number",
OPT_SLAP_AUTO_GENERATE_UNIQUE_WRITE_NUM,
"Number of unique queries for auto-generate-sql-write-number",
(gptr*) &auto_generate_sql_unique_write_number,
(gptr*) &auto_generate_sql_unique_write_number,
(uchar**) &auto_generate_sql_unique_write_number,
(uchar**) &auto_generate_sql_unique_write_number,
0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
{"auto-generate-sql-write-number", OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
"Number of rows to insert to used in read and write loads (default is 100).\n",
(gptr*) &auto_generate_sql_number, (gptr*) &auto_generate_sql_number,
(uchar**) &auto_generate_sql_number, (uchar**) &auto_generate_sql_number,
0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
(uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"concurrency", 'c', "Number of clients to simulate for query to run.",
(gptr*) &concurrency_str, (gptr*) &concurrency_str, 0, GET_STR,
(uchar**) &concurrency_str, (uchar**) &concurrency_str, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"create", OPT_SLAP_CREATE_STRING, "File or string to use create tables.",
(gptr*) &create_string, (gptr*) &create_string, 0, GET_STR, REQUIRED_ARG,
(uchar**) &create_string, (uchar**) &create_string, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"create-schema", OPT_CREATE_SLAP_SCHEMA, "Schema to run tests in.",
(gptr*) &create_schema_string, (gptr*) &create_schema_string, 0, GET_STR,
(uchar**) &create_schema_string, (uchar**) &create_schema_string, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"csv", OPT_SLAP_CSV,
"Generate CSV output to named file or to stdout if no file is named.",
(gptr*) &opt_csv_str, (gptr*) &opt_csv_str, 0, GET_STR,
(uchar**) &opt_csv_str, (uchar**) &opt_csv_str, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
(gptr*) &default_dbug_option, (gptr*) &default_dbug_option, 0, GET_STR,
(uchar**) &default_dbug_option, (uchar**) &default_dbug_option, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"delimiter", 'F',
"Delimiter to use in SQL statements supplied in file or command line.",
(gptr*) &delimiter, (gptr*) &delimiter, 0, GET_STR, REQUIRED_ARG,
(uchar**) &delimiter, (uchar**) &delimiter, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"engine", 'e', "Storage engine to use for creating the table.",
(gptr*) &default_engine, (gptr*) &default_engine, 0,
(uchar**) &default_engine, (uchar**) &default_engine, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR,
{"host", 'h', "Connect to host.", (uchar**) &host, (uchar**) &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"iterations", 'i', "Number of times to run the tests.", (gptr*) &iterations,
(gptr*) &iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
{"iterations", 'i', "Number of times to run the tests.", (uchar**) &iterations,
(uchar**) &iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
{"number-char-cols", 'x',
"Number of VARCHAR columns to create table with if specifying --auto-generate-sql ",
(gptr*) &num_char_cols_opt, (gptr*) &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG,
(uchar**) &num_char_cols_opt, (uchar**) &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"number-int-cols", 'y',
"Number of INT columns to create table with if specifying --auto-generate-sql.",
(gptr*) &num_int_cols_opt, (gptr*) &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG,
(uchar**) &num_int_cols_opt, (uchar**) &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"number-of-queries", OPT_MYSQL_NUMBER_OF_QUERY,
"Limit each client to this number of queries (this is not exact).",
(gptr*) &num_of_query, (gptr*) &num_of_query, 0,
(uchar**) &num_of_query, (uchar**) &num_of_query, 0,
GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"only-print", OPT_MYSQL_ONLY_PRINT,
"This causes mysqlslap to not connect to the databases, but instead print "
"out what it would have done instead.",
(gptr*) &opt_only_print, (gptr*) &opt_only_print, 0, GET_BOOL, NO_ARG,
(uchar**) &opt_only_print, (uchar**) &opt_only_print, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's "
@ -581,50 +581,50 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
{"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
(uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
0},
{"post-query", OPT_SLAP_POST_QUERY,
"Query to run or file containing query to run after executing.",
(gptr*) &user_supplied_post_statements,
(gptr*) &user_supplied_post_statements,
(uchar**) &user_supplied_post_statements,
(uchar**) &user_supplied_post_statements,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"pre-query", OPT_SLAP_PRE_QUERY,
"Query to run or file containing query to run before executing.",
(gptr*) &user_supplied_pre_statements,
(gptr*) &user_supplied_pre_statements,
(uchar**) &user_supplied_pre_statements,
(uchar**) &user_supplied_pre_statements,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"preserve-schema", OPT_MYSQL_PRESERVE_SCHEMA,
"Preserve the schema from the mysqlslap run, this happens unless "
"--auto-generate-sql or --create are used.",
(gptr*) &opt_preserve, (gptr*) &opt_preserve, 0, GET_BOOL,
(uchar**) &opt_preserve, (uchar**) &opt_preserve, 0, GET_BOOL,
NO_ARG, TRUE, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL,
"The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"query", 'q', "Query to run or file containing query to run.",
(gptr*) &user_supplied_query, (gptr*) &user_supplied_query,
(uchar**) &user_supplied_query, (uchar**) &user_supplied_query,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory.", (gptr*) &shared_memory_base_name,
(gptr*) &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG,
"Base name of shared memory.", (uchar**) &shared_memory_base_name,
(uchar**) &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Run program in silent mode - no output.",
(gptr*) &opt_silent, (gptr*) &opt_silent, 0, GET_BOOL, NO_ARG,
(uchar**) &opt_silent, (uchar**) &opt_silent, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
(uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", (gptr*) &user,
(gptr*) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login if not current user.", (uchar**) &user,
(uchar**) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v',
"More verbose output; You can use this multiple times to get even more "
"verbose output.", (gptr*) &verbose, (gptr*) &verbose, 0,
"verbose output.", (uchar**) &verbose, (uchar**) &verbose, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
@ -674,7 +674,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (argument)
{
char *start= argument;
my_free((gptr)opt_password, MYF(MY_ALLOW_ZERO_PTR));
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
opt_password= my_strdup(argument,MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */
if (*start)
@ -1313,7 +1313,7 @@ get_options(int *argc,char ***argv)
tmp_string[sbuf.st_size]= '\0';
my_close(data_file,MYF(0));
parse_delimiter(tmp_string, &create_statements, delimiter[0]);
my_free((gptr)tmp_string, MYF(0));
my_free(tmp_string, MYF(0));
}
else if (create_string)
{
@ -1342,7 +1342,7 @@ get_options(int *argc,char ***argv)
if (user_supplied_query)
actual_queries= parse_delimiter(tmp_string, &query_statements,
delimiter[0]);
my_free((gptr)tmp_string, MYF(0));
my_free(tmp_string, MYF(0));
}
else if (user_supplied_query)
{
@ -1373,11 +1373,12 @@ get_options(int *argc,char ***argv)
if (user_supplied_pre_statements)
actual_queries= parse_delimiter(tmp_string, &pre_statements,
delimiter[0]);
my_free((gptr)tmp_string, MYF(0));
my_free(tmp_string, MYF(0));
}
else if (user_supplied_pre_statements)
{
actual_queries= parse_delimiter(user_supplied_pre_statements, &pre_statements,
actual_queries= parse_delimiter(user_supplied_pre_statements,
&pre_statements,
delimiter[0]);
}
@ -1403,7 +1404,7 @@ get_options(int *argc,char ***argv)
if (user_supplied_post_statements)
parse_delimiter(tmp_string, &post_statements,
delimiter[0]);
my_free((gptr)tmp_string, MYF(0));
my_free(tmp_string, MYF(0));
}
else if (user_supplied_post_statements)
{
@ -1500,9 +1501,9 @@ drop_primary_key_list(void)
if (primary_keys_number_of)
{
for (counter= 0; counter < primary_keys_number_of; counter++)
my_free((gptr)primary_keys[counter], MYF(0));
my_free(primary_keys[counter], MYF(0));
my_free((gptr)primary_keys, MYF(0));
my_free(primary_keys, MYF(0));
}
return 0;
@ -2081,10 +2082,10 @@ option_cleanup(option_string *stmt)
{
nptr= ptr->next;
if (ptr->string)
my_free((gptr)ptr->string, MYF(0));
my_free(ptr->string, MYF(0));
if (ptr->option)
my_free((gptr)ptr->option, MYF(0));
my_free((gptr)(byte *)ptr, MYF(0));
my_free(ptr->option, MYF(0));
my_free(ptr, MYF(0));
}
}
@ -2099,7 +2100,7 @@ statement_cleanup(statement *stmt)
{
nptr= ptr->next;
if (ptr->string)
my_free((gptr)ptr->string, MYF(0));
my_free((gptr)(byte *)ptr, MYF(0));
my_free(ptr->string, MYF(0));
my_free(ptr, MYF(0));
}
}

View file

@ -747,7 +747,7 @@ void close_files()
DBUG_PRINT("info", ("closing file: %s", cur_file->file_name));
my_fclose(cur_file->file, MYF(0));
}
my_free((gptr)cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR));
my_free((uchar*) cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR));
cur_file->file_name= 0;
}
DBUG_VOID_RETURN;
@ -766,8 +766,8 @@ void free_used_memory()
for (i= 0 ; i < q_lines.elements ; i++)
{
struct st_command **q= dynamic_element(&q_lines, i, struct st_command**);
my_free((gptr) (*q)->query_buf,MYF(MY_ALLOW_ZERO_PTR));
my_free((gptr) (*q),MYF(0));
my_free((*q)->query_buf,MYF(MY_ALLOW_ZERO_PTR));
my_free((*q),MYF(0));
}
for (i= 0; i < 10; i++)
{
@ -1014,7 +1014,7 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
if (!eval_result && (uint) stat_info.st_size != ds->length)
{
DBUG_PRINT("info",("Size differs: result size: %u file size: %lu",
ds->length, (ulong) stat_info.st_size));
(uint) ds->length, (ulong) stat_info.st_size));
DBUG_PRINT("info",("result: '%s'", ds->str));
DBUG_RETURN(RESULT_LENGTH_MISMATCH);
}
@ -1023,7 +1023,7 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
if ((fd = my_open(eval_file, O_RDONLY, MYF(MY_WME))) < 0)
die("Failed to open file %s", eval_file);
if (my_read(fd, (byte*)tmp, stat_info.st_size, MYF(MY_WME|MY_NABP)))
if (my_read(fd, (uchar*)tmp, stat_info.st_size, MYF(MY_WME|MY_NABP)))
die("Failed to read from file %s, errno: %d", eval_file, errno);
tmp[stat_info.st_size] = 0;
init_dynamic_string(&res_ds, "", stat_info.st_size+256, 256);
@ -1054,7 +1054,7 @@ err:
res_ptr, res_len);
dynstr_free(&res_ds);
my_free((gptr) tmp, MYF(0));
my_free(tmp, MYF(0));
my_close(fd, MYF(MY_WME));
DBUG_RETURN(res);
@ -1127,13 +1127,13 @@ void check_require(DYNAMIC_STRING* ds, const char *fname)
}
static byte *get_var_key(const byte* var, uint* len,
my_bool __attribute__((unused)) t)
static uchar *get_var_key(const uchar* var, size_t *len,
my_bool __attribute__((unused)) t)
{
register char* key;
key = ((VAR*)var)->name;
*len = ((VAR*)var)->name_len;
return (byte*)key;
return (uchar*)key;
}
@ -1177,7 +1177,7 @@ void var_free(void *v)
{
my_free(((VAR*) v)->str_val, MYF(MY_WME));
if (((VAR*)v)->alloced)
my_free((char*) v, MYF(MY_WME));
my_free(v, MYF(MY_WME));
}
@ -1189,7 +1189,7 @@ VAR* var_from_env(const char *name, const char *def_val)
tmp = def_val;
v = var_init(0, name, strlen(name), tmp, strlen(tmp));
my_hash_insert(&var_hash, (byte*)v);
my_hash_insert(&var_hash, (uchar*)v);
return v;
}
@ -1222,7 +1222,8 @@ VAR* var_get(const char *var_name, const char **var_name_end, my_bool raw,
if (length >= MAX_VAR_NAME_LENGTH)
die("Too long variable name: %s", save_var_name);
if (!(v = (VAR*) hash_search(&var_hash, save_var_name, length)))
if (!(v = (VAR*) hash_search(&var_hash, (const uchar*) save_var_name,
length)))
{
char buff[MAX_VAR_NAME_LENGTH+1];
strmake(buff, save_var_name, length);
@ -1253,10 +1254,10 @@ err:
VAR *var_obtain(const char *name, int len)
{
VAR* v;
if ((v = (VAR*)hash_search(&var_hash, name, len)))
if ((v = (VAR*)hash_search(&var_hash, (const uchar *) name, len)))
return v;
v = var_init(0, name, len, "", 0);
my_hash_insert(&var_hash, (byte*)v);
my_hash_insert(&var_hash, (uchar*)v);
return v;
}
@ -1308,7 +1309,7 @@ void var_set(const char *var_name, const char *var_name_end,
if (!(v->env_s= my_strdup(buf, MYF(MY_WME))))
die("Out of memory");
putenv(v->env_s);
my_free((gptr)old_env_s, MYF(MY_ALLOW_ZERO_PTR));
my_free(old_env_s, MYF(MY_ALLOW_ZERO_PTR));
}
DBUG_VOID_RETURN;
}
@ -1613,9 +1614,10 @@ FILE* my_popen(DYNAMIC_STRING *ds_cmd, const char *mode)
static void init_builtin_echo(void)
{
#ifdef __WIN__
size_t echo_length;
/* Look for "echo.exe" in same dir as mysqltest was started from */
dirname_part(builtin_echo, my_progname);
dirname_part(builtin_echo, my_progname, &echo_length);
fn_format(builtin_echo, ".\\echo.exe",
builtin_echo, "", MYF(MY_REPLACE_DIR));
@ -2087,8 +2089,8 @@ void read_until_delimiter(DYNAMIC_STRING *ds,
{
char c;
DBUG_ENTER("read_until_delimiter");
DBUG_PRINT("enter", ("delimiter: %s, length: %d",
ds_delimiter->str, ds_delimiter->length));
DBUG_PRINT("enter", ("delimiter: %s, length: %u",
ds_delimiter->str, (uint) ds_delimiter->length));
if (ds_delimiter->length > MAX_DELIMITER_LENGTH)
die("Max delimiter length(%d) exceeded", MAX_DELIMITER_LENGTH);
@ -2246,7 +2248,7 @@ void do_cat_file(struct st_command *command)
if ((fd= my_open(ds_filename.str, O_RDONLY, MYF(0))) < 0)
die("Failed to open file %s", ds_filename.str);
while((len= my_read(fd, (byte*)&buff,
while((len= my_read(fd, (uchar*)&buff,
sizeof(buff), MYF(0))) > 0)
{
char *p= buff, *start= buff;
@ -2314,10 +2316,10 @@ void do_diff_files(struct st_command *command)
my_close(fd, MYF(0));
die("Failed to open second file %s", ds_filename2.str);
}
while((len= my_read(fd, (byte*)&buff,
while((len= my_read(fd, (uchar*)&buff,
sizeof(buff), MYF(0))) > 0)
{
if ((len2= my_read(fd2, (byte*)&buff2,
if ((len2= my_read(fd2, (uchar*)&buff2,
sizeof(buff2), MYF(0))) != len)
{
/* File 2 was smaller */
@ -2331,7 +2333,7 @@ void do_diff_files(struct st_command *command)
break;
}
}
if (my_read(fd2, (byte*)&buff2,
if (my_read(fd2, (uchar*)&buff2,
sizeof(buff2), MYF(0)) > 0)
{
/* File 1 was smaller */
@ -3819,7 +3821,7 @@ int read_line(char *buf, int size)
my_fclose(cur_file->file, MYF(0));
cur_file->file= 0;
}
my_free((gptr)cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR));
my_free((uchar*) cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR));
cur_file->file_name= 0;
if (cur_file == file_stack)
{
@ -4172,12 +4174,12 @@ int read_command(struct st_command** command_ptr)
if (parser.current_line < parser.read_lines)
{
get_dynamic(&q_lines, (gptr) command_ptr, parser.current_line) ;
get_dynamic(&q_lines, (uchar*) command_ptr, parser.current_line) ;
DBUG_RETURN(0);
}
if (!(*command_ptr= command=
(struct st_command*) my_malloc(sizeof(*command), MYF(MY_WME))) ||
insert_dynamic(&q_lines, (gptr) &command))
insert_dynamic(&q_lines, (uchar*) &command))
die(NullS);
command->require_file[0]= 0;
@ -4233,18 +4235,18 @@ static struct my_option my_long_options[] =
{
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"basedir", 'b', "Basedir for tests.", (gptr*) &opt_basedir,
(gptr*) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"basedir", 'b', "Basedir for tests.", (uchar**) &opt_basedir,
(uchar**) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &opt_charsets_dir,
(gptr*) &opt_charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
"Directory where character sets are.", (uchar**) &opt_charsets_dir,
(uchar**) &opt_charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use the compressed server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
(uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statements.",
(gptr*) &cursor_protocol, (gptr*) &cursor_protocol, 0,
(uchar**) &cursor_protocol, (uchar**) &cursor_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use.", (gptr*) &opt_db, (gptr*) &opt_db, 0,
{"database", 'D', "Database to use.", (uchar**) &opt_db, (uchar**) &opt_db, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit",
@ -4253,51 +4255,51 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"host", 'h', "Connect to host.", (gptr*) &opt_host, (gptr*) &opt_host, 0,
{"host", 'h', "Connect to host.", (uchar**) &opt_host, (uchar**) &opt_host, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"include", 'i', "Include SQL before each test case.", (gptr*) &opt_include,
(gptr*) &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"logdir", OPT_LOG_DIR, "Directory for log files", (gptr*) &opt_logdir,
(gptr*) &opt_logdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"include", 'i', "Include SQL before each test case.", (uchar**) &opt_include,
(uchar**) &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"logdir", OPT_LOG_DIR, "Directory for log files", (uchar**) &opt_logdir,
(uchar**) &opt_logdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"mark-progress", OPT_MARK_PROGRESS,
"Write linenumber and elapsed time to <testname>.progress ",
(gptr*) &opt_mark_progress, (gptr*) &opt_mark_progress, 0,
(uchar**) &opt_mark_progress, (uchar**) &opt_mark_progress, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"max-connect-retries", OPT_MAX_CONNECT_RETRIES,
"Max number of connection attempts when connecting to server",
(gptr*) &opt_max_connect_retries, (gptr*) &opt_max_connect_retries, 0,
(uchar**) &opt_max_connect_retries, (uchar**) &opt_max_connect_retries, 0,
GET_INT, REQUIRED_ARG, 500, 1, 10000, 0, 0, 0},
{"password", 'p', "Password to use when connecting to server.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_port,
(gptr*) &opt_port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection.", (uchar**) &opt_port,
(uchar**) &opt_port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ps-protocol", OPT_PS_PROTOCOL, "Use prepared statements protocol for communication",
(gptr*) &ps_protocol, (gptr*) &ps_protocol, 0,
(uchar**) &ps_protocol, (uchar**) &ps_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"quiet", 's', "Suppress all normal output.", (gptr*) &silent,
(gptr*) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"quiet", 's', "Suppress all normal output.", (uchar**) &silent,
(uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"record", 'r', "Record output of test_file into result file.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"result-file", 'R', "Read/Store result from/in this file.",
(gptr*) &result_file_name, (gptr*) &result_file_name, 0,
(uchar**) &result_file_name, (uchar**) &result_file_name, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-arg", 'A', "Send option value to embedded server as a parameter.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-file", 'F', "Read embedded server arguments from file.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Suppress all normal output. Synonym for --quiet.",
(gptr*) &silent, (gptr*) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
(uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
"Don't use the memory allocation checking.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"sleep", 'T', "Sleep always this many seconds on sleep commands.",
(gptr*) &opt_sleep, (gptr*) &opt_sleep, 0, GET_INT, REQUIRED_ARG, -1, 0, 0,
(uchar**) &opt_sleep, (uchar**) &opt_sleep, 0, GET_INT, REQUIRED_ARG, -1, 0, 0,
0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &unix_sock, (gptr*) &unix_sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
(uchar**) &unix_sock, (uchar**) &unix_sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"sp-protocol", OPT_SP_PROTOCOL, "Use stored procedures for select",
(gptr*) &sp_protocol, (gptr*) &sp_protocol, 0,
(uchar**) &sp_protocol, (uchar**) &sp_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#include "sslopt-longopts.h"
{"test-file", 'x', "Read test from/in this file (default stdin).",
@ -4306,14 +4308,14 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't', "Temporary directory where sockets are put.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login.", (gptr*) &opt_user, (gptr*) &opt_user, 0,
{"user", 'u', "User for login.", (uchar**) &opt_user, (uchar**) &opt_user, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Write more.", (gptr*) &verbose, (gptr*) &verbose, 0,
{"verbose", 'v', "Write more.", (uchar**) &verbose, (uchar**) &verbose, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"view-protocol", OPT_VIEW_PROTOCOL, "Use views for select",
(gptr*) &view_protocol, (gptr*) &view_protocol, 0,
(uchar**) &view_protocol, (uchar**) &view_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@ -4529,7 +4531,7 @@ void str_to_file2(const char *fname, char *str, int size, my_bool append)
die("Could not open %s: errno = %d", buff, errno);
if (append && my_seek(fd, 0, SEEK_END, MYF(0)) == MY_FILEPOS_ERROR)
die("Could not find end of file %s: errno = %d", buff, errno);
if (my_write(fd, (byte*)str, size, MYF(MY_WME|MY_FNABP)))
if (my_write(fd, (uchar*)str, size, MYF(MY_WME|MY_FNABP)))
die("write failed");
my_close(fd, MYF(0));
}
@ -4646,7 +4648,7 @@ void init_win_path_patterns()
continue;
}
if (insert_dynamic(&patterns, (gptr) &p))
if (insert_dynamic(&patterns, (uchar*) &p))
die(NullS);
DBUG_PRINT("info", ("p: %s", p));
@ -4666,7 +4668,7 @@ void free_win_path_patterns()
for (i=0 ; i < patterns.elements ; i++)
{
const char** pattern= dynamic_element(&patterns, i, const char**);
my_free((gptr) *pattern, MYF(0));
my_free((char*) *pattern, MYF(0));
}
delete_dynamic(&patterns);
}
@ -4848,12 +4850,12 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
for (i= 0; i < num_fields; i++)
{
/* Free data for output */
my_free((gptr)my_bind[i].buffer, MYF(MY_WME | MY_FAE));
my_free(my_bind[i].buffer, MYF(MY_WME | MY_FAE));
}
/* Free array with bind structs, lengths and NULL flags */
my_free((gptr)my_bind , MYF(MY_WME | MY_FAE));
my_free((gptr)length , MYF(MY_WME | MY_FAE));
my_free((gptr)is_null , MYF(MY_WME | MY_FAE));
my_free(my_bind , MYF(MY_WME | MY_FAE));
my_free(length , MYF(MY_WME | MY_FAE));
my_free(is_null , MYF(MY_WME | MY_FAE));
}
@ -6561,15 +6563,15 @@ void free_replace_column()
typedef struct st_pointer_array { /* when using array-strings */
TYPELIB typelib; /* Pointer to strings */
byte *str; /* Strings is here */
uchar *str; /* Strings is here */
int7 *flag; /* Flag about each var. */
uint array_allocs,max_count,length,max_length;
} POINTER_ARRAY;
struct st_replace;
struct st_replace *init_replace(my_string *from, my_string *to, uint count,
my_string word_end_chars);
int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name);
struct st_replace *init_replace(char * *from, char * *to, uint count,
char * word_end_chars);
int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name);
void replace_strings_append(struct st_replace *rep, DYNAMIC_STRING* ds,
const char *from, int len);
void free_pointer_array(POINTER_ARRAY *pa);
@ -6633,7 +6635,7 @@ void free_replace()
DBUG_ENTER("free_replace");
if (glob_replace)
{
my_free((char*) glob_replace,MYF(0));
my_free(glob_replace,MYF(0));
glob_replace=0;
}
DBUG_VOID_RETURN;
@ -6844,7 +6846,7 @@ struct st_replace_regex* init_replace_regex(char* expr)
reg.icase= 1;
/* done parsing the statement, now place it in regex_arr */
if (insert_dynamic(&res->regex_arr,(gptr) &reg))
if (insert_dynamic(&res->regex_arr,(uchar*) &reg))
die("Out of memory");
}
res->odd_buf_len= res->even_buf_len= 8192;
@ -6855,7 +6857,7 @@ struct st_replace_regex* init_replace_regex(char* expr)
return res;
err:
my_free((gptr)res,0);
my_free(res,0);
die("Error parsing replace_regex \"%s\"", expr);
return 0;
}
@ -6896,7 +6898,7 @@ int multi_reg_replace(struct st_replace_regex* r,char* val)
struct st_regex re;
char* save_out_buf= out_buf;
get_dynamic(&r->regex_arr,(gptr)&re,i);
get_dynamic(&r->regex_arr,(uchar*)&re,i);
if (!reg_replace(&out_buf, buf_len_p, re.pattern, re.replace,
in_buf, re.icase))
@ -6949,7 +6951,7 @@ void free_replace_regex()
delete_dynamic(&glob_replace_regex->regex_arr);
my_free(glob_replace_regex->even_buf,MYF(MY_ALLOW_ZERO_PTR));
my_free(glob_replace_regex->odd_buf,MYF(MY_ALLOW_ZERO_PTR));
my_free((char*) glob_replace_regex,MYF(0));
my_free(glob_replace_regex,MYF(0));
glob_replace_regex=0;
}
}
@ -7144,7 +7146,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
str_p= str_end;
}
}
my_free((gptr)subs, MYF(0));
my_free(subs, MYF(0));
my_regfree(&r);
*res_p= 0;
*buf_p= buf;
@ -7204,13 +7206,13 @@ int get_next_bit(REP_SET *set,uint lastpos);
int find_set(REP_SETS *sets,REP_SET *find);
int find_found(FOUND_SET *found_set,uint table_offset,
int found_offset);
uint start_at_word(my_string pos);
uint end_of_word(my_string pos);
uint start_at_word(char * pos);
uint end_of_word(char * pos);
static uint found_sets=0;
uint replace_len(my_string str)
uint replace_len(char * str)
{
uint len=0;
while (*str)
@ -7225,8 +7227,8 @@ uint replace_len(my_string str)
/* Init a replace structure for further calls */
REPLACE *init_replace(my_string *from, my_string *to,uint count,
my_string word_end_chars)
REPLACE *init_replace(char * *from, char * *to,uint count,
char * word_end_chars)
{
static const int SPACE_CHAR= 256;
static const int START_OF_LINE= 257;
@ -7235,7 +7237,7 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count,
uint i,j,states,set_nr,len,result_len,max_length,found_end,bits_set,bit_nr;
int used_sets,chr,default_state;
char used_chars[LAST_CHAR_CODE],is_word_end[256];
my_string pos,to_pos,*to_array;
char * pos, *to_pos, **to_array;
REP_SETS sets;
REP_SET *set,*start_states,*word_states,*new_set;
FOLLOWS *follow,*follow_ptr;
@ -7280,7 +7282,7 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count,
if (!(follow=(FOLLOWS*) my_malloc((states+2)*sizeof(FOLLOWS),MYF(MY_WME))))
{
free_sets(&sets);
my_free((gptr) found_set,MYF(0));
my_free(found_set,MYF(0));
DBUG_RETURN(0);
}
@ -7471,12 +7473,12 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count,
if ((replace=(REPLACE*) my_malloc(sizeof(REPLACE)*(sets.count)+
sizeof(REPLACE_STRING)*(found_sets+1)+
sizeof(my_string)*count+result_len,
sizeof(char *)*count+result_len,
MYF(MY_WME | MY_ZEROFILL))))
{
rep_str=(REPLACE_STRING*) (replace+sets.count);
to_array=(my_string*) (rep_str+found_sets+1);
to_pos=(my_string) (to_array+count);
to_array= (char **) (rep_str+found_sets+1);
to_pos=(char *) (to_array+count);
for (i=0 ; i < count ; i++)
{
to_array[i]=to_pos;
@ -7487,7 +7489,8 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count,
for (i=1 ; i <= found_sets ; i++)
{
pos=from[found_set[i-1].table_offset];
rep_str[i].found= !bcmp(pos,"\\^",3) ? 2 : 1;
rep_str[i].found= !bcmp((const uchar*) pos,
(const uchar*) "\\^", 3) ? 2 : 1;
rep_str[i].replace_string=to_array[found_set[i-1].table_offset];
rep_str[i].to_offset=found_set[i-1].found_offset-start_at_word(pos);
rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+
@ -7502,9 +7505,9 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count,
replace[i].next[j]=(REPLACE*) (rep_str+(-sets.set[i].next[j]-1));
}
}
my_free((gptr) follow,MYF(0));
my_free(follow,MYF(0));
free_sets(&sets);
my_free((gptr) found_set,MYF(0));
my_free(found_set,MYF(0));
DBUG_PRINT("exit",("Replace table has %d states",sets.count));
DBUG_RETURN(replace);
}
@ -7520,7 +7523,7 @@ int init_sets(REP_SETS *sets,uint states)
if (!(sets->bit_buffer=(uint*) my_malloc(sizeof(uint)*sets->size_of_bits*
SET_MALLOC_HUNC,MYF(MY_WME))))
{
my_free((gptr) sets->set,MYF(0));
my_free(sets->set,MYF(0));
return 1;
}
return 0;
@ -7552,13 +7555,13 @@ REP_SET *make_new_set(REP_SETS *sets)
return set;
}
count=sets->count+sets->invisible+SET_MALLOC_HUNC;
if (!(set=(REP_SET*) my_realloc((gptr) sets->set_buffer,
if (!(set=(REP_SET*) my_realloc((uchar*) sets->set_buffer,
sizeof(REP_SET)*count,
MYF(MY_WME))))
return 0;
sets->set_buffer=set;
sets->set=set+sets->invisible;
if (!(bit_buffer=(uint*) my_realloc((gptr) sets->bit_buffer,
if (!(bit_buffer=(uint*) my_realloc((uchar*) sets->bit_buffer,
(sizeof(uint)*sets->size_of_bits)*count,
MYF(MY_WME))))
return 0;
@ -7581,8 +7584,8 @@ void free_last_set(REP_SETS *sets)
void free_sets(REP_SETS *sets)
{
my_free((gptr)sets->set_buffer,MYF(0));
my_free((gptr)sets->bit_buffer,MYF(0));
my_free(sets->set_buffer,MYF(0));
my_free(sets->bit_buffer,MYF(0));
return;
}
@ -7609,13 +7612,13 @@ void or_bits(REP_SET *to,REP_SET *from)
void copy_bits(REP_SET *to,REP_SET *from)
{
memcpy((byte*) to->bits,(byte*) from->bits,
memcpy((uchar*) to->bits,(uchar*) from->bits,
(size_t) (sizeof(uint) * to->size_of_bits));
}
int cmp_bits(REP_SET *set1,REP_SET *set2)
{
return bcmp((byte*) set1->bits,(byte*) set2->bits,
return bcmp((uchar*) set1->bits,(uchar*) set2->bits,
sizeof(uint) * set1->size_of_bits);
}
@ -7683,17 +7686,19 @@ int find_found(FOUND_SET *found_set,uint table_offset, int found_offset)
/* Return 1 if regexp starts with \b or ends with \b*/
uint start_at_word(my_string pos)
uint start_at_word(char * pos)
{
return (((!bcmp(pos,"\\b",2) && pos[2]) || !bcmp(pos,"\\^",2)) ? 1 : 0);
return (((!bcmp((const uchar*) pos, (const uchar*) "\\b",2) && pos[2]) ||
!bcmp((const uchar*) pos, (const uchar*) "\\^", 2)) ? 1 : 0);
}
uint end_of_word(my_string pos)
uint end_of_word(char * pos)
{
my_string end=strend(pos);
return ((end > pos+2 && !bcmp(end-2,"\\b",2)) ||
(end >= pos+2 && !bcmp(end-2,"\\$",2))) ?
1 : 0;
char * end=strend(pos);
return ((end > pos+2 && !bcmp((const uchar*) end-2,
(const uchar*) "\\b", 2)) ||
(end >= pos+2 && !bcmp((const uchar*) end-2,
(const uchar*) "\\$",2))) ? 1 : 0;
}
/****************************************************************************
@ -7703,10 +7708,10 @@ uint end_of_word(my_string pos)
#define PC_MALLOC 256 /* Bytes for pointers */
#define PS_MALLOC 512 /* Bytes for data */
int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
{
uint i,length,old_count;
byte *new_pos;
uchar *new_pos;
const char **new_array;
DBUG_ENTER("insert_pointer_name");
@ -7714,16 +7719,16 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
{
if (!(pa->typelib.type_names=(const char **)
my_malloc(((PC_MALLOC-MALLOC_OVERHEAD)/
(sizeof(my_string)+sizeof(*pa->flag))*
(sizeof(my_string)+sizeof(*pa->flag))),MYF(MY_WME))))
(sizeof(char *)+sizeof(*pa->flag))*
(sizeof(char *)+sizeof(*pa->flag))),MYF(MY_WME))))
DBUG_RETURN(-1);
if (!(pa->str= (byte*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
MYF(MY_WME))))
{
my_free((gptr) pa->typelib.type_names,MYF(0));
my_free((char*) pa->typelib.type_names,MYF(0));
DBUG_RETURN (-1);
}
pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(byte*)+
pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+
sizeof(*pa->flag));
pa->flag= (int7*) (pa->typelib.type_names+pa->max_count);
pa->length=0;
@ -7733,7 +7738,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
length=(uint) strlen(name)+1;
if (pa->length+length >= pa->max_length)
{
if (!(new_pos= (byte*) my_realloc((gptr) pa->str,
if (!(new_pos= (uchar*) my_realloc((uchar*) pa->str,
(uint) (pa->max_length+PS_MALLOC),
MYF(MY_WME))))
DBUG_RETURN(1);
@ -7752,23 +7757,23 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
int len;
pa->array_allocs++;
len=(PC_MALLOC*pa->array_allocs - MALLOC_OVERHEAD);
if (!(new_array=(const char **) my_realloc((gptr) pa->typelib.type_names,
if (!(new_array=(const char **) my_realloc((uchar*) pa->typelib.type_names,
(uint) len/
(sizeof(byte*)+sizeof(*pa->flag))*
(sizeof(byte*)+sizeof(*pa->flag)),
(sizeof(uchar*)+sizeof(*pa->flag))*
(sizeof(uchar*)+sizeof(*pa->flag)),
MYF(MY_WME))))
DBUG_RETURN(1);
pa->typelib.type_names=new_array;
old_count=pa->max_count;
pa->max_count=len/(sizeof(byte*) + sizeof(*pa->flag));
pa->max_count=len/(sizeof(uchar*) + sizeof(*pa->flag));
pa->flag= (int7*) (pa->typelib.type_names+pa->max_count);
memcpy((byte*) pa->flag,(my_string) (pa->typelib.type_names+old_count),
memcpy((uchar*) pa->flag,(char *) (pa->typelib.type_names+old_count),
old_count*sizeof(*pa->flag));
}
pa->flag[pa->typelib.count]=0; /* Reset flag */
pa->typelib.type_names[pa->typelib.count++]= pa->str+pa->length;
pa->typelib.type_names[pa->typelib.count++]= (char*) pa->str+pa->length;
pa->typelib.type_names[pa->typelib.count]= NullS; /* Put end-mark */
VOID(strmov(pa->str+pa->length,name));
VOID(strmov((char*) pa->str+pa->length,name));
pa->length+=length;
DBUG_RETURN(0);
} /* insert_pointer_name */
@ -7781,9 +7786,9 @@ void free_pointer_array(POINTER_ARRAY *pa)
if (pa->typelib.count)
{
pa->typelib.count=0;
my_free((gptr) pa->typelib.type_names,MYF(0));
my_free((char*) pa->typelib.type_names,MYF(0));
pa->typelib.type_names=0;
my_free((gptr) pa->str,MYF(0));
my_free(pa->str,MYF(0));
}
} /* free_pointer_array */
@ -7880,7 +7885,7 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input)
*line_end= 0;
/* Insert pointer to the line in array */
if (insert_dynamic(&lines, (gptr) &start))
if (insert_dynamic(&lines, (uchar*) &start))
die("Out of memory inserting lines to sort");
start= line_end+1;

View file

@ -22,8 +22,8 @@
static bool init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,
ulong max_size);
static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str);
static uint fill_buffer(LINE_BUFFER *buffer);
static bool init_line_buffer_from_string(LINE_BUFFER *buffer,char * str);
static size_t fill_buffer(LINE_BUFFER *buffer);
static char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length);
@ -35,7 +35,7 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
return 0;
if (init_line_buffer(line_buff,fileno(file),IO_SIZE,max_size))
{
my_free((char*) line_buff,MYF(0));
my_free(line_buff,MYF(0));
return 0;
}
return line_buff;
@ -62,13 +62,13 @@ void batch_readline_end(LINE_BUFFER *line_buff)
{
if (line_buff)
{
my_free((gptr) line_buff->buffer,MYF(MY_ALLOW_ZERO_PTR));
my_free((char*) line_buff,MYF(0));
my_free(line_buff->buffer,MYF(MY_ALLOW_ZERO_PTR));
my_free(line_buff,MYF(0));
}
}
LINE_BUFFER *batch_readline_command(LINE_BUFFER *line_buff, my_string str)
LINE_BUFFER *batch_readline_command(LINE_BUFFER *line_buff, char * str)
{
if (!line_buff)
if (!(line_buff=(LINE_BUFFER*)
@ -76,7 +76,7 @@ LINE_BUFFER *batch_readline_command(LINE_BUFFER *line_buff, my_string str)
return 0;
if (init_line_buffer_from_string(line_buff,str))
{
my_free((char*) line_buff,MYF(0));
my_free(line_buff,MYF(0));
return 0;
}
return line_buff;
@ -106,13 +106,13 @@ init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,ulong max_buffer)
several times. the resulting buffer will contain a
concatenation of all strings separated by spaces
*/
static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str)
static bool init_line_buffer_from_string(LINE_BUFFER *buffer,char * str)
{
uint old_length=(uint)(buffer->end - buffer->buffer);
uint length= (uint) strlen(str);
if (!(buffer->buffer= buffer->start_of_line= buffer->end_of_line=
(char*)my_realloc(buffer->buffer, old_length+length+2,
MYF(MY_FAE|MY_ALLOW_ZERO_PTR))))
(char*) my_realloc((uchar*) buffer->buffer, old_length+length+2,
MYF(MY_FAE|MY_ALLOW_ZERO_PTR))))
return 1;
buffer->end= buffer->buffer + old_length;
if (old_length)
@ -133,9 +133,9 @@ static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str)
bytes read from disk.
*/
static uint fill_buffer(LINE_BUFFER *buffer)
static size_t fill_buffer(LINE_BUFFER *buffer)
{
uint read_count;
size_t read_count;
uint bufbytes= (uint) (buffer->end - buffer->start_of_line);
if (buffer->eof)
@ -166,11 +166,11 @@ static uint fill_buffer(LINE_BUFFER *buffer)
}
/* Read in new stuff. */
if ((read_count= my_read(buffer->file, (byte*) buffer->end, read_count,
if ((read_count= my_read(buffer->file, (uchar*) buffer->end, read_count,
MYF(MY_WME))) == MY_FILE_ERROR)
return read_count;
return (size_t) -1;
DBUG_PRINT("fill_buff", ("Got %d bytes", read_count));
DBUG_PRINT("fill_buff", ("Got %lu bytes", (ulong) read_count));
/* Kludge to pretend every nonempty file ends with a newline. */
if (!read_count && bufbytes && buffer->end[-1] != '\n')
@ -189,7 +189,7 @@ static uint fill_buffer(LINE_BUFFER *buffer)
char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length)
{
char *pos;
uint length;
size_t length;
DBUG_ENTER("intern_read_line");
buffer->start_of_line=buffer->end_of_line;
@ -202,7 +202,7 @@ char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length)
{
if ((uint) (pos - buffer->start_of_line) < buffer->max_size)
{
if (!(length=fill_buffer(buffer)) || length == (uint) -1)
if (!(length=fill_buffer(buffer)) || length == (size_t) -1)
DBUG_RETURN(0);
continue;
}

View file

@ -32,7 +32,7 @@
required by the string function
*/
extern gptr sql_alloc(unsigned size);
extern void sql_alloc(size_t size);
extern void sql_element_free(void *ptr);
#include "sql_string.h"
@ -506,7 +506,7 @@ bool String::append(FILE* file, uint32 arg_length, myf my_flags)
{
if (realloc(str_length+arg_length))
return TRUE;
if (my_fread(file, (byte*) Ptr + str_length, arg_length, my_flags))
if (my_fread(file, (uchar*) Ptr + str_length, arg_length, my_flags))
{
shrink(str_length);
return TRUE;
@ -520,7 +520,7 @@ bool String::append(IO_CACHE* file, uint32 arg_length)
{
if (realloc(str_length+arg_length))
return TRUE;
if (my_b_read(file, (byte*) Ptr + str_length, arg_length))
if (my_b_read(file, (uchar*) Ptr + str_length, arg_length))
{
shrink(str_length);
return TRUE;
@ -645,7 +645,7 @@ bool String::replace(uint32 offset,uint32 arg_length,
{
if (realloc(str_length+(uint32) diff))
return TRUE;
bmove_upp(Ptr+str_length+diff,Ptr+str_length,
bmove_upp((uchar*) Ptr+str_length+diff, (uchar*) Ptr+str_length,
str_length-offset-arg_length);
}
if (to_length)

View file

@ -7,7 +7,7 @@ AC_DEFUN([AC_SYS_COMPILER_FLAG],
AC_CACHE_VAL(mysql_cv_option_$2,
[
CFLAGS="[$]OLD_CFLAGS $1"
AC_TRY_RUN([int main(){exit(0);}],mysql_cv_option_$2=yes,mysql_cv_option_$2=no,mysql_cv_option_$2=no)
AC_TRY_LINK([int main(){exit(0);}],mysql_cv_option_$2=yes,mysql_cv_option_$2=no,mysql_cv_option_$2=no)
])
CFLAGS="[$]OLD_CFLAGS"

View file

@ -450,29 +450,6 @@ AC_DEFINE([HAVE_BOOL], [1], [bool is not defined by all C++ compilators])
fi
])dnl
AC_DEFUN([MYSQL_STACK_DIRECTION],
[AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
[AC_TRY_RUN([#include <stdlib.h>
int find_stack_direction ()
{
static char *addr = 0;
auto char dummy;
if (addr == 0)
{
addr = &dummy;
return find_stack_direction ();
}
else
return (&dummy > addr) ? 1 : -1;
}
int main ()
{
exit (find_stack_direction() < 0);
}], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
ac_cv_c_stack_direction=0)])
AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
])dnl
AC_DEFUN([MYSQL_CHECK_LONGLONG_TO_FLOAT],
[
AC_MSG_CHECKING(if conversion of longlong to float works)
@ -488,7 +465,9 @@ int main()
fprintf(file,"%g\n",f);
fclose(file);
return (0);
}], ac_cv_conv_longlong_to_float=`cat conftestval`, ac_cv_conv_longlong_to_float=0, ifelse([$2], , , ac_cv_conv_longlong_to_float=$2))])dnl
}], ac_cv_conv_longlong_to_float=`cat conftestval`,
ac_cv_conv_longlong_to_float=0,
ac_cv_conv_longlong_to_float="yes")])dnl # Cross compiling, assume can convert
if test "$ac_cv_conv_longlong_to_float" = "1" -o "$ac_cv_conv_longlong_to_float" = "yes"
then
ac_cv_conv_longlong_to_float=yes

View file

@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
#
# When changing major version number please also check switch statement
# in mysqlbinlog::check_master_version().
AM_INIT_AUTOMAKE(mysql, 5.1.19-beta)
AM_INIT_AUTOMAKE(mysql, 5.1.20-beta)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10
@ -230,14 +230,8 @@ AC_CHECK_PROGS(YACC, ['bison -y -p MYSQL'])
AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf)
AC_CHECK_PROG(DVIS, tex, manual.dvi)
AC_MSG_CHECKING("return type of sprintf")
#check the return type of sprintf
case $SYSTEM_TYPE in
*netware*)
AC_DEFINE(SPRINTF_RETURNS_INT, [1]) AC_MSG_RESULT("int")
;;
*)
AC_MSG_CHECKING("return type of sprintf")
AC_TRY_RUN([
int main()
{
@ -263,10 +257,12 @@ AC_TRY_RUN([
[AC_DEFINE(SPRINTF_RETURNS_PTR, [1], [Broken sprintf])
AC_MSG_RESULT("ptr")],
[AC_DEFINE(SPRINTF_RETURNS_GARBAGE, [1], [Broken sprintf])
AC_MSG_RESULT("garbage")])
])
;;
esac
AC_MSG_RESULT("garbage")]
)],
# Cross compile, assume POSIX
[AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf])
AC_MSG_RESULT("int (we assume)")]
)
AC_PATH_PROG(uname_prog, uname, no)
@ -1667,6 +1663,12 @@ AC_ARG_WITH(client-ldflags,
[CLIENT_EXTRA_LDFLAGS=])
AC_SUBST(CLIENT_EXTRA_LDFLAGS)
AC_ARG_WITH(mysqld-libs,
[ --with-mysqld-libs Extra libraries to link with for mysqld],
[MYSQLD_EXTRA_LIBS=$withval],
[MYSQLD_EXTRA_LIBS=])
AC_SUBST(MYSQLD_EXTRA_LIBS)
AC_ARG_WITH(lib-ccflags,
[ --with-lib-ccflags Extra CC options for libraries],
[LIB_EXTRA_CCFLAGS=$withval],
@ -1784,8 +1786,6 @@ MYSQL_TYPE_ACCEPT
#---END:
# Figure out what type of struct rlimit to use with setrlimit
MYSQL_TYPE_STRUCT_RLIMIT
# Find where the stack goes
MYSQL_STACK_DIRECTION
# We want to skip alloca on irix unconditionally. It may work on some version..
MYSQL_FUNC_ALLOCA
# Do struct timespec have members tv_sec or ts_sec

View file

@ -264,7 +264,7 @@ static BOOLEAN DoTrace(CODE_STATE *cs);
/* Test to see if file is writable */
#if !(!defined(HAVE_ACCESS) || defined(MSDOS))
static BOOLEAN Writable(char *pathname);
static BOOLEAN Writable(const char *pathname);
/* Change file owner and group */
static void ChangeOwner(CODE_STATE *cs, char *pathname);
/* Allocate memory for runtime support */
@ -343,12 +343,12 @@ static CODE_STATE *code_state(void)
if (!(cs=(CODE_STATE *) tmp->dbug))
{
cs=(CODE_STATE*) DbugMalloc(sizeof(*cs));
bzero((char*) cs,sizeof(*cs));
bzero((uchar*) cs,sizeof(*cs));
cs->process= db_process ? db_process : "dbug";
cs->func="?func";
cs->file="?file";
cs->stack=&init_settings;
tmp->dbug=(gptr) cs;
tmp->dbug= (void*) cs;
}
}
return cs;
@ -715,7 +715,7 @@ void _db_push_(const char *control)
void _db_set_init_(const char *control)
{
CODE_STATE tmp_cs;
bzero((char*) &tmp_cs, sizeof(tmp_cs));
bzero((uchar*) &tmp_cs, sizeof(tmp_cs));
tmp_cs.stack= &init_settings;
_db_set_(&tmp_cs, control);
}
@ -830,7 +830,7 @@ void _db_pop_()
} \
} while (0)
int _db_explain_ (CODE_STATE *cs, char *buf, int len)
int _db_explain_ (CODE_STATE *cs, char *buf, size_t len)
{
char *start=buf, *end=buf+len-4;
@ -887,10 +887,10 @@ overflow:
* see _db_explain_
*/
int _db_explain_init_(char *buf, int len)
int _db_explain_init_(char *buf, size_t len)
{
CODE_STATE cs;
bzero((char*) &cs,sizeof(cs));
bzero((uchar*) &cs,sizeof(cs));
cs.stack=&init_settings;
return _db_explain_(&cs, buf, len);
}
@ -1083,7 +1083,7 @@ void _db_pargs_(uint _line_, const char *keyword)
CODE_STATE *cs=0;
get_code_state_or_return;
cs->u_line= _line_;
cs->u_keyword= (char*) keyword;
cs->u_keyword= keyword;
}
@ -1160,7 +1160,8 @@ void _db_doprnt_(const char *format,...)
* Is used to examine corrputed memory or arrays.
*/
void _db_dump_(uint _line_, const char *keyword, const char *memory, uint length)
void _db_dump_(uint _line_, const char *keyword,
const unsigned char *memory, size_t length)
{
int pos;
char dbuff[90];
@ -1168,7 +1169,7 @@ void _db_dump_(uint _line_, const char *keyword, const char *memory, uint length
CODE_STATE *cs=0;
get_code_state_or_return;
if (_db_keyword_(cs, (char*) keyword))
if (_db_keyword_(cs, keyword))
{
if (!cs->locked)
pthread_mutex_lock(&THR_LOCK_dbug);
@ -1182,7 +1183,7 @@ void _db_dump_(uint _line_, const char *keyword, const char *memory, uint length
{
fprintf(cs->stack->out_file, "%s: ", cs->func);
}
sprintf(dbuff,"%s: Memory: 0x%lx Bytes: (%d)\n",
sprintf(dbuff,"%s: Memory: 0x%lx Bytes: (%ld)\n",
keyword,(ulong) memory, length);
(void) fputs(dbuff,cs->stack->out_file);
@ -1292,7 +1293,7 @@ static struct link *ListDel(struct link *head,
{
struct link *delme=*cur;
*cur=(*cur)->next_link;
free((char*)delme);
free((void*) delme);
}
} while (*cur && *(cur=&((*cur)->next_link)));
}
@ -1451,7 +1452,7 @@ static void FreeState(CODE_STATE *cs, struct settings *state, int free_state)
if (state->prof_file)
DBUGCloseFile(cs, state->prof_file);
if (free_state)
free((char *) state);
free((void*) state);
}
@ -1696,7 +1697,7 @@ static void FreeList(struct link *linkp)
{
old= linkp;
linkp= linkp->next_link;
free((char *) old);
free((void*) old);
}
}
@ -1815,7 +1816,7 @@ static void DBUGOpenFile(CODE_STATE *cs,
}
else
{
if (!Writable((char*)name))
if (!Writable(name))
{
(void) fprintf(stderr, ERR_OPEN, cs->process, name);
perror("");
@ -1988,7 +1989,7 @@ static char *DbugMalloc(size_t size)
{
register char *new_malloc;
if (!(new_malloc= (char*) malloc((size_t) size)))
if (!(new_malloc= (char*) malloc(size)))
DbugExit("out of memory");
return new_malloc;
}
@ -2062,7 +2063,7 @@ static const char *BaseName(const char *pathname)
#ifndef Writable
static BOOLEAN Writable(char *pathname)
static BOOLEAN Writable(const char *pathname)
{
REGISTER BOOLEAN granted;
REGISTER char *lastslash;

View file

@ -99,31 +99,31 @@ static struct my_option my_long_options[]=
{"debug", '#', "This is a non-debug version. Catch this and exit",
0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
{"debug", '#', "Output debug log", (gptr *) & default_dbug_option,
(gptr *) & default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log", (uchar**) & default_dbug_option,
(uchar**) & default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-info", 'T', "Print some debug info at exit.", (gptr *) & info_flag,
(gptr *) & info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", 'T', "Print some debug info at exit.", (uchar**) & info_flag,
(uchar**) & info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Prints version", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"charset", 'C', "Charset dir", (gptr *) & charsets_dir,
(gptr *) & charsets_dir,
{"charset", 'C', "Charset dir", (uchar**) & charsets_dir,
(uchar**) & charsets_dir,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"in_file", 'F', "Input file", (gptr *) & TXTFILE, (gptr *) & TXTFILE,
{"in_file", 'F', "Input file", (uchar**) & TXTFILE, (uchar**) & TXTFILE,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"out_dir", 'D', "Output base directory", (gptr *) & DATADIRECTORY,
(gptr *) & DATADIRECTORY,
{"out_dir", 'D', "Output base directory", (uchar**) & DATADIRECTORY,
(uchar**) & DATADIRECTORY,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"out_file", 'O', "Output filename (errmsg.sys)", (gptr *) & OUTFILE,
(gptr *) & OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"header_file", 'H', "mysqld_error.h file ", (gptr *) & HEADERFILE,
(gptr *) & HEADERFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"name_file", 'N', "mysqld_ername.h file ", (gptr *) & NAMEFILE,
(gptr *) & NAMEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"state_file", 'S', "sql_state.h file", (gptr *) & STATEFILE,
(gptr *) & STATEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"out_file", 'O', "Output filename (errmsg.sys)", (uchar**) & OUTFILE,
(uchar**) & OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"header_file", 'H', "mysqld_error.h file ", (uchar**) & HEADERFILE,
(uchar**) & HEADERFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"name_file", 'N', "mysqld_ername.h file ", (uchar**) & NAMEFILE,
(uchar**) & NAMEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"state_file", 'S', "sql_state.h file", (uchar**) & STATEFILE,
(uchar**) & STATEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@ -329,21 +329,21 @@ static int create_sys_files(struct languages *lang_head,
/* continue with header of the errmsg.sys file */
length= ftell(to) - HEADER_LENGTH - row_count * 2;
bzero((gptr) head, HEADER_LENGTH);
bmove((byte *) head, (byte *) file_head, 4);
bzero((uchar*) head, HEADER_LENGTH);
bmove((uchar *) head, (uchar *) file_head, 4);
head[4]= 1;
int2store(head + 6, length);
int2store(head + 8, row_count);
head[30]= csnum;
my_fseek(to, 0l, MY_SEEK_SET, MYF(0));
if (my_fwrite(to, (byte*) head, HEADER_LENGTH, MYF(MY_WME | MY_FNABP)))
if (my_fwrite(to, (uchar*) head, HEADER_LENGTH, MYF(MY_WME | MY_FNABP)))
goto err;
for (i= 0; i < row_count; i++)
{
int2store(head, file_pos[i]);
if (my_fwrite(to, (byte*) head, 2, MYF(MY_WME | MY_FNABP)))
if (my_fwrite(to, (uchar*) head, 2, MYF(MY_WME | MY_FNABP)))
goto err;
}
my_fclose(to, MYF(0));
@ -362,7 +362,7 @@ static void clean_up(struct languages *lang_head, struct errors *error_head)
struct errors *tmp_error, *next_error;
uint count, i;
my_free((gptr) default_language, MYF(0));
my_free((uchar*) default_language, MYF(0));
for (tmp_lang= lang_head; tmp_lang; tmp_lang= next_language)
{
@ -370,7 +370,7 @@ static void clean_up(struct languages *lang_head, struct errors *error_head)
my_free(tmp_lang->lang_short_name, MYF(0));
my_free(tmp_lang->lang_long_name, MYF(0));
my_free(tmp_lang->charset, MYF(0));
my_free((gptr) tmp_lang, MYF(0));
my_free((uchar*) tmp_lang, MYF(0));
}
for (tmp_error= error_head; tmp_error; tmp_error= next_error)
@ -381,17 +381,17 @@ static void clean_up(struct languages *lang_head, struct errors *error_head)
{
struct message *tmp;
tmp= dynamic_element(&tmp_error->msg, i, struct message*);
my_free((gptr) tmp->lang_short_name, MYF(0));
my_free((gptr) tmp->text, MYF(0));
my_free((uchar*) tmp->lang_short_name, MYF(0));
my_free((uchar*) tmp->text, MYF(0));
}
delete_dynamic(&tmp_error->msg);
if (tmp_error->sql_code1[0])
my_free((gptr) tmp_error->sql_code1, MYF(0));
my_free((uchar*) tmp_error->sql_code1, MYF(0));
if (tmp_error->sql_code2[0])
my_free((gptr) tmp_error->sql_code2, MYF(0));
my_free((gptr) tmp_error->er_name, MYF(0));
my_free((gptr) tmp_error, MYF(0));
my_free((uchar*) tmp_error->sql_code2, MYF(0));
my_free((uchar*) tmp_error->er_name, MYF(0));
my_free((uchar*) tmp_error, MYF(0));
}
}
@ -471,7 +471,7 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
current_error->er_name, current_message.lang_short_name);
DBUG_RETURN(0);
}
if (insert_dynamic(&current_error->msg, (byte *) & current_message))
if (insert_dynamic(&current_error->msg, (uchar *) & current_message))
DBUG_RETURN(0);
continue;
}
@ -534,7 +534,7 @@ static uint parse_error_offset(char *str)
end= 0;
ioffset= (uint) my_strtoll10(soffset, &end, &error);
my_free((gptr) soffset, MYF(0));
my_free((uchar*) soffset, MYF(0));
DBUG_RETURN(ioffset);
}

View file

@ -51,10 +51,10 @@
/* another argument to specify page ranges... seek to right spot and go from there */
typedef unsigned long int ulint;
typedef unsigned char byte;
typedef unsigned char uchar;
/* innodb function in name; modified slightly to not have the ASM version (lots of #ifs that didn't apply) */
ulint mach_read_from_4(byte *b)
ulint mach_read_from_4(uchar *b)
{
return( ((ulint)(b[0]) << 24)
+ ((ulint)(b[1]) << 16)
@ -78,7 +78,7 @@ ulint
ut_fold_binary(
/*===========*/
/* out: folded value */
byte* str, /* in: string of bytes */
uchar* str, /* in: string of bytes */
ulint len) /* in: length */
{
ulint i;
@ -98,7 +98,7 @@ ulint
buf_calc_page_new_checksum(
/*=======================*/
/* out: checksum */
byte* page) /* in: buffer page */
uchar* page) /* in: buffer page */
{
ulint checksum;
@ -123,7 +123,7 @@ ulint
buf_calc_page_old_checksum(
/*=======================*/
/* out: checksum */
byte* page) /* in: buffer page */
uchar* page) /* in: buffer page */
{
ulint checksum;
@ -138,7 +138,7 @@ buf_calc_page_old_checksum(
int main(int argc, char **argv)
{
FILE *f; /* our input file */
byte *p; /* storage of pages read */
uchar *p; /* storage of pages read */
int bytes; /* bytes read count */
ulint ct; /* current page number (0 based) */
int now; /* current time */
@ -256,7 +256,7 @@ int main(int argc, char **argv)
}
/* allocate buffer for reading (so we don't realloc every time) */
p= (byte *)malloc(UNIV_PAGE_SIZE);
p= (uchar *)malloc(UNIV_PAGE_SIZE);
/* main checksumming loop */
ct= start_page;

View file

@ -47,30 +47,30 @@ static struct my_option my_long_options[] =
added if the file has no extension)
*/
{"config-file", 'c', "Deprecated, please use --defaults-file instead. Name of config file to read; if no extension is given, default extension (e.g., .ini or .cnf) will be added",
(gptr*) &config_file, (gptr*) &config_file, 0, GET_STR, REQUIRED_ARG,
(uchar**) &config_file, (uchar**) &config_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
{"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
(uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"defaults-file", 'c', "Like --config-file, except: if first option, then read this file only, do not read global or per-user config files; should be the first option",
(gptr*) &config_file, (gptr*) &config_file, 0, GET_STR, REQUIRED_ARG,
(uchar**) &config_file, (uchar**) &config_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"defaults-extra-file", 'e',
"Read this file after the global config file and before the config file in the users home directory; should be the first option",
(gptr*) &my_defaults_extra_file, (gptr*) &my_defaults_extra_file, 0,
(uchar**) &my_defaults_extra_file, (uchar**) &my_defaults_extra_file, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"defaults-group-suffix", 'g',
"In addition to the given groups, read also groups with this suffix",
(gptr*) &my_defaults_group_suffix, (gptr*) &my_defaults_group_suffix,
(uchar**) &my_defaults_group_suffix, (uchar**) &my_defaults_group_suffix,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extra-file", 'e',
"Deprecated. Synonym for --defaults-extra-file.",
(gptr*) &my_defaults_extra_file,
(gptr*) &my_defaults_extra_file, 0, GET_STR,
(uchar**) &my_defaults_extra_file,
(uchar**) &my_defaults_extra_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"no-defaults", 'n', "Return an empty string (useful for scripts).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},

View file

@ -38,7 +38,7 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0},
{"verbose", 'v',
"Be more verbose. Give a warning, if kill can't handle signal 0.",
(gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
(uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Print version information and exit.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}

View file

@ -41,18 +41,18 @@ static struct my_option my_long_options[] =
{"info", 'I', "Synonym for --help.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
{"ndb", 257, "Ndbcluster storage engine specific error codes.", (gptr*) &ndb_code,
(gptr*) &ndb_code, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"ndb", 257, "Ndbcluster storage engine specific error codes.", (uchar**) &ndb_code,
(uchar**) &ndb_code, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
#ifdef HAVE_SYS_ERRLIST
{"all", 'a', "Print all the error messages and the number.",
(gptr*) &print_all_codes, (gptr*) &print_all_codes, 0, GET_BOOL, NO_ARG,
(uchar**) &print_all_codes, (uchar**) &print_all_codes, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Only print the error message.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Print error code and message (default).", (gptr*) &verbose,
(gptr*) &verbose, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"verbose", 'v', "Print error code and message (default).", (uchar**) &verbose,
(uchar**) &verbose, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"version", 'V', "Displays version information and exits.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}

View file

@ -51,7 +51,7 @@
typedef struct st_pointer_array { /* when using array-strings */
TYPELIB typelib; /* Pointer to strings */
byte *str; /* Strings is here */
uchar *str; /* Strings is here */
int7 *flag; /* Flag about each var. */
uint array_allocs,max_count,length,max_length;
} POINTER_ARRAY;
@ -83,14 +83,14 @@ static int static_get_options(int *argc,char * * *argv);
static int get_replace_strings(int *argc,char * * *argv,
POINTER_ARRAY *from_array,
POINTER_ARRAY *to_array);
static int insert_pointer_name(POINTER_ARRAY *pa, my_string name);
static int insert_pointer_name(POINTER_ARRAY *pa, char * name);
static void free_pointer_array(POINTER_ARRAY *pa);
static int convert_pipe(REPLACE *,FILE *,FILE *);
static int convert_file(REPLACE *, my_string);
static REPLACE *init_replace(my_string *from, my_string *to,uint count,
my_string word_end_chars);
static uint replace_strings(REPLACE *rep, my_string *start,uint *max_length,
my_string from);
static int convert_file(REPLACE *, char *);
static REPLACE *init_replace(char * *from, char * *to,uint count,
char * word_end_chars);
static uint replace_strings(REPLACE *rep, char * *start,uint *max_length,
char * from);
static int initialize_buffer(void);
static void reset_buffer(void);
static void free_buffer(void);
@ -245,10 +245,10 @@ POINTER_ARRAY *from_array,*to_array;
return 0;
}
static int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
{
uint i,length,old_count;
byte *new_pos;
uchar *new_pos;
const char **new_array;
DBUG_ENTER("insert_pointer_name");
@ -256,16 +256,16 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
{
if (!(pa->typelib.type_names=(const char **)
my_malloc(((PC_MALLOC-MALLOC_OVERHEAD)/
(sizeof(my_string)+sizeof(*pa->flag))*
(sizeof(my_string)+sizeof(*pa->flag))),MYF(MY_WME))))
(sizeof(char *)+sizeof(*pa->flag))*
(sizeof(char *)+sizeof(*pa->flag))),MYF(MY_WME))))
DBUG_RETURN(-1);
if (!(pa->str= (byte*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
MYF(MY_WME))))
{
my_free((gptr) pa->typelib.type_names,MYF(0));
my_free((uchar*) pa->typelib.type_names,MYF(0));
DBUG_RETURN (-1);
}
pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(byte*)+
pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+
sizeof(*pa->flag));
pa->flag= (int7*) (pa->typelib.type_names+pa->max_count);
pa->length=0;
@ -277,7 +277,7 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
{
pa->max_length=(pa->length+length+MALLOC_OVERHEAD+PS_MALLOC-1)/PS_MALLOC;
pa->max_length=pa->max_length*PS_MALLOC-MALLOC_OVERHEAD;
if (!(new_pos= (byte*) my_realloc((gptr) pa->str,
if (!(new_pos= (uchar*) my_realloc((uchar*) pa->str,
(uint) pa->max_length,
MYF(MY_WME))))
DBUG_RETURN(1);
@ -295,17 +295,17 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
int len;
pa->array_allocs++;
len=(PC_MALLOC*pa->array_allocs - MALLOC_OVERHEAD);
if (!(new_array=(const char **) my_realloc((gptr) pa->typelib.type_names,
if (!(new_array=(const char **) my_realloc((uchar*) pa->typelib.type_names,
(uint) len/
(sizeof(byte*)+sizeof(*pa->flag))*
(sizeof(byte*)+sizeof(*pa->flag)),
(sizeof(uchar*)+sizeof(*pa->flag))*
(sizeof(uchar*)+sizeof(*pa->flag)),
MYF(MY_WME))))
DBUG_RETURN(1);
pa->typelib.type_names=new_array;
old_count=pa->max_count;
pa->max_count=len/(sizeof(byte*) + sizeof(*pa->flag));
pa->max_count=len/(sizeof(uchar*) + sizeof(*pa->flag));
pa->flag= (int7*) (pa->typelib.type_names+pa->max_count);
memcpy((byte*) pa->flag,(my_string) (pa->typelib.type_names+old_count),
memcpy((uchar*) pa->flag,(char *) (pa->typelib.type_names+old_count),
old_count*sizeof(*pa->flag));
}
pa->flag[pa->typelib.count]=0; /* Reset flag */
@ -324,9 +324,9 @@ static void free_pointer_array(reg1 POINTER_ARRAY *pa)
if (pa->typelib.count)
{
pa->typelib.count=0;
my_free((gptr) pa->typelib.type_names,MYF(0));
my_free((uchar*) pa->typelib.type_names,MYF(0));
pa->typelib.type_names=0;
my_free((gptr) pa->str,MYF(0));
my_free((uchar*) pa->str,MYF(0));
}
return;
} /* free_pointer_array */
@ -380,23 +380,23 @@ static int get_next_bit(REP_SET *set,uint lastpos);
static short find_set(REP_SETS *sets,REP_SET *find);
static short find_found(FOUND_SET *found_set,uint table_offset,
int found_offset);
static uint start_at_word(my_string pos);
static uint end_of_word(my_string pos);
static uint replace_len(my_string pos);
static uint start_at_word(char * pos);
static uint end_of_word(char * pos);
static uint replace_len(char * pos);
static uint found_sets=0;
/* Init a replace structure for further calls */
static REPLACE *init_replace(my_string *from, my_string *to,uint count,
my_string word_end_chars)
static REPLACE *init_replace(char * *from, char * *to,uint count,
char * word_end_chars)
{
uint i,j,states,set_nr,len,result_len,max_length,found_end,bits_set,bit_nr;
int used_sets,chr;
short default_state;
char used_chars[LAST_CHAR_CODE],is_word_end[256];
my_string pos,to_pos,*to_array;
char * pos, *to_pos, **to_array;
REP_SETS sets;
REP_SET *set,*start_states,*word_states,*new_set;
FOLLOWS *follow,*follow_ptr;
@ -441,7 +441,7 @@ static REPLACE *init_replace(my_string *from, my_string *to,uint count,
if (!(follow=(FOLLOWS*) my_malloc((states+2)*sizeof(FOLLOWS),MYF(MY_WME))))
{
free_sets(&sets);
my_free((gptr) found_set,MYF(0));
my_free((uchar*) found_set,MYF(0));
DBUG_RETURN(0);
}
@ -632,12 +632,12 @@ static REPLACE *init_replace(my_string *from, my_string *to,uint count,
if ((replace=(REPLACE*) my_malloc(sizeof(REPLACE)*(sets.count)+
sizeof(REPLACE_STRING)*(found_sets+1)+
sizeof(my_string)*count+result_len,
sizeof(char *)*count+result_len,
MYF(MY_WME | MY_ZEROFILL))))
{
rep_str=(REPLACE_STRING*) (replace+sets.count);
to_array=(my_string*) (rep_str+found_sets+1);
to_pos=(my_string) (to_array+count);
to_array=(char **) (rep_str+found_sets+1);
to_pos=(char *) (to_array+count);
for (i=0 ; i < count ; i++)
{
to_array[i]=to_pos;
@ -663,9 +663,9 @@ static REPLACE *init_replace(my_string *from, my_string *to,uint count,
replace[i].next[j]=(REPLACE*) (rep_str+(-sets.set[i].next[j]-1));
}
}
my_free((gptr) follow,MYF(0));
my_free((uchar*) follow,MYF(0));
free_sets(&sets);
my_free((gptr) found_set,MYF(0));
my_free((uchar*) found_set,MYF(0));
DBUG_PRINT("exit",("Replace table has %d states",sets.count));
DBUG_RETURN(replace);
}
@ -681,7 +681,7 @@ static int init_sets(REP_SETS *sets,uint states)
if (!(sets->bit_buffer=(uint*) my_malloc(sizeof(uint)*sets->size_of_bits*
SET_MALLOC_HUNC,MYF(MY_WME))))
{
my_free((gptr) sets->set,MYF(0));
my_free((uchar*) sets->set,MYF(0));
return 1;
}
return 0;
@ -713,13 +713,13 @@ static REP_SET *make_new_set(REP_SETS *sets)
return set;
}
count=sets->count+sets->invisible+SET_MALLOC_HUNC;
if (!(set=(REP_SET*) my_realloc((gptr) sets->set_buffer,
if (!(set=(REP_SET*) my_realloc((uchar*) sets->set_buffer,
sizeof(REP_SET)*count,
MYF(MY_WME))))
return 0;
sets->set_buffer=set;
sets->set=set+sets->invisible;
if (!(bit_buffer=(uint*) my_realloc((gptr) sets->bit_buffer,
if (!(bit_buffer=(uint*) my_realloc((uchar*) sets->bit_buffer,
(sizeof(uint)*sets->size_of_bits)*count,
MYF(MY_WME))))
return 0;
@ -742,8 +742,8 @@ static void free_last_set(REP_SETS *sets)
static void free_sets(REP_SETS *sets)
{
my_free((gptr)sets->set_buffer,MYF(0));
my_free((gptr)sets->bit_buffer,MYF(0));
my_free((uchar*)sets->set_buffer,MYF(0));
my_free((uchar*)sets->bit_buffer,MYF(0));
return;
}
@ -770,13 +770,13 @@ static void or_bits(REP_SET *to,REP_SET *from)
static void copy_bits(REP_SET *to,REP_SET *from)
{
memcpy((byte*) to->bits,(byte*) from->bits,
memcpy((uchar*) to->bits,(uchar*) from->bits,
(size_t) (sizeof(uint) * to->size_of_bits));
}
static int cmp_bits(REP_SET *set1,REP_SET *set2)
{
return bcmp((byte*) set1->bits,(byte*) set2->bits,
return bcmp((uchar*) set1->bits,(uchar*) set2->bits,
sizeof(uint) * set1->size_of_bits);
}
@ -847,21 +847,21 @@ static short find_found(FOUND_SET *found_set,uint table_offset,
/* Return 1 if regexp starts with \b or ends with \b*/
static uint start_at_word(my_string pos)
static uint start_at_word(char * pos)
{
return (((!bcmp(pos,"\\b",2) && pos[2]) || !bcmp(pos,"\\^",2)) ? 1 : 0);
}
static uint end_of_word(my_string pos)
static uint end_of_word(char * pos)
{
my_string end=strend(pos);
char * end=strend(pos);
return ((end > pos+2 && !bcmp(end-2,"\\b",2)) ||
(end >= pos+2 && !bcmp(end-2,"\\$",2))) ?
1 : 0;
}
static uint replace_len(my_string str)
static uint replace_len(char * str)
{
uint len=0;
while (*str)
@ -877,12 +877,12 @@ static uint replace_len(my_string str)
/* The actual loop */
static uint replace_strings(REPLACE *rep, my_string *start,uint *max_length,
my_string from)
static uint replace_strings(REPLACE *rep, char **start, uint *max_length,
char *from)
{
reg1 REPLACE *rep_pos;
reg2 REPLACE_STRING *rep_str;
my_string to,end,pos,new;
char *to, *end, *pos, *new;
end=(to= *start) + *max_length-1;
rep_pos=rep+1;
@ -903,7 +903,7 @@ static uint replace_strings(REPLACE *rep, my_string *start,uint *max_length,
}
if (!(rep_str = ((REPLACE_STRING*) rep_pos))->replace_string)
return (uint) (to - *start)-1;
updated=1; /* Some my_string is replaced */
updated=1; /* Some char * is replaced */
to-=rep_str->to_offset;
for (pos=rep_str->replace_string; *pos ; pos++)
{
@ -1047,7 +1047,7 @@ FILE *in,*out;
}
static int convert_file(REPLACE *rep, my_string name)
static int convert_file(REPLACE *rep, char * name)
{
int error;
FILE *in,*out;
@ -1056,6 +1056,7 @@ static int convert_file(REPLACE *rep, my_string name)
char link_name[FN_REFLEN];
#endif
File temp_file;
size_t dir_buff_length;
DBUG_ENTER("convert_file");
/* check if name is a symlink */
@ -1065,7 +1066,7 @@ static int convert_file(REPLACE *rep, my_string name)
#endif
if (!(in= my_fopen(org_name,O_RDONLY,MYF(MY_WME))))
DBUG_RETURN(1);
dirname_part(dir_buff,org_name);
dirname_part(dir_buff, org_name, &dir_buff_length);
if ((temp_file= create_temp_file(tempname, dir_buff, "PR", O_WRONLY,
MYF(MY_WME))) < 0)
{

View file

@ -53,10 +53,10 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"symbols-file", 's', "Use specified symbols file.", (gptr*) &sym_fname,
(gptr*) &sym_fname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"symbols-file", 's', "Use specified symbols file.", (uchar**) &sym_fname,
(uchar**) &sym_fname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"numeric-dump-file", 'n', "Read the dump from specified file.",
(gptr*) &dump_fname, (gptr*) &dump_fname, 0, GET_STR, REQUIRED_ARG,
(uchar**) &dump_fname, (uchar**) &dump_fname, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@ -235,7 +235,7 @@ static void init_sym_table()
SYM_ENTRY se;
if (init_sym_entry(&se, buf))
continue;
if (insert_dynamic(&sym_table, (gptr)&se))
if (insert_dynamic(&sym_table, (uchar*)&se))
die("insert_dynamic() failed - looks like we are out of memory");
}
@ -255,7 +255,7 @@ static void verify_sort()
for (i = 0; i < sym_table.elements; i++)
{
SYM_ENTRY se;
get_dynamic(&sym_table, (gptr)&se, i);
get_dynamic(&sym_table, (uchar*)&se, i);
if (se.addr < last)
die("sym table does not appear to be sorted, did you forget \
--numeric-sort arg to nm? trouble addr = %p, last = %p", se.addr, last);
@ -267,16 +267,16 @@ static void verify_sort()
static SYM_ENTRY* resolve_addr(uchar* addr, SYM_ENTRY* se)
{
uint i;
get_dynamic(&sym_table, (gptr)se, 0);
get_dynamic(&sym_table, (uchar*)se, 0);
if (addr < se->addr)
return 0;
for (i = 1; i < sym_table.elements; i++)
{
get_dynamic(&sym_table, (gptr)se, i);
get_dynamic(&sym_table, (uchar*)se, i);
if (addr < se->addr)
{
get_dynamic(&sym_table, (gptr)se, i - 1);
get_dynamic(&sym_table, (uchar*)se, i - 1);
return se;
}
}

View file

@ -43,7 +43,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"info", 'I', "Synonym for --help.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Be more silent.", (gptr*) &silent, (gptr*) &silent,
{"silent", 's', "Be more silent.", (uchar**) &silent, (uchar**) &silent,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Displays version information and exits.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -83,7 +83,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
return 0;
}
/*static my_string load_default_groups[]= { "resolveip","client",0 }; */
/*static char * load_default_groups[]= { "resolveip","client",0 }; */
static int get_options(int *argc,char ***argv)
{

View file

@ -112,9 +112,6 @@ extern "C" {
/* signal by closing the sockets */
#define SIGNAL_WITH_VIO_CLOSE 1
/* On NetWare, stack grows towards lower address*/
#define STACK_DIRECTION -1
/* On NetWare, we need to set stack size for threads, otherwise default 16K is used */
#define NW_THD_STACKSIZE 65536

View file

@ -250,8 +250,6 @@ inline double ulonglong2double(ulonglong value)
#endif
#define STACK_DIRECTION -1
/* Optimized store functions for Intel x86 */
#ifndef _WIN64
@ -310,10 +308,10 @@ inline double ulonglong2double(ulonglong value)
#define doublestore(T,V) do { *((long *) T) = *((long*) &V); \
*(((long *) T)+1) = *(((long*) &V)+1); } while(0)
#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); }
#define floatstore(T,V) memcpy((byte*)(T), (byte*)(&V), sizeof(float))
#define floatget(V,M) memcpy((byte*)(&V), (byte*)(M), sizeof(float))
#define floatstore(T,V) memcpy((uchar*)(T), (uchar*)(&V), sizeof(float))
#define floatget(V,M) memcpy((uchar*)(&V), (uchar*)(M), sizeof(float))
#define float8get(V,M) doubleget((V),(M))
#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
#define float4store(V,M) memcpy((uchar*) V,(uchar*) (&M),sizeof(float))
#define float8store(V,M) doublestore((V),(M))
#endif /* _WIN64 */

View file

@ -39,8 +39,8 @@ int longlong2decimal(longlong from, decimal_t *to);
int decimal2double(decimal_t *from, double *to);
int double2decimal(double from, decimal_t *to);
int decimal_actual_fraction(decimal_t *from);
int decimal2bin(decimal_t *from, char *to, int precision, int scale);
int bin2decimal(char *from, decimal_t *to, int precision, int scale);
int decimal2bin(decimal_t *from, uchar *to, int precision, int scale);
int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale);
int decimal_size(int precision, int scale);
int decimal_bin_size(int precision, int scale);

View file

@ -32,7 +32,7 @@ typedef struct st_ft_info FT_INFO;
struct _ft_vft
{
int (*read_next)(FT_INFO *, char *);
float (*find_relevance)(FT_INFO *, byte *, uint);
float (*find_relevance)(FT_INFO *, uchar *, uint);
void (*close_search)(FT_INFO *);
float (*get_relevance)(FT_INFO *);
void (*reinit_search)(FT_INFO *);
@ -62,8 +62,8 @@ void ft_free_stopwords(void);
#define FT_SORTED 2
#define FT_EXPAND 4 /* query expansion */
FT_INFO *ft_init_search(uint,void *, uint, byte *, uint,CHARSET_INFO *, byte *);
my_bool ft_boolean_check_syntax_string(const byte *);
FT_INFO *ft_init_search(uint,void *, uint, uchar *, uint,CHARSET_INFO *, uchar *);
my_bool ft_boolean_check_syntax_string(const uchar *);
#ifdef __cplusplus
}

View file

@ -30,12 +30,13 @@ extern "C" {
/* flags for hash_init */
#define HASH_UNIQUE 1 /* hash_insert fails on duplicate key */
typedef byte *(*hash_get_key)(const byte *,uint*,my_bool);
typedef uchar *(*hash_get_key)(const uchar *,size_t*,my_bool);
typedef void (*hash_free_key)(void *);
typedef struct st_hash {
uint key_offset,key_length; /* Length of key if const length */
uint records, blength;
size_t key_offset,key_length; /* Length of key if const length */
size_t blength;
ulong records;
uint flags;
DYNAMIC_ARRAY array; /* Place for hash_keys */
hash_get_key get_key;
@ -48,21 +49,21 @@ typedef uint HASH_SEARCH_STATE;
#define hash_init(A,B,C,D,E,F,G,H) _hash_init(A,B,C,D,E,F,G, H CALLER_INFO)
my_bool _hash_init(HASH *hash, CHARSET_INFO *charset,
uint default_array_elements, uint key_offset,
uint key_length, hash_get_key get_key,
ulong default_array_elements, size_t key_offset,
size_t key_length, hash_get_key get_key,
void (*free_element)(void*), uint flags CALLER_INFO_PROTO);
void hash_free(HASH *tree);
void my_hash_reset(HASH *hash);
byte *hash_element(HASH *hash,uint idx);
gptr hash_search(const HASH *info, const byte *key, uint length);
gptr hash_first(const HASH *info, const byte *key, uint length,
uchar *hash_element(HASH *hash,ulong idx);
uchar *hash_search(const HASH *info, const uchar *key, size_t length);
uchar *hash_first(const HASH *info, const uchar *key, size_t length,
HASH_SEARCH_STATE *state);
gptr hash_next(const HASH *info, const byte *key, uint length,
HASH_SEARCH_STATE *state);
my_bool my_hash_insert(HASH *info,const byte *data);
my_bool hash_delete(HASH *hash,byte *record);
my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length);
void hash_replace(HASH *hash, HASH_SEARCH_STATE *state, byte *new_row);
uchar *hash_next(const HASH *info, const uchar *key, size_t length,
HASH_SEARCH_STATE *state);
my_bool my_hash_insert(HASH *info,const uchar *data);
my_bool hash_delete(HASH *hash,uchar *record);
my_bool hash_update(HASH *hash,uchar *record,uchar *old_key,size_t old_key_length);
void hash_replace(HASH *hash, HASH_SEARCH_STATE *state, uchar *new_row);
my_bool hash_check(HASH *hash); /* Only in debug library */
#define hash_clear(H) bzero((char*) (H),sizeof(*(H)))

View file

@ -57,7 +57,7 @@ typedef struct st_heapinfo /* Struct from heap_info */
typedef struct st_heap_ptrs
{
byte *blocks[HP_PTRS_IN_NOD]; /* pointers to HP_PTRS or records */
uchar *blocks[HP_PTRS_IN_NOD]; /* pointers to HP_PTRS or records */
} HP_PTRS;
struct st_level_info
@ -70,7 +70,7 @@ struct st_level_info
of last_blocks array. For level 0 - 1, for level 1 - HP_PTRS_IN_NOD, for
level 2 - HP_PTRS_IN_NOD^2 and so forth.
*/
uint records_under_level;
ulong records_under_level;
/*
Ptr to last allocated HP_PTRS (or records buffer for level 0) on this
@ -123,10 +123,10 @@ typedef struct st_hp_keydef /* Key definition with open */
ha_rows hash_buckets;
TREE rb_tree;
int (*write_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo,
const byte *record, byte *recpos);
const uchar *record, uchar *recpos);
int (*delete_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo,
const byte *record, byte *recpos, int flag);
uint (*get_key_length)(struct st_hp_keydef *keydef, const byte *key);
const uchar *record, uchar *recpos, int flag);
uint (*get_key_length)(struct st_hp_keydef *keydef, const uchar *key);
} HP_KEYDEF;
typedef struct st_heap_share
@ -144,8 +144,8 @@ typedef struct st_heap_share
uint keys,max_key_length;
uint currently_disabled_keys; /* saved value from "keys" when disabled */
uint open_count;
byte *del_link; /* Link to next block with del. rec */
my_string name; /* Name of "memory-file" */
uchar *del_link; /* Link to next block with del. rec */
char * name; /* Name of "memory-file" */
#ifdef THREAD
THR_LOCK lock;
pthread_mutex_t intern_lock; /* Locking for use with _locking */
@ -162,14 +162,14 @@ struct st_hp_hash_info;
typedef struct st_heap_info
{
HP_SHARE *s;
byte *current_ptr;
uchar *current_ptr;
struct st_hp_hash_info *current_hash_ptr;
ulong current_record,next_block;
int lastinx,errkey;
int mode; /* Mode of file (READONLY..) */
uint opt_flag,update;
byte *lastkey; /* Last used key with rkey */
byte *recbuf; /* Record buffer for rb-tree keys */
uchar *lastkey; /* Last used key with rkey */
uchar *recbuf; /* Record buffer for rb-tree keys */
enum ha_rkey_function last_find_flag;
TREE_ELEMENT *parents[MAX_TREE_HEIGHT+1];
TREE_ELEMENT **last_pos;
@ -195,12 +195,12 @@ typedef struct st_heap_create_info
extern HP_INFO *heap_open(const char *name, int mode);
extern int heap_close(HP_INFO *info);
extern int heap_write(HP_INFO *info,const byte *buff);
extern int heap_update(HP_INFO *info,const byte *old,const byte *newdata);
extern int heap_rrnd(HP_INFO *info,byte *buf,byte *pos);
extern int heap_write(HP_INFO *info,const uchar *buff);
extern int heap_update(HP_INFO *info,const uchar *old,const uchar *newdata);
extern int heap_rrnd(HP_INFO *info,uchar *buf,uchar *pos);
extern int heap_scan_init(HP_INFO *info);
extern int heap_scan(register HP_INFO *info, byte *record);
extern int heap_delete(HP_INFO *info,const byte *buff);
extern int heap_scan(register HP_INFO *info, uchar *record);
extern int heap_delete(HP_INFO *info,const uchar *buff);
extern int heap_info(HP_INFO *info,HEAPINFO *x,int flag);
extern int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
uint reclength, ulong max_records, ulong min_records,
@ -211,32 +211,32 @@ extern int heap_extra(HP_INFO *info,enum ha_extra_function function);
extern int heap_reset(HP_INFO *info);
extern int heap_rename(const char *old_name,const char *new_name);
extern int heap_panic(enum ha_panic_function flag);
extern int heap_rsame(HP_INFO *info,byte *record,int inx);
extern int heap_rnext(HP_INFO *info,byte *record);
extern int heap_rprev(HP_INFO *info,byte *record);
extern int heap_rfirst(HP_INFO *info,byte *record,int inx);
extern int heap_rlast(HP_INFO *info,byte *record,int inx);
extern int heap_rsame(HP_INFO *info,uchar *record,int inx);
extern int heap_rnext(HP_INFO *info,uchar *record);
extern int heap_rprev(HP_INFO *info,uchar *record);
extern int heap_rfirst(HP_INFO *info,uchar *record,int inx);
extern int heap_rlast(HP_INFO *info,uchar *record,int inx);
extern void heap_clear(HP_INFO *info);
extern void heap_clear_keys(HP_INFO *info);
extern int heap_disable_indexes(HP_INFO *info);
extern int heap_enable_indexes(HP_INFO *info);
extern int heap_indexes_are_disabled(HP_INFO *info);
extern void heap_update_auto_increment(HP_INFO *info, const byte *record);
extern void heap_update_auto_increment(HP_INFO *info, const uchar *record);
ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, key_range *min_key,
key_range *max_key);
int hp_panic(enum ha_panic_function flag);
int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function find_flag);
extern gptr heap_find(HP_INFO *info,int inx,const byte *key);
extern uchar * heap_find(HP_INFO *info,int inx,const uchar *key);
extern int heap_check_heap(HP_INFO *info, my_bool print_status);
extern byte *heap_position(HP_INFO *info);
extern uchar *heap_position(HP_INFO *info);
/* The following is for programs that uses the old HEAP interface where
pointer to rows where a long instead of a (byte*).
pointer to rows where a long instead of a (uchar*).
*/
#if defined(WANT_OLD_HEAP_VERSION) || defined(OLD_HEAP_VERSION)
extern int heap_rrnd_old(HP_INFO *info,byte *buf,ulong pos);
extern int heap_rrnd_old(HP_INFO *info,uchar *buf,ulong pos);
extern ulong heap_position_old(HP_INFO *info);
#endif
#ifdef OLD_HEAP_VERSION
@ -244,7 +244,7 @@ typedef ulong HEAP_PTR;
#define heap_position(A) heap_position_old(A)
#define heap_rrnd(A,B,C) heap_rrnd_old(A,B,C)
#else
typedef byte *HEAP_PTR;
typedef uchar *HEAP_PTR;
#endif
#ifdef __cplusplus

View file

@ -66,9 +66,9 @@ typedef struct st_key_cache
HASH_LINK **hash_root; /* arr. of entries into hash table buckets */
HASH_LINK *hash_link_root; /* memory for hash table links */
HASH_LINK *free_hash_list; /* list of free hash links */
BLOCK_LINK *free_block_list; /* list of free blocks */
BLOCK_LINK *free_block_list; /* list of free blocks */
BLOCK_LINK *block_root; /* memory for block links */
byte HUGE_PTR *block_mem; /* memory for block buffers */
uchar HUGE_PTR *block_mem; /* memory for block buffers */
BLOCK_LINK *used_last; /* ptr to the last block of the LRU chain */
BLOCK_LINK *used_ins; /* ptr to the insertion block in LRU chain */
pthread_mutex_t cache_lock; /* to lock access to the cache structure */
@ -115,16 +115,16 @@ extern int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
uint age_threshold);
extern void change_key_cache_param(KEY_CACHE *keycache, uint division_limit,
uint age_threshold);
extern byte *key_cache_read(KEY_CACHE *keycache,
extern uchar *key_cache_read(KEY_CACHE *keycache,
File file, my_off_t filepos, int level,
byte *buff, uint length,
uchar *buff, uint length,
uint block_length,int return_buffer);
extern int key_cache_insert(KEY_CACHE *keycache,
File file, my_off_t filepos, int level,
byte *buff, uint length);
uchar *buff, uint length);
extern int key_cache_write(KEY_CACHE *keycache,
File file, my_off_t filepos, int level,
byte *buff, uint length,
uchar *buff, uint length,
uint block_length,int force_write);
extern int flush_key_blocks(KEY_CACHE *keycache,
int file, enum flush_type type);
@ -133,8 +133,8 @@ extern void end_key_cache(KEY_CACHE *keycache, my_bool cleanup);
/* Functions to handle multiple key caches */
extern my_bool multi_keycache_init(void);
extern void multi_keycache_free(void);
extern KEY_CACHE *multi_key_cache_search(byte *key, uint length);
extern my_bool multi_key_cache_set(const byte *key, uint length,
extern KEY_CACHE *multi_key_cache_search(uchar *key, uint length);
extern my_bool multi_key_cache_set(const uchar *key, uint length,
KEY_CACHE *key_cache);
extern void multi_key_cache_change(KEY_CACHE *old_data,
KEY_CACHE *new_data);

View file

@ -51,8 +51,8 @@ extern MY_UNICASE_INFO *my_unicase_turkish[256];
typedef struct uni_ctype_st
{
unsigned char pctype;
unsigned char *ctype;
uchar pctype;
uchar *ctype;
} MY_UNI_CTYPE;
extern MY_UNI_CTYPE my_uni_ctype[256];
@ -125,22 +125,22 @@ struct charset_info_st;
/* See strings/CHARSET_INFO.txt for information about this structure */
typedef struct my_collation_handler_st
{
my_bool (*init)(struct charset_info_st *, void *(*alloc)(uint));
my_bool (*init)(struct charset_info_st *, void *(*alloc)(size_t));
/* Collation routines */
int (*strnncoll)(struct charset_info_st *,
const uchar *, uint, const uchar *, uint, my_bool);
const uchar *, size_t, const uchar *, size_t, my_bool);
int (*strnncollsp)(struct charset_info_st *,
const uchar *, uint, const uchar *, uint,
const uchar *, size_t, const uchar *, size_t,
my_bool diff_if_only_endspace_difference);
int (*strnxfrm)(struct charset_info_st *,
uchar *, uint, const uchar *, uint);
uint (*strnxfrmlen)(struct charset_info_st *, uint);
size_t (*strnxfrm)(struct charset_info_st *,
uchar *, size_t, const uchar *, size_t);
size_t (*strnxfrmlen)(struct charset_info_st *, size_t);
my_bool (*like_range)(struct charset_info_st *,
const char *s, uint s_length,
const char *s, size_t s_length,
pchar w_prefix, pchar w_one, pchar w_many,
uint res_length,
size_t res_length,
char *min_str, char *max_str,
uint *min_len, uint *max_len);
size_t *min_len, size_t *max_len);
int (*wildcmp)(struct charset_info_st *,
const char *str,const char *str_end,
const char *wildstr,const char *wildend,
@ -149,14 +149,14 @@ typedef struct my_collation_handler_st
int (*strcasecmp)(struct charset_info_st *, const char *, const char *);
uint (*instr)(struct charset_info_st *,
const char *b, uint b_length,
const char *s, uint s_length,
const char *b, size_t b_length,
const char *s, size_t s_length,
my_match_t *match, uint nmatch);
/* Hash calculation */
void (*hash_sort)(struct charset_info_st *cs, const uchar *key, uint len,
void (*hash_sort)(struct charset_info_st *cs, const uchar *key, size_t len,
ulong *nr1, ulong *nr2);
my_bool (*propagate)(struct charset_info_st *cs, const uchar *str, uint len);
my_bool (*propagate)(struct charset_info_st *cs, const uchar *str, size_t len);
} MY_COLLATION_HANDLER;
extern MY_COLLATION_HANDLER my_collation_mb_bin_handler;
@ -168,64 +168,67 @@ extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler;
/* See strings/CHARSET_INFO.txt about information on this structure */
typedef struct my_charset_handler_st
{
my_bool (*init)(struct charset_info_st *, void *(*alloc)(uint));
my_bool (*init)(struct charset_info_st *, void *(*alloc)(size_t));
/* Multibyte routines */
int (*ismbchar)(struct charset_info_st *, const char *, const char *);
int (*mbcharlen)(struct charset_info_st *, uint);
uint (*numchars)(struct charset_info_st *, const char *b, const char *e);
uint (*charpos)(struct charset_info_st *, const char *b, const char *e, uint pos);
uint (*well_formed_len)(struct charset_info_st *,
uint (*ismbchar)(struct charset_info_st *, const char *, const char *);
uint (*mbcharlen)(struct charset_info_st *, uint c);
size_t (*numchars)(struct charset_info_st *, const char *b, const char *e);
size_t (*charpos)(struct charset_info_st *, const char *b, const char *e,
size_t pos);
size_t (*well_formed_len)(struct charset_info_st *,
const char *b,const char *e,
uint nchars, int *error);
uint (*lengthsp)(struct charset_info_st *, const char *ptr, uint length);
uint (*numcells)(struct charset_info_st *, const char *b, const char *e);
size_t nchars, int *error);
size_t (*lengthsp)(struct charset_info_st *, const char *ptr, size_t length);
size_t (*numcells)(struct charset_info_st *, const char *b, const char *e);
/* Unicode conversion */
int (*mb_wc)(struct charset_info_st *cs,my_wc_t *wc,
const unsigned char *s,const unsigned char *e);
const uchar *s,const uchar *e);
int (*wc_mb)(struct charset_info_st *cs,my_wc_t wc,
unsigned char *s,unsigned char *e);
uchar *s,uchar *e);
/* CTYPE scanner */
int (*ctype)(struct charset_info_st *cs, int *ctype,
const unsigned char *s, const unsigned char *e);
const uchar *s, const uchar *e);
/* Functions for case and sort conversion */
uint (*caseup_str)(struct charset_info_st *, char *);
uint (*casedn_str)(struct charset_info_st *, char *);
uint (*caseup)(struct charset_info_st *, char *src, uint srclen,
char *dst, uint dstlen);
uint (*casedn)(struct charset_info_st *, char *src, uint srclen,
char *dst, uint dstlen);
size_t (*caseup_str)(struct charset_info_st *, char *);
size_t (*casedn_str)(struct charset_info_st *, char *);
size_t (*caseup)(struct charset_info_st *, char *src, size_t srclen,
char *dst, size_t dstlen);
size_t (*casedn)(struct charset_info_st *, char *src, size_t srclen,
char *dst, size_t dstlen);
/* Charset dependant snprintf() */
int (*snprintf)(struct charset_info_st *, char *to, uint n, const char *fmt,
...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5);
int (*long10_to_str)(struct charset_info_st *, char *to, uint n, int radix,
long int val);
int (*longlong10_to_str)(struct charset_info_st *, char *to, uint n,
int radix, longlong val);
size_t (*snprintf)(struct charset_info_st *, char *to, size_t n,
const char *fmt,
...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5);
size_t (*long10_to_str)(struct charset_info_st *, char *to, size_t n,
int radix, long int val);
size_t (*longlong10_to_str)(struct charset_info_st *, char *to, size_t n,
int radix, longlong val);
void (*fill)(struct charset_info_st *, char *to, uint len, int fill);
void (*fill)(struct charset_info_st *, char *to, size_t len, int fill);
/* String-to-number conversion routines */
long (*strntol)(struct charset_info_st *, const char *s, uint l,
long (*strntol)(struct charset_info_st *, const char *s, size_t l,
int base, char **e, int *err);
ulong (*strntoul)(struct charset_info_st *, const char *s, uint l,
ulong (*strntoul)(struct charset_info_st *, const char *s, size_t l,
int base, char **e, int *err);
longlong (*strntoll)(struct charset_info_st *, const char *s, uint l,
longlong (*strntoll)(struct charset_info_st *, const char *s, size_t l,
int base, char **e, int *err);
ulonglong (*strntoull)(struct charset_info_st *, const char *s, uint l,
ulonglong (*strntoull)(struct charset_info_st *, const char *s, size_t l,
int base, char **e, int *err);
double (*strntod)(struct charset_info_st *, char *s, uint l, char **e,
double (*strntod)(struct charset_info_st *, char *s, size_t l, char **e,
int *err);
longlong (*strtoll10)(struct charset_info_st *cs,
const char *nptr, char **endptr, int *error);
ulonglong (*strntoull10rnd)(struct charset_info_st *cs,
const char *str, uint length, int unsigned_fl,
const char *str, size_t length,
int unsigned_fl,
char **endptr, int *error);
ulong (*scan)(struct charset_info_st *, const char *b, const char *e,
int sq);
size_t (*scan)(struct charset_info_st *, const char *b, const char *e,
int sq);
} MY_CHARSET_HANDLER;
extern MY_CHARSET_HANDLER my_charset_8bit_handler;
@ -302,35 +305,35 @@ extern CHARSET_INFO my_charset_cp1250_czech_ci;
extern CHARSET_INFO my_charset_filename;
/* declarations for simple charsets */
extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *,
uint);
uint my_strnxfrmlen_simple(CHARSET_INFO *, uint);
extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint,
const uchar *, uint, my_bool);
extern size_t my_strnxfrm_simple(CHARSET_INFO *, uchar *, size_t,
const uchar *, size_t);
size_t my_strnxfrmlen_simple(CHARSET_INFO *, size_t);
extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, size_t,
const uchar *, size_t, my_bool);
extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, uint,
const uchar *, uint,
extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t,
const uchar *, size_t,
my_bool diff_if_only_endspace_difference);
extern void my_hash_sort_simple(CHARSET_INFO *cs,
const uchar *key, uint len,
const uchar *key, size_t len,
ulong *nr1, ulong *nr2);
extern uint my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, uint length);
extern size_t my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, size_t length);
extern uint my_instr_simple(struct charset_info_st *,
const char *b, uint b_length,
const char *s, uint s_length,
const char *b, size_t b_length,
const char *s, size_t s_length,
my_match_t *match, uint nmatch);
/* Functions for 8bit */
extern uint my_caseup_str_8bit(CHARSET_INFO *, char *);
extern uint my_casedn_str_8bit(CHARSET_INFO *, char *);
extern uint my_caseup_8bit(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern uint my_casedn_8bit(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern size_t my_caseup_str_8bit(CHARSET_INFO *, char *);
extern size_t my_casedn_str_8bit(CHARSET_INFO *, char *);
extern size_t my_caseup_8bit(CHARSET_INFO *, char *src, size_t srclen,
char *dst, size_t dstlen);
extern size_t my_casedn_8bit(CHARSET_INFO *, char *src, size_t srclen,
char *dst, size_t dstlen);
extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *);
@ -340,26 +343,26 @@ int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
int my_mb_ctype_8bit(CHARSET_INFO *,int *, const uchar *,const uchar *);
int my_mb_ctype_mb(CHARSET_INFO *,int *, const uchar *,const uchar *);
ulong my_scan_8bit(CHARSET_INFO *cs, const char *b, const char *e, int sq);
size_t my_scan_8bit(CHARSET_INFO *cs, const char *b, const char *e, int sq);
int my_snprintf_8bit(struct charset_info_st *, char *to, uint n,
const char *fmt, ...)
size_t my_snprintf_8bit(struct charset_info_st *, char *to, size_t n,
const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 4, 5);
long my_strntol_8bit(CHARSET_INFO *, const char *s, uint l, int base,
long my_strntol_8bit(CHARSET_INFO *, const char *s, size_t l, int base,
char **e, int *err);
ulong my_strntoul_8bit(CHARSET_INFO *, const char *s, size_t l, int base,
char **e, int *err);
ulong my_strntoul_8bit(CHARSET_INFO *, const char *s, uint l, int base,
longlong my_strntoll_8bit(CHARSET_INFO *, const char *s, size_t l, int base,
char **e, int *err);
longlong my_strntoll_8bit(CHARSET_INFO *, const char *s, uint l, int base,
ulonglong my_strntoull_8bit(CHARSET_INFO *, const char *s, size_t l, int base,
char **e, int *err);
ulonglong my_strntoull_8bit(CHARSET_INFO *, const char *s, uint l, int base,
char **e, int *err);
double my_strntod_8bit(CHARSET_INFO *, char *s, uint l,char **e,
double my_strntod_8bit(CHARSET_INFO *, char *s, size_t l,char **e,
int *err);
int my_long10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix,
long int val);
int my_longlong10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix,
longlong val);
size_t my_long10_to_str_8bit(CHARSET_INFO *, char *to, size_t l, int radix,
long int val);
size_t my_longlong10_to_str_8bit(CHARSET_INFO *, char *to, size_t l, int radix,
longlong val);
longlong my_strtoll10_8bit(CHARSET_INFO *cs,
const char *nptr, char **endptr, int *error);
@ -367,34 +370,34 @@ longlong my_strtoll10_ucs2(CHARSET_INFO *cs,
const char *nptr, char **endptr, int *error);
ulonglong my_strntoull10rnd_8bit(CHARSET_INFO *cs,
const char *str, uint length, int unsigned_fl,
char **endptr, int *error);
const char *str, size_t length, int
unsigned_fl, char **endptr, int *error);
ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs,
const char *str, uint length, int unsigned_fl,
char **endptr, int *error);
const char *str, size_t length,
int unsigned_fl, char **endptr, int *error);
void my_fill_8bit(CHARSET_INFO *cs, char* to, uint l, int fill);
void my_fill_8bit(CHARSET_INFO *cs, char* to, size_t l, int fill);
my_bool my_like_range_simple(CHARSET_INFO *cs,
const char *ptr, uint ptr_length,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
uint res_length,
size_t res_length,
char *min_str, char *max_str,
uint *min_length, uint *max_length);
size_t *min_length, size_t *max_length);
my_bool my_like_range_mb(CHARSET_INFO *cs,
const char *ptr, uint ptr_length,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
uint res_length,
size_t res_length,
char *min_str, char *max_str,
uint *min_length, uint *max_length);
size_t *min_length, size_t *max_length);
my_bool my_like_range_ucs2(CHARSET_INFO *cs,
const char *ptr, uint ptr_length,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
uint res_length,
size_t res_length,
char *min_str, char *max_str,
uint *min_length, uint *max_length);
size_t *min_length, size_t *max_length);
int my_wildcmp_8bit(CHARSET_INFO *,
@ -407,35 +410,35 @@ int my_wildcmp_bin(CHARSET_INFO *,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many);
uint my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e);
uint my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e,
uint pos, int *error);
int my_mbcharlen_8bit(CHARSET_INFO *, uint c);
size_t my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e);
size_t my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e);
size_t my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, size_t pos);
size_t my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e,
size_t pos, int *error);
uint my_mbcharlen_8bit(CHARSET_INFO *, uint c);
/* Functions for multibyte charsets */
extern uint my_caseup_str_mb(CHARSET_INFO *, char *);
extern uint my_casedn_str_mb(CHARSET_INFO *, char *);
extern uint my_caseup_mb(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern uint my_casedn_mb(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern size_t my_caseup_str_mb(CHARSET_INFO *, char *);
extern size_t my_casedn_str_mb(CHARSET_INFO *, char *);
extern size_t my_caseup_mb(CHARSET_INFO *, char *src, size_t srclen,
char *dst, size_t dstlen);
extern size_t my_casedn_mb(CHARSET_INFO *, char *src, size_t srclen,
char *dst, size_t dstlen);
extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *);
int my_wildcmp_mb(CHARSET_INFO *,
const char *str,const char *str_end,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many);
uint my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
uint my_numcells_mb(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e,
uint pos, int *error);
size_t my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
size_t my_numcells_mb(CHARSET_INFO *, const char *b, const char *e);
size_t my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, size_t pos);
size_t my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e,
size_t pos, int *error);
uint my_instr_mb(struct charset_info_st *,
const char *b, uint b_length,
const char *s, uint s_length,
const char *b, size_t b_length,
const char *s, size_t s_length,
my_match_t *match, uint nmatch);
int my_wildcmp_unicode(CHARSET_INFO *cs,
@ -444,13 +447,13 @@ int my_wildcmp_unicode(CHARSET_INFO *cs,
int escape, int w_one, int w_many,
MY_UNICASE_INFO **weights);
extern my_bool my_parse_charset_xml(const char *bug, uint len,
extern my_bool my_parse_charset_xml(const char *bug, size_t len,
int (*add)(CHARSET_INFO *cs));
extern char *my_strchr(CHARSET_INFO *cs, const char *str, const char *end,
pchar c);
my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, uint len);
my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len);
my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, size_t len);
my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, size_t len);
#define _MY_U 01 /* Upper case */

View file

@ -112,59 +112,59 @@ extern char NEAR _dig_vec_lower[];
/* Prototypes for string functions */
#if !defined(bfill) && !defined(HAVE_BFILL)
extern void bfill(gptr dst,uint len,pchar fill);
extern void bfill(uchar *dst,size_t len,pchar fill);
#endif
#if !defined(bzero) && !defined(HAVE_BZERO)
extern void bzero(gptr dst,uint len);
extern void bzero(uchar * dst,size_t len);
#endif
#if !defined(bcmp) && !defined(HAVE_BCMP)
extern int bcmp(const char *s1,const char *s2,uint len);
extern size_t bcmp(const uchar *s1,const uchar *s2,size_t len);
#endif
#ifdef HAVE_purify
extern int my_bcmp(const char *s1,const char *s2,uint len);
extern size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len);
#undef bcmp
#define bcmp(A,B,C) my_bcmp((A),(B),(C))
#endif
#ifndef bmove512
extern void bmove512(gptr dst,const gptr src,uint len);
extern void bmove512(uchar *dst,const uchar *src,size_t len);
#endif
#if !defined(HAVE_BMOVE) && !defined(bmove)
extern void bmove(char *dst, const char *src,uint len);
extern void bmove(uuchar *dst, const uchar *src,size_t len);
#endif
extern void bmove_upp(char *dst,const char *src,uint len);
extern void bchange(char *dst,uint old_len,const char *src,
uint new_len,uint tot_len);
extern void strappend(char *s,uint len,pchar fill);
extern void bmove_upp(uchar *dst,const uchar *src,size_t len);
extern void bchange(uchar *dst,size_t old_len,const uchar *src,
size_t new_len,size_t tot_len);
extern void strappend(char *s,size_t len,pchar fill);
extern char *strend(const char *s);
extern char *strcend(const char *, pchar);
extern char *strfield(char *src,int fields,int chars,int blanks,
int tabch);
extern char *strfill(my_string s,uint len,pchar fill);
extern uint strinstr(const char *str,const char *search);
extern uint r_strinstr(reg1 my_string str,int from, reg4 my_string search);
extern char *strfill(char * s,size_t len,pchar fill);
extern size_t strinstr(const char *str,const char *search);
extern size_t r_strinstr(const char *str, size_t from, const char *search);
extern char *strkey(char *dst,char *head,char *tail,char *flags);
extern char *strmake(char *dst,const char *src,uint length);
extern char *strmake(char *dst,const char *src,size_t length);
#ifndef strmake_overlapp
extern char *strmake_overlapp(char *dst,const char *src, uint length);
extern char *strmake_overlapp(char *dst,const char *src, size_t length);
#endif
#ifndef strmov
extern char *strmov(char *dst,const char *src);
#endif
extern char *strnmov(char *dst,const char *src,uint n);
extern char *strnmov(char *dst,const char *src,size_t n);
extern char *strsuff(const char *src,const char *suffix);
extern char *strcont(const char *src,const char *set);
extern char *strxcat _VARARGS((char *dst,const char *src, ...));
extern char *strxmov _VARARGS((char *dst,const char *src, ...));
extern char *strxcpy _VARARGS((char *dst,const char *src, ...));
extern char *strxncat _VARARGS((char *dst,uint len, const char *src, ...));
extern char *strxnmov _VARARGS((char *dst,uint len, const char *src, ...));
extern char *strxncpy _VARARGS((char *dst,uint len, const char *src, ...));
extern char *strxncat _VARARGS((char *dst,size_t len, const char *src, ...));
extern char *strxnmov _VARARGS((char *dst,size_t len, const char *src, ...));
extern char *strxncpy _VARARGS((char *dst,size_t len, const char *src, ...));
/* Prototypes of normal stringfunctions (with may ours) */
@ -179,7 +179,7 @@ extern size_t strlen(const char *);
#endif
#endif
#ifndef HAVE_STRNLEN
extern uint strnlen(const char *s, uint n);
extern size_t strnlen(const char *s, size_t n);
#endif
#if !defined(__cplusplus)
@ -232,9 +232,9 @@ extern ulonglong strtoull(const char *str, char **ptr, int base);
/* my_vsnprintf.c */
extern int my_vsnprintf( char *str, size_t n,
const char *format, va_list ap );
extern int my_snprintf(char *to, size_t n, const char *fmt, ...)
extern size_t my_vsnprintf(char *str, size_t n,
const char *format, va_list ap);
extern size_t my_snprintf(char *to, size_t n, const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 3, 4);
#if defined(__cplusplus)
@ -245,17 +245,18 @@ extern int my_snprintf(char *to, size_t n, const char *fmt, ...)
LEX_STRING -- a pair of a C-string and its length.
NOTE: this exactly form of declaration is required for some C-compilers
(for one, Sun C 5.7 2005/01/07). Unfortunatelt with such declaration
(for one, Sun C 5.7 2005/01/07). Unfortunately with such declaration
LEX_STRING can not be forward declared.
*/
typedef struct
{
char *str;
uint length;
size_t length;
} LEX_STRING;
#define STRING_WITH_LEN(X) (X), ((uint) (sizeof(X) - 1))
#define C_STRING_WITH_LEN(X) ((char *) (X)), ((uint) (sizeof(X) - 1))
#define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1))
#define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1))
#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1))
#endif

View file

@ -37,8 +37,8 @@ typedef struct st_mem_root
USED_MEM *used; /* blocks almost without free memory */
USED_MEM *pre_alloc; /* preallocated block */
/* if block have less memory it will be put in 'used' list */
unsigned int min_malloc;
unsigned int block_size; /* initial block size */
size_t min_malloc;
size_t block_size; /* initial block size */
unsigned int block_num; /* allocated blocks counter */
/*
first free block in queue test counter (if it exceed

View file

@ -478,7 +478,7 @@ enum data_file_type {
typedef struct st_key_range
{
const byte *key;
const uchar *key;
uint length;
key_part_map keypart_map;
enum ha_rkey_function flag;

View file

@ -23,8 +23,8 @@ extern "C" {
struct _db_code_state_;
extern int _db_keyword_(struct _db_code_state_ *cs, const char *keyword);
extern int _db_strict_keyword_(const char *keyword);
extern int _db_explain_(struct _db_code_state_ *cs, char *buf, int len);
extern int _db_explain_init_(char *buf, int len);
extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len);
extern int _db_explain_init_(char *buf, size_t len);
extern void _db_setjmp_(void);
extern void _db_longjmp_(void);
extern void _db_process_(const char *name);
@ -40,8 +40,8 @@ extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_,
extern void _db_pargs_(uint _line_,const char *keyword);
extern void _db_doprnt_ _VARARGS((const char *format,...))
ATTRIBUTE_FORMAT(printf, 1, 2);
extern void _db_dump_(uint _line_,const char *keyword,const char *memory,
uint length);
extern void _db_dump_(uint _line_,const char *keyword,
const unsigned char *memory, size_t length);
extern void _db_end_(void);
extern void _db_lock_file_(void);
extern void _db_unlock_file_(void);

View file

@ -44,8 +44,8 @@ struct my_option
const char *name; /* Name of the option */
int id; /* unique id or short option */
const char *comment; /* option comment, for autom. --help */
gptr *value; /* The variable value */
gptr *u_max_value; /* The user def. max variable value */
uchar **value; /* The variable value */
uchar **u_max_value; /* The user def. max variable value */
struct st_typelib *typelib; /* Pointer to possible values */
ulong var_type;
enum get_opt_arg_type arg_type;
@ -69,7 +69,7 @@ extern int handle_options (int *argc, char ***argv,
const struct my_option *longopts, my_get_one_option);
extern void my_print_help(const struct my_option *options);
extern void my_print_variables(const struct my_option *options);
extern void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
extern void my_getopt_register_get_addr(uchar ** (*func_addr)(const char *, uint,
const struct my_option *));
ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp);

View file

@ -895,21 +895,14 @@ typedef long my_ptrdiff_t;
typedef long long my_ptrdiff_t;
#endif
/* We can't set my_size_t to size_t as we want my_size_t to be unsigned */
#if SIZEOF_CHARP <= SIZEOF_LONG
typedef unsigned long my_size_t;
#else
typedef unsigned long long my_size_t;
#endif
#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1))
#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double))
/* Size to make adressable obj. */
#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t)))
/* Offset of field f in structure t */
#define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f)
#define ADD_TO_PTR(ptr,size,type) (type) ((byte*) (ptr)+size)
#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((byte*) (A) - (byte*) (B))
#define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size)
#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B))
/*
Custom version of standard offsetof() macro which can be used to get
@ -944,11 +937,6 @@ typedef unsigned long long my_size_t;
/* Typdefs for easyier portability */
#if defined(VOIDTYPE)
typedef void *gptr; /* Generic pointer */
#else
typedef char *gptr; /* Generic pointer */
#endif
#ifndef HAVE_UCHAR
typedef unsigned char uchar; /* Short for unsigned char */
#endif
@ -1069,12 +1057,7 @@ typedef off_t os_off_t;
typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */
typedef short int15; /* Most effective integer 0 <= x <= 32767 */
typedef char *my_string; /* String of characters */
typedef unsigned long size_s; /* Size of strings (In string-funcs) */
typedef int myf; /* Type of MyFlags in my_funcs */
#ifndef byte_defined
typedef char byte; /* Smallest addressable unit */
#endif
typedef char my_bool; /* Small bool */
#if !defined(bool) && !defined(bool_defined) && (!defined(HAVE_BOOL) || !defined(__cplusplus))
typedef char bool; /* Ordinary boolean values 0 1 */
@ -1220,9 +1203,9 @@ do { doubleget_union _tmp; \
} while (0)
#define float4get(V,M) do { *((float *) &(V)) = *((float*) (M)); } while(0)
#define float8get(V,M) doubleget((V),(M))
#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
#define floatstore(T,V) memcpy((byte*)(T), (byte*)(&V),sizeof(float))
#define floatget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(float))
#define float4store(V,M) memcpy((uchar*) V,(uchar*) (&M),sizeof(float))
#define floatstore(T,V) memcpy((uchar*)(T), (uchar*)(&V),sizeof(float))
#define floatget(V,M) memcpy((uchar*) &V,(uchar*) (M),sizeof(float))
#define float8store(V,M) doublestore((V),(M))
#endif /* __i386__ */
@ -1305,59 +1288,59 @@ do { doubleget_union _tmp; \
int4store((T),def_temp); \
int4store((T+4),def_temp2); } while(0)
#ifdef WORDS_BIGENDIAN
#define float4store(T,A) do { *(T)= ((byte *) &A)[3];\
*((T)+1)=(char) ((byte *) &A)[2];\
*((T)+2)=(char) ((byte *) &A)[1];\
*((T)+3)=(char) ((byte *) &A)[0]; } while(0)
#define float4store(T,A) do { *(T)= ((uchar *) &A)[3];\
*((T)+1)=(char) ((uchar *) &A)[2];\
*((T)+2)=(char) ((uchar *) &A)[1];\
*((T)+3)=(char) ((uchar *) &A)[0]; } while(0)
#define float4get(V,M) do { float def_temp;\
((byte*) &def_temp)[0]=(M)[3];\
((byte*) &def_temp)[1]=(M)[2];\
((byte*) &def_temp)[2]=(M)[1];\
((byte*) &def_temp)[3]=(M)[0];\
((uchar*) &def_temp)[0]=(M)[3];\
((uchar*) &def_temp)[1]=(M)[2];\
((uchar*) &def_temp)[2]=(M)[1];\
((uchar*) &def_temp)[3]=(M)[0];\
(V)=def_temp; } while(0)
#define float8store(T,V) do { *(T)= ((byte *) &V)[7];\
*((T)+1)=(char) ((byte *) &V)[6];\
*((T)+2)=(char) ((byte *) &V)[5];\
*((T)+3)=(char) ((byte *) &V)[4];\
*((T)+4)=(char) ((byte *) &V)[3];\
*((T)+5)=(char) ((byte *) &V)[2];\
*((T)+6)=(char) ((byte *) &V)[1];\
*((T)+7)=(char) ((byte *) &V)[0]; } while(0)
#define float8store(T,V) do { *(T)= ((uchar *) &V)[7];\
*((T)+1)=(char) ((uchar *) &V)[6];\
*((T)+2)=(char) ((uchar *) &V)[5];\
*((T)+3)=(char) ((uchar *) &V)[4];\
*((T)+4)=(char) ((uchar *) &V)[3];\
*((T)+5)=(char) ((uchar *) &V)[2];\
*((T)+6)=(char) ((uchar *) &V)[1];\
*((T)+7)=(char) ((uchar *) &V)[0]; } while(0)
#define float8get(V,M) do { double def_temp;\
((byte*) &def_temp)[0]=(M)[7];\
((byte*) &def_temp)[1]=(M)[6];\
((byte*) &def_temp)[2]=(M)[5];\
((byte*) &def_temp)[3]=(M)[4];\
((byte*) &def_temp)[4]=(M)[3];\
((byte*) &def_temp)[5]=(M)[2];\
((byte*) &def_temp)[6]=(M)[1];\
((byte*) &def_temp)[7]=(M)[0];\
((uchar*) &def_temp)[0]=(M)[7];\
((uchar*) &def_temp)[1]=(M)[6];\
((uchar*) &def_temp)[2]=(M)[5];\
((uchar*) &def_temp)[3]=(M)[4];\
((uchar*) &def_temp)[4]=(M)[3];\
((uchar*) &def_temp)[5]=(M)[2];\
((uchar*) &def_temp)[6]=(M)[1];\
((uchar*) &def_temp)[7]=(M)[0];\
(V) = def_temp; } while(0)
#else
#define float4get(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float))
#define float4store(V,M) memcpy_fixed((byte*) V,(byte*) (&M),sizeof(float))
#define float4get(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(float))
#define float4store(V,M) memcpy_fixed((uchar*) V,(uchar*) (&M),sizeof(float))
#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
#define doublestore(T,V) do { *(((char*)T)+0)=(char) ((byte *) &V)[4];\
*(((char*)T)+1)=(char) ((byte *) &V)[5];\
*(((char*)T)+2)=(char) ((byte *) &V)[6];\
*(((char*)T)+3)=(char) ((byte *) &V)[7];\
*(((char*)T)+4)=(char) ((byte *) &V)[0];\
*(((char*)T)+5)=(char) ((byte *) &V)[1];\
*(((char*)T)+6)=(char) ((byte *) &V)[2];\
*(((char*)T)+7)=(char) ((byte *) &V)[3]; }\
#define doublestore(T,V) do { *(((char*)T)+0)=(char) ((uchar *) &V)[4];\
*(((char*)T)+1)=(char) ((uchar *) &V)[5];\
*(((char*)T)+2)=(char) ((uchar *) &V)[6];\
*(((char*)T)+3)=(char) ((uchar *) &V)[7];\
*(((char*)T)+4)=(char) ((uchar *) &V)[0];\
*(((char*)T)+5)=(char) ((uchar *) &V)[1];\
*(((char*)T)+6)=(char) ((uchar *) &V)[2];\
*(((char*)T)+7)=(char) ((uchar *) &V)[3]; }\
while(0)
#define doubleget(V,M) do { double def_temp;\
((byte*) &def_temp)[0]=(M)[4];\
((byte*) &def_temp)[1]=(M)[5];\
((byte*) &def_temp)[2]=(M)[6];\
((byte*) &def_temp)[3]=(M)[7];\
((byte*) &def_temp)[4]=(M)[0];\
((byte*) &def_temp)[5]=(M)[1];\
((byte*) &def_temp)[6]=(M)[2];\
((byte*) &def_temp)[7]=(M)[3];\
((uchar*) &def_temp)[0]=(M)[4];\
((uchar*) &def_temp)[1]=(M)[5];\
((uchar*) &def_temp)[2]=(M)[6];\
((uchar*) &def_temp)[3]=(M)[7];\
((uchar*) &def_temp)[4]=(M)[0];\
((uchar*) &def_temp)[5]=(M)[1];\
((uchar*) &def_temp)[6]=(M)[2];\
((uchar*) &def_temp)[7]=(M)[3];\
(V) = def_temp; } while(0)
#endif /* __FLOAT_WORD_ORDER */
@ -1388,16 +1371,16 @@ do { doubleget_union _tmp; \
#define shortget(V,M) do { V = (short) (((short) ((uchar) (M)[1]))+\
((short) ((short) (M)[0]) << 8)); } while(0)
#define longget(V,M) do { int32 def_temp;\
((byte*) &def_temp)[0]=(M)[0];\
((byte*) &def_temp)[1]=(M)[1];\
((byte*) &def_temp)[2]=(M)[2];\
((byte*) &def_temp)[3]=(M)[3];\
((uchar*) &def_temp)[0]=(M)[0];\
((uchar*) &def_temp)[1]=(M)[1];\
((uchar*) &def_temp)[2]=(M)[2];\
((uchar*) &def_temp)[3]=(M)[3];\
(V)=def_temp; } while(0)
#define ulongget(V,M) do { uint32 def_temp;\
((byte*) &def_temp)[0]=(M)[0];\
((byte*) &def_temp)[1]=(M)[1];\
((byte*) &def_temp)[2]=(M)[2];\
((byte*) &def_temp)[3]=(M)[3];\
((uchar*) &def_temp)[0]=(M)[0];\
((uchar*) &def_temp)[1]=(M)[1];\
((uchar*) &def_temp)[2]=(M)[2];\
((uchar*) &def_temp)[3]=(M)[3];\
(V)=def_temp; } while(0)
#define shortstore(T,A) do { uint def_temp=(uint) (A) ;\
*(((char*)T)+1)=(char)(def_temp); \
@ -1407,12 +1390,12 @@ do { doubleget_union _tmp; \
*(((char*)T)+1)=(((A) >> 16));\
*(((char*)T)+0)=(((A) >> 24)); } while(0)
#define floatget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float))
#define floatstore(T,V) memcpy_fixed((byte*) (T),(byte*)(&V),sizeof(float))
#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double))
#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong))
#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong))
#define floatget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(float))
#define floatstore(T,V) memcpy_fixed((uchar*) (T),(uchar*)(&V),sizeof(float))
#define doubleget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(double))
#define doublestore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(double))
#define longlongget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(ulonglong))
#define longlongstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(ulonglong))
#else
@ -1423,15 +1406,15 @@ do { doubleget_union _tmp; \
#define shortstore(T,V) int2store(T,V)
#define longstore(T,V) int4store(T,V)
#ifndef floatstore
#define floatstore(T,V) memcpy_fixed((byte*) (T),(byte*) (&V),sizeof(float))
#define floatget(V,M) memcpy_fixed((byte*) &V, (byte*) (M), sizeof(float))
#define floatstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) (&V),sizeof(float))
#define floatget(V,M) memcpy_fixed((uchar*) &V, (uchar*) (M), sizeof(float))
#endif
#ifndef doubleget
#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double))
#define doubleget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(double))
#define doublestore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(double))
#endif /* doubleget */
#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong))
#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong))
#define longlongget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(ulonglong))
#define longlongstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(ulonglong))
#endif /* WORDS_BIGENDIAN */

View file

@ -33,11 +33,11 @@ extern LIST *list_cons(void *data,LIST *root);
extern LIST *list_reverse(LIST *root);
extern void list_free(LIST *root,unsigned int free_data);
extern unsigned int list_length(LIST *);
extern int list_walk(LIST *,list_walk_action action,gptr argument);
extern int list_walk(LIST *,list_walk_action action,unsigned char * argument);
#define list_rest(a) ((a)->next)
#define list_push(a,b) (a)=list_cons((b),(a))
#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((gptr) old,MYF(MY_FAE)); }
#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((unsigned char *) old,MYF(MY_FAE)); }
#ifdef __cplusplus
}

View file

@ -35,8 +35,9 @@ extern "C" {
#undef my_seek
#define my_read(a,b,c,d) my_quick_read(a,b,c,d)
#define my_write(a,b,c,d) my_quick_write(a,b,c)
extern uint my_quick_read(File Filedes,byte *Buffer,uint Count,myf myFlags);
extern uint my_quick_write(File Filedes,const byte *Buffer,uint Count);
extern size_t my_quick_read(File Filedes,uchar *Buffer,size_t Count,
myf myFlags);
extern size_t my_quick_write(File Filedes,const uchar *Buffer,size_t Count);
#if !defined(SAFEMALLOC) && defined(USE_HALLOC)
#define my_malloc(a,b) halloc(a,1)

View file

@ -688,7 +688,7 @@ struct st_my_thread_var
struct st_my_thread_var *next,**prev;
void *opt_info;
#ifndef DBUG_OFF
gptr dbug;
void *dbug;
char name[THREAD_NAME_SIZE+1];
#endif
};

View file

@ -41,7 +41,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define ERRMSGSIZE (SC_MAXWIDTH) /* Max length of a error message */
#define NRERRBUFFS (2) /* Buffers for parameters */
#define MY_FILE_ERROR ((uint) ~0)
#define MY_FILE_ERROR ((size_t) -1)
/* General bitmaps for my_func's */
#define MY_FFNF 1 /* Fatal if file not found */
@ -153,13 +153,13 @@ extern ulonglong sf_malloc_mem_limit;
#define TERMINATE(A) {}
#define QUICK_SAFEMALLOC
#define NORMAL_SAFEMALLOC
extern gptr my_malloc(uint Size,myf MyFlags);
extern void *my_malloc(size_t Size,myf MyFlags);
#define my_malloc_ci(SZ,FLAG) my_malloc( SZ, FLAG )
extern gptr my_realloc(gptr oldpoint,uint Size,myf MyFlags);
extern void my_no_flags_free(gptr ptr);
extern gptr my_memdup(const byte *from,uint length,myf MyFlags);
extern void *my_realloc(void *oldpoint, size_t Size, myf MyFlags);
extern void my_no_flags_free(void *ptr);
extern void *my_memdup(const void *from,size_t length,myf MyFlags);
extern char *my_strdup(const char *from,myf MyFlags);
extern char *my_strndup(const char *from, uint length,
extern char *my_strndup(const char *from, size_t length,
myf MyFlags);
/* we do use FG (as a no-op) in below so that a typo on FG is caught */
#define my_free(PTR,FG) ((void)FG,my_no_flags_free(PTR))
@ -171,8 +171,8 @@ extern char *my_strndup(const char *from, uint length,
#ifdef HAVE_LARGE_PAGES
extern uint my_get_large_page_size(void);
extern gptr my_large_malloc(uint size, myf my_flags);
extern void my_large_free(gptr ptr, myf my_flags);
extern uchar * my_large_malloc(size_t size, myf my_flags);
extern void my_large_free(uchar * ptr, myf my_flags);
#else
#define my_get_large_page_size() (0)
#define my_large_malloc(A,B) my_malloc_lock((A),(B))
@ -258,7 +258,7 @@ typedef struct wild_file_pack /* Struct to hold info when selecting files */
{
uint wilds; /* How many wildcards */
uint not_pos; /* Start of not-theese-files */
my_string *wild; /* Pointer to wildcards */
char * *wild; /* Pointer to wildcards */
} WF_PACK;
enum loglevel {
@ -284,7 +284,7 @@ typedef struct st_record_cache /* Used when cacheing records */
int rc_seek,error,inited;
uint rc_length,read_length,reclength;
my_off_t rc_record_pos,end_of_file;
byte *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos;
uchar *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos;
#ifdef HAVE_AIOWAIT
int use_async_io;
my_aio_result aio_result;
@ -300,7 +300,7 @@ enum file_type
struct st_my_file_info
{
my_string name;
char * name;
enum file_type type;
#if defined(THREAD) && !defined(HAVE_PREAD)
pthread_mutex_t mutex;
@ -311,7 +311,7 @@ extern struct st_my_file_info *my_file_info;
typedef struct st_dynamic_array
{
char *buffer;
uchar *buffer;
uint elements,max_element;
uint alloc_increment;
uint size_of_element;
@ -330,7 +330,7 @@ typedef struct st_my_tmpdir
typedef struct st_dynamic_string
{
char *str;
uint length,max_length,alloc_increment;
size_t length,max_length,alloc_increment;
} DYNAMIC_STRING;
struct st_io_cache;
@ -346,8 +346,8 @@ typedef struct st_io_cache_share
my_off_t pos_in_file;
/* If a synchronized write cache is the source of the data. */
struct st_io_cache *source_cache;
byte *buffer; /* The read buffer. */
byte *read_end; /* Behind last valid byte of buffer. */
uchar *buffer; /* The read buffer. */
uchar *read_end; /* Behind last valid byte of buffer. */
int running_threads; /* threads not in lock. */
int total_threads; /* threads sharing the cache. */
int error; /* Last error. */
@ -360,7 +360,7 @@ typedef struct st_io_cache_share
typedef struct st_io_cache /* Used when cacheing files */
{
/* Offset in file corresponding to the first byte of byte* buffer. */
/* Offset in file corresponding to the first byte of uchar* buffer. */
my_off_t pos_in_file;
/*
The offset of end of file for READ_CACHE and WRITE_CACHE.
@ -369,26 +369,26 @@ typedef struct st_io_cache /* Used when cacheing files */
*/
my_off_t end_of_file;
/* Points to current read position in the buffer */
byte *read_pos;
uchar *read_pos;
/* the non-inclusive boundary in the buffer for the currently valid read */
byte *read_end;
byte *buffer; /* The read buffer */
uchar *read_end;
uchar *buffer; /* The read buffer */
/* Used in ASYNC_IO */
byte *request_pos;
uchar *request_pos;
/* Only used in WRITE caches and in SEQ_READ_APPEND to buffer writes */
byte *write_buffer;
uchar *write_buffer;
/*
Only used in SEQ_READ_APPEND, and points to the current read position
in the write buffer. Note that reads in SEQ_READ_APPEND caches can
happen from both read buffer (byte* buffer) and write buffer
(byte* write_buffer).
happen from both read buffer (uchar* buffer) and write buffer
(uchar* write_buffer).
*/
byte *append_read_pos;
uchar *append_read_pos;
/* Points to current write position in the write buffer */
byte *write_pos;
uchar *write_pos;
/* The non-inclusive boundary of the valid write area */
byte *write_end;
uchar *write_end;
/*
Current_pos and current_end are convenience variables used by
@ -396,7 +396,7 @@ typedef struct st_io_cache /* Used when cacheing files */
current_pos points to &write_pos, and current_end to &write_end in a
WRITE_CACHE, and &read_pos and &read_end respectively otherwise
*/
byte **current_pos, **current_end;
uchar **current_pos, **current_end;
#ifdef THREAD
/*
The lock is for append buffer used in SEQ_READ_APPEND cache
@ -420,12 +420,12 @@ typedef struct st_io_cache /* Used when cacheing files */
my_b_read() will call read_function to fetch the data. read_function
must never be invoked directly.
*/
int (*read_function)(struct st_io_cache *,byte *,uint);
int (*read_function)(struct st_io_cache *,uchar *,size_t);
/*
Same idea as in the case of read_function, except my_b_write() needs to
be replaced with my_b_append() for a SEQ_READ_APPEND cache
*/
int (*write_function)(struct st_io_cache *,const byte *,uint);
int (*write_function)(struct st_io_cache *,const uchar *,size_t);
/*
Specifies the type of the cache. Depending on the type of the cache
certain operations might not be available and yield unpredicatable
@ -460,9 +460,9 @@ typedef struct st_io_cache /* Used when cacheing files */
*/
int seek_not_done,error;
/* buffer_length is memory size allocated for buffer or write_buffer */
uint buffer_length;
size_t buffer_length;
/* read_length is the same as buffer_length except when we use async io */
uint read_length;
size_t read_length;
myf myflags; /* Flags used to my_read/my_write */
/*
alloced_buffer is 1 if the buffer was allocated by init_io_cache() and
@ -518,14 +518,14 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
(((info)->read_end=(info)->read_pos),(*(info)->read_function)(info,0,0))
#define my_b_tell(info) ((info)->pos_in_file + \
(uint) (*(info)->current_pos - (info)->request_pos))
(size_t) (*(info)->current_pos - (info)->request_pos))
/* tell write offset in the SEQ_APPEND cache */
int my_b_copy_to_file(IO_CACHE *cache, FILE *file);
my_off_t my_b_append_tell(IO_CACHE* info);
my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */
#define my_b_bytes_in_cache(info) (uint) (*(info)->current_end - \
#define my_b_bytes_in_cache(info) (size_t) (*(info)->current_end - \
*(info)->current_pos)
typedef uint32 ha_checksum;
@ -542,13 +542,13 @@ typedef int (*Process_option_func)(void *ctx, const char *group_name,
extern int my_copy(const char *from,const char *to,myf MyFlags);
extern int my_append(const char *from,const char *to,myf MyFlags);
extern int my_delete(const char *name,myf MyFlags);
extern int my_getwd(my_string buf,uint size,myf MyFlags);
extern int my_getwd(char * buf,size_t size,myf MyFlags);
extern int my_setwd(const char *dir,myf MyFlags);
extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFlags);
extern gptr my_once_alloc(uint Size,myf MyFlags);
extern void *my_once_alloc(size_t Size,myf MyFlags);
extern void my_once_free(void);
extern char *my_once_strdup(const char *src,myf myflags);
extern char *my_once_memdup(const char *src, uint len, myf myflags);
extern void *my_once_memdup(const void *src, size_t len, myf myflags);
extern File my_open(const char *FileName,int Flags,myf MyFlags);
extern File my_register_filename(File fd, const char *FileName,
enum file_type type_of_file,
@ -566,39 +566,39 @@ extern File my_create_with_symlink(const char *linkname, const char *filename,
extern int my_delete_with_symlink(const char *name, myf MyFlags);
extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags);
extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
extern uint my_read(File Filedes,byte *Buffer,uint Count,myf MyFlags);
extern uint my_pread(File Filedes,byte *Buffer,uint Count,my_off_t offset,
extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags);
extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset,
myf MyFlags);
extern int my_rename(const char *from,const char *to,myf MyFlags);
extern my_off_t my_seek(File fd,my_off_t pos,int whence,myf MyFlags);
extern my_off_t my_tell(File fd,myf MyFlags);
extern uint my_write(File Filedes,const byte *Buffer,uint Count,
extern size_t my_write(File Filedes,const uchar *Buffer,size_t Count,
myf MyFlags);
extern uint my_pwrite(File Filedes,const byte *Buffer,uint Count,
extern size_t my_pwrite(File Filedes,const uchar *Buffer,size_t Count,
my_off_t offset,myf MyFlags);
extern uint my_fread(FILE *stream,byte *Buffer,uint Count,myf MyFlags);
extern uint my_fwrite(FILE *stream,const byte *Buffer,uint Count,
extern size_t my_fread(FILE *stream,uchar *Buffer,size_t Count,myf MyFlags);
extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count,
myf MyFlags);
extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags);
extern my_off_t my_ftell(FILE *stream,myf MyFlags);
extern gptr _mymalloc(uint uSize,const char *sFile,
uint uLine, myf MyFlag);
extern gptr _myrealloc(gptr pPtr,uint uSize,const char *sFile,
extern void *_mymalloc(size_t uSize,const char *sFile,
uint uLine, myf MyFlag);
extern void *_myrealloc(void *pPtr,size_t uSize,const char *sFile,
uint uLine, myf MyFlag);
extern gptr my_multi_malloc _VARARGS((myf MyFlags, ...));
extern void _myfree(gptr pPtr,const char *sFile,uint uLine, myf MyFlag);
extern int _sanity(const char *sFile,unsigned int uLine);
extern gptr _my_memdup(const byte *from,uint length,
const char *sFile, uint uLine,myf MyFlag);
extern my_string _my_strdup(const char *from, const char *sFile, uint uLine,
myf MyFlag);
extern char *_my_strndup(const char *from, uint length,
const char *sFile, uint uLine,
myf MyFlag);
extern void * my_multi_malloc _VARARGS((myf MyFlags, ...));
extern void _myfree(void *pPtr,const char *sFile,uint uLine, myf MyFlag);
extern int _sanity(const char *sFile, uint uLine);
extern void *_my_memdup(const void *from, size_t length,
const char *sFile, uint uLine,myf MyFlag);
extern char * _my_strdup(const char *from, const char *sFile, uint uLine,
myf MyFlag);
extern char *_my_strndup(const char *from, size_t length,
const char *sFile, uint uLine,
myf MyFlag);
/* implemented in my_memmem.c */
extern void *my_memmem(const void *haystack, size_t haystacklen,
const void *needle, size_t needlelen);
const void *needle, size_t needlelen);
#ifdef __WIN__
@ -639,7 +639,7 @@ extern my_bool my_init(void);
extern void my_end(int infoflag);
extern int my_redel(const char *from, const char *to, int MyFlags);
extern int my_copystat(const char *from, const char *to, int MyFlags);
extern my_string my_filename(File fd);
extern char * my_filename(File fd);
#ifndef THREAD
extern void dont_break(void);
@ -660,97 +660,97 @@ extern char *my_tmpdir(MY_TMPDIR *tmpdir);
extern void free_tmpdir(MY_TMPDIR *tmpdir);
extern void my_remember_signal(int signal_number,sig_handler (*func)(int));
extern uint dirname_part(my_string to,const char *name);
extern uint dirname_length(const char *name);
extern size_t dirname_part(char * to, const char *name, size_t *to_res_length);
extern size_t dirname_length(const char *name);
#define base_name(A) (A+dirname_length(A))
extern int test_if_hard_path(const char *dir_name);
extern my_bool has_path(const char *name);
extern char *convert_dirname(char *to, const char *from, const char *from_end);
extern void to_unix_path(my_string name);
extern my_string fn_ext(const char *name);
extern my_string fn_same(my_string toname,const char *name,int flag);
extern my_string fn_format(my_string to,const char *name,const char *dir,
extern void to_unix_path(char * name);
extern char * fn_ext(const char *name);
extern char * fn_same(char * toname,const char *name,int flag);
extern char * fn_format(char * to,const char *name,const char *dir,
const char *form, uint flag);
extern size_s strlength(const char *str);
extern void pack_dirname(my_string to,const char *from);
extern uint unpack_dirname(my_string to,const char *from);
extern uint cleanup_dirname(my_string to,const char *from);
extern uint system_filename(my_string to,const char *from);
extern uint unpack_filename(my_string to,const char *from);
extern my_string intern_filename(my_string to,const char *from);
extern my_string directory_file_name(my_string dst, const char *src);
extern int pack_filename(my_string to, const char *name, size_s max_length);
extern my_string my_path(my_string to,const char *progname,
extern size_t strlength(const char *str);
extern void pack_dirname(char * to,const char *from);
extern size_t unpack_dirname(char * to,const char *from);
extern size_t cleanup_dirname(char * to,const char *from);
extern size_t system_filename(char * to,const char *from);
extern size_t unpack_filename(char * to,const char *from);
extern char * intern_filename(char * to,const char *from);
extern char * directory_file_name(char * dst, const char *src);
extern int pack_filename(char * to, const char *name, size_t max_length);
extern char * my_path(char * to,const char *progname,
const char *own_pathname_part);
extern my_string my_load_path(my_string to, const char *path,
extern char * my_load_path(char * to, const char *path,
const char *own_path_prefix);
extern int wild_compare(const char *str,const char *wildstr,
pbool str_is_pattern);
extern WF_PACK *wf_comp(my_string str);
extern WF_PACK *wf_comp(char * str);
extern int wf_test(struct wild_file_pack *wf_pack,const char *name);
extern void wf_end(struct wild_file_pack *buffer);
extern size_s strip_sp(my_string str);
extern void get_date(my_string to,int timeflag,time_t use_time);
extern void soundex(CHARSET_INFO *, my_string out_pntr, my_string in_pntr,
extern size_t strip_sp(char * str);
extern void get_date(char * to,int timeflag,time_t use_time);
extern void soundex(CHARSET_INFO *, char * out_pntr, char * in_pntr,
pbool remove_garbage);
extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file,
uint reclength,enum cache_type type,
extern int init_record_cache(RECORD_CACHE *info,size_t cachesize,File file,
size_t reclength,enum cache_type type,
pbool use_async_io);
extern int read_cache_record(RECORD_CACHE *info,byte *to);
extern int read_cache_record(RECORD_CACHE *info,uchar *to);
extern int end_record_cache(RECORD_CACHE *info);
extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos,
const byte *record,uint length);
const uchar *record,size_t length);
extern int flush_write_cache(RECORD_CACHE *info);
extern long my_clock(void);
extern sig_handler sigtstp_handler(int signal_number);
extern void handle_recived_signals(void);
extern sig_handler my_set_alarm_variable(int signo);
extern void my_string_ptr_sort(void *base,uint items,size_s size);
extern void my_string_ptr_sort(uchar *base, uint items, size_t size);
extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements,
size_s size_of_element,uchar *buffer[]);
size_t size_of_element,uchar *buffer[]);
extern qsort_t qsort2(void *base_ptr, size_t total_elems, size_t size,
qsort2_cmp cmp, void *cmp_argument);
extern qsort2_cmp get_ptr_compare(uint);
void my_store_ptr(byte *buff, uint pack_length, my_off_t pos);
my_off_t my_get_ptr(byte *ptr, uint pack_length);
extern int init_io_cache(IO_CACHE *info,File file,uint cachesize,
extern qsort2_cmp get_ptr_compare(size_t);
void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos);
my_off_t my_get_ptr(uchar *ptr, size_t pack_length);
extern int init_io_cache(IO_CACHE *info,File file,size_t cachesize,
enum cache_type type,my_off_t seek_offset,
pbool use_async_io, myf cache_myflags);
extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type,
my_off_t seek_offset,pbool use_async_io,
pbool clear_cache);
extern void setup_io_cache(IO_CACHE* info);
extern int _my_b_read(IO_CACHE *info,byte *Buffer,uint Count);
extern int _my_b_read(IO_CACHE *info,uchar *Buffer,size_t Count);
#ifdef THREAD
extern int _my_b_read_r(IO_CACHE *info,byte *Buffer,uint Count);
extern int _my_b_read_r(IO_CACHE *info,uchar *Buffer,size_t Count);
extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare,
IO_CACHE *write_cache, uint num_threads);
extern void remove_io_thread(IO_CACHE *info);
#endif
extern int _my_b_seq_read(IO_CACHE *info,byte *Buffer,uint Count);
extern int _my_b_net_read(IO_CACHE *info,byte *Buffer,uint Count);
extern int _my_b_seq_read(IO_CACHE *info,uchar *Buffer,size_t Count);
extern int _my_b_net_read(IO_CACHE *info,uchar *Buffer,size_t Count);
extern int _my_b_get(IO_CACHE *info);
extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count);
extern int _my_b_write(IO_CACHE *info,const byte *Buffer,uint Count);
extern int my_b_append(IO_CACHE *info,const byte *Buffer,uint Count);
extern int my_b_safe_write(IO_CACHE *info,const byte *Buffer,uint Count);
extern int _my_b_async_read(IO_CACHE *info,uchar *Buffer,size_t Count);
extern int _my_b_write(IO_CACHE *info,const uchar *Buffer,size_t Count);
extern int my_b_append(IO_CACHE *info,const uchar *Buffer,size_t Count);
extern int my_b_safe_write(IO_CACHE *info,const uchar *Buffer,size_t Count);
extern int my_block_write(IO_CACHE *info, const byte *Buffer,
uint Count, my_off_t pos);
extern int my_block_write(IO_CACHE *info, const uchar *Buffer,
size_t Count, my_off_t pos);
extern int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock);
#define flush_io_cache(info) my_b_flush_io_cache((info),1)
extern int end_io_cache(IO_CACHE *info);
extern uint my_b_fill(IO_CACHE *info);
extern size_t my_b_fill(IO_CACHE *info);
extern void my_b_seek(IO_CACHE *info,my_off_t pos);
extern uint my_b_gets(IO_CACHE *info, char *to, uint max_length);
extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length);
extern my_off_t my_b_filelength(IO_CACHE *info);
extern uint my_b_printf(IO_CACHE *info, const char* fmt, ...);
extern uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap);
extern size_t my_b_printf(IO_CACHE *info, const char* fmt, ...);
extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap);
extern my_bool open_cached_file(IO_CACHE *cache,const char *dir,
const char *prefix, uint cache_size,
const char *prefix, size_t cache_size,
myf cache_myflags);
extern my_bool real_open_cached_file(IO_CACHE *cache);
extern void close_cached_file(IO_CACHE *cache);
@ -768,15 +768,15 @@ extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array,uint element_size,
extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size,
uint init_alloc,uint alloc_increment
CALLER_INFO_PROTO);
extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,gptr element);
extern byte *alloc_dynamic(DYNAMIC_ARRAY *array);
extern byte *pop_dynamic(DYNAMIC_ARRAY*);
extern my_bool set_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index);
extern void get_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index);
extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,uchar * element);
extern uchar *alloc_dynamic(DYNAMIC_ARRAY *array);
extern uchar *pop_dynamic(DYNAMIC_ARRAY*);
extern my_bool set_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_index);
extern void get_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_index);
extern void delete_dynamic(DYNAMIC_ARRAY *array);
extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index);
extern void freeze_size(DYNAMIC_ARRAY *array);
extern int get_index_dynamic(DYNAMIC_ARRAY *array, gptr element);
extern int get_index_dynamic(DYNAMIC_ARRAY *array, uchar * element);
#define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element)
#define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index))
#define push_dynamic(A,B) insert_dynamic((A),(B))
@ -784,19 +784,19 @@ extern int get_index_dynamic(DYNAMIC_ARRAY *array, gptr element);
#define sort_dynamic(A,cmp) qsort((A)->buffer, (A)->elements, (A)->size_of_element, (cmp))
extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
uint init_alloc,uint alloc_increment);
size_t init_alloc,size_t alloc_increment);
extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append);
my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
uint length);
size_t length);
extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append,
...);
extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str);
extern my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size);
extern my_bool dynstr_trunc(DYNAMIC_STRING *str, int n);
extern my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size);
extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n);
extern void dynstr_free(DYNAMIC_STRING *str);
#ifdef HAVE_MLOCK
extern byte *my_malloc_lock(uint length,myf flags);
extern void my_free_lock(byte *ptr,myf flags);
extern void *my_malloc_lock(size_t length,myf flags);
extern void my_free_lock(void *ptr,myf flags);
#else
#define my_malloc_lock(A,B) my_malloc((A),(B))
#define my_free_lock(A,B) my_free((A),(B))
@ -804,17 +804,17 @@ extern void my_free_lock(byte *ptr,myf flags);
#define alloc_root_inited(A) ((A)->min_malloc != 0)
#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8)
#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0)
extern void init_alloc_root(MEM_ROOT *mem_root, uint block_size,
uint pre_alloc_size);
extern gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size);
extern gptr multi_alloc_root(MEM_ROOT *mem_root, ...);
extern void init_alloc_root(MEM_ROOT *mem_root, size_t block_size,
size_t pre_alloc_size);
extern void *alloc_root(MEM_ROOT *mem_root, size_t Size);
extern void *multi_alloc_root(MEM_ROOT *mem_root, ...);
extern void free_root(MEM_ROOT *root, myf MyFLAGS);
extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
extern void reset_root_defaults(MEM_ROOT *mem_root, uint block_size,
uint prealloc_size);
extern void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
size_t prealloc_size);
extern char *strdup_root(MEM_ROOT *root,const char *str);
extern char *strmake_root(MEM_ROOT *root,const char *str,uint len);
extern char *memdup_root(MEM_ROOT *root,const char *str,uint len);
extern char *strmake_root(MEM_ROOT *root,const char *str,size_t len);
extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len);
extern int get_defaults_options(int argc, char **argv,
char **defaults, char **extra_defaults,
char **group_suffix);
@ -829,19 +829,20 @@ extern int my_search_option_files(const char *conf_file, int *argc,
extern void free_defaults(char **argv);
extern void my_print_default_files(const char *conf_file);
extern void print_defaults(const char *conf_file, const char **groups);
extern my_bool my_compress(byte *, ulong *, ulong *);
extern my_bool my_uncompress(byte *, ulong *, ulong *);
extern byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen);
extern int packfrm(const void *, uint, const void **, uint *);
extern int unpackfrm(const void **, uint *, const void *);
extern my_bool my_compress(uchar *, size_t *, size_t *);
extern my_bool my_uncompress(uchar *, size_t , size_t *);
extern uchar *my_compress_alloc(const uchar *packet, size_t *len,
size_t *complen);
extern int packfrm(const uchar *, size_t, uchar **, size_t *);
extern int unpackfrm(uchar **, size_t *, const uchar *);
extern ha_checksum my_checksum(ha_checksum crc, const byte *mem, uint count);
extern ha_checksum my_checksum(ha_checksum crc, const uchar *mem,
size_t count);
extern uint my_bit_log2(ulong value);
extern uint32 my_round_up_to_next_power(uint32 v);
extern uint my_count_bits(ulonglong v);
extern uint my_count_bits_ushort(ushort v);
extern void my_sleep(ulong m_seconds);
extern ulong crc32(ulong crc, const uchar *buf, uint len);
extern uint my_set_max_open_files(uint files);
void my_free_open_file_info(void);
@ -908,17 +909,17 @@ extern char *get_charsets_dir(char *buf);
extern my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2);
extern my_bool init_compiled_charsets(myf flags);
extern void add_compiled_collation(CHARSET_INFO *cs);
extern ulong escape_string_for_mysql(CHARSET_INFO *charset_info,
char *to, ulong to_length,
const char *from, ulong length);
extern size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
char *to, size_t to_length,
const char *from, size_t length);
#ifdef __WIN__
#define BACKSLASH_MBTAIL
/* File system character set */
extern CHARSET_INFO *fs_character_set(void);
#endif
extern ulong escape_quotes_for_mysql(CHARSET_INFO *charset_info,
char *to, ulong to_length,
const char *from, ulong length);
extern size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info,
char *to, size_t to_length,
const char *from, size_t length);
extern void thd_increment_bytes_sent(ulong length);
extern void thd_increment_bytes_received(ulong length);
@ -935,7 +936,7 @@ int my_security_attr_create(SECURITY_ATTRIBUTES **psa, const char **perror,
void my_security_attr_free(SECURITY_ATTRIBUTES *sa);
/* implemented in my_conio.c */
char* my_cgets(char *string, unsigned long clen, unsigned long* plen);
char* my_cgets(char *string, size_t clen, size_t* plen);
#endif
#ifdef __NETWARE__

View file

@ -25,10 +25,10 @@ extern "C" {
#define MAX_TREE_HEIGHT 64
#define ELEMENT_KEY(tree,element)\
(tree->offset_to_key ? (void*)((byte*) element+tree->offset_to_key) :\
(tree->offset_to_key ? (void*)((uchar*) element+tree->offset_to_key) :\
*((void**) (element+1)))
#define tree_set_pointer(element,ptr) *((byte **) (element+1))=((byte*) (ptr))
#define tree_set_pointer(element,ptr) *((uchar **) (element+1))=((uchar*) (ptr))
#define TREE_NO_DUPS 1

View file

@ -22,7 +22,7 @@ extern "C" {
typedef struct st_trie_node
{
uint16 leaf; /* Depth from root node if match, 0 else */
byte c; /* Label on this edge */
uchar c; /* Label on this edge */
struct st_trie_node *next; /* Next label */
struct st_trie_node *links; /* Array of edges leaving this node */
struct st_trie_node *fail; /* AC failure function */
@ -45,14 +45,14 @@ typedef struct st_ac_trie_state
extern TRIE *trie_init (TRIE *trie, CHARSET_INFO *charset);
extern void trie_free (TRIE *trie);
extern my_bool trie_insert (TRIE *trie, const byte *key, uint keylen);
extern my_bool trie_insert (TRIE *trie, const uchar *key, uint keylen);
extern my_bool ac_trie_prepare (TRIE *trie);
extern void ac_trie_init (TRIE *trie, AC_TRIE_STATE *state);
/* `trie_goto' is internal function and shouldn't be used. */
static inline TRIE_NODE *trie_goto (TRIE_NODE *root, TRIE_NODE *node, byte c)
static inline TRIE_NODE *trie_goto (TRIE_NODE *root, TRIE_NODE *node, uchar c)
{
TRIE_NODE *next;
DBUG_ENTER("trie_goto");
@ -67,7 +67,7 @@ static inline TRIE_NODE *trie_goto (TRIE_NODE *root, TRIE_NODE *node, byte c)
/*
SYNOPSIS
int ac_trie_next (AC_TRIE_STATE *state, byte *c);
int ac_trie_next (AC_TRIE_STATE *state, uchar *c);
state - valid pointer to `AC_TRIE_STATE'
c - character to lookup
@ -79,7 +79,7 @@ static inline TRIE_NODE *trie_goto (TRIE_NODE *root, TRIE_NODE *node, byte c)
`ac_trie_next' returns length of matched word or 0.
*/
static inline int ac_trie_next (AC_TRIE_STATE *state, byte *c)
static inline int ac_trie_next (AC_TRIE_STATE *state, uchar *c)
{
TRIE_NODE *root, *node;
DBUG_ENTER("ac_trie_next");
@ -94,7 +94,7 @@ static inline int ac_trie_next (AC_TRIE_STATE *state, byte *c)
/*
SYNOPSIS
my_bool trie_search (TRIE *trie, const byte *key, uint keylen);
my_bool trie_search (TRIE *trie, const uchar *key, uint keylen);
trie - valid pointer to `TRIE'
key - valid pointer to key to insert
keylen - non-0 key length
@ -113,7 +113,7 @@ static inline int ac_trie_next (AC_TRIE_STATE *state, byte *c)
consecutive loop better (tested)
*/
static inline my_bool trie_search (TRIE *trie, const byte *key, uint keylen)
static inline my_bool trie_search (TRIE *trie, const uchar *key, uint keylen)
{
TRIE_NODE *node;
uint k;
@ -123,7 +123,7 @@ static inline my_bool trie_search (TRIE *trie, const byte *key, uint keylen)
for (k= 0; k < keylen; k++)
{
byte p;
uchar p;
if (! (node= node->links))
DBUG_RETURN(FALSE);
p= key[k];

View file

@ -25,9 +25,9 @@
C_MODE_START
void parse_user(const char *user_id_str, uint user_id_len,
char *user_name_str, uint *user_name_len,
char *host_name_str, uint *host_name_len);
void parse_user(const char *user_id_str, size_t user_id_len,
char *user_name_str, size_t *user_name_len,
char *host_name_str, size_t *host_name_len);
C_MODE_END

View file

@ -28,8 +28,8 @@ extern "C" {
*/
#define my_vle_sizeof(ITEM) (((sizeof(ITEM) * CHAR_BIT) + 6) / 7)
byte *my_vle_encode(byte *vle, my_size_t max, ulong value);
byte const *my_vle_decode(ulong *value_ptr, byte const *vle);
uchar *my_vle_encode(uchar *vle, size_t max, ulong value);
uchar const *my_vle_decode(ulong *value_ptr, uchar const *vle);
#ifdef __cplusplus
}

View file

@ -57,27 +57,27 @@ typedef struct xml_stack_st
const char *cur;
const char *end;
void *user_data;
int (*enter)(struct xml_stack_st *st,const char *val, uint len);
int (*value)(struct xml_stack_st *st,const char *val, uint len);
int (*leave_xml)(struct xml_stack_st *st,const char *val, uint len);
int (*enter)(struct xml_stack_st *st,const char *val, size_t len);
int (*value)(struct xml_stack_st *st,const char *val, size_t len);
int (*leave_xml)(struct xml_stack_st *st,const char *val, size_t len);
} MY_XML_PARSER;
void my_xml_parser_create(MY_XML_PARSER *st);
void my_xml_parser_free(MY_XML_PARSER *st);
int my_xml_parse(MY_XML_PARSER *st,const char *str, uint len);
int my_xml_parse(MY_XML_PARSER *st,const char *str, size_t len);
void my_xml_set_value_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
const char *,
uint len));
size_t len));
void my_xml_set_enter_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
const char *,
uint len));
size_t len));
void my_xml_set_leave_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
const char *,
uint len));
size_t len));
void my_xml_set_user_data(MY_XML_PARSER *st, void *);
uint my_xml_error_pos(MY_XML_PARSER *st);
size_t my_xml_error_pos(MY_XML_PARSER *st);
uint my_xml_error_lineno(MY_XML_PARSER *st);
const char *my_xml_error_string(MY_XML_PARSER *st);

View file

@ -227,7 +227,7 @@ typedef struct st_mi_decode_tree /* Decode huff-table */
{
uint16 *table;
uint quick_table_bits;
byte *intervalls;
uchar *intervalls;
} MI_DECODE_TREE;
@ -259,7 +259,7 @@ typedef struct st_columndef /* column information */
/* invalidator function reference for Query Cache */
typedef void (* invalidator_by_filename)(const char * filename);
extern my_string myisam_log_filename; /* Name of logfile */
extern char * myisam_log_filename; /* Name of logfile */
extern ulong myisam_block_size;
extern ulong myisam_concurrent_insert;
extern my_bool myisam_flush,myisam_delay_key_write,myisam_single_user;
@ -269,26 +269,26 @@ extern ulong myisam_bulk_insert_tree_size, myisam_data_pointer_size;
/* Prototypes for myisam-functions */
extern int mi_close(struct st_myisam_info *file);
extern int mi_delete(struct st_myisam_info *file,const byte *buff);
extern int mi_delete(struct st_myisam_info *file,const uchar *buff);
extern struct st_myisam_info *mi_open(const char *name,int mode,
uint wait_if_locked);
extern int mi_panic(enum ha_panic_function function);
extern int mi_rfirst(struct st_myisam_info *file,byte *buf,int inx);
extern int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key,
extern int mi_rfirst(struct st_myisam_info *file,uchar *buf,int inx);
extern int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function search_flag);
extern int mi_rlast(struct st_myisam_info *file,byte *buf,int inx);
extern int mi_rnext(struct st_myisam_info *file,byte *buf,int inx);
extern int mi_rnext_same(struct st_myisam_info *info, byte *buf);
extern int mi_rprev(struct st_myisam_info *file,byte *buf,int inx);
extern int mi_rrnd(struct st_myisam_info *file,byte *buf, my_off_t pos);
extern int mi_rlast(struct st_myisam_info *file,uchar *buf,int inx);
extern int mi_rnext(struct st_myisam_info *file,uchar *buf,int inx);
extern int mi_rnext_same(struct st_myisam_info *info, uchar *buf);
extern int mi_rprev(struct st_myisam_info *file,uchar *buf,int inx);
extern int mi_rrnd(struct st_myisam_info *file,uchar *buf, my_off_t pos);
extern int mi_scan_init(struct st_myisam_info *file);
extern int mi_scan(struct st_myisam_info *file,byte *buf);
extern int mi_rsame(struct st_myisam_info *file,byte *record,int inx);
extern int mi_rsame_with_pos(struct st_myisam_info *file,byte *record,
extern int mi_scan(struct st_myisam_info *file,uchar *buf);
extern int mi_rsame(struct st_myisam_info *file,uchar *record,int inx);
extern int mi_rsame_with_pos(struct st_myisam_info *file,uchar *record,
int inx, my_off_t pos);
extern int mi_update(struct st_myisam_info *file,const byte *old,
byte *new_record);
extern int mi_write(struct st_myisam_info *file,byte *buff);
extern int mi_update(struct st_myisam_info *file,const uchar *old,
uchar *new_record);
extern int mi_write(struct st_myisam_info *file,uchar *buff);
extern my_off_t mi_position(struct st_myisam_info *file);
extern int mi_status(struct st_myisam_info *info, MI_ISAMINFO *x, uint flag);
extern int mi_lock_database(struct st_myisam_info *file,int lock_type);
@ -307,7 +307,7 @@ extern ha_rows mi_records_in_range(MI_INFO *info, int inx,
extern int mi_log(int activate_log);
extern int mi_is_changed(struct st_myisam_info *info);
extern int mi_delete_all_rows(struct st_myisam_info *info);
extern ulong _mi_calc_blob_length(uint length , const byte *pos);
extern ulong _mi_calc_blob_length(uint length , const uchar *pos);
extern uint mi_get_pointer_length(ulonglong file_length, uint def);
/* this is used to pass to mysql_myisamchk_table -- by Sasha Pachev */
@ -474,8 +474,8 @@ int chk_size(MI_CHECK *param, MI_INFO *info);
int chk_key(MI_CHECK *param, MI_INFO *info);
int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend);
int mi_repair(MI_CHECK *param, register MI_INFO *info,
my_string name, int rep_quick);
int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name);
char * name, int rep_quick);
int mi_sort_index(MI_CHECK *param, register MI_INFO *info, char * name);
int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
const char * name, int rep_quick);
int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
@ -494,7 +494,7 @@ void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part,
ulonglong records);
int filecopy(MI_CHECK *param, File to,File from,my_off_t start,
my_off_t length, const char *type);
int movepoint(MI_INFO *info,byte *record,my_off_t oldpos,
int movepoint(MI_INFO *info,uchar *record,my_off_t oldpos,
my_off_t newpos, uint prot_key);
int write_data_suffix(SORT_INFO *sort_info, my_bool fix_datafile);
int test_if_almost_full(MI_INFO *info);

View file

@ -78,20 +78,20 @@ typedef struct st_myrg_info
/* Prototypes for merge-functions */
extern int myrg_close(MYRG_INFO *file);
extern int myrg_delete(MYRG_INFO *file,const byte *buff);
extern int myrg_delete(MYRG_INFO *file,const uchar *buff);
extern MYRG_INFO *myrg_open(const char *name,int mode,int wait_if_locked);
extern int myrg_panic(enum ha_panic_function function);
extern int myrg_rfirst(MYRG_INFO *file,byte *buf,int inx);
extern int myrg_rlast(MYRG_INFO *file,byte *buf,int inx);
extern int myrg_rnext(MYRG_INFO *file,byte *buf,int inx);
extern int myrg_rprev(MYRG_INFO *file,byte *buf,int inx);
extern int myrg_rnext_same(MYRG_INFO *file,byte *buf);
extern int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
extern int myrg_rfirst(MYRG_INFO *file,uchar *buf,int inx);
extern int myrg_rlast(MYRG_INFO *file,uchar *buf,int inx);
extern int myrg_rnext(MYRG_INFO *file,uchar *buf,int inx);
extern int myrg_rprev(MYRG_INFO *file,uchar *buf,int inx);
extern int myrg_rnext_same(MYRG_INFO *file,uchar *buf);
extern int myrg_rkey(MYRG_INFO *info,uchar *buf,int inx, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function search_flag);
extern int myrg_rrnd(MYRG_INFO *file,byte *buf,ulonglong pos);
extern int myrg_rsame(MYRG_INFO *file,byte *record,int inx);
extern int myrg_update(MYRG_INFO *file,const byte *old,byte *new_rec);
extern int myrg_write(MYRG_INFO *info,byte *rec);
extern int myrg_rrnd(MYRG_INFO *file,uchar *buf,ulonglong pos);
extern int myrg_rsame(MYRG_INFO *file,uchar *record,int inx);
extern int myrg_update(MYRG_INFO *file,const uchar *old,uchar *new_rec);
extern int myrg_write(MYRG_INFO *info,uchar *rec);
extern int myrg_status(MYRG_INFO *file,MYMERGE_INFO *x,int flag);
extern int myrg_lock_database(MYRG_INFO *file,int lock_type);
extern int myrg_create(const char *name, const char **table_names,

View file

@ -53,7 +53,6 @@ typedef char my_bool;
#else
#define STDCALL __stdcall
#endif
typedef char * gptr;
#ifndef my_socket_defined
#ifdef __WIN__
@ -252,9 +251,9 @@ struct st_mysql_stmt;
typedef struct st_mysql
{
NET net; /* Communication parameters */
gptr connector_fd; /* ConnectorFd for SSL */
char *host,*user,*passwd,*unix_socket,*server_version,*host_info,*info;
char *db;
unsigned char *connector_fd; /* ConnectorFd for SSL */
char *host,*user,*passwd,*unix_socket,*server_version,*host_info;
char *info, *db;
struct charset_info_st *charset;
MYSQL_FIELD *fields;
MEM_ROOT field_alloc;
@ -753,9 +752,9 @@ typedef struct st_mysql_methods
my_bool (*read_query_result)(MYSQL *mysql);
my_bool (*advanced_command)(MYSQL *mysql,
enum enum_server_command command,
const char *header,
const unsigned char *header,
unsigned long header_length,
const char *arg,
const unsigned char *arg,
unsigned long arg_length,
my_bool skip_check,
MYSQL_STMT *stmt);
@ -848,10 +847,10 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
*/
#define simple_command(mysql, command, arg, length, skip_check) \
(*(mysql)->methods->advanced_command)(mysql, command, NullS, \
(*(mysql)->methods->advanced_command)(mysql, command, 0, \
0, arg, length, skip_check, NULL)
#define stmt_command(mysql, command, arg, length, stmt) \
(*(mysql)->methods->advanced_command)(mysql, command, NullS, \
(*(mysql)->methods->advanced_command)(mysql, command, 0, \
0, arg, length, 1, stmt)
#ifdef __NETWARE__

View file

@ -223,7 +223,7 @@ typedef struct st_net {
'query_cache_query' should be accessed only via query cache
functions and methods to maintain proper locking.
*/
gptr query_cache_query;
unsigned char *query_cache_query;
my_bool report_error; /* We should report error (we have unreported error) */
my_bool return_errno;
@ -344,13 +344,13 @@ my_bool my_net_init(NET *net, Vio* vio);
void my_net_local_init(NET *net);
void net_end(NET *net);
void net_clear(NET *net, my_bool clear_buffer);
my_bool net_realloc(NET *net, unsigned long length);
my_bool net_realloc(NET *net, size_t length);
my_bool net_flush(NET *net);
my_bool my_net_write(NET *net,const char *packet,unsigned long len);
my_bool my_net_write(NET *net,const unsigned char *packet, size_t len);
my_bool net_write_command(NET *net,unsigned char command,
const char *header, unsigned long head_len,
const char *packet, unsigned long len);
int net_real_write(NET *net,const char *packet,unsigned long len);
const unsigned char *header, size_t head_len,
const unsigned char *packet, size_t len);
int net_real_write(NET *net,const unsigned char *packet, size_t len);
unsigned long my_net_read(NET *net);
/*
@ -446,7 +446,7 @@ void my_thread_end(void);
#ifdef _global_h
ulong STDCALL net_field_length(uchar **packet);
my_ulonglong net_field_length_ll(uchar **packet);
char *net_store_length(char *pkg, ulonglong length);
uchar *net_store_length(uchar *pkg, ulonglong length);
#endif
#ifdef __cplusplus

View file

@ -27,13 +27,13 @@ extern "C" {
#endif
typedef struct st_queue {
byte **root;
uchar **root;
void *first_cmp_arg;
uint elements;
uint max_elements;
uint offset_to_key; /* compare is done on element+offset */
int max_at_top; /* Set if queue_top gives max */
int (*compare)(void *, byte *,byte *);
int (*compare)(void *, uchar *,uchar *);
uint auto_extent;
} QUEUE;
@ -44,7 +44,7 @@ typedef struct st_queue {
#define queue_set_cmp_arg(queue, set_arg) (queue)->first_cmp_arg= set_arg
#define queue_set_max_at_top(queue, set_arg) \
(queue)->max_at_top= set_arg ? (-1 ^ 1) : 0
typedef int (*queue_compare)(void *,byte *, byte *);
typedef int (*queue_compare)(void *,uchar *, uchar *);
int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
pbool max_at_top, queue_compare compare,
@ -57,9 +57,9 @@ int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
void *first_cmp_arg);
int resize_queue(QUEUE *queue, uint max_elements);
void delete_queue(QUEUE *queue);
void queue_insert(QUEUE *queue,byte *element);
int queue_insert_safe(QUEUE *queue, byte *element);
byte *queue_remove(QUEUE *queue,uint idx);
void queue_insert(QUEUE *queue,uchar *element);
int queue_insert_safe(QUEUE *queue, uchar *element);
uchar *queue_remove(QUEUE *queue,uint idx);
#define queue_remove_all(queue) { (queue)->elements= 0; }
#define queue_is_full(queue) (queue->elements == queue->max_elements)
void _downheap(QUEUE *queue,uint idx);

View file

@ -32,9 +32,9 @@ void mysql_read_default_options(struct st_mysql_options *options,
const char *filename,const char *group);
my_bool
cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
const char *header, ulong header_length,
const char *arg, ulong arg_length, my_bool skip_check,
MYSQL_STMT *stmt);
const unsigned char *header, ulong header_length,
const unsigned char *arg, ulong arg_length,
my_bool skip_check, MYSQL_STMT *stmt);
unsigned long cli_safe_read(MYSQL *mysql);
void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
const char *sqlstate);

View file

@ -17,29 +17,29 @@
{"ssl", OPT_SSL_SSL,
"Enable SSL for connection (automatically enabled with other flags). Disable with --skip-ssl.",
(gptr*) &opt_use_ssl, (gptr*) &opt_use_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0,
(uchar **) &opt_use_ssl, (uchar **) &opt_use_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"ssl-ca", OPT_SSL_CA,
"CA file in PEM format (check OpenSSL docs, implies --ssl).",
(gptr*) &opt_ssl_ca, (gptr*) &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
(uchar **) &opt_ssl_ca, (uchar **) &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-capath", OPT_SSL_CAPATH,
"CA directory (check OpenSSL docs, implies --ssl).",
(gptr*) &opt_ssl_capath, (gptr*) &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
(uchar **) &opt_ssl_capath, (uchar **) &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format (implies --ssl).",
(gptr*) &opt_ssl_cert, (gptr*) &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
(uchar **) &opt_ssl_cert, (uchar **) &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-cipher", OPT_SSL_CIPHER, "SSL cipher to use (implies --ssl).",
(gptr*) &opt_ssl_cipher, (gptr*) &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG,
(uchar **) &opt_ssl_cipher, (uchar **) &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl).",
(gptr*) &opt_ssl_key, (gptr*) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
(uchar **) &opt_ssl_key, (uchar **) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#ifdef MYSQL_CLIENT
{"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT,
"Verify server's \"Common Name\" in its cert against hostname used when connecting. This option is disabled by default.",
(gptr*) &opt_ssl_verify_server_cert, (gptr*) &opt_ssl_verify_server_cert,
(uchar **) &opt_ssl_verify_server_cert, (uchar **) &opt_ssl_verify_server_cert,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
#endif /* HAVE_OPENSSL */

View file

@ -51,8 +51,8 @@ Vio* vio_new_win32shared_memory(NET *net,HANDLE handle_file_map,
HANDLE event_client_wrote,
HANDLE event_client_read,
HANDLE event_conn_closed);
int vio_read_pipe(Vio *vio, gptr buf, int size);
int vio_write_pipe(Vio *vio, const gptr buf, int size);
size_t vio_read_pipe(Vio *vio, uchar * buf, size_t size);
size_t vio_write_pipe(Vio *vio, const uchar * buf, size_t size);
int vio_close_pipe(Vio * vio);
#else
#define HANDLE void *
@ -62,9 +62,9 @@ void vio_delete(Vio* vio);
int vio_close(Vio* vio);
void vio_reset(Vio* vio, enum enum_vio_type type,
my_socket sd, HANDLE hPipe, uint flags);
int vio_read(Vio *vio, gptr buf, int size);
int vio_read_buff(Vio *vio, gptr buf, int size);
int vio_write(Vio *vio, const gptr buf, int size);
size_t vio_read(Vio *vio, uchar * buf, size_t size);
size_t vio_read_buff(Vio *vio, uchar * buf, size_t size);
size_t vio_write(Vio *vio, const uchar * buf, size_t size);
int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode);
my_bool vio_is_blocking(Vio *vio);
/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible */
@ -128,8 +128,8 @@ void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd);
#endif /* HAVE_OPENSSL */
#ifdef HAVE_SMEM
int vio_read_shared_memory(Vio *vio, gptr buf, int size);
int vio_write_shared_memory(Vio *vio, const gptr buf, int size);
size_t vio_read_shared_memory(Vio *vio, uchar * buf, size_t size);
size_t vio_write_shared_memory(Vio *vio, const uchar * buf, size_t size);
int vio_close_shared_memory(Vio * vio);
#endif
@ -187,8 +187,8 @@ struct st_vio
/* function pointers. They are similar for socket/SSL/whatever */
void (*viodelete)(Vio*);
int (*vioerrno)(Vio*);
int (*read)(Vio*, gptr, int);
int (*write)(Vio*, const gptr, int);
size_t (*read)(Vio*, uchar *, size_t);
size_t (*write)(Vio*, const uchar *, size_t);
int (*vioblocking)(Vio*, my_bool, my_bool *);
my_bool (*is_blocking)(Vio*);
int (*viokeepalive)(Vio*, my_bool);
@ -210,7 +210,7 @@ struct st_vio
HANDLE event_client_wrote;
HANDLE event_client_read;
HANDLE event_conn_closed;
long shared_memory_remain;
size_t shared_memory_remain;
char *shared_memory_pos;
NET *net;
#endif /* HAVE_SMEM */

View file

@ -14,7 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
extern uint mysql_port;
extern my_string mysql_unix_port;
extern char * mysql_unix_port;
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | \
CLIENT_TRANSACTIONS | \

View file

@ -625,7 +625,7 @@ mysql_connect(MYSQL *mysql,const char *host,
if (!(res=mysql_real_connect(mysql,host,user,passwd,NullS,0,NullS,0)))
{
if (mysql->free_me)
my_free((gptr) mysql,MYF(0));
my_free((uchar*) mysql,MYF(0));
}
mysql->reconnect= 1;
DBUG_RETURN(res);
@ -946,7 +946,7 @@ static int default_local_infile_read(void *ptr, char *buf, uint buf_len)
int count;
default_local_infile_data*data = (default_local_infile_data *) ptr;
if ((count= (int) my_read(data->fd, (byte *) buf, buf_len, MYF(0))) < 0)
if ((count= (int) my_read(data->fd, (uchar *) buf, buf_len, MYF(0))) < 0)
{
data->error_num= EE_READ; /* the errmsg for not entire file read */
my_snprintf(data->error_msg, sizeof(data->error_msg)-1,
@ -4539,7 +4539,7 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
}
if (!((bit<<=1) & 255))
{
bit= 1; /* To next byte */
bit= 1; /* To next uchar */
null_ptr++;
}
}
@ -4732,7 +4732,7 @@ static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
DBUG_ASSERT(row <= row_end);
if (!((bit<<=1) & 255))
{
bit= 1; /* To next byte */
bit= 1; /* To next uchar */
null_ptr++;
}
}
@ -5043,7 +5043,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt)
}
}
my_free((gptr) stmt, MYF(MY_WME));
my_free((uchar*) stmt, MYF(MY_WME));
DBUG_RETURN(test(rc));
}

View file

@ -206,10 +206,10 @@ void STDCALL mysql_manager_close(MYSQL_MANAGER* con)
allocated in my_multimalloc() along with con->host, freeing
con->hosts frees the whole block
*/
my_free((gptr)con->host,MYF(MY_ALLOW_ZERO_PTR));
my_free((uchar*)con->host,MYF(MY_ALLOW_ZERO_PTR));
net_end(&con->net);
if (con->free_me)
my_free((gptr)con,MYF(0));
my_free((uchar*)con,MYF(0));
}

View file

@ -47,9 +47,9 @@ void Querycache_stream::store_short(ushort s)
cur_data+= 2;
return;
}
*cur_data= ((byte *)(&s))[0];
*cur_data= ((uchar *)(&s))[0];
use_next_block(TRUE);
*(cur_data++)= ((byte *)(&s))[1];
*(cur_data++)= ((uchar *)(&s))[1];
}
void Querycache_stream::store_int(uint i)
@ -100,7 +100,7 @@ void Querycache_stream::store_ll(ulonglong ll)
}
memcpy(cur_data, &ll, rest_len);
use_next_block(TRUE);
memcpy(cur_data, ((byte*)&ll)+rest_len, 8-rest_len);
memcpy(cur_data, ((uchar*)&ll)+rest_len, 8-rest_len);
cur_data+= 8-rest_len;
}
@ -165,9 +165,9 @@ ushort Querycache_stream::load_short()
cur_data+= 2;
return result;
}
((byte*)&result)[0]= *cur_data;
((uchar*)&result)[0]= *cur_data;
use_next_block(FALSE);
((byte*)&result)[1]= *(cur_data++);
((uchar*)&result)[1]= *(cur_data++);
return result;
}
@ -216,7 +216,7 @@ ulonglong Querycache_stream::load_ll()
}
memcpy(&result, cur_data, rest_len);
use_next_block(FALSE);
memcpy(((byte*)&result)+rest_len, cur_data, 8-rest_len);
memcpy(((uchar*)&result)+rest_len, cur_data, 8-rest_len);
cur_data+= 8-rest_len;
return result;
}
@ -245,7 +245,7 @@ char *Querycache_stream::load_str(MEM_ROOT *alloc, uint *str_len)
{
char *result;
*str_len= load_int();
if (!(result= alloc_root(alloc, *str_len + 1)))
if (!(result= (char*) alloc_root(alloc, *str_len + 1)))
return 0;
load_str_only(result, *str_len);
return result;
@ -259,7 +259,7 @@ int Querycache_stream::load_safe_str(MEM_ROOT *alloc, char **str, uint *str_len)
return 0;
}
(*str_len)--;
if (!(*str= alloc_root(alloc, *str_len + 1)))
if (!(*str= (char*) alloc_root(alloc, *str_len + 1)))
return 1;
load_str_only(*str, *str_len);
return 0;

View file

@ -15,8 +15,8 @@
class Querycache_stream
{
byte *cur_data;
byte *data_end;
uchar *cur_data;
uchar *data_end;
Query_cache_block *block;
uint headers_len;
public:
@ -27,7 +27,7 @@ public:
Querycache_stream(Query_cache_block *ini_block, uint ini_headers_len) :
block(ini_block), headers_len(ini_headers_len)
{
cur_data= ((byte*)block)+headers_len;
cur_data= ((uchar*)block)+headers_len;
data_end= cur_data + (block->used-headers_len);
#ifndef DBUG_OFF
first_block= ini_block;
@ -54,7 +54,7 @@ public:
else
DBUG_ASSERT(block->type == Query_cache_block::RES_CONT);
cur_data= ((byte*)block)+headers_len;
cur_data= ((uchar*)block)+headers_len;
data_end= cur_data + (block->used-headers_len);
}

View file

@ -68,13 +68,13 @@ void embedded_get_error(MYSQL *mysql, MYSQL_DATA *data)
net->last_errno= ei->last_errno;
strmake(net->last_error, ei->info, sizeof(net->last_error));
memcpy(net->sqlstate, ei->sqlstate, sizeof(net->sqlstate));
my_free((gptr) data, MYF(0));
my_free(data, MYF(0));
}
static my_bool
emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
const char *header, ulong header_length,
const char *arg, ulong arg_length, my_bool skip_check,
const uchar *header, ulong header_length,
const uchar *arg, ulong arg_length, my_bool skip_check,
MYSQL_STMT *stmt)
{
my_bool result= 1;
@ -180,7 +180,7 @@ static MYSQL_FIELD *emb_list_fields(MYSQL *mysql)
res= ((THD*) mysql->thd)->cur_data;
((THD*) mysql->thd)->cur_data= 0;
mysql->field_alloc= res->alloc;
my_free((gptr) res,MYF(0));
my_free(res,MYF(0));
mysql->status= MYSQL_STATUS_READY;
return mysql->fields;
}
@ -209,7 +209,7 @@ static my_bool emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
stmt->fields= mysql->fields;
stmt->mem_root= res->alloc;
mysql->fields= NULL;
my_free((gptr) res,MYF(0));
my_free(res,MYF(0));
}
return 0;
@ -265,7 +265,7 @@ static my_bool emb_read_query_result(MYSQL *mysql)
thd->cur_data= res;
}
else
my_free((gptr) res, MYF(0));
my_free(res, MYF(0));
return 0;
}
@ -273,7 +273,7 @@ static my_bool emb_read_query_result(MYSQL *mysql)
static int emb_stmt_execute(MYSQL_STMT *stmt)
{
DBUG_ENTER("emb_stmt_execute");
char header[5];
uchar header[5];
THD *thd;
my_bool res;
@ -1063,22 +1063,22 @@ bool Protocol_text::store_null()
return false;
}
bool Protocol::net_store_data(const char *from, uint length)
bool Protocol::net_store_data(const uchar *from, size_t length)
{
char *field_buf;
if (!thd->mysql) // bootstrap file handling
return false;
return FALSE;
if (!(field_buf=alloc_root(alloc, length + sizeof(uint) + 1)))
return true;
if (!(field_buf= (char*) alloc_root(alloc, length + sizeof(uint) + 1)))
return TRUE;
*(uint *)field_buf= length;
*next_field= field_buf + sizeof(uint);
memcpy(*next_field, from, length);
memcpy((uchar*) *next_field, from, length);
(*next_field)[length]= 0;
if (next_mysql_field->max_length < length)
next_mysql_field->max_length=length;
++next_field;
++next_mysql_field;
return false;
return FALSE;
}

View file

@ -71,7 +71,7 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(distdir)/std_data/ndb_backup50
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(distdir)/std_data/ndb_backup51
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib
-rm -rf `find $(distdir)/suite -type d -name SCCS`
-rm -rf `find $(distdir)/suite -type d -name SCCS` $(distdir)/suite/row_lock
install-data-local:
$(mkinstalldirs) \
@ -113,7 +113,7 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib
for f in `(cd $(srcdir); find suite -type f | grep -v SCCS)`; \
for f in `(cd $(srcdir); find suite -type f | egrep -v 'SCCS|row_lock')`; \
do \
d=$(DESTDIR)$(testdir)/`dirname $$f`; \
mkdir -p $$d ; \

View file

@ -1,3 +1,4 @@
--source include/have_log_bin.inc
--source include/not_embedded.inc
--source ./include/have_federated_db.inc

View file

@ -265,8 +265,13 @@ sub mtr_report_stats ($) {
else
{
# We report different types of problems in order
foreach my $pattern ( "^Warning:", "^Error:", "^==.* at 0x",
"InnoDB: Warning", "missing DBUG_RETURN",
foreach my $pattern ( "^Warning:",
"\\[Warning\\]",
"\\[ERROR\\]",
"^Error:", "^==.* at 0x",
"InnoDB: Warning",
"^safe_mutex:",
"missing DBUG_RETURN",
"mysqld: Warning",
"allocated at line",
"Attempting backtrace", "Assertion .* failed" )
@ -281,10 +286,69 @@ sub mtr_report_stats ($) {
while ( <ERR> )
{
# Skip some non fatal warnings from the log files
if ( /Warning:\s+Table:.* on (delete|rename)/ or
/Warning:\s+Setting lower_case_table_names=2/ or
/Warning:\s+One can only use the --user.*root/ or
/InnoDB: Warning: we did not need to do crash recovery/)
if (
/\"SELECT UNIX_TIMESTAMP\(\)\" failed on master/ or
/Aborted connection/ or
/Client requested master to start replication from impossible position/ or
/Could not find first log file name in binary log/ or
/Enabling keys got errno/ or
/Error reading master configuration/ or
/Error reading packet/ or
/Event Scheduler/ or
/Failed to open log/ or
/Failed to open the existing master info file/ or
/Forcing shutdown of [0-9]* plugins/ or
/Got error [0-9]* when reading table/ or
/Incorrect definition of table/ or
/Incorrect information in file/ or
/InnoDB: Warning: we did not need to do crash recovery/ or
/Invalid \(old\?\) table or database name/ or
/Lock wait timeout exceeded/ or
/Log entry on master is longer than max_allowed_packet/ or
/unknown option '--loose-/ or
/unknown variable 'loose-/ or
/You have forced lower_case_table_names to 0 through a command-line option/ or
/Setting lower_case_table_names=2/ or
/NDB Binlog:/ or
/NDB: failed to setup table/ or
/NDB: only row based binary logging/ or
/Neither --relay-log nor --relay-log-index were used/ or
/Query partially completed/ or
/Slave I.O thread aborted while waiting for relay log/ or
/Slave SQL thread is stopped because UNTIL condition/ or
/Slave SQL thread retried transaction/ or
/Slave \(additional info\)/ or
/Slave: .*Duplicate column name/ or
/Slave: .*master may suffer from/ or
/Slave: According to the master's version/ or
/Slave: Column [0-9]* type mismatch/ or
/Slave: Error .* doesn't exist/ or
/Slave: Error .*Deadlock found/ or
/Slave: Error .*Unknown table/ or
/Slave: Error in Write_rows event: / or
/Slave: Field .* of table .* has no default value/ or
/Slave: Query caused different errors on master and slave/ or
/Slave: Table .* doesn't exist/ or
/Slave: Table width mismatch/ or
/Slave: The incident LOST_EVENTS occured on the master/ or
/Slave: Unknown error.* 1105/ or
/Slave: Can't drop database.* database doesn't exist/ or
/Sort aborted/ or
/Time-out in NDB/ or
/Warning:\s+One can only use the --user.*root/ or
/Warning:\s+Setting lower_case_table_names=2/ or
/Warning:\s+Table:.* on (delete|rename)/ or
/You have an error in your SQL syntax/ or
/deprecated/ or
/description of time zone/ or
/equal MySQL server ids/ or
/error .*connecting to master/ or
/error reading log entry/ or
/lower_case_table_names is set/ or
/skip-name-resolve mode/ or
/slave SQL thread aborted/ or
/Slave: .*Duplicate entry/
)
{
next; # Skip these lines
}

View file

@ -629,6 +629,11 @@ else
TEST_MODE=`echo $TEST_MODE | sed 's/^ *//'`
fi
#
# Skip tests that doesn't work with shell version
#
SKIP_TEST="$SKIP_TEST bootstrap"
#++
# mysqld Environment Parameters
#--
@ -900,8 +905,8 @@ MYSQL_DUMP="$MYSQL_DUMP --no-defaults --debug-info -uroot --socket=$MASTER_MYSOC
MYSQL_SLAP="$MYSQL_SLAP -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSLAP_OPT"
MYSQL_DUMP_SLAVE="$MYSQL_DUMP_DIR --no-defaults -uroot --socket=$SLAVE_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_SHOW="$MYSQL_SHOW --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSHOW_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --debug-info --no-defaults --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_IMPORT="$MYSQL_IMPORT --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --debug-info --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_IMPORT="$MYSQL_IMPORT --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --no-defaults --debug-info --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_DUMP_SLAVE MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES MYSQL_IMPORT

View file

@ -3770,8 +3770,7 @@ sub mysqld_arguments ($$$$) {
"%s--log-slow-queries=%s-slow.log", $prefix, $log_base_path);
# Check if "extra_opt" contains --skip-log-bin
my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt);
my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt, @opt_extra_mysqld_opt);
if ( $mysqld->{'type'} eq 'master' )
{
if (! ($opt_skip_master_binlog || $skip_binlog) )

View file

@ -1,14 +1,12 @@
drop table if exists t1;
SHOW GLOBAL VARIABLES LIKE "%_format%";
SHOW GLOBAL VARIABLES WHERE Variable_name LIKE "%_format%" AND Variable_name != "binlog_format";
Variable_name Value
binlog_format <format>
date_format %d.%m.%Y
datetime_format %Y-%m-%d %H:%i:%s
default_week_format 0
time_format %H.%i.%s
SHOW SESSION VARIABLES LIKE "%_format%";
SHOW SESSION VARIABLES WHERE Variable_name LIKE "%_format%" AND Variable_name != "binlog_format";
Variable_name Value
binlog_format <format>
date_format %d.%m.%Y
datetime_format %Y-%m-%d %H:%i:%s
default_week_format 0
@ -30,9 +28,8 @@ set datetime_format= '%H:%i:%s %Y-%m-%d';
set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
set datetime_format= '%h:%i:%s %p %Y-%m-%d';
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
SHOW SESSION VARIABLES LIKE "%format";
SHOW SESSION VARIABLES WHERE Variable_name LIKE "%format" AND Variable_name != "binlog_format";
Variable_name Value
binlog_format <format>
date_format %m-%d-%Y
datetime_format %h:%i:%s.%f %p %Y-%m-%d
default_week_format 0

View file

@ -22,6 +22,11 @@ hex(inet_aton('127.1.1'))
select length(uuid()), charset(uuid()), length(unhex(replace(uuid(),_utf8'-',_utf8'')));
length(uuid()) charset(uuid()) length(unhex(replace(uuid(),_utf8'-',_utf8'')))
36 utf8 16
set @a= uuid_short();
set @b= uuid_short();
select cast(@a - @b as signed);
cast(@a - @b as signed)
-1
select length(format('nan', 2)) > 0;
length(format('nan', 2)) > 0
1

View file

@ -1,2 +1,2 @@
Variable_name Value
have_log_bin ON
log_bin ON

View file

@ -475,9 +475,24 @@ set sql_mode=16384+(65536*4);
select @@sql_mode;
@@sql_mode
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,NO_TABLE_OPTIONS,ANSI
set sql_mode=2147483648;
ERROR 42000: Variable 'sql_mode' can't be set to the value of '2147483648'
set sql_mode=2147483648*2;
ERROR 42000: Variable 'sql_mode' can't be set to the value of '4294967296'
select @@sql_mode;
@@sql_mode
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,NO_TABLE_OPTIONS,ANSI
set sql_mode=PAD_CHAR_TO_FULL_LENGTH;
create table t1 (a int auto_increment primary key, b char(5));
insert into t1 (b) values('a'),('b\t'),('c ');
select concat('x',b,'x') from t1;
concat('x',b,'x')
xa x
xb x
xc x
set sql_mode=0;
select concat('x',b,'x') from t1;
concat('x',b,'x')
xax
xb x
xcx
drop table t1;
SET @@SQL_MODE=@OLD_SQL_MODE;

View file

@ -6,10 +6,8 @@
drop table if exists t1;
--enable_warnings
--replace_result ROW <format> STATEMENT <format> MIXED <format>
SHOW GLOBAL VARIABLES LIKE "%_format%";
--replace_result ROW <format> STATEMENT <format> MIXED <format>
SHOW SESSION VARIABLES LIKE "%_format%";
SHOW GLOBAL VARIABLES WHERE Variable_name LIKE "%_format%" AND Variable_name != "binlog_format";
SHOW SESSION VARIABLES WHERE Variable_name LIKE "%_format%" AND Variable_name != "binlog_format";
#
# Test setting a lot of different formats to see which formats are accepted and
@ -36,8 +34,7 @@ set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
set datetime_format= '%h:%i:%s %p %Y-%m-%d';
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
--replace_result ROW <format> STATEMENT <format> MIXED <format>
SHOW SESSION VARIABLES LIKE "%format";
SHOW SESSION VARIABLES WHERE Variable_name LIKE "%format" AND Variable_name != "binlog_format";
--error 1231
SET time_format='%h:%i:%s';

View file

@ -15,6 +15,9 @@ im_options : Bug#20294 2006-07-24 stewart Instance manager test
im_daemon_life_cycle : Bug#20294 2007-05-14 alik Instance manager tests fail randomly
im_cmd_line : Bug#20294 2007-05-14 alik Instance manager tests fail randomly
im_life_cycle : BUG#27851 Instance manager dies on ASSERT in ~Thread_registry() or from not being able to close a mysqld instance.
im_instance_conf : BUG#28743 Instance manager generates warnings in test suite
im_utils : BUG#28743 Instance manager generates warnings in test suite
concurrent_innodb : BUG#21579 2006-08-11 mleich innodb_concurrent random failures with varying differences
ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog

View file

@ -3,6 +3,8 @@
# We verify that we did not introduce a deadlock.
# This is intended to mimick how mysqldump and innobackup work.
-- source include/have_log_bin.inc
# And it requires InnoDB
-- source include/not_embedded.inc
-- source include/have_innodb.inc

View file

@ -14,6 +14,12 @@ select hex(inet_aton('127.1.1'));
select length(uuid()), charset(uuid()), length(unhex(replace(uuid(),_utf8'-',_utf8'')));
# As we can assume we are the only user for the mysqld server, the difference
# between two calls should be -1
set @a= uuid_short();
set @b= uuid_short();
select cast(@a - @b as signed);
#
# Test for core dump with nan
#

View file

@ -2,6 +2,8 @@
# TODO: Need to look at making a row based version once the new row based client is completed. [jbm]
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/have_log_bin.inc
# Embedded server doesn't support binlogging
-- source include/not_embedded.inc

View file

@ -1,6 +1,9 @@
# Embedded server doesn't support external clients
--source include/not_embedded.inc
# Binlog is required
--source include/have_log_bin.inc
--disable_warnings
DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3;
drop database if exists mysqldump_test_db;

View file

@ -1,3 +1,5 @@
-- source include/have_log_bin.inc
# This test should work in embedded server after mysqltest is fixed
-- source include/not_embedded.inc

View file

@ -1,4 +1,5 @@
-- source include/not_embedded.inc
-- source include/have_log_bin.inc
#
# SQL Syntax for Prepared Statements test
#

View file

@ -2,6 +2,7 @@
# tests that require InnoDB...
#
-- source include/have_log_bin.inc
-- source include/have_innodb.inc
--disable_warnings

View file

@ -264,7 +264,18 @@ select @@sql_mode;
set sql_mode=16384+(65536*4);
select @@sql_mode;
--error 1231
set sql_mode=2147483648; # that mode does not exist
set sql_mode=2147483648*2; # that mode does not exist
select @@sql_mode;
#
# Test WL921: Retain spaces when retrieving CHAR column values
set sql_mode=PAD_CHAR_TO_FULL_LENGTH;
create table t1 (a int auto_increment primary key, b char(5));
insert into t1 (b) values('a'),('b\t'),('c ');
select concat('x',b,'x') from t1;
set sql_mode=0;
select concat('x',b,'x') from t1;
drop table t1;
SET @@SQL_MODE=@OLD_SQL_MODE;

View file

@ -3,6 +3,7 @@
# TODO: Create row based version once $MYSQL_BINLOG has new RB version
# Embedded server does not support binlogging
--source include/not_embedded.inc
--source include/have_log_bin.inc
# Check that user variables are binlogged correctly (BUG#3875)
create table t1 (a varchar(50));

View file

@ -41,8 +41,8 @@
*/
my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
void *init_buffer, uint init_alloc,
uint alloc_increment CALLER_INFO_PROTO)
void *init_buffer, uint init_alloc,
uint alloc_increment CALLER_INFO_PROTO)
{
DBUG_ENTER("init_dynamic_array");
if (!alloc_increment)
@ -63,7 +63,7 @@ my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
array->size_of_element=element_size;
if ((array->buffer= init_buffer))
DBUG_RETURN(FALSE);
if (!(array->buffer=(char*) my_malloc_ci(element_size*init_alloc,MYF(MY_WME))))
if (!(array->buffer=(uchar*) my_malloc_ci(element_size*init_alloc,MYF(MY_WME))))
{
array->max_element=0;
DBUG_RETURN(TRUE);
@ -72,8 +72,8 @@ my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
}
my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
uint init_alloc,
uint alloc_increment CALLER_INFO_PROTO)
uint init_alloc,
uint alloc_increment CALLER_INFO_PROTO)
{
/* placeholder to preserve ABI */
return my_init_dynamic_array_ci(array, element_size, init_alloc,
@ -92,9 +92,9 @@ my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
FALSE Ok
*/
my_bool insert_dynamic(DYNAMIC_ARRAY *array, gptr element)
my_bool insert_dynamic(DYNAMIC_ARRAY *array, uchar* element)
{
gptr buffer;
uchar* buffer;
if (array->elements == array->max_element)
{ /* Call only when nessesary */
if (!(buffer=alloc_dynamic(array)))
@ -127,32 +127,32 @@ my_bool insert_dynamic(DYNAMIC_ARRAY *array, gptr element)
0 Error
*/
byte *alloc_dynamic(DYNAMIC_ARRAY *array)
uchar *alloc_dynamic(DYNAMIC_ARRAY *array)
{
if (array->elements == array->max_element)
{
char *new_ptr;
if (array->buffer == (char *)(array + 1))
if (array->buffer == (uchar *)(array + 1))
{
/*
In this senerio, the buffer is statically preallocated,
so we have to create an all-new malloc since we overflowed
*/
if (!(new_ptr= (char *) my_malloc((array->max_element+
array->alloc_increment) *
array->size_of_element,
MYF(MY_WME))))
array->alloc_increment) *
array->size_of_element,
MYF(MY_WME))))
return 0;
memcpy(new_ptr, array->buffer,
array->elements * array->size_of_element);
}
else
if (!(new_ptr=(char*) my_realloc(array->buffer,(array->max_element+
array->alloc_increment)*
array->size_of_element,
MYF(MY_WME | MY_ALLOW_ZERO_PTR))))
array->alloc_increment)*
array->size_of_element,
MYF(MY_WME | MY_ALLOW_ZERO_PTR))))
return 0;
array->buffer=new_ptr;
array->buffer= (uchar*) new_ptr;
array->max_element+=array->alloc_increment;
}
return array->buffer+(array->elements++ * array->size_of_element);
@ -171,7 +171,7 @@ byte *alloc_dynamic(DYNAMIC_ARRAY *array)
0 Array is empty
*/
byte *pop_dynamic(DYNAMIC_ARRAY *array)
uchar *pop_dynamic(DYNAMIC_ARRAY *array)
{
if (array->elements)
return array->buffer+(--array->elements * array->size_of_element);
@ -196,7 +196,7 @@ byte *pop_dynamic(DYNAMIC_ARRAY *array)
FALSE Ok
*/
my_bool set_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
my_bool set_dynamic(DYNAMIC_ARRAY *array, uchar* element, uint idx)
{
if (idx >= array->elements)
{
@ -206,33 +206,33 @@ my_bool set_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
char *new_ptr;
size=(idx+array->alloc_increment)/array->alloc_increment;
size*= array->alloc_increment;
if (array->buffer == (char *)(array + 1))
if (array->buffer == (uchar *)(array + 1))
{
/*
In this senerio, the buffer is statically preallocated,
so we have to create an all-new malloc since we overflowed
*/
if (!(new_ptr= (char *) my_malloc(size *
array->size_of_element,
MYF(MY_WME))))
array->size_of_element,
MYF(MY_WME))))
return 0;
memcpy(new_ptr, array->buffer,
array->elements * array->size_of_element);
}
else
if (!(new_ptr=(char*) my_realloc(array->buffer,size*
array->size_of_element,
MYF(MY_WME | MY_ALLOW_ZERO_PTR))))
array->size_of_element,
MYF(MY_WME | MY_ALLOW_ZERO_PTR))))
return TRUE;
array->buffer=new_ptr;
array->buffer= (uchar*) new_ptr;
array->max_element=size;
}
bzero((gptr) (array->buffer+array->elements*array->size_of_element),
(idx - array->elements)*array->size_of_element);
bzero((uchar*) (array->buffer+array->elements*array->size_of_element),
(idx - array->elements)*array->size_of_element);
array->elements=idx+1;
}
memcpy(array->buffer+(idx * array->size_of_element),element,
(size_t) array->size_of_element);
(size_t) array->size_of_element);
return FALSE;
}
@ -242,21 +242,21 @@ my_bool set_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
SYNOPSIS
get_dynamic()
array
gptr Element to be returned. If idx > elements contain zeroes.
uchar* Element to be returned. If idx > elements contain zeroes.
idx Index of element wanted.
*/
void get_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
void get_dynamic(DYNAMIC_ARRAY *array, uchar* element, uint idx)
{
if (idx >= array->elements)
{
DBUG_PRINT("warning",("To big array idx: %d, array size is %d",
idx,array->elements));
idx,array->elements));
bzero(element,array->size_of_element);
return;
}
memcpy(element,array->buffer+idx*array->size_of_element,
(size_t) array->size_of_element);
(size_t) array->size_of_element);
}
@ -273,7 +273,7 @@ void delete_dynamic(DYNAMIC_ARRAY *array)
/*
Just mark as empty if we are using a static buffer
*/
if (array->buffer == (char *)(array + 1))
if (array->buffer == (uchar *)(array + 1))
array->elements= 0;
else
if (array->buffer)
@ -290,15 +290,15 @@ void delete_dynamic(DYNAMIC_ARRAY *array)
SYNOPSIS
delete_dynamic_element()
array
idx Index of element to be deleted
idx Index of element to be deleted
*/
void delete_dynamic_element(DYNAMIC_ARRAY *array, uint idx)
{
char *ptr=array->buffer+array->size_of_element*idx;
char *ptr= (char*) array->buffer+array->size_of_element*idx;
array->elements--;
memmove(ptr,ptr+array->size_of_element,
(array->elements-idx)*array->size_of_element);
(array->elements-idx)*array->size_of_element);
}
@ -318,14 +318,14 @@ void freeze_size(DYNAMIC_ARRAY *array)
/*
Do nothing if we are using a static buffer
*/
if (array->buffer == (char *)(array + 1))
if (array->buffer == (uchar *)(array + 1))
return;
if (array->buffer && array->max_element != elements)
{
array->buffer=(char*) my_realloc(array->buffer,
elements*array->size_of_element,
MYF(MY_WME));
array->buffer=(uchar*) my_realloc(array->buffer,
elements*array->size_of_element,
MYF(MY_WME));
array->max_element=elements;
}
}
@ -341,7 +341,7 @@ void freeze_size(DYNAMIC_ARRAY *array)
*/
int get_index_dynamic(DYNAMIC_ARRAY *array, gptr element)
int get_index_dynamic(DYNAMIC_ARRAY *array, uchar* element)
{
uint ret;
if (array->buffer > element)

View file

@ -376,7 +376,7 @@ void add_compiled_collation(CHARSET_INFO *cs)
cs->state|= MY_CS_AVAILABLE;
}
static void *cs_alloc(uint size)
static void *cs_alloc(size_t size)
{
return my_once_alloc(size, MYF(MY_WME));
}
@ -594,13 +594,13 @@ CHARSET_INFO *get_charset_by_csname(const char *cs_name,
"big enough"
RETURN VALUES
~0 The escaped string did not fit in the to buffer
>=0 The length of the escaped string
(size_t) -1 The escaped string did not fit in the to buffer
# The length of the escaped string
*/
ulong escape_string_for_mysql(CHARSET_INFO *charset_info,
char *to, ulong to_length,
const char *from, ulong length)
size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
char *to, size_t to_length,
const char *from, size_t length)
{
const char *to_start= to;
const char *end, *to_end=to_start + (to_length ? to_length-1 : 2*length);
@ -684,7 +684,7 @@ ulong escape_string_for_mysql(CHARSET_INFO *charset_info,
}
}
*to= 0;
return overflow ? (ulong)~0 : (ulong) (to - to_start);
return overflow ? (size_t) -1 : (size_t) (to - to_start);
}
@ -738,9 +738,9 @@ CHARSET_INFO *fs_character_set()
>=0 The length of the escaped string
*/
ulong escape_quotes_for_mysql(CHARSET_INFO *charset_info,
char *to, ulong to_length,
const char *from, ulong length)
size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info,
char *to, size_t to_length,
const char *from, size_t length)
{
const char *to_start= to;
const char *end, *to_end=to_start + (to_length ? to_length-1 : 2*length);

View file

@ -15,7 +15,8 @@
#include <my_global.h>
#include "my_sys.h"
#include <my_sys.h>
#include <zlib.h>
/*
Calculate a long checksum for a memoryblock.
@ -27,15 +28,15 @@
length length of the block
*/
ha_checksum my_checksum(ha_checksum crc, const byte *pos, uint length)
ha_checksum my_checksum(ha_checksum crc, const uchar *pos, size_t length)
{
#ifdef NOT_USED
const byte *end=pos+length;
const uchar *end=pos+length;
for ( ; pos != end ; pos++)
crc=((crc << 8) + *((uchar*) pos)) + (crc >> (8*sizeof(ha_checksum)-8));
return crc;
#else
return (ha_checksum)crc32((uint)crc, (const uchar *)pos, length);
return (ha_checksum)crc32((uint)crc, pos, length);
#endif
}

View file

@ -268,9 +268,9 @@ static int handle_default_option(void *in_ctx, const char *group_name,
if (find_type((char *)group_name, ctx->group, 3))
{
if (!(tmp= alloc_root(ctx->alloc, (uint) strlen(option) + 1)))
if (!(tmp= alloc_root(ctx->alloc, strlen(option) + 1)))
return 1;
if (insert_dynamic(ctx->args, (gptr) &tmp))
if (insert_dynamic(ctx->args, (uchar*) &tmp))
return 1;
strmov(tmp, option);
}
@ -426,7 +426,7 @@ int load_defaults(const char *conf_file, const char **groups,
/* copy name + found arguments + command line arguments to new array */
res[0]= argv[0][0]; /* Name MUST be set, even by embedded library */
memcpy((gptr) (res+1), args.buffer, args.elements*sizeof(char*));
memcpy((uchar*) (res+1), args.buffer, args.elements*sizeof(char*));
/* Skip --defaults-xxx options */
(*argc)-= args_used;
(*argv)+= args_used;
@ -442,7 +442,7 @@ int load_defaults(const char *conf_file, const char **groups,
}
if (*argc)
memcpy((gptr) (res+1+args.elements), (char*) ((*argv)+1),
memcpy((uchar*) (res+1+args.elements), (char*) ((*argv)+1),
(*argc-1)*sizeof(char*));
res[args.elements+ *argc]=0; /* last null */
@ -514,7 +514,7 @@ static int search_default_file(Process_option_func opt_handler,
# Returns pointer to the argument after the keyword.
*/
static char *get_argument(const char *keyword, uint kwlen,
static char *get_argument(const char *keyword, size_t kwlen,
char *ptr, char *name, uint line)
{
char *end;
@ -718,10 +718,11 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
name,line);
goto err;
}
for ( ; my_isspace(&my_charset_latin1,end[-1]) ; end--) ;/* Remove end space */
/* Remove end space */
for ( ; my_isspace(&my_charset_latin1,end[-1]) ; end--) ;
end[0]=0;
strnmov(curr_gr, ptr, min((uint) (end-ptr)+1, 4096));
strmake(curr_gr, ptr, min((size_t) (end-ptr)+1, sizeof(curr_gr)-1));
/* signal that a new group is found */
opt_handler(handler_ctx, curr_gr, NULL);
@ -743,7 +744,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
for ( ; my_isspace(&my_charset_latin1,end[-1]) ; end--) ;
if (!value)
{
strmake(strmov(option,"--"),ptr,(uint) (end-ptr));
strmake(strmov(option,"--"),ptr, (size_t) (end-ptr));
if (opt_handler(handler_ctx, curr_gr, option))
goto err;
}
@ -769,7 +770,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
value++;
value_end--;
}
ptr=strnmov(strmov(option,"--"),ptr,(uint) (end-ptr));
ptr=strnmov(strmov(option,"--"),ptr,(size_t) (end-ptr));
*ptr++= '=';
for ( ; value != value_end; value++)
@ -931,9 +932,9 @@ void print_defaults(const char *conf_file, const char **groups)
typedef UINT (WINAPI *GET_SYSTEM_WINDOWS_DIRECTORY)(LPSTR, UINT);
static uint my_get_system_windows_directory(char *buffer, uint size)
static size_t my_get_system_windows_directory(char *buffer, size_t size)
{
uint count;
size_t count;
GET_SYSTEM_WINDOWS_DIRECTORY
func_ptr= (GET_SYSTEM_WINDOWS_DIRECTORY)
GetProcAddress(GetModuleHandle("kernel32.dll"),

View file

@ -68,9 +68,8 @@ int modify_defaults_file(const char *file_location, const char *option,
FILE *cnf_file;
MY_STAT file_stat;
char linebuff[BUFF_SIZE], *src_ptr, *dst_ptr, *file_buffer;
uint opt_len= 0;
uint optval_len= 0;
uint sect_len, nr_newlines= 0, buffer_size;
size_t opt_len= 0, optval_len= 0, sect_len;
uint nr_newlines= 0, buffer_size;
my_bool in_section= FALSE, opt_applied= 0;
uint reserve_extended;
uint new_opt_len;
@ -86,8 +85,8 @@ int modify_defaults_file(const char *file_location, const char *option,
if (option && option_value)
{
opt_len= (uint) strlen(option);
optval_len= (uint) strlen(option_value);
opt_len= strlen(option);
optval_len= strlen(option_value);
}
new_opt_len= opt_len + 1 + optval_len + NEWLINE_LEN;
@ -110,7 +109,7 @@ int modify_defaults_file(const char *file_location, const char *option,
MYF(MY_WME))))
goto malloc_err;
sect_len= (uint) strlen(section_name);
sect_len= strlen(section_name);
for (dst_ptr= file_buffer; fgets(linebuff, BUFF_SIZE, cnf_file); )
{
@ -219,7 +218,7 @@ int modify_defaults_file(const char *file_location, const char *option,
if (my_chsize(fileno(cnf_file), (my_off_t) (dst_ptr - file_buffer), 0,
MYF(MY_WME)) ||
my_fseek(cnf_file, 0, MY_SEEK_SET, MYF(0)) ||
my_fwrite(cnf_file, file_buffer, (uint) (dst_ptr - file_buffer),
my_fwrite(cnf_file, file_buffer, (size_t) (dst_ptr - file_buffer),
MYF(MY_NABP)))
goto err;
}

View file

@ -30,15 +30,15 @@
typedef struct st_hash_info {
uint next; /* index to next key */
byte *data; /* data for current entry */
uchar *data; /* data for current entry */
} HASH_LINK;
static uint hash_mask(uint hashnr,uint buffmax,uint maxlength);
static void movelink(HASH_LINK *array,uint pos,uint next_link,uint newlink);
static int hashcmp(const HASH *hash, HASH_LINK *pos, const byte *key,
uint length);
static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key,
size_t length);
static uint calc_hash(const HASH *hash, const byte *key, uint length)
static uint calc_hash(const HASH *hash, const uchar *key, size_t length)
{
ulong nr1=1, nr2=4;
hash->charset->coll->hash_sort(hash->charset,(uchar*) key,length,&nr1,&nr2);
@ -47,12 +47,12 @@ static uint calc_hash(const HASH *hash, const byte *key, uint length)
my_bool
_hash_init(HASH *hash,CHARSET_INFO *charset,
uint size,uint key_offset,uint key_length,
ulong size, size_t key_offset, size_t key_length,
hash_get_key get_key,
void (*free_element)(void*),uint flags CALLER_INFO_PROTO)
{
DBUG_ENTER("hash_init");
DBUG_PRINT("enter",("hash: 0x%lx size: %d", (long) hash, size));
DBUG_PRINT("enter",("hash: 0x%lx size: %u", (long) hash, (uint) size));
hash->records=0;
if (my_init_dynamic_array_ci(&hash->array,sizeof(HASH_LINK),size,0))
@ -140,18 +140,18 @@ void my_hash_reset(HASH *hash)
/* some helper functions */
/*
This function is char* instead of byte* as HPUX11 compiler can't
This function is char* instead of uchar* as HPUX11 compiler can't
handle inline functions that are not defined as native types
*/
static inline char*
hash_key(const HASH *hash, const byte *record, uint *length,
hash_key(const HASH *hash, const uchar *record, size_t *length,
my_bool first)
{
if (hash->get_key)
return (*hash->get_key)(record,length,first);
*length=hash->key_length;
return (byte*) record+hash->key_offset;
return (uchar*) record+hash->key_offset;
}
/* Calculate pos according to keys */
@ -165,8 +165,8 @@ static uint hash_mask(uint hashnr,uint buffmax,uint maxlength)
static uint hash_rec_mask(const HASH *hash, HASH_LINK *pos,
uint buffmax, uint maxlength)
{
uint length;
byte *key= (byte*) hash_key(hash,pos->data,&length,0);
size_t length;
uchar *key= (uchar*) hash_key(hash,pos->data,&length,0);
return hash_mask(calc_hash(hash,key,length),buffmax,maxlength);
}
@ -177,15 +177,15 @@ static
#if !defined(__USLC__) && !defined(__sgi)
inline
#endif
unsigned int rec_hashnr(HASH *hash,const byte *record)
unsigned int rec_hashnr(HASH *hash,const uchar *record)
{
uint length;
byte *key= (byte*) hash_key(hash,record,&length,0);
size_t length;
uchar *key= (uchar*) hash_key(hash,record,&length,0);
return calc_hash(hash,key,length);
}
gptr hash_search(const HASH *hash, const byte *key, uint length)
uchar* hash_search(const HASH *hash, const uchar *key, size_t length)
{
HASH_SEARCH_STATE state;
return hash_first(hash, key, length, &state);
@ -198,7 +198,7 @@ gptr hash_search(const HASH *hash, const byte *key, uint length)
Assigns the number of the found record to HASH_SEARCH_STATE state
*/
gptr hash_first(const HASH *hash, const byte *key, uint length,
uchar* hash_first(const HASH *hash, const uchar *key, size_t length,
HASH_SEARCH_STATE *current_record)
{
HASH_LINK *pos;
@ -235,7 +235,7 @@ gptr hash_first(const HASH *hash, const byte *key, uint length,
/* Get next record with identical key */
/* Can only be called if previous calls was hash_search */
gptr hash_next(const HASH *hash, const byte *key, uint length,
uchar* hash_next(const HASH *hash, const uchar *key, size_t length,
HASH_SEARCH_STATE *current_record)
{
HASH_LINK *pos;
@ -292,11 +292,11 @@ static void movelink(HASH_LINK *array,uint find,uint next_link,uint newlink)
!= 0 key of record != key
*/
static int hashcmp(const HASH *hash, HASH_LINK *pos, const byte *key,
uint length)
static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key,
size_t length)
{
uint rec_keylength;
byte *rec_key= (byte*) hash_key(hash,pos->data,&rec_keylength,1);
size_t rec_keylength;
uchar *rec_key= (uchar*) hash_key(hash,pos->data,&rec_keylength,1);
return ((length && length != rec_keylength) ||
my_strnncoll(hash->charset, (uchar*) rec_key, rec_keylength,
(uchar*) key, rec_keylength));
@ -305,11 +305,12 @@ static int hashcmp(const HASH *hash, HASH_LINK *pos, const byte *key,
/* Write a hash-key to the hash-index */
my_bool my_hash_insert(HASH *info,const byte *record)
my_bool my_hash_insert(HASH *info,const uchar *record)
{
int flag;
uint halfbuff,hash_nr,first_index,idx;
byte *ptr_to_rec,*ptr_to_rec2;
size_t idx;
uint halfbuff,hash_nr,first_index;
uchar *ptr_to_rec,*ptr_to_rec2;
HASH_LINK *data,*empty,*gpos,*gpos2,*pos;
LINT_INIT(gpos); LINT_INIT(gpos2);
@ -317,7 +318,7 @@ my_bool my_hash_insert(HASH *info,const byte *record)
if (HASH_UNIQUE & info->flags)
{
byte *key= (byte*) hash_key(info, record, &idx, 1);
char *key= (char*) hash_key(info, record, &idx, 1);
if (hash_search(info, key, idx))
return(TRUE); /* Duplicate entry */
}
@ -364,7 +365,7 @@ my_bool my_hash_insert(HASH *info,const byte *record)
{
/* Change link of previous LOW-key */
gpos->data=ptr_to_rec;
gpos->next=(uint) (pos-data);
gpos->next= (uint) (pos-data);
flag= (flag & HIGHFIND) | (LOWFIND | LOWUSED);
}
gpos=pos;
@ -413,7 +414,7 @@ my_bool my_hash_insert(HASH *info,const byte *record)
pos=data+idx;
if (pos == empty)
{
pos->data=(byte*) record;
pos->data=(uchar*) record;
pos->next=NO_RECORD;
}
else
@ -423,12 +424,12 @@ my_bool my_hash_insert(HASH *info,const byte *record)
gpos=data+hash_rec_mask(info,pos,info->blength,info->records+1);
if (pos == gpos)
{
pos->data=(byte*) record;
pos->data=(uchar*) record;
pos->next=(uint) (empty - data);
}
else
{
pos->data=(byte*) record;
pos->data=(uchar*) record;
pos->next=NO_RECORD;
movelink(data,(uint) (pos-data),(uint) (gpos-data),(uint) (empty-data));
}
@ -445,7 +446,7 @@ my_bool my_hash_insert(HASH *info,const byte *record)
** if there is a free-function it's called for record if found
******************************************************************************/
my_bool hash_delete(HASH *hash,byte *record)
my_bool hash_delete(HASH *hash,uchar *record)
{
uint blength,pos2,pos_hashnr,lastpos_hashnr,idx,empty_index;
HASH_LINK *data,*lastpos,*gpos,*pos,*pos3,*empty;
@ -523,7 +524,7 @@ my_bool hash_delete(HASH *hash,byte *record)
exit:
VOID(pop_dynamic(&hash->array));
if (hash->free)
(*hash->free)((byte*) record);
(*hash->free)((uchar*) record);
DBUG_RETURN(0);
}
@ -532,20 +533,22 @@ exit:
This is much more efficent than using a delete & insert.
*/
my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length)
my_bool hash_update(HASH *hash, uchar *record, uchar *old_key,
size_t old_key_length)
{
uint idx,new_index,new_pos_index,blength,records,empty;
uint new_index,new_pos_index,blength,records,empty;
size_t idx;
HASH_LINK org_link,*data,*previous,*pos;
DBUG_ENTER("hash_update");
if (HASH_UNIQUE & hash->flags)
{
HASH_SEARCH_STATE state;
byte *found, *new_key= hash_key(hash, record, &idx, 1);
char *found, *new_key= hash_key(hash, record, &idx, 1);
if ((found= hash_first(hash, new_key, idx, &state)))
do
{
if (found != record)
if (found != (char*) record)
DBUG_RETURN(1); /* Duplicate entry */
}
while ((found= hash_next(hash, new_key, idx, &state)));
@ -609,7 +612,7 @@ my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length)
}
byte *hash_element(HASH *hash,uint idx)
uchar *hash_element(HASH *hash,ulong idx)
{
if (idx < hash->records)
return dynamic_element(&hash->array,idx,HASH_LINK*)->data;
@ -622,7 +625,7 @@ byte *hash_element(HASH *hash,uint idx)
isn't changed
*/
void hash_replace(HASH *hash, HASH_SEARCH_STATE *current_record, byte *new_row)
void hash_replace(HASH *hash, HASH_SEARCH_STATE *current_record, uchar *new_row)
{
if (*current_record != NO_RECORD) /* Safety */
dynamic_element(&hash->array, *current_record, HASH_LINK*)->data= new_row;

View file

@ -61,8 +61,8 @@ void list_free(LIST *root, uint free_data)
{
next=root->next;
if (free_data)
my_free((gptr) root->data,MYF(0));
my_free((gptr) root,MYF(0));
my_free((uchar*) root->data,MYF(0));
my_free((uchar*) root,MYF(0));
root=next;
}
}
@ -101,7 +101,7 @@ uint list_length(LIST *list)
}
int list_walk(LIST *list, list_walk_action action, gptr argument)
int list_walk(LIST *list, list_walk_action action, uchar* argument)
{
int error=0;
while (list)

View file

@ -58,7 +58,7 @@ static my_bool cache_remove_open_tmp(IO_CACHE *cache __attribute__((unused)),
*/
my_bool open_cached_file(IO_CACHE *cache, const char* dir, const char *prefix,
uint cache_size, myf cache_myflags)
size_t cache_size, myf cache_myflags)
{
DBUG_ENTER("open_cached_file");
cache->dir= dir ? my_strdup(dir,MYF(cache_myflags & MY_WME)) : (char*) 0;

View file

@ -18,9 +18,9 @@
/* Functions definied in this file */
uint dirname_length(const char *name)
size_t dirname_length(const char *name)
{
register my_string pos,gpos;
register char *pos, *gpos;
#ifdef BASKSLASH_MBTAIL
CHARSET_INFO *fs= fs_character_set();
#endif
@ -47,21 +47,31 @@ uint dirname_length(const char *name)
)
gpos=pos;
}
return ((uint) (uint) (gpos+1-(char*) name));
return (size_t) (gpos+1-(char*) name);
}
/* Gives directory part of filename. Directory ends with '/' */
/* Returns length of directory part */
/*
Gives directory part of filename. Directory ends with '/'
uint dirname_part(my_string to, const char *name)
SYNOPSIS
dirname_part()
to Store directory name here
name Original name
to_length Store length of 'to' here
RETURN
# Length of directory part in 'name'
*/
size_t dirname_part(char *to, const char *name, size_t *to_res_length)
{
uint length;
size_t length;
DBUG_ENTER("dirname_part");
DBUG_PRINT("enter",("'%s'",name));
length=dirname_length(name);
convert_dirname(to, name, name+length);
*to_res_length= (size_t) (convert_dirname(to, name, name+length) - to);
DBUG_RETURN(length);
} /* dirname */
@ -142,7 +152,7 @@ char *convert_dirname(char *to, const char *from, const char *from_end)
}
#else
/* This is ok even if to == from, becasue we need to cut the string */
to= strmake(to, from, (uint) (from_end-from));
to= strmake(to, from, (size_t) (from_end-from));
#endif
/* Add FN_LIBCHAR to the end of directory path */

View file

@ -33,21 +33,22 @@
points at the end ASCII(0) of the filename.
*/
my_string fn_ext(const char *name)
char *fn_ext(const char *name)
{
register my_string pos,gpos;
register const char *pos, *gpos;
DBUG_ENTER("fn_ext");
DBUG_PRINT("mfunkt",("name: '%s'",name));
#if defined(FN_DEVCHAR) || defined(FN_C_AFTER_DIR) || defined(BASKSLASH_MBTAIL)
{
char buff[FN_REFLEN];
gpos=(my_string) name+dirname_part(buff,(char*) name);
size_t res_length;
gpos= name+ dirname_part(buff,(char*) name, &res_length);
}
#else
if (!(gpos= strrchr(name, FN_LIBCHAR)))
gpos= (my_string) name;
gpos= name;
#endif
pos=strchr(gpos,FN_EXTCHAR);
DBUG_RETURN (pos ? pos : strend(gpos));
DBUG_RETURN((char*) (pos ? pos : strend(gpos)));
} /* fn_ext */

View file

@ -23,18 +23,19 @@
The arguments should be in unix format.
*/
my_string fn_format(my_string to, const char *name, const char *dir,
char * fn_format(char * to, const char *name, const char *dir,
const char *extension, uint flag)
{
reg1 uint length;
char dev[FN_REFLEN], buff[FN_REFLEN], *pos, *startpos;
const char *ext;
reg1 size_t length;
size_t dev_length;
DBUG_ENTER("fn_format");
DBUG_PRINT("enter",("name: %s dir: %s extension: %s flag: %d",
name,dir,extension,flag));
/* Copy and skip directory */
name+=(length=dirname_part(dev,(startpos=(my_string) name)));
name+=(length=dirname_part(dev, (startpos=(char *) name), &dev_length));
if (length == 0 || (flag & MY_REPLACE_DIR))
{
/* Use given directory */
@ -63,7 +64,7 @@ my_string fn_format(my_string to, const char *name, const char *dir,
}
else
{
length=(uint) (pos-(char*) name); /* Change extension */
length= (size_t) (pos-(char*) name); /* Change extension */
ext= extension;
}
}
@ -76,18 +77,19 @@ my_string fn_format(my_string to, const char *name, const char *dir,
if (strlen(dev)+length+strlen(ext) >= FN_REFLEN || length >= FN_LEN )
{
/* To long path, return original or NULL */
uint tmp_length;
size_t tmp_length;
if (flag & MY_SAFE_PATH)
return NullS;
tmp_length=strlength(startpos);
DBUG_PRINT("error",("dev: '%s' ext: '%s' length: %d",dev,ext,length));
tmp_length= strlength(startpos);
DBUG_PRINT("error",("dev: '%s' ext: '%s' length: %u",dev,ext,
(uint) length));
(void) strmake(to,startpos,min(tmp_length,FN_REFLEN-1));
}
else
{
if (to == startpos)
{
bmove(buff,(char*) name,length); /* Save name for last copy */
bmove(buff,(uchar*) name,length); /* Save name for last copy */
name=buff;
}
pos=strmake(strmov(to,dev),name,length);
@ -109,18 +111,18 @@ my_string fn_format(my_string to, const char *name, const char *dir,
} /* fn_format */
/*
strlength(const string str)
Return length of string with end-space:s not counted.
*/
/*
strlength(const string str)
Return length of string with end-space:s not counted.
*/
size_s strlength(const char *str)
size_t strlength(const char *str)
{
reg1 my_string pos;
reg2 my_string found;
reg1 const char * pos;
reg2 const char * found;
DBUG_ENTER("strlength");
pos=found=(char*) str;
pos= found= str;
while (*pos)
{
@ -136,5 +138,5 @@ size_s strlength(const char *str)
found=pos;
while (*++pos == ' ') {};
}
DBUG_RETURN((size_s) (found-(char*) str));
DBUG_RETURN((size_t) (found - str));
} /* strlength */

View file

@ -34,7 +34,7 @@
*/
void get_date(register my_string to, int flag, time_t date)
void get_date(register char * to, int flag, time_t date)
{
reg2 struct tm *start_time;
time_t skr;

View file

@ -152,11 +152,11 @@ init_functions(IO_CACHE* info)
# error
*/
int init_io_cache(IO_CACHE *info, File file, uint cachesize,
int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
enum cache_type type, my_off_t seek_offset,
pbool use_async_io, myf cache_myflags)
{
uint min_cache;
size_t min_cache;
my_off_t pos;
my_off_t end_of_file= ~(my_off_t) 0;
DBUG_ENTER("init_io_cache");
@ -214,7 +214,7 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
/* Trim cache size if the file is very small */
if ((my_off_t) cachesize > end_of_file-seek_offset+IO_SIZE*2-1)
{
cachesize=(uint) (end_of_file-seek_offset)+IO_SIZE*2-1;
cachesize= (size_t) (end_of_file-seek_offset)+IO_SIZE*2-1;
use_async_io=0; /* No need to use async */
}
}
@ -223,18 +223,17 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
if (type != READ_NET && type != WRITE_NET)
{
/* Retry allocating memory in smaller blocks until we get one */
cachesize=(uint) ((ulong) (cachesize + min_cache-1) &
(ulong) ~(min_cache-1));
cachesize= ((cachesize + min_cache-1) & ~(min_cache-1));
for (;;)
{
uint buffer_block;
size_t buffer_block;
if (cachesize < min_cache)
cachesize = min_cache;
buffer_block = cachesize;
buffer_block= cachesize;
if (type == SEQ_READ_APPEND)
buffer_block *= 2;
if ((info->buffer=
(byte*) my_malloc(buffer_block,
(uchar*) my_malloc(buffer_block,
MYF((cache_myflags & ~ MY_WME) |
(cachesize == min_cache ? MY_WME : 0)))) != 0)
{
@ -247,11 +246,11 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
if (cachesize == min_cache)
DBUG_RETURN(2); /* Can't alloc cache */
/* Try with less memory */
cachesize= (uint) ((ulong) cachesize*3/4 & (ulong)~(min_cache-1));
cachesize= (cachesize*3/4 & ~(min_cache-1));
}
}
DBUG_PRINT("info",("init_io_cache: cachesize = %u",cachesize));
DBUG_PRINT("info",("init_io_cache: cachesize = %lu", (ulong) cachesize));
info->read_length=info->buffer_length=cachesize;
info->myflags=cache_myflags & ~(MY_NABP | MY_FNABP);
info->request_pos= info->read_pos= info->write_pos = info->buffer;
@ -350,7 +349,7 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
seek_offset <= my_b_tell(info))
{
/* Reuse current buffer without flushing it to disk */
byte *pos;
uchar *pos;
if (info->type == WRITE_CACHE && type == READ_CACHE)
{
info->read_end=info->write_pos;
@ -452,22 +451,22 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
1 Error: can't read requested characters
*/
int _my_b_read(register IO_CACHE *info, byte *Buffer, uint Count)
int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
{
uint length,diff_length,left_length;
my_off_t max_length, pos_in_file;
size_t length,diff_length,left_length, max_length;
my_off_t pos_in_file;
DBUG_ENTER("_my_b_read");
if ((left_length=(uint) (info->read_end-info->read_pos)))
if ((left_length= (size_t) (info->read_end-info->read_pos)))
{
DBUG_ASSERT(Count >= left_length); /* User is not using my_b_read() */
memcpy(Buffer,info->read_pos, (size_t) (left_length));
memcpy(Buffer,info->read_pos, left_length);
Buffer+=left_length;
Count-=left_length;
}
/* pos_in_file always point on where info->buffer was read */
pos_in_file=info->pos_in_file+(uint) (info->read_end - info->buffer);
pos_in_file=info->pos_in_file+ (size_t) (info->read_end - info->buffer);
/*
Whenever a function which operates on IO_CACHE flushes/writes
@ -496,20 +495,20 @@ int _my_b_read(register IO_CACHE *info, byte *Buffer, uint Count)
}
}
diff_length=(uint) (pos_in_file & (IO_SIZE-1));
if (Count >= (uint) (IO_SIZE+(IO_SIZE-diff_length)))
diff_length= (size_t) (pos_in_file & (IO_SIZE-1));
if (Count >= (size_t) (IO_SIZE+(IO_SIZE-diff_length)))
{ /* Fill first intern buffer */
uint read_length;
size_t read_length;
if (info->end_of_file <= pos_in_file)
{ /* End of file */
info->error=(int) left_length;
info->error= (int) left_length;
DBUG_RETURN(1);
}
length=(Count & (uint) ~(IO_SIZE-1))-diff_length;
if ((read_length=my_read(info->file,Buffer,(uint) length,info->myflags))
!= (uint) length)
length=(Count & (size_t) ~(IO_SIZE-1))-diff_length;
if ((read_length= my_read(info->file,Buffer, length, info->myflags))
!= length)
{
info->error= (read_length == (uint) -1 ? -1 :
info->error= (read_length == (size_t) -1 ? -1 :
(int) (read_length+left_length));
DBUG_RETURN(1);
}
@ -520,10 +519,10 @@ int _my_b_read(register IO_CACHE *info, byte *Buffer, uint Count)
diff_length=0;
}
max_length=info->read_length-diff_length;
max_length= info->read_length-diff_length;
if (info->type != READ_FIFO &&
max_length > (info->end_of_file - pos_in_file))
max_length = info->end_of_file - pos_in_file;
max_length= (size_t) (info->end_of_file - pos_in_file);
if (!max_length)
{
if (Count)
@ -533,21 +532,21 @@ int _my_b_read(register IO_CACHE *info, byte *Buffer, uint Count)
}
length=0; /* Didn't read any chars */
}
else if ((length=my_read(info->file,info->buffer,(uint) max_length,
info->myflags)) < Count ||
length == (uint) -1)
else if ((length= my_read(info->file,info->buffer, max_length,
info->myflags)) < Count ||
length == (size_t) -1)
{
if (length != (uint) -1)
memcpy(Buffer,info->buffer,(size_t) length);
if (length != (size_t) -1)
memcpy(Buffer, info->buffer, length);
info->pos_in_file= pos_in_file;
info->error= length == (uint) -1 ? -1 : (int) (length+left_length);
info->error= length == (size_t) -1 ? -1 : (int) (length+left_length);
info->read_pos=info->read_end=info->buffer;
DBUG_RETURN(1);
}
info->read_pos=info->buffer+Count;
info->read_end=info->buffer+length;
info->pos_in_file=pos_in_file;
memcpy(Buffer,info->buffer,(size_t) Count);
memcpy(Buffer, info->buffer, Count);
DBUG_RETURN(0);
}
@ -859,8 +858,9 @@ static int lock_io_cache(IO_CACHE *cache, my_off_t pos)
/* Another thread did read the block already. */
}
DBUG_PRINT("io_cache_share", ("reader awoke, going to process %u bytes",
cshare->read_end ? (uint)
(cshare->read_end - cshare->buffer) : 0));
(uint) (cshare->read_end ? (size_t)
(cshare->read_end - cshare->buffer) :
0)));
/*
Leave the lock. Do not call unlock_io_cache() later. The thread that
@ -952,33 +952,33 @@ static void unlock_io_cache(IO_CACHE *cache)
1 Error: can't read requested characters
*/
int _my_b_read_r(register IO_CACHE *cache, byte *Buffer, uint Count)
int _my_b_read_r(register IO_CACHE *cache, uchar *Buffer, size_t Count)
{
my_off_t pos_in_file;
uint length, diff_length, left_length;
size_t length, diff_length, left_length;
IO_CACHE_SHARE *cshare= cache->share;
DBUG_ENTER("_my_b_read_r");
if ((left_length= (uint) (cache->read_end - cache->read_pos)))
if ((left_length= (size_t) (cache->read_end - cache->read_pos)))
{
DBUG_ASSERT(Count >= left_length); /* User is not using my_b_read() */
memcpy(Buffer, cache->read_pos, (size_t) (left_length));
memcpy(Buffer, cache->read_pos, left_length);
Buffer+= left_length;
Count-= left_length;
}
while (Count)
{
int cnt, len;
size_t cnt, len;
pos_in_file= cache->pos_in_file + (cache->read_end - cache->buffer);
diff_length= (uint) (pos_in_file & (IO_SIZE-1));
diff_length= (size_t) (pos_in_file & (IO_SIZE-1));
length=IO_ROUND_UP(Count+diff_length)-diff_length;
length= ((length <= cache->read_length) ?
length + IO_ROUND_DN(cache->read_length - length) :
length - IO_ROUND_UP(length - cache->read_length));
if (cache->type != READ_FIFO &&
(length > (cache->end_of_file - pos_in_file)))
length= (uint) (cache->end_of_file - pos_in_file);
length= (size_t) (cache->end_of_file - pos_in_file);
if (length == 0)
{
cache->error= (int) left_length;
@ -1013,12 +1013,12 @@ int _my_b_read_r(register IO_CACHE *cache, byte *Buffer, uint Count)
DBUG_RETURN(1);
}
}
len= (int) my_read(cache->file, cache->buffer, length, cache->myflags);
len= my_read(cache->file, cache->buffer, length, cache->myflags);
}
DBUG_PRINT("io_cache_share", ("read %d bytes", len));
DBUG_PRINT("io_cache_share", ("read %lu bytes", (ulong) len));
cache->read_end= cache->buffer + (len == -1 ? 0 : len);
cache->error= (len == (int)length ? 0 : len);
cache->read_end= cache->buffer + (len == (size_t) -1 ? 0 : len);
cache->error= (len == length ? 0 : (int) len);
cache->pos_in_file= pos_in_file;
/* Copy important values to the share. */
@ -1039,19 +1039,20 @@ int _my_b_read_r(register IO_CACHE *cache, byte *Buffer, uint Count)
cache->read_end= cshare->read_end;
cache->pos_in_file= cshare->pos_in_file;
len= (int) ((cache->error == -1) ? -1 : cache->read_end - cache->buffer);
len= ((cache->error == -1) ? (size_t) -1 :
(size_t) (cache->read_end - cache->buffer));
}
cache->read_pos= cache->buffer;
cache->seek_not_done= 0;
if (len <= 0)
if (len == 0 || len == (size_t) -1)
{
DBUG_PRINT("io_cache_share", ("reader error. len %d left %u",
len, left_length));
DBUG_PRINT("io_cache_share", ("reader error. len %lu left %lu",
(ulong) len, (ulong) left_length));
cache->error= (int) left_length;
DBUG_RETURN(1);
}
cnt= ((uint) len > Count) ? (int) Count : len;
memcpy(Buffer, cache->read_pos, (size_t) cnt);
cnt= (len > Count) ? Count : len;
memcpy(Buffer, cache->read_pos, cnt);
Count -= cnt;
Buffer+= cnt;
left_length+= cnt;
@ -1079,7 +1080,7 @@ int _my_b_read_r(register IO_CACHE *cache, byte *Buffer, uint Count)
*/
static void copy_to_read_buffer(IO_CACHE *write_cache,
const byte *write_buffer, uint write_length)
const uchar *write_buffer, size_t write_length)
{
IO_CACHE_SHARE *cshare= write_cache->share;
@ -1090,7 +1091,7 @@ static void copy_to_read_buffer(IO_CACHE *write_cache,
*/
while (write_length)
{
uint copy_length= min(write_length, write_cache->buffer_length);
size_t copy_length= min(write_length, write_cache->buffer_length);
int __attribute__((unused)) rc;
rc= lock_io_cache(write_cache, write_cache->pos_in_file);
@ -1126,33 +1127,32 @@ static void copy_to_read_buffer(IO_CACHE *write_cache,
1 Failed to read
*/
int _my_b_seq_read(register IO_CACHE *info, byte *Buffer, uint Count)
int _my_b_seq_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
{
uint length,diff_length,left_length,save_count;
my_off_t max_length, pos_in_file;
size_t length, diff_length, left_length, save_count, max_length;
my_off_t pos_in_file;
save_count=Count;
/* first, read the regular buffer */
if ((left_length=(uint) (info->read_end-info->read_pos)))
if ((left_length=(size_t) (info->read_end-info->read_pos)))
{
DBUG_ASSERT(Count > left_length); /* User is not using my_b_read() */
memcpy(Buffer,info->read_pos, (size_t) (left_length));
memcpy(Buffer,info->read_pos, left_length);
Buffer+=left_length;
Count-=left_length;
}
lock_append_buffer(info);
/* pos_in_file always point on where info->buffer was read */
if ((pos_in_file=info->pos_in_file+(uint) (info->read_end - info->buffer)) >=
info->end_of_file)
if ((pos_in_file=info->pos_in_file +
(size_t) (info->read_end - info->buffer)) >= info->end_of_file)
goto read_append_buffer;
/*
With read-append cache we must always do a seek before we read,
because the write could have moved the file pointer astray
*/
if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0))
== MY_FILEPOS_ERROR)
if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) == MY_FILEPOS_ERROR)
{
info->error= -1;
unlock_append_buffer(info);
@ -1160,16 +1160,17 @@ int _my_b_seq_read(register IO_CACHE *info, byte *Buffer, uint Count)
}
info->seek_not_done=0;
diff_length=(uint) (pos_in_file & (IO_SIZE-1));
diff_length= (size_t) (pos_in_file & (IO_SIZE-1));
/* now the second stage begins - read from file descriptor */
if (Count >= (uint) (IO_SIZE+(IO_SIZE-diff_length)))
{ /* Fill first intern buffer */
uint read_length;
if (Count >= (size_t) (IO_SIZE+(IO_SIZE-diff_length)))
{
/* Fill first intern buffer */
size_t read_length;
length=(Count & (uint) ~(IO_SIZE-1))-diff_length;
if ((read_length=my_read(info->file,Buffer,(uint) length,info->myflags)) ==
(uint)-1)
length=(Count & (size_t) ~(IO_SIZE-1))-diff_length;
if ((read_length= my_read(info->file,Buffer, length,
info->myflags)) == (size_t) -1)
{
info->error= -1;
unlock_append_buffer(info);
@ -1179,7 +1180,7 @@ int _my_b_seq_read(register IO_CACHE *info, byte *Buffer, uint Count)
Buffer+=read_length;
pos_in_file+=read_length;
if (read_length != (uint) length)
if (read_length != length)
{
/*
We only got part of data; Read the rest of the data from the
@ -1191,9 +1192,9 @@ int _my_b_seq_read(register IO_CACHE *info, byte *Buffer, uint Count)
diff_length=0;
}
max_length=info->read_length-diff_length;
max_length= info->read_length-diff_length;
if (max_length > (info->end_of_file - pos_in_file))
max_length = info->end_of_file - pos_in_file;
max_length= (size_t) (info->end_of_file - pos_in_file);
if (!max_length)
{
if (Count)
@ -1202,9 +1203,8 @@ int _my_b_seq_read(register IO_CACHE *info, byte *Buffer, uint Count)
}
else
{
length=my_read(info->file,info->buffer,(uint) max_length,
info->myflags);
if (length == (uint) -1)
length= my_read(info->file,info->buffer, max_length, info->myflags);
if (length == (size_t) -1)
{
info->error= -1;
unlock_append_buffer(info);
@ -1212,7 +1212,7 @@ int _my_b_seq_read(register IO_CACHE *info, byte *Buffer, uint Count)
}
if (length < Count)
{
memcpy(Buffer,info->buffer,(size_t) length);
memcpy(Buffer, info->buffer, length);
Count -= length;
Buffer += length;
@ -1241,9 +1241,9 @@ read_append_buffer:
{
/* First copy the data to Count */
uint len_in_buff = (uint) (info->write_pos - info->append_read_pos);
uint copy_len;
uint transfer_len;
size_t len_in_buff = (size_t) (info->write_pos - info->append_read_pos);
size_t copy_len;
size_t transfer_len;
DBUG_ASSERT(info->append_read_pos <= info->write_pos);
/*
@ -1288,15 +1288,16 @@ read_append_buffer:
0 Success
1 An error has occurred; IO_CACHE to error state.
*/
int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
int _my_b_async_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
{
uint length,read_length,diff_length,left_length,use_length,org_Count;
my_off_t max_length;
size_t length,read_length,diff_length,left_length,use_length,org_Count;
size_t max_length;
my_off_t next_pos_in_file;
byte *read_buffer;
uchar *read_buffer;
memcpy(Buffer,info->read_pos,
(size_t) (left_length=(uint) (info->read_end-info->read_pos)));
(left_length= (size_t) (info->read_end-info->read_pos)));
Buffer+=left_length;
org_Count=Count;
Count-=left_length;
@ -1315,15 +1316,15 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
info->error= -1;
return(1);
}
if (! (read_length = (uint) info->aio_result.result.aio_return) ||
read_length == (uint) -1)
if (! (read_length= (size_t) info->aio_result.result.aio_return) ||
read_length == (size_t) -1)
{
my_errno=0; /* For testing */
info->error= (read_length == (uint) -1 ? -1 :
info->error= (read_length == (size_t) -1 ? -1 :
(int) (read_length+left_length));
return(1);
}
info->pos_in_file+=(uint) (info->read_end - info->request_pos);
info->pos_in_file+= (size_t) (info->read_end - info->request_pos);
if (info->request_pos != info->buffer)
info->request_pos=info->buffer;
@ -1354,7 +1355,7 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
if (info->aio_read_pos > info->pos_in_file)
{
my_errno=EINVAL;
return(info->read_length= -1);
return(info->read_length= (size_t) -1);
}
#endif
/* Copy found bytes to buffer */
@ -1367,7 +1368,7 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
info->read_pos+=length;
}
else
next_pos_in_file=(info->pos_in_file+ (uint)
next_pos_in_file=(info->pos_in_file+ (size_t)
(info->read_end - info->request_pos));
/* If reading large blocks, or first read or read with skip */
@ -1386,11 +1387,11 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
return (1);
}
read_length=IO_SIZE*2- (uint) (next_pos_in_file & (IO_SIZE-1));
read_length=IO_SIZE*2- (size_t) (next_pos_in_file & (IO_SIZE-1));
if (Count < read_length)
{ /* Small block, read to cache */
if ((read_length=my_read(info->file,info->request_pos,
read_length, info->myflags)) == (uint) -1)
read_length, info->myflags)) == (size_t) -1)
return info->error= -1;
use_length=min(Count,read_length);
memcpy(Buffer,info->request_pos,(size_t) use_length);
@ -1410,10 +1411,10 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
}
else
{ /* Big block, don't cache it */
if ((read_length=my_read(info->file,Buffer,(uint) Count,info->myflags))
if ((read_length= my_read(info->file,Buffer, Count,info->myflags))
!= Count)
{
info->error= read_length == (uint) -1 ? -1 : read_length+left_length;
info->error= read_length == (size_t) -1 ? -1 : read_length+left_length;
return 1;
}
info->read_pos=info->read_end=info->request_pos;
@ -1421,12 +1422,12 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
}
}
/* Read next block with asyncronic io */
max_length=info->end_of_file - next_pos_in_file;
/* Read next block with asyncronic io */
diff_length=(next_pos_in_file & (IO_SIZE-1));
max_length= info->read_length - diff_length;
if (max_length > info->end_of_file - next_pos_in_file)
max_length= (size_t) (info->end_of_file - next_pos_in_file);
if (max_length > (my_off_t) info->read_length - diff_length)
max_length= (my_off_t) info->read_length - diff_length;
if (info->request_pos != info->buffer)
read_buffer=info->buffer;
else
@ -1435,9 +1436,9 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
if (max_length)
{
info->aio_result.result.aio_errno=AIO_INPROGRESS; /* Marker for test */
DBUG_PRINT("aioread",("filepos: %ld length: %ld",
(ulong) next_pos_in_file,(ulong) max_length));
if (aioread(info->file,read_buffer,(int) max_length,
DBUG_PRINT("aioread",("filepos: %ld length: %lu",
(ulong) next_pos_in_file, (ulong) max_length));
if (aioread(info->file,read_buffer, max_length,
(my_off_t) next_pos_in_file,MY_SEEK_SET,
&info->aio_result.result))
{ /* Skip async io */
@ -1447,7 +1448,7 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
if (info->request_pos != info->buffer)
{
bmove(info->buffer,info->request_pos,
(uint) (info->read_end - info->read_pos));
(size_t) (info->read_end - info->read_pos));
info->request_pos=info->buffer;
info->read_pos-=info->read_length;
info->read_end-=info->read_length;
@ -1467,7 +1468,7 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
int _my_b_get(IO_CACHE *info)
{
byte buff;
uchar buff;
IO_CACHE_CALLBACK pre_read,post_read;
if ((pre_read = info->pre_read))
(*pre_read)(info);
@ -1488,9 +1489,9 @@ int _my_b_get(IO_CACHE *info)
-1 On error; my_errno contains error code.
*/
int _my_b_write(register IO_CACHE *info, const byte *Buffer, uint Count)
int _my_b_write(register IO_CACHE *info, const uchar *Buffer, size_t Count)
{
uint rest_length,length;
size_t rest_length,length;
if (info->pos_in_file+info->buffer_length > info->end_of_file)
{
@ -1498,7 +1499,7 @@ int _my_b_write(register IO_CACHE *info, const byte *Buffer, uint Count)
return info->error = -1;
}
rest_length=(uint) (info->write_end - info->write_pos);
rest_length= (size_t) (info->write_end - info->write_pos);
memcpy(info->write_pos,Buffer,(size_t) rest_length);
Buffer+=rest_length;
Count-=rest_length;
@ -1508,7 +1509,7 @@ int _my_b_write(register IO_CACHE *info, const byte *Buffer, uint Count)
return 1;
if (Count >= IO_SIZE)
{ /* Fill first intern buffer */
length=Count & (uint) ~(IO_SIZE-1);
length=Count & (size_t) ~(IO_SIZE-1);
if (info->seek_not_done)
{
/*
@ -1524,7 +1525,7 @@ int _my_b_write(register IO_CACHE *info, const byte *Buffer, uint Count)
}
info->seek_not_done=0;
}
if (my_write(info->file,Buffer,(uint) length,info->myflags | MY_NABP))
if (my_write(info->file, Buffer, length, info->myflags | MY_NABP))
return info->error= -1;
#ifdef THREAD
@ -1559,9 +1560,9 @@ int _my_b_write(register IO_CACHE *info, const byte *Buffer, uint Count)
the write buffer before we are ready with it.
*/
int my_b_append(register IO_CACHE *info, const byte *Buffer, uint Count)
int my_b_append(register IO_CACHE *info, const uchar *Buffer, size_t Count)
{
uint rest_length,length;
size_t rest_length,length;
#ifdef THREAD
/*
@ -1572,10 +1573,10 @@ int my_b_append(register IO_CACHE *info, const byte *Buffer, uint Count)
#endif
lock_append_buffer(info);
rest_length=(uint) (info->write_end - info->write_pos);
rest_length= (size_t) (info->write_end - info->write_pos);
if (Count <= rest_length)
goto end;
memcpy(info->write_pos,Buffer,(size_t) rest_length);
memcpy(info->write_pos, Buffer, rest_length);
Buffer+=rest_length;
Count-=rest_length;
info->write_pos+=rest_length;
@ -1586,8 +1587,8 @@ int my_b_append(register IO_CACHE *info, const byte *Buffer, uint Count)
}
if (Count >= IO_SIZE)
{ /* Fill first intern buffer */
length=Count & (uint) ~(IO_SIZE-1);
if (my_write(info->file,Buffer,(uint) length,info->myflags | MY_NABP))
length=Count & (size_t) ~(IO_SIZE-1);
if (my_write(info->file,Buffer, length, info->myflags | MY_NABP))
{
unlock_append_buffer(info);
return info->error= -1;
@ -1605,7 +1606,7 @@ end:
}
int my_b_safe_write(IO_CACHE *info, const byte *Buffer, uint Count)
int my_b_safe_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
{
/*
Sasha: We are not writing this with the ? operator to avoid hitting
@ -1625,10 +1626,10 @@ int my_b_safe_write(IO_CACHE *info, const byte *Buffer, uint Count)
we will never get a seek over the end of the buffer
*/
int my_block_write(register IO_CACHE *info, const byte *Buffer, uint Count,
int my_block_write(register IO_CACHE *info, const uchar *Buffer, size_t Count,
my_off_t pos)
{
uint length;
size_t length;
int error=0;
#ifdef THREAD
@ -1648,7 +1649,7 @@ int my_block_write(register IO_CACHE *info, const byte *Buffer, uint Count,
/* Write the part of the block that is before buffer */
length= (uint) (info->pos_in_file - pos);
if (my_pwrite(info->file, Buffer, length, pos, info->myflags | MY_NABP))
info->error=error=-1;
info->error= error= -1;
Buffer+=length;
pos+= length;
Count-= length;
@ -1658,10 +1659,10 @@ int my_block_write(register IO_CACHE *info, const byte *Buffer, uint Count,
}
/* Check if we want to write inside the used part of the buffer.*/
length= (uint) (info->write_end - info->buffer);
length= (size_t) (info->write_end - info->buffer);
if (pos < info->pos_in_file + length)
{
uint offset= (uint) (pos - info->pos_in_file);
size_t offset= (size_t) (pos - info->pos_in_file);
length-=offset;
if (length > Count)
length=Count;
@ -1696,7 +1697,7 @@ int my_block_write(register IO_CACHE *info, const byte *Buffer, uint Count,
int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
{
uint length;
size_t length;
my_bool append_cache;
my_off_t pos_in_file;
DBUG_ENTER("my_b_flush_io_cache");
@ -1713,7 +1714,7 @@ int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
}
LOCK_APPEND_BUFFER;
if ((length=(uint) (info->write_pos - info->write_buffer)))
if ((length=(size_t) (info->write_pos - info->write_buffer)))
{
#ifdef THREAD
/*
@ -1821,8 +1822,8 @@ int end_io_cache(IO_CACHE *info)
info->alloced_buffer=0;
if (info->file != -1) /* File doesn't exist */
error= my_b_flush_io_cache(info,1);
my_free((gptr) info->buffer,MYF(MY_WME));
info->buffer=info->read_pos=(byte*) 0;
my_free((uchar*) info->buffer,MYF(MY_WME));
info->buffer=info->read_pos=(uchar*) 0;
}
if (info->type == SEQ_READ_APPEND)
{

View file

@ -50,7 +50,7 @@
int
my_b_copy_to_file(IO_CACHE *cache, FILE *file)
{
uint bytes_in_cache;
size_t bytes_in_cache;
DBUG_ENTER("my_b_copy_to_file");
/* Reinit the cache to read from the beginning of the cache */
@ -60,7 +60,7 @@ my_b_copy_to_file(IO_CACHE *cache, FILE *file)
do
{
if (my_fwrite(file, cache->read_pos, bytes_in_cache,
MYF(MY_WME | MY_NABP)) == (uint) -1)
MYF(MY_WME | MY_NABP)) == (size_t) -1)
DBUG_RETURN(1);
cache->read_pos= cache->read_end;
} while ((bytes_in_cache= my_b_fill(cache)));
@ -175,18 +175,24 @@ void my_b_seek(IO_CACHE *info,my_off_t pos)
/*
Fill buffer. Note that this assumes that you have already used
all characters in the CACHE, independent of the read_pos value!
return: 0 on error or EOF (info->error = -1 on error)
number of characters
Fill buffer of the cache.
NOTES
This assumes that you have already used all characters in the CACHE,
independent of the read_pos value!
RETURN
0 On error or EOF (info->error = -1 on error)
# Number of characters
*/
uint my_b_fill(IO_CACHE *info)
size_t my_b_fill(IO_CACHE *info)
{
my_off_t pos_in_file=(info->pos_in_file+
(uint) (info->read_end - info->buffer));
my_off_t max_length;
uint diff_length,length;
(size_t) (info->read_end - info->buffer));
size_t diff_length, length, max_length;
if (info->seek_not_done)
{ /* File touched, do seek */
if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) ==
@ -197,17 +203,18 @@ uint my_b_fill(IO_CACHE *info)
}
info->seek_not_done=0;
}
diff_length=(uint) (pos_in_file & (IO_SIZE-1));
max_length= (my_off_t) (info->end_of_file - pos_in_file);
if (max_length > (my_off_t) (info->read_length-diff_length))
max_length=(my_off_t) (info->read_length-diff_length);
diff_length=(size_t) (pos_in_file & (IO_SIZE-1));
max_length=(info->read_length-diff_length);
if (max_length >= (info->end_of_file - pos_in_file))
max_length= (size_t) (info->end_of_file - pos_in_file);
if (!max_length)
{
info->error= 0;
return 0; /* EOF */
}
else if ((length=my_read(info->file,info->buffer,(uint) max_length,
info->myflags)) == (uint) -1)
if ((length= my_read(info->file,info->buffer,max_length,
info->myflags)) == (size_t) -1)
{
info->error= -1;
return 0;
@ -226,15 +233,17 @@ uint my_b_fill(IO_CACHE *info)
If buffer is full then to[max_length-1] will be set to \0.
*/
uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length)
{
char *start = to;
uint length;
size_t length;
max_length--; /* Save place for end \0 */
/* Calculate number of characters in buffer */
if (!(length= my_b_bytes_in_cache(info)) &&
!(length= my_b_fill(info)))
return 0;
for (;;)
{
char *pos,*end;
@ -246,7 +255,7 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
{
info->read_pos=pos;
*to='\0';
return (uint) (to-start);
return (size_t) (to-start);
}
}
if (!(max_length-=length))
@ -254,7 +263,7 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
/* Found enough charcters; Return found string */
info->read_pos=pos;
*to='\0';
return (uint) (to-start);
return (size_t) (to-start);
}
if (!(length=my_b_fill(info)))
return 0;
@ -265,26 +274,22 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
my_off_t my_b_filelength(IO_CACHE *info)
{
if (info->type == WRITE_CACHE)
{
return my_b_tell(info);
}
else
{
info->seek_not_done=1;
return my_seek(info->file,0L,MY_SEEK_END,MYF(0));
}
info->seek_not_done= 1;
return my_seek(info->file, 0L, MY_SEEK_END, MYF(0));
}
/*
Simple printf version. Supports '%s', '%d', '%u', "%ld" and "%lu"
Used for logging in MySQL
returns number of written character, or (uint) -1 on error
returns number of written character, or (size_t) -1 on error
*/
uint my_b_printf(IO_CACHE *info, const char* fmt, ...)
size_t my_b_printf(IO_CACHE *info, const char* fmt, ...)
{
int result;
size_t result;
va_list args;
va_start(args,fmt);
result=my_b_vprintf(info, fmt, args);
@ -293,9 +298,9 @@ uint my_b_printf(IO_CACHE *info, const char* fmt, ...)
}
uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
{
uint out_length=0;
size_t out_length= 0;
uint minimum_width; /* as yet unimplemented */
uint minimum_width_sign;
uint precision; /* as yet unimplemented for anything but %b */
@ -312,19 +317,17 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
{
/* Copy everything until '%' or end of string */
const char *start=fmt;
uint length;
size_t length;
for (; (*fmt != '\0') && (*fmt != '%'); fmt++) ;
length= (uint) (fmt - start);
length= (size_t) (fmt - start);
out_length+=length;
if (my_b_write(info, start, length))
goto err;
if (*fmt == '\0') /* End of format */
{
return out_length;
}
/*
By this point, *fmt must be a percent; Keep track of this location and
@ -339,10 +342,13 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
minimum_width_sign= 1;
/* Skip if max size is used (to be compatible with printf) */
while (*fmt == '-') { fmt++; minimum_width_sign= -1; }
if (*fmt == '*') {
if (*fmt == '*')
{
precision= (int) va_arg(args, int);
fmt++;
} else {
}
else
{
while (my_isdigit(&my_charset_latin1, *fmt)) {
minimum_width=(minimum_width * 10) + (*fmt - '0');
fmt++;
@ -350,12 +356,15 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
}
minimum_width*= minimum_width_sign;
if (*fmt == '.') {
if (*fmt == '.')
{
fmt++;
if (*fmt == '*') {
precision= (int) va_arg(args, int);
fmt++;
} else {
}
else
{
while (my_isdigit(&my_charset_latin1, *fmt)) {
precision=(precision * 10) + (*fmt - '0');
fmt++;
@ -366,7 +375,7 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
if (*fmt == 's') /* String parameter */
{
reg2 char *par = va_arg(args, char *);
uint length2 = (uint) strlen(par);
size_t length2 = strlen(par);
/* TODO: implement minimum width and precision */
out_length+= length2;
if (my_b_write(info, par, length2))
@ -382,14 +391,14 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
else if (*fmt == 'd' || *fmt == 'u') /* Integer parameter */
{
register int iarg;
uint length2;
size_t length2;
char buff[17];
iarg = va_arg(args, int);
if (*fmt == 'd')
length2= (uint) (int10_to_str((long) iarg,buff, -10) - buff);
length2= (size_t) (int10_to_str((long) iarg,buff, -10) - buff);
else
length2= (uint) (int10_to_str((long) (uint) iarg,buff,10)- buff);
length2= (size_t) (int10_to_str((long) (uint) iarg,buff,10)- buff);
out_length+= length2;
if (my_b_write(info, buff, length2))
goto err;
@ -398,14 +407,14 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
/* long parameter */
{
register long iarg;
uint length2;
size_t length2;
char buff[17];
iarg = va_arg(args, long);
if (*++fmt == 'd')
length2= (uint) (int10_to_str(iarg,buff, -10) - buff);
length2= (size_t) (int10_to_str(iarg,buff, -10) - buff);
else
length2= (uint) (int10_to_str(iarg,buff,10)- buff);
length2= (size_t) (int10_to_str(iarg,buff,10)- buff);
out_length+= length2;
if (my_b_write(info, buff, length2))
goto err;
@ -421,5 +430,5 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
return out_length;
err:
return (uint) -1;
return (size_t) -1;
}

Some files were not shown because too many files have changed in this diff Show more