diff options
author | unknown <monty@mysql.com/narttu.mysql.fi> | 2007-05-10 12:59:39 +0300 |
---|---|---|
committer | unknown <monty@mysql.com/narttu.mysql.fi> | 2007-05-10 12:59:39 +0300 |
commit | 1629d809edeb96488e40c5753061d71676d9585b (patch) | |
tree | 6480cbef09e9dec2fa347b1899963ab3658d692f /sql | |
parent | 03682775c9406b3cb5b1f77ffb21a0acaece40e8 (diff) | |
download | mariadb-git-1629d809edeb96488e40c5753061d71676d9585b.tar.gz |
WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:
- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t
Removed declaration of byte, gptr, my_string, my_size_t and size_s.
Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
as this requires fewer casts in the code and is more in line with how the
standard functions work.
- Added extra length argument to dirname_part() to return the length of the
created string.
- Changed (at least) following functions to take uchar* as argument:
- db_dump()
- my_net_write()
- net_write_command()
- net_store_data()
- DBUG_DUMP()
- decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
argument to my_uncompress() from a pointer to a value as we only return
one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.
Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
explicitely as this conflict was often hided by casting the function to
hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
size_t. This was needed to properly detect errors (which are
returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
(portability fix)
- Removed windows specific code to restore cursor position as this
causes slowdown on windows and we should not mix read() and pread()
calls anyway as this is not thread safe. Updated function comment to
reflect this. Changed function that depended on original behavior of
my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
m_size is the number of elements in the array, not a string/memory
length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
- Replaced some calls to alloc_root + memcpy to use
strmake_root()/strdup_root().
- Changed some calls from memdup() to strmake() (Safety fix)
- Simpler loops in client-simple.c
BitKeeper/etc/ignore:
added libmysqld/ha_ndbcluster_cond.cc
---
added debian/defs.mk debian/control
client/completion_hash.cc:
Remove not needed casts
client/my_readline.h:
Remove some old types
client/mysql.cc:
Simplify types
client/mysql_upgrade.c:
Remove some old types
Update call to dirname_part
client/mysqladmin.cc:
Remove some old types
client/mysqlbinlog.cc:
Remove some old types
Change some buffers to be uchar to avoid casts
client/mysqlcheck.c:
Remove some old types
client/mysqldump.c:
Remove some old types
Remove some not needed casts
Change some string lengths to size_t
client/mysqlimport.c:
Remove some old types
client/mysqlshow.c:
Remove some old types
client/mysqlslap.c:
Remove some old types
Remove some not needed casts
client/mysqltest.c:
Removed some old types
Removed some not needed casts
Updated hash-get-key function arguments
Updated parameters to dirname_part()
client/readline.cc:
Removed some old types
Removed some not needed casts
Changed some string lengths to use size_t
client/sql_string.cc:
Removed some old types
dbug/dbug.c:
Removed some old types
Changed some string lengths to use size_t
Changed some prototypes to avoid casts
extra/comp_err.c:
Removed some old types
extra/innochecksum.c:
Removed some old types
extra/my_print_defaults.c:
Removed some old types
extra/mysql_waitpid.c:
Removed some old types
extra/perror.c:
Removed some old types
extra/replace.c:
Removed some old types
Updated parameters to dirname_part()
extra/resolve_stack_dump.c:
Removed some old types
extra/resolveip.c:
Removed some old types
include/config-win.h:
Removed some old types
include/decimal.h:
Changed binary strings to be uchar* instead of char*
include/ft_global.h:
Removed some old types
include/hash.h:
Removed some old types
include/heap.h:
Removed some old types
Changed records_under_level to be 'ulong' instead of 'uint' to clarify usage of variable
include/keycache.h:
Removed some old types
include/m_ctype.h:
Removed some old types
Changed some string lengths to use size_t
Changed character length functions to return uint
unsigned char -> uchar
include/m_string.h:
Removed some old types
Changed some string lengths to use size_t
include/my_alloc.h:
Changed some string lengths to use size_t
include/my_base.h:
Removed some old types
include/my_dbug.h:
Removed some old types
Changed some string lengths to use size_t
Changed db_dump() to take uchar * as argument for memory to reduce number of casts in usage
include/my_getopt.h:
Removed some old types
include/my_global.h:
Removed old types:
my_size_t -> size_t
byte -> uchar
gptr -> uchar *
include/my_list.h:
Removed some old types
include/my_nosys.h:
Removed some old types
include/my_pthread.h:
Removed some old types
include/my_sys.h:
Removed some old types
Changed MY_FILE_ERROR to be in line with new definitions of my_write()/my_read()
Changed some string lengths to use size_t
my_malloc() / my_free() now uses void *
Updated parameters to dirname_part() & my_uncompress()
include/my_tree.h:
Removed some old types
include/my_trie.h:
Removed some old types
include/my_user.h:
Changed some string lengths to use size_t
include/my_vle.h:
Removed some old types
include/my_xml.h:
Removed some old types
Changed some string lengths to use size_t
include/myisam.h:
Removed some old types
include/myisammrg.h:
Removed some old types
include/mysql.h:
Removed some old types
Changed byte streams to use uchar* instead of char*
include/mysql_com.h:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
include/queues.h:
Removed some old types
include/sql_common.h:
Removed some old types
include/sslopt-longopts.h:
Removed some old types
include/violite.h:
Removed some old types
Changed some string lengths to use size_t
libmysql/client_settings.h:
Removed some old types
libmysql/libmysql.c:
Removed some old types
libmysql/manager.c:
Removed some old types
libmysqld/emb_qcache.cc:
Removed some old types
libmysqld/emb_qcache.h:
Removed some old types
libmysqld/lib_sql.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
true -> TRUE, false -> FALSE
mysys/array.c:
Removed some old types
mysys/charset.c:
Changed some string lengths to use size_t
mysys/checksum.c:
Include zlib to get definition for crc32
Removed some old types
mysys/default.c:
Removed some old types
Changed some string lengths to use size_t
mysys/default_modify.c:
Changed some string lengths to use size_t
Removed some not needed casts
mysys/hash.c:
Removed some old types
Changed some string lengths to use size_t
Note: Prototype of hash_key() has changed which may cause problems if client uses hash_init() with a cast for the hash-get-key function.
hash_element now takes 'ulong' as the index type (cleanup)
mysys/list.c:
Removed some old types
mysys/mf_cache.c:
Changed some string lengths to use size_t
mysys/mf_dirname.c:
Removed some old types
Changed some string lengths to use size_t
Added argument to dirname_part() to avoid calculation of length for 'to'
mysys/mf_fn_ext.c:
Removed some old types
Updated parameters to dirname_part()
mysys/mf_format.c:
Removed some old types
Changed some string lengths to use size_t
mysys/mf_getdate.c:
Removed some old types
mysys/mf_iocache.c:
Removed some old types
Changed some string lengths to use size_t
Changed calculation of 'max_length' to be done the same way in all functions
mysys/mf_iocache2.c:
Removed some old types
Changed some string lengths to use size_t
Clean up comments
Removed not needed indentation
mysys/mf_keycache.c:
Removed some old types
mysys/mf_keycaches.c:
Removed some old types
mysys/mf_loadpath.c:
Removed some old types
mysys/mf_pack.c:
Removed some old types
Changed some string lengths to use size_t
Removed some not needed casts
Removed very old VMS code
Updated parameters to dirname_part()
Use result of dirnam_part() to remove call to strcat()
mysys/mf_path.c:
Removed some old types
mysys/mf_radix.c:
Removed some old types
mysys/mf_same.c:
Removed some old types
mysys/mf_sort.c:
Removed some old types
mysys/mf_soundex.c:
Removed some old types
mysys/mf_strip.c:
Removed some old types
mysys/mf_tempdir.c:
Removed some old types
mysys/mf_unixpath.c:
Removed some old types
mysys/mf_wfile.c:
Removed some old types
mysys/mulalloc.c:
Removed some old types
mysys/my_alloc.c:
Removed some old types
Changed some string lengths to use size_t
Use void* as type for allocated memory area
Removed some not needed casts
Changed argument 'Size' to 'length' according coding guidelines
mysys/my_chsize.c:
Changed some buffers to be uchar* to avoid casts
mysys/my_compress.c:
More comments
Removed some old types
Changed string lengths to use size_t
Changed arguments to my_uncompress() to make them easier to understand
Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix)
Changed type of 'pack_data' argument to packfrm() to avoid casts.
mysys/my_conio.c:
Changed some string lengths to use size_t
mysys/my_create.c:
Removed some old types
mysys/my_div.c:
Removed some old types
mysys/my_error.c:
Removed some old types
mysys/my_fopen.c:
Removed some old types
mysys/my_fstream.c:
Removed some old types
Changed some string lengths to use size_t
writen -> written
mysys/my_getopt.c:
Removed some old types
mysys/my_getwd.c:
Removed some old types
More comments
mysys/my_init.c:
Removed some old types
mysys/my_largepage.c:
Removed some old types
Changed some string lengths to use size_t
mysys/my_lib.c:
Removed some old types
mysys/my_lockmem.c:
Removed some old types
mysys/my_malloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/my_memmem.c:
Indentation cleanup
mysys/my_once.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
mysys/my_open.c:
Removed some old types
mysys/my_pread.c:
Removed some old types
Changed all functions to use size_t
Added comment for how my_pread() / my_pwrite() are supposed to work.
Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe.
(If we ever would really need this, it should be enabled only with a flag argument)
mysys/my_quick.c:
Removed some old types
Changed all functions to use size_t
mysys/my_read.c:
Removed some old types
Changed all functions to use size_t
mysys/my_realloc.c:
Removed some old types
Use void* as type for allocated memory area
Changed all functions to use size_t
mysys/my_static.c:
Removed some old types
mysys/my_static.h:
Removed some old types
mysys/my_vle.c:
Removed some old types
mysys/my_wincond.c:
Removed some old types
mysys/my_windac.c:
Removed some old types
mysys/my_write.c:
Removed some old types
Changed all functions to use size_t
mysys/ptr_cmp.c:
Removed some old types
Changed all functions to use size_t
mysys/queues.c:
Removed some old types
mysys/safemalloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/string.c:
Removed some old types
Changed all functions to use size_t
mysys/testhash.c:
Removed some old types
mysys/thr_alarm.c:
Removed some old types
mysys/thr_lock.c:
Removed some old types
mysys/tree.c:
Removed some old types
mysys/trie.c:
Removed some old types
mysys/typelib.c:
Removed some old types
plugin/daemon_example/daemon_example.cc:
Removed some old types
regex/reginit.c:
Removed some old types
server-tools/instance-manager/buffer.cc:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/buffer.h:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/commands.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_map.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_options.cc:
Changed buffer to be of type uchar*
Replaced alloc_root + strcpy() with strdup_root()
server-tools/instance-manager/mysql_connection.cc:
Changed buffer to be of type uchar*
server-tools/instance-manager/options.cc:
Removed some old types
server-tools/instance-manager/parse.cc:
Changed some string lengths to use size_t
server-tools/instance-manager/parse.h:
Removed some old types
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.cc:
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.h:
Changed some string lengths to use size_t
server-tools/instance-manager/user_map.cc:
Removed some old types
Changed some string lengths to use size_t
sql/derror.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/discover.cc:
Changed in readfrm() and writefrom() the type for argument 'frmdata' to uchar** to avoid casts
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
sql/event_data_objects.cc:
Removed some old types
Added missing casts for alloc() and sprintf()
sql/event_db_repository.cc:
Changed some buffers to be uchar* to avoid casts
Added missing casts for sprintf()
sql/event_queue.cc:
Removed some old types
sql/field.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/field.h:
Removed some old types
Changed memory buffers to be uchar* (except of store() as this would have caused too many other changes).
Changed some string lengths to use size_t
Removed some not needed casts
Changed val_xxx(xxx, new_ptr) to take const pointers
sql/field_conv.cc:
Removed some old types
Added casts required because memory area pointers are now uchar*
sql/filesort.cc:
Initalize variable that was used unitialized in error conditions
sql/gen_lex_hash.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/gstream.h:
Added required cast
sql/ha_ndbcluster.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Added required casts
Removed some not needed casts
sql/ha_ndbcluster.h:
Removed some old types
sql/ha_ndbcluster_binlog.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Replaced sql_alloc() + memcpy() + set end 0 with sql_strmake()
Changed some string lengths to use size_t
Added missing casts for alloc() and sprintf()
sql/ha_ndbcluster_binlog.h:
Removed some old types
sql/ha_ndbcluster_cond.cc:
Removed some old types
Removed some not needed casts
sql/ha_ndbcluster_cond.h:
Removed some old types
sql/ha_partition.cc:
Removed some old types
Changed prototype for change_partition() to avoid casts
sql/ha_partition.h:
Removed some old types
sql/handler.cc:
Removed some old types
Changed some string lengths to use size_t
sql/handler.h:
Removed some old types
Changed some string lengths to use size_t
Changed type for 'frmblob' parameter for discover() and ha_discover() to get fewer casts
sql/hash_filo.h:
Removed some old types
Changed all functions to use size_t
sql/hostname.cc:
Removed some old types
sql/item.cc:
Removed some old types
Changed some string lengths to use size_t
Use strmake() instead of memdup() to create a null terminated string.
Updated calls to new Field()
sql/item.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.h:
Removed some old types
sql/item_create.cc:
Removed some old types
sql/item_func.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added test for failing alloc() in init_result_field()
Remove old confusing comment
Fixed compiler warning
sql/item_func.h:
Removed some old types
sql/item_row.cc:
Removed some old types
sql/item_row.h:
Removed some old types
sql/item_strfunc.cc:
Include zlib (needed becasue we call crc32)
Removed some old types
sql/item_strfunc.h:
Removed some old types
Changed some types to match new function prototypes
sql/item_subselect.cc:
Removed some old types
sql/item_subselect.h:
Removed some old types
sql/item_sum.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/item_sum.h:
Removed some old types
sql/item_timefunc.cc:
Removed some old types
Changed some string lengths to use size_t
sql/item_timefunc.h:
Removed some old types
sql/item_xmlfunc.cc:
Changed some string lengths to use size_t
sql/item_xmlfunc.h:
Removed some old types
sql/key.cc:
Removed some old types
Removed some not needed casts
sql/lock.cc:
Removed some old types
Added some cast to my_multi_malloc() arguments for safety
sql/log.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Changed usage of pwrite() to not assume it holds the cursor position for the file
Made usage of my_read() safer
sql/log_event.cc:
Removed some old types
Added checking of return value of malloc() in pack_info()
Changed some buffers to be uchar* to avoid casts
Removed some 'const' to avoid casts
Added missing casts for alloc() and sprintf()
Added required casts
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
sql/log_event.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/log_event_old.cc:
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/log_event_old.h:
Changed some buffers to be uchar* to avoid casts
sql/mf_iocache.cc:
Removed some old types
sql/my_decimal.cc:
Changed memory area to use uchar*
sql/my_decimal.h:
Changed memory area to use uchar*
sql/mysql_priv.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some string lengths to use size_t
Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid long overflow
Changed some buffers to be uchar* to avoid casts
sql/mysqld.cc:
Removed some old types
sql/net_serv.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Ensure that vio_read()/vio_write() return values are stored in a size_t variable
Removed some not needed casts
sql/opt_range.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/opt_range.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/opt_sum.cc:
Removed some old types
Removed some not needed casts
sql/parse_file.cc:
Removed some old types
Changed some string lengths to use size_t
Changed alloc_root + memcpy + set end 0 -> strmake_root()
sql/parse_file.h:
Removed some old types
sql/partition_info.cc:
Removed some old types
Added missing casts for alloc()
Changed some buffers to be uchar* to avoid casts
sql/partition_info.h:
Changed some buffers to be uchar* to avoid casts
sql/protocol.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/protocol.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/records.cc:
Removed some old types
sql/repl_failsafe.cc:
Removed some old types
Changed some string lengths to use size_t
Added required casts
sql/rpl_filter.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some string lengths to use size_t
sql/rpl_filter.h:
Changed some string lengths to use size_t
sql/rpl_injector.h:
Removed some old types
sql/rpl_record.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
sql/rpl_record.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/rpl_record_old.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/rpl_record_old.h:
Removed some old types
Changed some buffers to be uchar* to avoid cast
sql/rpl_rli.cc:
Removed some old types
sql/rpl_tblmap.cc:
Removed some old types
sql/rpl_tblmap.h:
Removed some old types
sql/rpl_utility.cc:
Removed some old types
sql/rpl_utility.h:
Removed some old types
Changed type of m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length
sql/set_var.cc:
Removed some old types
Updated parameters to dirname_part()
sql/set_var.h:
Removed some old types
sql/slave.cc:
Removed some old types
Changed some string lengths to use size_t
sql/slave.h:
Removed some old types
sql/sp.cc:
Removed some old types
Added missing casts for printf()
sql/sp.h:
Removed some old types
Updated hash-get-key function arguments
sql/sp_cache.cc:
Removed some old types
Added missing casts for printf()
Updated hash-get-key function arguments
sql/sp_head.cc:
Removed some old types
Added missing casts for alloc() and printf()
Added required casts
Updated hash-get-key function arguments
sql/sp_head.h:
Removed some old types
sql/sp_pcontext.cc:
Removed some old types
sql/sp_pcontext.h:
Removed some old types
sql/sql_acl.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added required casts
sql/sql_analyse.cc:
Changed some buffers to be uchar* to avoid casts
sql/sql_analyse.h:
Changed some buffers to be uchar* to avoid casts
sql/sql_array.h:
Removed some old types
sql/sql_base.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_binlog.cc:
Removed some old types
Added missing casts for printf()
sql/sql_cache.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
Changed some string lengths to use size_t
sql/sql_cache.h:
Removed some old types
Removed reference to not existing function cache_key()
Updated hash-get-key function arguments
sql/sql_class.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc()
Updated hash-get-key function arguments
Moved THD::max_row_length() to table.cc (as it's not depending on THD)
Removed some not needed casts
sql/sql_class.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Removed some not needed casts
Changed some string lengths to use size_t
Moved max_row_length and max_row_length_blob() to table.cc, as they are not depending on THD
sql/sql_connect.cc:
Removed some old types
Added required casts
sql/sql_db.cc:
Removed some old types
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
Added missing casts for alloc()
sql/sql_delete.cc:
Removed some old types
sql/sql_handler.cc:
Removed some old types
Updated hash-get-key function arguments
Added some cast to my_multi_malloc() arguments for safety
sql/sql_help.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_insert.cc:
Removed some old types
Added missing casts for alloc() and printf()
sql/sql_lex.cc:
Removed some old types
sql/sql_lex.h:
Removed some old types
Removed some not needed casts
sql/sql_list.h:
Removed some old types
Removed some not needed casts
sql/sql_load.cc:
Removed some old types
Removed compiler warning
sql/sql_manager.cc:
Removed some old types
sql/sql_map.cc:
Removed some old types
sql/sql_map.h:
Removed some old types
sql/sql_olap.cc:
Removed some old types
sql/sql_parse.cc:
Removed some old types
Trivial move of code lines to make things more readable
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/sql_partition.cc:
Removed some old types
Removed compiler warnings about not used functions
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_partition.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_plugin.cc:
Removed some old types
Added missing casts for alloc()
Updated hash-get-key function arguments
sql/sql_prepare.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Added missing casts for alloc() and printf()
sql-common/client.c:
Removed some old types
Changed some memory areas to use uchar*
sql-common/my_user.c:
Changed some string lengths to use size_t
sql-common/pack.c:
Changed some buffers to be uchar* to avoid casts
sql/sql_repl.cc:
Added required casts
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/sql_select.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some old types
sql/sql_select.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_servers.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_show.cc:
Removed some old types
Added missing casts for alloc()
Removed some not needed casts
sql/sql_string.cc:
Removed some old types
Added required casts
sql/sql_table.cc:
Removed some old types
Removed compiler warning about not used variable
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_test.cc:
Removed some old types
sql/sql_trigger.cc:
Removed some old types
Added missing casts for alloc()
sql/sql_udf.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_union.cc:
Removed some old types
sql/sql_update.cc:
Removed some old types
Removed some not needed casts
sql/sql_view.cc:
Removed some old types
sql/sql_yacc.yy:
Removed some old types
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/stacktrace.c:
Removed some old types
sql/stacktrace.h:
Removed some old types
sql/structs.h:
Removed some old types
sql/table.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Removed setting of LEX_STRING() arguments in declaration
Added required casts
More function comments
Moved max_row_length() here from sql_class.cc/sql_class.h
sql/table.h:
Removed some old types
Changed some string lengths to use size_t
sql/thr_malloc.cc:
Use void* as type for allocated memory area
Changed all functions to use size_t
sql/tzfile.h:
Changed some buffers to be uchar* to avoid casts
sql/tztime.cc:
Changed some buffers to be uchar* to avoid casts
Updated hash-get-key function arguments
Added missing casts for alloc()
Removed some not needed casts
sql/uniques.cc:
Removed some old types
Removed some not needed casts
sql/unireg.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added missing casts for alloc()
storage/archive/archive_reader.c:
Removed some old types
storage/archive/azio.c:
Removed some old types
Removed some not needed casts
storage/archive/ha_archive.cc:
Removed some old types
Changed type for 'frmblob' in archive_discover() to match handler
Updated hash-get-key function arguments
Removed some not needed casts
storage/archive/ha_archive.h:
Removed some old types
storage/blackhole/ha_blackhole.cc:
Removed some old types
storage/blackhole/ha_blackhole.h:
Removed some old types
storage/csv/ha_tina.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
storage/csv/ha_tina.h:
Removed some old types
Removed some not needed casts
storage/csv/transparent_file.cc:
Removed some old types
Changed type of 'bytes_read' to be able to detect read errors
Fixed indentation
storage/csv/transparent_file.h:
Removed some old types
storage/example/ha_example.cc:
Removed some old types
Updated hash-get-key function arguments
storage/example/ha_example.h:
Removed some old types
storage/federated/ha_federated.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
storage/federated/ha_federated.h:
Removed some old types
storage/heap/_check.c:
Changed some buffers to be uchar* to avoid casts
storage/heap/_rectest.c:
Removed some old types
storage/heap/ha_heap.cc:
Removed some old types
storage/heap/ha_heap.h:
Removed some old types
storage/heap/heapdef.h:
Removed some old types
storage/heap/hp_block.c:
Removed some old types
Changed some string lengths to use size_t
storage/heap/hp_clear.c:
Removed some old types
storage/heap/hp_close.c:
Removed some old types
storage/heap/hp_create.c:
Removed some old types
storage/heap/hp_delete.c:
Removed some old types
storage/heap/hp_hash.c:
Removed some old types
storage/heap/hp_info.c:
Removed some old types
storage/heap/hp_open.c:
Removed some old types
storage/heap/hp_rfirst.c:
Removed some old types
storage/heap/hp_rkey.c:
Removed some old types
storage/heap/hp_rlast.c:
Removed some old types
storage/heap/hp_rnext.c:
Removed some old types
storage/heap/hp_rprev.c:
Removed some old types
storage/heap/hp_rrnd.c:
Removed some old types
storage/heap/hp_rsame.c:
Removed some old types
storage/heap/hp_scan.c:
Removed some old types
storage/heap/hp_test1.c:
Removed some old types
storage/heap/hp_test2.c:
Removed some old types
storage/heap/hp_update.c:
Removed some old types
storage/heap/hp_write.c:
Removed some old types
Changed some string lengths to use size_t
storage/innobase/handler/ha_innodb.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc() and printf()
Removed some not needed casts
storage/innobase/handler/ha_innodb.h:
Removed some old types
storage/myisam/ft_boolean_search.c:
Removed some old types
storage/myisam/ft_nlq_search.c:
Removed some old types
storage/myisam/ft_parser.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ft_static.c:
Removed some old types
storage/myisam/ft_stopwords.c:
Removed some old types
storage/myisam/ft_update.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ftdefs.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/fulltext.h:
Removed some old types
storage/myisam/ha_myisam.cc:
Removed some old types
storage/myisam/ha_myisam.h:
Removed some old types
storage/myisam/mi_cache.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_check.c:
Removed some old types
storage/myisam/mi_checksum.c:
Removed some old types
storage/myisam/mi_close.c:
Removed some old types
storage/myisam/mi_create.c:
Removed some old types
storage/myisam/mi_delete.c:
Removed some old types
storage/myisam/mi_delete_all.c:
Removed some old types
storage/myisam/mi_dynrec.c:
Removed some old types
storage/myisam/mi_extra.c:
Removed some old types
storage/myisam/mi_key.c:
Removed some old types
storage/myisam/mi_locking.c:
Removed some old types
storage/myisam/mi_log.c:
Removed some old types
storage/myisam/mi_open.c:
Removed some old types
Removed some not needed casts
Check argument of my_write()/my_pwrite() in functions returning int
Added casting of string lengths to size_t
storage/myisam/mi_packrec.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_page.c:
Removed some old types
storage/myisam/mi_preload.c:
Removed some old types
storage/myisam/mi_range.c:
Removed some old types
storage/myisam/mi_rfirst.c:
Removed some old types
storage/myisam/mi_rkey.c:
Removed some old types
storage/myisam/mi_rlast.c:
Removed some old types
storage/myisam/mi_rnext.c:
Removed some old types
storage/myisam/mi_rnext_same.c:
Removed some old types
storage/myisam/mi_rprev.c:
Removed some old types
storage/myisam/mi_rrnd.c:
Removed some old types
storage/myisam/mi_rsame.c:
Removed some old types
storage/myisam/mi_rsamepos.c:
Removed some old types
storage/myisam/mi_scan.c:
Removed some old types
storage/myisam/mi_search.c:
Removed some old types
storage/myisam/mi_static.c:
Removed some old types
storage/myisam/mi_statrec.c:
Removed some old types
storage/myisam/mi_test1.c:
Removed some old types
storage/myisam/mi_test2.c:
Removed some old types
storage/myisam/mi_test3.c:
Removed some old types
storage/myisam/mi_unique.c:
Removed some old types
storage/myisam/mi_update.c:
Removed some old types
storage/myisam/mi_write.c:
Removed some old types
storage/myisam/myisam_ftdump.c:
Removed some old types
storage/myisam/myisamchk.c:
Removed some old types
storage/myisam/myisamdef.h:
Removed some old types
storage/myisam/myisamlog.c:
Removed some old types
Indentation fix
storage/myisam/myisampack.c:
Removed some old types
storage/myisam/rt_index.c:
Removed some old types
storage/myisam/rt_split.c:
Removed some old types
storage/myisam/sort.c:
Removed some old types
storage/myisam/sp_defs.h:
Removed some old types
storage/myisam/sp_key.c:
Removed some old types
storage/myisammrg/ha_myisammrg.cc:
Removed some old types
storage/myisammrg/ha_myisammrg.h:
Removed some old types
storage/myisammrg/myrg_close.c:
Removed some old types
storage/myisammrg/myrg_def.h:
Removed some old types
storage/myisammrg/myrg_delete.c:
Removed some old types
storage/myisammrg/myrg_open.c:
Removed some old types
Updated parameters to dirname_part()
storage/myisammrg/myrg_queue.c:
Removed some old types
storage/myisammrg/myrg_rfirst.c:
Removed some old types
storage/myisammrg/myrg_rkey.c:
Removed some old types
storage/myisammrg/myrg_rlast.c:
Removed some old types
storage/myisammrg/myrg_rnext.c:
Removed some old types
storage/myisammrg/myrg_rnext_same.c:
Removed some old types
storage/myisammrg/myrg_rprev.c:
Removed some old types
storage/myisammrg/myrg_rrnd.c:
Removed some old types
storage/myisammrg/myrg_rsame.c:
Removed some old types
storage/myisammrg/myrg_update.c:
Removed some old types
storage/myisammrg/myrg_write.c:
Removed some old types
storage/ndb/include/util/ndb_opts.h:
Removed some old types
storage/ndb/src/cw/cpcd/main.cpp:
Removed some old types
storage/ndb/src/kernel/vm/Configuration.cpp:
Removed some old types
storage/ndb/src/mgmclient/main.cpp:
Removed some old types
storage/ndb/src/mgmsrv/InitConfigFileParser.cpp:
Removed some old types
Removed old disabled code
storage/ndb/src/mgmsrv/main.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbBlob.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbOperationDefine.cpp:
Removed not used variable
storage/ndb/src/ndbapi/NdbOperationInt.cpp:
Added required casts
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
Added required casts
storage/ndb/tools/delete_all.cpp:
Removed some old types
storage/ndb/tools/desc.cpp:
Removed some old types
storage/ndb/tools/drop_index.cpp:
Removed some old types
storage/ndb/tools/drop_tab.cpp:
Removed some old types
storage/ndb/tools/listTables.cpp:
Removed some old types
storage/ndb/tools/ndb_config.cpp:
Removed some old types
storage/ndb/tools/restore/consumer_restore.cpp:
Changed some buffers to be uchar* to avoid casts with new defintion of packfrm()
storage/ndb/tools/restore/restore_main.cpp:
Removed some old types
storage/ndb/tools/select_all.cpp:
Removed some old types
storage/ndb/tools/select_count.cpp:
Removed some old types
storage/ndb/tools/waiter.cpp:
Removed some old types
strings/bchange.c:
Changed function to use uchar * and size_t
strings/bcmp.c:
Changed function to use uchar * and size_t
strings/bmove512.c:
Changed function to use uchar * and size_t
strings/bmove_upp.c:
Changed function to use uchar * and size_t
strings/ctype-big5.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-bin.c:
Changed functions to use size_t
strings/ctype-cp932.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-czech.c:
Fixed indentation
Changed functions to use size_t
strings/ctype-euc_kr.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-eucjpms.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-gb2312.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-gbk.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-latin1.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-mb.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-simple.c:
Changed functions to use size_t
Simpler loops for caseup/casedown
unsigned int -> uint
unsigned char -> uchar
strings/ctype-sjis.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-tis620.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-uca.c:
Changed functions to use size_t
unsigned char -> uchar
strings/ctype-ucs2.c:
Moved inclusion of stdarg.h to other includes
usigned char -> uchar
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-ujis.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-utf8.c:
Changed functions to use size_t
unsigned char -> uchar
Indentation fixes
strings/ctype-win1250ch.c:
Indentation fixes
Changed functions to use size_t
strings/ctype.c:
Changed functions to use size_t
strings/decimal.c:
Changed type for memory argument to uchar *
strings/do_ctype.c:
Indentation fixes
strings/my_strtoll10.c:
unsigned char -> uchar
strings/my_vsnprintf.c:
Changed functions to use size_t
strings/r_strinstr.c:
Removed some old types
Changed functions to use size_t
strings/str_test.c:
Removed some old types
strings/strappend.c:
Changed functions to use size_t
strings/strcont.c:
Removed some old types
strings/strfill.c:
Removed some old types
strings/strinstr.c:
Changed functions to use size_t
strings/strlen.c:
Changed functions to use size_t
strings/strmake.c:
Changed functions to use size_t
strings/strnlen.c:
Changed functions to use size_t
strings/strnmov.c:
Changed functions to use size_t
strings/strto.c:
unsigned char -> uchar
strings/strtod.c:
Changed functions to use size_t
strings/strxnmov.c:
Changed functions to use size_t
strings/xml.c:
Changed functions to use size_t
Indentation fixes
tests/mysql_client_test.c:
Removed some old types
tests/thread_test.c:
Removed some old types
vio/test-ssl.c:
Removed some old types
vio/test-sslclient.c:
Removed some old types
vio/test-sslserver.c:
Removed some old types
vio/vio.c:
Removed some old types
vio/vio_priv.h:
Removed some old types
Changed vio_read()/vio_write() to work with size_t
vio/viosocket.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viossl.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viosslfactories.c:
Removed some old types
vio/viotest-ssl.c:
Removed some old types
win/README:
More explanations
Diffstat (limited to 'sql')
142 files changed, 3798 insertions, 3706 deletions
diff --git a/sql/derror.cc b/sql/derror.cc index 0e74d411b1f..aa7edd639da 100644 --- a/sql/derror.cc +++ b/sql/derror.cc @@ -55,7 +55,7 @@ bool init_errmessage(void) /* Register messages for use with my_error(). */ if (my_error_register(errmsgs, ER_ERROR_FIRST, ER_ERROR_LAST)) { - x_free((gptr) errmsgs); + x_free((uchar*) errmsgs); DBUG_RETURN(TRUE); } @@ -72,11 +72,13 @@ static bool read_texts(const char *file_name,const char ***point, uint error_messages) { register uint i; - uint count,funktpos,length,textcount; + uint count,funktpos,textcount; + size_t length; File file; char name[FN_REFLEN]; - const char *buff; + uchar *buff; uchar head[32],*pos; + const char *errmsg; DBUG_ENTER("read_texts"); *point=0; // If something goes wrong @@ -88,7 +90,7 @@ static bool read_texts(const char *file_name,const char ***point, goto err; /* purecov: inspected */ funktpos=1; - if (my_read(file,(byte*) head,32,MYF(MY_NABP))) goto err; + if (my_read(file,(uchar*) head,32,MYF(MY_NABP))) goto err; if (head[0] != (uchar) 254 || head[1] != (uchar) 254 || head[2] != 2 || head[3] != 1) goto err; /* purecov: inspected */ @@ -122,22 +124,24 @@ Check that the above file is the right version for this program!", unireg_abort(1); } - x_free((gptr) *point); /* Free old language */ + x_free((uchar*) *point); /* Free old language */ if (!(*point= (const char**) - my_malloc((uint) (length+count*sizeof(char*)),MYF(0)))) + my_malloc((size_t) (length+count*sizeof(char*)),MYF(0)))) { funktpos=2; /* purecov: inspected */ goto err; /* purecov: inspected */ } - buff= (char*) (*point + count); + buff= (uchar*) (*point + count); - if (my_read(file,(byte*) buff,(uint) count*2,MYF(MY_NABP))) goto err; - for (i=0, pos= (uchar*) buff ; i< count ; i++) + if (my_read(file, buff, (size_t) count*2,MYF(MY_NABP))) + goto err; + for (i=0, pos= buff ; i< count ; i++) { - (*point)[i]=buff+uint2korr(pos); + (*point)[i]= (char*) buff+uint2korr(pos); pos+=2; } - if (my_read(file,(byte*) buff,(uint) length,MYF(MY_NABP))) goto err; + if (my_read(file, buff, length, MYF(MY_NABP))) + goto err; for (i=1 ; i < textcount ; i++) { @@ -149,16 +153,16 @@ Check that the above file is the right version for this program!", err: switch (funktpos) { case 2: - buff="Not enough memory for messagefile '%s'"; + errmsg= "Not enough memory for messagefile '%s'"; break; case 1: - buff="Can't read from messagefile '%s'"; + errmsg= "Can't read from messagefile '%s'"; break; default: - buff="Can't find messagefile '%s'"; + errmsg= "Can't find messagefile '%s'"; break; } - sql_print_error(buff,name); + sql_print_error(errmsg, name); err1: if (file != FERR) VOID(my_close(file,MYF(MY_WME))); diff --git a/sql/discover.cc b/sql/discover.cc index 395bfbfff45..a7af90c440f 100644 --- a/sql/discover.cc +++ b/sql/discover.cc @@ -39,14 +39,13 @@ frmdata and len are set to 0 on error */ -int readfrm(const char *name, - const void **frmdata, uint *len) +int readfrm(const char *name, uchar **frmdata, size_t *len) { int error; char index_file[FN_REFLEN]; File file; - ulong read_len; - char *read_data; + size_t read_len; + uchar *read_data; MY_STAT state; DBUG_ENTER("readfrm"); DBUG_PRINT("enter",("name: '%s'",name)); @@ -68,12 +67,12 @@ int readfrm(const char *name, // Read whole frm file error= 3; - read_data= 0; + read_data= 0; // Nothing to free if (read_string(file, &read_data, read_len)) goto err; // Setup return data - *frmdata= (void*) read_data; + *frmdata= (uchar*) read_data; *len= read_len; error= 0; @@ -102,21 +101,20 @@ int readfrm(const char *name, 2 Could not write file */ -int writefrm(const char *name, const void *frmdata, uint len) +int writefrm(const char *name, const uchar *frmdata, size_t len) { File file; char index_file[FN_REFLEN]; int error; DBUG_ENTER("writefrm"); - DBUG_PRINT("enter",("name: '%s' len: %d ",name,len)); - //DBUG_DUMP("frmdata", (char*)frmdata, len); + DBUG_PRINT("enter",("name: '%s' len: %lu ",name, (ulong) len)); error= 0; if ((file=my_create(fn_format(index_file,name,"",reg_ext, MY_UNPACK_FILENAME|MY_APPEND_EXT), CREATE_MODE,O_RDWR | O_TRUNC,MYF(MY_WME))) >= 0) { - if (my_write(file,(byte*)frmdata,len,MYF(MY_WME | MY_NABP))) + if (my_write(file, frmdata, len,MYF(MY_WME | MY_NABP))) error= 2; VOID(my_close(file,MYF(0))); } diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index f5847e603e8..71a87c12169 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -42,7 +42,7 @@ Event_queue_element_for_exec::init(LEX_STRING db, LEX_STRING n) return TRUE; if (!(name.str= my_strndup(n.str, name.length= n.length, MYF(MY_WME)))) { - my_free((gptr) dbname.str, MYF(0)); + my_free((uchar*) dbname.str, MYF(0)); return TRUE; } return FALSE; @@ -58,8 +58,8 @@ Event_queue_element_for_exec::init(LEX_STRING db, LEX_STRING n) Event_queue_element_for_exec::~Event_queue_element_for_exec() { - my_free((gptr) dbname.str, MYF(0)); - my_free((gptr) name.str, MYF(0)); + my_free((uchar*) dbname.str, MYF(0)); + my_free((uchar*) name.str, MYF(0)); } @@ -615,7 +615,7 @@ Event_parse_data::init_definer(THD *thd) /* + 1 for @ */ DBUG_PRINT("info",("init definer as whole")); definer.length= definer_user_len + definer_host_len + 1; - definer.str= thd->alloc(definer.length + 1); + definer.str= (char*) thd->alloc(definer.length + 1); DBUG_PRINT("info",("copy the user")); memcpy(definer.str, definer_user, definer_user_len); @@ -1631,7 +1631,7 @@ Event_queue_element::update_timing_fields(THD *thd) DBUG_ENTER("Event_queue_element::update_timing_fields"); - DBUG_PRINT("enter", ("name: %*s", name.length, name.str)); + DBUG_PRINT("enter", ("name: %*s", (int) name.length, name.str)); /* No need to update if nothing has changed */ if (!(status_changed || last_executed_changed)) @@ -1691,7 +1691,8 @@ Event_timed::get_create_event(THD *thd, String *buf) expr_buf.length(0); DBUG_ENTER("get_create_event"); - DBUG_PRINT("ret_info",("body_len=[%d]body=[%s]", body.length, body.str)); + DBUG_PRINT("ret_info",("body_len=[%d]body=[%s]", + (int) body.length, body.str)); if (expression && Events::reconstruct_interval_expression(&expr_buf, interval, expression)) diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index e49fd6791a0..fa17ee8a380 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -303,7 +303,7 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table, CHARSET_INFO *scs= system_charset_info; KEY *key_info; uint key_len; - byte *key_buf= NULL; + uchar *key_buf= NULL; LINT_INIT(key_buf); DBUG_ENTER("Event_db_repository::index_read_for_db_for_i_s"); @@ -324,7 +324,7 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table, event_table->field[ET_FIELD_DB]->store(db, strlen(db), scs); key_len= key_info->key_part[0].store_length; - if (!(key_buf= (byte *)alloc_root(thd->mem_root, key_len))) + if (!(key_buf= (uchar *)alloc_root(thd->mem_root, key_len))) { /* Don't send error, it would be done by sql_alloc_error_handler() */ ret= 1; @@ -521,7 +521,7 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data, if (open_event_table(thd, TL_WRITE, &table)) goto end; - DBUG_PRINT("info", ("name: %.*s", parse_data->name.length, + DBUG_PRINT("info", ("name: %.*s", (int) parse_data->name.length, parse_data->name.str)); DBUG_PRINT("info", ("check existance of an event with the same name")); @@ -757,9 +757,9 @@ bool Event_db_repository::find_named_event(LEX_STRING db, LEX_STRING name, TABLE *table) { - byte key[MAX_KEY_LENGTH]; + uchar key[MAX_KEY_LENGTH]; DBUG_ENTER("Event_db_repository::find_named_event"); - DBUG_PRINT("enter", ("name: %.*s", name.length, name.str)); + DBUG_PRINT("enter", ("name: %.*s", (int) name.length, name.str)); /* Create key to find row. We have to use field->store() to be able to @@ -879,7 +879,8 @@ Event_db_repository::load_named_event(THD *thd, LEX_STRING dbname, bool ret; DBUG_ENTER("Event_db_repository::load_named_event"); - DBUG_PRINT("enter",("thd: 0x%lx name: %*s", (long) thd, name.length, name.str)); + DBUG_PRINT("enter",("thd: 0x%lx name: %*s", (long) thd, + (int) name.length, name.str)); if (!(ret= open_event_table(thd, TL_READ, &table))) { diff --git a/sql/event_queue.cc b/sql/event_queue.cc index a7c31429cb3..e1bf3a85a7a 100644 --- a/sql/event_queue.cc +++ b/sql/event_queue.cc @@ -53,7 +53,7 @@ */ static int -event_queue_element_compare_q(void *vptr, byte* a, byte *b) +event_queue_element_compare_q(void *vptr, uchar* a, uchar *b) { my_time_t lhs = ((Event_queue_element *)a)->execute_at; my_time_t rhs = ((Event_queue_element *)b)->execute_at; @@ -193,7 +193,7 @@ Event_queue::create_event(THD *thd, Event_queue_element *new_element, DBUG_PRINT("info", ("new event in the queue: 0x%lx", (long) new_element)); LOCK_QUEUE_DATA(); - *created= (queue_insert_safe(&queue, (byte *) new_element) == FALSE); + *created= (queue_insert_safe(&queue, (uchar *) new_element) == FALSE); dbug_dump_queue(thd->query_start()); pthread_cond_broadcast(&COND_queue_state); UNLOCK_QUEUE_DATA(); @@ -242,7 +242,7 @@ Event_queue::update_event(THD *thd, LEX_STRING dbname, LEX_STRING name, if (new_element) { DBUG_PRINT("info", ("new event in the queue: 0x%lx", (long) new_element)); - queue_insert_safe(&queue, (byte *) new_element); + queue_insert_safe(&queue, (uchar *) new_element); pthread_cond_broadcast(&COND_queue_state); } diff --git a/sql/field.cc b/sql/field.cc index 5624294d012..e883831a828 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1051,7 +1051,7 @@ bool Field::type_can_have_key_part(enum enum_field_types type) /* Numeric fields base class constructor */ -Field_num::Field_num(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, +Field_num::Field_num(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, uint8 dec_arg, bool zero_arg, bool unsigned_arg) @@ -1071,9 +1071,10 @@ void Field_num::prepend_zeros(String *value) int diff; if ((diff= (int) (field_length - value->length())) > 0) { - bmove_upp((char*) value->ptr()+field_length,value->ptr()+value->length(), + bmove_upp((uchar*) value->ptr()+field_length, + (uchar*) value->ptr()+value->length(), value->length()); - bfill((char*) value->ptr(),diff,'0'); + bfill((uchar*) value->ptr(),diff,'0'); value->length(field_length); (void) value->c_ptr_quick(); // Avoid warnings in purify } @@ -1155,7 +1156,8 @@ bool Field_num::get_int(CHARSET_INFO *cs, const char *from, uint len, char *end; int error; - *rnd= (longlong) cs->cset->strntoull10rnd(cs, from, len, unsigned_flag, &end, + *rnd= (longlong) cs->cset->strntoull10rnd(cs, from, len, + unsigned_flag, &end, &error); if (unsigned_flag) { @@ -1179,7 +1181,8 @@ bool Field_num::get_int(CHARSET_INFO *cs, const char *from, uint len, goto out_of_range; } } - if (table->in_use->count_cuted_fields && check_int(cs, from, len, end, error)) + if (table->in_use->count_cuted_fields && + check_int(cs, from, len, end, error)) return 1; return 0; @@ -1296,7 +1299,7 @@ String *Field::val_int_as_str(String *val_buffer, my_bool unsigned_val) } -Field::Field(char *ptr_arg,uint32 length_arg,uchar *null_ptr_arg, +Field::Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg) :ptr(ptr_arg), null_ptr(null_ptr_arg), @@ -1323,18 +1326,17 @@ void Field::hash(ulong *nr, ulong *nr2) { uint len= pack_length(); CHARSET_INFO *cs= charset(); - cs->coll->hash_sort(cs, (uchar*) ptr, len, nr, nr2); + cs->coll->hash_sort(cs, ptr, len, nr, nr2); } } -my_size_t +size_t Field::do_last_null_byte() const { - DBUG_ASSERT(null_ptr == NULL || (byte*) null_ptr >= table->record[0]); + DBUG_ASSERT(null_ptr == NULL || null_ptr >= table->record[0]); if (null_ptr) - return (byte*) null_ptr - table->record[0] + 1; - else - return LAST_NULL_BYTE_UNDEF; + return (size_t) (null_ptr - table->record[0]) + 1; + return LAST_NULL_BYTE_UNDEF; } @@ -1488,7 +1490,7 @@ my_decimal* Field_num::val_decimal(my_decimal *decimal_value) } -Field_str::Field_str(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, +Field_str::Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, CHARSET_INFO *charset_arg) :Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, @@ -1639,7 +1641,7 @@ Field *Field::new_field(MEM_ROOT *root, struct st_table *new_table, Field *Field::new_key_field(MEM_ROOT *root, struct st_table *new_table, - char *new_ptr, uchar *new_null_ptr, + uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit) { Field *tmp; @@ -1693,7 +1695,7 @@ Field_decimal::reset(void) void Field_decimal::overflow(bool negative) { uint len=field_length; - char *to=ptr, filler= '9'; + uchar *to=ptr, filler= '9'; set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); if (negative) @@ -1729,36 +1731,37 @@ void Field_decimal::overflow(bool negative) } -int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) +int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs) { ASSERT_COLUMN_MARKED_FOR_WRITE; char buff[STRING_BUFFER_USUAL_SIZE]; String tmp(buff,sizeof(buff), &my_charset_bin); + const uchar *from= (uchar*) from_arg; - /* Convert character set if the old one is multi byte */ + /* Convert character set if the old one is multi uchar */ if (cs->mbmaxlen > 1) { uint dummy_errors; - tmp.copy(from, len, cs, &my_charset_bin, &dummy_errors); - from= tmp.ptr(); + tmp.copy((char*) from, len, cs, &my_charset_bin, &dummy_errors); + from= (uchar*) tmp.ptr(); len= tmp.length(); } - const char *end= from+len; + const uchar *end= from+len; /* The pointer where the field value starts (i.e., "where to write") */ - char *to=ptr; + uchar *to= ptr; uint tmp_dec, tmp_uint; /* The sign of the number : will be 0 (means positive but sign not specified), '+' or '-' */ - char sign_char=0; + uchar sign_char=0; /* The pointers where prezeros start and stop */ - const char *pre_zeros_from, *pre_zeros_end; + const uchar *pre_zeros_from, *pre_zeros_end; /* The pointers where digits at the left of '.' start and stop */ - const char *int_digits_from, *int_digits_end; + const uchar *int_digits_from, *int_digits_end; /* The pointers where digits at the right of '.' start and stop */ - const char *frac_digits_from, *frac_digits_end; + const uchar *frac_digits_from, *frac_digits_end; /* The sign of the exponent : will be 0 (means no exponent), '+' or '-' */ char expo_sign_char=0; uint exponent=0; // value of the exponent @@ -1766,20 +1769,20 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) Pointers used when digits move from the left of the '.' to the right of the '.' (explained below) */ - const char *int_digits_tail_from; + const uchar *int_digits_tail_from; /* Number of 0 that need to be added at the left of the '.' (1E3: 3 zeros) */ uint int_digits_added_zeros; /* Pointer used when digits move from the right of the '.' to the left of the '.' */ - const char *frac_digits_head_end; + const uchar *frac_digits_head_end; /* Number of 0 that need to be added at the right of the '.' (for 1E-3) */ uint frac_digits_added_zeros; - char *pos,*tmp_left_pos,*tmp_right_pos; + uchar *pos,*tmp_left_pos,*tmp_right_pos; /* Pointers that are used as limits (begin and end of the field buffer) */ - char *left_wall,*right_wall; - char tmp_char; + uchar *left_wall,*right_wall; + uchar tmp_char; /* To remember if table->in_use->cuted_fields has already been incremented, to do that only once @@ -2116,17 +2119,18 @@ int Field_decimal::store(double nr) } #endif - reg4 uint i,length; - char fyllchar,*to; + reg4 uint i; + size_t length; + uchar fyllchar,*to; char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE]; fyllchar = zerofill ? (char) '0' : (char) ' '; #ifdef HAVE_SNPRINTF buff[sizeof(buff)-1]=0; // Safety snprintf(buff,sizeof(buff)-1, "%.*f",(int) dec,nr); - length=(uint) strlen(buff); + length= strlen(buff); #else - length=(uint) my_sprintf(buff,(buff,"%.*f",dec,nr)); + length= my_sprintf(buff,(buff,"%.*f",dec,nr)); #endif if (length > field_length) @@ -2150,7 +2154,8 @@ int Field_decimal::store(longlong nr, bool unsigned_val) ASSERT_COLUMN_MARKED_FOR_WRITE; char buff[22]; uint length, int_part; - char fyllchar, *to; + char fyllchar; + uchar *to; if (nr < 0 && unsigned_flag && !unsigned_val) { @@ -2185,7 +2190,7 @@ double Field_decimal::val_real(void) ASSERT_COLUMN_MARKED_FOR_READ; int not_used; char *end_not_used; - return my_strntod(&my_charset_bin, ptr, field_length, &end_not_used, + return my_strntod(&my_charset_bin, (char*) ptr, field_length, &end_not_used, ¬_used); } @@ -2194,11 +2199,10 @@ longlong Field_decimal::val_int(void) ASSERT_COLUMN_MARKED_FOR_READ; int not_used; if (unsigned_flag) - return my_strntoull(&my_charset_bin, ptr, field_length, 10, NULL, - ¬_used); - else - return my_strntoll(&my_charset_bin, ptr, field_length, 10, NULL, + return my_strntoull(&my_charset_bin, (char*) ptr, field_length, 10, NULL, ¬_used); + return my_strntoll(&my_charset_bin, (char*) ptr, field_length, 10, NULL, + ¬_used); } @@ -2206,10 +2210,12 @@ String *Field_decimal::val_str(String *val_buffer __attribute__((unused)), String *val_ptr) { ASSERT_COLUMN_MARKED_FOR_READ; - char *str; + uchar *str; + size_t tmp_length; + for (str=ptr ; *str == ' ' ; str++) ; - uint tmp_length=(uint) (str-ptr); val_ptr->set_charset(&my_charset_bin); + tmp_length= (size_t) (str-ptr); if (field_length < tmp_length) // Error in data val_ptr->length(0); else @@ -2222,9 +2228,9 @@ String *Field_decimal::val_str(String *val_buffer __attribute__((unused)), ** 5.00 , -1.0, 05, -05, +5 with optional pre/end space */ -int Field_decimal::cmp(const char *a_ptr,const char *b_ptr) +int Field_decimal::cmp(const uchar *a_ptr,const uchar *b_ptr) { - const char *end; + const uchar *end; int swap=0; /* First remove prefixes '0', ' ', and '-' */ for (end=a_ptr+field_length; @@ -2255,9 +2261,9 @@ int Field_decimal::cmp(const char *a_ptr,const char *b_ptr) } -void Field_decimal::sort_string(char *to,uint length) +void Field_decimal::sort_string(uchar *to,uint length) { - char *str,*end; + uchar *str,*end; for (str=ptr,end=ptr+length; str != end && ((my_isspace(&my_charset_bin,*str) || *str == '+' || @@ -2299,7 +2305,7 @@ void Field_decimal::sql_type(String &res) const ** Field_new_decimal ****************************************************************************/ -Field_new_decimal::Field_new_decimal(char *ptr_arg, +Field_new_decimal::Field_new_decimal(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, @@ -2321,7 +2327,7 @@ Field_new_decimal::Field_new_decimal(uint32 len_arg, const char *name, uint8 dec_arg, bool unsigned_arg) - :Field_num((char*) 0, len_arg, + :Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0, NONE, name, dec_arg, 0, unsigned_arg) { @@ -2419,7 +2425,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value) my_decimal2binary(E_DEC_FATAL_ERROR, &buff, ptr, precision, dec); error= 1; } - DBUG_EXECUTE("info", print_decimal_buff(decimal_value, (byte *) ptr, + DBUG_EXECUTE("info", print_decimal_buff(decimal_value, (uchar *) ptr, bin_size);); DBUG_RETURN(error); } @@ -2434,8 +2440,9 @@ int Field_new_decimal::store(const char *from, uint length, DBUG_ENTER("Field_new_decimal::store(char*)"); if ((err= str2my_decimal(E_DEC_FATAL_ERROR & - ~(E_DEC_OVERFLOW | E_DEC_BAD_NUM), - from, length, charset_arg, &decimal_value)) && + ~(E_DEC_OVERFLOW | E_DEC_BAD_NUM), + from, length, charset_arg, + &decimal_value)) && table->in_use->abort_on_warning) { /* Because "from" is not NUL-terminated and we use %s in the ER() */ @@ -2584,7 +2591,7 @@ my_decimal* Field_new_decimal::val_decimal(my_decimal *decimal_value) DBUG_ENTER("Field_new_decimal::val_decimal"); binary2my_decimal(E_DEC_FATAL_ERROR, ptr, decimal_value, precision, dec); - DBUG_EXECUTE("info", print_decimal_buff(decimal_value, (byte *) ptr, + DBUG_EXECUTE("info", print_decimal_buff(decimal_value, (uchar *) ptr, bin_size);); DBUG_RETURN(decimal_value); } @@ -2602,13 +2609,13 @@ String *Field_new_decimal::val_str(String *val_buffer, } -int Field_new_decimal::cmp(const char *a,const char*b) +int Field_new_decimal::cmp(const uchar *a,const uchar*b) { return memcmp(a, b, bin_size); } -void Field_new_decimal::sort_string(char *buff, +void Field_new_decimal::sort_string(uchar *buff, uint length __attribute__((unused))) { memcpy(buff, ptr, bin_size); @@ -2743,7 +2750,7 @@ int Field_tiny::store(longlong nr, bool unsigned_val) double Field_tiny::val_real(void) { ASSERT_COLUMN_MARKED_FOR_READ; - int tmp= unsigned_flag ? (int) ((uchar*) ptr)[0] : + int tmp= unsigned_flag ? (int) ptr[0] : (int) ((signed char*) ptr)[0]; return (double) tmp; } @@ -2752,7 +2759,7 @@ double Field_tiny::val_real(void) longlong Field_tiny::val_int(void) { ASSERT_COLUMN_MARKED_FOR_READ; - int tmp= unsigned_flag ? (int) ((uchar*) ptr)[0] : + int tmp= unsigned_flag ? (int) ptr[0] : (int) ((signed char*) ptr)[0]; return (longlong) tmp; } @@ -2770,7 +2777,7 @@ String *Field_tiny::val_str(String *val_buffer, if (unsigned_flag) length= (uint) cs->cset->long10_to_str(cs,to,mlength, 10, - (long) *((uchar*) ptr)); + (long) *ptr); else length= (uint) cs->cset->long10_to_str(cs,to,mlength,-10, (long) *((signed char*) ptr)); @@ -2786,7 +2793,7 @@ bool Field_tiny::send_binary(Protocol *protocol) return protocol->store_tiny((longlong) (int8) ptr[0]); } -int Field_tiny::cmp(const char *a_ptr, const char *b_ptr) +int Field_tiny::cmp(const uchar *a_ptr, const uchar *b_ptr) { signed char a,b; a=(signed char) a_ptr[0]; b= (signed char) b_ptr[0]; @@ -2795,12 +2802,12 @@ int Field_tiny::cmp(const char *a_ptr, const char *b_ptr) return (a < b) ? -1 : (a > b) ? 1 : 0; } -void Field_tiny::sort_string(char *to,uint length __attribute__((unused))) +void Field_tiny::sort_string(uchar *to,uint length __attribute__((unused))) { if (unsigned_flag) *to= *ptr; else - to[0] = (char) ((uchar) ptr[0] ^ (uchar) 128); /* Revers signbit */ + to[0] = (char) (ptr[0] ^ (uchar) 128); /* Revers signbit */ } void Field_tiny::sql_type(String &res) const @@ -3005,7 +3012,7 @@ bool Field_short::send_binary(Protocol *protocol) } -int Field_short::cmp(const char *a_ptr, const char *b_ptr) +int Field_short::cmp(const uchar *a_ptr, const uchar *b_ptr) { short a,b; #ifdef WORDS_BIGENDIAN @@ -3027,7 +3034,7 @@ int Field_short::cmp(const char *a_ptr, const char *b_ptr) return (a < b) ? -1 : (a > b) ? 1 : 0; } -void Field_short::sort_string(char *to,uint length __attribute__((unused))) +void Field_short::sort_string(uchar *to,uint length __attribute__((unused))) { #ifdef WORDS_BIGENDIAN if (!table->s->db_low_byte_first) @@ -3213,7 +3220,7 @@ bool Field_medium::send_binary(Protocol *protocol) } -int Field_medium::cmp(const char *a_ptr, const char *b_ptr) +int Field_medium::cmp(const uchar *a_ptr, const uchar *b_ptr) { long a,b; if (unsigned_flag) @@ -3229,7 +3236,7 @@ int Field_medium::cmp(const char *a_ptr, const char *b_ptr) return (a < b) ? -1 : (a > b) ? 1 : 0; } -void Field_medium::sort_string(char *to,uint length __attribute__((unused))) +void Field_medium::sort_string(uchar *to,uint length __attribute__((unused))) { if (unsigned_flag) to[0] = ptr[2]; @@ -3440,7 +3447,7 @@ bool Field_long::send_binary(Protocol *protocol) return protocol->store_long(Field_long::val_int()); } -int Field_long::cmp(const char *a_ptr, const char *b_ptr) +int Field_long::cmp(const uchar *a_ptr, const uchar *b_ptr) { int32 a,b; #ifdef WORDS_BIGENDIAN @@ -3460,7 +3467,7 @@ int Field_long::cmp(const char *a_ptr, const char *b_ptr) return (a < b) ? -1 : (a > b) ? 1 : 0; } -void Field_long::sort_string(char *to,uint length __attribute__((unused))) +void Field_long::sort_string(uchar *to,uint length __attribute__((unused))) { #ifdef WORDS_BIGENDIAN if (!table->s->db_low_byte_first) @@ -3680,7 +3687,7 @@ bool Field_longlong::send_binary(Protocol *protocol) } -int Field_longlong::cmp(const char *a_ptr, const char *b_ptr) +int Field_longlong::cmp(const uchar *a_ptr, const uchar *b_ptr) { longlong a,b; #ifdef WORDS_BIGENDIAN @@ -3701,7 +3708,7 @@ int Field_longlong::cmp(const char *a_ptr, const char *b_ptr) return (a < b) ? -1 : (a > b) ? 1 : 0; } -void Field_longlong::sort_string(char *to,uint length __attribute__((unused))) +void Field_longlong::sort_string(uchar *to,uint length __attribute__((unused))) { #ifdef WORDS_BIGENDIAN if (!table->s->db_low_byte_first) @@ -3826,7 +3833,7 @@ int Field_float::store(double nr) } else #endif - memcpy_fixed(ptr,(byte*) &j,sizeof(j)); + memcpy_fixed(ptr,(uchar*) &j,sizeof(j)); return error; } @@ -3849,7 +3856,7 @@ double Field_float::val_real(void) } else #endif - memcpy_fixed((byte*) &j,ptr,sizeof(j)); + memcpy_fixed((uchar*) &j,ptr,sizeof(j)); return ((double) j); } @@ -3863,7 +3870,7 @@ longlong Field_float::val_int(void) } else #endif - memcpy_fixed((byte*) &j,ptr,sizeof(j)); + memcpy_fixed((uchar*) &j,ptr,sizeof(j)); return (longlong) rint(j); } @@ -3880,7 +3887,7 @@ String *Field_float::val_str(String *val_buffer, } else #endif - memcpy_fixed((byte*) &nr,ptr,sizeof(nr)); + memcpy_fixed((uchar*) &nr,ptr,sizeof(nr)); uint to_length=max(field_length,70); val_buffer->alloc(to_length); @@ -3952,7 +3959,7 @@ String *Field_float::val_str(String *val_buffer, } -int Field_float::cmp(const char *a_ptr, const char *b_ptr) +int Field_float::cmp(const uchar *a_ptr, const uchar *b_ptr) { float a,b; #ifdef WORDS_BIGENDIAN @@ -3972,7 +3979,7 @@ int Field_float::cmp(const char *a_ptr, const char *b_ptr) #define FLT_EXP_DIG (sizeof(float)*8-FLT_MANT_DIG) -void Field_float::sort_string(char *to,uint length __attribute__((unused))) +void Field_float::sort_string(uchar *to,uint length __attribute__((unused))) { float nr; #ifdef WORDS_BIGENDIAN @@ -3984,7 +3991,7 @@ void Field_float::sort_string(char *to,uint length __attribute__((unused))) #endif memcpy_fixed(&nr,ptr,sizeof(float)); - uchar *tmp= (uchar*) to; + uchar *tmp= to; if (nr == (float) 0.0) { /* Change to zero string */ tmp[0]=(uchar) 128; @@ -4284,7 +4291,7 @@ bool Field_double::send_binary(Protocol *protocol) } -int Field_double::cmp(const char *a_ptr, const char *b_ptr) +int Field_double::cmp(const uchar *a_ptr, const uchar *b_ptr) { ASSERT_COLUMN_MARKED_FOR_READ; double a,b; @@ -4308,7 +4315,7 @@ int Field_double::cmp(const char *a_ptr, const char *b_ptr) /* The following should work for IEEE */ -void Field_double::sort_string(char *to,uint length __attribute__((unused))) +void Field_double::sort_string(uchar *to,uint length __attribute__((unused))) { double nr; #ifdef WORDS_BIGENDIAN @@ -4319,7 +4326,7 @@ void Field_double::sort_string(char *to,uint length __attribute__((unused))) else #endif doubleget(nr,ptr); - change_double_for_sort(nr, (byte*) to); + change_double_for_sort(nr, to); } @@ -4384,7 +4391,7 @@ void Field_double::sql_type(String &res) const exception is different behavior of old/new timestamps during ALTER TABLE. */ -Field_timestamp::Field_timestamp(char *ptr_arg, uint32 len_arg, +Field_timestamp::Field_timestamp(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, @@ -4407,7 +4414,7 @@ Field_timestamp::Field_timestamp(char *ptr_arg, uint32 len_arg, Field_timestamp::Field_timestamp(bool maybe_null_arg, const char *field_name_arg, CHARSET_INFO *cs) - :Field_str((char*) 0, 19, maybe_null_arg ? (uchar*) "": 0, 0, + :Field_str((uchar*) 0, 19, maybe_null_arg ? (uchar*) "": 0, 0, NONE, field_name_arg, cs) { /* For 4.0 MYD and 4.0 InnoDB compatibility */ @@ -4720,7 +4727,7 @@ bool Field_timestamp::send_binary(Protocol *protocol) } -int Field_timestamp::cmp(const char *a_ptr, const char *b_ptr) +int Field_timestamp::cmp(const uchar *a_ptr, const uchar *b_ptr) { int32 a,b; #ifdef WORDS_BIGENDIAN @@ -4739,7 +4746,7 @@ int Field_timestamp::cmp(const char *a_ptr, const char *b_ptr) } -void Field_timestamp::sort_string(char *to,uint length __attribute__((unused))) +void Field_timestamp::sort_string(uchar *to,uint length __attribute__((unused))) { #ifdef WORDS_BIGENDIAN if (!table || !table->s->db_low_byte_first) @@ -5021,7 +5028,7 @@ bool Field_time::send_binary(Protocol *protocol) } -int Field_time::cmp(const char *a_ptr, const char *b_ptr) +int Field_time::cmp(const uchar *a_ptr, const uchar *b_ptr) { int32 a,b; a=(int32) sint3korr(a_ptr); @@ -5029,7 +5036,7 @@ int Field_time::cmp(const char *a_ptr, const char *b_ptr) return (a < b) ? -1 : (a > b) ? 1 : 0; } -void Field_time::sort_string(char *to,uint length __attribute__((unused))) +void Field_time::sort_string(uchar *to,uint length __attribute__((unused))) { to[0] = (uchar) (ptr[2] ^ 128); to[1] = ptr[1]; @@ -5133,7 +5140,7 @@ double Field_year::val_real(void) longlong Field_year::val_int(void) { ASSERT_COLUMN_MARKED_FOR_READ; - int tmp= (int) ((uchar*) ptr)[0]; + int tmp= (int) ptr[0]; if (field_length != 4) tmp%=100; // Return last 2 char else if (tmp) @@ -5327,7 +5334,7 @@ String *Field_date::val_str(String *val_buffer, } -int Field_date::cmp(const char *a_ptr, const char *b_ptr) +int Field_date::cmp(const uchar *a_ptr, const uchar *b_ptr) { int32 a,b; #ifdef WORDS_BIGENDIAN @@ -5346,7 +5353,7 @@ int Field_date::cmp(const char *a_ptr, const char *b_ptr) } -void Field_date::sort_string(char *to,uint length __attribute__((unused))) +void Field_date::sort_string(uchar *to,uint length __attribute__((unused))) { #ifdef WORDS_BIGENDIAN if (!table || !table->s->db_low_byte_first) @@ -5578,7 +5585,7 @@ bool Field_newdate::get_time(MYSQL_TIME *ltime) } -int Field_newdate::cmp(const char *a_ptr, const char *b_ptr) +int Field_newdate::cmp(const uchar *a_ptr, const uchar *b_ptr) { uint32 a,b; a=(uint32) uint3korr(a_ptr); @@ -5587,7 +5594,7 @@ int Field_newdate::cmp(const char *a_ptr, const char *b_ptr) } -void Field_newdate::sort_string(char *to,uint length __attribute__((unused))) +void Field_newdate::sort_string(uchar *to,uint length __attribute__((unused))) { to[0] = ptr[2]; to[1] = ptr[1]; @@ -5843,7 +5850,7 @@ bool Field_datetime::get_time(MYSQL_TIME *ltime) return Field_datetime::get_date(ltime,0); } -int Field_datetime::cmp(const char *a_ptr, const char *b_ptr) +int Field_datetime::cmp(const uchar *a_ptr, const uchar *b_ptr) { longlong a,b; #ifdef WORDS_BIGENDIAN @@ -5862,7 +5869,7 @@ int Field_datetime::cmp(const char *a_ptr, const char *b_ptr) ((ulonglong) a > (ulonglong) b) ? 1 : 0; } -void Field_datetime::sort_string(char *to,uint length __attribute__((unused))) +void Field_datetime::sort_string(uchar *to,uint length __attribute__((unused))) { #ifdef WORDS_BIGENDIAN if (!table || !table->s->db_low_byte_first) @@ -6013,7 +6020,7 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs) DBUG_ASSERT(table->in_use == current_thd); copy_length= well_formed_copy_nchars(field_charset, - ptr, field_length, + (char*) ptr, field_length, cs, from, length, field_length / field_charset->mbmaxlen, &well_formed_error_pos, @@ -6022,7 +6029,7 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs) /* Append spaces if the string was shorter than the field. */ if (copy_length < field_length) - field_charset->cset->fill(field_charset,ptr+copy_length, + field_charset->cset->fill(field_charset,(char*) ptr+copy_length, field_length-copy_length, field_charset->pad_char); @@ -6089,7 +6096,7 @@ int Field_str::store(double nr) like inserting 500.0 in char(1) */ DBUG_ASSERT(local_char_length < 5 || length <= local_char_length+1); - return store((const char *) buff, length, charset()); + return store(buff, length, charset()); } @@ -6149,14 +6156,15 @@ double Field_string::val_real(void) CHARSET_INFO *cs= charset(); double result; - result= my_strntod(cs,ptr,field_length,&end,&error); + result= my_strntod(cs,(char*) ptr,field_length,&end,&error); if (!table->in_use->no_errors && - (error || (field_length != (uint32)(end - ptr) && - !check_if_only_end_space(cs, end, ptr + field_length)))) + (error || (field_length != (uint32)(end - (char*) ptr) && + !check_if_only_end_space(cs, end, + (char*) ptr + field_length)))) { char buf[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE]; String tmp(buf, sizeof(buf), cs); - tmp.copy(ptr, field_length, cs); + tmp.copy((char*) ptr, field_length, cs); push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_TRUNCATED_WRONG_VALUE, ER(ER_TRUNCATED_WRONG_VALUE), @@ -6174,14 +6182,15 @@ longlong Field_string::val_int(void) CHARSET_INFO *cs= charset(); longlong result; - result= my_strntoll(cs,ptr,field_length,10,&end,&error); + result= my_strntoll(cs, (char*) ptr,field_length,10,&end,&error); if (!table->in_use->no_errors && - (error || (field_length != (uint32)(end - ptr) && - !check_if_only_end_space(cs, end, ptr + field_length)))) + (error || (field_length != (uint32)(end - (char*) ptr) && + !check_if_only_end_space(cs, end, + (char*) ptr + field_length)))) { char buf[LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE]; String tmp(buf, sizeof(buf), cs); - tmp.copy(ptr, field_length, cs); + tmp.copy((char*) ptr, field_length, cs); push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_TRUNCATED_WRONG_VALUE, ER(ER_TRUNCATED_WRONG_VALUE), @@ -6202,7 +6211,8 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)), MODE_PAD_CHAR_TO_FULL_LENGTH) length= my_charpos(field_charset, ptr, ptr + field_length, field_length); else - length= field_charset->cset->lengthsp(field_charset, ptr, field_length); + length= field_charset->cset->lengthsp(field_charset, (const char*) ptr, + field_length); val_ptr->set((const char*) ptr, length, field_charset); return val_ptr; } @@ -6211,14 +6221,14 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)), my_decimal *Field_string::val_decimal(my_decimal *decimal_value) { ASSERT_COLUMN_MARKED_FOR_READ; - int err= str2my_decimal(E_DEC_FATAL_ERROR, ptr, field_length, charset(), - decimal_value); + int err= str2my_decimal(E_DEC_FATAL_ERROR, (char*) ptr, field_length, + charset(), decimal_value); if (!table->in_use->no_errors && err) { char buf[DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE]; CHARSET_INFO *cs= charset(); String tmp(buf, sizeof(buf), cs); - tmp.copy(ptr, field_length, cs); + tmp.copy((char*) ptr, field_length, cs); push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_TRUNCATED_WRONG_VALUE, ER(ER_TRUNCATED_WRONG_VALUE), @@ -6229,7 +6239,7 @@ my_decimal *Field_string::val_decimal(my_decimal *decimal_value) } -int Field_string::cmp(const char *a_ptr, const char *b_ptr) +int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr) { uint a_len, b_len; @@ -6246,17 +6256,17 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr) like in latin_de 'ae' and 0xe4 */ return field_charset->coll->strnncollsp(field_charset, - (const uchar*) a_ptr, a_len, - (const uchar*) b_ptr, b_len, + a_ptr, a_len, + b_ptr, b_len, 0); } -void Field_string::sort_string(char *to,uint length) +void Field_string::sort_string(uchar *to,uint length) { IF_DBUG(uint tmp=) my_strnxfrm(field_charset, - (uchar*) to, length, - (uchar*) ptr, field_length); + to, length, + ptr, field_length); DBUG_ASSERT(tmp == length); } @@ -6281,7 +6291,7 @@ void Field_string::sql_type(String &res) const } -char *Field_string::pack(char *to, const char *from, uint max_length) +uchar *Field_string::pack(uchar *to, const uchar *from, uint max_length) { uint length= min(field_length,max_length); uint local_char_length= max_length/field_charset->mbmaxlen; @@ -6291,15 +6301,15 @@ char *Field_string::pack(char *to, const char *from, uint max_length) set_if_smaller(length, local_char_length); while (length && from[length-1] == ' ') length--; - *to++= (char) (uchar) length; + *to++= (uchar) length; if (field_length > 255) - *to++= (char) (uchar) (length >> 8); + *to++= (uchar) (length >> 8); memcpy(to, from, length); return to+length; } -const char *Field_string::unpack(char *to, const char *from) +const uchar *Field_string::unpack(uchar *to, const uchar *from) { uint length; if (field_length > 255) @@ -6308,7 +6318,7 @@ const char *Field_string::unpack(char *to, const char *from) from+= 2; } else - length= (uint) (uchar) *from++; + length= (uint) *from++; memcpy(to, from, (int) length); bfill(to+length, field_length - length, ' '); return from+length; @@ -6331,7 +6341,7 @@ const char *Field_string::unpack(char *to, const char *from) > 0 a > b */ -int Field_string::pack_cmp(const char *a, const char *b, uint length, +int Field_string::pack_cmp(const uchar *a, const uchar *b, uint length, my_bool insert_or_update) { uint a_length, b_length; @@ -6344,12 +6354,12 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length, } else { - a_length= (uint) (uchar) *a++; - b_length= (uint) (uchar) *b++; + a_length= (uint) *a++; + b_length= (uint) *b++; } return field_charset->coll->strnncollsp(field_charset, - (const uchar*) a, a_length, - (const uchar*) b, b_length, + a, a_length, + b, b_length, insert_or_update); } @@ -6369,18 +6379,18 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length, > 0 row > key */ -int Field_string::pack_cmp(const char *key, uint length, +int Field_string::pack_cmp(const uchar *key, uint length, my_bool insert_or_update) { uint row_length, local_key_length; - char *end; + uchar *end; if (length > 255) { local_key_length= uint2korr(key); key+= 2; } else - local_key_length= (uint) (uchar) *key++; + local_key_length= (uint) *key++; /* Only use 'length' of key, not field_length */ end= ptr + length; @@ -6389,17 +6399,17 @@ int Field_string::pack_cmp(const char *key, uint length, row_length= (uint) (end - ptr); return field_charset->coll->strnncollsp(field_charset, - (const uchar*) ptr, row_length, - (const uchar*) key, local_key_length, + ptr, row_length, + key, local_key_length, insert_or_update); } -uint Field_string::packed_col_length(const char *data_ptr, uint length) +uint Field_string::packed_col_length(const uchar *data_ptr, uint length) { if (length > 255) return uint2korr(data_ptr)+2; - return (uint) ((uchar) *data_ptr)+1; + return (uint) *data_ptr + 1; } @@ -6408,9 +6418,11 @@ uint Field_string::max_packed_col_length(uint max_length) return (max_length > 255 ? 2 : 1)+max_length; } -uint Field_string::get_key_image(char *buff, uint length, imagetype type_arg) + +uint Field_string::get_key_image(uchar *buff, uint length, imagetype type_arg) { - uint bytes = my_charpos(field_charset, ptr, ptr + field_length, + uint bytes = my_charpos(field_charset, (char*) ptr, + (char*) ptr + field_length, length / field_charset->mbmaxlen); memcpy(buff, ptr, bytes); if (bytes < length) @@ -6418,6 +6430,7 @@ uint Field_string::get_key_image(char *buff, uint length, imagetype type_arg) return bytes; } + Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type) { @@ -6471,7 +6484,8 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs) const char *from_end_pos; copy_length= well_formed_copy_nchars(field_charset, - ptr + length_bytes, field_length, + (char*) ptr + length_bytes, + field_length, cs, from, length, field_length / field_charset->mbmaxlen, &well_formed_error_pos, @@ -6519,9 +6533,9 @@ double Field_varstring::val_real(void) ASSERT_COLUMN_MARKED_FOR_READ; int not_used; char *end_not_used; - uint length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr); - return my_strntod(field_charset, ptr+length_bytes, length, &end_not_used, - ¬_used); + uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); + return my_strntod(field_charset, (char*) ptr+length_bytes, length, + &end_not_used, ¬_used); } @@ -6530,8 +6544,8 @@ longlong Field_varstring::val_int(void) ASSERT_COLUMN_MARKED_FOR_READ; int not_used; char *end_not_used; - uint length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr); - return my_strntoll(field_charset, ptr+length_bytes, length, 10, + uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); + return my_strntoll(field_charset, (char*) ptr+length_bytes, length, 10, &end_not_used, ¬_used); } @@ -6539,7 +6553,7 @@ String *Field_varstring::val_str(String *val_buffer __attribute__((unused)), String *val_ptr) { ASSERT_COLUMN_MARKED_FOR_READ; - uint length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr); + uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); val_ptr->set((const char*) ptr+length_bytes, length, field_charset); return val_ptr; } @@ -6548,14 +6562,14 @@ String *Field_varstring::val_str(String *val_buffer __attribute__((unused)), my_decimal *Field_varstring::val_decimal(my_decimal *decimal_value) { ASSERT_COLUMN_MARKED_FOR_READ; - uint length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr); - str2my_decimal(E_DEC_FATAL_ERROR, ptr+length_bytes, length, charset(), - decimal_value); + uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); + str2my_decimal(E_DEC_FATAL_ERROR, (char*) ptr+length_bytes, length, + charset(), decimal_value); return decimal_value; } -int Field_varstring::cmp_max(const char *a_ptr, const char *b_ptr, +int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr, uint max_len) { uint a_length, b_length; @@ -6563,8 +6577,8 @@ int Field_varstring::cmp_max(const char *a_ptr, const char *b_ptr, if (length_bytes == 1) { - a_length= (uint) (uchar) *a_ptr; - b_length= (uint) (uchar) *b_ptr; + a_length= (uint) *a_ptr; + b_length= (uint) *b_ptr; } else { @@ -6574,10 +6588,10 @@ int Field_varstring::cmp_max(const char *a_ptr, const char *b_ptr, set_if_smaller(a_length, max_len); set_if_smaller(b_length, max_len); diff= field_charset->coll->strnncollsp(field_charset, - (const uchar*) a_ptr+ + a_ptr+ length_bytes, a_length, - (const uchar*) b_ptr+ + b_ptr+ length_bytes, b_length,0); return diff; @@ -6588,18 +6602,18 @@ int Field_varstring::cmp_max(const char *a_ptr, const char *b_ptr, NOTE: varstring and blob keys are ALWAYS stored with a 2 byte length prefix */ -int Field_varstring::key_cmp(const byte *key_ptr, uint max_key_length) +int Field_varstring::key_cmp(const uchar *key_ptr, uint max_key_length) { - uint length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr); + uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); uint local_char_length= max_key_length / field_charset->mbmaxlen; local_char_length= my_charpos(field_charset, ptr + length_bytes, ptr + length_bytes + length, local_char_length); set_if_smaller(length, local_char_length); return field_charset->coll->strnncollsp(field_charset, - (const uchar*) ptr + length_bytes, + ptr + length_bytes, length, - (const uchar*) key_ptr+ + key_ptr+ HA_KEY_BLOB_LENGTH, uint2korr(key_ptr), 0); } @@ -6613,22 +6627,20 @@ int Field_varstring::key_cmp(const byte *key_ptr, uint max_key_length) (keys are created and compared in key.cc) */ -int Field_varstring::key_cmp(const byte *a,const byte *b) +int Field_varstring::key_cmp(const uchar *a,const uchar *b) { return field_charset->coll->strnncollsp(field_charset, - (const uchar*) a + - HA_KEY_BLOB_LENGTH, + a + HA_KEY_BLOB_LENGTH, uint2korr(a), - (const uchar*) b + - HA_KEY_BLOB_LENGTH, + b + HA_KEY_BLOB_LENGTH, uint2korr(b), 0); } -void Field_varstring::sort_string(char *to,uint length) +void Field_varstring::sort_string(uchar *to,uint length) { - uint tot_length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr); + uint tot_length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); if (field_charset == &my_charset_bin) { @@ -6641,8 +6653,7 @@ void Field_varstring::sort_string(char *to,uint length) } tot_length= my_strnxfrm(field_charset, - (uchar*) to, length, - (uchar*) ptr + length_bytes, + to, length, ptr + length_bytes, tot_length); DBUG_ASSERT(tot_length == length); } @@ -6679,7 +6690,7 @@ void Field_varstring::sql_type(String &res) const uint32 Field_varstring::data_length() { - return length_bytes == 1 ? (uint32) (uchar) *ptr : uint2korr(ptr); + return length_bytes == 1 ? (uint32) *ptr : uint2korr(ptr); } /* @@ -6687,9 +6698,9 @@ uint32 Field_varstring::data_length() Here the number of length bytes are depending on the given max_length */ -char *Field_varstring::pack(char *to, const char *from, uint max_length) +uchar *Field_varstring::pack(uchar *to, const uchar *from, uint max_length) { - uint length= length_bytes == 1 ? (uint) (uchar) *from : uint2korr(from); + uint length= length_bytes == 1 ? (uint) *from : uint2korr(from); set_if_smaller(max_length, field_length); if (length > max_length) length=max_length; @@ -6702,9 +6713,9 @@ char *Field_varstring::pack(char *to, const char *from, uint max_length) } -char *Field_varstring::pack_key(char *to, const char *key, uint max_length) +uchar *Field_varstring::pack_key(uchar *to, const uchar *key, uint max_length) { - uint length= length_bytes == 1 ? (uint) (uchar) *key : uint2korr(key); + uint length= length_bytes == 1 ? (uint) *key : uint2korr(key); uint local_char_length= ((field_charset->mbmaxlen > 1) ? max_length/field_charset->mbmaxlen : max_length); key+= length_bytes; @@ -6741,13 +6752,13 @@ char *Field_varstring::pack_key(char *to, const char *key, uint max_length) Pointer to end of 'key' (To the next key part if multi-segment key) */ -const char *Field_varstring::unpack_key(char *to, const char *key, - uint max_length) +const uchar *Field_varstring::unpack_key(uchar *to, const uchar *key, + uint max_length) { /* get length of the blob key */ - uint32 length= *((uchar*) key++); + uint32 length= *key++; if (max_length > 255) - length+= (*((uchar*) key++)) << 8; + length+= (*key++) << 8; /* put the length into the record buffer */ if (length_bytes == 1) @@ -6771,8 +6782,8 @@ const char *Field_varstring::unpack_key(char *to, const char *key, end of key storage */ -char *Field_varstring::pack_key_from_key_image(char *to, const char *from, - uint max_length) +uchar *Field_varstring::pack_key_from_key_image(uchar *to, const uchar *from, + uint max_length) { /* Key length is always stored as 2 bytes */ uint length= uint2korr(from); @@ -6791,11 +6802,11 @@ char *Field_varstring::pack_key_from_key_image(char *to, const char *from, unpack field packed with Field_varstring::pack() */ -const char *Field_varstring::unpack(char *to, const char *from) +const uchar *Field_varstring::unpack(uchar *to, const uchar *from) { uint length; if (length_bytes == 1) - length= (uint) (uchar) (*to= *from++); + length= (uint) (*to= *from++); else { length= uint2korr(from); @@ -6808,7 +6819,7 @@ const char *Field_varstring::unpack(char *to, const char *from) } -int Field_varstring::pack_cmp(const char *a, const char *b, +int Field_varstring::pack_cmp(const uchar *a, const uchar *b, uint key_length_arg, my_bool insert_or_update) { @@ -6820,21 +6831,21 @@ int Field_varstring::pack_cmp(const char *a, const char *b, } else { - a_length= (uint) (uchar) *a++; - b_length= (uint) (uchar) *b++; + a_length= (uint) *a++; + b_length= (uint) *b++; } return field_charset->coll->strnncollsp(field_charset, - (const uchar*) a, a_length, - (const uchar*) b, b_length, + a, a_length, + b, b_length, insert_or_update); } -int Field_varstring::pack_cmp(const char *b, uint key_length_arg, +int Field_varstring::pack_cmp(const uchar *b, uint key_length_arg, my_bool insert_or_update) { - char *a= ptr+ length_bytes; - uint a_length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr); + uchar *a= ptr+ length_bytes; + uint a_length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); uint b_length; uint local_char_length= ((field_charset->mbmaxlen > 1) ? key_length_arg / field_charset->mbmaxlen : @@ -6845,7 +6856,7 @@ int Field_varstring::pack_cmp(const char *b, uint key_length_arg, b_length=uint2korr(b); b+= HA_KEY_BLOB_LENGTH; } else - b_length= (uint) (uchar) *b++; + b_length= (uint) *b++; if (a_length > local_char_length) { @@ -6855,18 +6866,17 @@ int Field_varstring::pack_cmp(const char *b, uint key_length_arg, } return field_charset->coll->strnncollsp(field_charset, - (const uchar*) a, - a_length, - (const uchar*) b, b_length, + a, a_length, + b, b_length, insert_or_update); } -uint Field_varstring::packed_col_length(const char *data_ptr, uint length) +uint Field_varstring::packed_col_length(const uchar *data_ptr, uint length) { if (length > 255) return uint2korr(data_ptr)+2; - return (uint) ((uchar) *data_ptr)+1; + return (uint) *data_ptr + 1; } @@ -6875,11 +6885,11 @@ uint Field_varstring::max_packed_col_length(uint max_length) return (max_length > 255 ? 2 : 1)+max_length; } -uint Field_varstring::get_key_image(char *buff, uint length, imagetype type) +uint Field_varstring::get_key_image(uchar *buff, uint length, imagetype type) { - uint f_length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr); + uint f_length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); uint local_char_length= length / field_charset->mbmaxlen; - char *pos= ptr+length_bytes; + uchar *pos= ptr+length_bytes; local_char_length= my_charpos(field_charset, pos, pos + f_length, local_char_length); set_if_smaller(f_length, local_char_length); @@ -6898,23 +6908,23 @@ uint Field_varstring::get_key_image(char *buff, uint length, imagetype type) } -void Field_varstring::set_key_image(char *buff,uint length) +void Field_varstring::set_key_image(const uchar *buff,uint length) { length= uint2korr(buff); // Real length is here - (void) Field_varstring::store(buff+HA_KEY_BLOB_LENGTH, length, + (void) Field_varstring::store((const char*) buff+HA_KEY_BLOB_LENGTH, length, field_charset); } -int Field_varstring::cmp_binary(const char *a_ptr, const char *b_ptr, +int Field_varstring::cmp_binary(const uchar *a_ptr, const uchar *b_ptr, uint32 max_length) { uint32 a_length,b_length; if (length_bytes == 1) { - a_length= (uint) (uchar) *a_ptr; - b_length= (uint) (uchar) *b_ptr; + a_length= (uint) *a_ptr; + b_length= (uint) *b_ptr; } else { @@ -6942,7 +6952,7 @@ Field *Field_varstring::new_field(MEM_ROOT *root, struct st_table *new_table, Field *Field_varstring::new_key_field(MEM_ROOT *root, struct st_table *new_table, - char *new_ptr, uchar *new_null_ptr, + uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit) { Field_varstring *res; @@ -6983,9 +6993,9 @@ void Field_varstring::hash(ulong *nr, ulong *nr2) } else { - uint len= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr); + uint len= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); CHARSET_INFO *cs= charset(); - cs->coll->hash_sort(cs, (uchar*) ptr + length_bytes, len, nr, nr2); + cs->coll->hash_sort(cs, ptr + length_bytes, len, nr, nr2); } } @@ -6996,7 +7006,7 @@ void Field_varstring::hash(ulong *nr, ulong *nr2) ** packlength slot and may be from 1-4. ****************************************************************************/ -Field_blob::Field_blob(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, +Field_blob::Field_blob(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, TABLE_SHARE *share, uint blob_pack_length, CHARSET_INFO *cs) @@ -7043,11 +7053,11 @@ void Field_blob::store_length(uint32 number) } -uint32 Field_blob::get_length(const char *pos) +uint32 Field_blob::get_length(const uchar *pos) { switch (packlength) { case 1: - return (uint32) (uchar) pos[0]; + return (uint32) pos[0]; case 2: { uint16 tmp; @@ -7094,7 +7104,7 @@ uint32 Field_blob::get_length(const char *pos) nothing */ -void Field_blob::put_length(char *pos, uint32 length) +void Field_blob::put_length(uchar *pos, uint32 length) { switch (packlength) { case 1: @@ -7162,7 +7172,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs) Field_blob::store_length(copy_length); tmp= value.ptr(); - bmove(ptr+packlength,(char*) &tmp,sizeof(char*)); + bmove(ptr+packlength,(uchar*) &tmp,sizeof(char*)); if (check_string_copy_error(this, well_formed_error_pos, cannot_convert_error_pos, from + length)) @@ -7246,29 +7256,35 @@ my_decimal *Field_blob::val_decimal(my_decimal *decimal_value) { ASSERT_COLUMN_MARKED_FOR_READ; const char *blob; - memcpy_fixed(&blob, ptr+packlength, sizeof(const char*)); + size_t length; + memcpy_fixed(&blob, ptr+packlength, sizeof(const uchar*)); if (!blob) + { blob= ""; - str2my_decimal(E_DEC_FATAL_ERROR, blob, get_length(ptr), charset(), + length= 0; + } + else + length= get_length(ptr); + + str2my_decimal(E_DEC_FATAL_ERROR, blob, length, charset(), decimal_value); return decimal_value; } -int Field_blob::cmp(const char *a,uint32 a_length, const char *b, +int Field_blob::cmp(const uchar *a,uint32 a_length, const uchar *b, uint32 b_length) { return field_charset->coll->strnncollsp(field_charset, - (const uchar*)a, a_length, - (const uchar*)b, b_length, + a, a_length, b, b_length, 0); } -int Field_blob::cmp_max(const char *a_ptr, const char *b_ptr, +int Field_blob::cmp_max(const uchar *a_ptr, const uchar *b_ptr, uint max_length) { - char *blob1,*blob2; + uchar *blob1,*blob2; memcpy_fixed(&blob1,a_ptr+packlength,sizeof(char*)); memcpy_fixed(&blob2,b_ptr+packlength,sizeof(char*)); uint a_len= get_length(a_ptr), b_len= get_length(b_ptr); @@ -7278,7 +7294,7 @@ int Field_blob::cmp_max(const char *a_ptr, const char *b_ptr, } -int Field_blob::cmp_binary(const char *a_ptr, const char *b_ptr, +int Field_blob::cmp_binary(const uchar *a_ptr, const uchar *b_ptr, uint32 max_length) { char *a,*b; @@ -7299,10 +7315,10 @@ int Field_blob::cmp_binary(const char *a_ptr, const char *b_ptr, /* The following is used only when comparing a key */ -uint Field_blob::get_key_image(char *buff,uint length, imagetype type_arg) +uint Field_blob::get_key_image(uchar *buff,uint length, imagetype type_arg) { uint32 blob_length= get_length(ptr); - char *blob; + uchar *blob; #ifdef HAVE_SPATIAL if (type_arg == itMBR) @@ -7319,7 +7335,7 @@ uint Field_blob::get_key_image(char *buff,uint length, imagetype type_arg) return image_length; } get_ptr(&blob); - gobj= Geometry::construct(&buffer, blob, blob_length); + gobj= Geometry::construct(&buffer, (char*) blob, blob_length); if (!gobj || gobj->get_mbr(&mbr, &dummy)) bzero(buff, image_length); else @@ -7354,16 +7370,17 @@ uint Field_blob::get_key_image(char *buff,uint length, imagetype type_arg) } -void Field_blob::set_key_image(char *buff,uint length) +void Field_blob::set_key_image(const uchar *buff,uint length) { length= uint2korr(buff); - (void) Field_blob::store(buff+HA_KEY_BLOB_LENGTH, length, field_charset); + (void) Field_blob::store((const char*) buff+HA_KEY_BLOB_LENGTH, length, + field_charset); } -int Field_blob::key_cmp(const byte *key_ptr, uint max_key_length) +int Field_blob::key_cmp(const uchar *key_ptr, uint max_key_length) { - char *blob1; + uchar *blob1; uint blob_length=get_length(ptr); memcpy_fixed(&blob1,ptr+packlength,sizeof(char*)); CHARSET_INFO *cs= charset(); @@ -7372,14 +7389,14 @@ int Field_blob::key_cmp(const byte *key_ptr, uint max_key_length) local_char_length); set_if_smaller(blob_length, local_char_length); return Field_blob::cmp(blob1, blob_length, - (char*) key_ptr+HA_KEY_BLOB_LENGTH, + key_ptr+HA_KEY_BLOB_LENGTH, uint2korr(key_ptr)); } -int Field_blob::key_cmp(const byte *a,const byte *b) +int Field_blob::key_cmp(const uchar *a,const uchar *b) { - return Field_blob::cmp((char*) a+HA_KEY_BLOB_LENGTH, uint2korr(a), - (char*) b+HA_KEY_BLOB_LENGTH, uint2korr(b)); + return Field_blob::cmp(a+HA_KEY_BLOB_LENGTH, uint2korr(a), + b+HA_KEY_BLOB_LENGTH, uint2korr(b)); } @@ -7390,9 +7407,9 @@ uint32 Field_blob::sort_length() const } -void Field_blob::sort_string(char *to,uint length) +void Field_blob::sort_string(uchar *to,uint length) { - char *blob; + uchar *blob; uint blob_length=get_length(); if (!blob_length) @@ -7401,7 +7418,7 @@ void Field_blob::sort_string(char *to,uint length) { if (field_charset == &my_charset_bin) { - char *pos; + uchar *pos; /* Store length of blob last in blob to shorter blobs before longer blobs @@ -7427,8 +7444,7 @@ void Field_blob::sort_string(char *to,uint length) memcpy_fixed(&blob,ptr+packlength,sizeof(char*)); blob_length=my_strnxfrm(field_charset, - (uchar*) to, length, - (uchar*) blob, blob_length); + to, length, blob, blob_length); DBUG_ASSERT(blob_length == length); } } @@ -7454,23 +7470,23 @@ void Field_blob::sql_type(String &res) const } -char *Field_blob::pack(char *to, const char *from, uint max_length) +uchar *Field_blob::pack(uchar *to, const uchar *from, uint max_length) { - char *save=ptr; - ptr=(char*) from; + uchar *save= ptr; + ptr= (uchar*) from; uint32 length=get_length(); // Length of from string if (length > max_length) { ptr=to; length=max_length; store_length(length); // Store max length - ptr=(char*) from; + ptr= (uchar*) from; } else memcpy(to,from,packlength); // Copy length if (length) { - get_ptr((char**) &from); + get_ptr((uchar**) &from); memcpy(to+packlength, from,length); } ptr=save; // Restore org row pointer @@ -7478,7 +7494,7 @@ char *Field_blob::pack(char *to, const char *from, uint max_length) } -const char *Field_blob::unpack(char *to, const char *from) +const uchar *Field_blob::unpack(uchar *to, const uchar *from) { memcpy(to,from,packlength); uint32 length=get_length(from); @@ -7492,7 +7508,7 @@ const char *Field_blob::unpack(char *to, const char *from) /* Keys for blobs are like keys on varchars */ -int Field_blob::pack_cmp(const char *a, const char *b, uint key_length_arg, +int Field_blob::pack_cmp(const uchar *a, const uchar *b, uint key_length_arg, my_bool insert_or_update) { uint a_length, b_length; @@ -7503,20 +7519,20 @@ int Field_blob::pack_cmp(const char *a, const char *b, uint key_length_arg, } else { - a_length= (uint) (uchar) *a++; - b_length= (uint) (uchar) *b++; + a_length= (uint) *a++; + b_length= (uint) *b++; } return field_charset->coll->strnncollsp(field_charset, - (const uchar*) a, a_length, - (const uchar*) b, b_length, + a, a_length, + b, b_length, insert_or_update); } -int Field_blob::pack_cmp(const char *b, uint key_length_arg, +int Field_blob::pack_cmp(const uchar *b, uint key_length_arg, my_bool insert_or_update) { - char *a; + uchar *a; uint a_length, b_length; memcpy_fixed(&a,ptr+packlength,sizeof(char*)); if (!a) @@ -7528,24 +7544,24 @@ int Field_blob::pack_cmp(const char *b, uint key_length_arg, b_length= uint2korr(b); b+=2; } else - b_length= (uint) (uchar) *b++; + b_length= (uint) *b++; return field_charset->coll->strnncollsp(field_charset, - (const uchar*) a, a_length, - (const uchar*) b, b_length, + a, a_length, + b, b_length, insert_or_update); } /* Create a packed key that will be used for storage from a MySQL row */ -char *Field_blob::pack_key(char *to, const char *from, uint max_length) +uchar *Field_blob::pack_key(uchar *to, const uchar *from, uint max_length) { - char *save=ptr; - ptr=(char*) from; + uchar *save= ptr; + ptr= (uchar*) from; uint32 length=get_length(); // Length of from string uint local_char_length= ((field_charset->mbmaxlen > 1) ? - max_length/field_charset->mbmaxlen : max_length); + max_length/field_charset->mbmaxlen : max_length); if (length) - get_ptr((char**) &from); + get_ptr((uchar**) &from); if (length > local_char_length) local_char_length= my_charpos(field_charset, from, from+length, local_char_length); @@ -7582,12 +7598,13 @@ char *Field_blob::pack_key(char *to, const char *from, uint max_length) Pointer into 'from' past the last byte copied from packed key. */ -const char *Field_blob::unpack_key(char *to, const char *from, uint max_length) +const uchar *Field_blob::unpack_key(uchar *to, const uchar *from, + uint max_length) { /* get length of the blob key */ - uint32 length= *((uchar*) from++); + uint32 length= *from++; if (max_length > 255) - length+= (*((uchar*) from++)) << 8; + length+= *from++ << 8; /* put the length into the record buffer */ put_length(to, length); @@ -7605,8 +7622,8 @@ const char *Field_blob::unpack_key(char *to, const char *from, uint max_length) /* Create a packed key that will be used for storage from a MySQL key */ -char *Field_blob::pack_key_from_key_image(char *to, const char *from, - uint max_length) +uchar *Field_blob::pack_key_from_key_image(uchar *to, const uchar *from, + uint max_length) { uint length=uint2korr(from); if (length > max_length) @@ -7620,11 +7637,11 @@ char *Field_blob::pack_key_from_key_image(char *to, const char *from, } -uint Field_blob::packed_col_length(const char *data_ptr, uint length) +uint Field_blob::packed_col_length(const uchar *data_ptr, uint length) { if (length > 255) return uint2korr(data_ptr)+2; - return (uint) ((uchar) *data_ptr)+1; + return (uint) *data_ptr + 1; } @@ -7648,9 +7665,9 @@ uint Field_blob::is_equal(create_field *new_field) #ifdef HAVE_SPATIAL -uint Field_geom::get_key_image(char *buff, uint length, imagetype type) +uint Field_geom::get_key_image(uchar *buff, uint length, imagetype type) { - char *blob; + uchar *blob; const char *dummy; MBR mbr; ulong blob_length= get_length(ptr); @@ -7664,7 +7681,7 @@ uint Field_geom::get_key_image(char *buff, uint length, imagetype type) return image_length; } get_ptr(&blob); - gobj= Geometry::construct(&buffer, blob, blob_length); + gobj= Geometry::construct(&buffer, (char*) blob, blob_length); if (!gobj || gobj->get_mbr(&mbr, &dummy)) bzero(buff, image_length); else @@ -7902,7 +7919,7 @@ longlong Field_enum::val_int(void) ASSERT_COLUMN_MARKED_FOR_READ; switch (packlength) { case 1: - return (longlong) (uchar) ptr[0]; + return (longlong) ptr[0]; case 2: { uint16 tmp; @@ -7956,18 +7973,18 @@ String *Field_enum::val_str(String *val_buffer __attribute__((unused)), return val_ptr; } -int Field_enum::cmp(const char *a_ptr, const char *b_ptr) +int Field_enum::cmp(const uchar *a_ptr, const uchar *b_ptr) { - char *old=ptr; - ptr=(char*) a_ptr; + uchar *old= ptr; + ptr= (uchar*) a_ptr; ulonglong a=Field_enum::val_int(); - ptr=(char*) b_ptr; + ptr= (uchar*) b_ptr; ulonglong b=Field_enum::val_int(); - ptr=old; + ptr= old; return (a < b) ? -1 : (a > b) ? 1 : 0; } -void Field_enum::sort_string(char *to,uint length __attribute__((unused))) +void Field_enum::sort_string(uchar *to,uint length __attribute__((unused))) { ulonglong value=Field_enum::val_int(); to+=packlength-1; @@ -8149,9 +8166,9 @@ bool Field_enum::eq_def(Field *field) for (uint i=0 ; i < from_lib->count ; i++) if (my_strnncoll(field_charset, (const uchar*)typelib->type_names[i], - (uint) strlen(typelib->type_names[i]), + strlen(typelib->type_names[i]), (const uchar*)from_lib->type_names[i], - (uint) strlen(from_lib->type_names[i]))) + strlen(from_lib->type_names[i]))) return 0; return 1; } @@ -8210,7 +8227,7 @@ uint Field_num::is_equal(create_field *new_field) 11 one byte for 'd' */ -Field_bit::Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, +Field_bit::Field_bit(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg, enum utype unireg_check_arg, const char *field_name_arg) : Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, @@ -8228,7 +8245,7 @@ Field_bit::Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, } -my_size_t +size_t Field_bit::do_last_null_byte() const { /* @@ -8250,14 +8267,14 @@ Field_bit::do_last_null_byte() const result= bit_ptr; if (result) - return (byte*) result - table->record[0] + 1; - else - return LAST_NULL_BYTE_UNDEF; + return (size_t) (result - table->record[0]) + 1; + return LAST_NULL_BYTE_UNDEF; } + Field *Field_bit::new_key_field(MEM_ROOT *root, struct st_table *new_table, - char *new_ptr, uchar *new_null_ptr, + uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit) { Field_bit *res; @@ -8266,7 +8283,7 @@ Field *Field_bit::new_key_field(MEM_ROOT *root, new_null_bit))) { /* Move bits normally stored in null_pointer to new_ptr */ - res->bit_ptr= (uchar*) new_ptr; + res->bit_ptr= new_ptr; res->bit_ofs= 0; if (bit_len) res->ptr++; // Store rest of data here @@ -8363,7 +8380,7 @@ longlong Field_bit::val_int(void) switch (bytes_in_rec) { case 0: return bits; - case 1: return bits | (ulonglong) (uchar) ptr[0]; + case 1: return bits | (ulonglong) ptr[0]; case 2: return bits | mi_uint2korr(ptr); case 3: return bits | mi_uint3korr(ptr); case 4: return bits | mi_uint4korr(ptr); @@ -8413,7 +8430,7 @@ my_decimal *Field_bit::val_decimal(my_decimal *deciaml_value) The a and b pointer must be pointers to the field in a record (not the table->record[0] necessarily) */ -int Field_bit::cmp_max(const char *a, const char *b, uint max_len) +int Field_bit::cmp_max(const uchar *a, const uchar *b, uint max_len) { my_ptrdiff_t a_diff= a - ptr; my_ptrdiff_t b_diff= b - ptr; @@ -8429,13 +8446,13 @@ int Field_bit::cmp_max(const char *a, const char *b, uint max_len) } -int Field_bit::key_cmp(const byte *str, uint length) +int Field_bit::key_cmp(const uchar *str, uint length) { if (bit_len) { int flag; uchar bits= get_rec_bits(bit_ptr, bit_ofs, bit_len); - if ((flag= (int) (bits - *(uchar*) str))) + if ((flag= (int) (bits - *str))) return flag; str++; length--; @@ -8458,7 +8475,7 @@ int Field_bit::cmp_offset(uint row_offset) } -uint Field_bit::get_key_image(char *buff, uint length, imagetype type_arg) +uint Field_bit::get_key_image(uchar *buff, uint length, imagetype type_arg) { if (bit_len) { @@ -8481,7 +8498,7 @@ void Field_bit::sql_type(String &res) const } -char *Field_bit::pack(char *to, const char *from, uint max_length) +uchar *Field_bit::pack(uchar *to, const uchar *from, uint max_length) { DBUG_ASSERT(max_length); uint length; @@ -8515,7 +8532,7 @@ char *Field_bit::pack(char *to, const char *from, uint max_length) } -const char *Field_bit::unpack(char *to, const char *from) +const uchar *Field_bit::unpack(uchar *to, const uchar *from) { if (bit_len > 0) { @@ -8549,7 +8566,7 @@ void Field_bit::set_default() Bit field support for non-MyISAM tables. */ -Field_bit_as_char::Field_bit_as_char(char *ptr_arg, uint32 len_arg, +Field_bit_as_char::Field_bit_as_char(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg) @@ -8576,7 +8593,7 @@ int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs) { memset(ptr, 0xff, bytes_in_rec); if (bits) - *ptr&= ((1 << bits) - 1); /* set first byte */ + *ptr&= ((1 << bits) - 1); /* set first uchar */ if (table->in_use->really_abort_on_warning()) set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1); else @@ -9104,7 +9121,7 @@ uint pack_length_to_packflag(uint type) } -Field *make_field(TABLE_SHARE *share, char *ptr, uint32 field_length, +Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length, uchar *null_pos, uchar null_bit, uint pack_flag, enum_field_types field_type, diff --git a/sql/field.h b/sql/field.h index f9d77fe17ab..2bb9864e904 100644 --- a/sql/field.h +++ b/sql/field.h @@ -48,10 +48,10 @@ class Field Field(const Item &); /* Prevent use of these */ void operator=(Field &); public: - static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); } + static void *operator new(size_t size) {return sql_alloc(size); } static void operator delete(void *ptr_arg, size_t size) { TRASH(ptr_arg, size); } - char *ptr; // Position to field in record + uchar *ptr; // Position to field in record uchar *null_ptr; // Byte where null_bit is /* Note that you can use table->in_use as replacement for current_thd member @@ -90,11 +90,12 @@ public: uint16 field_index; // field number in fields array uchar null_bit; // Bit used to test null bit - Field(char *ptr_arg,uint32 length_arg,uchar *null_ptr_arg,uchar null_bit_arg, - utype unireg_check_arg, const char *field_name_arg); + Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg, + uchar null_bit_arg, utype unireg_check_arg, + const char *field_name_arg); virtual ~Field() {} /* Store functions returns 1 on overflow and -1 on fatal error */ - virtual int store(const char *to,uint length,CHARSET_INFO *cs)=0; + virtual int store(const char *to, uint length,CHARSET_INFO *cs)=0; virtual int store(double nr)=0; virtual int store(longlong nr, bool unsigned_val)=0; virtual int store_decimal(const my_decimal *d)=0; @@ -171,20 +172,20 @@ public: virtual uint32 key_length() const { return pack_length(); } virtual enum_field_types type() const =0; virtual enum_field_types real_type() const { return type(); } - inline int cmp(const char *str) { return cmp(ptr,str); } - virtual int cmp_max(const char *a, const char *b, uint max_len) + inline int cmp(const uchar *str) { return cmp(ptr,str); } + virtual int cmp_max(const uchar *a, const uchar *b, uint max_len) { return cmp(a, b); } - virtual int cmp(const char *,const char *)=0; - virtual int cmp_binary(const char *a,const char *b, uint32 max_length=~0L) + virtual int cmp(const uchar *,const uchar *)=0; + virtual int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0L) { return memcmp(a,b,pack_length()); } virtual int cmp_offset(uint row_offset) { return cmp(ptr,ptr+row_offset); } virtual int cmp_binary_offset(uint row_offset) { return cmp_binary(ptr, ptr+row_offset); }; - virtual int key_cmp(const byte *a,const byte *b) - { return cmp((char*) a,(char*) b); } - virtual int key_cmp(const byte *str, uint length) - { return cmp(ptr,(char*) str); } + virtual int key_cmp(const uchar *a,const uchar *b) + { return cmp(a, b); } + virtual int key_cmp(const uchar *str, uint length) + { return cmp(ptr,str); } virtual uint decimals() const { return 0; } /* Caller beware: sql_type can change str.Ptr, so check @@ -201,7 +202,7 @@ public: { if (!null_ptr) return 0; - return test(record[(uint) (null_ptr - (uchar*) table->record[0])] & + return test(record[(uint) (null_ptr -table->record[0])] & null_bit); } inline bool is_null_in_record_with_offset(my_ptrdiff_t offset) @@ -236,15 +237,15 @@ public: the record. If the field does not use any bits of the null bytes, the value 0 (LAST_NULL_BYTE_UNDEF) is returned. */ - my_size_t last_null_byte() const { - my_size_t bytes= do_last_null_byte(); + size_t last_null_byte() const { + size_t bytes= do_last_null_byte(); DBUG_PRINT("debug", ("last_null_byte() ==> %ld", (long) bytes)); DBUG_ASSERT(bytes <= table->s->null_bytes); return bytes; } virtual void make_field(Send_field *); - virtual void sort_string(char *buff,uint length)=0; + virtual void sort_string(uchar *buff,uint length)=0; virtual bool optimize_range(uint idx, uint part); /* This should be true for fields which, when compared with constant @@ -258,23 +259,23 @@ public: virtual Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type); virtual Field *new_key_field(MEM_ROOT *root, struct st_table *new_table, - char *new_ptr, uchar *new_null_ptr, + uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit); Field *clone(MEM_ROOT *mem_root, struct st_table *new_table); - inline void move_field(char *ptr_arg,uchar *null_ptr_arg,uchar null_bit_arg) + inline void move_field(uchar *ptr_arg,uchar *null_ptr_arg,uchar null_bit_arg) { ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg; } - inline void move_field(char *ptr_arg) { ptr=ptr_arg; } + inline void move_field(uchar *ptr_arg) { ptr=ptr_arg; } virtual void move_field_offset(my_ptrdiff_t ptr_diff) { - ptr=ADD_TO_PTR(ptr,ptr_diff,char*); + ptr=ADD_TO_PTR(ptr,ptr_diff, uchar*); if (null_ptr) null_ptr=ADD_TO_PTR(null_ptr,ptr_diff,uchar*); } - inline void get_image(char *buff,uint length, CHARSET_INFO *cs) + inline void get_image(uchar *buff,uint length, CHARSET_INFO *cs) { memcpy(buff,ptr,length); } - inline void set_image(char *buff,uint length, CHARSET_INFO *cs) + inline void set_image(const uchar *buff,uint length, CHARSET_INFO *cs) { memcpy(ptr,buff,length); } @@ -304,12 +305,12 @@ public: Number of copied bytes (excluding padded zero bytes -- see above). */ - virtual uint get_key_image(char *buff, uint length, imagetype type) + virtual uint get_key_image(uchar *buff, uint length, imagetype type) { get_image(buff, length, &my_charset_bin); return length; } - virtual void set_key_image(char *buff,uint length) + virtual void set_key_image(const uchar *buff,uint length) { set_image(buff,length, &my_charset_bin); } inline longlong val_int_offset(uint row_offset) { @@ -318,63 +319,64 @@ public: ptr-=row_offset; return tmp; } - inline longlong val_int(char *new_ptr) + inline longlong val_int(const uchar *new_ptr) { - char *old_ptr= ptr; + uchar *old_ptr= ptr; longlong return_value; - ptr= new_ptr; + ptr= (uchar*) new_ptr; return_value= val_int(); ptr= old_ptr; return return_value; } - inline String *val_str(String *str, char *new_ptr) + inline String *val_str(String *str, const uchar *new_ptr) { - char *old_ptr= ptr; - ptr= new_ptr; + uchar *old_ptr= ptr; + ptr= (uchar*) new_ptr; val_str(str); ptr= old_ptr; return str; } virtual bool send_binary(Protocol *protocol); - virtual char *pack(char* to, const char *from, uint max_length=~(uint) 0) + virtual uchar *pack(uchar *to, const uchar *from, uint max_length=~(uint) 0) { uint32 length=pack_length(); memcpy(to,from,length); return to+length; } - virtual const char *unpack(char* to, const char *from) + virtual const uchar *unpack(uchar* to, const uchar *from) { uint length=pack_length(); memcpy(to,from,length); return from+length; } - virtual char *pack_key(char* to, const char *from, uint max_length) + virtual uchar *pack_key(uchar* to, const uchar *from, uint max_length) { return pack(to,from,max_length); } - virtual char *pack_key_from_key_image(char* to, const char *from, + virtual uchar *pack_key_from_key_image(uchar* to, const uchar *from, uint max_length) { return pack(to,from,max_length); } - virtual const char *unpack_key(char* to, const char *from, uint max_length) + virtual const uchar *unpack_key(uchar* to, const uchar *from, + uint max_length) { return unpack(to,from); } - virtual uint packed_col_length(const char *to, uint length) + virtual uint packed_col_length(const uchar *to, uint length) { return length;} virtual uint max_packed_col_length(uint max_length) { return max_length;} - virtual int pack_cmp(const char *a,const char *b, uint key_length_arg, + virtual int pack_cmp(const uchar *a,const uchar *b, uint key_length_arg, my_bool insert_or_update) { return cmp(a,b); } - virtual int pack_cmp(const char *b, uint key_length_arg, + virtual int pack_cmp(const uchar *b, uint key_length_arg, my_bool insert_or_update) { return cmp(ptr,b); } - uint offset(byte *record) + uint offset(uchar *record) { - return (uint) (ptr - (char*) record); + return (uint) (ptr - record); } void copy_from_tmp(int offset); uint fill_cache_field(struct st_cache_field *copy); @@ -424,7 +426,7 @@ public: /* Hash value */ virtual void hash(ulong *nr, ulong *nr2); friend bool reopen_table(THD *,struct st_table *,bool); - friend int cre_myisam(my_string name, register TABLE *form, uint options, + friend int cre_myisam(char * name, register TABLE *form, uint options, ulonglong auto_increment_value); friend class Copy_field; friend class Item_avg_field; @@ -451,7 +453,7 @@ private: function. This represents the inheritance interface and can be overridden by subclasses. */ - virtual my_size_t do_last_null_byte() const; + virtual size_t do_last_null_byte() const; }; @@ -459,7 +461,7 @@ class Field_num :public Field { public: const uint8 dec; bool zerofill,unsigned_flag; // Purify cannot handle bit fields - Field_num(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, + Field_num(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, uint8 dec_arg, bool zero_arg, bool unsigned_arg); @@ -487,7 +489,7 @@ protected: CHARSET_INFO *field_charset; enum Derivation field_derivation; public: - Field_str(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, + Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, CHARSET_INFO *charset); Item_result result_type () const { return STRING_RESULT; } @@ -517,7 +519,7 @@ public: class Field_longstr :public Field_str { public: - Field_longstr(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_longstr(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, CHARSET_INFO *charset_arg) :Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, @@ -530,7 +532,7 @@ public: /* base class for float and double and decimal (old one) */ class Field_real :public Field_num { public: - Field_real(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_real(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, uint8 dec_arg, bool zero_arg, bool unsigned_arg) @@ -545,7 +547,7 @@ public: class Field_decimal :public Field_real { public: - Field_decimal(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_decimal(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, uint8 dec_arg,bool zero_arg,bool unsigned_arg) @@ -563,8 +565,8 @@ public: double val_real(void); longlong val_int(void); String *val_str(String*,String *); - int cmp(const char *,const char*); - void sort_string(char *buff,uint length); + int cmp(const uchar *,const uchar *); + void sort_string(uchar *buff,uint length); void overflow(bool negative); bool zero_pack() const { return 0; } void sql_type(String &str) const; @@ -583,7 +585,7 @@ public: So for example we need to count length from precision handling CREATE TABLE ( DECIMAL(x,y)) */ - Field_new_decimal(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_new_decimal(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, uint8 dec_arg, bool zero_arg, bool unsigned_arg); @@ -605,8 +607,8 @@ public: longlong val_int(void); my_decimal *val_decimal(my_decimal *); String *val_str(String*, String *); - int cmp(const char *, const char*); - void sort_string(char *buff, uint length); + int cmp(const uchar *, const uchar *); + void sort_string(uchar *buff, uint length); bool zero_pack() const { return 0; } void sql_type(String &str) const; uint32 max_display_length() { return field_length; } @@ -618,7 +620,7 @@ public: class Field_tiny :public Field_num { public: - Field_tiny(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_tiny(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, bool zero_arg, bool unsigned_arg) @@ -638,8 +640,8 @@ public: longlong val_int(void); String *val_str(String*,String *); bool send_binary(Protocol *protocol); - int cmp(const char *,const char*); - void sort_string(char *buff,uint length); + int cmp(const uchar *,const uchar *); + void sort_string(uchar *buff,uint length); uint32 pack_length() const { return 1; } void sql_type(String &str) const; uint32 max_display_length() { return 4; } @@ -648,7 +650,7 @@ public: class Field_short :public Field_num { public: - Field_short(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_short(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, bool zero_arg, bool unsigned_arg) @@ -658,7 +660,7 @@ public: {} Field_short(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, bool unsigned_arg) - :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, + :Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, NONE, field_name_arg, 0, 0, unsigned_arg) {} enum Item_result result_type () const { return INT_RESULT; } @@ -673,8 +675,8 @@ public: longlong val_int(void); String *val_str(String*,String *); bool send_binary(Protocol *protocol); - int cmp(const char *,const char*); - void sort_string(char *buff,uint length); + int cmp(const uchar *,const uchar *); + void sort_string(uchar *buff,uint length); uint32 pack_length() const { return 2; } void sql_type(String &str) const; uint32 max_display_length() { return 6; } @@ -683,7 +685,7 @@ public: class Field_medium :public Field_num { public: - Field_medium(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_medium(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, bool zero_arg, bool unsigned_arg) @@ -703,8 +705,8 @@ public: longlong val_int(void); String *val_str(String*,String *); bool send_binary(Protocol *protocol); - int cmp(const char *,const char*); - void sort_string(char *buff,uint length); + int cmp(const uchar *,const uchar *); + void sort_string(uchar *buff,uint length); uint32 pack_length() const { return 3; } void sql_type(String &str) const; uint32 max_display_length() { return 8; } @@ -713,7 +715,7 @@ public: class Field_long :public Field_num { public: - Field_long(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_long(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, bool zero_arg, bool unsigned_arg) @@ -723,7 +725,7 @@ public: {} Field_long(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, bool unsigned_arg) - :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, + :Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, NONE, field_name_arg,0,0,unsigned_arg) {} enum Item_result result_type () const { return INT_RESULT; } @@ -738,8 +740,8 @@ public: longlong val_int(void); bool send_binary(Protocol *protocol); String *val_str(String*,String *); - int cmp(const char *,const char*); - void sort_string(char *buff,uint length); + int cmp(const uchar *,const uchar *); + void sort_string(uchar *buff,uint length); uint32 pack_length() const { return 4; } void sql_type(String &str) const; uint32 max_display_length() { return 11; } @@ -749,7 +751,7 @@ public: #ifdef HAVE_LONG_LONG class Field_longlong :public Field_num { public: - Field_longlong(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_longlong(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, bool zero_arg, bool unsigned_arg) @@ -760,7 +762,7 @@ public: Field_longlong(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, bool unsigned_arg) - :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, + :Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0, NONE, field_name_arg,0,0,unsigned_arg) {} enum Item_result result_type () const { return INT_RESULT; } @@ -779,8 +781,8 @@ public: longlong val_int(void); String *val_str(String*,String *); bool send_binary(Protocol *protocol); - int cmp(const char *,const char*); - void sort_string(char *buff,uint length); + int cmp(const uchar *,const uchar *); + void sort_string(uchar *buff,uint length); uint32 pack_length() const { return 8; } void sql_type(String &str) const; bool can_be_compared_as_longlong() const { return TRUE; } @@ -791,7 +793,7 @@ public: class Field_float :public Field_real { public: - Field_float(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_float(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, uint8 dec_arg,bool zero_arg,bool unsigned_arg) @@ -801,7 +803,7 @@ public: {} Field_float(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, uint8 dec_arg) - :Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0, + :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0, NONE, field_name_arg, dec_arg, 0, 0) {} enum_field_types type() const { return MYSQL_TYPE_FLOAT;} @@ -814,8 +816,8 @@ public: longlong val_int(void); String *val_str(String*,String *); bool send_binary(Protocol *protocol); - int cmp(const char *,const char*); - void sort_string(char *buff,uint length); + int cmp(const uchar *,const uchar *); + void sort_string(uchar *buff,uint length); uint32 pack_length() const { return sizeof(float); } void sql_type(String &str) const; }; @@ -824,7 +826,7 @@ public: class Field_double :public Field_real { public: my_bool not_fixed; - Field_double(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_double(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, uint8 dec_arg,bool zero_arg,bool unsigned_arg) @@ -835,13 +837,13 @@ public: {} Field_double(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, uint8 dec_arg) - :Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0, + :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0, NONE, field_name_arg, dec_arg, 0, 0), not_fixed(dec_arg >= NOT_FIXED_DEC) {} Field_double(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, uint8 dec_arg, my_bool not_fixed_srg) - :Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0, + :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0, NONE, field_name_arg, dec_arg, 0, 0), not_fixed(not_fixed_srg) {} @@ -855,8 +857,8 @@ public: longlong val_int(void); String *val_str(String*,String *); bool send_binary(Protocol *protocol); - int cmp(const char *,const char*); - void sort_string(char *buff,uint length); + int cmp(const uchar *,const uchar *); + void sort_string(uchar *buff,uint length); uint32 pack_length() const { return sizeof(double); } void sql_type(String &str) const; uint size_of() const { return sizeof(*this); } @@ -868,7 +870,7 @@ public: class Field_null :public Field_str { static uchar null[1]; public: - Field_null(char *ptr_arg, uint32 len_arg, + Field_null(uchar *ptr_arg, uint32 len_arg, enum utype unireg_check_arg, const char *field_name_arg, CHARSET_INFO *cs) :Field_str(ptr_arg, len_arg, null, 1, @@ -886,8 +888,8 @@ public: my_decimal *val_decimal(my_decimal *) { return 0; } String *val_str(String *value,String *value2) { value2->length(0); return value2;} - int cmp(const char *a, const char *b) { return 0;} - void sort_string(char *buff, uint length) {} + int cmp(const uchar *a, const uchar *b) { return 0;} + void sort_string(uchar *buff, uint length) {} uint32 pack_length() const { return 0; } void sql_type(String &str) const; uint size_of() const { return sizeof(*this); } @@ -897,7 +899,7 @@ public: class Field_timestamp :public Field_str { public: - Field_timestamp(char *ptr_arg, uint32 len_arg, + Field_timestamp(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, TABLE_SHARE *share, CHARSET_INFO *cs); @@ -914,8 +916,8 @@ public: longlong val_int(void); String *val_str(String*,String *); bool send_binary(Protocol *protocol); - int cmp(const char *,const char*); - void sort_string(char *buff,uint length); + int cmp(const uchar *,const uchar *); + void sort_string(uchar *buff,uint length); uint32 pack_length() const { return 4; } void sql_type(String &str) const; bool can_be_compared_as_longlong() const { return TRUE; } @@ -950,7 +952,7 @@ public: class Field_year :public Field_tiny { public: - Field_year(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_year(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg) :Field_tiny(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, @@ -971,7 +973,7 @@ public: class Field_date :public Field_str { public: - Field_date(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, + Field_date(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, CHARSET_INFO *cs) :Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg, @@ -979,7 +981,7 @@ public: {} Field_date(bool maybe_null_arg, const char *field_name_arg, CHARSET_INFO *cs) - :Field_str((char*) 0,10, maybe_null_arg ? (uchar*) "": 0,0, + :Field_str((uchar*) 0,10, maybe_null_arg ? (uchar*) "": 0,0, NONE, field_name_arg, cs) {} enum_field_types type() const { return MYSQL_TYPE_DATE;} enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; } @@ -992,8 +994,8 @@ public: longlong val_int(void); String *val_str(String*,String *); bool send_binary(Protocol *protocol); - int cmp(const char *,const char*); - void sort_string(char *buff,uint length); + int cmp(const uchar *,const uchar *); + void sort_string(uchar *buff,uint length); uint32 pack_length() const { return 4; } void sql_type(String &str) const; bool can_be_compared_as_longlong() const { return TRUE; } @@ -1003,7 +1005,7 @@ public: class Field_newdate :public Field_str { public: - Field_newdate(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, + Field_newdate(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, CHARSET_INFO *cs) :Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg, @@ -1022,8 +1024,8 @@ public: longlong val_int(void); String *val_str(String*,String *); bool send_binary(Protocol *protocol); - int cmp(const char *,const char*); - void sort_string(char *buff,uint length); + int cmp(const uchar *,const uchar *); + void sort_string(uchar *buff,uint length); uint32 pack_length() const { return 3; } void sql_type(String &str) const; bool can_be_compared_as_longlong() const { return TRUE; } @@ -1035,7 +1037,7 @@ public: class Field_time :public Field_str { public: - Field_time(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, + Field_time(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, CHARSET_INFO *cs) :Field_str(ptr_arg, 8, null_ptr_arg, null_bit_arg, @@ -1043,7 +1045,7 @@ public: {} Field_time(bool maybe_null_arg, const char *field_name_arg, CHARSET_INFO *cs) - :Field_str((char*) 0,8, maybe_null_arg ? (uchar*) "": 0,0, + :Field_str((uchar*) 0,8, maybe_null_arg ? (uchar*) "": 0,0, NONE, field_name_arg, cs) {} enum_field_types type() const { return MYSQL_TYPE_TIME;} enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; } @@ -1059,8 +1061,8 @@ public: bool get_date(MYSQL_TIME *ltime, uint fuzzydate); bool send_binary(Protocol *protocol); bool get_time(MYSQL_TIME *ltime); - int cmp(const char *,const char*); - void sort_string(char *buff,uint length); + int cmp(const uchar *,const uchar *); + void sort_string(uchar *buff,uint length); uint32 pack_length() const { return 3; } void sql_type(String &str) const; bool can_be_compared_as_longlong() const { return TRUE; } @@ -1070,7 +1072,7 @@ public: class Field_datetime :public Field_str { public: - Field_datetime(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, + Field_datetime(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, CHARSET_INFO *cs) :Field_str(ptr_arg, 19, null_ptr_arg, null_bit_arg, @@ -1078,7 +1080,7 @@ public: {} Field_datetime(bool maybe_null_arg, const char *field_name_arg, CHARSET_INFO *cs) - :Field_str((char*) 0,19, maybe_null_arg ? (uchar*) "": 0,0, + :Field_str((uchar*) 0,19, maybe_null_arg ? (uchar*) "": 0,0, NONE, field_name_arg, cs) {} enum_field_types type() const { return MYSQL_TYPE_DATETIME;} #ifdef HAVE_LONG_LONG @@ -1099,8 +1101,8 @@ public: longlong val_int(void); String *val_str(String*,String *); bool send_binary(Protocol *protocol); - int cmp(const char *,const char*); - void sort_string(char *buff,uint length); + int cmp(const uchar *,const uchar *); + void sort_string(uchar *buff,uint length); uint32 pack_length() const { return 8; } void sql_type(String &str) const; bool can_be_compared_as_longlong() const { return TRUE; } @@ -1113,7 +1115,7 @@ public: class Field_string :public Field_longstr { public: bool can_alter_field_type; - Field_string(char *ptr_arg, uint32 len_arg,uchar *null_ptr_arg, + Field_string(uchar *ptr_arg, uint32 len_arg,uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, CHARSET_INFO *cs) @@ -1122,7 +1124,7 @@ public: can_alter_field_type(1) {}; Field_string(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, CHARSET_INFO *cs) - :Field_longstr((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0, + :Field_longstr((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0, NONE, field_name_arg, cs), can_alter_field_type(1) {}; @@ -1139,7 +1141,7 @@ public: bool zero_pack() const { return 0; } int reset(void) { - charset()->cset->fill(charset(),ptr,field_length, + charset()->cset->fill(charset(),(char*) ptr, field_length, (has_charset() ? ' ' : 0)); return 0; } @@ -1150,22 +1152,22 @@ public: longlong val_int(void); String *val_str(String*,String *); my_decimal *val_decimal(my_decimal *); - int cmp(const char *,const char*); - void sort_string(char *buff,uint length); + int cmp(const uchar *,const uchar *); + void sort_string(uchar *buff,uint length); void sql_type(String &str) const; - char *pack(char *to, const char *from, uint max_length=~(uint) 0); - const char *unpack(char* to, const char *from); - int pack_cmp(const char *a,const char *b,uint key_length, + uchar *pack(uchar *to, const uchar *from, uint max_length=~(uint) 0); + const uchar *unpack(uchar* to, const uchar *from); + int pack_cmp(const uchar *a,const uchar *b,uint key_length, my_bool insert_or_update); - int pack_cmp(const char *b,uint key_length,my_bool insert_or_update); - uint packed_col_length(const char *to, uint length); + int pack_cmp(const uchar *b,uint key_length,my_bool insert_or_update); + uint packed_col_length(const uchar *to, uint length); uint max_packed_col_length(uint max_length); uint size_of() const { return sizeof(*this); } enum_field_types real_type() const { return MYSQL_TYPE_STRING; } bool has_charset(void) const { return charset() == &my_charset_bin ? FALSE : TRUE; } Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type); - virtual uint get_key_image(char *buff,uint length, imagetype type); + virtual uint get_key_image(uchar *buff,uint length, imagetype type); }; @@ -1173,7 +1175,7 @@ class Field_varstring :public Field_longstr { public: /* Store number of bytes used to store length (1 or 2) */ uint32 length_bytes; - Field_varstring(char *ptr_arg, + Field_varstring(uchar *ptr_arg, uint32 len_arg, uint length_bytes_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, @@ -1187,7 +1189,7 @@ public: Field_varstring(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, TABLE_SHARE *share, CHARSET_INFO *cs) - :Field_longstr((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0, + :Field_longstr((uchar*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0, NONE, field_name_arg, cs), length_bytes(len_arg < 256 ? 1 :2) { @@ -1212,27 +1214,28 @@ public: longlong val_int(void); String *val_str(String*,String *); my_decimal *val_decimal(my_decimal *); - int cmp_max(const char *, const char *, uint max_length); - int cmp(const char *a,const char*b) + int cmp_max(const uchar *, const uchar *, uint max_length); + int cmp(const uchar *a,const uchar *b) { return cmp_max(a, b, ~0L); } - void sort_string(char *buff,uint length); - uint get_key_image(char *buff,uint length, imagetype type); - void set_key_image(char *buff,uint length); + void sort_string(uchar *buff,uint length); + uint get_key_image(uchar *buff,uint length, imagetype type); + void set_key_image(const uchar *buff,uint length); void sql_type(String &str) const; - char *pack(char *to, const char *from, uint max_length=~(uint) 0); - char *pack_key(char *to, const char *from, uint max_length); - char *pack_key_from_key_image(char* to, const char *from, uint max_length); - const char *unpack(char* to, const char *from); - const char *unpack_key(char* to, const char *from, uint max_length); - int pack_cmp(const char *a, const char *b, uint key_length, + uchar *pack(uchar *to, const uchar *from, uint max_length=~(uint) 0); + uchar *pack_key(uchar *to, const uchar *from, uint max_length); + uchar *pack_key_from_key_image(uchar* to, const uchar *from, + uint max_length); + const uchar *unpack(uchar* to, const uchar *from); + const uchar *unpack_key(uchar* to, const uchar *from, uint max_length); + int pack_cmp(const uchar *a, const uchar *b, uint key_length, my_bool insert_or_update); - int pack_cmp(const char *b, uint key_length,my_bool insert_or_update); - int cmp_binary(const char *a,const char *b, uint32 max_length=~0L); - int key_cmp(const byte *,const byte*); - int key_cmp(const byte *str, uint length); - uint packed_col_length(const char *to, uint length); + int pack_cmp(const uchar *b, uint key_length,my_bool insert_or_update); + int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0L); + int key_cmp(const uchar *,const uchar*); + int key_cmp(const uchar *str, uint length); + uint packed_col_length(const uchar *to, uint length); uint max_packed_col_length(uint max_length); uint32 data_length(); uint size_of() const { return sizeof(*this); } @@ -1241,7 +1244,7 @@ public: { return charset() == &my_charset_bin ? FALSE : TRUE; } Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type); Field *new_key_field(MEM_ROOT *root, struct st_table *new_table, - char *new_ptr, uchar *new_null_ptr, + uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit); uint is_equal(create_field *new_field); void hash(ulong *nr, ulong *nr2); @@ -1253,12 +1256,12 @@ protected: uint packlength; String value; // For temporaries public: - Field_blob(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, + Field_blob(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, TABLE_SHARE *share, uint blob_pack_length, CHARSET_INFO *cs); Field_blob(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, CHARSET_INFO *cs) - :Field_longstr((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0, + :Field_longstr((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0, NONE, field_name_arg, cs), packlength(4) { @@ -1266,7 +1269,7 @@ public: } Field_blob(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, CHARSET_INFO *cs, bool set_packlength) - :Field_longstr((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0, + :Field_longstr((uchar*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0, NONE, field_name_arg, cs) { flags|= BLOB_FLAG; @@ -1289,15 +1292,15 @@ public: longlong val_int(void); String *val_str(String*,String *); my_decimal *val_decimal(my_decimal *); - int cmp_max(const char *, const char *, uint max_length); - int cmp(const char *a,const char*b) + int cmp_max(const uchar *, const uchar *, uint max_length); + int cmp(const uchar *a,const uchar *b) { return cmp_max(a, b, ~0L); } - int cmp(const char *a, uint32 a_length, const char *b, uint32 b_length); - int cmp_binary(const char *a,const char *b, uint32 max_length=~0L); - int key_cmp(const byte *,const byte*); - int key_cmp(const byte *str, uint length); + int cmp(const uchar *a, uint32 a_length, const uchar *b, uint32 b_length); + int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0L); + int key_cmp(const uchar *,const uchar*); + int key_cmp(const uchar *str, uint length); uint32 key_length() const { return 0; } - void sort_string(char *buff,uint length); + void sort_string(uchar *buff,uint length); uint32 pack_length() const { return (uint32) (packlength+table->s->blob_ptr_size); } uint32 sort_length() const; @@ -1305,57 +1308,60 @@ public: { return (uint32) (((ulonglong) 1 << (packlength*8)) -1); } - int reset(void) { bzero(ptr, packlength+sizeof(char*)); return 0; } - void reset_fields() { bzero((char*) &value,sizeof(value)); } + int reset(void) { bzero(ptr, packlength+sizeof(uchar*)); return 0; } + void reset_fields() { bzero((uchar*) &value,sizeof(value)); } void store_length(uint32 number); inline uint32 get_length(uint row_offset=0) { return get_length(ptr+row_offset); } - uint32 get_length(const char *ptr); - void put_length(char *pos, uint32 length); - inline void get_ptr(char **str) + uint32 get_length(const uchar *ptr); + void put_length(uchar *pos, uint32 length); + inline void get_ptr(uchar **str) { - memcpy_fixed(str,ptr+packlength,sizeof(char*)); + memcpy_fixed((uchar*) str,ptr+packlength,sizeof(uchar*)); } - inline void get_ptr(char **str, uint row_offset) + inline void get_ptr(uchar **str, uint row_offset) { - memcpy_fixed(str,ptr+packlength+row_offset,sizeof(char*)); + memcpy_fixed((uchar*) str,ptr+packlength+row_offset,sizeof(char*)); } - inline void set_ptr(char *length,char *data) + inline void set_ptr(uchar *length, uchar *data) { memcpy(ptr,length,packlength); memcpy_fixed(ptr+packlength,&data,sizeof(char*)); } - inline void set_ptr(uint32 length,char *data) + inline void set_ptr(uint32 length, uchar *data) { store_length(length); memcpy_fixed(ptr+packlength,&data,sizeof(char*)); } - uint get_key_image(char *buff,uint length, imagetype type); - void set_key_image(char *buff,uint length); + uint get_key_image(uchar *buff,uint length, imagetype type); + void set_key_image(const uchar *buff,uint length); void sql_type(String &str) const; inline bool copy() - { char *tmp; + { + uchar *tmp; get_ptr(&tmp); - if (value.copy(tmp,get_length(),charset())) + if (value.copy((char*) tmp, get_length(),charset())) { Field_blob::reset(); return 1; } - tmp=(char*) value.ptr(); memcpy_fixed(ptr+packlength,&tmp,sizeof(char*)); + tmp=(uchar*) value.ptr(); + memcpy_fixed(ptr+packlength,&tmp,sizeof(char*)); return 0; } - char *pack(char *to, const char *from, uint max_length= ~(uint) 0); - char *pack_key(char *to, const char *from, uint max_length); - char *pack_key_from_key_image(char* to, const char *from, uint max_length); - const char *unpack(char *to, const char *from); - const char *unpack_key(char* to, const char *from, uint max_length); - int pack_cmp(const char *a, const char *b, uint key_length, + uchar *pack(uchar *to, const uchar *from, uint max_length= ~(uint) 0); + uchar *pack_key(uchar *to, const uchar *from, uint max_length); + uchar *pack_key_from_key_image(uchar* to, const uchar *from, + uint max_length); + const uchar *unpack(uchar *to, const uchar *from); + const uchar *unpack_key(uchar* to, const uchar *from, uint max_length); + int pack_cmp(const uchar *a, const uchar *b, uint key_length, my_bool insert_or_update); - int pack_cmp(const char *b, uint key_length,my_bool insert_or_update); - uint packed_col_length(const char *col_ptr, uint length); + int pack_cmp(const uchar *b, uint key_length,my_bool insert_or_update); + uint packed_col_length(const uchar *col_ptr, uint length); uint max_packed_col_length(uint max_length); void free() { value.free(); } - inline void clear_temporary() { bzero((char*) &value,sizeof(value)); } + inline void clear_temporary() { bzero((uchar*) &value,sizeof(value)); } friend int field_conv(Field *to,Field *from); uint size_of() const { return sizeof(*this); } bool has_charset(void) const @@ -1370,7 +1376,7 @@ class Field_geom :public Field_blob { public: enum geometry_type geom_type; - Field_geom(char *ptr_arg, uchar *null_ptr_arg, uint null_bit_arg, + Field_geom(uchar *ptr_arg, uchar *null_ptr_arg, uint null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, TABLE_SHARE *share, uint blob_pack_length, enum geometry_type geom_type_arg) @@ -1388,7 +1394,7 @@ public: int store(double nr); int store(longlong nr, bool unsigned_val); int store_decimal(const my_decimal *); - uint get_key_image(char *buff,uint length,imagetype type); + uint get_key_image(uchar *buff,uint length,imagetype type); uint size_of() const { return sizeof(*this); } int reset(void) { return !maybe_null() || Field_blob::reset(); } }; @@ -1400,7 +1406,7 @@ protected: uint packlength; public: TYPELIB *typelib; - Field_enum(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_enum(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, uint packlength_arg, @@ -1423,8 +1429,8 @@ public: double val_real(void); longlong val_int(void); String *val_str(String*,String *); - int cmp(const char *,const char*); - void sort_string(char *buff,uint length); + int cmp(const uchar *,const uchar *); + void sort_string(uchar *buff,uint length); uint32 pack_length() const { return (uint32) packlength; } void store_type(ulonglong value); void sql_type(String &str) const; @@ -1441,7 +1447,7 @@ public: class Field_set :public Field_enum { public: - Field_set(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_set(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, uint32 packlength_arg, @@ -1484,7 +1490,7 @@ public: uchar bit_ofs; // offset to 'uneven' high bits uint bit_len; // number of 'uneven' high bits uint bytes_in_rec; - Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_bit(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg, enum utype unireg_check_arg, const char *field_name_arg); enum_field_types type() const { return MYSQL_TYPE_BIT; } @@ -1503,29 +1509,29 @@ public: String *val_str(String*, String *); virtual bool str_needs_quotes() { return TRUE; } my_decimal *val_decimal(my_decimal *); - int cmp(const char *a, const char *b) + int cmp(const uchar *a, const uchar *b) { return cmp_binary(a, b); } int cmp_binary_offset(uint row_offset) { return cmp_offset(row_offset); } - int cmp_max(const char *a, const char *b, uint max_length); - int key_cmp(const byte *a, const byte *b) - { return cmp_binary((char *) a, (char *) b); } - int key_cmp(const byte *str, uint length); + int cmp_max(const uchar *a, const uchar *b, uint max_length); + int key_cmp(const uchar *a, const uchar *b) + { return cmp_binary((uchar *) a, (uchar *) b); } + int key_cmp(const uchar *str, uint length); int cmp_offset(uint row_offset); - uint get_key_image(char *buff, uint length, imagetype type); - void set_key_image(char *buff, uint length) - { Field_bit::store(buff, length, &my_charset_bin); } - void sort_string(char *buff, uint length) + uint get_key_image(uchar *buff, uint length, imagetype type); + void set_key_image(const uchar *buff, uint length) + { Field_bit::store((char*) buff, length, &my_charset_bin); } + void sort_string(uchar *buff, uint length) { get_key_image(buff, length, itRAW); } uint32 pack_length() const { return (uint32) (field_length + 7) / 8; } uint32 pack_length_in_rec() const { return bytes_in_rec; } void sql_type(String &str) const; - char *pack(char *to, const char *from, uint max_length=~(uint) 0); - const char *unpack(char* to, const char *from); + uchar *pack(uchar *to, const uchar *from, uint max_length=~(uint) 0); + const uchar *unpack(uchar* to, const uchar *from); virtual void set_default(); Field *new_key_field(MEM_ROOT *root, struct st_table *new_table, - char *new_ptr, uchar *new_null_ptr, + uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit); void set_bit_ptr(uchar *bit_ptr_arg, uchar bit_ofs_arg) { @@ -1546,7 +1552,7 @@ public: } private: - virtual my_size_t do_last_null_byte() const; + virtual size_t do_last_null_byte() const; }; @@ -1559,7 +1565,7 @@ private: */ class Field_bit_as_char: public Field_bit { public: - Field_bit_as_char(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + Field_bit_as_char(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg); enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; } @@ -1647,7 +1653,7 @@ class Send_field { class Copy_field :public Sql_alloc { void (*get_copy_func(Field *to,Field *from))(Copy_field *); public: - char *from_ptr,*to_ptr; + uchar *from_ptr,*to_ptr; uchar *from_null_ptr,*to_null_ptr; my_bool *null_row; uint from_bit,to_bit; @@ -1658,13 +1664,13 @@ public: Copy_field() {} ~Copy_field() {} void set(Field *to,Field *from,bool save); // Field to field - void set(char *to,Field *from); // Field to string + void set(uchar *to,Field *from); // Field to string void (*do_copy)(Copy_field *); void (*do_copy2)(Copy_field *); // Used to handle null values }; -Field *make_field(TABLE_SHARE *share, char *ptr, uint32 field_length, +Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length, uchar *null_pos, uchar null_bit, uint pack_flag, enum_field_types field_type, CHARSET_INFO *cs, diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 9771cbc12b1..e920fe70f26 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -355,8 +355,8 @@ static void do_cut_string(Copy_field *copy) /* Check if we loosed any important characters */ if (cs->cset->scan(cs, - copy->from_ptr + copy->to_length, - copy->from_ptr + copy->from_length, + (char*) copy->from_ptr + copy->to_length, + (char*) copy->from_ptr + copy->from_length, MY_SEQ_SPACES) < copy->from_length - copy->to_length) { copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, @@ -374,8 +374,10 @@ static void do_cut_string_complex(Copy_field *copy) { // Shorter string field int well_formed_error; CHARSET_INFO *cs= copy->from_field->charset(); - const char *from_end= copy->from_ptr + copy->from_length; - uint copy_length= cs->cset->well_formed_len(cs, copy->from_ptr, from_end, + const uchar *from_end= copy->from_ptr + copy->from_length; + uint copy_length= cs->cset->well_formed_len(cs, + (char*) copy->from_ptr, + (char*) from_end, copy->to_length / cs->mbmaxlen, &well_formed_error); if (copy->to_length < copy_length) @@ -384,7 +386,8 @@ static void do_cut_string_complex(Copy_field *copy) /* Check if we lost any important characters */ if (well_formed_error || - cs->cset->scan(cs, copy->from_ptr + copy_length, from_end, + cs->cset->scan(cs, (char*) copy->from_ptr + copy_length, + (char*) from_end, MY_SEQ_SPACES) < (copy->from_length - copy_length)) { copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, @@ -392,7 +395,7 @@ static void do_cut_string_complex(Copy_field *copy) } if (copy_length < copy->to_length) - cs->cset->fill(cs, copy->to_ptr + copy_length, + cs->cset->fill(cs, (char*) copy->to_ptr + copy_length, copy->to_length - copy_length, ' '); } @@ -403,7 +406,7 @@ static void do_expand_binary(Copy_field *copy) { CHARSET_INFO *cs= copy->from_field->charset(); memcpy(copy->to_ptr,copy->from_ptr,copy->from_length); - cs->cset->fill(cs, copy->to_ptr+copy->from_length, + cs->cset->fill(cs, (char*) copy->to_ptr+copy->from_length, copy->to_length-copy->from_length, '\0'); } @@ -413,7 +416,7 @@ static void do_expand_string(Copy_field *copy) { CHARSET_INFO *cs= copy->from_field->charset(); memcpy(copy->to_ptr,copy->from_ptr,copy->from_length); - cs->cset->fill(cs, copy->to_ptr+copy->from_length, + cs->cset->fill(cs, (char*) copy->to_ptr+copy->from_length, copy->to_length-copy->from_length, ' '); } @@ -438,9 +441,10 @@ static void do_varstring1_mb(Copy_field *copy) int well_formed_error; CHARSET_INFO *cs= copy->from_field->charset(); uint from_length= (uint) *(uchar*) copy->from_ptr; - const char *from_ptr= copy->from_ptr + 1; + const uchar *from_ptr= copy->from_ptr + 1; uint to_char_length= (copy->to_length - 1) / cs->mbmaxlen; - uint length= cs->cset->well_formed_len(cs, from_ptr, from_ptr + from_length, + uint length= cs->cset->well_formed_len(cs, (char*) from_ptr, + (char*) from_ptr + from_length, to_char_length, &well_formed_error); if (length < from_length) { @@ -448,7 +452,7 @@ static void do_varstring1_mb(Copy_field *copy) copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); } - *(uchar*) copy->to_ptr= (uchar) length; + *copy->to_ptr= (uchar) length; memcpy(copy->to_ptr + 1, from_ptr, length); } @@ -475,8 +479,9 @@ static void do_varstring2_mb(Copy_field *copy) CHARSET_INFO *cs= copy->from_field->charset(); uint char_length= (copy->to_length - HA_KEY_BLOB_LENGTH) / cs->mbmaxlen; uint from_length= uint2korr(copy->from_ptr); - const char *from_beg= copy->from_ptr + HA_KEY_BLOB_LENGTH; - uint length= cs->cset->well_formed_len(cs, from_beg, from_beg + from_length, + const uchar *from_beg= copy->from_ptr + HA_KEY_BLOB_LENGTH; + uint length= cs->cset->well_formed_len(cs, (char*) from_beg, + (char*) from_beg + from_length, char_length, &well_formed_error); if (length < from_length) { @@ -501,7 +506,7 @@ static void do_varstring2_mb(Copy_field *copy) The 'to' buffer should have a size of field->pack_length()+1 */ -void Copy_field::set(char *to,Field *from) +void Copy_field::set(uchar *to,Field *from) { from_ptr=from->ptr; to_ptr=to; diff --git a/sql/filesort.cc b/sql/filesort.cc index a80e4a0fa54..1091282aea1 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -30,7 +30,7 @@ /* How to write record_ref. */ #define WRITE_REF(file,from) \ -if (my_b_write((file),(byte*) (from),param->ref_length)) \ +if (my_b_write((file),(uchar*) (from),param->ref_length)) \ DBUG_RETURN(1); /* functions defined in this file */ @@ -42,7 +42,7 @@ static ha_rows find_all_keys(SORTPARAM *param,SQL_SELECT *select, IO_CACHE *tempfile,IO_CACHE *indexfile); static int write_keys(SORTPARAM *param,uchar * *sort_keys, uint count, IO_CACHE *buffer_file, IO_CACHE *tempfile); -static void make_sortkey(SORTPARAM *param,uchar *to, byte *ref_pos); +static void make_sortkey(SORTPARAM *param,uchar *to, uchar *ref_pos); static void register_used_fields(SORTPARAM *param); static int merge_index(SORTPARAM *param,uchar *sort_buffer, BUFFPEK *buffpek, @@ -56,7 +56,7 @@ static uint sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length, static SORT_ADDON_FIELD *get_addon_fields(THD *thd, Field **ptabfield, uint sortlength, uint *plength); static void unpack_addon_fields(struct st_sort_addon_field *addon_field, - byte *buff); + uchar *buff); /* Sort a table @@ -153,7 +153,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, if (param.addon_field) { param.res_length= param.addon_length; - if (!(table_sort.addon_buf= (byte *) my_malloc(param.addon_length, + if (!(table_sort.addon_buf= (uchar *) my_malloc(param.addon_length, MYF(MY_WME)))) goto err; } @@ -198,7 +198,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, } if (multi_byte_charset && - !(param.tmp_buffer=my_malloc(param.sort_length,MYF(MY_WME)))) + !(param.tmp_buffer= (char*) my_malloc(param.sort_length,MYF(MY_WME)))) goto err; memavl= thd->variables.sortbuff_size; @@ -245,7 +245,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, { if (!table_sort.buffpek && table_sort.buffpek_len < maxbuffer && !(table_sort.buffpek= - (byte *) read_buffpek_from_file(&buffpek_pointers, maxbuffer))) + (uchar *) read_buffpek_from_file(&buffpek_pointers, maxbuffer))) goto err; buffpek= (BUFFPEK *) table_sort.buffpek; table_sort.buffpek_len= maxbuffer; @@ -283,9 +283,9 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, x_free(param.tmp_buffer); if (!subselect || !subselect->is_uncacheable()) { - x_free((gptr) sort_keys); + x_free((uchar*) sort_keys); table_sort.sort_keys= 0; - x_free((gptr) buffpek); + x_free((uchar*) buffpek); table_sort.buffpek= 0; table_sort.buffpek_len= 0; } @@ -323,19 +323,19 @@ void filesort_free_buffers(TABLE *table, bool full) { if (table->sort.record_pointers) { - my_free((gptr) table->sort.record_pointers,MYF(0)); + my_free((uchar*) table->sort.record_pointers,MYF(0)); table->sort.record_pointers=0; } if (full) { if (table->sort.sort_keys ) { - x_free((gptr) table->sort.sort_keys); + x_free((uchar*) table->sort.sort_keys); table->sort.sort_keys= 0; } if (table->sort.buffpek) { - x_free((gptr) table->sort.buffpek); + x_free((uchar*) table->sort.buffpek); table->sort.buffpek= 0; table->sort.buffpek_len= 0; } @@ -379,7 +379,7 @@ static BUFFPEK *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count) if (tmp) { if (reinit_io_cache(buffpek_pointers,READ_CACHE,0L,0,0) || - my_b_read(buffpek_pointers, (byte*) tmp, length)) + my_b_read(buffpek_pointers, (uchar*) tmp, length)) { my_free((char*) tmp, MYF(0)); tmp=0; @@ -431,7 +431,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, { int error,flag,quick_select; uint idx,indexpos,ref_length; - byte *ref_pos,*next_pos,ref_buff[MAX_REFLENGTH]; + uchar *ref_pos,*next_pos,ref_buff[MAX_REFLENGTH]; my_off_t record; TABLE *sort_form; THD *thd= current_thd; @@ -458,7 +458,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, next_pos=ref_pos; if (! indexfile && ! quick_select) { - next_pos=(byte*) 0; /* Find records in sequence */ + next_pos=(uchar*) 0; /* Find records in sequence */ file->ha_rnd_init(1); file->extra_opt(HA_EXTRA_CACHE, current_thd->variables.read_buff_size); @@ -483,7 +483,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, register_used_fields(param); if (select && select->cond) select->cond->walk(&Item::register_field_in_read_map, 1, - (byte*) sort_form); + (uchar*) sort_form); sort_form->column_bitmaps_set(&sort_form->tmp_set, &sort_form->tmp_set); for (;;) @@ -501,7 +501,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, { if (indexfile) { - if (my_b_read(indexfile,(byte*) ref_pos,ref_length)) /* purecov: deadcode */ + if (my_b_read(indexfile,(uchar*) ref_pos,ref_length)) /* purecov: deadcode */ { error= my_errno ? my_errno : -1; /* Abort */ break; @@ -609,7 +609,7 @@ static int write_keys(SORTPARAM *param, register uchar **sort_keys, uint count, IO_CACHE *buffpek_pointers, IO_CACHE *tempfile) { - uint sort_length, rec_length; + size_t sort_length, rec_length; uchar **end; BUFFPEK buffpek; DBUG_ENTER("write_keys"); @@ -619,7 +619,7 @@ write_keys(SORTPARAM *param, register uchar **sort_keys, uint count, #ifdef MC68000 quicksort(sort_keys,count,sort_length); #else - my_string_ptr_sort((gptr) sort_keys, (uint) count, sort_length); + my_string_ptr_sort((uchar*) sort_keys, (uint) count, sort_length); #endif if (!my_b_inited(tempfile) && open_cached_file(tempfile, mysql_tmpdir, TEMP_PREFIX, DISK_BUFFER_SIZE, @@ -630,9 +630,9 @@ write_keys(SORTPARAM *param, register uchar **sort_keys, uint count, count=(uint) param->max_rows; /* purecov: inspected */ buffpek.count=(ha_rows) count; for (end=sort_keys+count ; sort_keys != end ; sort_keys++) - if (my_b_write(tempfile, (byte*) *sort_keys, (uint) rec_length)) + if (my_b_write(tempfile, (uchar*) *sort_keys, (uint) rec_length)) goto err; - if (my_b_write(buffpek_pointers, (byte*) &buffpek, sizeof(buffpek))) + if (my_b_write(buffpek_pointers, (uchar*) &buffpek, sizeof(buffpek))) goto err; DBUG_RETURN(0); @@ -667,7 +667,7 @@ static inline void store_length(uchar *to, uint length, uint pack_length) /* makes a sort-key from record */ static void make_sortkey(register SORTPARAM *param, - register uchar *to, byte *ref_pos) + register uchar *to, uchar *ref_pos) { reg3 Field *field; reg1 SORT_FIELD *sort_field; @@ -694,7 +694,7 @@ static void make_sortkey(register SORTPARAM *param, else *to++=1; } - field->sort_string((char*) to,sort_field->length); + field->sort_string(to, sort_field->length); } else { // Item @@ -823,7 +823,7 @@ static void make_sortkey(register SORTPARAM *param, } *to++=1; } - my_decimal2binary(E_DEC_FATAL_ERROR, dec_val, (char*)to, + my_decimal2binary(E_DEC_FATAL_ERROR, dec_val, to, item->max_length - (item->decimals ? 1:0), item->decimals); break; @@ -841,7 +841,7 @@ static void make_sortkey(register SORTPARAM *param, } *to++=1; } - change_double_for_sort(value,(byte*) to); + change_double_for_sort(value,(uchar*) to); break; } case ROW_RESULT: @@ -891,13 +891,13 @@ static void make_sortkey(register SORTPARAM *param, else { #ifdef HAVE_purify - uchar *end= (uchar*) field->pack((char *) to, field->ptr); + uchar *end= field->pack(to, field->ptr); uint length= (uint) ((to + addonf->length) - end); DBUG_ASSERT((int) length >= 0); if (length) bzero(end, length); #else - (void) field->pack((char *) to, field->ptr); + (void) field->pack(to, field->ptr); #endif } to+= addonf->length; @@ -906,7 +906,7 @@ static void make_sortkey(register SORTPARAM *param, else { /* Save filepos last */ - memcpy((byte*) to, ref_pos, (size_s) param->ref_length); + memcpy((uchar*) to, ref_pos, (size_t) param->ref_length); } return; } @@ -935,7 +935,7 @@ static void register_used_fields(SORTPARAM *param) else { // Item sort_field->item->walk(&Item::register_field_in_read_map, 1, - (byte *) table); + (uchar *) table); } } @@ -958,16 +958,16 @@ static bool save_index(SORTPARAM *param, uchar **sort_keys, uint count, FILESORT_INFO *table_sort) { uint offset,res_length; - byte *to; + uchar *to; DBUG_ENTER("save_index"); - my_string_ptr_sort((gptr) sort_keys, (uint) count, param->sort_length); + my_string_ptr_sort((uchar*) sort_keys, (uint) count, param->sort_length); res_length= param->res_length; offset= param->rec_length-res_length; if ((ha_rows) count > param->max_rows) count=(uint) param->max_rows; if (!(to= table_sort->record_pointers= - (byte*) my_malloc(res_length*count, MYF(MY_WME)))) + (uchar*) my_malloc(res_length*count, MYF(MY_WME)))) DBUG_RETURN(1); /* purecov: inspected */ for (uchar **end= sort_keys+count ; sort_keys != end ; sort_keys++) { @@ -1039,7 +1039,7 @@ uint read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count))) { - if (my_pread(fromfile->file,(byte*) buffpek->base, + if (my_pread(fromfile->file,(uchar*) buffpek->base, (length= rec_length*count),buffpek->file_pos,MYF_RW)) return((uint) -1); /* purecov: inspected */ buffpek->key=buffpek->base; @@ -1154,7 +1154,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, if (error == -1) goto err; /* purecov: inspected */ buffpek->max_keys= buffpek->mem_count; // If less data in buffers than expected - queue_insert(&queue, (byte*) buffpek); + queue_insert(&queue, (uchar*) buffpek); } if (param->unique_buff) @@ -1169,7 +1169,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, */ buffpek= (BUFFPEK*) queue_top(&queue); memcpy(param->unique_buff, buffpek->key, rec_length); - if (my_b_write(to_file, (byte*) buffpek->key, rec_length)) + if (my_b_write(to_file, (uchar*) buffpek->key, rec_length)) { error=1; goto err; /* purecov: inspected */ } @@ -1203,14 +1203,14 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, } if (flag == 0) { - if (my_b_write(to_file,(byte*) buffpek->key, rec_length)) + if (my_b_write(to_file,(uchar*) buffpek->key, rec_length)) { error=1; goto err; /* purecov: inspected */ } } else { - if (my_b_write(to_file, (byte*) buffpek->key+offset, res_length)) + if (my_b_write(to_file, (uchar*) buffpek->key+offset, res_length)) { error=1; goto err; /* purecov: inspected */ } @@ -1265,7 +1265,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, max_rows-= buffpek->mem_count; if (flag == 0) { - if (my_b_write(to_file,(byte*) buffpek->key, + if (my_b_write(to_file,(uchar*) buffpek->key, (rec_length*buffpek->mem_count))) { error= 1; goto err; /* purecov: inspected */ @@ -1279,7 +1279,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, strpos != end ; strpos+= rec_length) { - if (my_b_write(to_file, (byte *) strpos, res_length)) + if (my_b_write(to_file, (uchar *) strpos, res_length)) { error=1; goto err; } @@ -1548,7 +1548,7 @@ get_addon_fields(THD *thd, Field **ptabfield, uint sortlength, uint *plength) */ static void -unpack_addon_fields(struct st_sort_addon_field *addon_field, byte *buff) +unpack_addon_fields(struct st_sort_addon_field *addon_field, uchar *buff) { Field *field; SORT_ADDON_FIELD *addonf= addon_field; @@ -1561,7 +1561,7 @@ unpack_addon_fields(struct st_sort_addon_field *addon_field, byte *buff) continue; } field->set_notnull(); - field->unpack(field->ptr, (char *) buff+addonf->offset); + field->unpack(field->ptr, buff + addonf->offset); } } @@ -1572,7 +1572,7 @@ unpack_addon_fields(struct st_sort_addon_field *addon_field, byte *buff) #define DBL_EXP_DIG (sizeof(double)*8-DBL_MANT_DIG) -void change_double_for_sort(double nr,byte *to) +void change_double_for_sort(double nr,uchar *to) { uchar *tmp=(uchar*) to; if (nr == 0.0) diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 2d78999017a..36b7f30dc64 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -90,8 +90,8 @@ 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 {"help", '?', "Display help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/sql/gstream.h b/sql/gstream.h index 10274635413..1ef90ad5bf0 100644 --- a/sql/gstream.h +++ b/sql/gstream.h @@ -35,7 +35,7 @@ public: {} ~Gis_read_stream() { - my_free(m_err_msg, MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) m_err_msg, MYF(MY_ALLOW_ZERO_PTR)); } enum enum_tok_types get_next_toc_type(); diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 5bbaa793939..ad6572d7a6b 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -146,7 +146,7 @@ pthread_mutex_t ndbcluster_mutex; // Table lock handling HASH ndbcluster_open_tables; -static byte *ndbcluster_get_key(NDB_SHARE *share,uint *length, +static uchar *ndbcluster_get_key(NDB_SHARE *share, size_t *length, my_bool not_used __attribute__((unused))); #ifdef HAVE_NDB_BINLOG static int rename_share(NDB_SHARE *share, const char *new_key); @@ -336,11 +336,11 @@ int execute_no_commit_ie(ha_ndbcluster *h, NdbTransaction *trans, Place holder for ha_ndbcluster thread specific data */ static -byte *thd_ndb_share_get_key(THD_NDB_SHARE *thd_ndb_share, uint *length, +uchar *thd_ndb_share_get_key(THD_NDB_SHARE *thd_ndb_share, size_t *length, my_bool not_used __attribute__((unused))) { *length= sizeof(thd_ndb_share->key); - return (byte*) &thd_ndb_share->key; + return (uchar*) &thd_ndb_share->key; } Thd_ndb::Thd_ndb() @@ -395,9 +395,9 @@ Thd_ndb::get_open_table(THD *thd, const void *key) DBUG_ENTER("Thd_ndb::get_open_table"); HASH_SEARCH_STATE state; THD_NDB_SHARE *thd_ndb_share= - (THD_NDB_SHARE*)hash_first(&open_tables, (byte *)&key, sizeof(key), &state); + (THD_NDB_SHARE*)hash_first(&open_tables, (uchar *)&key, sizeof(key), &state); while (thd_ndb_share && thd_ndb_share->key != key) - thd_ndb_share= (THD_NDB_SHARE*)hash_next(&open_tables, (byte *)&key, sizeof(key), &state); + thd_ndb_share= (THD_NDB_SHARE*)hash_next(&open_tables, (uchar *)&key, sizeof(key), &state); if (thd_ndb_share == 0) { thd_ndb_share= (THD_NDB_SHARE *) alloc_root(&thd->transaction.mem_root, @@ -406,7 +406,7 @@ Thd_ndb::get_open_table(THD *thd, const void *key) thd_ndb_share->stat.last_count= count; thd_ndb_share->stat.no_uncommitted_rows_count= 0; thd_ndb_share->stat.records= ~(ha_rows)0; - my_hash_insert(&open_tables, (byte *)thd_ndb_share); + my_hash_insert(&open_tables, (uchar *)thd_ndb_share); } else if (thd_ndb_share->stat.last_count != count) { @@ -674,7 +674,7 @@ static bool field_type_forces_var_part(enum_field_types type) */ bool ha_ndbcluster::set_hidden_key(NdbOperation *ndb_op, - uint fieldnr, const byte *field_ptr) + uint fieldnr, const uchar *field_ptr) { DBUG_ENTER("set_hidden_key"); DBUG_RETURN(ndb_op->equal(fieldnr, (char*)field_ptr) != 0); @@ -686,14 +686,14 @@ bool ha_ndbcluster::set_hidden_key(NdbOperation *ndb_op, */ int ha_ndbcluster::set_ndb_key(NdbOperation *ndb_op, Field *field, - uint fieldnr, const byte *field_ptr) + uint fieldnr, const uchar *field_ptr) { uint32 pack_len= field->pack_length(); DBUG_ENTER("set_ndb_key"); DBUG_PRINT("enter", ("%d: %s, ndb_type: %u, len=%d", fieldnr, field->field_name, field->type(), pack_len)); - DBUG_DUMP("key", (char*)field_ptr, pack_len); + DBUG_DUMP("key", field_ptr, pack_len); DBUG_ASSERT(ndb_supported_type(field->type())); DBUG_ASSERT(! (field->flags & BLOB_FLAG)); @@ -710,13 +710,13 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field, uint fieldnr, int row_offset, bool *set_blob_value) { - const byte* field_ptr= field->ptr + row_offset; + const uchar* field_ptr= field->ptr + row_offset; uint32 pack_len= field->pack_length(); DBUG_ENTER("set_ndb_value"); DBUG_PRINT("enter", ("%d: %s type: %u len=%d is_null=%s", fieldnr, field->field_name, field->type(), pack_len, field->is_null(row_offset) ? "Y" : "N")); - DBUG_DUMP("value", (char*) field_ptr, pack_len); + DBUG_DUMP("value", field_ptr, pack_len); DBUG_ASSERT(ndb_supported_type(field->type())); { @@ -725,7 +725,7 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field, if (pack_len == 0) { pack_len= sizeof(empty_field); - field_ptr= (byte *)&empty_field; + field_ptr= (uchar *)&empty_field; if (field->is_null(row_offset)) empty_field= 0; else @@ -755,7 +755,7 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field, // Set value to NULL DBUG_RETURN((ndb_op->setValue(fieldnr, (char*)NULL) != 0)); DBUG_PRINT("info", ("bit field")); - DBUG_DUMP("value", (char*)&bits, pack_len); + DBUG_DUMP("value", (uchar*)&bits, pack_len); #ifdef WORDS_BIGENDIAN /* store lsw first */ bits = ((bits >> 32) & 0x00000000FFFFFFFFLL) @@ -775,18 +775,18 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field, // Get length and pointer to data uint32 blob_len= field_blob->get_length(field_ptr); - char* blob_ptr= NULL; + uchar* blob_ptr= NULL; field_blob->get_ptr(&blob_ptr); // Looks like NULL ptr signals length 0 blob if (blob_ptr == NULL) { DBUG_ASSERT(blob_len == 0); - blob_ptr= (char*)""; + blob_ptr= (uchar*)""; } DBUG_PRINT("value", ("set blob ptr: 0x%lx len: %u", (long) blob_ptr, blob_len)); - DBUG_DUMP("value", (char*)blob_ptr, min(blob_len, 26)); + DBUG_DUMP("value", blob_ptr, min(blob_len, 26)); if (set_blob_value) *set_blob_value= TRUE; @@ -830,7 +830,7 @@ int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg) passes a record pointer diff. */ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array, - byte*& buffer, uint& buffer_size, + uchar*& buffer, uint& buffer_size, my_ptrdiff_t ptrdiff) { DBUG_ENTER("get_ndb_blobs_value"); @@ -866,7 +866,7 @@ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array, size+= 8 - size % 8; if (loop == 1) { - char *buf= buffer + offset; + uchar *buf= buffer + offset; uint32 len= 0xffffffff; // Max uint32 if (ndb_blob->readData(buf, len) != 0) ERR_RETURN(ndb_blob->getNdbError()); @@ -883,7 +883,7 @@ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array, else if (loop == 1) // undefined or null { // have to set length even in this case - char *buf= buffer + offset; // or maybe NULL + uchar *buf= buffer + offset; // or maybe NULL uint32 len= 0; field_blob->ptr+= ptrdiff; field_blob->set_ptr(len, buf); @@ -896,7 +896,7 @@ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array, my_free(buffer, MYF(MY_ALLOW_ZERO_PTR)); buffer_size= 0; DBUG_PRINT("info", ("allocate blobs buffer size %u", offset)); - buffer= my_malloc(offset, MYF(MY_WME)); + buffer= (uchar*) my_malloc(offset, MYF(MY_WME)); if (buffer == NULL) { sql_print_error("ha_ndbcluster::get_ndb_blobs_value: " @@ -917,7 +917,7 @@ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array, */ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field, - uint fieldnr, byte* buf) + uint fieldnr, uchar* buf) { DBUG_ENTER("get_ndb_value"); DBUG_PRINT("enter", ("fieldnr: %d flags: %o", fieldnr, @@ -932,13 +932,13 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field, { if (field->type() != MYSQL_TYPE_BIT) { - byte *field_buf; + uchar *field_buf; if (field->pack_length() != 0) field_buf= buf + (field->ptr - table->record[0]); else - field_buf= (byte *)&dummy_buf; + field_buf= (uchar *)&dummy_buf; m_value[fieldnr].rec= ndb_op->getValue(fieldnr, - field_buf); + (char*) field_buf); } else // if (field->type() == MYSQL_TYPE_BIT) { @@ -953,7 +953,7 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field, if (ndb_blob != NULL) { // Set callback - m_blobs_offset= buf - (byte*) table->record[0]; + m_blobs_offset= buf - (uchar*) table->record[0]; void *arg= (void *)this; DBUG_RETURN(ndb_blob->setActiveHook(g_get_ndb_blobs_value, arg) != 0); } @@ -961,7 +961,7 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field, } // Used for hidden key only - m_value[fieldnr].rec= ndb_op->getValue(fieldnr, m_ref); + m_value[fieldnr].rec= ndb_op->getValue(fieldnr, (char*) m_ref); DBUG_RETURN(m_value[fieldnr].rec == NULL); } @@ -1035,8 +1035,8 @@ int ha_ndbcluster::get_metadata(const char *path) DBUG_ASSERT(m_table == NULL); DBUG_ASSERT(m_table_info == NULL); - const void *data= NULL, *pack_data= NULL; - uint length, pack_length; + uchar *data= NULL, *pack_data= NULL; + size_t length, pack_length; /* Compare FrmData in NDB with frm file from disk. @@ -1045,8 +1045,8 @@ int ha_ndbcluster::get_metadata(const char *path) if (readfrm(path, &data, &length) || packfrm(data, length, &pack_data, &pack_length)) { - my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(pack_data, MYF(MY_ALLOW_ZERO_PTR)); DBUG_RETURN(1); } @@ -1058,11 +1058,11 @@ int ha_ndbcluster::get_metadata(const char *path) && cmp_frm(tab, pack_data, pack_length)) { DBUG_PRINT("error", - ("metadata, pack_length: %d getFrmLength: %d memcmp: %d", - pack_length, tab->getFrmLength(), + ("metadata, pack_length: %lu getFrmLength: %d memcmp: %d", + (ulong) pack_length, tab->getFrmLength(), memcmp(pack_data, tab->getFrmData(), pack_length))); - DBUG_DUMP("pack_data", (char*)pack_data, pack_length); - DBUG_DUMP("frm", (char*)tab->getFrmData(), tab->getFrmLength()); + DBUG_DUMP("pack_data", (uchar*) pack_data, pack_length); + DBUG_DUMP("frm", (uchar*) tab->getFrmData(), tab->getFrmLength()); error= HA_ERR_TABLE_DEF_CHANGED; } my_free((char*)data, MYF(0)); @@ -1565,7 +1565,7 @@ inline ulong ha_ndbcluster::index_flags(uint idx_no, uint part, HA_KEY_SCAN_NOT_ROR); } -static void shrink_varchar(Field* field, const byte* & ptr, char* buf) +static void shrink_varchar(Field* field, const uchar* & ptr, uchar* buf) { if (field->type() == MYSQL_TYPE_VARCHAR && ptr != NULL) { Field_varstring* f= (Field_varstring*)field; @@ -1584,7 +1584,7 @@ static void shrink_varchar(Field* field, const byte* & ptr, char* buf) } } -int ha_ndbcluster::set_primary_key(NdbOperation *op, const byte *key) +int ha_ndbcluster::set_primary_key(NdbOperation *op, const uchar *key) { KEY* key_info= table->key_info + table_share->primary_key; KEY_PART_INFO* key_part= key_info->key_part; @@ -1594,8 +1594,8 @@ int ha_ndbcluster::set_primary_key(NdbOperation *op, const byte *key) for (; key_part != end; key_part++) { Field* field= key_part->field; - const byte* ptr= key; - char buf[256]; + const uchar* ptr= key; + uchar buf[256]; shrink_varchar(field, ptr, buf); if (set_ndb_key(op, field, key_part->fieldnr-1, ptr)) @@ -1606,7 +1606,7 @@ int ha_ndbcluster::set_primary_key(NdbOperation *op, const byte *key) } -int ha_ndbcluster::set_primary_key_from_record(NdbOperation *op, const byte *record) +int ha_ndbcluster::set_primary_key_from_record(NdbOperation *op, const uchar *record) { KEY* key_info= table->key_info + table_share->primary_key; KEY_PART_INFO* key_part= key_info->key_part; @@ -1624,7 +1624,7 @@ int ha_ndbcluster::set_primary_key_from_record(NdbOperation *op, const byte *rec } int ha_ndbcluster::set_index_key_from_record(NdbOperation *op, - const byte *record, uint keyno) + const uchar *record, uint keyno) { KEY* key_info= table->key_info + keyno; KEY_PART_INFO* key_part= key_info->key_part; @@ -1645,7 +1645,7 @@ int ha_ndbcluster::set_index_key_from_record(NdbOperation *op, int ha_ndbcluster::set_index_key(NdbOperation *op, const KEY *key_info, - const byte * key_ptr) + const uchar * key_ptr) { DBUG_ENTER("ha_ndbcluster::set_index_key"); uint i; @@ -1655,8 +1655,8 @@ ha_ndbcluster::set_index_key(NdbOperation *op, for (i= 0; key_part != end; key_part++, i++) { Field* field= key_part->field; - const byte* ptr= key_part->null_bit ? key_ptr + 1 : key_ptr; - char buf[256]; + const uchar* ptr= key_part->null_bit ? key_ptr + 1 : key_ptr; + uchar buf[256]; shrink_varchar(field, ptr, buf); if (set_ndb_key(op, field, m_index[active_index].unique_index_attrid_map[i], ptr)) ERR_RETURN(m_active_trans->getNdbError()); @@ -1666,7 +1666,7 @@ ha_ndbcluster::set_index_key(NdbOperation *op, } inline -int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op) +int ha_ndbcluster::define_read_attrs(uchar* buf, NdbOperation* op) { uint i; DBUG_ENTER("define_read_attrs"); @@ -1708,7 +1708,7 @@ int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op) Read one record from NDB using primary key */ -int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf, +int ha_ndbcluster::pk_read(const uchar *key, uint key_len, uchar *buf, uint32 part_id) { uint no_fields= table_share->fields; @@ -1718,7 +1718,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf, int res; DBUG_ENTER("pk_read"); DBUG_PRINT("enter", ("key_len: %u", key_len)); - DBUG_DUMP("key", (char*)key, key_len); + DBUG_DUMP("key", key, key_len); m_write_op= FALSE; NdbOperation::LockMode lm= @@ -1731,7 +1731,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf, { // This table has no primary key, use "hidden" primary key DBUG_PRINT("info", ("Using hidden key")); - DBUG_DUMP("key", (char*)key, 8); + DBUG_DUMP("key", key, 8); if (set_hidden_key(op, no_fields, key)) ERR_RETURN(trans->getNdbError()); @@ -1777,7 +1777,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf, or hidden key */ -int ha_ndbcluster::complemented_read(const byte *old_data, byte *new_data, +int ha_ndbcluster::complemented_read(const uchar *old_data, uchar *new_data, uint32 old_part_id) { uint no_fields= table_share->fields, i; @@ -1914,7 +1914,7 @@ bool ha_ndbcluster::check_all_operations_for_error(NdbTransaction *trans, * primary key or unique index values */ -int ha_ndbcluster::peek_indexed_rows(const byte *record, +int ha_ndbcluster::peek_indexed_rows(const uchar *record, bool check_pk) { NdbTransaction *trans= m_active_trans; @@ -2008,15 +2008,15 @@ int ha_ndbcluster::peek_indexed_rows(const byte *record, Read one record from NDB using unique secondary index */ -int ha_ndbcluster::unique_index_read(const byte *key, - uint key_len, byte *buf) +int ha_ndbcluster::unique_index_read(const uchar *key, + uint key_len, uchar *buf) { int res; NdbTransaction *trans= m_active_trans; NdbIndexOperation *op; DBUG_ENTER("ha_ndbcluster::unique_index_read"); DBUG_PRINT("enter", ("key_len: %u, index: %u", key_len, active_index)); - DBUG_DUMP("key", (char*)key, key_len); + DBUG_DUMP("key", key, key_len); NdbOperation::LockMode lm= (NdbOperation::LockMode)get_ndb_lock_type(m_lock.type); @@ -2152,7 +2152,7 @@ inline int ha_ndbcluster::fetch_next(NdbScanOperation* cursor) */ -inline int ha_ndbcluster::next_result(byte *buf) +inline int ha_ndbcluster::next_result(uchar *buf) { int res; DBUG_ENTER("next_result"); @@ -2231,10 +2231,10 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op, struct part_st { bool part_last; const key_range *key; - const byte *part_ptr; + const uchar *part_ptr; bool part_null; int bound_type; - const char* bound_ptr; + const uchar* bound_ptr; }; struct part_st part[2]; @@ -2344,13 +2344,13 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op, { DBUG_PRINT("info", ("key %d:%d offset: %d length: %d last: %d bound: %d", j, i, tot_len, part_len, p.part_last, p.bound_type)); - DBUG_DUMP("info", (const char*)p.part_ptr, part_store_len); + DBUG_DUMP("info", p.part_ptr, part_store_len); // Set bound if not cancelled via type -1 if (p.bound_type != -1) { - const char* ptr= p.bound_ptr; - char buf[256]; + const uchar* ptr= p.bound_ptr; + uchar buf[256]; shrink_varchar(field, ptr, buf); if (op->setBound(i, p.bound_type, ptr)) ERR_RETURN(op->getNdbError()); @@ -2370,7 +2370,7 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op, int ha_ndbcluster::ordered_index_scan(const key_range *start_key, const key_range *end_key, bool sorted, bool descending, - byte* buf, part_id_range *part_spec) + uchar* buf, part_id_range *part_spec) { int res; bool restart; @@ -2476,9 +2476,9 @@ guess_scan_flags(NdbOperation::LockMode lm, */ int ha_ndbcluster::unique_index_scan(const KEY* key_info, - const byte *key, + const uchar *key, uint key_len, - byte *buf) + uchar *buf) { int res; NdbScanOperation *op; @@ -2552,7 +2552,7 @@ int ha_ndbcluster::unique_index_scan(const KEY* key_info, Start full table scan in NDB */ -int ha_ndbcluster::full_table_scan(byte *buf) +int ha_ndbcluster::full_table_scan(uchar *buf) { int res; NdbScanOperation *op; @@ -2619,7 +2619,7 @@ int ha_ndbcluster::full_table_scan(byte *buf) /* Insert one record into NDB */ -int ha_ndbcluster::write_row(byte *record) +int ha_ndbcluster::write_row(uchar *record) { bool has_auto_increment; uint i; @@ -2709,7 +2709,7 @@ int ha_ndbcluster::write_row(byte *record) ndb->getNdbError().status == NdbError::TemporaryError); if (ret == -1) ERR_RETURN(ndb->getNdbError()); - if (set_hidden_key(op, table_share->fields, (const byte*)&auto_value)) + if (set_hidden_key(op, table_share->fields, (const uchar*)&auto_value)) ERR_RETURN(op->getNdbError()); } else @@ -2830,8 +2830,8 @@ int ha_ndbcluster::write_row(byte *record) /* Compare if a key in a row has changed */ -int ha_ndbcluster::key_cmp(uint keynr, const byte * old_row, - const byte * new_row) +int ha_ndbcluster::key_cmp(uint keynr, const uchar * old_row, + const uchar * new_row) { KEY_PART_INFO *key_part=table->key_info[keynr].key_part; KEY_PART_INFO *end=key_part+table->key_info[keynr].key_parts; @@ -2847,8 +2847,8 @@ int ha_ndbcluster::key_cmp(uint keynr, const byte * old_row, if (key_part->key_part_flag & (HA_BLOB_PART | HA_VAR_LENGTH_PART)) { - if (key_part->field->cmp_binary((char*) (old_row + key_part->offset), - (char*) (new_row + key_part->offset), + if (key_part->field->cmp_binary((old_row + key_part->offset), + (new_row + key_part->offset), (ulong) key_part->length)) return 1; } @@ -2866,7 +2866,7 @@ int ha_ndbcluster::key_cmp(uint keynr, const byte * old_row, Update one record in NDB using primary key */ -int ha_ndbcluster::update_row(const byte *old_data, byte *new_data) +int ha_ndbcluster::update_row(const uchar *old_data, uchar *new_data) { THD *thd= table->in_use; NdbTransaction *trans= m_active_trans; @@ -2951,7 +2951,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data) { // Undo delete_row(old_data) m_primary_key_update= TRUE; - undo_res= write_row((byte *)old_data); + undo_res= write_row((uchar *)old_data); if (undo_res) push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, @@ -3066,7 +3066,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data) Delete one record from NDB, using primary key */ -int ha_ndbcluster::delete_row(const byte *record) +int ha_ndbcluster::delete_row(const uchar *record) { THD *thd= table->in_use; NdbTransaction *trans= m_active_trans; @@ -3178,7 +3178,7 @@ int ha_ndbcluster::delete_row(const byte *record) */ void ndb_unpack_record(TABLE *table, NdbValue *value, - MY_BITMAP *defined, byte *buf) + MY_BITMAP *defined, uchar *buf) { Field **p_field= table->field, *field= *p_field; my_ptrdiff_t row_offset= (my_ptrdiff_t) (buf - table->record[0]); @@ -3265,13 +3265,13 @@ void ndb_unpack_record(TABLE *table, NdbValue *value, field_bit->Field_bit::move_field_offset(-row_offset); DBUG_PRINT("info",("[%u] SET", (*value).rec->getColumn()->getColumnNo())); - DBUG_DUMP("info", (const char*) field->ptr, field->pack_length()); + DBUG_DUMP("info", field->ptr, field->pack_length()); } else { DBUG_PRINT("info",("[%u] SET", (*value).rec->getColumn()->getColumnNo())); - DBUG_DUMP("info", (const char*) field->ptr, field->pack_length()); + DBUG_DUMP("info", field->ptr, field->pack_length()); } } else @@ -3295,7 +3295,7 @@ void ndb_unpack_record(TABLE *table, NdbValue *value, #ifndef DBUG_OFF // pointer vas set in get_ndb_blobs_value Field_blob *field_blob= (Field_blob*)field; - char* ptr; + uchar *ptr; field_blob->get_ptr(&ptr, row_offset); uint32 len= field_blob->get_length(row_offset); DBUG_PRINT("info",("[%u] SET ptr: 0x%lx len: %u", @@ -3309,7 +3309,7 @@ void ndb_unpack_record(TABLE *table, NdbValue *value, DBUG_VOID_RETURN; } -void ha_ndbcluster::unpack_record(byte *buf) +void ha_ndbcluster::unpack_record(uchar *buf) { ndb_unpack_record(table, m_value, 0, buf); #ifndef DBUG_OFF @@ -3422,10 +3422,10 @@ int ha_ndbcluster::index_end() */ static int -check_null_in_key(const KEY* key_info, const byte *key, uint key_len) +check_null_in_key(const KEY* key_info, const uchar *key, uint key_len) { KEY_PART_INFO *curr_part, *end_part; - const byte* end_ptr= key + key_len; + const uchar* end_ptr= key + key_len; curr_part= key_info->key_part; end_part= curr_part + key_info->key_parts; @@ -3439,8 +3439,8 @@ check_null_in_key(const KEY* key_info, const byte *key, uint key_len) return 0; } -int ha_ndbcluster::index_read(byte *buf, - const byte *key, uint key_len, +int ha_ndbcluster::index_read(uchar *buf, + const uchar *key, uint key_len, enum ha_rkey_function find_flag) { key_range start_key; @@ -3468,7 +3468,7 @@ int ha_ndbcluster::index_read(byte *buf, } -int ha_ndbcluster::index_next(byte *buf) +int ha_ndbcluster::index_next(uchar *buf) { DBUG_ENTER("ha_ndbcluster::index_next"); statistic_increment(current_thd->status_var.ha_read_next_count, @@ -3477,7 +3477,7 @@ int ha_ndbcluster::index_next(byte *buf) } -int ha_ndbcluster::index_prev(byte *buf) +int ha_ndbcluster::index_prev(uchar *buf) { DBUG_ENTER("ha_ndbcluster::index_prev"); statistic_increment(current_thd->status_var.ha_read_prev_count, @@ -3486,7 +3486,7 @@ int ha_ndbcluster::index_prev(byte *buf) } -int ha_ndbcluster::index_first(byte *buf) +int ha_ndbcluster::index_first(uchar *buf) { DBUG_ENTER("ha_ndbcluster::index_first"); statistic_increment(current_thd->status_var.ha_read_first_count, @@ -3498,14 +3498,14 @@ int ha_ndbcluster::index_first(byte *buf) } -int ha_ndbcluster::index_last(byte *buf) +int ha_ndbcluster::index_last(uchar *buf) { DBUG_ENTER("ha_ndbcluster::index_last"); statistic_increment(current_thd->status_var.ha_read_last_count,&LOCK_status); DBUG_RETURN(ordered_index_scan(0, 0, TRUE, TRUE, buf, NULL)); } -int ha_ndbcluster::index_read_last(byte * buf, const byte * key, uint key_len) +int ha_ndbcluster::index_read_last(uchar * buf, const uchar * key, uint key_len) { DBUG_ENTER("ha_ndbcluster::index_read_last"); DBUG_RETURN(index_read(buf, key, key_len, HA_READ_PREFIX_LAST)); @@ -3514,7 +3514,7 @@ int ha_ndbcluster::index_read_last(byte * buf, const byte * key, uint key_len) int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key, const key_range *end_key, bool desc, bool sorted, - byte* buf) + uchar* buf) { part_id_range part_spec; ndb_index_type type= get_index_type(active_index); @@ -3594,7 +3594,7 @@ int ha_ndbcluster::read_range_first(const key_range *start_key, const key_range *end_key, bool eq_r, bool sorted) { - byte* buf= table->record[0]; + uchar* buf= table->record[0]; DBUG_ENTER("ha_ndbcluster::read_range_first"); DBUG_RETURN(read_range_first_to_buf(start_key, end_key, FALSE, sorted, buf)); @@ -3684,7 +3684,7 @@ int ha_ndbcluster::rnd_end() } -int ha_ndbcluster::rnd_next(byte *buf) +int ha_ndbcluster::rnd_next(uchar *buf) { DBUG_ENTER("rnd_next"); statistic_increment(current_thd->status_var.ha_read_rnd_next_count, @@ -3703,7 +3703,7 @@ int ha_ndbcluster::rnd_next(byte *buf) again */ -int ha_ndbcluster::rnd_pos(byte *buf, byte *pos) +int ha_ndbcluster::rnd_pos(uchar *buf, uchar *pos) { DBUG_ENTER("rnd_pos"); statistic_increment(current_thd->status_var.ha_read_rnd_count, @@ -3721,7 +3721,7 @@ int ha_ndbcluster::rnd_pos(byte *buf, byte *pos) The partition id has been fetched from ndb and has been stored directly after the hidden key */ - DBUG_DUMP("key+part", (char *)pos, key_length); + DBUG_DUMP("key+part", pos, key_length); key_length= ref_length - sizeof(m_part_id); part_spec.start_part= part_spec.end_part= *(uint32 *)(pos + key_length); } @@ -3738,7 +3738,7 @@ int ha_ndbcluster::rnd_pos(byte *buf, byte *pos) } DBUG_PRINT("info", ("partition id %u", part_spec.start_part)); } - DBUG_DUMP("key", (char *)pos, key_length); + DBUG_DUMP("key", pos, key_length); DBUG_RETURN(pk_read(pos, key_length, buf, part_spec.start_part)); } } @@ -3750,12 +3750,12 @@ int ha_ndbcluster::rnd_pos(byte *buf, byte *pos) using "reference" in rnd_pos */ -void ha_ndbcluster::position(const byte *record) +void ha_ndbcluster::position(const uchar *record) { KEY *key_info; KEY_PART_INFO *key_part; KEY_PART_INFO *end; - byte *buff; + uchar *buff; uint key_length; DBUG_ENTER("position"); @@ -3781,7 +3781,7 @@ void ha_ndbcluster::position(const byte *record) } size_t len = key_part->length; - const byte * ptr = record + key_part->offset; + const uchar * ptr = record + key_part->offset; Field *field = key_part->field; if (field->type() == MYSQL_TYPE_VARCHAR) { @@ -3832,9 +3832,9 @@ void ha_ndbcluster::position(const byte *record) } #ifndef DBUG_OFF if (table_share->primary_key == MAX_KEY && m_use_partition_function) - DBUG_DUMP("key+part", (char*)ref, key_length+sizeof(m_part_id)); + DBUG_DUMP("key+part", ref, key_length+sizeof(m_part_id)); #endif - DBUG_DUMP("ref", (char*)ref, key_length); + DBUG_DUMP("ref", ref, key_length); DBUG_VOID_RETURN; } @@ -4937,8 +4937,9 @@ int ha_ndbcluster::create(const char *name, THD *thd= current_thd; NDBTAB tab; NDBCOL col; - uint pack_length, length, i, pk_length= 0; - const void *data= NULL, *pack_data= NULL; + size_t pack_length, length; + uint i, pk_length= 0; + uchar *data= NULL, *pack_data= NULL; bool create_from_engine= (create_info->table_options & HA_OPTION_CREATE_FROM_ENGINE); bool is_truncate= (thd->lex->sql_command == SQLCOM_TRUNCATE); char tablespace[FN_LEN]; @@ -5022,7 +5023,9 @@ int ha_ndbcluster::create(const char *name, my_free((char*)data, MYF(0)); DBUG_RETURN(2); } - DBUG_PRINT("info", ("setFrm data: 0x%lx len: %d", (long) pack_data, pack_length)); + DBUG_PRINT("info", + ("setFrm data: 0x%lx len: %lu", (long) pack_data, + (ulong) pack_length)); tab.setFrm(pack_data, pack_length); my_free((char*)data, MYF(0)); my_free((char*)pack_data, MYF(0)); @@ -5257,7 +5260,7 @@ int ha_ndbcluster::create(const char *name, { uint length= (uint) strlen(name); if ((share= (NDB_SHARE*) hash_search(&ndbcluster_open_tables, - (byte*) name, length))) + (uchar*) name, length))) handle_trailing_share(share); } /* @@ -5336,8 +5339,8 @@ int ha_ndbcluster::create_handler_files(const char *file, { Ndb* ndb; const NDBTAB *tab; - const void *data= NULL, *pack_data= NULL; - uint length, pack_length; + uchar *data= NULL, *pack_data= NULL; + size_t length, pack_length; int error= 0; DBUG_ENTER("create_handler_files"); @@ -6403,13 +6406,13 @@ static int ndbcluster_close_connection(handlerton *hton, THD *thd) int ndbcluster_discover(handlerton *hton, THD* thd, const char *db, const char *name, - const void** frmblob, - uint* frmlen) + uchar **frmblob, + size_t *frmlen) { int error= 0; NdbError ndb_error; - uint len; - const void* data= NULL; + size_t len; + uchar* data= NULL; Ndb* ndb; char key[FN_REFLEN]; DBUG_ENTER("ndbcluster_discover"); @@ -6470,7 +6473,7 @@ int ndbcluster_discover(handlerton *hton, THD* thd, const char *db, goto err; } - if (unpackfrm(&data, &len, tab->getFrmData())) + if (unpackfrm(&data, &len, (uchar*) tab->getFrmData())) { DBUG_PRINT("error", ("Could not unpack table")); error= 1; @@ -6540,11 +6543,11 @@ int ndbcluster_table_exists_in_engine(handlerton *hton, THD* thd, -extern "C" byte* tables_get_key(const char *entry, uint *length, +extern "C" uchar* tables_get_key(const char *entry, size_t *length, my_bool not_used __attribute__((unused))) { *length= strlen(entry); - return (byte*) entry; + return (uchar*) entry; } @@ -6725,8 +6728,8 @@ int ndbcluster_find_all_files(THD *thd) /* finalize construction of path */ end+= tablename_to_filename(elmt.name, end, sizeof(key)-(end-key)); - const void *data= 0, *pack_data= 0; - uint length, pack_length; + uchar *data= 0, *pack_data= 0; + size_t length, pack_length; int discover= 0; if (readfrm(key, &data, &length) || packfrm(data, length, &pack_data, &pack_length)) @@ -6854,7 +6857,7 @@ int ndbcluster_find_files(handlerton *hton, THD *thd, continue; } DBUG_PRINT("info", ("Inserting %s into ndb_tables hash", elmt.name)); - my_hash_insert(&ndb_tables, (byte*)thd->strdup(elmt.name)); + my_hash_insert(&ndb_tables, (uchar*)thd->strdup(elmt.name)); } char *file_name; @@ -6864,7 +6867,7 @@ int ndbcluster_find_files(handlerton *hton, THD *thd, { bool file_on_disk= FALSE; DBUG_PRINT("info", ("%s", file_name)); - if (hash_search(&ndb_tables, file_name, strlen(file_name))) + if (hash_search(&ndb_tables, (uchar*) file_name, strlen(file_name))) { DBUG_PRINT("info", ("%s existed in NDB _and_ on disk ", file_name)); file_on_disk= TRUE; @@ -6880,7 +6883,8 @@ int ndbcluster_find_files(handlerton *hton, THD *thd, if (file_on_disk) { // Ignore this ndb table - gptr record= hash_search(&ndb_tables, file_name, strlen(file_name)); + uchar *record= hash_search(&ndb_tables, (uchar*) file_name, + strlen(file_name)); DBUG_ASSERT(record); hash_delete(&ndb_tables, record); push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, @@ -6893,7 +6897,7 @@ int ndbcluster_find_files(handlerton *hton, THD *thd, if (file_on_disk) { // File existed in NDB and as frm file, put in ok_tables list - my_hash_insert(&ok_tables, (byte*)file_name); + my_hash_insert(&ok_tables, (uchar*)file_name); continue; } DBUG_PRINT("info", ("%s existed on disk", name)); @@ -6931,8 +6935,8 @@ int ndbcluster_find_files(handlerton *hton, THD *thd, List<char> create_list; for (i= 0 ; i < ndb_tables.records ; i++) { - file_name= hash_element(&ndb_tables, i); - if (!hash_search(&ok_tables, file_name, strlen(file_name))) + file_name= (char*) hash_element(&ndb_tables, i); + if (!hash_search(&ok_tables, (uchar*) file_name, strlen(file_name))) { build_table_filename(name, sizeof(name), db, file_name, reg_ext, 0); if (my_access(name, F_OK)) @@ -7556,7 +7560,7 @@ uint ndb_get_commitcount(THD *thd, char *dbname, char *tabname, DBUG_PRINT("enter", ("name: %s", name)); pthread_mutex_lock(&ndbcluster_mutex); if (!(share=(NDB_SHARE*) hash_search(&ndbcluster_open_tables, - (byte*) name, + (uchar*) name, strlen(name)))) { pthread_mutex_unlock(&ndbcluster_mutex); @@ -7781,11 +7785,11 @@ ha_ndbcluster::register_query_cache_table(THD *thd, data we want to or can share. */ -static byte *ndbcluster_get_key(NDB_SHARE *share,uint *length, +static uchar *ndbcluster_get_key(NDB_SHARE *share, size_t *length, my_bool not_used __attribute__((unused))) { *length= share->key_length; - return (byte*) share->key; + return (uchar*) share->key; } @@ -7928,7 +7932,7 @@ int handle_trailing_share(NDB_SHARE *share) at the cost of a possible mem leak, by "renaming" the share - First remove from hash */ - hash_delete(&ndbcluster_open_tables, (byte*) share); + hash_delete(&ndbcluster_open_tables, (uchar*) share); /* now give it a new name, just a running number @@ -7938,7 +7942,7 @@ int handle_trailing_share(NDB_SHARE *share) const uint min_key_length= 10; if (share->key_length < min_key_length) { - share->key= alloc_root(&share->mem_root, min_key_length + 1); + share->key= (char*) alloc_root(&share->mem_root, min_key_length + 1); share->key_length= min_key_length; } share->key_length= @@ -7946,7 +7950,7 @@ int handle_trailing_share(NDB_SHARE *share) trailing_share_id++); } /* Keep it for possible the future trailing free */ - my_hash_insert(&ndbcluster_open_tables, (byte*) share); + my_hash_insert(&ndbcluster_open_tables, (uchar*) share); DBUG_RETURN(0); } @@ -7962,11 +7966,11 @@ static int rename_share(NDB_SHARE *share, const char *new_key) DBUG_PRINT("rename_share", ("old_key: %s old__length: %d", share->key, share->key_length)); if ((tmp= (NDB_SHARE*) hash_search(&ndbcluster_open_tables, - (byte*) new_key, new_length))) + (uchar*) new_key, new_length))) handle_trailing_share(tmp); /* remove the share from hash */ - hash_delete(&ndbcluster_open_tables, (byte*) share); + hash_delete(&ndbcluster_open_tables, (uchar*) share); dbug_print_open_tables(); /* save old stuff if insert should fail */ @@ -7977,18 +7981,18 @@ static int rename_share(NDB_SHARE *share, const char *new_key) now allocate and set the new key, db etc enough space for key, db, and table_name */ - share->key= alloc_root(&share->mem_root, 2 * (new_length + 1)); + share->key= (char*) alloc_root(&share->mem_root, 2 * (new_length + 1)); strmov(share->key, new_key); share->key_length= new_length; - if (my_hash_insert(&ndbcluster_open_tables, (byte*) share)) + if (my_hash_insert(&ndbcluster_open_tables, (uchar*) share)) { // ToDo free the allocated stuff above? DBUG_PRINT("error", ("rename_share: my_hash_insert %s failed", share->key)); share->key= old_key; share->key_length= old_length; - if (my_hash_insert(&ndbcluster_open_tables, (byte*) share)) + if (my_hash_insert(&ndbcluster_open_tables, (uchar*) share)) { sql_print_error("rename_share: failed to recover %s", share->key); DBUG_PRINT("error", ("rename_share: my_hash_insert %s failed", @@ -8068,7 +8072,7 @@ NDB_SHARE *ndbcluster_get_share(const char *key, TABLE *table, if (!have_lock) pthread_mutex_lock(&ndbcluster_mutex); if (!(share= (NDB_SHARE*) hash_search(&ndbcluster_open_tables, - (byte*) key, + (uchar*) key, length))) { if (!create_if_not_exists) @@ -8088,13 +8092,13 @@ NDB_SHARE *ndbcluster_get_share(const char *key, TABLE *table, *root_ptr= &share->mem_root; // remember to reset before return share->state= NSS_INITIAL; /* enough space for key, db, and table_name */ - share->key= alloc_root(*root_ptr, 2 * (length + 1)); + share->key= (char*) alloc_root(*root_ptr, 2 * (length + 1)); share->key_length= length; strmov(share->key, key); - if (my_hash_insert(&ndbcluster_open_tables, (byte*) share)) + if (my_hash_insert(&ndbcluster_open_tables, (uchar*) share)) { free_root(&share->mem_root, MYF(0)); - my_free((gptr) share, 0); + my_free((uchar*) share, 0); *root_ptr= old_root; if (!have_lock) pthread_mutex_unlock(&ndbcluster_mutex); @@ -8137,7 +8141,7 @@ void ndbcluster_real_free_share(NDB_SHARE **share) DBUG_ENTER("ndbcluster_real_free_share"); dbug_print_share("ndbcluster_real_free_share:", *share); - hash_delete(&ndbcluster_open_tables, (byte*) *share); + hash_delete(&ndbcluster_open_tables, (uchar*) *share); thr_lock_delete(&(*share)->lock); pthread_mutex_destroy(&(*share)->mutex); @@ -8149,15 +8153,15 @@ void ndbcluster_real_free_share(NDB_SHARE **share) // (*share)->table_share->mem_root is freed by free_table_share free_table_share((*share)->table_share); #ifndef DBUG_OFF - bzero((gptr)(*share)->table_share, sizeof(*(*share)->table_share)); - bzero((gptr)(*share)->table, sizeof(*(*share)->table)); + bzero((uchar*)(*share)->table_share, sizeof(*(*share)->table_share)); + bzero((uchar*)(*share)->table, sizeof(*(*share)->table)); (*share)->table_share= 0; (*share)->table= 0; #endif } #endif free_root(&(*share)->mem_root, MYF(0)); - my_free((gptr) *share, MYF(0)); + my_free((uchar*) *share, MYF(0)); *share= 0; dbug_print_open_tables(); @@ -8382,13 +8386,13 @@ ha_ndbcluster::null_value_index_search(KEY_MULTI_RANGE *ranges, KEY* key_info= table->key_info + active_index; KEY_MULTI_RANGE *range= ranges; ulong reclength= table->s->reclength; - byte *curr= (byte*)buffer->buffer; - byte *end_of_buffer= (byte*)buffer->buffer_end; + uchar *curr= (uchar*)buffer->buffer; + uchar *end_of_buffer= (uchar*)buffer->buffer_end; for (; range<end_range && curr+reclength <= end_of_buffer; range++) { - const byte *key= range->start_key.key; + const uchar *key= range->start_key.key; uint key_len= range->start_key.length; if (check_null_in_key(key_info, key, key_len)) DBUG_RETURN(TRUE); @@ -8456,8 +8460,8 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p, /** * Variables for loop */ - byte *curr= (byte*)buffer->buffer; - byte *end_of_buffer= (byte*)buffer->buffer_end; + uchar *curr= (uchar*)buffer->buffer; + uchar *end_of_buffer= (uchar*)buffer->buffer_end; NdbOperation::LockMode lm= (NdbOperation::LockMode)get_ndb_lock_type(m_lock.type); bool need_pk = (lm == NdbOperation::LM_Read); @@ -8586,7 +8590,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p, * This as we don't want mysqld to reuse the buffer when we read * the remaining ranges */ - buffer->end_of_used_area= (byte*)buffer->buffer_end; + buffer->end_of_used_area= (uchar*)buffer->buffer_end; } else { @@ -8602,7 +8606,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p, { m_multi_range_defined= multi_range_curr; multi_range_curr= ranges; - m_multi_range_result_ptr= (byte*)buffer->buffer; + m_multi_range_result_ptr= (uchar*)buffer->buffer; DBUG_RETURN(read_multi_range_next(found_range_p)); } ERR_RETURN(m_active_trans->getNdbError()); @@ -8821,7 +8825,7 @@ ha_ndbcluster::update_table_comment( char *str; const char *fmt="%s%snumber_of_replicas: %d"; const unsigned fmt_len_plus_extra= length + strlen(fmt); - if ((str= my_malloc(fmt_len_plus_extra, MYF(0))) == NULL) + if ((str= (char*) my_malloc(fmt_len_plus_extra, MYF(0))) == NULL) { sql_print_error("ha_ndbcluster::update_table_comment: " "my_malloc(%u) failed", (unsigned int)fmt_len_plus_extra); diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index df621ff1938..a84ec66f399 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -84,7 +84,7 @@ typedef struct ndb_index_data { typedef union { const NdbRecAttr *rec; NdbBlob *blob; void *ptr; } NdbValue; int get_ndb_blobs_value(TABLE* table, NdbValue* value_array, - byte*& buffer, uint& buffer_size, + uchar*& buffer, uint& buffer_size, my_ptrdiff_t ptrdiff); typedef enum { @@ -115,7 +115,7 @@ typedef struct st_ndbcluster_share { char *old_names; // for rename table TABLE_SHARE *table_share; TABLE *table; - byte *record[2]; // pointer to allocated records for receiving data + uchar *record[2]; // pointer to allocated records for receiving data NdbValue *ndb_value[2]; MY_BITMAP *subscriber_bitmap; #endif @@ -224,30 +224,30 @@ class ha_ndbcluster: public handler int open(const char *name, int mode, uint test_if_locked); int close(void); - int write_row(byte *buf); - int update_row(const byte *old_data, byte *new_data); - int delete_row(const byte *buf); + int write_row(uchar *buf); + int update_row(const uchar *old_data, uchar *new_data); + int delete_row(const uchar *buf); int index_init(uint index, bool sorted); int index_end(); - int index_read(byte *buf, const byte *key, uint key_len, + int index_read(uchar *buf, const uchar *key, uint key_len, enum ha_rkey_function find_flag); - int index_next(byte *buf); - int index_prev(byte *buf); - int index_first(byte *buf); - int index_last(byte *buf); - int index_read_last(byte * buf, const byte * key, uint key_len); + int index_next(uchar *buf); + int index_prev(uchar *buf); + int index_first(uchar *buf); + int index_last(uchar *buf); + int index_read_last(uchar * buf, const uchar * key, uint key_len); int rnd_init(bool scan); int rnd_end(); - int rnd_next(byte *buf); - int rnd_pos(byte *buf, byte *pos); - void position(const byte *record); + int rnd_next(uchar *buf); + int rnd_pos(uchar *buf, uchar *pos); + void position(const uchar *record); int read_range_first(const key_range *start_key, const key_range *end_key, bool eq_range, bool sorted); int read_range_first_to_buf(const key_range *start_key, const key_range *end_key, bool eq_range, bool sorted, - byte* buf); + uchar* buf); int read_range_next(); int alter_tablespace(st_alter_tablespace *info); @@ -416,56 +416,56 @@ private: char* get_tablespace_name(THD *thd, char *name, uint name_len); int set_range_data(void *tab, partition_info* part_info); int set_list_data(void *tab, partition_info* part_info); - int complemented_read(const byte *old_data, byte *new_data, + int complemented_read(const uchar *old_data, uchar *new_data, uint32 old_part_id); - int pk_read(const byte *key, uint key_len, byte *buf, uint32 part_id); + int pk_read(const uchar *key, uint key_len, uchar *buf, uint32 part_id); int ordered_index_scan(const key_range *start_key, const key_range *end_key, - bool sorted, bool descending, byte* buf, + bool sorted, bool descending, uchar* buf, part_id_range *part_spec); - int unique_index_read(const byte *key, uint key_len, - byte *buf); + int unique_index_read(const uchar *key, uint key_len, + uchar *buf); int unique_index_scan(const KEY* key_info, - const byte *key, + const uchar *key, uint key_len, - byte *buf); - int full_table_scan(byte * buf); + uchar *buf); + int full_table_scan(uchar * buf); bool check_all_operations_for_error(NdbTransaction *trans, const NdbOperation *first, const NdbOperation *last, uint errcode); - int peek_indexed_rows(const byte *record, bool check_pk); + int peek_indexed_rows(const uchar *record, bool check_pk); int fetch_next(NdbScanOperation* op); - int next_result(byte *buf); - int define_read_attrs(byte* buf, NdbOperation* op); - int filtered_scan(const byte *key, uint key_len, - byte *buf, + int next_result(uchar *buf); + int define_read_attrs(uchar* buf, NdbOperation* op); + int filtered_scan(const uchar *key, uint key_len, + uchar *buf, enum ha_rkey_function find_flag); int close_scan(); - void unpack_record(byte *buf); + void unpack_record(uchar *buf); int get_ndb_lock_type(enum thr_lock_type type); void set_dbname(const char *pathname); void set_tabname(const char *pathname); bool set_hidden_key(NdbOperation*, - uint fieldnr, const byte* field_ptr); + uint fieldnr, const uchar* field_ptr); int set_ndb_key(NdbOperation*, Field *field, - uint fieldnr, const byte* field_ptr); + uint fieldnr, const uchar* field_ptr); int set_ndb_value(NdbOperation*, Field *field, uint fieldnr, int row_offset= 0, bool *set_blob_value= 0); - int get_ndb_value(NdbOperation*, Field *field, uint fieldnr, byte*); + int get_ndb_value(NdbOperation*, Field *field, uint fieldnr, uchar*); int get_ndb_partition_id(NdbOperation *); friend int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg); - int set_primary_key(NdbOperation *op, const byte *key); - int set_primary_key_from_record(NdbOperation *op, const byte *record); - int set_index_key_from_record(NdbOperation *op, const byte *record, + int set_primary_key(NdbOperation *op, const uchar *key); + int set_primary_key_from_record(NdbOperation *op, const uchar *record); + int set_index_key_from_record(NdbOperation *op, const uchar *record, uint keyno); int set_bounds(NdbIndexScanOperation*, uint inx, bool rir, const key_range *keys[2], uint= 0); - int key_cmp(uint keynr, const byte * old_row, const byte * new_row); - int set_index_key(NdbOperation *, const KEY *key_info, const byte *key_ptr); + int key_cmp(uint keynr, const uchar * old_row, const uchar * new_row); + int set_index_key(NdbOperation *, const KEY *key_info, const uchar *key_ptr); void print_results(); virtual void get_auto_increment(ulonglong offset, ulonglong increment, @@ -508,10 +508,10 @@ private: THD_NDB_SHARE *m_thd_ndb_share; // NdbRecAttr has no reference to blob NdbValue m_value[NDB_MAX_ATTRIBUTES_IN_TABLE]; - byte m_ref[NDB_HIDDEN_PRIMARY_KEY_LENGTH]; + uchar m_ref[NDB_HIDDEN_PRIMARY_KEY_LENGTH]; partition_info *m_part_info; uint32 m_part_id; - byte *m_rec0; + uchar *m_rec0; Field **m_part_field_array; bool m_use_partition_function; bool m_sorted; @@ -534,7 +534,7 @@ private: bool m_slow_path; my_ptrdiff_t m_blobs_offset; // memory for blobs in one tuple - char *m_blobs_buffer; + uchar *m_blobs_buffer; uint32 m_blobs_buffer_size; uint m_dupkey; // set from thread variables at external lock @@ -545,12 +545,12 @@ private: ha_ndbcluster_cond *m_cond; bool m_disable_multi_read; - byte *m_multi_range_result_ptr; + uchar *m_multi_range_result_ptr; KEY_MULTI_RANGE *m_multi_ranges; KEY_MULTI_RANGE *m_multi_range_defined; const NdbOperation *m_current_multi_operation; NdbIndexScanOperation *m_multi_cursor; - byte *m_multi_range_cursor_result_ptr; + uchar *m_multi_range_cursor_result_ptr; int setup_recattr(const NdbRecAttr*); Ndb *get_ndb(); }; diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 25a9ccdcb87..bfaaaadab43 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -130,14 +130,14 @@ static TABLE_LIST binlog_tables; #ifndef DBUG_OFF /* purecov: begin deadcode */ -static void print_records(TABLE *table, const char *record) +static void print_records(TABLE *table, const uchar *record) { for (uint j= 0; j < table->s->fields; j++) { char buf[40]; int pos= 0; Field *field= table->field[j]; - const byte* field_ptr= field->ptr - table->record[0] + record; + const uchar* field_ptr= field->ptr - table->record[0] + record; int pack_len= field->pack_length(); int n= pack_len < 10 ? pack_len : 10; @@ -196,14 +196,14 @@ static void dbug_print_table(const char *info, TABLE *table) (long) f->ptr, (int) (f->ptr - table->record[0]), f->null_bit, (long) f->null_ptr, - (int) ((byte*) f->null_ptr - table->record[0]))); + (int) ((uchar*) f->null_ptr - table->record[0]))); if (f->type() == MYSQL_TYPE_BIT) { Field_bit *g= (Field_bit*) f; DBUG_PRINT("MYSQL_TYPE_BIT",("field_length: %d bit_ptr: 0x%lx[+%d] " "bit_ofs: %d bit_len: %u", g->field_length, (long) g->bit_ptr, - (int) ((byte*) g->bit_ptr - + (int) ((uchar*) g->bit_ptr - table->record[0]), g->bit_ofs, g->bit_len)); } @@ -682,7 +682,7 @@ static NDB_SHARE *ndbcluster_check_ndb_apply_status_share() pthread_mutex_lock(&ndbcluster_mutex); void *share= hash_search(&ndbcluster_open_tables, - NDB_APPLY_TABLE_FILE, + (uchar*) NDB_APPLY_TABLE_FILE, sizeof(NDB_APPLY_TABLE_FILE) - 1); DBUG_PRINT("info",("ndbcluster_check_ndb_apply_status_share %s 0x%lx", NDB_APPLY_TABLE_FILE, (long) share)); @@ -700,7 +700,7 @@ static NDB_SHARE *ndbcluster_check_ndb_schema_share() pthread_mutex_lock(&ndbcluster_mutex); void *share= hash_search(&ndbcluster_open_tables, - NDB_SCHEMA_TABLE_FILE, + (uchar*) NDB_SCHEMA_TABLE_FILE, sizeof(NDB_SCHEMA_TABLE_FILE) - 1); DBUG_PRINT("info",("ndbcluster_check_ndb_schema_share %s 0x%lx", NDB_SCHEMA_TABLE_FILE, (long) share)); @@ -904,7 +904,7 @@ static void ndbcluster_get_schema(NDB_SHARE *share, TABLE *table= share->table; Field **field; /* unpack blob values */ - byte* blobs_buffer= 0; + uchar* blobs_buffer= 0; uint blobs_buffer_size= 0; my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set); { @@ -919,14 +919,14 @@ static void ndbcluster_get_schema(NDB_SHARE *share, DBUG_ASSERT(FALSE); } } - /* db varchar 1 length byte */ + /* db varchar 1 length uchar */ field= table->field; s->db_length= *(uint8*)(*field)->ptr; DBUG_ASSERT(s->db_length <= (*field)->field_length); DBUG_ASSERT((*field)->field_length + 1 == sizeof(s->db)); memcpy(s->db, (*field)->ptr + 1, s->db_length); s->db[s->db_length]= 0; - /* name varchar 1 length byte */ + /* name varchar 1 length uchar */ field++; s->name_length= *(uint8*)(*field)->ptr; DBUG_ASSERT(s->name_length <= (*field)->field_length); @@ -943,13 +943,11 @@ static void ndbcluster_get_schema(NDB_SHARE *share, { Field_blob *field_blob= (Field_blob*)(*field); uint blob_len= field_blob->get_length((*field)->ptr); - char *blob_ptr= 0; + uchar *blob_ptr= 0; field_blob->get_ptr(&blob_ptr); assert(blob_len == 0 || blob_ptr != 0); s->query_length= blob_len; - s->query= sql_alloc(blob_len+1); - memcpy(s->query, blob_ptr, blob_len); - s->query[blob_len]= 0; + s->query= sql_strmake((char*) blob_ptr, blob_len); } /* node_id */ field++; @@ -1318,7 +1316,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share, (void) pthread_mutex_unlock(&ndb_schema_object->mutex); } - DBUG_DUMP("schema_subscribers", (char*)schema_subscribers.bitmap, + DBUG_DUMP("schema_subscribers", (uchar*)schema_subscribers.bitmap, no_bytes_in_map(&schema_subscribers)); DBUG_PRINT("info", ("bitmap_is_clear_all(&schema_subscribers): %d", bitmap_is_clear_all(&schema_subscribers))); @@ -1522,7 +1520,7 @@ end: bitmap_intersect(&ndb_schema_object->slock_bitmap, &schema_subscribers); DBUG_DUMP("ndb_schema_object->slock_bitmap.bitmap", - (char*)ndb_schema_object->slock_bitmap.bitmap, + (uchar*)ndb_schema_object->slock_bitmap.bitmap, no_bytes_in_map(&ndb_schema_object->slock_bitmap)); if (bitmap_is_clear_all(&ndb_schema_object->slock_bitmap)) @@ -1607,8 +1605,8 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, { const char *tabname= table_share->table_name.str; char key[FN_REFLEN]; - const void *data= 0, *pack_data= 0; - uint length, pack_length; + uchar *data= 0, *pack_data= 0; + size_t length, pack_length; int error; NDBDICT *dict= ndb->getDictionary(); const NDBTAB *altered_table= pOp->getTable(); @@ -1626,7 +1624,7 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, packfrm(data, length, &pack_data, &pack_length) == 0 && cmp_frm(altered_table, pack_data, pack_length)) { - DBUG_DUMP("frm", (char*)altered_table->getFrmData(), + DBUG_DUMP("frm", (uchar*) altered_table->getFrmData(), altered_table->getFrmLength()); pthread_mutex_lock(&LOCK_open); Ndb_table_guard ndbtab_g(dict, tabname); @@ -1637,7 +1635,8 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR)); data= NULL; - if ((error= unpackfrm(&data, &length, altered_table->getFrmData())) || + if ((error= unpackfrm(&data, &length, + (const uchar*) altered_table->getFrmData())) || (error= writefrm(key, data, length))) { sql_print_information("NDB: Failed write frm for %s.%s, error %d", @@ -1957,7 +1956,7 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb, if (log_query && ndb_binlog_running) ndb_binlog_query(thd, schema); /* signal that schema operation has been handled */ - DBUG_DUMP("slock", (char*)schema->slock, schema->slock_length); + DBUG_DUMP("slock", (uchar*) schema->slock, schema->slock_length); if (bitmap_is_set(&slock, node_id)) { if (post_epoch_unlock) @@ -2104,14 +2103,14 @@ ndb_binlog_thread_handle_schema_event_post_epoch(THD *thd, pthread_mutex_lock(&ndbcluster_mutex); NDB_SCHEMA_OBJECT *ndb_schema_object= (NDB_SCHEMA_OBJECT*) hash_search(&ndb_schema_objects, - (byte*) key, strlen(key)); + (uchar*) key, strlen(key)); if (ndb_schema_object) { pthread_mutex_lock(&ndb_schema_object->mutex); memcpy(ndb_schema_object->slock, schema->slock, sizeof(ndb_schema_object->slock)); DBUG_DUMP("ndb_schema_object->slock_bitmap.bitmap", - (char*)ndb_schema_object->slock_bitmap.bitmap, + (uchar*)ndb_schema_object->slock_bitmap.bitmap, no_bytes_in_map(&ndb_schema_object->slock_bitmap)); pthread_mutex_unlock(&ndb_schema_object->mutex); pthread_cond_signal(&injector_cond); @@ -2495,7 +2494,7 @@ int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key, /* Handle any trailing share */ NDB_SHARE *share= (NDB_SHARE*) hash_search(&ndbcluster_open_tables, - (byte*) key, key_len); + (uchar*) key, key_len); if (share && share_may_exist) { @@ -2906,10 +2905,10 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab, if (is_ndb_compatible_type(f)) { DBUG_PRINT("info", ("%s compatible", col_name)); - attr0.rec= op->getValue(col_name, f->ptr); + attr0.rec= op->getValue(col_name, (char*) f->ptr); attr1.rec= op->getPreValue(col_name, - (f->ptr - share->table->record[0]) + - share->table->record[1]); + (f->ptr - share->table->record[0]) + + (char*) share->table->record[1]); } else if (! (f->flags & BLOB_FLAG)) { @@ -3295,7 +3294,7 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp, for now malloc/free blobs buffer each time TODO if possible share single permanent buffer with handlers */ - byte* blobs_buffer[2] = { 0, 0 }; + uchar* blobs_buffer[2] = { 0, 0 }; uint blobs_buffer_size[2] = { 0, 0 }; switch(pOp->getEventType()) @@ -3455,11 +3454,13 @@ private: Injector thread main loop ****************************************************************/ -static byte *ndb_schema_objects_get_key(NDB_SCHEMA_OBJECT *schema_object, uint *length, - my_bool not_used __attribute__((unused))) +static uchar * +ndb_schema_objects_get_key(NDB_SCHEMA_OBJECT *schema_object, + size_t *length, + my_bool not_used __attribute__((unused))) { *length= schema_object->key_length; - return (byte*) schema_object->key; + return (uchar*) schema_object->key; } static NDB_SCHEMA_OBJECT *ndb_get_schema_object(const char *key, @@ -3475,7 +3476,7 @@ static NDB_SCHEMA_OBJECT *ndb_get_schema_object(const char *key, pthread_mutex_lock(&ndbcluster_mutex); while (!(ndb_schema_object= (NDB_SCHEMA_OBJECT*) hash_search(&ndb_schema_objects, - (byte*) key, + (uchar*) key, length))) { if (!create_if_not_exists) @@ -3493,9 +3494,9 @@ static NDB_SCHEMA_OBJECT *ndb_get_schema_object(const char *key, ndb_schema_object->key= (char *)(ndb_schema_object+1); memcpy(ndb_schema_object->key, key, length + 1); ndb_schema_object->key_length= length; - if (my_hash_insert(&ndb_schema_objects, (byte*) ndb_schema_object)) + if (my_hash_insert(&ndb_schema_objects, (uchar*) ndb_schema_object)) { - my_free((gptr) ndb_schema_object, 0); + my_free((uchar*) ndb_schema_object, 0); break; } pthread_mutex_init(&ndb_schema_object->mutex, MY_MUTEX_INIT_FAST); @@ -3525,9 +3526,9 @@ static void ndb_free_schema_object(NDB_SCHEMA_OBJECT **ndb_schema_object, if (!--(*ndb_schema_object)->use_count) { DBUG_PRINT("info", ("use_count: %d", (*ndb_schema_object)->use_count)); - hash_delete(&ndb_schema_objects, (byte*) *ndb_schema_object); + hash_delete(&ndb_schema_objects, (uchar*) *ndb_schema_object); pthread_mutex_destroy(&(*ndb_schema_object)->mutex); - my_free((gptr) *ndb_schema_object, MYF(0)); + my_free((uchar*) *ndb_schema_object, MYF(0)); *ndb_schema_object= 0; } else @@ -3956,7 +3957,7 @@ restart: NdbDictionary::Event::TE_DELETE)) == 0) { DBUG_PRINT("info", ("skipping non data event table: %.*s", - name.length, name.str)); + (int) name.length, name.str)); continue; } if (!trans.good()) @@ -3965,7 +3966,8 @@ restart: ("Found new data event, initializing transaction")); inj->new_trans(thd, &trans); } - DBUG_PRINT("info", ("use_table: %.*s", name.length, name.str)); + DBUG_PRINT("info", ("use_table: %.*s", + (int) name.length, name.str)); injector::transaction::table tbl(table, TRUE); IF_DBUG(int ret=) trans.use_table(::server_id, tbl); DBUG_ASSERT(ret == 0); @@ -3979,7 +3981,8 @@ restart: #ifndef DBUG_OFF const LEX_STRING& name= table->s->table_name; - DBUG_PRINT("info", ("use_table: %.*s", name.length, name.str)); + DBUG_PRINT("info", ("use_table: %.*s", + (int) name.length, name.str)); #endif injector::transaction::table tbl(table, TRUE); IF_DBUG(int ret=) trans.use_table(::server_id, tbl); diff --git a/sql/ha_ndbcluster_binlog.h b/sql/ha_ndbcluster_binlog.h index ac0d769433e..b5b8d0d9745 100644 --- a/sql/ha_ndbcluster_binlog.h +++ b/sql/ha_ndbcluster_binlog.h @@ -184,7 +184,7 @@ int ndbcluster_find_all_files(THD *thd); #endif /* HAVE_NDB_BINLOG */ void ndb_unpack_record(TABLE *table, NdbValue *value, - MY_BITMAP *defined, byte *buf); + MY_BITMAP *defined, uchar *buf); char *ndb_pack_varchar(const NDBCOL *col, char *buf, const char *str, int sz); diff --git a/sql/ha_ndbcluster_cond.cc b/sql/ha_ndbcluster_cond.cc index 267be17c330..c686e83504c 100644 --- a/sql/ha_ndbcluster_cond.cc +++ b/sql/ha_ndbcluster_cond.cc @@ -1377,9 +1377,9 @@ ha_ndbcluster_cond::generate_scan_filter_from_cond(NdbScanFilter& filter) int ha_ndbcluster_cond::generate_scan_filter_from_key(NdbScanOperation *op, const KEY* key_info, - const byte *key, + const uchar *key, uint key_len, - byte *buf) + uchar *buf) { KEY_PART_INFO* key_part= key_info->key_part; KEY_PART_INFO* end= key_part+key_info->key_parts; @@ -1392,9 +1392,9 @@ int ha_ndbcluster_cond::generate_scan_filter_from_key(NdbScanOperation *op, { Field* field= key_part->field; uint32 pack_len= field->pack_length(); - const byte* ptr= key; + const uchar* ptr= key; DBUG_PRINT("info", ("Filtering value for %s", field->field_name)); - DBUG_DUMP("key", (char*)ptr, pack_len); + DBUG_DUMP("key", ptr, pack_len); if (key_part->null_bit) { DBUG_PRINT("info", ("Generating ISNULL filter")); diff --git a/sql/ha_ndbcluster_cond.h b/sql/ha_ndbcluster_cond.h index 617302107d8..d5b3b913f22 100644 --- a/sql/ha_ndbcluster_cond.h +++ b/sql/ha_ndbcluster_cond.h @@ -198,7 +198,7 @@ public: return value.item->str_value.ptr(); break; case(NDB_FIELD): - return value.field_value->field->ptr; + return (char*) value.field_value->field->ptr; default: break; } @@ -458,9 +458,9 @@ public: int generate_scan_filter_from_cond(NdbScanFilter& filter); int generate_scan_filter_from_key(NdbScanOperation* op, const KEY* key_info, - const byte *key, + const uchar *key, uint key_len, - byte *buf); + uchar *buf); private: bool serialize_cond(const COND *cond, Ndb_cond_stack *ndb_cond, TABLE *table, const NdbDictionary::Table *ndb_table); diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index d3979fa0718..5393e8499b0 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1224,9 +1224,9 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, const char *path, ulonglong *copied, ulonglong *deleted, - const void *pack_frm_data + const uchar *pack_frm_data __attribute__((unused)), - uint pack_frm_len + size_t pack_frm_len __attribute__((unused))) { List_iterator<partition_element> part_it(m_part_info->partitions); @@ -1964,7 +1964,7 @@ bool ha_partition::create_handler_file(const char *name) if ((file= my_create(file_name, CREATE_MODE, O_RDWR | O_TRUNC, MYF(MY_WME))) >= 0) { - result= my_write(file, (byte *) file_buffer, tot_len_byte, + result= my_write(file, (uchar *) file_buffer, tot_len_byte, MYF(MY_WME | MY_NABP)); VOID(my_close(file, MYF(0))); } @@ -2141,14 +2141,14 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root) /* Following could be done with my_stat to read in whole file */ if ((file= my_open(buff, O_RDONLY | O_SHARE, MYF(0))) < 0) DBUG_RETURN(TRUE); - if (my_read(file, (byte *) & buff[0], 8, MYF(MY_NABP))) + if (my_read(file, (uchar *) & buff[0], 8, MYF(MY_NABP))) goto err1; len_words= uint4korr(buff); len_bytes= 4 * len_words; - if (!(file_buffer= my_malloc(len_bytes, MYF(0)))) + if (!(file_buffer= (char*) my_malloc(len_bytes, MYF(0)))) goto err1; VOID(my_seek(file, 0, MY_SEEK_SET, MYF(0))); - if (my_read(file, (byte *) file_buffer, len_bytes, MYF(MY_NABP))) + if (my_read(file, (uchar *) file_buffer, len_bytes, MYF(MY_NABP))) goto err2; chksum= 0; @@ -2237,7 +2237,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) alloc_len+= table->s->max_key_length; if (!m_ordered_rec_buffer) { - if (!(m_ordered_rec_buffer= (byte*)my_malloc(alloc_len, MYF(MY_WME)))) + if (!(m_ordered_rec_buffer= (uchar*)my_malloc(alloc_len, MYF(MY_WME)))) { DBUG_RETURN(1); } @@ -2256,7 +2256,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) int2store(ptr, i); ptr+= m_rec_length + PARTITION_BYTES_IN_POS; } while (++i < m_tot_parts); - m_start_key.key= (const byte*)ptr; + m_start_key.key= (const uchar*)ptr; } } @@ -2641,13 +2641,13 @@ void ha_partition::unlock_row() may be used in determining which partition the row should be written to. */ -int ha_partition::write_row(byte * buf) +int ha_partition::write_row(uchar * buf) { uint32 part_id; int error; longlong func_value; #ifdef NOT_NEEDED - byte *rec0= m_rec0; + uchar *rec0= m_rec0; #endif DBUG_ENTER("ha_partition::write_row"); DBUG_ASSERT(buf == m_rec0); @@ -2721,7 +2721,7 @@ int ha_partition::write_row(byte * buf) old_data is normally record[1] but may be anything */ -int ha_partition::update_row(const byte *old_data, byte *new_data) +int ha_partition::update_row(const uchar *old_data, uchar *new_data) { uint32 new_part_id, old_part_id; int error; @@ -2793,7 +2793,7 @@ int ha_partition::update_row(const byte *old_data, byte *new_data) buf is either record[0] or record[1] */ -int ha_partition::delete_row(const byte *buf) +int ha_partition::delete_row(const uchar *buf) { uint32 part_id; int error; @@ -3064,7 +3064,7 @@ int ha_partition::rnd_end() sql_table.cc, and sql_update.cc. */ -int ha_partition::rnd_next(byte *buf) +int ha_partition::rnd_next(uchar *buf) { handler *file; int result= HA_ERR_END_OF_FILE; @@ -3157,7 +3157,7 @@ end: Called from filesort.cc, sql_select.cc, sql_delete.cc and sql_update.cc. */ -void ha_partition::position(const byte *record) +void ha_partition::position(const uchar *record) { handler *file= m_file[m_last_part]; DBUG_ENTER("ha_partition::position"); @@ -3197,13 +3197,13 @@ void ha_partition::position(const byte *record) sql_update.cc. */ -int ha_partition::rnd_pos(byte * buf, byte *pos) +int ha_partition::rnd_pos(uchar * buf, uchar *pos) { uint part_id; handler *file; DBUG_ENTER("ha_partition::rnd_pos"); - part_id= uint2korr((const byte *) pos); + part_id= uint2korr((const uchar *) pos); DBUG_ASSERT(part_id < m_tot_parts); file= m_file[part_id]; m_last_part= part_id; @@ -3335,7 +3335,7 @@ int ha_partition::index_end() used in conjuntion with multi read ranges. */ -int ha_partition::index_read(byte * buf, const byte * key, +int ha_partition::index_read(uchar * buf, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag) { @@ -3356,7 +3356,7 @@ int ha_partition::index_read(byte * buf, const byte * key, see index_read for rest */ -int ha_partition::common_index_read(byte *buf, const byte *key, +int ha_partition::common_index_read(uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) { @@ -3433,7 +3433,7 @@ int ha_partition::common_index_read(byte *buf, const byte *key, and sql_select.cc. */ -int ha_partition::index_first(byte * buf) +int ha_partition::index_first(uchar * buf) { DBUG_ENTER("ha_partition::index_first"); @@ -3464,7 +3464,7 @@ int ha_partition::index_first(byte * buf) and sql_select.cc. */ -int ha_partition::index_last(byte * buf) +int ha_partition::index_last(uchar * buf) { DBUG_ENTER("ha_partition::index_last"); @@ -3481,7 +3481,7 @@ int ha_partition::index_last(byte * buf) see index_first for rest */ -int ha_partition::common_first_last(byte *buf) +int ha_partition::common_first_last(uchar *buf) { int error; @@ -3512,7 +3512,7 @@ int ha_partition::common_first_last(byte *buf) Can only be used on indexes supporting HA_READ_ORDER */ -int ha_partition::index_read_last(byte *buf, const byte *key, +int ha_partition::index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map) { DBUG_ENTER("ha_partition::index_read_last"); @@ -3539,7 +3539,7 @@ int ha_partition::index_read_last(byte *buf, const byte *key, Used to read forward through the index. */ -int ha_partition::index_next(byte * buf) +int ha_partition::index_next(uchar * buf) { DBUG_ENTER("ha_partition::index_next"); @@ -3575,7 +3575,7 @@ int ha_partition::index_next(byte * buf) as supplied in the call. */ -int ha_partition::index_next_same(byte *buf, const byte *key, uint keylen) +int ha_partition::index_next_same(uchar *buf, const uchar *key, uint keylen) { DBUG_ENTER("ha_partition::index_next_same"); @@ -3602,7 +3602,7 @@ int ha_partition::index_next_same(byte *buf, const byte *key, uint keylen) Used to read backwards through the index. */ -int ha_partition::index_prev(byte * buf) +int ha_partition::index_prev(uchar * buf) { DBUG_ENTER("ha_partition::index_prev"); @@ -3711,7 +3711,7 @@ int ha_partition::read_range_next() of them */ -int ha_partition::partition_scan_set_up(byte * buf, bool idx_read_flag) +int ha_partition::partition_scan_set_up(uchar * buf, bool idx_read_flag) { DBUG_ENTER("ha_partition::partition_scan_set_up"); @@ -3792,7 +3792,7 @@ int ha_partition::partition_scan_set_up(byte * buf, bool idx_read_flag) perform any sort. */ -int ha_partition::handle_unordered_next(byte *buf, bool is_next_same) +int ha_partition::handle_unordered_next(uchar *buf, bool is_next_same) { handler *file= file= m_file[m_part_spec.start_part]; int error; @@ -3847,7 +3847,7 @@ int ha_partition::handle_unordered_next(byte *buf, bool is_next_same) Both initial start and after completing scan on one partition. */ -int ha_partition::handle_unordered_scan_next_partition(byte * buf) +int ha_partition::handle_unordered_scan_next_partition(uchar * buf) { uint i; DBUG_ENTER("ha_partition::handle_unordered_scan_next_partition"); @@ -3934,7 +3934,7 @@ int ha_partition::handle_unordered_scan_next_partition(byte * buf) entries. */ -int ha_partition::handle_ordered_index_scan(byte *buf, bool reverse_order) +int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order) { uint i; uint j= 0; @@ -3949,7 +3949,7 @@ int ha_partition::handle_ordered_index_scan(byte *buf, bool reverse_order) { if (!(bitmap_is_set(&(m_part_info->used_partitions), i))) continue; - byte *rec_buf_ptr= rec_buf(i); + uchar *rec_buf_ptr= rec_buf(i); int error; handler *file= m_file[i]; @@ -3984,7 +3984,7 @@ int ha_partition::handle_ordered_index_scan(byte *buf, bool reverse_order) /* Initialise queue without order first, simply insert */ - queue_element(&m_queue, j++)= (byte*)queue_buf(i); + queue_element(&m_queue, j++)= (uchar*)queue_buf(i); } else if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE) { @@ -4021,11 +4021,11 @@ int ha_partition::handle_ordered_index_scan(byte *buf, bool reverse_order) NONE */ -void ha_partition::return_top_record(byte *buf) +void ha_partition::return_top_record(uchar *buf) { uint part_id; - byte *key_buffer= queue_top(&m_queue); - byte *rec_buffer= key_buffer + PARTITION_BYTES_IN_POS; + uchar *key_buffer= queue_top(&m_queue); + uchar *rec_buffer= key_buffer + PARTITION_BYTES_IN_POS; part_id= uint2korr(key_buffer); memcpy(buf, rec_buffer, m_rec_length); @@ -4048,7 +4048,7 @@ void ha_partition::return_top_record(byte *buf) other Error code */ -int ha_partition::handle_ordered_next(byte *buf, bool is_next_same) +int ha_partition::handle_ordered_next(uchar *buf, bool is_next_same) { int error; uint part_id= m_top_entry; @@ -4097,7 +4097,7 @@ int ha_partition::handle_ordered_next(byte *buf, bool is_next_same) other Error code */ -int ha_partition::handle_ordered_prev(byte *buf) +int ha_partition::handle_ordered_prev(uchar *buf) { int error; uint part_id= m_top_entry; @@ -5342,7 +5342,7 @@ uint ha_partition::min_record_length(uint options) const they are the same. Sort in partition id order if not equal. */ -int ha_partition::cmp_ref(const byte *ref1, const byte *ref2) +int ha_partition::cmp_ref(const uchar *ref1, const uchar *ref2) { uint part_id; my_ptrdiff_t diff1, diff2; @@ -5551,11 +5551,11 @@ static int partition_init= 0; Function we use in the creation of our hash to get key. */ -static byte *partition_get_key(PARTITION_SHARE *share, uint *length, +static uchar *partition_get_key(PARTITION_SHARE *share, size_t *length, my_bool not_used __attribute__ ((unused))) { *length= share->table_name_length; - return (byte *) share->table_name; + return (uchar *) share->table_name; } /* @@ -5595,12 +5595,12 @@ static PARTITION_SHARE *get_share(const char *table_name, TABLE *table) length= (uint) strlen(table_name); if (!(share= (PARTITION_SHARE *) hash_search(&partition_open_tables, - (byte *) table_name, length))) + (uchar *) table_name, length))) { if (!(share= (PARTITION_SHARE *) my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), - &share, sizeof(*share), - &tmp_name, length + 1, NullS))) + &share, (uint) sizeof(*share), + &tmp_name, (uint) length + 1, NullS))) { pthread_mutex_unlock(&partition_mutex); return NULL; @@ -5610,7 +5610,7 @@ static PARTITION_SHARE *get_share(const char *table_name, TABLE *table) share->table_name_length= length; share->table_name= tmp_name; strmov(share->table_name, table_name); - if (my_hash_insert(&partition_open_tables, (byte *) share)) + if (my_hash_insert(&partition_open_tables, (uchar *) share)) goto error; thr_lock_init(&share->lock); pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST); @@ -5622,7 +5622,7 @@ static PARTITION_SHARE *get_share(const char *table_name, TABLE *table) error: pthread_mutex_unlock(&partition_mutex); - my_free((gptr) share, MYF(0)); + my_free((uchar*) share, MYF(0)); return NULL; } @@ -5639,10 +5639,10 @@ static int free_share(PARTITION_SHARE *share) pthread_mutex_lock(&partition_mutex); if (!--share->use_count) { - hash_delete(&partition_open_tables, (byte *) share); + hash_delete(&partition_open_tables, (uchar *) share); thr_lock_delete(&share->lock); pthread_mutex_destroy(&share->mutex); - my_free((gptr) share, MYF(0)); + my_free((uchar*) share, MYF(0)); } pthread_mutex_unlock(&partition_mutex); diff --git a/sql/ha_partition.h b/sql/ha_partition.h index a081e4bb472..0878c75ec42 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -61,12 +61,12 @@ private: handler **m_reorged_file; // Reorganised partitions handler **m_added_file; // Added parts kept for errors partition_info *m_part_info; // local reference to partition - byte *m_start_key_ref; // Reference of start key in current + uchar *m_start_key_ref; // Reference of start key in current // index scan info Field **m_part_field_array; // Part field array locally to save acc - byte *m_ordered_rec_buffer; // Row and key buffer for ord. idx scan + uchar *m_ordered_rec_buffer; // Row and key buffer for ord. idx scan KEY *m_curr_key_info; // Current index - byte *m_rec0; // table->record[0] + uchar *m_rec0; // table->record[0] QUEUE m_queue; // Prio queue used by sorted read /* Since the partition handler is a handler on top of other handlers, it @@ -195,8 +195,8 @@ public: const char *path, ulonglong *copied, ulonglong *deleted, - const void *pack_frm_data, - uint pack_frm_len); + const uchar *pack_frm_data, + size_t pack_frm_len); virtual int drop_partitions(const char *path); virtual int rename_partitions(const char *path); bool get_no_parts(const char *name, uint *no_parts) @@ -306,9 +306,9 @@ public: number of calls to write_row. Not yet though. */ - virtual int write_row(byte * buf); - virtual int update_row(const byte * old_data, byte * new_data); - virtual int delete_row(const byte * buf); + virtual int write_row(uchar * buf); + virtual int update_row(const uchar * old_data, uchar * new_data); + virtual int delete_row(const uchar * buf); virtual int delete_all_rows(void); virtual void start_bulk_insert(ha_rows rows); virtual int end_bulk_insert(); @@ -347,9 +347,9 @@ public: */ virtual int rnd_init(bool scan); virtual int rnd_end(); - virtual int rnd_next(byte * buf); - virtual int rnd_pos(byte * buf, byte * pos); - virtual void position(const byte * record); + virtual int rnd_next(uchar * buf); + virtual int rnd_pos(uchar * buf, uchar * pos); + virtual void position(const uchar * record); /* ------------------------------------------------------------------------- @@ -383,7 +383,7 @@ public: index_init initializes an index before using it and index_end does any end processing needed. */ - virtual int index_read(byte * buf, const byte * key, + virtual int index_read(uchar * buf, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag); virtual int index_init(uint idx, bool sorted); @@ -393,12 +393,12 @@ public: These methods are used to jump to next or previous entry in the index scan. There are also methods to jump to first and last entry. */ - virtual int index_next(byte * buf); - virtual int index_prev(byte * buf); - virtual int index_first(byte * buf); - virtual int index_last(byte * buf); - virtual int index_next_same(byte * buf, const byte * key, uint keylen); - virtual int index_read_last(byte * buf, const byte * key, + virtual int index_next(uchar * buf); + virtual int index_prev(uchar * buf); + virtual int index_first(uchar * buf); + virtual int index_last(uchar * buf); + virtual int index_next_same(uchar * buf, const uchar * key, uint keylen); + virtual int index_read_last(uchar * buf, const uchar * key, key_part_map keypart_map); /* @@ -406,7 +406,7 @@ public: handler.cc, no storage engine has implemented it so neither will the partition handler. - virtual int read_first_row(byte *buf, uint primary_key); + virtual int read_first_row(uchar *buf, uint primary_key); */ /* @@ -424,27 +424,27 @@ public: virtual int read_range_next(); private: - int common_index_read(byte * buf, const byte * key, + int common_index_read(uchar * buf, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag); - int common_first_last(byte * buf); - int partition_scan_set_up(byte * buf, bool idx_read_flag); - int handle_unordered_next(byte * buf, bool next_same); - int handle_unordered_scan_next_partition(byte * buf); - byte *queue_buf(uint part_id) + int common_first_last(uchar * buf); + int partition_scan_set_up(uchar * buf, bool idx_read_flag); + int handle_unordered_next(uchar * buf, bool next_same); + int handle_unordered_scan_next_partition(uchar * buf); + uchar *queue_buf(uint part_id) { return (m_ordered_rec_buffer + (part_id * (m_rec_length + PARTITION_BYTES_IN_POS))); } - byte *rec_buf(uint part_id) + uchar *rec_buf(uint part_id) { return (queue_buf(part_id) + PARTITION_BYTES_IN_POS); } - int handle_ordered_index_scan(byte * buf, bool reverse_order); - int handle_ordered_next(byte * buf, bool next_same); - int handle_ordered_prev(byte * buf); - void return_top_record(byte * buf); + int handle_ordered_index_scan(uchar * buf, bool reverse_order); + int handle_ordered_next(uchar * buf, bool next_same); + int handle_ordered_prev(uchar * buf); + void return_top_record(uchar * buf); void include_partition_fields_in_used_fields(); public: /* @@ -809,7 +809,7 @@ public: to check whether the rest of the reference part is also the same. ------------------------------------------------------------------------- */ - virtual int cmp_ref(const byte * ref1, const byte * ref2); + virtual int cmp_ref(const uchar * ref1, const uchar * ref2); /* ------------------------------------------------------------------------- MODULE auto increment @@ -873,10 +873,10 @@ public: Fulltext stuff not yet. ------------------------------------------------------------------------- virtual int ft_init() { return HA_ERR_WRONG_COMMAND; } - virtual FT_INFO *ft_init_ext(uint flags,uint inx,const byte *key, + virtual FT_INFO *ft_init_ext(uint flags,uint inx,const uchar *key, uint keylen) { return NULL; } - virtual int ft_read(byte *buf) { return HA_ERR_WRONG_COMMAND; } + virtual int ft_read(uchar *buf) { return HA_ERR_WRONG_COMMAND; } */ /* @@ -885,7 +885,7 @@ public: ------------------------------------------------------------------------- The following method is only used by MyISAM when used as temporary tables in a join. - virtual int restart_rnd_next(byte *buf, byte *pos); + virtual int restart_rnd_next(uchar *buf, uchar *pos); */ /* diff --git a/sql/handler.cc b/sql/handler.cc index e0018a66400..f28e0d0bc20 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -353,7 +353,7 @@ static int ha_finish_errors(void) /* Allocate a pointer array for the error message strings. */ if (! (errmsgs= my_error_unregister(HA_ERR_FIRST, HA_ERR_LAST))) return 1; - my_free((gptr) errmsgs, MYF(0)); + my_free((uchar*) errmsgs, MYF(0)); return 0; } @@ -391,7 +391,7 @@ int ha_finalize_handlerton(st_plugin_int *plugin) } } - my_free((gptr)hton, MYF(0)); + my_free((uchar*)hton, MYF(0)); DBUG_RETURN(0); } @@ -1037,7 +1037,7 @@ static my_bool xarecover_handlerton(THD *unused, st_plugin_int *plugin, } // recovery mode if (info->commit_list ? - hash_search(info->commit_list, (byte *)&x, sizeof(x)) != 0 : + hash_search(info->commit_list, (uchar *)&x, sizeof(x)) != 0 : tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT) { #ifndef DBUG_OFF @@ -1107,7 +1107,7 @@ int ha_recover(HASH *commit_list) plugin_foreach(NULL, xarecover_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, &info); - my_free((gptr)info.list, MYF(0)); + my_free((uchar*)info.list, MYF(0)); if (info.found_foreign_xids) sql_print_warning("Found %d prepared XA transactions", info.found_foreign_xids); @@ -1231,7 +1231,7 @@ int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv) { int err; DBUG_ASSERT((*ht)->savepoint_set != 0); - if ((err= (*(*ht)->savepoint_rollback)(*ht, thd, (byte *)(sv+1)+(*ht)->savepoint_offset))) + if ((err= (*(*ht)->savepoint_rollback)(*ht, thd, (uchar *)(sv+1)+(*ht)->savepoint_offset))) { // cannot happen my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err); error=1; @@ -1280,7 +1280,7 @@ int ha_savepoint(THD *thd, SAVEPOINT *sv) error=1; break; } - if ((err= (*(*ht)->savepoint_set)(*ht, thd, (byte *)(sv+1)+(*ht)->savepoint_offset))) + if ((err= (*(*ht)->savepoint_set)(*ht, thd, (uchar *)(sv+1)+(*ht)->savepoint_offset))) { // cannot happen my_error(ER_GET_ERRNO, MYF(0), err); error=1; @@ -1307,7 +1307,7 @@ int ha_release_savepoint(THD *thd, SAVEPOINT *sv) if (!(*ht)->savepoint_release) continue; if ((err= (*(*ht)->savepoint_release)(*ht, thd, - (byte *)(sv+1)+ + (uchar *)(sv+1)+ (*ht)->savepoint_offset))) { // cannot happen my_error(ER_GET_ERRNO, MYF(0), err); @@ -1544,7 +1544,7 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode, table->db_stat|=HA_READ_ONLY; (void) extra(HA_EXTRA_NO_READCHECK); // Not needed in SQL - if (!(ref= (byte*) alloc_root(&table->mem_root, ALIGN_SIZE(ref_length)*2))) + if (!(ref= (uchar*) alloc_root(&table->mem_root, ALIGN_SIZE(ref_length)*2))) { close(); error=HA_ERR_OUT_OF_MEM; @@ -1562,7 +1562,7 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode, This is never called for InnoDB tables, as these table types has the HA_STATS_RECORDS_IS_EXACT set. */ -int handler::read_first_row(byte * buf, uint primary_key) +int handler::read_first_row(uchar * buf, uint primary_key) { register int error; DBUG_ENTER("handler::read_first_row"); @@ -1972,7 +1972,7 @@ void handler::get_auto_increment(ulonglong offset, ulonglong increment, } else { - byte key[MAX_KEY_LENGTH]; + uchar key[MAX_KEY_LENGTH]; key_copy(key, table->record[0], table->key_info + table->s->next_number_index, table->s->next_number_key_offset); @@ -2331,12 +2331,12 @@ static bool update_frm_version(TABLE *table) int4store(version, MYSQL_VERSION_ID); - if ((result= my_pwrite(file,(byte*) version,4,51L,MYF_RW))) + if ((result= my_pwrite(file,(uchar*) version,4,51L,MYF_RW))) goto err; - for (entry=(TABLE*) hash_first(&open_cache,(byte*) key,key_length, &state); + for (entry=(TABLE*) hash_first(&open_cache,(uchar*) key,key_length, &state); entry; - entry= (TABLE*) hash_next(&open_cache,(byte*) key,key_length, &state)) + entry= (TABLE*) hash_next(&open_cache,(uchar*) key,key_length, &state)) entry->s->mysql_version= MYSQL_VERSION_ID; } err: @@ -2499,7 +2499,7 @@ int ha_enable_transaction(THD *thd, bool on) DBUG_RETURN(error); } -int handler::index_next_same(byte *buf, const byte *key, uint keylen) +int handler::index_next_same(uchar *buf, const uchar *key, uint keylen) { int error; if (!(error=index_next(buf))) @@ -2608,8 +2608,8 @@ err: int ha_create_table_from_engine(THD* thd, const char *db, const char *name) { int error; - const void *frmblob; - uint frmlen; + uchar *frmblob; + size_t frmlen; char path[FN_REFLEN]; HA_CREATE_INFO create_info; TABLE table; @@ -2617,7 +2617,7 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name) DBUG_ENTER("ha_create_table_from_engine"); DBUG_PRINT("enter", ("name '%s'.'%s'", db, name)); - bzero((char*) &create_info,sizeof(create_info)); + bzero((uchar*) &create_info,sizeof(create_info)); if ((error= ha_discover(thd, db, name, &frmblob, &frmlen))) { /* Table could not be discovered and thus not created */ @@ -2632,7 +2632,7 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name) (void)strxnmov(path,FN_REFLEN-1,mysql_data_home,"/",db,"/",name,NullS); // Save the frm file error= writefrm(path, frmblob, frmlen); - my_free((char*) frmblob, MYF(0)); + my_free(frmblob, MYF(0)); if (error) DBUG_RETURN(2); @@ -2774,8 +2774,8 @@ struct st_discover_args { const char *db; const char *name; - const void** frmblob; - uint* frmlen; + uchar **frmblob; + size_t *frmlen; }; static my_bool discover_handlerton(THD *thd, st_plugin_int *plugin, @@ -2793,7 +2793,7 @@ static my_bool discover_handlerton(THD *thd, st_plugin_int *plugin, } int ha_discover(THD *thd, const char *db, const char *name, - const void **frmblob, uint *frmlen) + uchar **frmblob, size_t *frmlen) { int error= -1; // Table does not exist in any handler DBUG_ENTER("ha_discover"); @@ -3278,7 +3278,7 @@ int handler::compare_key(key_range *range) } -int handler::index_read_idx(byte * buf, uint index, const byte * key, +int handler::index_read_idx(uchar * buf, uint index, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag) { @@ -3538,8 +3538,8 @@ namespace template<class RowsEventT> int binlog_log_row(TABLE* table, - const byte *before_record, - const byte *after_record) + const uchar *before_record, + const uchar *after_record) { if (table->file->ha_table_flags() & HA_HAS_OWN_BINLOGGING) return 0; @@ -3588,13 +3588,13 @@ namespace */ template int - binlog_log_row<Write_rows_log_event>(TABLE *, const byte *, const byte *); + binlog_log_row<Write_rows_log_event>(TABLE *, const uchar *, const uchar *); template int - binlog_log_row<Delete_rows_log_event>(TABLE *, const byte *, const byte *); + binlog_log_row<Delete_rows_log_event>(TABLE *, const uchar *, const uchar *); template int - binlog_log_row<Update_rows_log_event>(TABLE *, const byte *, const byte *); + binlog_log_row<Update_rows_log_event>(TABLE *, const uchar *, const uchar *); } @@ -3618,9 +3618,9 @@ int handler::ha_reset() { DBUG_ENTER("ha_reset"); /* Check that we have called all proper deallocation functions */ - DBUG_ASSERT((byte*) table->def_read_set.bitmap + + DBUG_ASSERT((uchar*) table->def_read_set.bitmap + table->s->column_bitmap_size == - (byte*) table->def_write_set.bitmap); + (uchar*) table->def_write_set.bitmap); DBUG_ASSERT(bitmap_is_set_all(&table->s->all_set)); DBUG_ASSERT(table->key_read == 0); /* ensure that ha_index_end / ha_rnd_end has been called */ @@ -3631,7 +3631,7 @@ int handler::ha_reset() } -int handler::ha_write_row(byte *buf) +int handler::ha_write_row(uchar *buf) { int error; if (unlikely(error= write_row(buf))) @@ -3641,7 +3641,7 @@ int handler::ha_write_row(byte *buf) return 0; } -int handler::ha_update_row(const byte *old_data, byte *new_data) +int handler::ha_update_row(const uchar *old_data, uchar *new_data) { int error; @@ -3658,7 +3658,7 @@ int handler::ha_update_row(const byte *old_data, byte *new_data) return 0; } -int handler::ha_delete_row(const byte *buf) +int handler::ha_delete_row(const uchar *buf) { int error; if (unlikely(error= delete_row(buf))) @@ -3781,7 +3781,7 @@ int fl_log_iterator_next(struct handler_iterator *iterator, void fl_log_iterator_destroy(struct handler_iterator *iterator) { - my_free((gptr)iterator->buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*)iterator->buffer, MYF(MY_ALLOW_ZERO_PTR)); } @@ -3794,7 +3794,7 @@ fl_log_iterator_buffer_init(struct handler_iterator *iterator) MY_DIR *dirp; struct fl_buff *buff; char *name_ptr; - byte *ptr; + uchar *ptr; FILEINFO *file; uint32 i; @@ -3805,7 +3805,7 @@ fl_log_iterator_buffer_init(struct handler_iterator *iterator) { return HA_ITERATOR_ERROR; } - if ((ptr= (byte*)my_malloc(ALIGN_SIZE(sizeof(fl_buff)) + + if ((ptr= (uchar*)my_malloc(ALIGN_SIZE(sizeof(fl_buff)) + ((ALIGN_SIZE(sizeof(LEX_STRING)) + sizeof(enum log_status) + + FN_REFLEN) * diff --git a/sql/handler.h b/sql/handler.h index cfa86358fa1..ff0d5a362a5 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -378,9 +378,9 @@ struct xid_t { return sizeof(formatID)+sizeof(gtrid_length)+sizeof(bqual_length)+ gtrid_length+bqual_length; } - byte *key() + uchar *key() { - return (byte *)>rid_length; + return (uchar *)>rid_length; } uint key_length() { @@ -674,8 +674,8 @@ struct handlerton struct handler_iterator *fill_this_in); int (*discover)(handlerton *hton, THD* thd, const char *db, const char *name, - const void** frmblob, - uint* frmlen); + uchar **frmblob, + size_t *frmlen); int (*find_files)(handlerton *hton, THD *thd, const char *db, const char *path, @@ -835,9 +835,9 @@ typedef struct st_ha_check_opt typedef struct st_handler_buffer { - const byte *buffer; /* Buffer one can start using */ - const byte *buffer_end; /* End of buffer */ - byte *end_of_used_area; /* End of area that was used by handler */ + const uchar *buffer; /* Buffer one can start using */ + const uchar *buffer_end; /* End of buffer */ + uchar *end_of_used_area; /* End of area that was used by handler */ } HANDLER_BUFFER; typedef struct system_status_var SSV; @@ -867,7 +867,7 @@ public: {} }; -uint calculate_key_len(TABLE *, uint, const byte *, key_part_map); +uint calculate_key_len(TABLE *, uint, const uchar *, key_part_map); /* bitmap with first N+1 bits set (keypart_map for a key prefix of [0..N] keyparts) @@ -913,8 +913,8 @@ class handler :public Sql_alloc virtual int end_bulk_insert() {return 0; } public: handlerton *ht; /* storage engine of this handler */ - byte *ref; /* Pointer to current row */ - byte *dup_ref; /* Pointer to duplicate row */ + uchar *ref; /* Pointer to current row */ + uchar *dup_ref; /* Pointer to duplicate row */ ha_statistics stats; @@ -1136,9 +1136,9 @@ public: and delete_row() below. */ int ha_external_lock(THD *thd, int lock_type); - int ha_write_row(byte * buf); - int ha_update_row(const byte * old_data, byte * new_data); - int ha_delete_row(const byte * buf); + int ha_write_row(uchar * buf); + int ha_update_row(const uchar * old_data, uchar * new_data); + int ha_delete_row(const uchar * buf); /* SYNOPSIS @@ -1171,7 +1171,7 @@ public: 0 Bulk delete used by handler 1 Bulk delete not used, normal operation used */ - virtual int bulk_update_row(const byte *old_data, byte *new_data, + virtual int bulk_update_row(const uchar *old_data, uchar *new_data, uint *dup_key_found) { DBUG_ASSERT(FALSE); @@ -1220,7 +1220,7 @@ public: return HA_ERR_WRONG_COMMAND; } private: - virtual int index_read(byte * buf, const byte * key, uint key_len, + virtual int index_read(uchar * buf, const uchar * key, uint key_len, enum ha_rkey_function find_flag) { return HA_ERR_WRONG_COMMAND; } public: @@ -1230,7 +1230,7 @@ public: row if available. If the key value is null, begin at the first key of the index. */ - virtual int index_read(byte * buf, const byte * key, key_part_map keypart_map, + virtual int index_read(uchar * buf, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag) { uint key_len= calculate_key_len(table, active_index, key, keypart_map); @@ -1242,20 +1242,20 @@ public: row if available. If the key value is null, begin at the first key of the index. */ - virtual int index_read_idx(byte * buf, uint index, const byte * key, + virtual int index_read_idx(uchar * buf, uint index, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag); - virtual int index_next(byte * buf) + virtual int index_next(uchar * buf) { return HA_ERR_WRONG_COMMAND; } - virtual int index_prev(byte * buf) + virtual int index_prev(uchar * buf) { return HA_ERR_WRONG_COMMAND; } - virtual int index_first(byte * buf) + virtual int index_first(uchar * buf) { return HA_ERR_WRONG_COMMAND; } - virtual int index_last(byte * buf) + virtual int index_last(uchar * buf) { return HA_ERR_WRONG_COMMAND; } - virtual int index_next_same(byte *buf, const byte *key, uint keylen); + virtual int index_next_same(uchar *buf, const uchar *key, uint keylen); private: - virtual int index_read_last(byte * buf, const byte * key, uint key_len) + virtual int index_read_last(uchar * buf, const uchar * key, uint key_len) { return (my_errno=HA_ERR_WRONG_COMMAND); } public: /** @@ -1263,7 +1263,7 @@ public: The following functions works like index_read, but it find the last row with the current key value or prefix. */ - virtual int index_read_last(byte * buf, const byte * key, + virtual int index_read_last(uchar * buf, const uchar * key, key_part_map keypart_map) { uint key_len= calculate_key_len(table, active_index, key, keypart_map); @@ -1282,21 +1282,21 @@ public: void ft_end() { ft_handler=NULL; } virtual FT_INFO *ft_init_ext(uint flags, uint inx,String *key) { return NULL; } - virtual int ft_read(byte *buf) { return HA_ERR_WRONG_COMMAND; } - virtual int rnd_next(byte *buf)=0; - virtual int rnd_pos(byte * buf, byte *pos)=0; - virtual int read_first_row(byte *buf, uint primary_key); + virtual int ft_read(uchar *buf) { return HA_ERR_WRONG_COMMAND; } + virtual int rnd_next(uchar *buf)=0; + virtual int rnd_pos(uchar * buf, uchar *pos)=0; + virtual int read_first_row(uchar *buf, uint primary_key); /* The following function is only needed for tables that may be temporary tables during joins */ - virtual int restart_rnd_next(byte *buf, byte *pos) + virtual int restart_rnd_next(uchar *buf, uchar *pos) { return HA_ERR_WRONG_COMMAND; } - virtual int rnd_same(byte *buf, uint inx) + virtual int rnd_same(uchar *buf, uint inx) { return HA_ERR_WRONG_COMMAND; } virtual ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key) { return (ha_rows) 10; } - virtual void position(const byte *record)=0; + virtual void position(const uchar *record)=0; virtual int info(uint)=0; // see my_base.h for full description virtual void get_dynamic_partition_info(PARTITION_INFO *stat_info, uint part_id); @@ -1552,8 +1552,8 @@ public: const char *path, ulonglong *copied, ulonglong *deleted, - const void *pack_frm_data, - uint pack_frm_len) + const uchar *pack_frm_data, + size_t pack_frm_len) { return HA_ERR_WRONG_COMMAND; } virtual int drop_partitions(const char *path) { return HA_ERR_WRONG_COMMAND; } @@ -1592,7 +1592,7 @@ public: false otherwise */ virtual bool primary_key_is_clustered() { return FALSE; } - virtual int cmp_ref(const byte *ref1, const byte *ref2) + virtual int cmp_ref(const uchar *ref1, const uchar *ref2) { return memcmp(ref1, ref2, ref_length); } @@ -1637,18 +1637,18 @@ public: { return COMPATIBLE_DATA_NO; } /* These are only called from sql_select for internal temporary tables */ - virtual int write_row(byte *buf __attribute__((unused))) + virtual int write_row(uchar *buf __attribute__((unused))) { return HA_ERR_WRONG_COMMAND; } - virtual int update_row(const byte *old_data __attribute__((unused)), - byte *new_data __attribute__((unused))) + virtual int update_row(const uchar *old_data __attribute__((unused)), + uchar *new_data __attribute__((unused))) { return HA_ERR_WRONG_COMMAND; } - virtual int delete_row(const byte *buf __attribute__((unused))) + virtual int delete_row(const uchar *buf __attribute__((unused))) { return HA_ERR_WRONG_COMMAND; } @@ -1741,7 +1741,7 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat); /* discovery */ int ha_create_table_from_engine(THD* thd, const char *db, const char *name); int ha_discover(THD* thd, const char* dbname, const char* name, - const void** frmblob, uint* frmlen); + uchar** frmblob, size_t* frmlen); int ha_find_files(THD *thd,const char *db,const char *path, const char *wild, bool dir,List<char>* files); int ha_table_exists_in_engine(THD* thd, const char* db, const char* name); diff --git a/sql/hash_filo.h b/sql/hash_filo.h index c25af67b572..ab13d338695 100644 --- a/sql/hash_filo.h +++ b/sql/hash_filo.h @@ -84,10 +84,10 @@ public: first_link=last_link=0; } - hash_filo_element *search(gptr key,uint length) + hash_filo_element *search(uchar* key, size_t length) { hash_filo_element *entry=(hash_filo_element*) - hash_search(&cache,(byte*) key,length); + hash_search(&cache,(uchar*) key,length); if (entry) { // Found; link it first if (entry != first_link) @@ -113,9 +113,9 @@ public: { hash_filo_element *tmp=last_link; last_link=last_link->prev_used; - hash_delete(&cache,(byte*) tmp); + hash_delete(&cache,(uchar*) tmp); } - if (my_hash_insert(&cache,(byte*) entry)) + if (my_hash_insert(&cache,(uchar*) entry)) { if (free_element) (*free_element)(entry); // This should never happen diff --git a/sql/hostname.cc b/sql/hostname.cc index 049220c6b6f..34384a9c8c0 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -84,7 +84,7 @@ static void add_hostname(struct in_addr *in,const char *name) { VOID(pthread_mutex_lock(&hostname_cache->lock)); host_entry *entry; - if (!(entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr,0))) + if (!(entry=(host_entry*) hostname_cache->search((uchar*) &in->s_addr,0))) { uint length=name ? (uint) strlen(name) : 0; @@ -115,7 +115,7 @@ void inc_host_errors(struct in_addr *in) { VOID(pthread_mutex_lock(&hostname_cache->lock)); host_entry *entry; - if ((entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr,0))) + if ((entry=(host_entry*) hostname_cache->search((uchar*) &in->s_addr,0))) entry->errors++; VOID(pthread_mutex_unlock(&hostname_cache->lock)); } @@ -124,7 +124,7 @@ void reset_host_errors(struct in_addr *in) { VOID(pthread_mutex_lock(&hostname_cache->lock)); host_entry *entry; - if ((entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr,0))) + if ((entry=(host_entry*) hostname_cache->search((uchar*) &in->s_addr,0))) entry->errors=0; VOID(pthread_mutex_unlock(&hostname_cache->lock)); } @@ -134,7 +134,7 @@ void reset_host_errors(struct in_addr *in) #define INADDR_LOOPBACK 0x7f000001UL #endif -my_string ip_to_hostname(struct in_addr *in, uint *errors) +char * ip_to_hostname(struct in_addr *in, uint *errors) { uint i; host_entry *entry; @@ -149,7 +149,7 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) if (!(specialflag & SPECIAL_NO_HOST_CACHE)) { VOID(pthread_mutex_lock(&hostname_cache->lock)); - if ((entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr,0))) + if ((entry=(host_entry*) hostname_cache->search((uchar*) &in->s_addr,0))) { char *name; if (!entry->hostname) diff --git a/sql/item.cc b/sql/item.cc index 3f4751a4753..0371f5e891f 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -432,7 +432,7 @@ void Item::cleanup() arg - a dummy parameter, is not used here */ -bool Item::cleanup_processor(byte *arg) +bool Item::cleanup_processor(uchar *arg) { if (fixed) cleanup(); @@ -495,7 +495,7 @@ void Item::rename(char *new_name) pointer to newly allocated item is returned. */ -Item* Item::transform(Item_transformer transformer, byte *arg) +Item* Item::transform(Item_transformer transformer, uchar *arg) { DBUG_ASSERT(!current_thd->is_stmt_prepare()); @@ -553,7 +553,7 @@ void Item_ident::cleanup() DBUG_VOID_RETURN; } -bool Item_ident::remove_dependence_processor(byte * arg) +bool Item_ident::remove_dependence_processor(uchar * arg) { DBUG_ENTER("Item_ident::remove_dependence_processor"); if (depended_from == (st_select_lex *) arg) @@ -584,7 +584,7 @@ bool Item_ident::remove_dependence_processor(byte * arg) for the subsequent items. */ -bool Item_field::collect_item_field_processor(byte *arg) +bool Item_field::collect_item_field_processor(uchar *arg) { DBUG_ENTER("Item_field::collect_item_field_processor"); DBUG_PRINT("info", ("%s", field->field_name ? field->field_name : "noname")); @@ -619,7 +619,7 @@ bool Item_field::collect_item_field_processor(byte *arg) FALSE otherwise */ -bool Item_field::find_item_in_field_list_processor(byte *arg) +bool Item_field::find_item_in_field_list_processor(uchar *arg) { KEY_PART_INFO *first_non_group_part= *((KEY_PART_INFO **) arg); KEY_PART_INFO *last_part= *(((KEY_PART_INFO **) arg) + 1); @@ -642,7 +642,7 @@ bool Item_field::find_item_in_field_list_processor(byte *arg) column read set or to register used fields in a view */ -bool Item_field::register_field_in_read_map(byte *arg) +bool Item_field::register_field_in_read_map(uchar *arg) { TABLE *table= (TABLE *) arg; if (field->table == table || !table) @@ -691,7 +691,7 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs) } if (!my_charset_same(cs, system_charset_info)) { - uint32 res_length; + size_t res_length; name= sql_strmake_with_convert(str, name_length= length, cs, MAX_ALIAS_NAME, system_charset_info, &res_length); @@ -786,7 +786,7 @@ Item *Item_string::safe_charset_converter(CHARSET_INFO *tocs) */ return NULL; } - if (!(ptr= current_thd->memdup(cstr.ptr(), cstr.length() + 1 ))) + if (!(ptr= current_thd->strmake(cstr.ptr(), cstr.length()))) return NULL; conv->str_value.set(ptr, cstr.length(), cstr.charset()); /* Ensure that no one is going to change the result string */ @@ -2139,7 +2139,7 @@ Item_decimal::Item_decimal(my_decimal *value_par) } -Item_decimal::Item_decimal(const char *bin, int precision, int scale) +Item_decimal::Item_decimal(const uchar *bin, int precision, int scale) { binary2my_decimal(E_DEC_FATAL_ERROR, bin, &decimal_value, precision, scale); @@ -4066,7 +4066,7 @@ Item_equal *Item_field::find_item_equal(COND_EQUAL *cond_equal) FALSE otherwise */ -bool Item_field::subst_argument_checker(byte **arg) +bool Item_field::subst_argument_checker(uchar **arg) { return (result_type() != STRING_RESULT) || (*arg); } @@ -4098,7 +4098,7 @@ bool Item_field::subst_argument_checker(byte **arg) pointer to the field item, otherwise. */ -Item *Item_field::equal_fields_propagator(byte *arg) +Item *Item_field::equal_fields_propagator(uchar *arg) { if (no_const_subst) return this; @@ -4129,7 +4129,7 @@ Item *Item_field::equal_fields_propagator(byte *arg) See comments in Arg_comparator::set_compare_func() for details */ -bool Item_field::set_no_const_sub(byte *arg) +bool Item_field::set_no_const_sub(uchar *arg) { if (field->charset() != &my_charset_bin) no_const_subst=1; @@ -4164,7 +4164,7 @@ bool Item_field::set_no_const_sub(byte *arg) this - otherwise. */ -Item *Item_field::replace_equal_field(byte *arg) +Item *Item_field::replace_equal_field(uchar *arg) { if (item_equal) { @@ -4314,42 +4314,42 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length) switch (field_type()) { case MYSQL_TYPE_DECIMAL: case MYSQL_TYPE_NEWDECIMAL: - field= new Field_new_decimal((char*) 0, max_length, null_ptr, 0, + field= new Field_new_decimal((uchar*) 0, max_length, null_ptr, 0, Field::NONE, name, decimals, 0, unsigned_flag); break; case MYSQL_TYPE_TINY: - field= new Field_tiny((char*) 0, max_length, null_ptr, 0, Field::NONE, + field= new Field_tiny((uchar*) 0, max_length, null_ptr, 0, Field::NONE, name, 0, unsigned_flag); break; case MYSQL_TYPE_SHORT: - field= new Field_short((char*) 0, max_length, null_ptr, 0, Field::NONE, + field= new Field_short((uchar*) 0, max_length, null_ptr, 0, Field::NONE, name, 0, unsigned_flag); break; case MYSQL_TYPE_LONG: - field= new Field_long((char*) 0, max_length, null_ptr, 0, Field::NONE, + field= new Field_long((uchar*) 0, max_length, null_ptr, 0, Field::NONE, name, 0, unsigned_flag); break; #ifdef HAVE_LONG_LONG case MYSQL_TYPE_LONGLONG: - field= new Field_longlong((char*) 0, max_length, null_ptr, 0, Field::NONE, + field= new Field_longlong((uchar*) 0, max_length, null_ptr, 0, Field::NONE, name, 0, unsigned_flag); break; #endif case MYSQL_TYPE_FLOAT: - field= new Field_float((char*) 0, max_length, null_ptr, 0, Field::NONE, + field= new Field_float((uchar*) 0, max_length, null_ptr, 0, Field::NONE, name, decimals, 0, unsigned_flag); break; case MYSQL_TYPE_DOUBLE: - field= new Field_double((char*) 0, max_length, null_ptr, 0, Field::NONE, + field= new Field_double((uchar*) 0, max_length, null_ptr, 0, Field::NONE, name, decimals, 0, unsigned_flag); break; case MYSQL_TYPE_NULL: - field= new Field_null((char*) 0, max_length, Field::NONE, + field= new Field_null((uchar*) 0, max_length, Field::NONE, name, &my_charset_bin); break; case MYSQL_TYPE_INT24: - field= new Field_medium((char*) 0, max_length, null_ptr, 0, Field::NONE, + field= new Field_medium((uchar*) 0, max_length, null_ptr, 0, Field::NONE, name, 0, unsigned_flag); break; case MYSQL_TYPE_NEWDATE: @@ -4366,7 +4366,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length) field= new Field_datetime(maybe_null, name, &my_charset_bin); break; case MYSQL_TYPE_YEAR: - field= new Field_year((char*) 0, max_length, null_ptr, 0, Field::NONE, + field= new Field_year((uchar*) 0, max_length, null_ptr, 0, Field::NONE, name); break; case MYSQL_TYPE_BIT: @@ -5032,7 +5032,7 @@ void Item_field::update_null_value() this field otherwise */ -Item *Item_field::update_value_transformer(byte *select_arg) +Item *Item_field::update_value_transformer(uchar *select_arg) { SELECT_LEX *select= (SELECT_LEX*)select_arg; DBUG_ASSERT(fixed); @@ -5849,7 +5849,7 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions) same time it can replace some nodes in the tree */ -Item *Item_default_value::transform(Item_transformer transformer, byte *args) +Item *Item_default_value::transform(Item_transformer transformer, uchar *args) { DBUG_ASSERT(!current_thd->is_stmt_prepare()); @@ -6791,7 +6791,7 @@ Field *Item_type_holder::make_field_by_type(TABLE *table) switch (fld_type) { case MYSQL_TYPE_ENUM: DBUG_ASSERT(enum_set_typelib); - field= new Field_enum((char *) 0, max_length, null_ptr, 0, + field= new Field_enum((uchar *) 0, max_length, null_ptr, 0, Field::NONE, name, get_enum_pack_length(enum_set_typelib->count), enum_set_typelib, collation.collation); @@ -6800,7 +6800,7 @@ Field *Item_type_holder::make_field_by_type(TABLE *table) return field; case MYSQL_TYPE_SET: DBUG_ASSERT(enum_set_typelib); - field= new Field_set((char *) 0, max_length, null_ptr, 0, + field= new Field_set((uchar *) 0, max_length, null_ptr, 0, Field::NONE, name, get_set_pack_length(enum_set_typelib->count), enum_set_typelib, collation.collation); diff --git a/sql/item.h b/sql/item.h index 8b57f831cbd..24b7bbfa5bc 100644 --- a/sql/item.h +++ b/sql/item.h @@ -426,7 +426,7 @@ public: }; -typedef bool (Item::*Item_processor) (byte *arg); +typedef bool (Item::*Item_processor) (uchar *arg); /* Analyzer function SYNOPSIS @@ -438,8 +438,8 @@ typedef bool (Item::*Item_processor) (byte *arg); FALSE Don't do it */ -typedef bool (Item::*Item_analyzer) (byte **argp); -typedef Item* (Item::*Item_transformer) (byte *arg); +typedef bool (Item::*Item_analyzer) (uchar **argp); +typedef Item* (Item::*Item_transformer) (uchar *arg); typedef void (*Cond_traverser) (const Item *item, void *arg); @@ -448,9 +448,9 @@ class Item { void operator=(Item &); public: static void *operator new(size_t size) - { return (void*) sql_alloc((uint) size); } + { return sql_alloc(size); } static void *operator new(size_t size, MEM_ROOT *mem_root) - { return (void*) alloc_root(mem_root, (uint) size); } + { return alloc_root(mem_root, size); } static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); } static void operator delete(void *ptr, MEM_ROOT *mem_root) {} @@ -476,9 +476,9 @@ public: save_in_field */ String str_value; - my_string name; /* Name from select */ + char * name; /* Name from select */ /* Original item name (if it was renamed)*/ - my_string orig_name; + char * orig_name; Item *next; uint32 max_length; uint name_length; /* Length of name */ @@ -779,12 +779,12 @@ public: static CHARSET_INFO *default_charset(); virtual CHARSET_INFO *compare_collation() { return NULL; } - virtual bool walk(Item_processor processor, bool walk_subquery, byte *arg) + virtual bool walk(Item_processor processor, bool walk_subquery, uchar *arg) { return (this->*processor)(arg); } - virtual Item* transform(Item_transformer transformer, byte *arg); + virtual Item* transform(Item_transformer transformer, uchar *arg); /* This function performs a generic "compilation" of the Item tree. @@ -802,8 +802,8 @@ public: i.e. analysis is performed top-down while transformation is done bottom-up. */ - virtual Item* compile(Item_analyzer analyzer, byte **arg_p, - Item_transformer transformer, byte *arg_t) + virtual Item* compile(Item_analyzer analyzer, uchar **arg_p, + Item_transformer transformer, uchar *arg_t) { if ((this->*analyzer) (arg_p)) return ((this->*transformer) (arg_t)); @@ -816,15 +816,15 @@ public: (*traverser)(this, arg); } - virtual bool remove_dependence_processor(byte * arg) { return 0; } - virtual bool remove_fixed(byte * arg) { fixed= 0; return 0; } - virtual bool cleanup_processor(byte *arg); - virtual bool collect_item_field_processor(byte * arg) { return 0; } - virtual bool find_item_in_field_list_processor(byte *arg) { return 0; } - virtual bool change_context_processor(byte *context) { return 0; } - virtual bool reset_query_id_processor(byte *query_id_arg) { return 0; } - virtual bool is_expensive_processor(byte *arg) { return 0; } - virtual bool register_field_in_read_map(byte *arg) { return 0; } + virtual bool remove_dependence_processor(uchar * arg) { return 0; } + virtual bool remove_fixed(uchar * arg) { fixed= 0; return 0; } + virtual bool cleanup_processor(uchar *arg); + virtual bool collect_item_field_processor(uchar * arg) { return 0; } + virtual bool find_item_in_field_list_processor(uchar *arg) { return 0; } + virtual bool change_context_processor(uchar *context) { return 0; } + virtual bool reset_query_id_processor(uchar *query_id_arg) { return 0; } + virtual bool is_expensive_processor(uchar *arg) { return 0; } + virtual bool register_field_in_read_map(uchar *arg) { return 0; } /* Check if a partition function is allowed SYNOPSIS @@ -877,17 +877,17 @@ public: assumes that there are no multi-byte collations amongst the partition fields. */ - virtual bool check_partition_func_processor(byte *bool_arg) { return TRUE;} - virtual bool subst_argument_checker(byte **arg) + virtual bool check_partition_func_processor(uchar *bool_arg) { return TRUE;} + virtual bool subst_argument_checker(uchar **arg) { if (*arg) *arg= NULL; return TRUE; } - virtual Item *equal_fields_propagator(byte * arg) { return this; } - virtual bool set_no_const_sub(byte *arg) { return FALSE; } - virtual Item *replace_equal_field(byte * arg) { return this; } + virtual Item *equal_fields_propagator(uchar * arg) { return this; } + virtual bool set_no_const_sub(uchar *arg) { return FALSE; } + virtual Item *replace_equal_field(uchar * arg) { return this; } /* For SP local variable returns pointer to Item representing its @@ -916,7 +916,7 @@ public: virtual Item_field *filed_for_view_update() { return 0; } virtual Item *neg_transformer(THD *thd) { return NULL; } - virtual Item *update_value_transformer(byte *select_arg) { return this; } + virtual Item *update_value_transformer(uchar *select_arg) { return this; } virtual Item *safe_charset_converter(CHARSET_INFO *tocs); void delete_self() { @@ -1223,7 +1223,7 @@ public: Item_num() {} /* Remove gcc warning */ virtual Item_num *neg()= 0; Item *safe_charset_converter(CHARSET_INFO *tocs); - bool check_partition_func_processor(byte *int_arg) { return FALSE;} + bool check_partition_func_processor(uchar *int_arg) { return FALSE;} }; #define NO_CACHED_FIELD_INDEX ((uint)(-1)) @@ -1267,9 +1267,9 @@ public: Item_ident(THD *thd, Item_ident *item); const char *full_name() const; void cleanup(); - bool remove_dependence_processor(byte * arg); + bool remove_dependence_processor(uchar * arg); void print(String *str); - virtual bool change_context_processor(byte *cntx) + virtual bool change_context_processor(uchar *cntx) { context= (Name_resolution_context *)cntx; return FALSE; } friend bool insert_fields(THD *thd, Name_resolution_context *context, const char *db_name, @@ -1378,25 +1378,25 @@ public: bool is_null() { return field->is_null(); } void update_null_value(); Item *get_tmp_table_item(THD *thd); - bool collect_item_field_processor(byte * arg); - bool find_item_in_field_list_processor(byte *arg); - bool register_field_in_read_map(byte *arg); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool collect_item_field_processor(uchar * arg); + bool find_item_in_field_list_processor(uchar *arg); + bool register_field_in_read_map(uchar *arg); + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} void cleanup(); bool result_as_longlong() { return field->can_be_compared_as_longlong(); } Item_equal *find_item_equal(COND_EQUAL *cond_equal); - bool subst_argument_checker(byte **arg); - Item *equal_fields_propagator(byte *arg); - bool set_no_const_sub(byte *arg); - Item *replace_equal_field(byte *arg); + bool subst_argument_checker(uchar **arg); + Item *equal_fields_propagator(uchar *arg); + bool set_no_const_sub(uchar *arg); + Item *replace_equal_field(uchar *arg); inline uint32 max_disp_length() { return field->max_display_length(); } Item_field *filed_for_view_update() { return this; } Item *safe_charset_converter(CHARSET_INFO *tocs); int fix_outer_field(THD *thd, Field **field, Item **reference); - virtual Item *update_value_transformer(byte *select_arg); + virtual Item *update_value_transformer(uchar *select_arg); void print(String *str); friend class Item_default_value; friend class Item_insert_value; @@ -1432,7 +1432,7 @@ public: bool is_null() { return 1; } void print(String *str) { str->append(STRING_WITH_LEN("NULL")); } Item *safe_charset_converter(CHARSET_INFO *tocs); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_null_result :public Item_null @@ -1445,7 +1445,7 @@ public: { save_in_field(result_field, no_conversions); } - bool check_partition_func_processor(byte *int_arg) {return TRUE;} + bool check_partition_func_processor(uchar *int_arg) {return TRUE;} }; /* Item represents one placeholder ('?') of prepared statement */ @@ -1652,7 +1652,7 @@ public: Item_decimal(my_decimal *value_par); Item_decimal(longlong val, bool unsig); Item_decimal(double val, int precision, int scale); - Item_decimal(const char *bin, int precision, int scale); + Item_decimal(const uchar *bin, int precision, int scale); enum Type type() const { return DECIMAL_ITEM; } enum Item_result result_type () const { return DECIMAL_RESULT; } @@ -1739,7 +1739,7 @@ public: {} void print(String *str) { str->append(func_name); } Item *safe_charset_converter(CHARSET_INFO *tocs); - bool check_partition_func_processor(byte *int_arg) {return TRUE;} + bool check_partition_func_processor(uchar *int_arg) {return TRUE;} }; @@ -1821,7 +1821,7 @@ public: void print(String *str); // to prevent drop fixed flag (no need parent cleanup call) void cleanup() {} - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -1836,7 +1836,7 @@ public: {} Item *safe_charset_converter(CHARSET_INFO *tocs); void print(String *str) { str->append(func_name); } - bool check_partition_func_processor(byte *int_arg) {return TRUE;} + bool check_partition_func_processor(uchar *int_arg) {return TRUE;} }; @@ -1848,7 +1848,7 @@ public: CHARSET_INFO *cs= NULL): Item_string(name, length, cs) {} - bool check_partition_func_processor(byte *int_arg) {return TRUE;} + bool check_partition_func_processor(uchar *int_arg) {return TRUE;} }; @@ -1896,7 +1896,7 @@ public: unsigned_flag=1; } enum_field_types field_type() const { return int_field_type; } - bool check_partition_func_processor(byte *int_arg) {return TRUE;} + bool check_partition_func_processor(uchar *int_arg) {return TRUE;} }; @@ -1923,7 +1923,7 @@ public: void cleanup() {} bool eq(const Item *item, bool binary_cmp) const; virtual Item *safe_charset_converter(CHARSET_INFO *tocs); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -2043,7 +2043,7 @@ public: { return ref ? (*ref)->real_item() : this; } - bool walk(Item_processor processor, bool walk_subquery, byte *arg) + bool walk(Item_processor processor, bool walk_subquery, uchar *arg) { return (*ref)->walk(processor, walk_subquery, arg); } void print(String *str); bool result_as_longlong() @@ -2222,7 +2222,7 @@ public: } Item *clone_item(); virtual Item *real_item() { return ref; } - bool check_partition_func_processor(byte *int_arg) {return TRUE;} + bool check_partition_func_processor(uchar *int_arg) {return TRUE;} }; #ifdef MYSQL_SERVER @@ -2331,7 +2331,7 @@ public: class Cached_item_field :public Cached_item { - char *buff; + uchar *buff; Field *field; uint length; @@ -2339,7 +2339,7 @@ public: Cached_item_field(Item_field *item) { field= item->field; - buff= (char*) sql_calloc(length=field->pack_length()); + buff= (uchar*) sql_calloc(length=field->pack_length()); } bool cmp(void); }; @@ -2363,13 +2363,13 @@ public: int save_in_field(Field *field_arg, bool no_conversions); table_map used_tables() const { return (table_map)0L; } - bool walk(Item_processor processor, bool walk_subquery, byte *args) + bool walk(Item_processor processor, bool walk_subquery, uchar *args) { return arg->walk(processor, walk_subquery, args) || (this->*processor)(args); } - Item *transform(Item_transformer transformer, byte *args); + Item *transform(Item_transformer transformer, uchar *args); }; /* @@ -2403,7 +2403,7 @@ public: */ table_map used_tables() const { return RAND_TABLE_BIT; } - bool walk(Item_processor processor, bool walk_subquery, byte *args) + bool walk(Item_processor processor, bool walk_subquery, uchar *args) { return arg->walk(processor, walk_subquery, args) || (this->*processor)(args); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index ff7b991448c..2d61b6f1f9f 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -531,8 +531,8 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) which would be transformed to: WHERE col= 'j' */ - (*a)->walk(&Item::set_no_const_sub, FALSE, (byte*) 0); - (*b)->walk(&Item::set_no_const_sub, FALSE, (byte*) 0); + (*a)->walk(&Item::set_no_const_sub, FALSE, (uchar*) 0); + (*b)->walk(&Item::set_no_const_sub, FALSE, (uchar*) 0); } break; } @@ -2425,7 +2425,7 @@ bool Item_func_case::fix_fields(THD *thd, Item **ref) Item_func_case::val_int() -> Item_func_case::find_item() */ #ifndef EMBEDDED_LIBRARY - char buff[MAX_FIELD_WIDTH*2+sizeof(String)*2+sizeof(String*)*2+sizeof(double)*2+sizeof(longlong)*2]; + uchar buff[MAX_FIELD_WIDTH*2+sizeof(String)*2+sizeof(String*)*2+sizeof(double)*2+sizeof(longlong)*2]; #endif bool res= Item_func::fix_fields(thd, ref); /* @@ -2765,7 +2765,7 @@ static int cmp_decimal(void *cmp_arg, my_decimal *a, my_decimal *b) int in_vector::find(Item *item) { - byte *result=get_value(item); + uchar *result=get_value(item); if (!result || !used_count) return 0; // Null value @@ -2820,9 +2820,9 @@ void in_string::set(uint pos,Item *item) } -byte *in_string::get_value(Item *item) +uchar *in_string::get_value(Item *item) { - return (byte*) item->val_str(&tmp); + return (uchar*) item->val_str(&tmp); } in_row::in_row(uint elements, Item * item) @@ -2845,12 +2845,12 @@ in_row::~in_row() delete [] (cmp_item_row*) base; } -byte *in_row::get_value(Item *item) +uchar *in_row::get_value(Item *item) { tmp.store_value(item); if (item->is_null()) return 0; - return (byte *)&tmp; + return (uchar *)&tmp; } void in_row::set(uint pos, Item *item) @@ -2873,13 +2873,13 @@ void in_longlong::set(uint pos,Item *item) buff->unsigned_flag= item->unsigned_flag; } -byte *in_longlong::get_value(Item *item) +uchar *in_longlong::get_value(Item *item) { tmp.val= item->val_int(); if (item->null_value) return 0; tmp.unsigned_flag= item->unsigned_flag; - return (byte*) &tmp; + return (uchar*) &tmp; } in_double::in_double(uint elements) @@ -2891,12 +2891,12 @@ void in_double::set(uint pos,Item *item) ((double*) base)[pos]= item->val_real(); } -byte *in_double::get_value(Item *item) +uchar *in_double::get_value(Item *item) { tmp= item->val_real(); if (item->null_value) return 0; /* purecov: inspected */ - return (byte*) &tmp; + return (uchar*) &tmp; } @@ -2918,12 +2918,12 @@ void in_decimal::set(uint pos, Item *item) } -byte *in_decimal::get_value(Item *item) +uchar *in_decimal::get_value(Item *item) { my_decimal *result= item->val_decimal(&val); if (item->null_value) return 0; - return (byte *)result; + return (uchar *)result; } @@ -3434,7 +3434,7 @@ Item_cond::fix_fields(THD *thd, Item **ref) List_iterator<Item> li(list); Item *item; #ifndef EMBEDDED_LIBRARY - char buff[sizeof(char*)]; // Max local vars in function + uchar buff[sizeof(char*)]; // Max local vars in function #endif not_null_tables_cache= used_tables_cache= 0; const_item_cache= 1; @@ -3501,7 +3501,7 @@ Item_cond::fix_fields(THD *thd, Item **ref) return FALSE; } -bool Item_cond::walk(Item_processor processor, bool walk_subquery, byte *arg) +bool Item_cond::walk(Item_processor processor, bool walk_subquery, uchar *arg) { List_iterator_fast<Item> li(list); Item *item; @@ -3533,7 +3533,7 @@ bool Item_cond::walk(Item_processor processor, bool walk_subquery, byte *arg) Item returned as the result of transformation of the root node */ -Item *Item_cond::transform(Item_transformer transformer, byte *arg) +Item *Item_cond::transform(Item_transformer transformer, uchar *arg) { DBUG_ASSERT(!current_thd->is_stmt_prepare()); @@ -3584,8 +3584,8 @@ Item *Item_cond::transform(Item_transformer transformer, byte *arg) Item returned as the result of transformation of the root node */ -Item *Item_cond::compile(Item_analyzer analyzer, byte **arg_p, - Item_transformer transformer, byte *arg_t) +Item *Item_cond::compile(Item_analyzer analyzer, uchar **arg_p, + Item_transformer transformer, uchar *arg_t) { if (!(this->*analyzer)(arg_p)) return 0; @@ -3598,7 +3598,7 @@ Item *Item_cond::compile(Item_analyzer analyzer, byte **arg_p, The same parameter value of arg_p must be passed to analyze any argument of the condition formula. */ - byte *arg_v= *arg_p; + uchar *arg_v= *arg_p; Item *new_item= item->compile(analyzer, &arg_v, transformer, arg_t); if (new_item && new_item != item) li.replace(new_item); @@ -4832,7 +4832,7 @@ void Item_equal::fix_length_and_dec() item->collation.collation); } -bool Item_equal::walk(Item_processor processor, bool walk_subquery, byte *arg) +bool Item_equal::walk(Item_processor processor, bool walk_subquery, uchar *arg) { List_iterator_fast<Item_field> it(fields); Item *item; @@ -4844,7 +4844,7 @@ bool Item_equal::walk(Item_processor processor, bool walk_subquery, byte *arg) return Item_func::walk(processor, walk_subquery, arg); } -Item *Item_equal::transform(Item_transformer transformer, byte *arg) +Item *Item_equal::transform(Item_transformer transformer, uchar *arg) { DBUG_ASSERT(!current_thd->is_stmt_prepare()); diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 7aede7d2954..15ddab8b32e 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -355,8 +355,8 @@ public: } Item *neg_transformer(THD *thd); virtual Item *negated_item(); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} - bool subst_argument_checker(byte **arg) { return TRUE; } + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool subst_argument_checker(uchar **arg) { return TRUE; } }; class Item_func_not :public Item_bool_func @@ -367,7 +367,7 @@ public: enum Functype functype() const { return NOT_FUNC; } const char *func_name() const { return "not"; } Item *neg_transformer(THD *thd); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} void print(String *str); }; @@ -572,7 +572,7 @@ public: return this; } bool eq(const Item *item, bool binary_cmp) const; - bool subst_argument_checker(byte **arg) { return TRUE; } + bool subst_argument_checker(uchar **arg) { return TRUE; } }; @@ -598,7 +598,7 @@ public: bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } uint decimal_precision() const { return 1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -610,7 +610,7 @@ public: optimize_type select_optimize() const { return OPTIMIZE_NONE; } const char *func_name() const { return "strcmp"; } void print(String *str) { Item_func::print(str); } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -673,7 +673,7 @@ public: const char *func_name() const { return "ifnull"; } Field *tmp_table_field(TABLE *table); uint decimal_precision() const; - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -714,7 +714,7 @@ public: void print(String *str) { Item_func::print(str); } table_map not_null_tables() const { return 0; } bool is_null(); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; /* Functions to handle the optimized IN */ @@ -739,7 +739,7 @@ public: count(elements), used_count(elements) {} virtual ~in_vector() {} virtual void set(uint pos,Item *item)=0; - virtual byte *get_value(Item *item)=0; + virtual uchar *get_value(Item *item)=0; void sort() { qsort2(base,used_count,size,compare,collation); @@ -782,7 +782,7 @@ public: in_string(uint elements,qsort2_cmp cmp_func, CHARSET_INFO *cs); ~in_string(); void set(uint pos,Item *item); - byte *get_value(Item *item); + uchar *get_value(Item *item); Item* create_item() { return new Item_string(collation); @@ -811,7 +811,7 @@ class in_longlong :public in_vector public: in_longlong(uint elements); void set(uint pos,Item *item); - byte *get_value(Item *item); + uchar *get_value(Item *item); Item* create_item() { @@ -838,7 +838,7 @@ class in_double :public in_vector public: in_double(uint elements); void set(uint pos,Item *item); - byte *get_value(Item *item); + uchar *get_value(Item *item); Item *create_item() { return new Item_float(0.0); @@ -857,7 +857,7 @@ class in_decimal :public in_vector public: in_decimal(uint elements); void set(uint pos, Item *item); - byte *get_value(Item *item); + uchar *get_value(Item *item); Item *create_item() { return new Item_decimal(0, FALSE); @@ -1020,7 +1020,7 @@ public: in_row(uint elements, Item *); ~in_row(); void set(uint pos,Item *item); - byte *get_value(Item *item); + uchar *get_value(Item *item); Item_result result_type() { return ROW_RESULT; } }; @@ -1118,7 +1118,7 @@ public: void print(String *str); Item *find_item(String *str); CHARSET_INFO *compare_collation() { return cmp_collation.collation; } - bool check_partition_func_processor(byte *bool_arg) { return FALSE;} + bool check_partition_func_processor(uchar *bool_arg) { return FALSE;} void cleanup() { uint i; @@ -1199,7 +1199,7 @@ public: bool nulls_in_row(); bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; /* Functions used by where clause */ @@ -1242,7 +1242,7 @@ public: optimize_type select_optimize() const { return OPTIMIZE_NULL; } Item *neg_transformer(THD *thd); CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; /* Functions used by HAVING for rewriting IN subquery */ @@ -1269,7 +1269,7 @@ public: */ table_map used_tables() const { return used_tables_cache | RAND_TABLE_BIT; } - bool check_partition_func_processor(byte *int_arg) {return TRUE;} + bool check_partition_func_processor(uchar *int_arg) {return TRUE;} }; @@ -1292,7 +1292,7 @@ public: void print(String *str); CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } void top_level_item() { abort_on_null=1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -1331,7 +1331,7 @@ public: const char *func_name() const { return "like"; } bool fix_fields(THD *thd, Item **ref); void cleanup(); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; #ifdef USE_REGEX @@ -1354,7 +1354,7 @@ public: const char *func_name() const { return "regexp"; } void print(String *str) { print_op(str); } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; #else @@ -1407,14 +1407,14 @@ public: COND **conds); void top_level_item() { abort_on_null=1; } void copy_andor_arguments(THD *thd, Item_cond *item); - bool walk(Item_processor processor, bool walk_subquery, byte *arg); - Item *transform(Item_transformer transformer, byte *arg); + bool walk(Item_processor processor, bool walk_subquery, uchar *arg); + Item *transform(Item_transformer transformer, uchar *arg); void traverse_cond(Cond_traverser, void *arg, traverse_order order); void neg_arguments(THD *thd); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} - bool subst_argument_checker(byte **arg) { return TRUE; } - Item *compile(Item_analyzer analyzer, byte **arg_p, - Item_transformer transformer, byte *arg_t); + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool subst_argument_checker(uchar **arg) { return TRUE; } + Item *compile(Item_analyzer analyzer, uchar **arg_p, + Item_transformer transformer, uchar *arg_t); }; @@ -1523,8 +1523,8 @@ public: void fix_length_and_dec(); bool fix_fields(THD *thd, Item **ref); void update_used_tables(); - bool walk(Item_processor processor, bool walk_subquery, byte *arg); - Item *transform(Item_transformer transformer, byte *arg); + bool walk(Item_processor processor, bool walk_subquery, uchar *arg); + Item *transform(Item_transformer transformer, uchar *arg); void print(String *str); CHARSET_INFO *compare_collation() { return fields.head()->collation.collation; } diff --git a/sql/item_create.cc b/sql/item_create.cc index 8c97b596336..4687a3c647b 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -4908,12 +4908,13 @@ static Native_func_registry func_array[] = static HASH native_functions_hash; -extern "C" byte* -get_native_fct_hash_key(const byte *buff, uint *length, my_bool /* unused */) +extern "C" uchar* +get_native_fct_hash_key(const uchar *buff, size_t *length, + my_bool /* unused */) { Native_func_registry *func= (Native_func_registry*) buff; *length= func->name.length; - return (byte*) func->name.str; + return (uchar*) func->name.str; } /* @@ -4940,7 +4941,7 @@ int item_create_init() for (func= func_array; func->builder != NULL; func++) { - if (my_hash_insert(& native_functions_hash, (byte*) func)) + if (my_hash_insert(& native_functions_hash, (uchar*) func)) DBUG_RETURN(1); } @@ -4948,8 +4949,8 @@ int item_create_init() for (uint i=0 ; i < native_functions_hash.records ; i++) { func= (Native_func_registry*) hash_element(& native_functions_hash, i); - DBUG_PRINT("info", ("native function %s, length %d", - func->name.str, func->name.length)); + DBUG_PRINT("info", ("native function: %s length: %u", + func->name.str, (uint) func->name.length)); } #endif @@ -4977,7 +4978,7 @@ find_native_function_builder(THD *thd, LEX_STRING name) /* Thread safe */ func= (Native_func_registry*) hash_search(& native_functions_hash, - (byte*) name.str, + (uchar*) name.str, name.length); if (func) diff --git a/sql/item_func.cc b/sql/item_func.cc index ab57b047201..64c181fde71 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -143,7 +143,7 @@ Item_func::fix_fields(THD *thd, Item **ref) DBUG_ASSERT(fixed == 0); Item **arg,**arg_end; #ifndef EMBEDDED_LIBRARY // Avoid compiler warning - char buff[STACK_BUFF_ALLOC]; // Max argument in function + uchar buff[STACK_BUFF_ALLOC]; // Max argument in function #endif used_tables_cache= not_null_tables_cache= 0; @@ -196,7 +196,7 @@ Item_func::fix_fields(THD *thd, Item **ref) bool Item_func::walk(Item_processor processor, bool walk_subquery, - byte *argument) + uchar *argument) { if (arg_count) { @@ -259,7 +259,7 @@ void Item_func::traverse_cond(Cond_traverser traverser, Item returned as the result of transformation of the root node */ -Item *Item_func::transform(Item_transformer transformer, byte *argument) +Item *Item_func::transform(Item_transformer transformer, uchar *argument) { DBUG_ASSERT(!current_thd->is_stmt_prepare()); @@ -312,8 +312,8 @@ Item *Item_func::transform(Item_transformer transformer, byte *argument) Item returned as the result of transformation of the root node */ -Item *Item_func::compile(Item_analyzer analyzer, byte **arg_p, - Item_transformer transformer, byte *arg_t) +Item *Item_func::compile(Item_analyzer analyzer, uchar **arg_p, + Item_transformer transformer, uchar *arg_t) { if (!(this->*analyzer)(arg_p)) return 0; @@ -326,7 +326,7 @@ Item *Item_func::compile(Item_analyzer analyzer, byte **arg_p, The same parameter value of arg_p must be passed to analyze any argument of the condition formula. */ - byte *arg_v= *arg_p; + uchar *arg_v= *arg_p; Item *new_item= (*arg)->compile(analyzer, &arg_v, transformer, arg_t); if (new_item && *arg != new_item) current_thd->change_item_tree(arg, new_item); @@ -466,7 +466,7 @@ Field *Item_func::tmp_table_field(TABLE *table) } -bool Item_func::is_expensive_processor(byte *arg) +bool Item_func::is_expensive_processor(uchar *arg) { return is_expensive(); } @@ -2690,7 +2690,7 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func, uint arg_count, Item **arguments) { #ifndef EMBEDDED_LIBRARY // Avoid compiler warning - char buff[STACK_BUFF_ALLOC]; // Max argument in function + uchar buff[STACK_BUFF_ALLOC]; // Max argument in function #endif DBUG_ENTER("Item_udf_func::fix_fields"); @@ -3128,8 +3128,8 @@ static HASH hash_user_locks; class User_level_lock { - char *key; - uint key_length; + uchar *key; + size_t key_length; public: int count; @@ -3138,16 +3138,16 @@ public: my_thread_id thread_id; void set_thread(THD *thd) { thread_id= thd->thread_id; } - User_level_lock(const char *key_arg,uint length, ulong id) + User_level_lock(const uchar *key_arg,uint length, ulong id) :key_length(length),count(1),locked(1), thread_id(id) { - key=(char*) my_memdup((byte*) key_arg,length,MYF(0)); + key= (uchar*) my_memdup(key_arg,length,MYF(0)); pthread_cond_init(&cond,NULL); if (key) { - if (my_hash_insert(&hash_user_locks,(byte*) this)) + if (my_hash_insert(&hash_user_locks,(uchar*) this)) { - my_free((gptr) key,MYF(0)); + my_free(key,MYF(0)); key=0; } } @@ -3156,22 +3156,22 @@ public: { if (key) { - hash_delete(&hash_user_locks,(byte*) this); - my_free((gptr) key,MYF(0)); + hash_delete(&hash_user_locks,(uchar*) this); + my_free(key, MYF(0)); } pthread_cond_destroy(&cond); } inline bool initialized() { return key != 0; } friend void item_user_lock_release(User_level_lock *ull); - friend char *ull_get_key(const User_level_lock *ull, uint *length, - my_bool not_used); + friend uchar *ull_get_key(const User_level_lock *ull, size_t *length, + my_bool not_used); }; -char *ull_get_key(const User_level_lock *ull, uint *length, - my_bool not_used __attribute__((unused))) +uchar *ull_get_key(const User_level_lock *ull, size_t *length, + my_bool not_used __attribute__((unused))) { - *length=(uint) ull->key_length; - return (char*) ull->key; + *length= ull->key_length; + return ull->key; } @@ -3241,8 +3241,8 @@ void debug_sync_point(const char* lock_name, uint lock_timeout) THD* thd=current_thd; User_level_lock* ull; struct timespec abstime; - int lock_name_len; - lock_name_len=strlen(lock_name); + size_t lock_name_len; + lock_name_len= strlen(lock_name); pthread_mutex_lock(&LOCK_user_locks); if (thd->ull) @@ -3257,8 +3257,9 @@ void debug_sync_point(const char* lock_name, uint lock_timeout) this case, we will not be waiting, but rather, just waste CPU and memory on the whole deal */ - if (!(ull= ((User_level_lock*) hash_search(&hash_user_locks, lock_name, - lock_name_len)))) + if (!(ull= ((User_level_lock*) hash_search(&hash_user_locks, + (uchar*) lock_name, + lock_name_len)))) { pthread_mutex_unlock(&LOCK_user_locks); return; @@ -3353,10 +3354,11 @@ longlong Item_func_get_lock::val_int() } if (!(ull= ((User_level_lock *) hash_search(&hash_user_locks, - (byte*) res->ptr(), - res->length())))) + (uchar*) res->ptr(), + (size_t) res->length())))) { - ull=new User_level_lock(res->ptr(),res->length(), thd->thread_id); + ull= new User_level_lock((uchar*) res->ptr(), (size_t) res->length(), + thd->thread_id); if (!ull || !ull->initialized()) { delete ull; @@ -3446,8 +3448,8 @@ longlong Item_func_release_lock::val_int() result=0; pthread_mutex_lock(&LOCK_user_locks); if (!(ull= ((User_level_lock*) hash_search(&hash_user_locks, - (const byte*) res->ptr(), - res->length())))) + (const uchar*) res->ptr(), + (size_t) res->length())))) { null_value=1; } @@ -3592,7 +3594,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name, { user_var_entry *entry; - if (!(entry = (user_var_entry*) hash_search(hash, (byte*) name.str, + if (!(entry = (user_var_entry*) hash_search(hash, (uchar*) name.str, name.length)) && create_if_not_exists) { @@ -3622,7 +3624,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name, entry->used_query_id=current_thd->query_id; entry->type=STRING_RESULT; memcpy(entry->name.str, name.str, name.length+1); - if (my_hash_insert(hash,(byte*) entry)) + if (my_hash_insert(hash,(uchar*) entry)) { my_free((char*) entry,MYF(0)); return 0; @@ -4369,7 +4371,7 @@ int get_var_with_binlog(THD *thd, enum_sql_command sql_command, } /* Mark that this variable has been used by this query */ var_entry->used_query_id= thd->query_id; - if (insert_dynamic(&thd->user_var_events, (gptr) &user_var_event)) + if (insert_dynamic(&thd->user_var_events, (uchar*) &user_var_event)) goto err; *out_entry= var_entry; @@ -4438,7 +4440,7 @@ enum Item_result Item_func_get_user_var::result_type() const { user_var_entry *entry; if (!(entry = (user_var_entry*) hash_search(¤t_thd->user_vars, - (byte*) name.str, + (uchar*) name.str, name.length))) return STRING_RESULT; return entry->type; @@ -4876,7 +4878,7 @@ double Item_func_match::val_real() if ((null_value= (a == 0)) || !a->length()) DBUG_RETURN(0); DBUG_RETURN(ft_handler->please->find_relevance(ft_handler, - (byte *)a->ptr(), a->length())); + (uchar *)a->ptr(), a->length())); } DBUG_RETURN(ft_handler->please->find_relevance(ft_handler, table->record[0], 0)); @@ -4991,8 +4993,8 @@ longlong Item_func_is_free_lock::val_int() } pthread_mutex_lock(&LOCK_user_locks); - ull= (User_level_lock *) hash_search(&hash_user_locks, (byte*) res->ptr(), - res->length()); + ull= (User_level_lock *) hash_search(&hash_user_locks, (uchar*) res->ptr(), + (size_t) res->length()); pthread_mutex_unlock(&LOCK_user_locks); if (!ull || !ull->locked) return 1; @@ -5010,8 +5012,8 @@ longlong Item_func_is_used_lock::val_int() return 0; pthread_mutex_lock(&LOCK_user_locks); - ull= (User_level_lock *) hash_search(&hash_user_locks, (byte*) res->ptr(), - res->length()); + ull= (User_level_lock *) hash_search(&hash_user_locks, (uchar*) res->ptr(), + (size_t) res->length()); pthread_mutex_unlock(&LOCK_user_locks); if (!ull || !ull->locked) return 0; @@ -5109,14 +5111,13 @@ Item_func_sp::func_name() const @retval TRUE is returned on an error @retval FALSE is returned on success. */ + bool Item_func_sp::init_result_field(THD *thd) { - DBUG_ENTER("Item_func_sp::init_result_field"); - LEX_STRING empty_name= { C_STRING_WITH_LEN("") }; - TABLE_SHARE *share; + DBUG_ENTER("Item_func_sp::init_result_field"); DBUG_ASSERT(m_sp == NULL); DBUG_ASSERT(sp_result_field == NULL); @@ -5143,30 +5144,34 @@ Item_func_sp::init_result_field(THD *thd) share->table_cache_key = empty_name; share->table_name = empty_name; - if (!(sp_result_field= m_sp->create_result_field(max_length, name, dummy_table))) + if (!(sp_result_field= m_sp->create_result_field(max_length, name, + dummy_table))) { DBUG_RETURN(TRUE); } if (sp_result_field->pack_length() > sizeof(result_buf)) { - sp_result_field->move_field(sql_alloc(sp_result_field->pack_length())); - } else { - sp_result_field->move_field(result_buf); + void *tmp; + if (!(tmp= sql_alloc(sp_result_field->pack_length()))) + DBUG_RETURN(TRUE); + sp_result_field->move_field((uchar*) tmp); } + else + sp_result_field->move_field(result_buf); sp_result_field->null_ptr= (uchar *) &null_value; sp_result_field->null_bit= 1; - - DBUG_RETURN(FALSE); } + /** @brief Initialize local members with values from the Field interface. @note called from Item::fix_fields. */ + void Item_func_sp::fix_length_and_dec() { DBUG_ENTER("Item_func_sp::fix_length_and_dec"); @@ -5181,6 +5186,7 @@ void Item_func_sp::fix_length_and_dec() DBUG_VOID_RETURN; } + /** @brief Execute function & store value in field. @@ -5194,12 +5200,6 @@ Item_func_sp::execute() { THD *thd= current_thd; - /* - Get field in virtual tmp table to store result. Create the field if - invoked first time. - */ - - /* Execute function and store the return value in the field. */ if (execute_impl(thd)) @@ -5423,8 +5423,8 @@ ulonglong uuid_value; void uuid_short_init() { - uuid_value= (((ulonglong) server_id << 56) + - (ulonglong) server_start_time << 24); + uuid_value= ((((ulonglong) server_id) << 56) + + (((ulonglong) server_start_time) << 24)); } diff --git a/sql/item_func.h b/sql/item_func.h index 21dce696d61..8077f03d7ae 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -184,13 +184,13 @@ public: { return agg_item_charsets(c, func_name(), items, nitems, flags, item_sep); } - bool walk(Item_processor processor, bool walk_subquery, byte *arg); - Item *transform(Item_transformer transformer, byte *arg); - Item* compile(Item_analyzer analyzer, byte **arg_p, - Item_transformer transformer, byte *arg_t); + bool walk(Item_processor processor, bool walk_subquery, uchar *arg); + Item *transform(Item_transformer transformer, uchar *arg); + Item* compile(Item_analyzer analyzer, uchar **arg_p, + Item_transformer transformer, uchar *arg_t); void traverse_cond(Cond_traverser traverser, void * arg, traverse_order order); - bool is_expensive_processor(byte *arg); + bool is_expensive_processor(uchar *arg); virtual bool is_expensive() { return 0; } }; @@ -253,7 +253,7 @@ public: void fix_num_length_and_dec(); void find_num_type(); String *str_op(String *str) { DBUG_ASSERT(0); return 0; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -266,7 +266,7 @@ class Item_num_op :public Item_func_numhybrid void print(String *str) { print_op(str); } void find_num_type(); String *str_op(String *str) { DBUG_ASSERT(0); return 0; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -311,7 +311,7 @@ public: { max_length=args[0]->max_length; unsigned_flag=0; } void print(String *str); uint decimal_precision() const { return args[0]->decimal_precision(); } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -345,7 +345,7 @@ public: void fix_length_and_dec() {}; const char *func_name() const { return "decimal_typecast"; } void print(String *); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -414,7 +414,7 @@ public: const char *func_name() const { return "DIV"; } void fix_length_and_dec(); void print(String *str) { print_op(str); } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -488,7 +488,7 @@ public: Item_func_exp(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "exp"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -498,7 +498,7 @@ public: Item_func_ln(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "ln"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -509,7 +509,7 @@ public: Item_func_log(Item *a,Item *b) :Item_dec_func(a,b) {} double val_real(); const char *func_name() const { return "log"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -519,7 +519,7 @@ public: Item_func_log2(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "log2"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -529,7 +529,7 @@ public: Item_func_log10(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "log10"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -539,7 +539,7 @@ public: Item_func_sqrt(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "sqrt"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -549,7 +549,7 @@ public: Item_func_pow(Item *a,Item *b) :Item_dec_func(a,b) {} double val_real(); const char *func_name() const { return "pow"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -559,7 +559,7 @@ public: Item_func_acos(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "acos"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_asin :public Item_dec_func @@ -568,7 +568,7 @@ public: Item_func_asin(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "asin"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_atan :public Item_dec_func @@ -578,7 +578,7 @@ public: Item_func_atan(Item *a,Item *b) :Item_dec_func(a,b) {} double val_real(); const char *func_name() const { return "atan"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_cos :public Item_dec_func @@ -587,7 +587,7 @@ public: Item_func_cos(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "cos"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_sin :public Item_dec_func @@ -596,7 +596,7 @@ public: Item_func_sin(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "sin"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_tan :public Item_dec_func @@ -605,7 +605,7 @@ public: Item_func_tan(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "tan"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_integer :public Item_int_func @@ -684,7 +684,7 @@ public: Item_func_sign(Item *a) :Item_int_func(a) {} const char *func_name() const { return "sign"; } longlong val_int(); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -699,7 +699,7 @@ public: const char *func_name() const { return name; } void fix_length_and_dec() { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -717,7 +717,7 @@ public: my_decimal *val_decimal(my_decimal *); void fix_length_and_dec(); enum Item_result result_type () const { return cmp_type; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_min :public Item_func_min_max @@ -772,7 +772,7 @@ public: longlong val_int(); const char *func_name() const { return "length"; } void fix_length_and_dec() { max_length=10; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_bit_length :public Item_func_length @@ -792,7 +792,7 @@ public: longlong val_int(); const char *func_name() const { return "char_length"; } void fix_length_and_dec() { max_length=10; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_coercibility :public Item_int_func @@ -816,7 +816,7 @@ public: longlong val_int(); void fix_length_and_dec(); void print(String *str); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -841,7 +841,7 @@ public: longlong val_int(); const char *func_name() const { return "ascii"; } void fix_length_and_dec() { max_length=3; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_ord :public Item_int_func @@ -851,7 +851,7 @@ public: Item_func_ord(Item *a) :Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "ord"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_find_in_set :public Item_int_func @@ -865,7 +865,7 @@ public: longlong val_int(); const char *func_name() const { return "find_in_set"; } void fix_length_and_dec(); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; /* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */ @@ -877,7 +877,7 @@ public: Item_func_bit(Item *a) :Item_int_func(a) {} void fix_length_and_dec() { unsigned_flag= 1; } void print(String *str) { print_op(str); } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_bit_or :public Item_func_bit @@ -903,7 +903,7 @@ public: longlong val_int(); const char *func_name() const { return "bit_count"; } void fix_length_and_dec() { max_length=2; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_shift_left :public Item_func_bit @@ -1344,7 +1344,7 @@ public: longlong val_int(); const char *func_name() const { return "inet_aton"; } void fix_length_and_dec() { decimals= 0; max_length= 21; maybe_null= 1; unsigned_flag= 1;} - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -1457,7 +1457,7 @@ private: sp_name *m_name; mutable sp_head *m_sp; TABLE *dummy_table; - char result_buf[64]; + uchar result_buf[64]; /* The result field of the concrete stored function. */ @@ -1531,7 +1531,7 @@ public: return str; } - virtual bool change_context_processor(byte *cntx) + virtual bool change_context_processor(uchar *cntx) { context= (Name_resolution_context *)cntx; return FALSE; } bool sp_check_access(THD * thd); @@ -1563,6 +1563,6 @@ public: longlong val_int(); void fix_length_and_dec() { max_length= 21; unsigned_flag=1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; diff --git a/sql/item_row.cc b/sql/item_row.cc index 956556ca783..d1d1011ab2b 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -142,7 +142,7 @@ void Item_row::print(String *str) } -bool Item_row::walk(Item_processor processor, bool walk_subquery, byte *arg) +bool Item_row::walk(Item_processor processor, bool walk_subquery, uchar *arg) { for (uint i= 0; i < arg_count; i++) { @@ -153,7 +153,7 @@ bool Item_row::walk(Item_processor processor, bool walk_subquery, byte *arg) } -Item *Item_row::transform(Item_transformer transformer, byte *arg) +Item *Item_row::transform(Item_transformer transformer, uchar *arg) { DBUG_ASSERT(!current_thd->is_stmt_prepare()); diff --git a/sql/item_row.h b/sql/item_row.h index d55d3ae223f..dd7436888f0 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -67,8 +67,8 @@ public: void update_used_tables(); void print(String *str); - bool walk(Item_processor processor, bool walk_subquery, byte *arg); - Item *transform(Item_transformer transformer, byte *arg); + bool walk(Item_processor processor, bool walk_subquery, uchar *arg); + Item *transform(Item_transformer transformer, uchar *arg); uint cols() { return arg_count; } Item* element_index(uint i) { return items[i]; } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index a1fd79cbfb0..f9ca53a8355 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -28,6 +28,7 @@ #include "md5.h" #include "sha1.h" #include "my_aes.h" +#include <zlib.h> C_MODE_START #include "../mysys/my_static.h" // For soundex_map C_MODE_END @@ -2220,7 +2221,7 @@ String *Item_func_make_set::val_str(String *str) } -Item *Item_func_make_set::transform(Item_transformer transformer, byte *arg) +Item *Item_func_make_set::transform(Item_transformer transformer, uchar *arg) { DBUG_ASSERT(!current_thd->is_stmt_prepare()); @@ -2903,7 +2904,7 @@ String *Item_load_file::val_str(String *str) goto err; if ((file = my_open(file_name->c_ptr(), O_RDONLY, MYF(0))) < 0) goto err; - if (my_read(file, (byte*) tmp_value.ptr(), stat_info.st_size, MYF(MY_NABP))) + if (my_read(file, (uchar*) tmp_value.ptr(), stat_info.st_size, MYF(MY_NABP))) { my_close(file, MYF(0)); goto err; diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 60e7de42a9d..c036ec490db 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -50,7 +50,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "md5"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -94,7 +94,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "concat"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_concat_ws :public Item_str_func @@ -116,7 +116,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "reverse"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -148,13 +148,13 @@ class Item_str_conv :public Item_str_func { protected: uint multiply; - uint (*converter)(CHARSET_INFO *cs, char *src, uint srclen, - char *dst, uint dstlen); + size_t (*converter)(CHARSET_INFO *cs, char *src, size_t srclen, + char *dst, size_t dstlen); String tmp_value; public: Item_str_conv(Item *item) :Item_str_func(item) {} String *val_str(String *); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -455,7 +455,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "soundex"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -491,12 +491,12 @@ public: void update_used_tables(); const char *func_name() const { return "make_set"; } - bool walk(Item_processor processor, bool walk_subquery, byte *arg) + bool walk(Item_processor processor, bool walk_subquery, uchar *arg) { return item->walk(processor, walk_subquery, arg) || Item_str_func::walk(processor, walk_subquery, arg); } - Item *transform(Item_transformer transformer, byte *arg); + Item *transform(Item_transformer transformer, uchar *arg); void print(String *str); }; @@ -549,7 +549,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "rpad"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -562,7 +562,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "lpad"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -577,7 +577,7 @@ public: collation.set(default_charset()); max_length= 64; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -594,7 +594,7 @@ public: decimals=0; max_length=args[0]->max_length*2*collation.collation->mbmaxlen; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_unhex :public Item_str_func @@ -614,7 +614,7 @@ public: decimals=0; max_length=(1+args[0]->max_length)/2; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -638,7 +638,7 @@ public: } void print(String *str); const char *func_name() const { return "cast_as_binary"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -678,7 +678,7 @@ public: String* val_str(String* str); const char *func_name() const { return "inet_ntoa"; } void fix_length_and_dec() { decimals = 0; max_length=3*8+7; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_quote :public Item_str_func @@ -693,7 +693,7 @@ public: collation.set(args[0]->collation); max_length= args[0]->max_length * 2 + 2; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_conv_charset :public Item_str_func @@ -794,7 +794,7 @@ public: const char *func_name() const { return "crc32"; } void fix_length_and_dec() { max_length=10; } longlong val_int(); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_uncompressed_length : public Item_int_func diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 812d3c222c0..e15fba78009 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -149,7 +149,7 @@ bool Item_subselect::fix_fields(THD *thd_param, Item **ref) DBUG_ASSERT(fixed == 0); engine->set_thd((thd= thd_param)); - if (check_stack_overrun(thd, STACK_MIN_SIZE, (gptr)&res)) + if (check_stack_overrun(thd, STACK_MIN_SIZE, (uchar*)&res)) return TRUE; res= engine->prepare(); @@ -206,7 +206,7 @@ err: bool Item_subselect::walk(Item_processor processor, bool walk_subquery, - byte *argument) + uchar *argument) { if (walk_subquery) @@ -449,7 +449,7 @@ Item_singlerow_subselect::select_transformer(JOIN *join) 'upper' select is not really dependent => we remove this dependence */ substitution->walk(&Item::remove_dependence_processor, 0, - (byte *) select_lex->outer_select()); + (uchar *) select_lex->outer_select()); return RES_REDUCE; } return RES_OK; diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 7c21eac6ec3..51ab7b8ad42 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -125,7 +125,7 @@ public: */ virtual void reset_value_registration() {} enum_parsing_place place() { return parsing_place; } - bool walk(Item_processor processor, bool walk_subquery, byte *arg); + bool walk(Item_processor processor, bool walk_subquery, uchar *arg); /** Get the SELECT_LEX structure associated with this Item. diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 2eced347650..f8d2c1e1122 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -403,7 +403,7 @@ Item *Item_sum::get_tmp_table_item(THD *thd) bool Item_sum::walk (Item_processor processor, bool walk_subquery, - byte *argument) + uchar *argument) { if (arg_count) { @@ -1434,7 +1434,7 @@ my_decimal *Item_sum_variance::val_decimal(my_decimal *dec_buf) void Item_sum_variance::reset_field() { double nr; - char *res= result_field->ptr; + uchar *res= result_field->ptr; nr= args[0]->val_real(); /* sets null_value as side-effect */ @@ -1457,7 +1457,7 @@ void Item_sum_variance::reset_field() void Item_sum_variance::update_field() { ulonglong field_count; - char *res=result_field->ptr; + uchar *res=result_field->ptr; double nr= args[0]->val_real(); /* sets null_value as side-effect */ @@ -1821,7 +1821,7 @@ bool Item_sum_and::add() void Item_sum_num::reset_field() { double nr= args[0]->val_real(); - char *res=result_field->ptr; + uchar *res=result_field->ptr; if (maybe_null) { @@ -1943,7 +1943,7 @@ void Item_sum_sum::reset_field() void Item_sum_count::reset_field() { - char *res=result_field->ptr; + uchar *res=result_field->ptr; longlong nr=0; if (!args[0]->maybe_null || !args[0]->is_null()) @@ -1954,7 +1954,7 @@ void Item_sum_count::reset_field() void Item_sum_avg::reset_field() { - char *res=result_field->ptr; + uchar *res=result_field->ptr; if (hybrid_type == DECIMAL_RESULT) { longlong tmp; @@ -1995,7 +1995,7 @@ void Item_sum_bit::reset_field() void Item_sum_bit::update_field() { - char *res=result_field->ptr; + uchar *res=result_field->ptr; bits= uint8korr(res); add(); int8store(res, bits); @@ -2030,7 +2030,7 @@ void Item_sum_sum::update_field() else { double old_nr,nr; - char *res=result_field->ptr; + uchar *res=result_field->ptr; float8get(old_nr,res); nr= args[0]->val_real(); @@ -2047,7 +2047,7 @@ void Item_sum_sum::update_field() void Item_sum_count::update_field() { longlong nr; - char *res=result_field->ptr; + uchar *res=result_field->ptr; nr=sint8korr(res); if (!args[0]->maybe_null || !args[0]->is_null()) @@ -2059,7 +2059,7 @@ void Item_sum_count::update_field() void Item_sum_avg::update_field() { longlong field_count; - char *res=result_field->ptr; + uchar *res=result_field->ptr; if (hybrid_type == DECIMAL_RESULT) { my_decimal value, *arg_val= args[0]->val_decimal(&value); @@ -2228,7 +2228,7 @@ double Item_avg_field::val_real() // fix_fields() never calls for this Item double nr; longlong count; - char *res; + uchar *res; if (hybrid_type == DECIMAL_RESULT) return val_real_from_decimal(); @@ -2361,10 +2361,10 @@ double Item_variance_field::val_real() ** COUNT(DISTINCT ...) ****************************************************************************/ -int simple_str_key_cmp(void* arg, byte* key1, byte* key2) +int simple_str_key_cmp(void* arg, uchar* key1, uchar* key2) { Field *f= (Field*) arg; - return f->cmp((const char*)key1, (const char*)key2); + return f->cmp(key1, key2); } /* @@ -2374,7 +2374,7 @@ int simple_str_key_cmp(void* arg, byte* key1, byte* key2) static */ -int composite_key_cmp(void* arg, byte* key1, byte* key2) +int composite_key_cmp(void* arg, uchar* key1, uchar* key2) { Item_sum_count_distinct* item = (Item_sum_count_distinct*)arg; Field **field = item->table->field; @@ -2384,7 +2384,7 @@ int composite_key_cmp(void* arg, byte* key1, byte* key2) { Field* f = *field; int len = *lengths++; - int res = f->cmp((char *) key1, (char *) key2); + int res = f->cmp(key1, key2); if (res) return res; key1 += len; @@ -2839,8 +2839,8 @@ String *Item_sum_udf_str::val_str(String *str) GROUP_CONCAT(DISTINCT expr,...) */ -int group_concat_key_cmp_with_distinct(void* arg, byte* key1, - byte* key2) +int group_concat_key_cmp_with_distinct(void* arg, uchar* key1, + uchar* key2) { Item_func_group_concat* grp_item= (Item_func_group_concat*)arg; TABLE *table= grp_item->table; @@ -2865,7 +2865,7 @@ int group_concat_key_cmp_with_distinct(void* arg, byte* key1, int res; uint offset= (field->offset(field->table->record[0]) - table->s->null_bytes); - if ((res= field->cmp((char *) key1 + offset, (char *) key2 + offset))) + if ((res= field->cmp(key1 + offset, key2 + offset))) return res; } } @@ -2878,7 +2878,7 @@ int group_concat_key_cmp_with_distinct(void* arg, byte* key1, GROUP_CONCAT(expr,... ORDER BY col,... ) */ -int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2) +int group_concat_key_cmp_with_order(void* arg, uchar* key1, uchar* key2) { Item_func_group_concat* grp_item= (Item_func_group_concat*) arg; ORDER **order_item, **end; @@ -2904,7 +2904,7 @@ int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2) int res; uint offset= (field->offset(field->table->record[0]) - table->s->null_bytes); - if ((res= field->cmp((char *) key1 + offset, (char *) key2 + offset))) + if ((res= field->cmp(key1 + offset, key2 + offset))) return (*order_item)->asc ? res : -res; } } @@ -2927,8 +2927,8 @@ int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2) the duplicated values when inserting things sorted by ORDER BY */ -int group_concat_key_cmp_with_distinct_and_order(void* arg,byte* key1, - byte* key2) +int group_concat_key_cmp_with_distinct_and_order(void* arg,uchar* key1, + uchar* key2) { if (!group_concat_key_cmp_with_distinct(arg,key1,key2)) return 0; @@ -2940,7 +2940,7 @@ int group_concat_key_cmp_with_distinct_and_order(void* arg,byte* key1, Append data from current leaf to item->result */ -int dump_leaf_key(byte* key, element_count count __attribute__((unused)), +int dump_leaf_key(uchar* key, element_count count __attribute__((unused)), Item_func_group_concat *item) { TABLE *table= item->table; @@ -2974,7 +2974,7 @@ int dump_leaf_key(byte* key, element_count count __attribute__((unused)), uint offset= (field->offset(field->table->record[0]) - table->s->null_bytes); DBUG_ASSERT(offset < table->s->reclength); - res= field->val_str(&tmp, (char *) key + offset); + res= field->val_str(&tmp, key + offset); } else res= (*arg)->val_str(&tmp); diff --git a/sql/item_sum.h b/sql/item_sum.h index 5cf4f93af0e..84b425755d1 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -361,7 +361,7 @@ public: Item *get_tmp_table_item(THD *thd); virtual Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length); - bool walk(Item_processor processor, bool walk_subquery, byte *argument); + bool walk(Item_processor processor, bool walk_subquery, uchar *argument); bool init_sum_func_check(THD *thd); bool check_sum_func(THD *thd, Item **ref); bool register_sum_func(THD *thd, Item **ref); @@ -587,8 +587,8 @@ class Item_sum_count_distinct :public Item_sum_int bool always_null; // Set to 1 if the result is always NULL - friend int composite_key_cmp(void* arg, byte* key1, byte* key2); - friend int simple_str_key_cmp(void* arg, byte* key1, byte* key2); + friend int composite_key_cmp(void* arg, uchar* key1, uchar* key2); + friend int simple_str_key_cmp(void* arg, uchar* key1, uchar* key2); public: Item_sum_count_distinct(List<Item> &list) @@ -1183,14 +1183,14 @@ class Item_func_group_concat : public Item_sum */ Item_func_group_concat *original; - friend int group_concat_key_cmp_with_distinct(void* arg, byte* key1, - byte* key2); - friend int group_concat_key_cmp_with_order(void* arg, byte* key1, - byte* key2); + friend int group_concat_key_cmp_with_distinct(void* arg, uchar* key1, + uchar* key2); + friend int group_concat_key_cmp_with_order(void* arg, uchar* key1, + uchar* key2); friend int group_concat_key_cmp_with_distinct_and_order(void* arg, - byte* key1, - byte* key2); - friend int dump_leaf_key(byte* key, + uchar* key1, + uchar* key2); + friend int dump_leaf_key(uchar* key, element_count count __attribute__((unused)), Item_func_group_concat *group_concat_item); @@ -1243,6 +1243,6 @@ public: Item *copy_or_same(THD* thd); void no_rows_in_result() {} void print(String *str); - virtual bool change_context_processor(byte *cntx) + virtual bool change_context_processor(uchar *cntx) { context= (Name_resolution_context *)cntx; return FALSE; } }; diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 0fd57264784..3bc63eaf5f9 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -886,9 +886,9 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs, { i++; /* Change values[0...i-1] -> values[0...count-1] */ - bmove_upp((char*) (values+count), (char*) (values+i), + bmove_upp((uchar*) (values+count), (uchar*) (values+i), sizeof(*values)*i); - bzero((char*) values, sizeof(*values)*(count-i)); + bzero((uchar*) values, sizeof(*values)*(count-i)); break; } } @@ -1223,7 +1223,7 @@ bool get_interval_value(Item *args,interval_type int_type, ulonglong array[5]; longlong value; const char *str; - uint32 length; + size_t length; CHARSET_INFO *cs=str_value->charset(); LINT_INIT(value); @@ -1258,7 +1258,7 @@ bool get_interval_value(Item *args,interval_type int_type, interval->neg=1; str++; } - length=(uint32) (end-str); // Set up pointers to new str + length= (size_t) (end-str); // Set up pointers to new str } switch (int_type) { diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 992b79753ca..bd0954e6bdb 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -38,7 +38,7 @@ public: { max_length=6*MY_CHARSET_BIN_MB_MAXLEN; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -53,7 +53,7 @@ public: decimals=0; max_length=6*MY_CHARSET_BIN_MB_MAXLEN; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -70,7 +70,7 @@ public: maybe_null=1; } enum_monotonicity_info get_monotonicity_info() const; - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -86,7 +86,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -111,7 +111,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -144,7 +144,7 @@ public: max_length=3*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -160,7 +160,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -176,7 +176,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -192,7 +192,7 @@ public: max_length=1*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -208,7 +208,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -224,7 +224,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_yearweek :public Item_int_func @@ -239,7 +239,7 @@ public: max_length=6*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -256,7 +256,7 @@ public: max_length=4*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -286,7 +286,7 @@ public: max_length=1*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_dayname :public Item_func_weekday @@ -319,7 +319,7 @@ public: decimals=0; max_length=10*MY_CHARSET_BIN_MB_MAXLEN; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -334,7 +334,7 @@ public: decimals=0; max_length=10*MY_CHARSET_BIN_MB_MAXLEN; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -585,7 +585,7 @@ public: Item_func_from_days(Item *a) :Item_date(a) {} const char *func_name() const { return "from_days"; } bool get_date(MYSQL_TIME *res, uint fuzzy_date); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -603,7 +603,7 @@ public: void fix_length_and_dec(); uint format_length(const String *format); bool eq(const Item *item, bool binary_cmp) const; - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -617,7 +617,7 @@ class Item_func_from_unixtime :public Item_date_func const char *func_name() const { return "from_unixtime"; } void fix_length_and_dec(); bool get_date(MYSQL_TIME *res, uint fuzzy_date); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -676,7 +676,7 @@ public: } const char *func_name() const { return "sec_to_time"; } bool result_as_longlong() { return TRUE; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -698,7 +698,7 @@ public: bool get_date(MYSQL_TIME *res, uint fuzzy_date); bool eq(const Item *item, bool binary_cmp) const; void print(String *str); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -716,7 +716,7 @@ class Item_extract :public Item_int_func void fix_length_and_dec(); bool eq(const Item *item, bool binary_cmp) const; void print(String *str); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -753,7 +753,7 @@ public: max_length=args[0]->max_length; maybe_null= 1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -773,7 +773,7 @@ public: String *val_str(String *a); void fix_length_and_dec(); void print(String *str); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -884,7 +884,7 @@ public: max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; } longlong val_int(); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -907,7 +907,7 @@ public: } void print(String *str); const char *func_name() const { return "add_time"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} double val_real() { return val_real_from_decimal(); } my_decimal *val_decimal(my_decimal *decimal_value) { @@ -949,7 +949,7 @@ public: :Item_str_timefunc(a, b ,c) {} String *val_str(String *str); const char *func_name() const { return "maketime"; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; class Item_func_microsecond :public Item_int_func @@ -963,7 +963,7 @@ public: decimals=0; maybe_null=1; } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -981,7 +981,7 @@ public: maybe_null=1; } void print(String *str); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -1028,7 +1028,7 @@ public: { return tmp_table_field_from_field_type(table, 1); } - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index 26474990644..fb340e07cd5 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -2601,7 +2601,7 @@ static uint xml_parent_tag(MY_XML_NODE *items, uint nitems, uint level) RETURN Currently only MY_XML_OK */ -static int xml_enter(MY_XML_PARSER *st,const char *attr, uint len) +static int xml_enter(MY_XML_PARSER *st,const char *attr, size_t len) { MY_XML_USER_DATA *data= (MY_XML_USER_DATA*)st->user_data; MY_XML_NODE *nodes= (MY_XML_NODE*) data->pxml->ptr(); @@ -2632,7 +2632,7 @@ static int xml_enter(MY_XML_PARSER *st,const char *attr, uint len) RETURN Currently only MY_XML_OK */ -static int xml_value(MY_XML_PARSER *st,const char *attr, uint len) +static int xml_value(MY_XML_PARSER *st,const char *attr, size_t len) { MY_XML_USER_DATA *data= (MY_XML_USER_DATA*)st->user_data; MY_XML_NODE *nodes= (MY_XML_NODE*) data->pxml->ptr(); @@ -2662,7 +2662,7 @@ static int xml_value(MY_XML_PARSER *st,const char *attr, uint len) RETURN Currently only MY_XML_OK */ -static int xml_leave(MY_XML_PARSER *st,const char *attr, uint len) +static int xml_leave(MY_XML_PARSER *st,const char *attr, size_t len) { MY_XML_USER_DATA *data= (MY_XML_USER_DATA*)st->user_data; DBUG_ASSERT(data->level > 0); @@ -2712,7 +2712,7 @@ String *Item_xml_str_func::parse_xml(String *raw_xml, String *parsed_xml_buf) if ((rc= my_xml_parse(&p, raw_xml->ptr(), raw_xml->length())) != MY_XML_OK) { char buf[128]; - my_snprintf(buf, sizeof(buf)-1, "parse error at line %d pos %d: %s", + my_snprintf(buf, sizeof(buf)-1, "parse error at line %d pos %lu: %s", my_xml_error_lineno(&p) + 1, my_xml_error_pos(&p) + 1, my_xml_error_string(&p)); diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h index 9f2860ef403..650893fa7bd 100644 --- a/sql/item_xmlfunc.h +++ b/sql/item_xmlfunc.h @@ -41,7 +41,7 @@ public: Item_func_xml_extractvalue(Item *a,Item *b) :Item_xml_str_func(a,b) {} const char *func_name() const { return "extractvalue"; } String *val_str(String *); - bool check_partition_func_processor(byte *int_arg) {return FALSE;} + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; diff --git a/sql/key.cc b/sql/key.cc index 19861cee134..851b5251b50 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -45,7 +45,7 @@ key_length is set to length of key before (not including) field */ -int find_ref_key(KEY *key, uint key_count, byte *record, Field *field, +int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field, uint *key_length, uint *keypart) { reg2 int i; @@ -111,7 +111,8 @@ int find_ref_key(KEY *key, uint key_count, byte *record, Field *field, None */ -void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length) +void key_copy(uchar *to_key, uchar *from_record, KEY *key_info, + uint key_length) { uint length; KEY_PART_INFO *key_part; @@ -131,7 +132,7 @@ void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length) Field_bit *field= (Field_bit *) (key_part->field); if (field->bit_len) { - uchar bits= get_rec_bits((uchar*) from_record + + uchar bits= get_rec_bits(from_record + key_part->null_offset + (key_part->null_bit == 128), field->bit_ofs, field->bit_len); @@ -144,7 +145,7 @@ void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length) { key_length-= HA_KEY_BLOB_LENGTH; length= min(key_length, key_part->length); - key_part->field->get_key_image((char*) to_key, length, Field::itRAW); + key_part->field->get_key_image(to_key, length, Field::itRAW); to_key+= HA_KEY_BLOB_LENGTH; } else @@ -152,7 +153,7 @@ void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length) length= min(key_length, key_part->length); Field *field= key_part->field; CHARSET_INFO *cs= field->charset(); - uint bytes= field->get_key_image((char*) to_key, length, Field::itRAW); + uint bytes= field->get_key_image(to_key, length, Field::itRAW); if (bytes < length) cs->cset->fill(cs, (char*) to_key + bytes, length - bytes, ' '); } @@ -180,7 +181,7 @@ void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length) None */ -void key_restore(byte *to_record, byte *from_key, KEY *key_info, +void key_restore(uchar *to_record, uchar *from_key, KEY *key_info, uint key_length) { uint length; @@ -218,7 +219,7 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info, from_key+= HA_KEY_BLOB_LENGTH; key_length-= HA_KEY_BLOB_LENGTH; ((Field_blob*) key_part->field)->set_ptr((ulong) blob_length, - (char*) from_key); + from_key); length= key_part->length; } else if (key_part->key_part_flag & HA_VAR_LENGTH_PART) @@ -228,7 +229,7 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info, length= min(key_length, key_part->length); old_map= dbug_tmp_use_all_columns(key_part->field->table, key_part->field->table->write_set); - key_part->field->set_key_image((char *) from_key, length); + key_part->field->set_key_image(from_key, length); dbug_tmp_restore_column_map(key_part->field->table->write_set, old_map); from_key+= HA_KEY_BLOB_LENGTH; } @@ -264,11 +265,11 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info, 1 Key has changed */ -bool key_cmp_if_same(TABLE *table,const byte *key,uint idx,uint key_length) +bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length) { uint store_length; KEY_PART_INFO *key_part; - const byte *key_end= key + key_length;; + const uchar *key_end= key + key_length;; for (key_part=table->key_info[idx].key_part; key < key_end ; @@ -300,7 +301,7 @@ bool key_cmp_if_same(TABLE *table,const byte *key,uint idx,uint key_length) { CHARSET_INFO *cs= key_part->field->charset(); uint char_length= key_part->length / cs->mbmaxlen; - const byte *pos= table->record[0] + key_part->offset; + const uchar *pos= table->record[0] + key_part->offset; if (length > char_length) { char_length= my_charpos(cs, pos, pos + length, char_length); @@ -424,11 +425,11 @@ bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields) 1 Key is larger than range */ -int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length) +int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length) { uint store_length; - for (const byte *end=key + key_length; + for (const uchar *end=key + key_length; key < end; key+= store_length, key_part++) { @@ -451,7 +452,7 @@ int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length) key++; // Skip null byte store_length--; } - if ((cmp=key_part->field->key_cmp((byte*) key, key_part->length)) < 0) + if ((cmp=key_part->field->key_cmp(key, key_part->length)) < 0) return -1; if (cmp > 0) return 1; @@ -484,13 +485,13 @@ int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length) and return the result of the comparison. */ -int key_rec_cmp(void *key, byte *first_rec, byte *second_rec) +int key_rec_cmp(void *key, uchar *first_rec, uchar *second_rec) { KEY *key_info= (KEY*)key; uint key_parts= key_info->key_parts, i= 0; KEY_PART_INFO *key_part= key_info->key_part; - char *rec0= key_part->field->ptr - key_part->offset; - my_ptrdiff_t first_diff= first_rec - (byte*)rec0, sec_diff= second_rec - (byte*)rec0; + uchar *rec0= key_part->field->ptr - key_part->offset; + my_ptrdiff_t first_diff= first_rec - rec0, sec_diff= second_rec - rec0; int result= 0; DBUG_ENTER("key_rec_cmp"); diff --git a/sql/lock.cc b/sql/lock.cc index 4427e57a938..eeb895a3c8e 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -137,7 +137,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, { /* Clear the lock type of all lock data to avoid reusage. */ reset_lock_data(sql_lock); - my_free((gptr) sql_lock,MYF(0)); + my_free((uchar*) sql_lock,MYF(0)); sql_lock=0; break; } @@ -145,7 +145,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, { /* Clear the lock type of all lock data to avoid reusage. */ reset_lock_data(sql_lock); - my_free((gptr) sql_lock,MYF(0)); + my_free((uchar*) sql_lock,MYF(0)); goto retry; } } @@ -161,7 +161,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, We do not wait for READ_ONLY=0, and fail. */ reset_lock_data(sql_lock); - my_free((gptr) sql_lock, MYF(0)); + my_free((uchar*) sql_lock, MYF(0)); sql_lock=0; my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only"); break; @@ -173,7 +173,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, { /* Clear the lock type of all lock data to avoid reusage. */ reset_lock_data(sql_lock); - my_free((gptr) sql_lock,MYF(0)); + my_free((uchar*) sql_lock,MYF(0)); sql_lock=0; break; } @@ -191,7 +191,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, if (rc > 1) /* a timeout or a deadlock */ { my_error(rc, MYF(0)); - my_free((gptr) sql_lock,MYF(0)); + my_free((uchar*) sql_lock,MYF(0)); sql_lock= 0; break; } @@ -285,7 +285,7 @@ void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock) thr_multi_unlock(sql_lock->locks,sql_lock->lock_count); if (sql_lock->table_count) VOID(unlock_external(thd,sql_lock->table,sql_lock->table_count)); - my_free((gptr) sql_lock,MYF(0)); + my_free((uchar*) sql_lock,MYF(0)); DBUG_VOID_RETURN; } @@ -435,7 +435,7 @@ void mysql_lock_downgrade_write(THD *thd, TABLE *table, { for (uint i=0; i < locked->lock_count; i++) thr_downgrade_write_lock(locked->locks[i], new_lock_type); - my_free((gptr) locked,MYF(0)); + my_free((uchar*) locked,MYF(0)); } } @@ -453,7 +453,7 @@ void mysql_lock_abort(THD *thd, TABLE *table, bool upgrade_lock) { for (uint i=0; i < locked->lock_count; i++) thr_abort_locks(locked->locks[i]->lock, upgrade_lock); - my_free((gptr) locked,MYF(0)); + my_free((uchar*) locked,MYF(0)); } DBUG_VOID_RETURN; } @@ -488,7 +488,7 @@ bool mysql_lock_abort_for_thread(THD *thd, TABLE *table) table->in_use->thread_id)) result= TRUE; } - my_free((gptr) locked,MYF(0)); + my_free((uchar*) locked,MYF(0)); } DBUG_RETURN(result); } @@ -530,8 +530,8 @@ MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b) } /* Delete old, not needed locks */ - my_free((gptr) a,MYF(0)); - my_free((gptr) b,MYF(0)); + my_free((uchar*) a,MYF(0)); + my_free((uchar*) b,MYF(0)); DBUG_RETURN(sql_lock); } @@ -749,7 +749,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, /* Clear the lock type of the lock data that are stored already. */ sql_lock->lock_count= locks - sql_lock->locks; reset_lock_data(sql_lock); - my_free((gptr) sql_lock,MYF(0)); + my_free((uchar*) sql_lock,MYF(0)); DBUG_RETURN(0); } } @@ -906,10 +906,10 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use) if (check_in_use) { /* Only insert the table if we haven't insert it already */ - for (table=(TABLE*) hash_first(&open_cache, (byte*)key, + for (table=(TABLE*) hash_first(&open_cache, (uchar*)key, key_length, &state); table ; - table = (TABLE*) hash_next(&open_cache,(byte*) key, + table = (TABLE*) hash_next(&open_cache,(uchar*) key, key_length, &state)) { if (table->in_use == thd) @@ -927,10 +927,10 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use) table cache */ if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), - &table, sizeof(*table), - &share, sizeof(*share), - &key_buff, key_length, - NULL)) + &table, (uint) sizeof(*table), + &share, (uint) sizeof(*share), + &key_buff, (uint) key_length, + NullS)) DBUG_RETURN(-1); table->s= share; share->set_table_cache_key(key_buff, key, key_length); @@ -939,9 +939,9 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use) table->locked_by_name=1; table_list->table=table; - if (my_hash_insert(&open_cache, (byte*) table)) + if (my_hash_insert(&open_cache, (uchar*) table)) { - my_free((gptr) table,MYF(0)); + my_free((uchar*) table,MYF(0)); DBUG_RETURN(-1); } @@ -955,7 +955,7 @@ void unlock_table_name(THD *thd, TABLE_LIST *table_list) { if (table_list->table) { - hash_delete(&open_cache, (byte*) table_list->table); + hash_delete(&open_cache, (uchar*) table_list->table); broadcast_refresh(); } } diff --git a/sql/log.cc b/sql/log.cc index 94c744f3f93..d7252b56d22 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1435,7 +1435,7 @@ static int binlog_close_connection(handlerton *hton, THD *thd) DBUG_ASSERT(mysql_bin_log.is_open() && trx_data->empty()); thd->ha_data[binlog_hton->slot]= 0; trx_data->~binlog_trx_data(); - my_free((gptr)trx_data, MYF(0)); + my_free((uchar*)trx_data, MYF(0)); return 0; } @@ -1670,7 +1670,7 @@ int check_binlog_magic(IO_CACHE* log, const char** errmsg) char magic[4]; DBUG_ASSERT(my_b_tell(log) == 0); - if (my_b_read(log, (byte*) magic, sizeof(magic))) + if (my_b_read(log, (uchar*) magic, sizeof(magic))) { *errmsg = "I/O error reading the header from the binary log"; sql_print_error("%s, errno=%d, io cache code=%d", *errmsg, my_errno, @@ -1772,15 +1772,16 @@ static int find_uniq_filename(char *name) struct st_my_dir *dir_info; reg1 struct fileinfo *file_info; ulong max_found=0; - + size_t buf_length, length; + char *start, *end; DBUG_ENTER("find_uniq_filename"); - uint length = dirname_part(buff,name); - char *start = name + length; - char *end = strend(start); + length= dirname_part(buff, name, &buf_length); + start= name + length; + end= strend(start); *end='.'; - length= (uint) (end-start+1); + length= (size_t) (end-start+1); if (!(dir_info = my_dir(buff,MYF(MY_DONT_SORT)))) { // This shouldn't happen @@ -1790,7 +1791,7 @@ static int find_uniq_filename(char *name) file_info= dir_info->dir_entry; for (i=dir_info->number_off_files ; i-- ; file_info++) { - if (bcmp(file_info->name,start,length) == 0 && + if (bcmp((uchar*) file_info->name, (uchar*) start, length) == 0 && test_if_number(file_info->name+length, &number,0)) { set_if_bigger(max_found,(ulong) number); @@ -1894,7 +1895,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg, ); end= strnmov(buff + len, "Time Id Command Argument\n", sizeof(buff) - len); - if (my_b_write(&log_file, (byte*) buff, (uint) (end-buff)) || + if (my_b_write(&log_file, (uchar*) buff, (uint) (end-buff)) || flush_io_cache(&log_file)) goto err; } @@ -2102,30 +2103,30 @@ bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host, start.tm_mday, start.tm_hour, start.tm_min, start.tm_sec); - if (my_b_write(&log_file, (byte*) &time_buff, time_buff_len)) + if (my_b_write(&log_file, (uchar*) &time_buff, time_buff_len)) goto err; } else - if (my_b_write(&log_file, (byte*) "\t\t" ,2) < 0) + if (my_b_write(&log_file, (uchar*) "\t\t" ,2) < 0) goto err; /* command_type, thread_id */ length= my_snprintf(buff, 32, "%5ld ", (long) thread_id); - if (my_b_write(&log_file, (byte*) buff, length)) + if (my_b_write(&log_file, (uchar*) buff, length)) goto err; - if (my_b_write(&log_file, (byte*) command_type, command_type_len)) + if (my_b_write(&log_file, (uchar*) command_type, command_type_len)) goto err; - if (my_b_write(&log_file, (byte*) "\t", 1)) + if (my_b_write(&log_file, (uchar*) "\t", 1)) goto err; /* sql_text */ - if (my_b_write(&log_file, (byte*) sql_text, sql_text_len)) + if (my_b_write(&log_file, (uchar*) sql_text, sql_text_len)) goto err; - if (my_b_write(&log_file, (byte*) "\n", 1) || + if (my_b_write(&log_file, (uchar*) "\n", 1) || flush_io_cache(&log_file)) goto err; } @@ -2205,7 +2206,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, start.tm_min, start.tm_sec); /* Note that my_b_write() assumes it knows the length for this */ - if (my_b_write(&log_file, (byte*) buff, buff_len)) + if (my_b_write(&log_file, (uchar*) buff, buff_len)) tmp_errno= errno; } if (my_b_printf(&log_file, "# User@Host: ", sizeof("# User@Host: ") - 1) @@ -2213,7 +2214,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, tmp_errno= errno; if (my_b_printf(&log_file, user_host, user_host_len) != user_host_len) tmp_errno= errno; - if (my_b_write(&log_file, (byte*) "\n", 1)) + if (my_b_write(&log_file, (uchar*) "\n", 1)) tmp_errno= errno; } /* For slow query log */ @@ -2261,18 +2262,18 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, { *end++=';'; *end='\n'; - if (my_b_write(&log_file, (byte*) "SET ", 4) || - my_b_write(&log_file, (byte*) buff + 1, (uint) (end-buff))) + if (my_b_write(&log_file, (uchar*) "SET ", 4) || + my_b_write(&log_file, (uchar*) buff + 1, (uint) (end-buff))) tmp_errno= errno; } if (is_command) { end= strxmov(buff, "# administrator command: ", NullS); buff_len= (ulong) (end - buff); - my_b_write(&log_file, (byte*) buff, buff_len); + my_b_write(&log_file, (uchar*) buff, buff_len); } - if (my_b_write(&log_file, (byte*) sql_text, sql_text_len) || - my_b_write(&log_file, (byte*) ";\n",2) || + if (my_b_write(&log_file, (uchar*) sql_text, sql_text_len) || + my_b_write(&log_file, (uchar*) ";\n",2) || flush_io_cache(&log_file)) tmp_errno= errno; if (tmp_errno) @@ -2456,7 +2457,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name, an extension for the binary log files. In this case we write a standard header to it. */ - if (my_b_safe_write(&log_file, (byte*) BINLOG_MAGIC, + if (my_b_safe_write(&log_file, (uchar*) BINLOG_MAGIC, BIN_LOG_HEADER_SIZE)) goto err; bytes_written+= BIN_LOG_HEADER_SIZE; @@ -2528,9 +2529,9 @@ bool MYSQL_BIN_LOG::open(const char *log_name, As this is a new log file, we write the file name to the index file. As every time we write to the index file, we sync it. */ - if (my_b_write(&index_file, (byte*) log_file_name, + if (my_b_write(&index_file, (uchar*) log_file_name, strlen(log_file_name)) || - my_b_write(&index_file, (byte*) "\n", 1) || + my_b_write(&index_file, (uchar*) "\n", 1) || flush_io_cache(&index_file) || my_sync(index_file.file, MYF(MY_WME))) goto err; @@ -2598,7 +2599,7 @@ static bool copy_up_file_and_fill(IO_CACHE *index_file, my_off_t offset) int bytes_read; my_off_t init_offset= offset; File file= index_file->file; - byte io_buf[IO_SIZE*2]; + uchar io_buf[IO_SIZE*2]; DBUG_ENTER("copy_up_file_and_fill"); for (;; offset+= bytes_read) @@ -2610,7 +2611,7 @@ static bool copy_up_file_and_fill(IO_CACHE *index_file, my_off_t offset) if (!bytes_read) break; // end of file (void) my_seek(file, offset-init_offset, MY_SEEK_SET, MYF(0)); - if (my_write(file, (byte*) io_buf, bytes_read, MYF(MY_WME | MY_NABP))) + if (my_write(file, io_buf, bytes_read, MYF(MY_WME | MY_NABP))) goto err; } /* The following will either truncate the file or fill the end with \n' */ @@ -2822,7 +2823,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd) need_start_event=1; if (!open_index_file(index_file_name, 0)) open(save_name, log_type, 0, io_cache_type, no_auto_events, max_size, 0); - my_free((gptr) save_name, MYF(0)); + my_free((uchar*) save_name, MYF(0)); err: VOID(pthread_mutex_unlock(&LOCK_thread_count)); @@ -3324,7 +3325,7 @@ bool MYSQL_BIN_LOG::appendv(const char* buf, uint len,...) safe_mutex_assert_owner(&LOCK_log); do { - if (my_b_append(&log_file,(byte*) buf,len)) + if (my_b_append(&log_file,(uchar*) buf,len)) { error= 1; goto err; @@ -3398,7 +3399,7 @@ int THD::binlog_setup_trx_data() open_cached_file(&trx_data->trans_log, mysql_tmpdir, LOG_PREFIX, binlog_cache_size, MYF(MY_WME))) { - my_free((gptr)trx_data, MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*)trx_data, MYF(MY_ALLOW_ZERO_PTR)); ha_data[binlog_hton->slot]= 0; DBUG_RETURN(1); // Didn't manage to set it up } @@ -3804,7 +3805,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info) for (uint i= 0; i < thd->user_var_events.elements; i++) { BINLOG_USER_VAR_EVENT *user_var_event; - get_dynamic(&thd->user_var_events,(gptr) &user_var_event, i); + get_dynamic(&thd->user_var_events,(uchar*) &user_var_event, i); User_var_log_event e(thd, user_var_event->user_var_event->name.str, user_var_event->user_var_event->name.length, user_var_event->value, @@ -4131,8 +4132,16 @@ void MYSQL_BIN_LOG::close(uint exiting) if (log_file.type == WRITE_CACHE && log_type == LOG_BIN) { my_off_t offset= BIN_LOG_HEADER_SIZE + FLAGS_OFFSET; - byte flags=0; // clearing LOG_EVENT_BINLOG_IN_USE_F + my_off_t org_position= my_tell(log_file.file, MYF(0)); + uchar flags= 0; // clearing LOG_EVENT_BINLOG_IN_USE_F my_pwrite(log_file.file, &flags, 1, offset, MYF(0)); + /* + Restore position so that anything we have in the IO_cache is written + to the correct position. + We need the seek here, as my_pwrite() is not guaranteed to keep the + original position on system that doesn't support pwrite(). + */ + my_seek(log_file.file, org_position, MY_SEEK_SET, MYF(0)); } /* this will cleanup IO_CACHE, sync and close the file */ @@ -4256,17 +4265,21 @@ bool flush_error_log() (void) my_delete(err_temp, MYF(0)); if (freopen(err_temp,"a+",stdout)) { + int fd; + size_t bytes; + uchar buf[IO_SIZE]; + freopen(err_temp,"a+",stderr); (void) my_delete(err_renamed, MYF(0)); my_rename(log_error_file,err_renamed,MYF(0)); if (freopen(log_error_file,"a+",stdout)) freopen(log_error_file,"a+",stderr); - int fd, bytes; - char buf[IO_SIZE]; + if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0) { - while ((bytes = (int) my_read(fd, (byte*) buf, IO_SIZE, MYF(0))) > 0) - my_fwrite(stderr, (byte*) buf, bytes, MYF(0)); + while ((bytes= my_read(fd, buf, IO_SIZE, MYF(0))) && + bytes != MY_FILE_ERROR) + my_fwrite(stderr, buf, bytes, MYF(0)); my_close(fd, MYF(0)); } (void) my_delete(err_temp, MYF(0)); @@ -4840,9 +4853,9 @@ void TC_LOG_MMAP::close() pthread_cond_destroy(&pages[i].cond); } case 3: - my_free((gptr)pages, MYF(0)); + my_free((uchar*)pages, MYF(0)); case 2: - my_munmap((byte*)data, (size_t)file_length); + my_munmap((uchar*)data, (size_t)file_length); case 1: my_close(fd, MYF(0)); } @@ -4876,13 +4889,13 @@ int TC_LOG_MMAP::recover() } if (hash_init(&xids, &my_charset_bin, tc_log_page_size/3, 0, - sizeof(my_xid), 0, 0, MYF(0))) + sizeof(my_xid), 0, 0, MYF(0))) goto err1; for ( ; p < end_p ; p++) { for (my_xid *x=p->start; x < p->end; x++) - if (*x && my_hash_insert(&xids, (byte *)x)) + if (*x && my_hash_insert(&xids, (uchar *)x)) goto err2; // OOM } @@ -5075,7 +5088,7 @@ int TC_LOG_BINLOG::recover(IO_CACHE *log, Format_description_log_event *fdle) if (! fdle->is_valid() || hash_init(&xids, &my_charset_bin, TC_LOG_PAGE_SIZE/3, 0, - sizeof(my_xid), 0, 0, MYF(0))) + sizeof(my_xid), 0, 0, MYF(0))) goto err1; init_alloc_root(&mem_root, TC_LOG_PAGE_SIZE, TC_LOG_PAGE_SIZE); @@ -5087,8 +5100,8 @@ int TC_LOG_BINLOG::recover(IO_CACHE *log, Format_description_log_event *fdle) if (ev->get_type_code() == XID_EVENT) { Xid_log_event *xev=(Xid_log_event *)ev; - byte *x=(byte *)memdup_root(&mem_root, (char *)& xev->xid, - sizeof(xev->xid)); + uchar *x= (uchar *) memdup_root(&mem_root, (uchar*) &xev->xid, + sizeof(xev->xid)); if (! x) goto err2; my_hash_insert(&xids, x); diff --git a/sql/log_event.cc b/sql/log_event.cc index 4087893060a..bde19f38df1 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -299,10 +299,10 @@ static void cleanup_load_tmpdir() static bool write_str(IO_CACHE *file, char *str, uint length) { - byte tmp[1]; - tmp[0]= (byte) length; + uchar tmp[1]; + tmp[0]= (uchar) length; return (my_b_safe_write(file, tmp, sizeof(tmp)) || - my_b_safe_write(file, (byte*) str, length)); + my_b_safe_write(file, (uchar*) str, length)); } @@ -310,8 +310,8 @@ static bool write_str(IO_CACHE *file, char *str, uint length) read_str() */ -static inline int read_str(const char **buf, const char *buf_end, const char **str, - uint8 *len) +static inline int read_str(const char **buf, const char *buf_end, + const char **str, uint8 *len) { if (*buf + ((uint) (uchar) **buf) >= buf_end) return 1; @@ -637,7 +637,7 @@ void Log_event::init_show_field_list(List<Item>* field_list) bool Log_event::write_header(IO_CACHE* file, ulong event_data_length) { - byte header[LOG_EVENT_HEADER_LEN]; + uchar header[LOG_EVENT_HEADER_LEN]; DBUG_ENTER("Log_event::write_header"); /* Store number of bytes that will be written by this event */ @@ -724,7 +724,7 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet, if (log_lock) pthread_mutex_lock(log_lock); - if (my_b_read(file, (byte*) buf, sizeof(buf))) + if (my_b_read(file, (uchar*) buf, sizeof(buf))) { /* If the read hits eof, we must report it as eof so the caller @@ -825,7 +825,7 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, LOCK_MUTEX; DBUG_PRINT("info", ("my_b_tell: %lu", (ulong) my_b_tell(file))); - if (my_b_read(file, (byte *) head, header_size)) + if (my_b_read(file, (uchar *) head, header_size)) { DBUG_PRINT("info", ("Log_event::read_log_event(IO_CACHE*,Format_desc*) \ failed my_b_read")); @@ -859,14 +859,14 @@ failed my_b_read")); } // some events use the extra byte to null-terminate strings - if (!(buf = my_malloc(data_len+1, MYF(MY_WME)))) + if (!(buf = (char*) my_malloc(data_len+1, MYF(MY_WME)))) { error = "Out of memory"; goto err; } buf[data_len] = 0; memcpy(buf, head, header_size); - if (my_b_read(file, (byte*) buf + header_size, data_len - header_size)) + if (my_b_read(file, (uchar*) buf + header_size, data_len - header_size)) { error = "read error"; goto err; @@ -1092,8 +1092,8 @@ void Log_event::print_header(IO_CACHE* file, ptr[7], ptr[8], ptr[9], ptr[10], ptr[11], ptr[12], ptr[13], ptr[14], ptr[15], ptr[16], ptr[17], ptr[18]); DBUG_ASSERT(bytes_written >= 0); - DBUG_ASSERT(static_cast<my_size_t>(bytes_written) < sizeof(emit_buf)); - my_b_write(file, (byte*) emit_buf, bytes_written); + DBUG_ASSERT(static_cast<size_t>(bytes_written) < sizeof(emit_buf)); + my_b_write(file, (uchar*) emit_buf, bytes_written); ptr += LOG_EVENT_MINIMAL_HEADER_LEN; hexdump_from += LOG_EVENT_MINIMAL_HEADER_LEN; } @@ -1123,8 +1123,8 @@ void Log_event::print_header(IO_CACHE* file, (unsigned long) (hexdump_from + (i & 0xfffffff0)), hex_string, char_string); DBUG_ASSERT(bytes_written >= 0); - DBUG_ASSERT(static_cast<my_size_t>(bytes_written) < sizeof(emit_buf)); - my_b_write(file, (byte*) emit_buf, bytes_written); + DBUG_ASSERT(static_cast<size_t>(bytes_written) < sizeof(emit_buf)); + my_b_write(file, (uchar*) emit_buf, bytes_written); hex_string[0]= 0; char_string[0]= 0; c= char_string; @@ -1144,14 +1144,14 @@ void Log_event::print_header(IO_CACHE* file, (unsigned long) (hexdump_from + (i & 0xfffffff0)), hex_string, char_string); DBUG_ASSERT(bytes_written >= 0); - DBUG_ASSERT(static_cast<my_size_t>(bytes_written) < sizeof(emit_buf)); - my_b_write(file, (byte*) emit_buf, bytes_written); + DBUG_ASSERT(static_cast<size_t>(bytes_written) < sizeof(emit_buf)); + my_b_write(file, (uchar*) emit_buf, bytes_written); } /* need a # to prefix the rest of printouts for example those of Rows_log_event::print_helper(). */ - my_b_write(file, reinterpret_cast<const byte*>("# "), 2); + my_b_write(file, reinterpret_cast<const uchar*>("# "), 2); } DBUG_VOID_RETURN; } @@ -1239,7 +1239,7 @@ void Query_log_event::pack_info(Protocol *protocol) { // TODO: show the catalog ?? char *buf, *pos; - if (!(buf= my_malloc(9 + db_len + q_len, MYF(MY_WME)))) + if (!(buf= (char*) my_malloc(9 + db_len + q_len, MYF(MY_WME)))) return; pos= buf; if (!(flags & LOG_EVENT_SUPPRESS_USE_F) @@ -1440,12 +1440,12 @@ bool Query_log_event::write(IO_CACHE* file) event_length= (uint) (start-buf) + get_post_header_size_for_derived() + db_len + 1 + q_len; return (write_header(file, event_length) || - my_b_safe_write(file, (byte*) buf, QUERY_HEADER_LEN) || + my_b_safe_write(file, (uchar*) buf, QUERY_HEADER_LEN) || write_post_header_for_derived(file) || - my_b_safe_write(file, (byte*) start_of_status, + my_b_safe_write(file, (uchar*) start_of_status, (uint) (start-start_of_status)) || - my_b_safe_write(file, (db) ? (byte*) db : (byte*)"", db_len + 1) || - my_b_safe_write(file, (byte*) query, q_len)) ? 1 : 0; + my_b_safe_write(file, (db) ? (uchar*) db : (uchar*)"", db_len + 1) || + my_b_safe_write(file, (uchar*) query, q_len)) ? 1 : 0; } /* @@ -1559,7 +1559,8 @@ static void copy_str_and_move(const char **src, */ Query_log_event::Query_log_event(const char* buf, uint event_len, - const Format_description_log_event *description_event, + const Format_description_log_event + *description_event, Log_event_type event_type) :Log_event(buf, description_event), data_buf(0), query(NullS), db(NullS), catalog_len(0), status_vars_len(0), @@ -1752,7 +1753,7 @@ void Query_log_event::print_query_header(IO_CACHE* file, end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10); end= strmov(end, print_event_info->delimiter); *end++='\n'; - my_b_write(file, (byte*) buff, (uint) (end-buff)); + my_b_write(file, (uchar*) buff, (uint) (end-buff)); if (flags & LOG_EVENT_THREAD_SPECIFIC_F) my_b_printf(file,"SET @@session.pseudo_thread_id=%lu%s\n", (ulong)thread_id, print_event_info->delimiter); @@ -1836,7 +1837,7 @@ void Query_log_event::print_query_header(IO_CACHE* file, print_event_info->charset_inited= 1; print_event_info->charset[0]= ~charset[0]; // force a difference to force write } - if (unlikely(bcmp(print_event_info->charset, charset, 6))) + if (unlikely(bcmp((uchar*) print_event_info->charset, (uchar*) charset, 6))) { CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME)); if (cs_info) @@ -1859,7 +1860,8 @@ void Query_log_event::print_query_header(IO_CACHE* file, } if (time_zone_len) { - if (bcmp(print_event_info->time_zone_str, time_zone_str, time_zone_len+1)) + if (bcmp((uchar*) print_event_info->time_zone_str, + (uchar*) time_zone_str, time_zone_len+1)) { my_b_printf(file,"SET @@session.time_zone='%s'%s\n", time_zone_str, print_event_info->delimiter); @@ -1890,7 +1892,7 @@ void Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) Write_on_release_cache cache(&print_event_info->head_cache, file); print_query_header(&cache, print_event_info); - my_b_write(&cache, (byte*) query, q_len); + my_b_write(&cache, (uchar*) query, q_len); my_b_printf(&cache, "%s\n", print_event_info->delimiter); } #endif /* MYSQL_CLIENT */ @@ -2326,7 +2328,7 @@ bool Start_log_event_v3::write(IO_CACHE* file) memcpy(buff + ST_SERVER_VER_OFFSET,server_version,ST_SERVER_VER_LEN); int4store(buff + ST_CREATED_OFFSET,created); return (write_header(file, sizeof(buff)) || - my_b_safe_write(file, (byte*) buff, sizeof(buff))); + my_b_safe_write(file, (uchar*) buff, sizeof(buff))); } #endif @@ -2561,7 +2563,7 @@ Format_description_log_event(const char* buf, DBUG_PRINT("info", ("common_header_len=%d number_of_event_types=%d", common_header_len, number_of_event_types)); /* If alloc fails, we'll detect it in is_valid() */ - post_header_len= (uint8*) my_memdup((byte*)buf+ST_COMMON_HEADER_LEN_OFFSET+1, + post_header_len= (uint8*) my_memdup((uchar*)buf+ST_COMMON_HEADER_LEN_OFFSET+1, number_of_event_types* sizeof(*post_header_len), MYF(0)); calc_server_version_split(); @@ -2575,12 +2577,12 @@ bool Format_description_log_event::write(IO_CACHE* file) We don't call Start_log_event_v3::write() because this would make 2 my_b_safe_write(). */ - byte buff[FORMAT_DESCRIPTION_HEADER_LEN]; + uchar buff[FORMAT_DESCRIPTION_HEADER_LEN]; int2store(buff + ST_BINLOG_VER_OFFSET,binlog_version); memcpy((char*) buff + ST_SERVER_VER_OFFSET,server_version,ST_SERVER_VER_LEN); int4store(buff + ST_CREATED_OFFSET,created); buff[ST_COMMON_HEADER_LEN_OFFSET]= LOG_EVENT_HEADER_LEN; - memcpy((char*) buff+ST_COMMON_HEADER_LEN_OFFSET+1, (byte*) post_header_len, + memcpy((char*) buff+ST_COMMON_HEADER_LEN_OFFSET+1, (uchar*) post_header_len, LOG_EVENT_TYPES); return (write_header(file, sizeof(buff)) || my_b_safe_write(file, buff, sizeof(buff))); @@ -2835,7 +2837,7 @@ void Load_log_event::pack_info(Protocol *protocol) { char *buf, *end; - if (!(buf= my_malloc(get_query_buffer_length(), MYF(MY_WME)))) + if (!(buf= (char*) my_malloc(get_query_buffer_length(), MYF(MY_WME)))) return; print_query(TRUE, buf, &end, 0, 0); protocol->store(buf, end-buf, &my_charset_bin); @@ -2859,7 +2861,7 @@ bool Load_log_event::write_data_header(IO_CACHE* file) buf[L_TBL_LEN_OFFSET] = (char)table_name_len; buf[L_DB_LEN_OFFSET] = (char)db_len; int4store(buf + L_NUM_FIELDS_OFFSET, num_fields); - return my_b_safe_write(file, (byte*)buf, LOAD_HEADER_LEN) != 0; + return my_b_safe_write(file, (uchar*)buf, LOAD_HEADER_LEN) != 0; } @@ -2873,13 +2875,13 @@ bool Load_log_event::write_data_body(IO_CACHE* file) return 1; if (num_fields && fields && field_lens) { - if (my_b_safe_write(file, (byte*)field_lens, num_fields) || - my_b_safe_write(file, (byte*)fields, field_block_len)) + if (my_b_safe_write(file, (uchar*)field_lens, num_fields) || + my_b_safe_write(file, (uchar*)fields, field_block_len)) return 1; } - return (my_b_safe_write(file, (byte*)table_name, table_name_len + 1) || - my_b_safe_write(file, (byte*)db, db_len + 1) || - my_b_safe_write(file, (byte*)fname, fname_len)); + return (my_b_safe_write(file, (uchar*)table_name, table_name_len + 1) || + my_b_safe_write(file, (uchar*)db, db_len + 1) || + my_b_safe_write(file, (uchar*)fname, fname_len)); } @@ -3498,7 +3500,7 @@ void Rotate_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) print_header(&cache, print_event_info, FALSE); my_b_printf(&cache, "\tRotate to "); if (new_log_ident) - my_b_write(&cache, (byte*) new_log_ident, (uint)ident_len); + my_b_write(&cache, (uchar*) new_log_ident, (uint)ident_len); my_b_printf(&cache, " pos: %s\n", llstr(pos, buf)); } #endif /* MYSQL_CLIENT */ @@ -3564,8 +3566,8 @@ bool Rotate_log_event::write(IO_CACHE* file) char buf[ROTATE_HEADER_LEN]; int8store(buf + R_POS_OFFSET, pos); return (write_header(file, ROTATE_HEADER_LEN + ident_len) || - my_b_safe_write(file, (byte*)buf, ROTATE_HEADER_LEN) || - my_b_safe_write(file, (byte*)new_log_ident, (uint) ident_len)); + my_b_safe_write(file, (uchar*)buf, ROTATE_HEADER_LEN) || + my_b_safe_write(file, (uchar*)new_log_ident, (uint) ident_len)); } #endif @@ -3732,8 +3734,8 @@ const char* Intvar_log_event::get_var_type_name() #ifndef MYSQL_CLIENT bool Intvar_log_event::write(IO_CACHE* file) { - byte buf[9]; - buf[I_TYPE_OFFSET]= (byte) type; + uchar buf[9]; + buf[I_TYPE_OFFSET]= (uchar) type; int8store(buf + I_VAL_OFFSET, val); return (write_header(file, sizeof(buf)) || my_b_safe_write(file, buf, sizeof(buf))); @@ -3861,7 +3863,7 @@ Rand_log_event::Rand_log_event(const char* buf, #ifndef MYSQL_CLIENT bool Rand_log_event::write(IO_CACHE* file) { - byte buf[16]; + uchar buf[16]; int8store(buf + RAND_SEED1_OFFSET, seed1); int8store(buf + RAND_SEED2_OFFSET, seed2); return (write_header(file, sizeof(buf)) || @@ -3968,7 +3970,7 @@ Xid_log_event(const char* buf, bool Xid_log_event::write(IO_CACHE* file) { return write_header(file, sizeof(xid)) || - my_b_safe_write(file, (byte*) &xid, sizeof(xid)); + my_b_safe_write(file, (uchar*) &xid, sizeof(xid)); } #endif @@ -4016,7 +4018,8 @@ void User_var_log_event::pack_info(Protocol* protocol) if (is_null) { - buf= my_malloc(val_offset + 5, MYF(MY_WME)); + if (!(buf= (char*) my_malloc(val_offset + 5, MYF(MY_WME)))) + return; strmov(buf + val_offset, "NULL"); event_len= val_offset + 4; } @@ -4026,28 +4029,37 @@ void User_var_log_event::pack_info(Protocol* protocol) case REAL_RESULT: double real_val; float8get(real_val, val); - buf= my_malloc(val_offset + FLOATING_POINT_BUFFER, MYF(MY_WME)); + if (!(buf= (char*) my_malloc(val_offset + FLOATING_POINT_BUFFER, + MYF(MY_WME)))) + return; event_len+= my_sprintf(buf + val_offset, (buf + val_offset, "%.14g", real_val)); break; case INT_RESULT: - buf= my_malloc(val_offset + 22, MYF(MY_WME)); + if (!(buf= (char*) my_malloc(val_offset + 22, MYF(MY_WME)))) + return; event_len= longlong10_to_str(uint8korr(val), buf + val_offset,-10)-buf; break; case DECIMAL_RESULT: { - buf= my_malloc(val_offset + DECIMAL_MAX_STR_LENGTH, MYF(MY_WME)); + if (!(buf= (char*) my_malloc(val_offset + DECIMAL_MAX_STR_LENGTH, + MYF(MY_WME)))) + return; String str(buf+val_offset, DECIMAL_MAX_STR_LENGTH, &my_charset_bin); my_decimal dec; - binary2my_decimal(E_DEC_FATAL_ERROR, val+2, &dec, val[0], val[1]); + binary2my_decimal(E_DEC_FATAL_ERROR, (uchar*) (val+2), &dec, val[0], + val[1]); my_decimal2string(E_DEC_FATAL_ERROR, &dec, 0, 0, 0, &str); event_len= str.length() + val_offset; break; } case STRING_RESULT: /* 15 is for 'COLLATE' and other chars */ - buf= my_malloc(event_len+val_len*2+1+2*MY_CS_NAME_SIZE+15, MYF(MY_WME)); + buf= (char*) my_malloc(event_len+val_len*2+1+2*MY_CS_NAME_SIZE+15, + MYF(MY_WME)); CHARSET_INFO *cs; + if (!buf) + return; if (!(cs= get_charset(charset_number, MYF(0)))) { strmov(buf+val_offset, "???"); @@ -4069,11 +4081,11 @@ void User_var_log_event::pack_info(Protocol* protocol) } buf[0]= '@'; buf[1]= '`'; + memcpy(buf+2, name, name_len); buf[2+name_len]= '`'; buf[3+name_len]= '='; - memcpy(buf+2, name, name_len); protocol->store(buf, event_len, &my_charset_bin); - my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buf, MYF(0)); } #endif /* !MYSQL_CLIENT */ @@ -4113,7 +4125,7 @@ bool User_var_log_event::write(IO_CACHE* file) char buf[UV_NAME_LEN_SIZE]; char buf1[UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE]; - char buf2[max(8, DECIMAL_MAX_FIELD_SIZE + 2)], *pos= buf2; + uchar buf2[max(8, DECIMAL_MAX_FIELD_SIZE + 2)], *pos= buf2; uint buf1_length; ulong event_length; @@ -4122,7 +4134,7 @@ bool User_var_log_event::write(IO_CACHE* file) if ((buf1[0]= is_null)) { buf1_length= 1; - val_len= 0; + val_len= 0; // Length of 'pos' } else { @@ -4147,7 +4159,7 @@ bool User_var_log_event::write(IO_CACHE* file) break; } case STRING_RESULT: - pos= val; + pos= (uchar*) val; break; case ROW_RESULT: default: @@ -4162,10 +4174,10 @@ bool User_var_log_event::write(IO_CACHE* file) event_length= sizeof(buf)+ name_len + buf1_length + val_len; return (write_header(file, event_length) || - my_b_safe_write(file, (byte*) buf, sizeof(buf)) || - my_b_safe_write(file, (byte*) name, name_len) || - my_b_safe_write(file, (byte*) buf1, buf1_length) || - my_b_safe_write(file, (byte*) pos, val_len)); + my_b_safe_write(file, (uchar*) buf, sizeof(buf)) || + my_b_safe_write(file, (uchar*) name, name_len) || + my_b_safe_write(file, (uchar*) buf1, buf1_length) || + my_b_safe_write(file, pos, val_len)); } #endif @@ -4187,7 +4199,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) } my_b_printf(&cache, "SET @`"); - my_b_write(&cache, (byte*) name, (uint) (name_len)); + my_b_write(&cache, (uchar*) name, (uint) (name_len)); my_b_printf(&cache, "`"); if (is_null) @@ -4218,7 +4230,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) dec.len= 10; dec.buf= dec_buf; - bin2decimal(val+2, &dec, precision, scale); + bin2decimal((uchar*) val+2, &dec, precision, scale); decimal2string(&dec, str_buf, &str_len, 0, 0, 0); str_buf[str_len]= 0; my_b_printf(&cache, ":=%s%s\n", str_buf, print_event_info->delimiter); @@ -4319,7 +4331,7 @@ int User_var_log_event::do_apply_event(RELAY_LOG_INFO const *rli) break; case DECIMAL_RESULT: { - Item_decimal *dec= new Item_decimal(val+2, val[0], val[1]); + Item_decimal *dec= new Item_decimal((uchar*) val+2, val[0], val[1]); it= dec; val= (char *)dec->val_decimal(NULL); val_len= sizeof(my_decimal); @@ -4484,7 +4496,7 @@ bool Slave_log_event::write(IO_CACHE* file) // log and host are already there return (write_header(file, event_length) || - my_b_safe_write(file, (byte*) mem_pool, event_length)); + my_b_safe_write(file, (uchar*) mem_pool, event_length)); } #endif @@ -4627,8 +4639,8 @@ bool Create_file_log_event::write_data_body(IO_CACHE* file) bool res; if ((res= Load_log_event::write_data_body(file)) || fake_base) return res; - return (my_b_safe_write(file, (byte*) "", 1) || - my_b_safe_write(file, (byte*) block, block_len)); + return (my_b_safe_write(file, (uchar*) "", 1) || + my_b_safe_write(file, (uchar*) block, block_len)); } @@ -4639,7 +4651,7 @@ bool Create_file_log_event::write_data_body(IO_CACHE* file) bool Create_file_log_event::write_data_header(IO_CACHE* file) { bool res; - byte buf[CREATE_FILE_HEADER_LEN]; + uchar buf[CREATE_FILE_HEADER_LEN]; if ((res= Load_log_event::write_data_header(file)) || fake_base) return res; int4store(buf + CF_FILE_ID_OFFSET, file_id); @@ -4675,7 +4687,7 @@ Create_file_log_event::Create_file_log_event(const char* buf, uint len, uint header_len= description_event->common_header_len; uint8 load_header_len= description_event->post_header_len[LOAD_EVENT-1]; uint8 create_file_header_len= description_event->post_header_len[CREATE_FILE_EVENT-1]; - if (!(event_buf= my_memdup((byte*) buf, len, MYF(MY_WME))) || + if (!(event_buf= (char*) my_memdup(buf, len, MYF(MY_WME))) || copy_log_event(event_buf,len, ((buf[EVENT_TYPE_OFFSET] == LOAD_EVENT) ? load_header_len + header_len : @@ -4830,7 +4842,7 @@ int Create_file_log_event::do_apply_event(RELAY_LOG_INFO const *rli) "could not open file '%s'", fname_buf); goto err; } - if (my_write(fd, (byte*) block, block_len, MYF(MY_WME+MY_NABP))) + if (my_write(fd, (uchar*) block, block_len, MYF(MY_WME+MY_NABP))) { slave_print_msg(ERROR_LEVEL, rli, my_errno, "Error in Create_file event: " "write to '%s' failed", fname_buf); @@ -4898,11 +4910,11 @@ Append_block_log_event::Append_block_log_event(const char* buf, uint len, #ifndef MYSQL_CLIENT bool Append_block_log_event::write(IO_CACHE* file) { - byte buf[APPEND_BLOCK_HEADER_LEN]; + uchar buf[APPEND_BLOCK_HEADER_LEN]; int4store(buf + AB_FILE_ID_OFFSET, file_id); return (write_header(file, APPEND_BLOCK_HEADER_LEN + block_len) || my_b_safe_write(file, buf, APPEND_BLOCK_HEADER_LEN) || - my_b_safe_write(file, (byte*) block, block_len)); + my_b_safe_write(file, (uchar*) block, block_len)); } #endif @@ -4986,7 +4998,7 @@ int Append_block_log_event::do_apply_event(RELAY_LOG_INFO const *rli) get_type_str(), fname); goto err; } - if (my_write(fd, (byte*) block, block_len, MYF(MY_WME+MY_NABP))) + if (my_write(fd, (uchar*) block, block_len, MYF(MY_WME+MY_NABP))) { slave_print_msg(ERROR_LEVEL, rli, my_errno, "Error in %s event: write to '%s' failed", @@ -5043,7 +5055,7 @@ Delete_file_log_event::Delete_file_log_event(const char* buf, uint len, #ifndef MYSQL_CLIENT bool Delete_file_log_event::write(IO_CACHE* file) { - byte buf[DELETE_FILE_HEADER_LEN]; + uchar buf[DELETE_FILE_HEADER_LEN]; int4store(buf + DF_FILE_ID_OFFSET, file_id); return (write_header(file, sizeof(buf)) || my_b_safe_write(file, buf, sizeof(buf))); @@ -5139,7 +5151,7 @@ Execute_load_log_event::Execute_load_log_event(const char* buf, uint len, #ifndef MYSQL_CLIENT bool Execute_load_log_event::write(IO_CACHE* file) { - byte buf[EXEC_LOAD_HEADER_LEN]; + uchar buf[EXEC_LOAD_HEADER_LEN]; int4store(buf + EL_FILE_ID_OFFSET, file_id); return (write_header(file, sizeof(buf)) || my_b_safe_write(file, buf, sizeof(buf))); @@ -5357,12 +5369,12 @@ ulong Execute_load_query_log_event::get_post_header_size_for_derived() bool Execute_load_query_log_event::write_post_header_for_derived(IO_CACHE* file) { - char buf[EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN]; + uchar buf[EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN]; int4store(buf, file_id); int4store(buf + 4, fn_pos_start); int4store(buf + 4 + 4, fn_pos_end); - *(buf + 4 + 4 + 4)= (char)dup_handling; - return my_b_safe_write(file, (byte*) buf, EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN); + *(buf + 4 + 4 + 4)= (uchar) dup_handling; + return my_b_safe_write(file, buf, EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN); } #endif @@ -5385,19 +5397,19 @@ void Execute_load_query_log_event::print(FILE* file, if (local_fname) { - my_b_write(&cache, (byte*) query, fn_pos_start); + my_b_write(&cache, (uchar*) query, fn_pos_start); my_b_printf(&cache, " LOCAL INFILE \'"); my_b_printf(&cache, local_fname); my_b_printf(&cache, "\'"); if (dup_handling == LOAD_DUP_REPLACE) my_b_printf(&cache, " REPLACE"); my_b_printf(&cache, " INTO"); - my_b_write(&cache, (byte*) query + fn_pos_end, q_len-fn_pos_end); + my_b_write(&cache, (uchar*) query + fn_pos_end, q_len-fn_pos_end); my_b_printf(&cache, "%s\n", print_event_info->delimiter); } else { - my_b_write(&cache, (byte*) query, q_len); + my_b_write(&cache, (uchar*) query, q_len); my_b_printf(&cache, "%s\n", print_event_info->delimiter); } @@ -5411,7 +5423,7 @@ void Execute_load_query_log_event::print(FILE* file, void Execute_load_query_log_event::pack_info(Protocol *protocol) { char *buf, *pos; - if (!(buf= my_malloc(9 + db_len + q_len + 10 + 21, MYF(MY_WME)))) + if (!(buf= (char*) my_malloc(9 + db_len + q_len + 10 + 21, MYF(MY_WME)))) return; pos= buf; if (db && db_len) @@ -5442,8 +5454,8 @@ Execute_load_query_log_event::do_apply_event(RELAY_LOG_INFO const *rli) int error; /* Replace filename and LOCAL keyword in query before executing it */ - if (!(buf = my_malloc(q_len + 1 - (fn_pos_end - fn_pos_start) + - (FN_REFLEN + 10) + 10 + 8 + 5, MYF(MY_WME)))) + if (!(buf = (char*) my_malloc(q_len + 1 - (fn_pos_end - fn_pos_start) + + (FN_REFLEN + 10) + 10 + 8 + 5, MYF(MY_WME)))) { slave_print_msg(ERROR_LEVEL, rli, my_errno, "Not enough memory"); return 1; @@ -5505,7 +5517,7 @@ bool sql_ex_info::write_data(IO_CACHE* file) write_str(file, line_term, (uint) line_term_len) || write_str(file, line_start, (uint) line_start_len) || write_str(file, escaped, (uint) escaped_len) || - my_b_safe_write(file,(byte*) &opt_flags,1)); + my_b_safe_write(file,(uchar*) &opt_flags,1)); } else { @@ -5517,7 +5529,7 @@ bool sql_ex_info::write_data(IO_CACHE* file) old_ex.escaped= *escaped; old_ex.opt_flags= opt_flags; old_ex.empty_flags=empty_flags; - return my_b_safe_write(file, (byte*) &old_ex, sizeof(old_ex)) != 0; + return my_b_safe_write(file, (uchar*) &old_ex, sizeof(old_ex)) != 0; } } @@ -5652,9 +5664,9 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, m_flags= uint2korr(post_start); - byte const *const var_start= - (const byte *)buf + common_header_len + post_header_len; - byte const *const ptr_width= var_start; + uchar const *const var_start= + (const uchar *)buf + common_header_len + post_header_len; + uchar const *const ptr_width= var_start; uchar *ptr_after_width= (uchar*) ptr_width; DBUG_PRINT("debug", ("Reading from %p", ptr_after_width)); m_width = net_field_length(&ptr_after_width); @@ -5668,7 +5680,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, DBUG_PRINT("debug", ("Reading from %p", ptr_after_width)); memcpy(m_cols.bitmap, ptr_after_width, (m_width + 7) / 8); ptr_after_width+= (m_width + 7) / 8; - DBUG_DUMP("m_cols", (char*) m_cols.bitmap, no_bytes_in_map(&m_cols)); + DBUG_DUMP("m_cols", (uchar*) m_cols.bitmap, no_bytes_in_map(&m_cols)); } else { @@ -5692,7 +5704,8 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, DBUG_PRINT("debug", ("Reading from %p", ptr_after_width)); memcpy(m_cols_ai.bitmap, ptr_after_width, (m_width + 7) / 8); ptr_after_width+= (m_width + 7) / 8; - DBUG_DUMP("m_cols_ai", (char*) m_cols_ai.bitmap, no_bytes_in_map(&m_cols_ai)); + DBUG_DUMP("m_cols_ai", (uchar*) m_cols_ai.bitmap, + no_bytes_in_map(&m_cols_ai)); } else { @@ -5702,13 +5715,13 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, } } - const byte* const ptr_rows_data= (const byte*) ptr_after_width; + const uchar* const ptr_rows_data= (const uchar*) ptr_after_width; - my_size_t const data_size= event_len - (ptr_rows_data - (const byte *) buf); + size_t const data_size= event_len - (ptr_rows_data - (const uchar *) buf); DBUG_PRINT("info",("m_table_id: %lu m_flags: %d m_width: %lu data_size: %lu", m_table_id, m_flags, m_width, data_size)); - m_rows_buf= (byte*)my_malloc(data_size, MYF(MY_WME)); + m_rows_buf= (uchar*) my_malloc(data_size, MYF(MY_WME)); if (likely((bool)m_rows_buf)) { m_rows_end= m_rows_buf + data_size; @@ -5726,15 +5739,15 @@ Rows_log_event::~Rows_log_event() if (m_cols.bitmap == m_bitbuf) // no my_malloc happened m_cols.bitmap= 0; // so no my_free in bitmap_free bitmap_free(&m_cols); // To pair with bitmap_init(). - my_free((gptr)m_rows_buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*)m_rows_buf, MYF(MY_ALLOW_ZERO_PTR)); } int Rows_log_event::get_data_size() { int const type_code= get_type_code(); - char buf[sizeof(m_width)+1]; - char *end= net_store_length(buf, (m_width + 7) / 8); + uchar buf[sizeof(m_width)+1]; + uchar *end= net_store_length(buf, (m_width + 7) / 8); DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", return 6 + no_bytes_in_map(&m_cols) + (end - buf) + @@ -5753,7 +5766,7 @@ int Rows_log_event::get_data_size() #ifndef MYSQL_CLIENT -int Rows_log_event::do_add_row_data(byte *row_data, my_size_t length) +int Rows_log_event::do_add_row_data(uchar *row_data, size_t length) { /* When the table has a primary key, we would probably want, by default, to @@ -5768,7 +5781,7 @@ int Rows_log_event::do_add_row_data(byte *row_data, my_size_t length) trigger false warnings. */ #ifndef HAVE_purify - DBUG_DUMP("row_data", (const char*)row_data, min(length, 32)); + DBUG_DUMP("row_data", row_data, min(length, 32)); #endif DBUG_ASSERT(m_rows_buf <= m_rows_cur); @@ -5776,14 +5789,14 @@ int Rows_log_event::do_add_row_data(byte *row_data, my_size_t length) DBUG_ASSERT(m_rows_cur <= m_rows_end); /* The cast will always work since m_rows_cur <= m_rows_end */ - if (static_cast<my_size_t>(m_rows_end - m_rows_cur) <= length) + if (static_cast<size_t>(m_rows_end - m_rows_cur) <= length) { - my_size_t const block_size= 1024; + size_t const block_size= 1024; my_ptrdiff_t const cur_size= m_rows_cur - m_rows_buf; my_ptrdiff_t const new_alloc= block_size * ((cur_size + length + block_size - 1) / block_size); - byte* const new_buf= (byte*)my_realloc((gptr)m_rows_buf, (uint) new_alloc, + uchar* const new_buf= (uchar*)my_realloc((uchar*)m_rows_buf, (uint) new_alloc, MYF(MY_ALLOW_ZERO_PTR|MY_WME)); if (unlikely(!new_buf)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -5815,7 +5828,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { DBUG_ENTER("Rows_log_event::do_apply_event(st_relay_log_info*)"); int error= 0; - char const *row_start= (char const *)m_rows_buf; + uchar const *row_start= m_rows_buf; /* If m_table_id == ~0UL, then we have a dummy event that does not @@ -6026,15 +6039,15 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) const_cast<RELAY_LOG_INFO*>(rli)->set_flag(RELAY_LOG_INFO::IN_STMT); error= do_before_row_operations(table); - while (error == 0 && row_start < (const char*) m_rows_end) + while (error == 0 && row_start < m_rows_end) { - char const *row_end= NULL; + uchar const *row_end= NULL; if ((error= do_prepare_row(thd, rli, table, row_start, &row_end))) break; // We should perform the after-row operation even in // the case of error DBUG_ASSERT(row_end != NULL); // cannot happen - DBUG_ASSERT(row_end <= (const char*)m_rows_end); + DBUG_ASSERT(row_end <= m_rows_end); /* in_use can have been set to NULL in close_tables_for_reopen */ THD* old_thd= table->in_use; @@ -6215,7 +6228,7 @@ Rows_log_event::do_update_pos(RELAY_LOG_INFO *rli) #ifndef MYSQL_CLIENT bool Rows_log_event::write_data_header(IO_CACHE *file) { - byte buf[ROWS_HEADER_LEN]; // No need to init the buffer + uchar buf[ROWS_HEADER_LEN]; // No need to init the buffer DBUG_ASSERT(m_table_id != ~0UL); DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", { @@ -6234,34 +6247,30 @@ bool Rows_log_event::write_data_body(IO_CACHE*file) Note that this should be the number of *bits*, not the number of bytes. */ - char sbuf[sizeof(m_width)]; + uchar sbuf[sizeof(m_width)]; my_ptrdiff_t const data_size= m_rows_cur - m_rows_buf; bool res= false; + uchar *const sbuf_end= net_store_length(sbuf, (size_t) m_width); + DBUG_ASSERT(static_cast<size_t>(sbuf_end - sbuf) <= sizeof(sbuf)); - char *const sbuf_end= net_store_length((char*) sbuf, (uint) m_width); - DBUG_ASSERT(static_cast<my_size_t>(sbuf_end - sbuf) <= sizeof(sbuf)); - - DBUG_DUMP("m_width", sbuf, sbuf_end - sbuf); - res= res || my_b_safe_write(file, - reinterpret_cast<byte*>(sbuf), - sbuf_end - sbuf); + DBUG_DUMP("m_width", sbuf, (size_t) (sbuf_end - sbuf)); + res= res || my_b_safe_write(file, sbuf, (size_t) (sbuf_end - sbuf)); - DBUG_DUMP("m_cols", (char*) m_cols.bitmap, no_bytes_in_map(&m_cols)); - res= res || my_b_safe_write(file, - reinterpret_cast<byte*>(m_cols.bitmap), + DBUG_DUMP("m_cols", (uchar*) m_cols.bitmap, no_bytes_in_map(&m_cols)); + res= res || my_b_safe_write(file, (uchar*) m_cols.bitmap, no_bytes_in_map(&m_cols)); /* TODO[refactor write]: Remove the "down cast" here (and elsewhere). */ if (get_type_code() == UPDATE_ROWS_EVENT) { - DBUG_DUMP("m_cols_ai", (char*) m_cols_ai.bitmap, no_bytes_in_map(&m_cols_ai)); - res= res || my_b_safe_write(file, - reinterpret_cast<byte*>(m_cols_ai.bitmap), + DBUG_DUMP("m_cols_ai", (uchar*) m_cols_ai.bitmap, + no_bytes_in_map(&m_cols_ai)); + res= res || my_b_safe_write(file, (uchar*) m_cols_ai.bitmap, no_bytes_in_map(&m_cols_ai)); } - DBUG_DUMP("rows",(const char *) m_rows_buf, data_size); - res= res || my_b_safe_write(file, m_rows_buf, (uint) data_size); + DBUG_DUMP("rows", m_rows_buf, data_size); + res= res || my_b_safe_write(file, m_rows_buf, (size_t) data_size); return res; @@ -6274,7 +6283,7 @@ void Rows_log_event::pack_info(Protocol *protocol) char buf[256]; char const *const flagstr= get_flags(STMT_END_F) ? " flags: STMT_END_F" : ""; - my_size_t bytes= my_snprintf(buf, sizeof(buf), + size_t bytes= my_snprintf(buf, sizeof(buf), "table_id: %lu%s", m_table_id, flagstr); protocol->store(buf, bytes, &my_charset_bin); } @@ -6346,7 +6355,7 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid, m_data_size+= 1 + m_colcnt; // COLCNT and column types /* If malloc fails, catched in is_valid() */ - if ((m_memory= my_malloc(m_colcnt, MYF(MY_WME)))) + if ((m_memory= (uchar*) my_malloc(m_colcnt, MYF(MY_WME)))) { m_coltype= reinterpret_cast<uchar*>(m_memory); for (unsigned int i= 0 ; i < m_table->s->fields ; ++i) @@ -6381,7 +6390,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len, trigger false warnings. */ #ifndef HAVE_purify - DBUG_DUMP("event buffer", buf, event_len); + DBUG_DUMP("event buffer", (uchar*) buf, event_len); #endif /* Read the post-header */ @@ -6409,29 +6418,29 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len, const char *const vpart= buf + common_header_len + post_header_len; /* Extract the length of the various parts from the buffer */ - byte const *const ptr_dblen= (byte const*)vpart + 0; + uchar const *const ptr_dblen= (uchar const*)vpart + 0; m_dblen= *(uchar*) ptr_dblen; /* Length of database name + counter + terminating null */ - byte const *const ptr_tbllen= ptr_dblen + m_dblen + 2; + uchar const *const ptr_tbllen= ptr_dblen + m_dblen + 2; m_tbllen= *(uchar*) ptr_tbllen; /* Length of table name + counter + terminating null */ - byte const *const ptr_colcnt= ptr_tbllen + m_tbllen + 2; + uchar const *const ptr_colcnt= ptr_tbllen + m_tbllen + 2; uchar *ptr_after_colcnt= (uchar*) ptr_colcnt; m_colcnt= net_field_length(&ptr_after_colcnt); DBUG_PRINT("info",("m_dblen: %lu off: %ld m_tbllen: %lu off: %ld m_colcnt: %lu off: %ld", - m_dblen, (long) (ptr_dblen-(const byte*)vpart), - m_tbllen, (long) (ptr_tbllen-(const byte*)vpart), - m_colcnt, (long) (ptr_colcnt-(const byte*)vpart))); + m_dblen, (long) (ptr_dblen-(const uchar*)vpart), + m_tbllen, (long) (ptr_tbllen-(const uchar*)vpart), + m_colcnt, (long) (ptr_colcnt-(const uchar*)vpart))); /* Allocate mem for all fields in one go. If fails, catched in is_valid() */ - m_memory= my_multi_malloc(MYF(MY_WME), - &m_dbnam, m_dblen + 1, - &m_tblnam, m_tbllen + 1, - &m_coltype, m_colcnt, - NULL); + m_memory= (uchar*) my_multi_malloc(MYF(MY_WME), + &m_dbnam, (uint) m_dblen + 1, + &m_tblnam, (uint) m_tbllen + 1, + &m_coltype, (uint) m_colcnt, + NullS); if (m_memory) { @@ -6464,8 +6473,11 @@ Table_map_log_event::~Table_map_log_event() #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { + RPL_TABLE_LIST *table_list; + char *db_mem, *tname_mem; + size_t dummy_len; + void *memory; DBUG_ENTER("Table_map_log_event::do_apply_event(st_relay_log_info*)"); - DBUG_ASSERT(rli->sql_thd == thd); /* Step the query id to mark what columns that are actually used. */ @@ -6473,19 +6485,13 @@ int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli) thd->query_id= next_query_id(); pthread_mutex_unlock(&LOCK_thread_count); - RPL_TABLE_LIST *table_list; - char *db_mem, *tname_mem; - void *const memory= - my_multi_malloc(MYF(MY_WME), - &table_list, sizeof(RPL_TABLE_LIST), - &db_mem, NAME_LEN + 1, - &tname_mem, NAME_LEN + 1, - NULL); - - if (memory == NULL) + if (!(memory= my_multi_malloc(MYF(MY_WME), + &table_list, (uint) sizeof(RPL_TABLE_LIST), + &db_mem, (uint) NAME_LEN + 1, + &tname_mem, (uint) NAME_LEN + 1, + NullS))) DBUG_RETURN(HA_ERR_OUT_OF_MEM); - uint dummy_len; bzero(table_list, sizeof(*table_list)); table_list->db = db_mem; table_list->alias= table_list->table_name = tname_mem; @@ -6501,7 +6507,7 @@ int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli) if (!rpl_filter->db_ok(table_list->db) || (rpl_filter->is_on() && !rpl_filter->tables_ok("", table_list))) { - my_free((gptr) memory, MYF(MY_WME)); + my_free(memory, MYF(MY_WME)); } else { @@ -6595,7 +6601,7 @@ int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli) DBUG_RETURN(error); err: - my_free((gptr) memory, MYF(MY_WME)); + my_free(memory, MYF(MY_WME)); DBUG_RETURN(error); } @@ -6611,7 +6617,7 @@ int Table_map_log_event::do_update_pos(RELAY_LOG_INFO *rli) bool Table_map_log_event::write_data_header(IO_CACHE *file) { DBUG_ASSERT(m_table_id != ~0UL); - byte buf[TABLE_MAP_HEADER_LEN]; + uchar buf[TABLE_MAP_HEADER_LEN]; DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", { int4store(buf + 0, m_table_id); @@ -6631,20 +6637,19 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file) DBUG_ASSERT(m_dblen < 128); DBUG_ASSERT(m_tbllen < 128); - byte const dbuf[]= { (byte) m_dblen }; - byte const tbuf[]= { (byte) m_tbllen }; + uchar const dbuf[]= { (uchar) m_dblen }; + uchar const tbuf[]= { (uchar) m_tbllen }; - char cbuf[sizeof(m_colcnt)]; - char *const cbuf_end= net_store_length((char*) cbuf, (uint) m_colcnt); - DBUG_ASSERT(static_cast<my_size_t>(cbuf_end - cbuf) <= sizeof(cbuf)); + uchar cbuf[sizeof(m_colcnt)]; + uchar *const cbuf_end= net_store_length(cbuf, (size_t) m_colcnt); + DBUG_ASSERT(static_cast<size_t>(cbuf_end - cbuf) <= sizeof(cbuf)); return (my_b_safe_write(file, dbuf, sizeof(dbuf)) || - my_b_safe_write(file, (const byte*)m_dbnam, m_dblen+1) || + my_b_safe_write(file, (const uchar*)m_dbnam, m_dblen+1) || my_b_safe_write(file, tbuf, sizeof(tbuf)) || - my_b_safe_write(file, (const byte*)m_tblnam, m_tbllen+1) || - my_b_safe_write(file, reinterpret_cast<byte*>(cbuf), - cbuf_end - (char*) cbuf) || - my_b_safe_write(file, reinterpret_cast<byte*>(m_coltype), m_colcnt)); + my_b_safe_write(file, (const uchar*)m_tblnam, m_tbllen+1) || + my_b_safe_write(file, cbuf, (size_t) (cbuf_end - cbuf)) || + my_b_safe_write(file, m_coltype, m_colcnt)); } #endif @@ -6659,7 +6664,7 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file) void Table_map_log_event::pack_info(Protocol *protocol) { char buf[256]; - my_size_t bytes= my_snprintf(buf, sizeof(buf), + size_t bytes= my_snprintf(buf, sizeof(buf), "table_id: %lu (%s.%s)", m_table_id, m_dbnam, m_tblnam); protocol->store(buf, bytes, &my_charset_bin); @@ -6771,8 +6776,8 @@ int Write_rows_log_event::do_after_row_operations(TABLE *table, int error) int Write_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli, TABLE *table, - char const *const row_start, - char const **const row_end) + uchar const *const row_start, + uchar const **const row_end) { DBUG_ASSERT(table != NULL); DBUG_ASSERT(row_start && row_end); @@ -6837,7 +6842,7 @@ namespace { */ static int copy_extra_record_fields(TABLE *table, - my_size_t master_reclength, + size_t master_reclength, my_ptrdiff_t master_fields) { DBUG_PRINT("info", ("Copying to 0x%lx " @@ -6979,7 +6984,7 @@ replace_record(THD *thd, TABLE *table, auto_afree_ptr<char> key(NULL); #ifndef DBUG_OFF - DBUG_DUMP("record[0]",(const char *) table->record[0], table->s->reclength); + DBUG_DUMP("record[0]", table->record[0], table->s->reclength); DBUG_PRINT_BITSET("debug", "write_set = %s", table->write_set); DBUG_PRINT_BITSET("debug", "read_set = %s", table->read_set); #endif @@ -7030,9 +7035,9 @@ replace_record(THD *thd, TABLE *table, DBUG_RETURN(ENOMEM); } - key_copy((byte*)key.get(), table->record[0], table->key_info + keynum, 0); + key_copy((uchar*)key.get(), table->record[0], table->key_info + keynum, 0); error= table->file->index_read_idx(table->record[1], keynum, - (const byte*)key.get(), + (const uchar*)key.get(), HA_WHOLE_KEY, HA_READ_KEY_EXACT); if (error) @@ -7130,7 +7135,7 @@ static bool record_compare(TABLE *table) */ bool result= FALSE; - byte saved_x[2], saved_filler[2]; + uchar saved_x[2], saved_filler[2]; if (table->s->null_bytes > 0) { @@ -7213,15 +7218,15 @@ record_compare_exit: <code>table->record[1]</code>, error code otherwise. */ -static int find_and_fetch_row(TABLE *table, byte *key) +static int find_and_fetch_row(TABLE *table, uchar *key) { - DBUG_ENTER("find_and_fetch_row(TABLE *table, byte *key, byte *record)"); + DBUG_ENTER("find_and_fetch_row(TABLE *table, uchar *key, uchar *record)"); DBUG_PRINT("enter", ("table: 0x%lx, key: 0x%lx record: 0x%lx", (long) table, (long) key, (long) table->record[1])); DBUG_ASSERT(table->in_use != NULL); - DBUG_DUMP("record[0]",(const char *) table->record[0], table->s->reclength); + DBUG_DUMP("record[0]", table->record[0], table->s->reclength); if ((table->file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION) && table->s->primary_key < MAX_KEY) @@ -7270,8 +7275,8 @@ static int find_and_fetch_row(TABLE *table, byte *key) trigger false warnings. */ #ifndef HAVE_purify - DBUG_DUMP("table->record[0]", (const char *)table->record[0], table->s->reclength); - DBUG_DUMP("table->record[1]", (const char *)table->record[1], table->s->reclength); + DBUG_DUMP("table->record[0]", table->record[0], table->s->reclength); + DBUG_DUMP("table->record[1]", table->record[1], table->s->reclength); #endif /* @@ -7296,8 +7301,8 @@ static int find_and_fetch_row(TABLE *table, byte *key) trigger false warnings. */ #ifndef HAVE_purify - DBUG_DUMP("table->record[0]", (const char *)table->record[0], table->s->reclength); - DBUG_DUMP("table->record[1]", (const char *)table->record[1], table->s->reclength); + DBUG_DUMP("table->record[0]", table->record[0], table->s->reclength); + DBUG_DUMP("table->record[1]", table->record[1], table->s->reclength); #endif /* Below is a minor "optimization". If the key (i.e., key number @@ -7365,11 +7370,10 @@ static int find_and_fetch_row(TABLE *table, byte *key) { error= table->file->rnd_next(table->record[1]); - DBUG_DUMP("record[0]",(const char *) table->record[0], table->s->reclength); - DBUG_DUMP("record[1]",(const char *) table->record[1], table->s->reclength); + DBUG_DUMP("record[0]", table->record[0], table->s->reclength); + DBUG_DUMP("record[1]", table->record[1], table->s->reclength); - switch (error) - { + switch (error) { case 0: case HA_ERR_RECORD_DELETED: break; @@ -7454,16 +7458,17 @@ int Delete_rows_log_event::do_before_row_operations(TABLE *table) if (table->s->keys > 0) { - m_memory= - my_multi_malloc(MYF(MY_WME), - &m_after_image, table->s->reclength, - &m_key, table->key_info->key_length, - NULL); + m_memory= (uchar*) my_multi_malloc(MYF(MY_WME), + &m_after_image, + (uint) table->s->reclength, + &m_key, + (uint) table->key_info->key_length, + NullS); } else { - m_after_image= (byte*)my_malloc(table->s->reclength, MYF(MY_WME)); - m_memory= (gptr)m_after_image; + m_after_image= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME)); + m_memory= (uchar*)m_after_image; m_key= NULL; } if (!m_memory) @@ -7486,8 +7491,8 @@ int Delete_rows_log_event::do_after_row_operations(TABLE *table, int error) int Delete_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli, TABLE *table, - char const *const row_start, - char const **const row_end) + uchar const *const row_start, + uchar const **const row_end) { int error; DBUG_ASSERT(row_start && row_end); @@ -7626,16 +7631,17 @@ int Update_rows_log_event::do_before_row_operations(TABLE *table) if (table->s->keys > 0) { - m_memory= - my_multi_malloc(MYF(MY_WME), - &m_after_image, table->s->reclength, - &m_key, table->key_info->key_length, - NULL); + m_memory= (uchar*) my_multi_malloc(MYF(MY_WME), + &m_after_image, + (uint) table->s->reclength, + &m_key, + (uint) table->key_info->key_length, + NullS); } else { - m_after_image= (byte*)my_malloc(table->s->reclength, MYF(MY_WME)); - m_memory= (gptr)m_after_image; + m_after_image= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME)); + m_memory= m_after_image; m_key= NULL; } if (!m_memory) @@ -7660,8 +7666,8 @@ int Update_rows_log_event::do_after_row_operations(TABLE *table, int error) int Update_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli, TABLE *table, - char const *const row_start, - char const **const row_end) + uchar const *const row_start, + uchar const **const row_end) { int error; DBUG_ASSERT(row_start && row_end); @@ -7681,7 +7687,7 @@ int Update_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli, error= unpack_row(rli, table, m_width, row_start, &m_cols, row_end, &m_master_reclength, table->read_set, UPDATE_ROWS_EVENT); store_record(table, record[1]); - char const *next_start = *row_end; + uchar const *next_start = *row_end; /* m_after_image is the after image for the update */ error= unpack_row(rli, table, m_width, next_start, &m_cols_ai, row_end, &m_master_reclength, table->write_set, UPDATE_ROWS_EVENT); @@ -7693,8 +7699,8 @@ int Update_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli, trigger false warnings. */ #ifndef HAVE_purify - DBUG_DUMP("record[0]", (const char *)table->record[0], table->s->reclength); - DBUG_DUMP("m_after_image", (const char *)m_after_image, table->s->reclength); + DBUG_DUMP("record[0]", table->record[0], table->s->reclength); + DBUG_DUMP("m_after_image", m_after_image, table->s->reclength); #endif /* @@ -7798,7 +7804,7 @@ Incident_log_event::description() const DBUG_PRINT("info", ("m_incident: %d", m_incident)); DBUG_ASSERT(0 <= m_incident); - DBUG_ASSERT((my_size_t) m_incident <= sizeof(description)/sizeof(*description)); + DBUG_ASSERT((size_t) m_incident <= sizeof(description)/sizeof(*description)); return description[m_incident]; } @@ -7808,7 +7814,7 @@ Incident_log_event::description() const void Incident_log_event::pack_info(Protocol *protocol) { char buf[256]; - my_size_t bytes; + size_t bytes; if (m_message.length > 0) bytes= my_snprintf(buf, sizeof(buf), "#%d (%s)", m_incident, description()); @@ -7852,7 +7858,7 @@ Incident_log_event::write_data_header(IO_CACHE *file) { DBUG_ENTER("Incident_log_event::write_data_header"); DBUG_PRINT("enter", ("m_incident: %d", m_incident)); - byte buf[sizeof(int16)]; + uchar buf[sizeof(int16)]; int2store(buf, (int16) m_incident); DBUG_RETURN(my_b_safe_write(file, buf, sizeof(buf))); } diff --git a/sql/log_event.h b/sql/log_event.h index 4e43822cb38..398bb9ca90f 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -753,7 +753,7 @@ public: static void operator delete(void *ptr, size_t size) { - my_free((gptr) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR)); + my_free((uchar*) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR)); } /* Placement version of the above operators */ @@ -1040,7 +1040,7 @@ public: ~Query_log_event() { if (data_buf) - my_free((gptr) data_buf, MYF(0)); + my_free((uchar*) data_buf, MYF(0)); } Log_event_type get_type_code() { return QUERY_EVENT; } #ifndef MYSQL_CLIENT @@ -1362,7 +1362,7 @@ public: Format_description_log_event(uint8 binlog_ver, const char* server_ver=0); Format_description_log_event(const char* buf, uint event_len, const Format_description_log_event* description_event); - ~Format_description_log_event() { my_free((gptr)post_header_len, MYF(0)); } + ~Format_description_log_event() { my_free((uchar*)post_header_len, MYF(0)); } Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;} #ifndef MYSQL_CLIENT bool write(IO_CACHE* file); @@ -1645,7 +1645,7 @@ public: ~Rotate_log_event() { if (flags & DUP_NAME) - my_free((gptr) new_log_ident, MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) new_log_ident, MYF(MY_ALLOW_ZERO_PTR)); } Log_event_type get_type_code() { return ROTATE_EVENT;} int get_data_size() { return ident_len + ROTATE_HEADER_LEN;} @@ -2069,20 +2069,20 @@ private: #endif #ifndef MYSQL_CLIENT - TABLE *m_table; + TABLE *m_table; #endif char const *m_dbnam; - my_size_t m_dblen; + size_t m_dblen; char const *m_tblnam; - my_size_t m_tbllen; + size_t m_tbllen; ulong m_colcnt; - unsigned char *m_coltype; + uchar *m_coltype; - gptr m_memory; + uchar *m_memory; ulong m_table_id; flag_set m_flags; - my_size_t m_data_size; + size_t m_data_size; }; @@ -2160,7 +2160,7 @@ public: #endif #ifndef MYSQL_CLIENT - int add_row_data(byte *data, my_size_t length) + int add_row_data(uchar *data, size_t length) { return do_add_row_data(data,length); } @@ -2170,7 +2170,7 @@ public: virtual int get_data_size(); MY_BITMAP const *get_cols() const { return &m_cols; } - my_size_t get_width() const { return m_width; } + size_t get_width() const { return m_width; } ulong get_table_id() const { return m_table_id; } #ifndef MYSQL_CLIENT @@ -2209,7 +2209,7 @@ protected: #endif #ifndef MYSQL_CLIENT - virtual int do_add_row_data(byte *data, my_size_t length); + virtual int do_add_row_data(uchar *data, size_t length); #endif #ifndef MYSQL_CLIENT @@ -2233,9 +2233,9 @@ protected: uint32 m_bitbuf[128/(sizeof(uint32)*8)]; uint32 m_bitbuf_ai[128/(sizeof(uint32)*8)]; - byte *m_rows_buf; /* The rows in packed format */ - byte *m_rows_cur; /* One-after the end of the data */ - byte *m_rows_end; /* One-after the end of the allocated space */ + uchar *m_rows_buf; /* The rows in packed format */ + uchar *m_rows_cur; /* One-after the end of the data */ + uchar *m_rows_end; /* One-after the end of the allocated space */ flag_set m_flags; /* Flags for row-level events */ @@ -2293,7 +2293,8 @@ private: Error code, if something went wrong, 0 otherwise. */ virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, - char const *row_start, char const **row_end) = 0; + uchar const *row_start, + uchar const **row_end) = 0; /* Primitive to do the actual execution necessary for a row. @@ -2341,9 +2342,9 @@ public: bool is_transactional, MY_BITMAP *cols, uint fields, - const byte *before_record + const uchar *before_record __attribute__((unused)), - const byte *after_record) + const uchar *after_record) { return thd->binlog_write_row(table, is_transactional, cols, fields, after_record); @@ -2358,13 +2359,13 @@ private: #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - gptr m_memory; - byte *m_after_image; + uchar *m_memory; + uchar *m_after_image; virtual int do_before_row_operations(TABLE *table); virtual int do_after_row_operations(TABLE *table, int error); virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, - char const *row_start, char const **row_end); + uchar const *row_start, uchar const **row_end); virtual int do_exec_row(TABLE *table); #endif }; @@ -2416,8 +2417,8 @@ public: bool is_transactional, MY_BITMAP *cols, uint fields, - const byte *before_record, - const byte *after_record) + const uchar *before_record, + const uchar *after_record) { return thd->binlog_update_row(table, is_transactional, cols, fields, before_record, after_record); @@ -2437,14 +2438,14 @@ protected: #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - gptr m_memory; - byte *m_key; - byte *m_after_image; + uchar *m_memory; + uchar *m_key; + uchar *m_after_image; virtual int do_before_row_operations(TABLE *table); virtual int do_after_row_operations(TABLE *table, int error); virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, - char const *row_start, char const **row_end); + uchar const *row_start, uchar const **row_end); virtual int do_exec_row(TABLE *table); #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ }; @@ -2491,8 +2492,8 @@ public: bool is_transactional, MY_BITMAP *cols, uint fields, - const byte *before_record, - const byte *after_record + const uchar *before_record, + const uchar *after_record __attribute__((unused))) { return thd->binlog_delete_row(table, is_transactional, @@ -2508,14 +2509,14 @@ protected: #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - gptr m_memory; - byte *m_key; - byte *m_after_image; + uchar *m_memory; + uchar *m_key; + uchar *m_after_image; virtual int do_before_row_operations(TABLE *table); virtual int do_after_row_operations(TABLE *table, int error); virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, - char const *row_start, char const **row_end); + uchar const *row_start, uchar const **row_end); virtual int do_exec_row(TABLE *table); #endif }; diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index 5153dff0e55..e6a9dd50c08 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -8,8 +8,8 @@ int Write_rows_log_event_old::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli, TABLE *table, - char const *row_start, - char const **row_end) + uchar const *row_start, + uchar const **row_end) { DBUG_ASSERT(table != NULL); DBUG_ASSERT(row_start && row_end); @@ -28,8 +28,8 @@ int Delete_rows_log_event_old::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli, TABLE *table, - char const *row_start, - char const **row_end) + uchar const *row_start, + uchar const **row_end) { int error; DBUG_ASSERT(row_start && row_end); @@ -61,8 +61,8 @@ Delete_rows_log_event_old::do_prepare_row(THD *thd, int Update_rows_log_event_old::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli, TABLE *table, - char const *row_start, - char const **row_end) + uchar const *row_start, + uchar const **row_end) { int error; DBUG_ASSERT(row_start && row_end); @@ -84,9 +84,8 @@ int Update_rows_log_event_old::do_prepare_row(THD *thd, row_start, &m_cols, row_end, &m_master_reclength, table->write_set, PRE_GA_UPDATE_ROWS_EVENT); - DBUG_DUMP("record[0]", (const char*) table->record[0], table->s->reclength); - DBUG_DUMP("m_after_image", (const char *) m_after_image, table->s->reclength); - + DBUG_DUMP("record[0]", table->record[0], table->s->reclength); + DBUG_DUMP("m_after_image", m_after_image, table->s->reclength); /* If we will access rows using the random access method, m_key will diff --git a/sql/log_event_old.h b/sql/log_event_old.h index 87b11aea3a3..7c2932360f5 100644 --- a/sql/log_event_old.h +++ b/sql/log_event_old.h @@ -50,7 +50,7 @@ private: #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, - char const *row_start, char const **row_end); + uchar const *row_start, uchar const **row_end); #endif }; @@ -84,7 +84,7 @@ private: #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, - char const *row_start, char const **row_end); + uchar const *row_start, uchar const **row_end); #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ }; @@ -118,7 +118,7 @@ private: #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, - char const *row_start, char const **row_end); + uchar const *row_start, uchar const **row_end); #endif }; diff --git a/sql/mf_iocache.cc b/sql/mf_iocache.cc index f237f15dbc9..5d9d6d834b4 100644 --- a/sql/mf_iocache.cc +++ b/sql/mf_iocache.cc @@ -40,8 +40,8 @@ extern "C" { ** Returns 0 if record read */ -int _my_b_net_read(register IO_CACHE *info, byte *Buffer, - uint Count __attribute__((unused))) +int _my_b_net_read(register IO_CACHE *info, uchar *Buffer, + size_t Count __attribute__((unused))) { ulong read_length; NET *net= &(current_thd)->net; @@ -61,7 +61,7 @@ int _my_b_net_read(register IO_CACHE *info, byte *Buffer, DBUG_RETURN(1); } /* to set up stuff for my_b_get (no _) */ - info->read_end = (info->read_pos = (byte*) net->read_pos) + read_length; + info->read_end = (info->read_pos = (uchar*) net->read_pos) + read_length; Buffer[0] = info->read_pos[0]; /* length is always 1 */ /* diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc index 7b2d271639f..66c8d87e2e0 100644 --- a/sql/my_decimal.cc +++ b/sql/my_decimal.cc @@ -118,7 +118,7 @@ int my_decimal2string(uint mask, const my_decimal *d, E_DEC_OVERFLOW */ -int my_decimal2binary(uint mask, const my_decimal *d, char *bin, int prec, +int my_decimal2binary(uint mask, const my_decimal *d, uchar *bin, int prec, int scale) { int err1= E_DEC_OK, err2; @@ -233,7 +233,7 @@ print_decimal(const my_decimal *dec) /* print decimal with its binary representation */ void -print_decimal_buff(const my_decimal *dec, const byte* ptr, int length) +print_decimal_buff(const my_decimal *dec, const uchar* ptr, int length) { print_decimal(dec); fprintf(DBUG_FILE, "Record: "); diff --git a/sql/my_decimal.h b/sql/my_decimal.h index eade029677f..284f6642b74 100644 --- a/sql/my_decimal.h +++ b/sql/my_decimal.h @@ -110,7 +110,7 @@ public: #ifndef DBUG_OFF void print_decimal(const my_decimal *dec); -void print_decimal_buff(const my_decimal *dec, const byte* ptr, int length); +void print_decimal_buff(const my_decimal *dec, const uchar* ptr, int length); const char *dbug_decimal_as_string(char *buff, const my_decimal *val); #else #define dbug_decimal_as_string(A) NULL @@ -200,16 +200,15 @@ void my_decimal2decimal(const my_decimal *from, my_decimal *to) } -int my_decimal2binary(uint mask, const my_decimal *d, char *bin, int prec, +int my_decimal2binary(uint mask, const my_decimal *d, uchar *bin, int prec, int scale); inline -int binary2my_decimal(uint mask, const char *bin, my_decimal *d, int prec, +int binary2my_decimal(uint mask, const uchar *bin, my_decimal *d, int prec, int scale) { - return check_result(mask, bin2decimal((char *)bin, (decimal_t*) d, prec, - scale)); + return check_result(mask, bin2decimal(bin, (decimal_t*) d, prec, scale)); } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index ffe180fd474..a47da122bcc 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -72,16 +72,16 @@ extern const char *primary_key_name; #include "unireg.h" void init_sql_alloc(MEM_ROOT *root, uint block_size, uint pre_alloc_size); -gptr sql_alloc(unsigned size); -gptr sql_calloc(unsigned size); +void *sql_alloc(size_t); +void *sql_calloc(size_t); char *sql_strdup(const char *str); -char *sql_strmake(const char *str,uint len); -gptr sql_memdup(const void * ptr,unsigned size); +char *sql_strmake(const char *str, size_t len); +void *sql_memdup(const void * ptr, size_t size); void sql_element_free(void *ptr); -char *sql_strmake_with_convert(const char *str, uint32 arg_length, +char *sql_strmake_with_convert(const char *str, size_t arg_length, CHARSET_INFO *from_cs, - uint32 max_res_length, - CHARSET_INFO *to_cs, uint32 *result_length); + size_t max_res_length, + CHARSET_INFO *to_cs, size_t *result_length); uint kill_one_thread(THD *thd, ulong id, bool only_kill_query); void sql_kill(THD *thd, ulong id, bool only_kill_query); bool net_request_file(NET* net, const char* fname); @@ -90,15 +90,15 @@ char* query_table_status(THD *thd,const char *db,const char *table_name); void net_set_write_timeout(NET *net, uint timeout); void net_set_read_timeout(NET *net, uint timeout); -#define x_free(A) { my_free((gptr) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); } -#define safeFree(x) { if(x) { my_free((gptr) x,MYF(0)); x = NULL; } } +#define x_free(A) { my_free((uchar*) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); } +#define safeFree(x) { if(x) { my_free((uchar*) x,MYF(0)); x = NULL; } } #define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1)) #define all_bits_set(A,B) ((A) & (B) != (B)) #define WARN_DEPRECATED(Thd,Ver,Old,New) \ do { \ DBUG_ASSERT(strncmp(Ver, MYSQL_SERVER_VERSION, sizeof(Ver)-1) > 0); \ - if (((gptr)Thd) != NULL) \ + if (((uchar*)Thd) != NULL) \ push_warning_printf(((THD *)Thd), MYSQL_ERROR::WARN_LEVEL_WARN, \ ER_WARN_DEPRECATED_SYNTAX, ER(ER_WARN_DEPRECATED_SYNTAX), \ (Old), (Ver), (New)); \ @@ -384,7 +384,7 @@ MY_LOCALE *my_locale_by_number(uint number); #define MODE_NO_KEY_OPTIONS 8192 #define MODE_NO_TABLE_OPTIONS 16384 #define MODE_NO_FIELD_OPTIONS 32768 -#define MODE_MYSQL323 65536 +#define MODE_MYSQL323 65536L #define MODE_MYSQL40 (MODE_MYSQL323*2) #define MODE_ANSI (MODE_MYSQL40*2) #define MODE_NO_AUTO_VALUE_ON_ZERO (MODE_ANSI*2) @@ -399,7 +399,7 @@ MY_LOCALE *my_locale_by_number(uint number); #define MODE_NO_AUTO_CREATE_USER (MODE_TRADITIONAL*2) #define MODE_HIGH_NOT_PRECEDENCE (MODE_NO_AUTO_CREATE_USER*2) #define MODE_NO_ENGINE_SUBSTITUTION (MODE_HIGH_NOT_PRECEDENCE*2) -#define MODE_PAD_CHAR_TO_FULL_LENGTH (MODE_NO_ENGINE_SUBSTITUTION*2) +#define MODE_PAD_CHAR_TO_FULL_LENGTH (ULL(1) << 31) /* Replication uses 8 bytes to store SQL_MODE in the binary log. The day you @@ -500,8 +500,8 @@ class THD; typedef struct st_sql_list { uint elements; - byte *first; - byte **next; + uchar *first; + uchar **next; st_sql_list() {} /* Remove gcc warning */ inline void empty() @@ -510,7 +510,7 @@ typedef struct st_sql_list { first=0; next= &first; } - inline void link_in_list(byte *element,byte **next_ptr) + inline void link_in_list(uchar *element,uchar **next_ptr) { elements++; (*next)=element; @@ -892,9 +892,9 @@ my_bool is_partition_management(LEX *lex); All methods presume that there is at least one field to change. */ -void set_field_ptr(Field **ptr, const byte *new_buf, const byte *old_buf); -void set_key_field_ptr(KEY *key_info, const byte *new_buf, - const byte *old_buf); +void set_field_ptr(Field **ptr, const uchar *new_buf, const uchar *old_buf); +void set_key_field_ptr(KEY *key_info, const uchar *new_buf, + const uchar *old_buf); bool mysql_backup_table(THD* thd, TABLE_LIST* table_list); bool mysql_restore_table(THD* thd, TABLE_LIST* table_list); @@ -1347,11 +1347,11 @@ typedef struct st_lock_param_type KEY *key_info_buffer; const char *db; const char *table_name; - const void *pack_frm_data; + uchar *pack_frm_data; enum thr_lock_type old_lock_type; uint key_count; uint db_options; - uint pack_frm_len; + size_t pack_frm_len; partition_info *part_info; } ALTER_PARTITION_PARAM_TYPE; @@ -1514,16 +1514,16 @@ void print_plan(JOIN* join,uint idx, double record_count, double read_time, #endif void mysql_print_status(); /* key.cc */ -int find_ref_key(KEY *key, uint key_count, byte *record, Field *field, +int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field, uint *key_length, uint *keypart); -void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length); -void key_restore(byte *to_record, byte *from_key, KEY *key_info, +void key_copy(uchar *to_key, uchar *from_record, KEY *key_info, uint key_length); +void key_restore(uchar *to_record, uchar *from_key, KEY *key_info, uint key_length); -bool key_cmp_if_same(TABLE *form,const byte *key,uint index,uint key_length); +bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length); void key_unpack(String *to,TABLE *form,uint index); bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields); -int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length); -int key_rec_cmp(void *key_info, byte *a, byte *b); +int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length); +int key_rec_cmp(void *key_info, uchar *a, uchar *b); bool init_errmessage(void); #endif /* MYSQL_SERVER */ @@ -1548,7 +1548,7 @@ bool slow_log_print(THD *thd, const char *query, uint query_length, bool general_log_print(THD *thd, enum enum_server_command command, const char *format,...); -bool fn_format_relative_to_data_home(my_string to, const char *name, +bool fn_format_relative_to_data_home(char * to, const char *name, const char *dir, const char *extension); #ifdef MYSQL_SERVER File open_binlog(IO_CACHE *log, const char *log_file_name, @@ -1819,8 +1819,8 @@ int rea_create_table(THD *thd, const char *path, List<create_field> &create_field, uint key_count,KEY *key_info, handler *file); -int format_number(uint inputflag,uint max_length,my_string pos,uint length, - my_string *errpos); +int format_number(uint inputflag,uint max_length,char * pos,uint length, + char * *errpos); /* table.cc */ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key, @@ -1833,10 +1833,10 @@ void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg); int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, uint db_stat, uint prgflag, uint ha_open_flags, TABLE *outparam, bool is_create_table); -int readfrm(const char *name, const void** data, uint* length); -int writefrm(const char* name, const void* data, uint len); +int readfrm(const char *name, uchar **data, size_t *length); +int writefrm(const char* name, const uchar* data, size_t len); int closefrm(TABLE *table, bool free_share); -int read_string(File file, gptr *to, uint length); +int read_string(File file, uchar* *to, size_t length); void free_blobs(TABLE *table); int set_zone(int nr,int min_zone,int max_zone); ulong convert_period_to_month(ulong period); @@ -1879,7 +1879,7 @@ void make_time(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time, int my_time_compare(MYSQL_TIME *a, MYSQL_TIME *b); int test_if_number(char *str,int *res,bool allow_wildcards); -void change_byte(byte *,uint,char,char); +void change_byte(uchar *,uint,char,char); void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form, SQL_SELECT *select, int use_record_cache, bool print_errors); @@ -1891,7 +1891,7 @@ ha_rows filesort(THD *thd, TABLE *form,struct st_sort_field *sortorder, ha_rows max_rows, bool sort_positions, ha_rows *examined_rows); void filesort_free_buffers(TABLE *table, bool full); -void change_double_for_sort(double nr,byte *to); +void change_double_for_sort(double nr,uchar *to); double my_double_round(double value, longlong dec, bool dec_unsigned, bool truncate); int get_quick_record(SQL_SELECT *select); @@ -1899,7 +1899,7 @@ int get_quick_record(SQL_SELECT *select); int calc_weekday(long daynr,bool sunday_first_day_of_week); uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year); void find_date(char *pos,uint *vek,uint flag); -TYPELIB *convert_strings_to_array_type(my_string *typelibs, my_string *end); +TYPELIB *convert_strings_to_array_type(char * *typelibs, char * *end); TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings); ulong get_form_pos(File file, uchar *head, TYPELIB *save_names); ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames, @@ -1934,7 +1934,7 @@ uint build_table_filename(char *buff, size_t bufflen, const char *db, /* from hostname.cc */ struct in_addr; -my_string ip_to_hostname(struct in_addr *in,uint *errors); +char * ip_to_hostname(struct in_addr *in,uint *errors); void inc_host_errors(struct in_addr *in); void reset_host_errors(struct in_addr *in); bool hostname_cache_init(); @@ -2098,7 +2098,7 @@ inline bool is_user_table(TABLE * table) #ifndef EMBEDDED_LIBRARY extern "C" void unireg_abort(int exit_code) __attribute__((noreturn)); void kill_delayed_threads(void); -bool check_stack_overrun(THD *thd, long margin, char *dummy); +bool check_stack_overrun(THD *thd, long margin, uchar *dummy); #else #define unireg_abort(exit_code) DBUG_RETURN(exit_code) inline void kill_delayed_threads(void) {} diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 796dc72a98d..7a4601c34fd 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1232,7 +1232,7 @@ void clean_up(bool print_message) if (tc_log) tc_log->close(); xid_cache_free(); - delete_elements(&key_caches, (void (*)(const char*, gptr)) free_key_cache); + delete_elements(&key_caches, (void (*)(const char*, uchar*)) free_key_cache); multi_keycache_free(); free_status_vars(); end_thr_alarm(1); /* Free allocated memory */ @@ -1279,7 +1279,7 @@ void clean_up(bool print_message) #endif thread_scheduler.end(); finish_client_errs(); - my_free((gptr) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST), + my_free((uchar*) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST), MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); DBUG_PRINT("quit", ("Error messages freed")); /* Tell main we are ready */ @@ -2239,7 +2239,7 @@ the thread stack. Please read http://www.mysql.com/doc/en/Linux.html\n\n", if (!(test_flags & TEST_NO_STACKTRACE)) { fprintf(stderr,"thd: 0x%lx\n",(long) thd); - print_stacktrace(thd ? (gptr) thd->thread_stack : (gptr) 0, + print_stacktrace(thd ? (uchar*) thd->thread_stack : (uchar*) 0, thread_stack); } if (thd) @@ -2627,7 +2627,7 @@ static void *my_str_malloc_mysqld(size_t size) static void my_str_free_mysqld(void *ptr) { - my_free((gptr)ptr, MYF(MY_FAE)); + my_free((uchar*)ptr, MYF(MY_FAE)); } #endif /* EMBEDDED_LIBRARY */ @@ -5067,12 +5067,12 @@ enum options_mysqld struct my_option my_long_options[] = { {"help", '?', "Display this help and exit.", - (gptr*) &opt_help, (gptr*) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, + (uchar**) &opt_help, (uchar**) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_REPLICATION {"abort-slave-event-count", OPT_ABORT_SLAVE_EVENT_COUNT, "Option used by mysql-test for debugging and testing of replication.", - (gptr*) &abort_slave_event_count, (gptr*) &abort_slave_event_count, + (uchar**) &abort_slave_event_count, (uchar**) &abort_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_REPLICATION */ {"allow-suspicious-udfs", OPT_ALLOW_SUSPICIOUS_UDFS, @@ -5080,33 +5080,33 @@ struct my_option my_long_options[] = "without corresponding xxx_init() or xxx_deinit(). That also means " "that one can load any function from any library, for example exit() " "from libc.so", - (gptr*) &opt_allow_suspicious_udfs, (gptr*) &opt_allow_suspicious_udfs, + (uchar**) &opt_allow_suspicious_udfs, (uchar**) &opt_allow_suspicious_udfs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax. This mode will also set transaction isolation level 'serializable'.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"auto-increment-increment", OPT_AUTO_INCREMENT, "Auto-increment columns are incremented by this", - (gptr*) &global_system_variables.auto_increment_increment, - (gptr*) &max_system_variables.auto_increment_increment, 0, GET_ULONG, + (uchar**) &global_system_variables.auto_increment_increment, + (uchar**) &max_system_variables.auto_increment_increment, 0, GET_ULONG, OPT_ARG, 1, 1, 65535, 0, 1, 0 }, {"auto-increment-offset", OPT_AUTO_INCREMENT_OFFSET, "Offset added to Auto-increment columns. Used when auto-increment-increment != 1", - (gptr*) &global_system_variables.auto_increment_offset, - (gptr*) &max_system_variables.auto_increment_offset, 0, GET_ULONG, OPT_ARG, + (uchar**) &global_system_variables.auto_increment_offset, + (uchar**) &max_system_variables.auto_increment_offset, 0, GET_ULONG, OPT_ARG, 1, 1, 65535, 0, 1, 0 }, {"automatic-sp-privileges", OPT_SP_AUTOMATIC_PRIVILEGES, "Creating and dropping stored procedures alters ACLs. Disable with --skip-automatic-sp-privileges.", - (gptr*) &sp_automatic_privileges, (gptr*) &sp_automatic_privileges, + (uchar**) &sp_automatic_privileges, (uchar**) &sp_automatic_privileges, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"basedir", 'b', "Path to installation directory. All paths are usually resolved relative to this.", - (gptr*) &mysql_home_ptr, (gptr*) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG, + (uchar**) &mysql_home_ptr, (uchar**) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"big-tables", OPT_BIG_TABLES, "Allow big result sets by saving all temporary sets on file (Solves most 'table full' errors).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.", - (gptr*) &my_bind_addr_str, (gptr*) &my_bind_addr_str, 0, GET_STR, + (uchar**) &my_bind_addr_str, (uchar**) &my_bind_addr_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"binlog_format", OPT_BINLOG_FORMAT, "Does not have any effect without '--log-bin'. " @@ -5120,7 +5120,7 @@ struct my_option my_long_options[] = "If ndbcluster is enabled and binlog_format is `mixed', the format switches" " to 'row' and back implicitly per each query accessing a NDB table." #endif - ,(gptr*) &opt_binlog_format, (gptr*) &opt_binlog_format, + ,(uchar**) &opt_binlog_format, (uchar**) &opt_binlog_format, 0, GET_STR, REQUIRED_ARG, BINLOG_FORMAT_MIXED, BINLOG_FORMAT_STMT, BINLOG_FORMAT_MIXED, 0, 0, 0}, {"binlog-do-db", OPT_BINLOG_DO_DB, @@ -5133,8 +5133,8 @@ struct my_option my_long_options[] = "The maximum size of a row-based binary log event in bytes. Rows will be " "grouped into events smaller than this size if possible. " "The value has to be a multiple of 256.", - (gptr*) &opt_binlog_rows_event_max_size, - (gptr*) &opt_binlog_rows_event_max_size, 0, + (uchar**) &opt_binlog_rows_event_max_size, + (uchar**) &opt_binlog_rows_event_max_size, 0, GET_ULONG, REQUIRED_ARG, /* def_value */ 1024, /* min_value */ 256, /* max_value */ ULONG_MAX, /* sub_size */ 0, /* block_size */ 256, @@ -5146,61 +5146,61 @@ struct my_option my_long_options[] = #endif {"character-set-client-handshake", OPT_CHARACTER_SET_CLIENT_HANDSHAKE, "Don't ignore client side character set value sent during handshake.", - (gptr*) &opt_character_set_client_handshake, - (gptr*) &opt_character_set_client_handshake, + (uchar**) &opt_character_set_client_handshake, + (uchar**) &opt_character_set_client_handshake, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"character-set-filesystem", OPT_CHARACTER_SET_FILESYSTEM, "Set the filesystem character set.", - (gptr*) &character_set_filesystem_name, - (gptr*) &character_set_filesystem_name, + (uchar**) &character_set_filesystem_name, + (uchar**) &character_set_filesystem_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, {"character-set-server", 'C', "Set the default character set.", - (gptr*) &default_character_set_name, (gptr*) &default_character_set_name, + (uchar**) &default_character_set_name, (uchar**) &default_character_set_name, 0, GET_STR, REQUIRED_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}, {"chroot", 'r', "Chroot mysqld daemon during startup.", - (gptr*) &mysqld_chroot, (gptr*) &mysqld_chroot, 0, GET_STR, REQUIRED_ARG, + (uchar**) &mysqld_chroot, (uchar**) &mysqld_chroot, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"collation-server", OPT_DEFAULT_COLLATION, "Set the default collation.", - (gptr*) &default_collation_name, (gptr*) &default_collation_name, + (uchar**) &default_collation_name, (uchar**) &default_collation_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, {"completion-type", OPT_COMPLETION_TYPE, "Default completion type.", - (gptr*) &global_system_variables.completion_type, - (gptr*) &max_system_variables.completion_type, 0, GET_ULONG, + (uchar**) &global_system_variables.completion_type, + (uchar**) &max_system_variables.completion_type, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 2, 0, 1, 0}, {"concurrent-insert", OPT_CONCURRENT_INSERT, "Use concurrent insert with MyISAM. Disable with --concurrent-insert=0", - (gptr*) &myisam_concurrent_insert, (gptr*) &myisam_concurrent_insert, + (uchar**) &myisam_concurrent_insert, (uchar**) &myisam_concurrent_insert, 0, GET_LONG, OPT_ARG, 1, 0, 2, 0, 0, 0}, {"console", OPT_CONSOLE, "Write error output on screen; Don't remove the console window on windows.", - (gptr*) &opt_console, (gptr*) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0, + (uchar**) &opt_console, (uchar**) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"core-file", OPT_WANT_CORE, "Write core on errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"datadir", 'h', "Path to the database root.", (gptr*) &mysql_data_home, - (gptr*) &mysql_data_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"datadir", 'h', "Path to the database root.", (uchar**) &mysql_data_home, + (uchar**) &mysql_data_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifndef DBUG_OFF - {"debug", '#', "Debug log.", (gptr*) &default_dbug_option, - (gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"debug", '#', "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", 'C', "Set the default character set (deprecated option, use --character-set-server instead).", - (gptr*) &default_character_set_name, (gptr*) &default_character_set_name, + (uchar**) &default_character_set_name, (uchar**) &default_character_set_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, {"default-collation", OPT_DEFAULT_COLLATION, "Set the default collation (deprecated option, use --collation-server instead).", - (gptr*) &default_collation_name, (gptr*) &default_collation_name, + (uchar**) &default_collation_name, (uchar**) &default_collation_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, {"default-storage-engine", OPT_STORAGE_ENGINE, "Set the default storage engine (table type) for tables.", - (gptr*)&default_storage_engine_str, (gptr*)&default_storage_engine_str, + (uchar**)&default_storage_engine_str, (uchar**)&default_storage_engine_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"default-table-type", OPT_STORAGE_ENGINE, "(deprecated) Use --default-storage-engine.", - (gptr*)&default_storage_engine_str, (gptr*)&default_storage_engine_str, + (uchar**)&default_storage_engine_str, (uchar**)&default_storage_engine_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"default-time-zone", OPT_DEFAULT_TIME_ZONE, "Set the default time zone.", - (gptr*) &default_tz_name, (gptr*) &default_tz_name, + (uchar**) &default_tz_name, (uchar**) &default_tz_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, {"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE.", 0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, @@ -5210,33 +5210,33 @@ struct my_option my_long_options[] = #ifdef HAVE_OPENSSL {"des-key-file", OPT_DES_KEY_FILE, "Load keys for des_encrypt() and des_encrypt from given file.", - (gptr*) &des_key_file, (gptr*) &des_key_file, 0, GET_STR, REQUIRED_ARG, + (uchar**) &des_key_file, (uchar**) &des_key_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_OPENSSL */ #ifdef HAVE_REPLICATION {"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT, "Option used by mysql-test for debugging and testing of replication.", - (gptr*) &disconnect_slave_event_count, - (gptr*) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, + (uchar**) &disconnect_slave_event_count, + (uchar**) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_REPLICATION */ {"enable-locking", OPT_ENABLE_LOCK, "Deprecated option, use --external-locking instead.", - (gptr*) &opt_external_locking, (gptr*) &opt_external_locking, + (uchar**) &opt_external_locking, (uchar**) &opt_external_locking, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef __NT__ {"enable-named-pipe", OPT_HAVE_NAMED_PIPE, "Enable the named pipe (NT).", - (gptr*) &opt_enable_named_pipe, (gptr*) &opt_enable_named_pipe, 0, GET_BOOL, + (uchar**) &opt_enable_named_pipe, (uchar**) &opt_enable_named_pipe, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"enable-pstack", OPT_DO_PSTACK, "Print a symbolic stack trace on failure.", - (gptr*) &opt_do_pstack, (gptr*) &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0, + (uchar**) &opt_do_pstack, (uchar**) &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"engine-condition-pushdown", OPT_ENGINE_CONDITION_PUSHDOWN, "Push supported query conditions to the storage engine.", - (gptr*) &global_system_variables.engine_condition_pushdown, - (gptr*) &global_system_variables.engine_condition_pushdown, + (uchar**) &global_system_variables.engine_condition_pushdown, + (uchar**) &global_system_variables.engine_condition_pushdown, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, /* See how it's handled in get_one_option() */ {"event-scheduler", OPT_EVENT_SCHEDULER, "Enable/disable the event scheduler.", @@ -5244,7 +5244,7 @@ struct my_option my_long_options[] = {"exit-info", 'T', "Used for debugging; Use at your own risk!", 0, 0, 0, GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"external-locking", OPT_USE_LOCKING, "Use system (external) locking (disabled by default). With this option enabled you can run myisamchk to test (not repair) tables while the MySQL server is running. Disable with --skip-external-locking.", - (gptr*) &opt_external_locking, (gptr*) &opt_external_locking, + (uchar**) &opt_external_locking, (uchar**) &opt_external_locking, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"flush", OPT_FLUSH, "Flush tables to disk between SQL commands.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -5252,50 +5252,50 @@ struct my_option my_long_options[] = easier to do */ {"gdb", OPT_DEBUGGING, "Set up signals usable for debugging", - (gptr*) &opt_debugging, (gptr*) &opt_debugging, + (uchar**) &opt_debugging, (uchar**) &opt_debugging, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"general-log", OPT_GENERAL_LOG, - "Enable|disable general log", (gptr*) &opt_log, - (gptr*) &opt_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, + "Enable|disable general log", (uchar**) &opt_log, + (uchar**) &opt_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_LARGE_PAGES {"large-pages", OPT_ENABLE_LARGE_PAGES, "Enable support for large pages. \ Disable with --skip-large-pages.", - (gptr*) &opt_large_pages, (gptr*) &opt_large_pages, 0, GET_BOOL, NO_ARG, 0, 0, 0, + (uchar**) &opt_large_pages, (uchar**) &opt_large_pages, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"init-connect", OPT_INIT_CONNECT, "Command(s) that are executed for each new connection", - (gptr*) &opt_init_connect, (gptr*) &opt_init_connect, 0, GET_STR_ALLOC, + (uchar**) &opt_init_connect, (uchar**) &opt_init_connect, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifndef DISABLE_GRANT_OPTIONS {"init-file", OPT_INIT_FILE, "Read SQL commands from this file at startup.", - (gptr*) &opt_init_file, (gptr*) &opt_init_file, 0, GET_STR, REQUIRED_ARG, + (uchar**) &opt_init_file, (uchar**) &opt_init_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif {"init-rpl-role", OPT_INIT_RPL_ROLE, "Set the replication role.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"init-slave", OPT_INIT_SLAVE, "Command(s) that are executed when a slave connects to this master", - (gptr*) &opt_init_slave, (gptr*) &opt_init_slave, 0, GET_STR_ALLOC, + (uchar**) &opt_init_slave, (uchar**) &opt_init_slave, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"innodb", OPT_INNODB, "Enable InnoDB (if this version of MySQL supports it). \ Disable with --skip-innodb (will save memory).", - (gptr*) &opt_innodb, (gptr*) &opt_innodb, 0, GET_BOOL, NO_ARG, OPT_INNODB_DEFAULT, 0, 0, + (uchar**) &opt_innodb, (uchar**) &opt_innodb, 0, GET_BOOL, NO_ARG, OPT_INNODB_DEFAULT, 0, 0, 0, 0, 0}, #ifdef WITH_INNOBASE_STORAGE_ENGINE {"innodb_checksums", OPT_INNODB_CHECKSUMS, "Enable InnoDB checksums validation (enabled by default). \ -Disable with --skip-innodb-checksums.", (gptr*) &innobase_use_checksums, - (gptr*) &innobase_use_checksums, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, +Disable with --skip-innodb-checksums.", (uchar**) &innobase_use_checksums, + (uchar**) &innobase_use_checksums, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, #endif {"innodb_data_file_path", OPT_INNODB_DATA_FILE_PATH, "Path to individual files and their sizes.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef WITH_INNOBASE_STORAGE_ENGINE {"innodb_data_home_dir", OPT_INNODB_DATA_HOME_DIR, - "The common part for InnoDB table spaces.", (gptr*) &innobase_data_home_dir, - (gptr*) &innobase_data_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, + "The common part for InnoDB table spaces.", (uchar**) &innobase_data_home_dir, + (uchar**) &innobase_data_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"innodb_doublewrite", OPT_INNODB_DOUBLEWRITE, "Enable InnoDB doublewrite buffer (enabled by default). \ -Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite, - (gptr*) &innobase_use_doublewrite, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, +Disable with --skip-innodb-doublewrite.", (uchar**) &innobase_use_doublewrite, + (uchar**) &innobase_use_doublewrite, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"innodb_fast_shutdown", OPT_INNODB_FAST_SHUTDOWN, "Speeds up the shutdown process of the InnoDB storage engine. Possible " "values are 0, 1 (faster)" @@ -5307,92 +5307,92 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite, " or 2 (fastest - crash-like)" #endif ".", - (gptr*) &innobase_fast_shutdown, - (gptr*) &innobase_fast_shutdown, 0, GET_ULONG, OPT_ARG, 1, 0, + (uchar**) &innobase_fast_shutdown, + (uchar**) &innobase_fast_shutdown, 0, GET_ULONG, OPT_ARG, 1, 0, IF_NETWARE(1,2), 0, 0, 0}, {"innodb_file_per_table", OPT_INNODB_FILE_PER_TABLE, "Stores each InnoDB table to an .ibd file in the database dir.", - (gptr*) &innobase_file_per_table, - (gptr*) &innobase_file_per_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + (uchar**) &innobase_file_per_table, + (uchar**) &innobase_file_per_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"innodb_flush_log_at_trx_commit", OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT, "Set to 0 (write and flush once per second), 1 (write and flush at each commit) or 2 (write at commit, flush once per second).", - (gptr*) &srv_flush_log_at_trx_commit, - (gptr*) &srv_flush_log_at_trx_commit, + (uchar**) &srv_flush_log_at_trx_commit, + (uchar**) &srv_flush_log_at_trx_commit, 0, GET_ULONG, OPT_ARG, 1, 0, 2, 0, 0, 0}, {"innodb_flush_method", OPT_INNODB_FLUSH_METHOD, - "With which method to flush data.", (gptr*) &innobase_unix_file_flush_method, - (gptr*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, + "With which method to flush data.", (uchar**) &innobase_unix_file_flush_method, + (uchar**) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"innodb_locks_unsafe_for_binlog", OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG, "Force InnoDB to not use next-key locking, to use only row-level locking.", - (gptr*) &innobase_locks_unsafe_for_binlog, - (gptr*) &innobase_locks_unsafe_for_binlog, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + (uchar**) &innobase_locks_unsafe_for_binlog, + (uchar**) &innobase_locks_unsafe_for_binlog, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"innodb_log_arch_dir", OPT_INNODB_LOG_ARCH_DIR, - "Where full logs should be archived.", (gptr*) &innobase_log_arch_dir, - (gptr*) &innobase_log_arch_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + "Where full logs should be archived.", (uchar**) &innobase_log_arch_dir, + (uchar**) &innobase_log_arch_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"innodb_log_archive", OPT_INNODB_LOG_ARCHIVE, "Set to 1 if you want to have logs archived.", 0, 0, 0, GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"innodb_log_group_home_dir", OPT_INNODB_LOG_GROUP_HOME_DIR, - "Path to InnoDB log files.", (gptr*) &innobase_log_group_home_dir, - (gptr*) &innobase_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, + "Path to InnoDB log files.", (uchar**) &innobase_log_group_home_dir, + (uchar**) &innobase_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT, - "Percentage of dirty pages allowed in bufferpool.", (gptr*) &srv_max_buf_pool_modified_pct, - (gptr*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0}, + "Percentage of dirty pages allowed in bufferpool.", (uchar**) &srv_max_buf_pool_modified_pct, + (uchar**) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0}, {"innodb_max_purge_lag", OPT_INNODB_MAX_PURGE_LAG, "Desired maximum length of the purge queue (0 = no limit)", - (gptr*) &srv_max_purge_lag, - (gptr*) &srv_max_purge_lag, 0, GET_LONG, REQUIRED_ARG, 0, 0, ~0L, + (uchar**) &srv_max_purge_lag, + (uchar**) &srv_max_purge_lag, 0, GET_LONG, REQUIRED_ARG, 0, 0, ~0L, 0, 1L, 0}, {"innodb_rollback_on_timeout", OPT_INNODB_ROLLBACK_ON_TIMEOUT, "Roll back the complete transaction on lock wait timeout, for 4.x compatibility (disabled by default)", - (gptr*) &innobase_rollback_on_timeout, (gptr*) &innobase_rollback_on_timeout, + (uchar**) &innobase_rollback_on_timeout, (uchar**) &innobase_rollback_on_timeout, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"innodb_status_file", OPT_INNODB_STATUS_FILE, "Enable SHOW INNODB STATUS output in the innodb_status.<pid> file", - (gptr*) &innobase_create_status_file, (gptr*) &innobase_create_status_file, + (uchar**) &innobase_create_status_file, (uchar**) &innobase_create_status_file, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"innodb_stats_on_metadata", OPT_INNODB_STATS_ON_METADATA, "Enable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)", - (gptr*) &innobase_stats_on_metadata, (gptr*) &innobase_stats_on_metadata, + (uchar**) &innobase_stats_on_metadata, (uchar**) &innobase_stats_on_metadata, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"innodb_support_xa", OPT_INNODB_SUPPORT_XA, "Enable InnoDB support for the XA two-phase commit", - (gptr*) &global_system_variables.innodb_support_xa, - (gptr*) &global_system_variables.innodb_support_xa, + (uchar**) &global_system_variables.innodb_support_xa, + (uchar**) &global_system_variables.innodb_support_xa, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"innodb_table_locks", OPT_INNODB_TABLE_LOCKS, "Enable InnoDB locking in LOCK TABLES", - (gptr*) &global_system_variables.innodb_table_locks, - (gptr*) &global_system_variables.innodb_table_locks, + (uchar**) &global_system_variables.innodb_table_locks, + (uchar**) &global_system_variables.innodb_table_locks, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, #endif /* End WITH_INNOBASE_STORAGE_ENGINE */ {"language", 'L', "Client error messages in given language. May be given as a full path.", - (gptr*) &language_ptr, (gptr*) &language_ptr, 0, GET_STR, REQUIRED_ARG, + (uchar**) &language_ptr, (uchar**) &language_ptr, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"lc-time-names", OPT_LC_TIME_NAMES, "Set the language used for the month names and the days of the week.", - (gptr*) &lc_time_names_name, - (gptr*) &lc_time_names_name, + (uchar**) &lc_time_names_name, + (uchar**) &lc_time_names_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, {"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0).", - (gptr*) &opt_local_infile, - (gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG, + (uchar**) &opt_local_infile, + (uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, - {"log", 'l', "Log connections and queries to file.", (gptr*) &opt_logname, - (gptr*) &opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"log", 'l', "Log connections and queries to file.", (uchar**) &opt_logname, + (uchar**) &opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"log-bin", OPT_BIN_LOG, "Log update queries in binary format. Optional (but strongly recommended " "to avoid replication problems if server's hostname changes) argument " "should be the chosen location for the binary log files.", - (gptr*) &opt_bin_logname, (gptr*) &opt_bin_logname, 0, GET_STR_ALLOC, + (uchar**) &opt_bin_logname, (uchar**) &opt_bin_logname, 0, GET_STR_ALLOC, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"log-bin-index", OPT_BIN_LOG_INDEX, "File that holds the names for last binary log files.", - (gptr*) &opt_binlog_index_name, (gptr*) &opt_binlog_index_name, 0, GET_STR, + (uchar**) &opt_binlog_index_name, (uchar**) &opt_binlog_index_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifndef TO_BE_REMOVED_IN_5_1_OR_6_0 /* @@ -5403,7 +5403,7 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite, */ {"log-bin-trust-routine-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS, "(deprecated) Use log-bin-trust-function-creators.", - (gptr*) &trust_function_creators, (gptr*) &trust_function_creators, 0, + (uchar**) &trust_function_creators, (uchar**) &trust_function_creators, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif /* @@ -5417,13 +5417,13 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite, "Note that if ALL connections to this server ALWAYS use row-based binary " "logging, the security issues do not exist and the binary logging cannot " "break, so you can safely set this to 1." - ,(gptr*) &trust_function_creators, (gptr*) &trust_function_creators, 0, + ,(uchar**) &trust_function_creators, (uchar**) &trust_function_creators, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-error", OPT_ERROR_LOG_FILE, "Error log file.", - (gptr*) &log_error_file_ptr, (gptr*) &log_error_file_ptr, 0, GET_STR, + (uchar**) &log_error_file_ptr, (uchar**) &log_error_file_ptr, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file.", - (gptr*) &myisam_log_filename, (gptr*) &myisam_log_filename, 0, GET_STR, + (uchar**) &myisam_log_filename, (uchar**) &myisam_log_filename, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"log-long-format", '0', "Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.", @@ -5432,165 +5432,165 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite, {"log-output", OPT_LOG_OUTPUT, "Syntax: log-output[=value[,value...]], where \"value\" could be TABLE, " "FILE or NONE.", - (gptr*) &log_output_str, (gptr*) &log_output_str, 0, + (uchar**) &log_output_str, (uchar**) &log_output_str, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif {"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES, "Log queries that are executed without benefit of any index to the slow log if it is open.", - (gptr*) &opt_log_queries_not_using_indexes, (gptr*) &opt_log_queries_not_using_indexes, + (uchar**) &opt_log_queries_not_using_indexes, (uchar**) &opt_log_queries_not_using_indexes, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-short-format", OPT_SHORT_LOG_FORMAT, "Don't log extra information to update and slow-query logs.", - (gptr*) &opt_short_log_format, (gptr*) &opt_short_log_format, + (uchar**) &opt_short_log_format, (uchar**) &opt_short_log_format, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-slave-updates", OPT_LOG_SLAVE_UPDATES, "Tells the slave to log the updates from the slave thread to the binary log. You will need to turn it on if you plan to daisy-chain the slaves.", - (gptr*) &opt_log_slave_updates, (gptr*) &opt_log_slave_updates, 0, GET_BOOL, + (uchar**) &opt_log_slave_updates, (uchar**) &opt_log_slave_updates, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-slow-admin-statements", OPT_LOG_SLOW_ADMIN_STATEMENTS, "Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log if it is open.", - (gptr*) &opt_log_slow_admin_statements, - (gptr*) &opt_log_slow_admin_statements, + (uchar**) &opt_log_slow_admin_statements, + (uchar**) &opt_log_slow_admin_statements, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-slow-queries", OPT_SLOW_QUERY_LOG, "Log slow queries to this log file. Defaults logging to hostname-slow.log file. Must be enabled to activate other slow log options.", - (gptr*) &opt_slow_logname, (gptr*) &opt_slow_logname, 0, GET_STR, OPT_ARG, + (uchar**) &opt_slow_logname, (uchar**) &opt_slow_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"log-tc", OPT_LOG_TC, "Path to transaction coordinator log (used for transactions that affect " "more than one storage engine, when binary log is disabled)", - (gptr*) &opt_tc_log_file, (gptr*) &opt_tc_log_file, 0, GET_STR, + (uchar**) &opt_tc_log_file, (uchar**) &opt_tc_log_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_MMAP {"log-tc-size", OPT_LOG_TC_SIZE, "Size of transaction coordinator log.", - (gptr*) &opt_tc_log_size, (gptr*) &opt_tc_log_size, 0, GET_ULONG, + (uchar**) &opt_tc_log_size, (uchar**) &opt_tc_log_size, 0, GET_ULONG, REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, ~0L, 0, TC_LOG_PAGE_SIZE, 0}, #endif {"log-update", OPT_UPDATE_LOG, "The update log is deprecated since version 5.0, is replaced by the binary \ log and this option justs turns on --log-bin instead.", - (gptr*) &opt_update_logname, (gptr*) &opt_update_logname, 0, GET_STR, + (uchar**) &opt_update_logname, (uchar**) &opt_update_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"log-warnings", 'W', "Log some not critical warnings to the log file.", - (gptr*) &global_system_variables.log_warnings, - (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0, + (uchar**) &global_system_variables.log_warnings, + (uchar**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"low-priority-updates", OPT_LOW_PRIORITY_UPDATES, "INSERT/DELETE/UPDATE has lower priority than selects.", - (gptr*) &global_system_variables.low_priority_updates, - (gptr*) &max_system_variables.low_priority_updates, + (uchar**) &global_system_variables.low_priority_updates, + (uchar**) &max_system_variables.low_priority_updates, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"master-connect-retry", OPT_MASTER_CONNECT_RETRY, "The number of seconds the slave thread will sleep before retrying to connect to the master in case the master goes down or the connection is lost.", - (gptr*) &master_connect_retry, (gptr*) &master_connect_retry, 0, GET_UINT, + (uchar**) &master_connect_retry, (uchar**) &master_connect_retry, 0, GET_UINT, REQUIRED_ARG, 60, 0, 0, 0, 0, 0}, {"master-host", OPT_MASTER_HOST, "Master hostname or IP address for replication. If not set, the slave thread will not be started. Note that the setting of master-host will be ignored if there exists a valid master.info file.", - (gptr*) &master_host, (gptr*) &master_host, 0, GET_STR, REQUIRED_ARG, 0, 0, + (uchar**) &master_host, (uchar**) &master_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"master-info-file", OPT_MASTER_INFO_FILE, "The location and name of the file that remembers the master and where the I/O replication \ thread is in the master's binlogs.", - (gptr*) &master_info_file, (gptr*) &master_info_file, 0, GET_STR, + (uchar**) &master_info_file, (uchar**) &master_info_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"master-password", OPT_MASTER_PASSWORD, "The password the slave thread will authenticate with when connecting to the master. If not set, an empty password is assumed.The value in master.info will take precedence if it can be read.", - (gptr*)&master_password, (gptr*)&master_password, 0, + (uchar**)&master_password, (uchar**)&master_password, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"master-port", OPT_MASTER_PORT, "The port the master is listening on. If not set, the compiled setting of MYSQL_PORT is assumed. If you have not tinkered with configure options, this should be 3306. The value in master.info will take precedence if it can be read.", - (gptr*) &master_port, (gptr*) &master_port, 0, GET_UINT, REQUIRED_ARG, + (uchar**) &master_port, (uchar**) &master_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, {"master-retry-count", OPT_MASTER_RETRY_COUNT, "The number of tries the slave will make to connect to the master before giving up.", - (gptr*) &master_retry_count, (gptr*) &master_retry_count, 0, GET_ULONG, + (uchar**) &master_retry_count, (uchar**) &master_retry_count, 0, GET_ULONG, REQUIRED_ARG, 3600*24, 0, 0, 0, 0, 0}, {"master-ssl", OPT_MASTER_SSL, "Enable the slave to connect to the master using SSL.", - (gptr*) &master_ssl, (gptr*) &master_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, + (uchar**) &master_ssl, (uchar**) &master_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"master-ssl-ca", OPT_MASTER_SSL_CA, "Master SSL CA file. Only applies if you have enabled master-ssl.", - (gptr*) &master_ssl_ca, (gptr*) &master_ssl_ca, 0, GET_STR, OPT_ARG, + (uchar**) &master_ssl_ca, (uchar**) &master_ssl_ca, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"master-ssl-capath", OPT_MASTER_SSL_CAPATH, "Master SSL CA path. Only applies if you have enabled master-ssl.", - (gptr*) &master_ssl_capath, (gptr*) &master_ssl_capath, 0, GET_STR, OPT_ARG, + (uchar**) &master_ssl_capath, (uchar**) &master_ssl_capath, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"master-ssl-cert", OPT_MASTER_SSL_CERT, "Master SSL certificate file name. Only applies if you have enabled \ master-ssl", - (gptr*) &master_ssl_cert, (gptr*) &master_ssl_cert, 0, GET_STR, OPT_ARG, + (uchar**) &master_ssl_cert, (uchar**) &master_ssl_cert, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"master-ssl-cipher", OPT_MASTER_SSL_CIPHER, "Master SSL cipher. Only applies if you have enabled master-ssl.", - (gptr*) &master_ssl_cipher, (gptr*) &master_ssl_capath, 0, GET_STR, OPT_ARG, + (uchar**) &master_ssl_cipher, (uchar**) &master_ssl_capath, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"master-ssl-key", OPT_MASTER_SSL_KEY, "Master SSL keyfile name. Only applies if you have enabled master-ssl.", - (gptr*) &master_ssl_key, (gptr*) &master_ssl_key, 0, GET_STR, OPT_ARG, + (uchar**) &master_ssl_key, (uchar**) &master_ssl_key, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"master-user", OPT_MASTER_USER, "The username the slave thread will use for authentication when connecting to the master. The user must have FILE privilege. If the master user is not set, user test is assumed. The value in master.info will take precedence if it can be read.", - (gptr*) &master_user, (gptr*) &master_user, 0, GET_STR, REQUIRED_ARG, 0, 0, + (uchar**) &master_user, (uchar**) &master_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_REPLICATION {"max-binlog-dump-events", OPT_MAX_BINLOG_DUMP_EVENTS, "Option used by mysql-test for debugging and testing of replication.", - (gptr*) &max_binlog_dump_events, (gptr*) &max_binlog_dump_events, 0, + (uchar**) &max_binlog_dump_events, (uchar**) &max_binlog_dump_events, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_REPLICATION */ - {"memlock", OPT_MEMLOCK, "Lock mysqld in memory.", (gptr*) &locked_in_memory, - (gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"memlock", OPT_MEMLOCK, "Lock mysqld in memory.", (uchar**) &locked_in_memory, + (uchar**) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"myisam-recover", OPT_MYISAM_RECOVER, "Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.", - (gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0, + (uchar**) &myisam_recover_options_str, (uchar**) &myisam_recover_options_str, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"ndbcluster", OPT_NDBCLUSTER, "Enable NDB Cluster (if this version of MySQL supports it). \ Disable with --skip-ndbcluster (will save memory).", - (gptr*) &opt_ndbcluster, (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, + (uchar**) &opt_ndbcluster, (uchar**) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, OPT_NDBCLUSTER_DEFAULT, 0, 0, 0, 0, 0}, #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE {"ndb-connectstring", OPT_NDB_CONNECTSTRING, "Connect string for ndbcluster.", - (gptr*) &opt_ndb_connectstring, - (gptr*) &opt_ndb_connectstring, + (uchar**) &opt_ndb_connectstring, + (uchar**) &opt_ndb_connectstring, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ndb-mgmd-host", OPT_NDB_MGMD, "Set host and port for ndb_mgmd. Syntax: hostname[:port]", - (gptr*) &opt_ndb_mgmd, - (gptr*) &opt_ndb_mgmd, + (uchar**) &opt_ndb_mgmd, + (uchar**) &opt_ndb_mgmd, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ndb-nodeid", OPT_NDB_NODEID, "Nodeid for this mysqlserver in the cluster.", - (gptr*) &opt_ndb_nodeid, - (gptr*) &opt_ndb_nodeid, + (uchar**) &opt_ndb_nodeid, + (uchar**) &opt_ndb_nodeid, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ndb-autoincrement-prefetch-sz", OPT_NDB_AUTOINCREMENT_PREFETCH_SZ, "Specify number of autoincrement values that are prefetched.", - (gptr*) &global_system_variables.ndb_autoincrement_prefetch_sz, - (gptr*) &global_system_variables.ndb_autoincrement_prefetch_sz, + (uchar**) &global_system_variables.ndb_autoincrement_prefetch_sz, + (uchar**) &global_system_variables.ndb_autoincrement_prefetch_sz, 0, GET_ULONG, REQUIRED_ARG, 32, 1, 256, 0, 0, 0}, {"ndb-distribution", OPT_NDB_DISTRIBUTION, "Default distribution for new tables in ndb", - (gptr*) &opt_ndb_distribution, - (gptr*) &opt_ndb_distribution, + (uchar**) &opt_ndb_distribution, + (uchar**) &opt_ndb_distribution, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ndb-force-send", OPT_NDB_FORCE_SEND, "Force send of buffers to ndb immediately without waiting for " "other threads.", - (gptr*) &global_system_variables.ndb_force_send, - (gptr*) &global_system_variables.ndb_force_send, + (uchar**) &global_system_variables.ndb_force_send, + (uchar**) &global_system_variables.ndb_force_send, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"ndb_force_send", OPT_NDB_FORCE_SEND, "same as --ndb-force-send.", - (gptr*) &global_system_variables.ndb_force_send, - (gptr*) &global_system_variables.ndb_force_send, + (uchar**) &global_system_variables.ndb_force_send, + (uchar**) &global_system_variables.ndb_force_send, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"ndb-extra-logging", OPT_NDB_EXTRA_LOGGING, "Turn on more logging in the error log.", - (gptr*) &ndb_extra_logging, - (gptr*) &ndb_extra_logging, + (uchar**) &ndb_extra_logging, + (uchar**) &ndb_extra_logging, 0, GET_INT, OPT_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_NDB_BINLOG {"ndb-report-thresh-binlog-epoch-slip", OPT_NDB_REPORT_THRESH_BINLOG_EPOCH_SLIP, @@ -5598,113 +5598,113 @@ Disable with --skip-ndbcluster (will save memory).", "E.g. 3 means that if the difference between what epoch has been received " "from the storage nodes and what has been applied to the binlog is 3 or more, " "a status message will be sent to the cluster log.", - (gptr*) &ndb_report_thresh_binlog_epoch_slip, - (gptr*) &ndb_report_thresh_binlog_epoch_slip, + (uchar**) &ndb_report_thresh_binlog_epoch_slip, + (uchar**) &ndb_report_thresh_binlog_epoch_slip, 0, GET_ULONG, REQUIRED_ARG, 3, 0, 256, 0, 0, 0}, {"ndb-report-thresh-binlog-mem-usage", OPT_NDB_REPORT_THRESH_BINLOG_MEM_USAGE, "Threshold on percentage of free memory before reporting binlog status. E.g. " "10 means that if amount of available memory for receiving binlog data from " "the storage nodes goes below 10%, " "a status message will be sent to the cluster log.", - (gptr*) &ndb_report_thresh_binlog_mem_usage, - (gptr*) &ndb_report_thresh_binlog_mem_usage, + (uchar**) &ndb_report_thresh_binlog_mem_usage, + (uchar**) &ndb_report_thresh_binlog_mem_usage, 0, GET_ULONG, REQUIRED_ARG, 10, 0, 100, 0, 0, 0}, #endif {"ndb-use-exact-count", OPT_NDB_USE_EXACT_COUNT, "Use exact records count during query planning and for fast " "select count(*), disable for faster queries.", - (gptr*) &global_system_variables.ndb_use_exact_count, - (gptr*) &global_system_variables.ndb_use_exact_count, + (uchar**) &global_system_variables.ndb_use_exact_count, + (uchar**) &global_system_variables.ndb_use_exact_count, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"ndb_use_exact_count", OPT_NDB_USE_EXACT_COUNT, "same as --ndb-use-exact-count.", - (gptr*) &global_system_variables.ndb_use_exact_count, - (gptr*) &global_system_variables.ndb_use_exact_count, + (uchar**) &global_system_variables.ndb_use_exact_count, + (uchar**) &global_system_variables.ndb_use_exact_count, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"ndb-use-transactions", OPT_NDB_USE_TRANSACTIONS, "Use transactions for large inserts, if enabled then large " "inserts will be split into several smaller transactions", - (gptr*) &global_system_variables.ndb_use_transactions, - (gptr*) &global_system_variables.ndb_use_transactions, + (uchar**) &global_system_variables.ndb_use_transactions, + (uchar**) &global_system_variables.ndb_use_transactions, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"ndb_use_transactions", OPT_NDB_USE_TRANSACTIONS, "same as --ndb-use-transactions.", - (gptr*) &global_system_variables.ndb_use_transactions, - (gptr*) &global_system_variables.ndb_use_transactions, + (uchar**) &global_system_variables.ndb_use_transactions, + (uchar**) &global_system_variables.ndb_use_transactions, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"ndb-shm", OPT_NDB_SHM, "Use shared memory connections when available.", - (gptr*) &opt_ndb_shm, - (gptr*) &opt_ndb_shm, + (uchar**) &opt_ndb_shm, + (uchar**) &opt_ndb_shm, 0, GET_BOOL, OPT_ARG, OPT_NDB_SHM_DEFAULT, 0, 0, 0, 0, 0}, {"ndb-optimized-node-selection", OPT_NDB_OPTIMIZED_NODE_SELECTION, "Select nodes for transactions in a more optimal way.", - (gptr*) &opt_ndb_optimized_node_selection, - (gptr*) &opt_ndb_optimized_node_selection, + (uchar**) &opt_ndb_optimized_node_selection, + (uchar**) &opt_ndb_optimized_node_selection, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, { "ndb-cache-check-time", OPT_NDB_CACHE_CHECK_TIME, "A dedicated thread is created to, at the given millisecons interval, invalidate the query cache if another MySQL server in the cluster has changed the data in the database.", - (gptr*) &opt_ndb_cache_check_time, (gptr*) &opt_ndb_cache_check_time, 0, GET_ULONG, REQUIRED_ARG, + (uchar**) &opt_ndb_cache_check_time, (uchar**) &opt_ndb_cache_check_time, 0, GET_ULONG, REQUIRED_ARG, 0, 0, LONG_TIMEOUT, 0, 1, 0}, {"ndb-index-stat-enable", OPT_NDB_INDEX_STAT_ENABLE, "Use ndb index statistics in query optimization.", - (gptr*) &global_system_variables.ndb_index_stat_enable, - (gptr*) &max_system_variables.ndb_index_stat_enable, + (uchar**) &global_system_variables.ndb_index_stat_enable, + (uchar**) &max_system_variables.ndb_index_stat_enable, 0, GET_BOOL, OPT_ARG, 0, 0, 1, 0, 0, 0}, #endif {"ndb-use-copying-alter-table", OPT_NDB_USE_COPYING_ALTER_TABLE, "Force ndbcluster to always copy tables at alter table (should only be used if on-line alter table fails).", - (gptr*) &global_system_variables.ndb_use_copying_alter_table, - (gptr*) &global_system_variables.ndb_use_copying_alter_table, + (uchar**) &global_system_variables.ndb_use_copying_alter_table, + (uchar**) &global_system_variables.ndb_use_copying_alter_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"new", 'n', "Use very new possible 'unsafe' functions.", - (gptr*) &global_system_variables.new_mode, - (gptr*) &max_system_variables.new_mode, + (uchar**) &global_system_variables.new_mode, + (uchar**) &max_system_variables.new_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef NOT_YET {"no-mix-table-types", OPT_NO_MIX_TYPE, "Don't allow commands with uses two different table types.", - (gptr*) &opt_no_mix_types, (gptr*) &opt_no_mix_types, 0, GET_BOOL, NO_ARG, + (uchar**) &opt_no_mix_types, (uchar**) &opt_no_mix_types, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"old-alter-table", OPT_OLD_ALTER_TABLE, "Use old, non-optimized alter table.", - (gptr*) &global_system_variables.old_alter_table, - (gptr*) &max_system_variables.old_alter_table, 0, GET_BOOL, NO_ARG, + (uchar**) &global_system_variables.old_alter_table, + (uchar**) &max_system_variables.old_alter_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"old-passwords", OPT_OLD_PASSWORDS, "Use old password encryption method (needed for 4.0 and older clients).", - (gptr*) &global_system_variables.old_passwords, - (gptr*) &max_system_variables.old_passwords, 0, GET_BOOL, NO_ARG, + (uchar**) &global_system_variables.old_passwords, + (uchar**) &max_system_variables.old_passwords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"one-thread", OPT_ONE_THREAD, "(deprecated): Only use one thread (for debugging under Linux). Use thread-handling=no-threads instead", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"old-style-user-limits", OPT_OLD_STYLE_USER_LIMITS, "Enable old-style user limits (before 5.0.3 user resources were counted per each user+host vs. per account)", - (gptr*) &opt_old_style_user_limits, (gptr*) &opt_old_style_user_limits, + (uchar**) &opt_old_style_user_limits, (uchar**) &opt_old_style_user_limits, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"pid-file", OPT_PID_FILE, "Pid file used by safe_mysqld.", - (gptr*) &pidfile_name_ptr, (gptr*) &pidfile_name_ptr, 0, GET_STR, + (uchar**) &pidfile_name_ptr, (uchar**) &pidfile_name_ptr, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"port", 'P', "Port number to use for connection.", (gptr*) &mysqld_port, - (gptr*) &mysqld_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"port", 'P', "Port number to use for connection.", (uchar**) &mysqld_port, + (uchar**) &mysqld_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port-open-timeout", OPT_PORT_OPEN_TIMEOUT, "Maximum time in seconds to wait for the port to become free. " - "(Default: no wait)", (gptr*) &mysqld_port_timeout, - (gptr*) &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + "(Default: no wait)", (uchar**) &mysqld_port_timeout, + (uchar**) &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"relay-log", OPT_RELAY_LOG, "The location and name to use for relay logs.", - (gptr*) &opt_relay_logname, (gptr*) &opt_relay_logname, 0, + (uchar**) &opt_relay_logname, (uchar**) &opt_relay_logname, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"relay-log-index", OPT_RELAY_LOG_INDEX, "The location and name to use for the file that keeps a list of the last \ relay logs.", - (gptr*) &opt_relaylog_index_name, (gptr*) &opt_relaylog_index_name, 0, + (uchar**) &opt_relaylog_index_name, (uchar**) &opt_relaylog_index_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE, "The location and name of the file that remembers where the SQL replication \ thread is in the relay logs.", - (gptr*) &relay_log_info_file, (gptr*) &relay_log_info_file, 0, GET_STR, + (uchar**) &relay_log_info_file, (uchar**) &relay_log_info_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"replicate-do-db", OPT_REPLICATE_DO_DB, "Tells the slave thread to restrict replication to the specified database. To specify more than one database, use the directive multiple times, once for each database. Note that this will only work if you do not use cross-database queries such as UPDATE some_db.some_table SET foo='bar' while having selected a different or no database. If you need cross database updates to work, make sure you have 3.23.28 or later, and use replicate-wild-do-table=db_name.%.", @@ -5726,8 +5726,8 @@ thread is in the relay logs.", "In replication, if set to 1, do not skip events having our server id. \ Default value is 0 (to break infinite loops in circular replication). \ Can't be set to 1 if --log-slave-updates is used.", - (gptr*) &replicate_same_server_id, - (gptr*) &replicate_same_server_id, + (uchar**) &replicate_same_server_id, + (uchar**) &replicate_same_server_id, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"replicate-wild-do-table", OPT_REPLICATE_WILD_DO_TABLE, @@ -5739,19 +5739,19 @@ Can't be set to 1 if --log-slave-updates is used.", // In replication, we may need to tell the other servers how to connect {"report-host", OPT_REPORT_HOST, "Hostname or IP of the slave to be reported to to the master during slave registration. Will appear in the output of SHOW SLAVE HOSTS. Leave unset if you do not want the slave to register itself with the master. Note that it is not sufficient for the master to simply read the IP of the slave off the socket once the slave connects. Due to NAT and other routing issues, that IP may not be valid for connecting to the slave from the master or other hosts.", - (gptr*) &report_host, (gptr*) &report_host, 0, GET_STR, REQUIRED_ARG, 0, 0, + (uchar**) &report_host, (uchar**) &report_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"report-password", OPT_REPORT_PASSWORD, "Undocumented.", - (gptr*) &report_password, (gptr*) &report_password, 0, GET_STR, + (uchar**) &report_password, (uchar**) &report_password, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"report-port", OPT_REPORT_PORT, "Port for connecting to slave reported to the master during slave registration. Set it only if the slave is listening on a non-default port or if you have a special tunnel from the master or other clients to the slave. If not sure, leave this option unset.", - (gptr*) &report_port, (gptr*) &report_port, 0, GET_UINT, REQUIRED_ARG, + (uchar**) &report_port, (uchar**) &report_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, - {"report-user", OPT_REPORT_USER, "Undocumented.", (gptr*) &report_user, - (gptr*) &report_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"report-user", OPT_REPORT_USER, "Undocumented.", (uchar**) &report_user, + (uchar**) &report_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"rpl-recovery-rank", OPT_RPL_RECOVERY_RANK, "Undocumented.", - (gptr*) &rpl_recovery_rank, (gptr*) &rpl_recovery_rank, 0, GET_ULONG, + (uchar**) &rpl_recovery_rank, (uchar**) &rpl_recovery_rank, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -5762,43 +5762,43 @@ Can't be set to 1 if --log-slave-updates is used.", #endif {"safe-user-create", OPT_SAFE_USER_CREATE, "Don't allow new user creation by the user who has no write privileges to the mysql.user table.", - (gptr*) &opt_safe_user_create, (gptr*) &opt_safe_user_create, 0, GET_BOOL, + (uchar**) &opt_safe_user_create, (uchar**) &opt_safe_user_create, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT, "Simulate memory shortage when compiled with the --with-debug=full option.", 0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"secure-auth", OPT_SECURE_AUTH, "Disallow authentication for accounts that have old (pre-4.1) passwords.", - (gptr*) &opt_secure_auth, (gptr*) &opt_secure_auth, 0, GET_BOOL, NO_ARG, + (uchar**) &opt_secure_auth, (uchar**) &opt_secure_auth, 0, GET_BOOL, NO_ARG, my_bool(0), 0, 0, 0, 0, 0}, {"secure-file-priv", OPT_SECURE_FILE_PRIV, "Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files within specified directory", - (gptr*) &opt_secure_file_priv, (gptr*) &opt_secure_file_priv, 0, + (uchar**) &opt_secure_file_priv, (uchar**) &opt_secure_file_priv, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"server-id", OPT_SERVER_ID, "Uniquely identifies the server instance in the community of replication partners.", - (gptr*) &server_id, (gptr*) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, + (uchar**) &server_id, (uchar**) &server_id, 0, GET_ULONG, REQUIRED_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", OPT_ENABLE_SHARED_MEMORY, - "Enable the shared memory.",(gptr*) &opt_enable_shared_memory, (gptr*) &opt_enable_shared_memory, + "Enable the shared memory.",(uchar**) &opt_enable_shared_memory, (uchar**) &opt_enable_shared_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif #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, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif {"show-slave-auth-info", OPT_SHOW_SLAVE_AUTH_INFO, "Show user and password in SHOW SLAVE HOSTS on this master", - (gptr*) &opt_show_slave_auth_info, (gptr*) &opt_show_slave_auth_info, 0, + (uchar**) &opt_show_slave_auth_info, (uchar**) &opt_show_slave_auth_info, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifndef DISABLE_GRANT_OPTIONS {"skip-grant-tables", OPT_SKIP_GRANT, "Start without grant tables. This gives all users FULL ACCESS to all tables!", - (gptr*) &opt_noacl, (gptr*) &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, + (uchar**) &opt_noacl, (uchar**) &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names.", 0, 0, 0, @@ -5825,8 +5825,8 @@ Can't be set to 1 if --log-slave-updates is used.", "Don't allow 'SHOW DATABASE' commands.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip-slave-start", OPT_SKIP_SLAVE_START, - "If set, slave is not autostarted.", (gptr*) &opt_skip_slave_start, - (gptr*) &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + "If set, slave is not autostarted.", (uchar**) &opt_skip_slave_start, + (uchar**) &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip-stack-trace", OPT_SKIP_STACK_TRACE, "Don't print a stack trace on failure.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -5839,23 +5839,23 @@ Can't be set to 1 if --log-slave-updates is used.", {"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR, "The location where the slave should put its temporary files when \ replicating a LOAD DATA INFILE command.", - (gptr*) &slave_load_tmpdir, (gptr*) &slave_load_tmpdir, 0, GET_STR_ALLOC, + (uchar**) &slave_load_tmpdir, (uchar**) &slave_load_tmpdir, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS, "Tells the slave thread to continue replication when a query returns an error from the provided list.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif {"slow-query-log", OPT_SLOW_LOG, - "Enable|disable slow query log", (gptr*) &opt_slow_log, - (gptr*) &opt_slow_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, + "Enable|disable slow query log", (uchar**) &opt_slow_log, + (uchar**) &opt_slow_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"socket", OPT_SOCKET, "Socket file to use for connection.", - (gptr*) &mysqld_unix_port, (gptr*) &mysqld_unix_port, 0, GET_STR, + (uchar**) &mysqld_unix_port, (uchar**) &mysqld_unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_REPLICATION {"sporadic-binlog-dump-fail", OPT_SPORADIC_BINLOG_DUMP_FAIL, "Option used by mysql-test for debugging and testing of replication.", - (gptr*) &opt_sporadic_binlog_dump_fail, - (gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, + (uchar**) &opt_sporadic_binlog_dump_fail, + (uchar**) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_REPLICATION */ {"sql-bin-update-same", OPT_SQL_BIN_UPDATE_SAME, @@ -5864,7 +5864,7 @@ log and this option does nothing anymore.", 0, 0, 0, GET_DISABLED, NO_ARG, 0, 0, 0, 0, 0, 0}, {"sql-mode", OPT_SQL_MODE, "Syntax: sql-mode=option[,option[,option...]] where option can be one of: REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, ONLY_FULL_GROUP_BY, NO_UNSIGNED_SUBTRACTION.", - (gptr*) &sql_mode_str, (gptr*) &sql_mode_str, 0, GET_STR, REQUIRED_ARG, 0, + (uchar**) &sql_mode_str, (uchar**) &sql_mode_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_OPENSSL #include "sslopt-longopts.h" @@ -5875,7 +5875,7 @@ log and this option does nothing anymore.", NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"symbolic-links", 's', "Enable symbolic link support.", - (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, + (uchar**) &my_use_symdir, (uchar**) &my_use_symdir, 0, GET_BOOL, NO_ARG, /* The system call realpath() produces warnings under valgrind and purify. These are not suppressed: instead we disable symlinks @@ -5884,19 +5884,19 @@ log and this option does nothing anymore.", IF_PURIFY(0,1), 0, 0, 0, 0, 0}, {"sysdate-is-now", OPT_SYSDATE_IS_NOW, "Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. Since 5.0, SYSDATE() returns a `dynamic' value different for different invocations, even within the same statement.", - (gptr*) &global_system_variables.sysdate_is_now, + (uchar**) &global_system_variables.sysdate_is_now, 0, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, {"tc-heuristic-recover", OPT_TC_HEURISTIC_RECOVER, "Decision to use in heuristic recover process. Possible values are COMMIT or ROLLBACK.", - (gptr*) &opt_tc_heuristic_recover, (gptr*) &opt_tc_heuristic_recover, + (uchar**) &opt_tc_heuristic_recover, (uchar**) &opt_tc_heuristic_recover, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"temp-pool", OPT_TEMP_POOL, "Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file.", - (gptr*) &use_temp_pool, (gptr*) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1, + (uchar**) &use_temp_pool, (uchar**) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"timed_mutexes", OPT_TIMED_MUTEXES, "Specify whether to time mutexes (only InnoDB mutexes are currently supported)", - (gptr*) &timed_mutexes, (gptr*) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0, + (uchar**) &timed_mutexes, (uchar**) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"tmpdir", 't', "Path for temporary files. Several paths may be specified, separated by a " @@ -5906,83 +5906,83 @@ log and this option does nothing anymore.", "colon (:)" #endif ", in this case they are used in a round-robin fashion.", - (gptr*) &opt_mysql_tmpdir, - (gptr*) &opt_mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + (uchar**) &opt_mysql_tmpdir, + (uchar**) &opt_mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"transaction-isolation", OPT_TX_ISOLATION, "Default transaction isolation level.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"use-symbolic-links", 's', "Enable symbolic link support. Deprecated option; use --symbolic-links instead.", - (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, + (uchar**) &my_use_symdir, (uchar**) &my_use_symdir, 0, GET_BOOL, NO_ARG, IF_PURIFY(0,1), 0, 0, 0, 0, 0}, {"user", 'u', "Run mysqld daemon as user.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"verbose", 'v', "Used with --help option for detailed help", - (gptr*) &opt_verbose, (gptr*) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, + (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}, {"warnings", 'W', "Deprecated; use --log-warnings instead.", - (gptr*) &global_system_variables.log_warnings, - (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, ~0L, + (uchar**) &global_system_variables.log_warnings, + (uchar**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, ~0L, 0, 0, 0}, { "back_log", OPT_BACK_LOG, "The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.", - (gptr*) &back_log, (gptr*) &back_log, 0, GET_ULONG, + (uchar**) &back_log, (uchar**) &back_log, 0, GET_ULONG, REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 }, {"binlog_cache_size", OPT_BINLOG_CACHE_SIZE, "The size of the cache to hold the SQL statements for the binary log during a transaction. If you often use big, multi-statement transactions you can increase this to get more performance.", - (gptr*) &binlog_cache_size, (gptr*) &binlog_cache_size, 0, GET_ULONG, + (uchar**) &binlog_cache_size, (uchar**) &binlog_cache_size, 0, GET_ULONG, REQUIRED_ARG, 32*1024L, IO_SIZE, ~0L, 0, IO_SIZE, 0}, {"bulk_insert_buffer_size", OPT_BULK_INSERT_BUFFER_SIZE, "Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread!", - (gptr*) &global_system_variables.bulk_insert_buff_size, - (gptr*) &max_system_variables.bulk_insert_buff_size, + (uchar**) &global_system_variables.bulk_insert_buff_size, + (uchar**) &max_system_variables.bulk_insert_buff_size, 0, GET_ULONG, REQUIRED_ARG, 8192*1024, 0, ~0L, 0, 1, 0}, {"connect_timeout", OPT_CONNECT_TIMEOUT, "The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake'.", - (gptr*) &connect_timeout, (gptr*) &connect_timeout, + (uchar**) &connect_timeout, (uchar**) &connect_timeout, 0, GET_ULONG, REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 }, { "date_format", OPT_DATE_FORMAT, "The DATE format (For future).", - (gptr*) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE], - (gptr*) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE], + (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE], + (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE], 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "datetime_format", OPT_DATETIME_FORMAT, "The DATETIME/TIMESTAMP format (for future).", - (gptr*) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME], - (gptr*) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME], + (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME], + (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME], 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "default_week_format", OPT_DEFAULT_WEEK_FORMAT, "The default week format used by WEEK() functions.", - (gptr*) &global_system_variables.default_week_format, - (gptr*) &max_system_variables.default_week_format, + (uchar**) &global_system_variables.default_week_format, + (uchar**) &max_system_variables.default_week_format, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 7L, 0, 1, 0}, {"delayed_insert_limit", OPT_DELAYED_INSERT_LIMIT, "After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT statements pending. If so, it allows these to execute before continuing.", - (gptr*) &delayed_insert_limit, (gptr*) &delayed_insert_limit, 0, GET_ULONG, + (uchar**) &delayed_insert_limit, (uchar**) &delayed_insert_limit, 0, GET_ULONG, REQUIRED_ARG, DELAYED_LIMIT, 1, ~0L, 0, 1, 0}, {"delayed_insert_timeout", OPT_DELAYED_INSERT_TIMEOUT, "How long a INSERT DELAYED thread should wait for INSERT statements before terminating.", - (gptr*) &delayed_insert_timeout, (gptr*) &delayed_insert_timeout, 0, + (uchar**) &delayed_insert_timeout, (uchar**) &delayed_insert_timeout, 0, GET_ULONG, REQUIRED_ARG, DELAYED_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, { "delayed_queue_size", OPT_DELAYED_QUEUE_SIZE, "What size queue (in rows) should be allocated for handling INSERT DELAYED. If the queue becomes full, any client that does INSERT DELAYED will wait until there is room in the queue again.", - (gptr*) &delayed_queue_size, (gptr*) &delayed_queue_size, 0, GET_ULONG, + (uchar**) &delayed_queue_size, (uchar**) &delayed_queue_size, 0, GET_ULONG, REQUIRED_ARG, DELAYED_QUEUE_SIZE, 1, ~0L, 0, 1, 0}, {"div_precision_increment", OPT_DIV_PRECINCREMENT, "Precision of the result of '/' operator will be increased on that value.", - (gptr*) &global_system_variables.div_precincrement, - (gptr*) &max_system_variables.div_precincrement, 0, GET_ULONG, + (uchar**) &global_system_variables.div_precincrement, + (uchar**) &max_system_variables.div_precincrement, 0, GET_ULONG, REQUIRED_ARG, 4, 0, DECIMAL_MAX_SCALE, 0, 0, 0}, {"expire_logs_days", OPT_EXPIRE_LOGS_DAYS, "If non-zero, binary logs will be purged after expire_logs_days " "days; possible purges happen at startup and at binary log rotation.", - (gptr*) &expire_logs_days, - (gptr*) &expire_logs_days, 0, GET_ULONG, + (uchar**) &expire_logs_days, + (uchar**) &expire_logs_days, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 99, 0, 1, 0}, { "flush_time", OPT_FLUSH_TIME, "A dedicated thread is created to flush all tables at the given interval.", - (gptr*) &flush_time, (gptr*) &flush_time, 0, GET_ULONG, REQUIRED_ARG, + (uchar**) &flush_time, (uchar**) &flush_time, 0, GET_ULONG, REQUIRED_ARG, FLUSH_TIME, 0, LONG_TIMEOUT, 0, 1, 0}, { "ft_boolean_syntax", OPT_FT_BOOLEAN_SYNTAX, "List of operators for MATCH ... AGAINST ( ... IN BOOLEAN MODE)", @@ -5990,148 +5990,148 @@ log and this option does nothing anymore.", REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.", - (gptr*) &ft_max_word_len, (gptr*) &ft_max_word_len, 0, GET_ULONG, + (uchar**) &ft_max_word_len, (uchar**) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10, HA_FT_MAXCHARLEN, 0, 1, 0}, { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.", - (gptr*) &ft_min_word_len, (gptr*) &ft_min_word_len, 0, GET_ULONG, + (uchar**) &ft_min_word_len, (uchar**) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN, 0, 1, 0}, { "ft_query_expansion_limit", OPT_FT_QUERY_EXPANSION_LIMIT, "Number of best matches to use for query expansion", - (gptr*) &ft_query_expansion_limit, (gptr*) &ft_query_expansion_limit, 0, GET_ULONG, + (uchar**) &ft_query_expansion_limit, (uchar**) &ft_query_expansion_limit, 0, GET_ULONG, REQUIRED_ARG, 20, 0, 1000, 0, 1, 0}, { "ft_stopword_file", OPT_FT_STOPWORD_FILE, "Use stopwords from this file instead of built-in list.", - (gptr*) &ft_stopword_file, (gptr*) &ft_stopword_file, 0, GET_STR, + (uchar**) &ft_stopword_file, (uchar**) &ft_stopword_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "group_concat_max_len", OPT_GROUP_CONCAT_MAX_LEN, "The maximum length of the result of function group_concat.", - (gptr*) &global_system_variables.group_concat_max_len, - (gptr*) &max_system_variables.group_concat_max_len, 0, GET_ULONG, + (uchar**) &global_system_variables.group_concat_max_len, + (uchar**) &max_system_variables.group_concat_max_len, 0, GET_ULONG, REQUIRED_ARG, 1024, 4, (long) ~0, 0, 1, 0}, #ifdef WITH_INNOBASE_STORAGE_ENGINE {"innodb_additional_mem_pool_size", OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE, "Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.", - (gptr*) &innobase_additional_mem_pool_size, - (gptr*) &innobase_additional_mem_pool_size, 0, GET_LONG, REQUIRED_ARG, + (uchar**) &innobase_additional_mem_pool_size, + (uchar**) &innobase_additional_mem_pool_size, 0, GET_LONG, REQUIRED_ARG, 1*1024*1024L, 512*1024L, ~0L, 0, 1024, 0}, {"innodb_autoextend_increment", OPT_INNODB_AUTOEXTEND_INCREMENT, "Data file autoextend increment in megabytes", - (gptr*) &srv_auto_extend_increment, - (gptr*) &srv_auto_extend_increment, + (uchar**) &srv_auto_extend_increment, + (uchar**) &srv_auto_extend_increment, 0, GET_LONG, REQUIRED_ARG, 8L, 1L, 1000L, 0, 1L, 0}, {"innodb_buffer_pool_size", OPT_INNODB_BUFFER_POOL_SIZE, "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.", - (gptr*) &innobase_buffer_pool_size, (gptr*) &innobase_buffer_pool_size, 0, + (uchar**) &innobase_buffer_pool_size, (uchar**) &innobase_buffer_pool_size, 0, GET_LL, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, LONGLONG_MAX, 0, 1024*1024L, 0}, {"innodb_commit_concurrency", OPT_INNODB_COMMIT_CONCURRENCY, "Helps in performance tuning in heavily concurrent environments.", - (gptr*) &srv_commit_concurrency, (gptr*) &srv_commit_concurrency, + (uchar**) &srv_commit_concurrency, (uchar**) &srv_commit_concurrency, 0, GET_LONG, REQUIRED_ARG, 0, 0, 1000, 0, 1, 0}, {"innodb_concurrency_tickets", OPT_INNODB_CONCURRENCY_TICKETS, "Number of times a thread is allowed to enter InnoDB within the same \ SQL query after it has once got the ticket", - (gptr*) &srv_n_free_tickets_to_enter, - (gptr*) &srv_n_free_tickets_to_enter, + (uchar**) &srv_n_free_tickets_to_enter, + (uchar**) &srv_n_free_tickets_to_enter, 0, GET_LONG, REQUIRED_ARG, 500L, 1L, ~0L, 0, 1L, 0}, {"innodb_file_io_threads", OPT_INNODB_FILE_IO_THREADS, - "Number of file I/O threads in InnoDB.", (gptr*) &innobase_file_io_threads, - (gptr*) &innobase_file_io_threads, 0, GET_LONG, REQUIRED_ARG, 4, 4, 64, 0, + "Number of file I/O threads in InnoDB.", (uchar**) &innobase_file_io_threads, + (uchar**) &innobase_file_io_threads, 0, GET_LONG, REQUIRED_ARG, 4, 4, 64, 0, 1, 0}, {"innodb_force_recovery", OPT_INNODB_FORCE_RECOVERY, "Helps to save your data in case the disk image of the database becomes corrupt.", - (gptr*) &innobase_force_recovery, (gptr*) &innobase_force_recovery, 0, + (uchar**) &innobase_force_recovery, (uchar**) &innobase_force_recovery, 0, GET_LONG, REQUIRED_ARG, 0, 0, 6, 0, 1, 0}, {"innodb_lock_wait_timeout", OPT_INNODB_LOCK_WAIT_TIMEOUT, "Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back.", - (gptr*) &innobase_lock_wait_timeout, (gptr*) &innobase_lock_wait_timeout, + (uchar**) &innobase_lock_wait_timeout, (uchar**) &innobase_lock_wait_timeout, 0, GET_LONG, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0}, {"innodb_log_buffer_size", OPT_INNODB_LOG_BUFFER_SIZE, "The size of the buffer which InnoDB uses to write log to the log files on disk.", - (gptr*) &innobase_log_buffer_size, (gptr*) &innobase_log_buffer_size, 0, + (uchar**) &innobase_log_buffer_size, (uchar**) &innobase_log_buffer_size, 0, GET_LONG, REQUIRED_ARG, 1024*1024L, 256*1024L, ~0L, 0, 1024, 0}, {"innodb_log_file_size", OPT_INNODB_LOG_FILE_SIZE, "Size of each log file in a log group.", - (gptr*) &innobase_log_file_size, (gptr*) &innobase_log_file_size, 0, + (uchar**) &innobase_log_file_size, (uchar**) &innobase_log_file_size, 0, GET_LL, REQUIRED_ARG, 5*1024*1024L, 1*1024*1024L, LONGLONG_MAX, 0, 1024*1024L, 0}, {"innodb_log_files_in_group", OPT_INNODB_LOG_FILES_IN_GROUP, "Number of log files in the log group. InnoDB writes to the files in a circular fashion. Value 3 is recommended here.", - (gptr*) &innobase_log_files_in_group, (gptr*) &innobase_log_files_in_group, + (uchar**) &innobase_log_files_in_group, (uchar**) &innobase_log_files_in_group, 0, GET_LONG, REQUIRED_ARG, 2, 2, 100, 0, 1, 0}, {"innodb_mirrored_log_groups", OPT_INNODB_MIRRORED_LOG_GROUPS, "Number of identical copies of log groups we keep for the database. Currently this should be set to 1.", - (gptr*) &innobase_mirrored_log_groups, - (gptr*) &innobase_mirrored_log_groups, 0, GET_LONG, REQUIRED_ARG, 1, 1, 10, + (uchar**) &innobase_mirrored_log_groups, + (uchar**) &innobase_mirrored_log_groups, 0, GET_LONG, REQUIRED_ARG, 1, 1, 10, 0, 1, 0}, {"innodb_open_files", OPT_INNODB_OPEN_FILES, "How many files at the maximum InnoDB keeps open at the same time.", - (gptr*) &innobase_open_files, (gptr*) &innobase_open_files, 0, + (uchar**) &innobase_open_files, (uchar**) &innobase_open_files, 0, GET_LONG, REQUIRED_ARG, 300L, 10L, ~0L, 0, 1L, 0}, {"innodb_sync_spin_loops", OPT_INNODB_SYNC_SPIN_LOOPS, "Count of spin-loop rounds in InnoDB mutexes", - (gptr*) &srv_n_spin_wait_rounds, - (gptr*) &srv_n_spin_wait_rounds, + (uchar**) &srv_n_spin_wait_rounds, + (uchar**) &srv_n_spin_wait_rounds, 0, GET_LONG, REQUIRED_ARG, 20L, 0L, ~0L, 0, 1L, 0}, {"innodb_thread_concurrency", OPT_INNODB_THREAD_CONCURRENCY, "Helps in performance tuning in heavily concurrent environments. " "Sets the maximum number of threads allowed inside InnoDB. Value 0" " will disable the thread throttling.", - (gptr*) &srv_thread_concurrency, (gptr*) &srv_thread_concurrency, + (uchar**) &srv_thread_concurrency, (uchar**) &srv_thread_concurrency, 0, GET_LONG, REQUIRED_ARG, 8, 0, 1000, 0, 1, 0}, {"innodb_thread_sleep_delay", OPT_INNODB_THREAD_SLEEP_DELAY, "Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0" " disable a sleep", - (gptr*) &srv_thread_sleep_delay, - (gptr*) &srv_thread_sleep_delay, + (uchar**) &srv_thread_sleep_delay, + (uchar**) &srv_thread_sleep_delay, 0, GET_LONG, REQUIRED_ARG, 10000L, 0L, ~0L, 0, 1L, 0}, #endif /* WITH_INNOBASE_STORAGE_ENGINE */ {"interactive_timeout", OPT_INTERACTIVE_TIMEOUT, "The number of seconds the server waits for activity on an interactive connection before closing it.", - (gptr*) &global_system_variables.net_interactive_timeout, - (gptr*) &max_system_variables.net_interactive_timeout, 0, + (uchar**) &global_system_variables.net_interactive_timeout, + (uchar**) &max_system_variables.net_interactive_timeout, 0, GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, {"join_buffer_size", OPT_JOIN_BUFF_SIZE, "The size of the buffer that is used for full joins.", - (gptr*) &global_system_variables.join_buff_size, - (gptr*) &max_system_variables.join_buff_size, 0, GET_ULONG, + (uchar**) &global_system_variables.join_buff_size, + (uchar**) &max_system_variables.join_buff_size, 0, GET_ULONG, REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE, 0}, {"key_buffer_size", OPT_KEY_BUFFER_SIZE, "The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.", - (gptr*) &dflt_key_cache_var.param_buff_size, - (gptr*) 0, + (uchar**) &dflt_key_cache_var.param_buff_size, + (uchar**) 0, 0, (GET_ULL | GET_ASK_ADDR), REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, ~(ulong) 0, MALLOC_OVERHEAD, IO_SIZE, 0}, {"key_cache_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD, "This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache", - (gptr*) &dflt_key_cache_var.param_age_threshold, - (gptr*) 0, + (uchar**) &dflt_key_cache_var.param_age_threshold, + (uchar**) 0, 0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG, 300, 100, ~0L, 0, 100, 0}, {"key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE, "The default size of key cache blocks", - (gptr*) &dflt_key_cache_var.param_block_size, - (gptr*) 0, + (uchar**) &dflt_key_cache_var.param_block_size, + (uchar**) 0, 0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG, KEY_CACHE_BLOCK_SIZE , 512, 1024*16, MALLOC_OVERHEAD, 512, 0}, {"key_cache_division_limit", OPT_KEY_CACHE_DIVISION_LIMIT, "The minimum percentage of warm blocks in key cache", - (gptr*) &dflt_key_cache_var.param_division_limit, - (gptr*) 0, + (uchar**) &dflt_key_cache_var.param_division_limit, + (uchar**) 0, 0, (GET_ULONG | GET_ASK_ADDR) , REQUIRED_ARG, 100, 1, 100, 0, 1, 0}, {"long_query_time", OPT_LONG_QUERY_TIME, "Log all queries that have taken more than long_query_time seconds to execute to file.", - (gptr*) &global_system_variables.long_query_time, - (gptr*) &max_system_variables.long_query_time, 0, GET_ULONG, + (uchar**) &global_system_variables.long_query_time, + (uchar**) &max_system_variables.long_query_time, 0, GET_ULONG, REQUIRED_ARG, 10, 1, LONG_TIMEOUT, 0, 1, 0}, {"lower_case_table_names", OPT_LOWER_CASE_TABLE_NAMES, "If set to 1 table names are stored in lowercase on disk and table names will be case-insensitive. Should be set to 2 if you are using a case insensitive file system", - (gptr*) &lower_case_table_names, - (gptr*) &lower_case_table_names, 0, GET_UINT, OPT_ARG, + (uchar**) &lower_case_table_names, + (uchar**) &lower_case_table_names, 0, GET_UINT, OPT_ARG, #ifdef FN_NO_CASE_SENCE 1 #else @@ -6140,351 +6140,351 @@ log and this option does nothing anymore.", , 0, 2, 0, 1, 0}, {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "Max packetlength to send/receive from to server.", - (gptr*) &global_system_variables.max_allowed_packet, - (gptr*) &max_system_variables.max_allowed_packet, 0, GET_ULONG, + (uchar**) &global_system_variables.max_allowed_packet, + (uchar**) &max_system_variables.max_allowed_packet, 0, GET_ULONG, REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0}, {"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE, "Can be used to restrict the total size used to cache a multi-transaction query.", - (gptr*) &max_binlog_cache_size, (gptr*) &max_binlog_cache_size, 0, + (uchar**) &max_binlog_cache_size, (uchar**) &max_binlog_cache_size, 0, GET_ULONG, REQUIRED_ARG, ~0L, IO_SIZE, ~0L, 0, IO_SIZE, 0}, {"max_binlog_size", OPT_MAX_BINLOG_SIZE, "Binary log will be rotated automatically when the size exceeds this \ value. Will also apply to relay logs if max_relay_log_size is 0. \ The minimum value for this variable is 4096.", - (gptr*) &max_binlog_size, (gptr*) &max_binlog_size, 0, GET_ULONG, + (uchar**) &max_binlog_size, (uchar**) &max_binlog_size, 0, GET_ULONG, REQUIRED_ARG, 1024*1024L*1024L, IO_SIZE, 1024*1024L*1024L, 0, IO_SIZE, 0}, {"max_connect_errors", OPT_MAX_CONNECT_ERRORS, "If there is more than this number of interrupted connections from a host this host will be blocked from further connections.", - (gptr*) &max_connect_errors, (gptr*) &max_connect_errors, 0, GET_ULONG, + (uchar**) &max_connect_errors, (uchar**) &max_connect_errors, 0, GET_ULONG, REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, ~0L, 0, 1, 0}, // Default max_connections of 151 is larger than Apache's default max // children, to avoid "too many connections" error in a common setup {"max_connections", OPT_MAX_CONNECTIONS, - "The number of simultaneous clients allowed.", (gptr*) &max_connections, - (gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 151, 1, 100000, 0, 1, + "The number of simultaneous clients allowed.", (uchar**) &max_connections, + (uchar**) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 151, 1, 100000, 0, 1, 0}, {"max_delayed_threads", OPT_MAX_DELAYED_THREADS, "Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero, which means INSERT DELAYED is not used.", - (gptr*) &global_system_variables.max_insert_delayed_threads, - (gptr*) &max_system_variables.max_insert_delayed_threads, + (uchar**) &global_system_variables.max_insert_delayed_threads, + (uchar**) &max_system_variables.max_insert_delayed_threads, 0, GET_ULONG, REQUIRED_ARG, 20, 0, 16384, 0, 1, 0}, {"max_error_count", OPT_MAX_ERROR_COUNT, "Max number of errors/warnings to store for a statement.", - (gptr*) &global_system_variables.max_error_count, - (gptr*) &max_system_variables.max_error_count, + (uchar**) &global_system_variables.max_error_count, + (uchar**) &max_system_variables.max_error_count, 0, GET_ULONG, REQUIRED_ARG, DEFAULT_ERROR_COUNT, 0, 65535, 0, 1, 0}, {"max_heap_table_size", OPT_MAX_HEP_TABLE_SIZE, "Don't allow creation of heap tables bigger than this.", - (gptr*) &global_system_variables.max_heap_table_size, - (gptr*) &max_system_variables.max_heap_table_size, 0, GET_ULL, + (uchar**) &global_system_variables.max_heap_table_size, + (uchar**) &max_system_variables.max_heap_table_size, 0, GET_ULL, REQUIRED_ARG, 16*1024*1024L, 16384, MAX_MEM_TABLE_SIZE, MALLOC_OVERHEAD, 1024, 0}, {"max_join_size", OPT_MAX_JOIN_SIZE, "Joins that are probably going to read more than max_join_size records return an error.", - (gptr*) &global_system_variables.max_join_size, - (gptr*) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG, + (uchar**) &global_system_variables.max_join_size, + (uchar**) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG, ~0L, 1, ~0L, 0, 1, 0}, {"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA, "Max number of bytes in sorted records.", - (gptr*) &global_system_variables.max_length_for_sort_data, - (gptr*) &max_system_variables.max_length_for_sort_data, 0, GET_ULONG, + (uchar**) &global_system_variables.max_length_for_sort_data, + (uchar**) &max_system_variables.max_length_for_sort_data, 0, GET_ULONG, REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0}, {"max_prepared_stmt_count", OPT_MAX_PREPARED_STMT_COUNT, "Maximum number of prepared statements in the server.", - (gptr*) &max_prepared_stmt_count, (gptr*) &max_prepared_stmt_count, + (uchar**) &max_prepared_stmt_count, (uchar**) &max_prepared_stmt_count, 0, GET_ULONG, REQUIRED_ARG, 16382, 0, 1*1024*1024, 0, 1, 0}, {"max_relay_log_size", OPT_MAX_RELAY_LOG_SIZE, "If non-zero: relay log will be rotated automatically when the size exceeds this value; if zero (the default): when the size exceeds max_binlog_size. 0 excepted, the minimum value for this variable is 4096.", - (gptr*) &max_relay_log_size, (gptr*) &max_relay_log_size, 0, GET_ULONG, + (uchar**) &max_relay_log_size, (uchar**) &max_relay_log_size, 0, GET_ULONG, REQUIRED_ARG, 0L, 0L, 1024*1024L*1024L, 0, IO_SIZE, 0}, { "max_seeks_for_key", OPT_MAX_SEEKS_FOR_KEY, "Limit assumed max number of seeks when looking up rows based on a key", - (gptr*) &global_system_variables.max_seeks_for_key, - (gptr*) &max_system_variables.max_seeks_for_key, 0, GET_ULONG, + (uchar**) &global_system_variables.max_seeks_for_key, + (uchar**) &max_system_variables.max_seeks_for_key, 0, GET_ULONG, REQUIRED_ARG, ~0L, 1, ~0L, 0, 1, 0 }, {"max_sort_length", OPT_MAX_SORT_LENGTH, "The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored).", - (gptr*) &global_system_variables.max_sort_length, - (gptr*) &max_system_variables.max_sort_length, 0, GET_ULONG, + (uchar**) &global_system_variables.max_sort_length, + (uchar**) &max_system_variables.max_sort_length, 0, GET_ULONG, REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0}, {"max_sp_recursion_depth", OPT_MAX_SP_RECURSION_DEPTH, "Maximum stored procedure recursion depth. (discussed with docs).", - (gptr*) &global_system_variables.max_sp_recursion_depth, - (gptr*) &max_system_variables.max_sp_recursion_depth, 0, GET_ULONG, + (uchar**) &global_system_variables.max_sp_recursion_depth, + (uchar**) &max_system_variables.max_sp_recursion_depth, 0, GET_ULONG, OPT_ARG, 0, 0, 255, 0, 1, 0 }, {"max_tmp_tables", OPT_MAX_TMP_TABLES, "Maximum number of temporary tables a client can keep open at a time.", - (gptr*) &global_system_variables.max_tmp_tables, - (gptr*) &max_system_variables.max_tmp_tables, 0, GET_ULONG, + (uchar**) &global_system_variables.max_tmp_tables, + (uchar**) &max_system_variables.max_tmp_tables, 0, GET_ULONG, REQUIRED_ARG, 32, 1, ~0L, 0, 1, 0}, {"max_user_connections", OPT_MAX_USER_CONNECTIONS, "The maximum number of active connections for a single user (0 = no limit).", - (gptr*) &max_user_connections, (gptr*) &max_user_connections, 0, GET_UINT, + (uchar**) &max_user_connections, (uchar**) &max_user_connections, 0, GET_UINT, REQUIRED_ARG, 0, 1, ~0, 0, 1, 0}, {"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT, "After this many write locks, allow some read locks to run in between.", - (gptr*) &max_write_lock_count, (gptr*) &max_write_lock_count, 0, GET_ULONG, + (uchar**) &max_write_lock_count, (uchar**) &max_write_lock_count, 0, GET_ULONG, REQUIRED_ARG, ~0L, 1, ~0L, 0, 1, 0}, {"multi_range_count", OPT_MULTI_RANGE_COUNT, "Number of key ranges to request at once.", - (gptr*) &global_system_variables.multi_range_count, - (gptr*) &max_system_variables.multi_range_count, 0, + (uchar**) &global_system_variables.multi_range_count, + (uchar**) &max_system_variables.multi_range_count, 0, GET_ULONG, REQUIRED_ARG, 256, 1, ~0L, 0, 1, 0}, {"myisam_block_size", OPT_MYISAM_BLOCK_SIZE, "Block size to be used for MyISAM index pages.", - (gptr*) &opt_myisam_block_size, - (gptr*) &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG, + (uchar**) &opt_myisam_block_size, + (uchar**) &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG, MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH, 0, MI_MIN_KEY_BLOCK_LENGTH, 0}, {"myisam_data_pointer_size", OPT_MYISAM_DATA_POINTER_SIZE, "Default pointer size to be used for MyISAM tables.", - (gptr*) &myisam_data_pointer_size, - (gptr*) &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG, + (uchar**) &myisam_data_pointer_size, + (uchar**) &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG, 6, 2, 7, 0, 1, 0}, {"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE, "Deprecated option", - (gptr*) &global_system_variables.myisam_max_extra_sort_file_size, - (gptr*) &max_system_variables.myisam_max_extra_sort_file_size, + (uchar**) &global_system_variables.myisam_max_extra_sort_file_size, + (uchar**) &max_system_variables.myisam_max_extra_sort_file_size, 0, GET_ULL, REQUIRED_ARG, (ulonglong) MI_MAX_TEMP_LENGTH, 0, (ulonglong) MAX_FILE_SIZE, 0, 1, 0}, {"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE, "Don't use the fast sort index method to created index if the temporary file would get bigger than this.", - (gptr*) &global_system_variables.myisam_max_sort_file_size, - (gptr*) &max_system_variables.myisam_max_sort_file_size, 0, + (uchar**) &global_system_variables.myisam_max_sort_file_size, + (uchar**) &max_system_variables.myisam_max_sort_file_size, 0, GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, (ulonglong) MAX_FILE_SIZE, 0, 1024*1024, 0}, {"myisam_repair_threads", OPT_MYISAM_REPAIR_THREADS, "Number of threads to use when repairing MyISAM tables. The value of 1 disables parallel repair.", - (gptr*) &global_system_variables.myisam_repair_threads, - (gptr*) &max_system_variables.myisam_repair_threads, 0, + (uchar**) &global_system_variables.myisam_repair_threads, + (uchar**) &max_system_variables.myisam_repair_threads, 0, GET_ULONG, REQUIRED_ARG, 1, 1, ~0L, 0, 1, 0}, {"myisam_sort_buffer_size", OPT_MYISAM_SORT_BUFFER_SIZE, "The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE.", - (gptr*) &global_system_variables.myisam_sort_buff_size, - (gptr*) &max_system_variables.myisam_sort_buff_size, 0, + (uchar**) &global_system_variables.myisam_sort_buff_size, + (uchar**) &max_system_variables.myisam_sort_buff_size, 0, GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ~0L, 0, 1, 0}, {"myisam_use_mmap", OPT_MYISAM_USE_MMAP, "Use memory mapping for reading and writing MyISAM tables", - (gptr*) &opt_myisam_use_mmap, - (gptr*) &opt_myisam_use_mmap, 0, GET_BOOL, NO_ARG, 0, + (uchar**) &opt_myisam_use_mmap, + (uchar**) &opt_myisam_use_mmap, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"myisam_stats_method", OPT_MYISAM_STATS_METHOD, "Specifies how MyISAM index statistics collection code should threat NULLs. " "Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), " "\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".", - (gptr*) &myisam_stats_method_str, (gptr*) &myisam_stats_method_str, 0, + (uchar**) &myisam_stats_method_str, (uchar**) &myisam_stats_method_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"net_buffer_length", OPT_NET_BUFFER_LENGTH, "Buffer length for TCP/IP and socket communication.", - (gptr*) &global_system_variables.net_buffer_length, - (gptr*) &max_system_variables.net_buffer_length, 0, GET_ULONG, + (uchar**) &global_system_variables.net_buffer_length, + (uchar**) &max_system_variables.net_buffer_length, 0, GET_ULONG, REQUIRED_ARG, 16384, 1024, 1024*1024L, 0, 1024, 0}, {"net_read_timeout", OPT_NET_READ_TIMEOUT, "Number of seconds to wait for more data from a connection before aborting the read.", - (gptr*) &global_system_variables.net_read_timeout, - (gptr*) &max_system_variables.net_read_timeout, 0, GET_ULONG, + (uchar**) &global_system_variables.net_read_timeout, + (uchar**) &max_system_variables.net_read_timeout, 0, GET_ULONG, REQUIRED_ARG, NET_READ_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, {"net_retry_count", OPT_NET_RETRY_COUNT, "If a read on a communication port is interrupted, retry this many times before giving up.", - (gptr*) &global_system_variables.net_retry_count, - (gptr*) &max_system_variables.net_retry_count,0, + (uchar**) &global_system_variables.net_retry_count, + (uchar**) &max_system_variables.net_retry_count,0, GET_ULONG, REQUIRED_ARG, MYSQLD_NET_RETRY_COUNT, 1, ~0L, 0, 1, 0}, {"net_write_timeout", OPT_NET_WRITE_TIMEOUT, "Number of seconds to wait for a block to be written to a connection before aborting the write.", - (gptr*) &global_system_variables.net_write_timeout, - (gptr*) &max_system_variables.net_write_timeout, 0, GET_ULONG, + (uchar**) &global_system_variables.net_write_timeout, + (uchar**) &max_system_variables.net_write_timeout, 0, GET_ULONG, REQUIRED_ARG, NET_WRITE_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, { "old", OPT_OLD_MODE, "Use compatible behavior.", - (gptr*) &global_system_variables.old_mode, - (gptr*) &max_system_variables.old_mode, 0, GET_BOOL, NO_ARG, + (uchar**) &global_system_variables.old_mode, + (uchar**) &max_system_variables.old_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"open_files_limit", OPT_OPEN_FILES_LIMIT, "If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of files.", - (gptr*) &open_files_limit, (gptr*) &open_files_limit, 0, GET_ULONG, + (uchar**) &open_files_limit, (uchar**) &open_files_limit, 0, GET_ULONG, REQUIRED_ARG, 0, 0, OS_FILE_LIMIT, 0, 1, 0}, {"optimizer_prune_level", OPT_OPTIMIZER_PRUNE_LEVEL, "Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search; 1 - prune plans based on number of retrieved rows.", - (gptr*) &global_system_variables.optimizer_prune_level, - (gptr*) &max_system_variables.optimizer_prune_level, + (uchar**) &global_system_variables.optimizer_prune_level, + (uchar**) &max_system_variables.optimizer_prune_level, 0, GET_ULONG, OPT_ARG, 1, 0, 1, 0, 1, 0}, {"optimizer_search_depth", OPT_OPTIMIZER_SEARCH_DEPTH, "Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Smaller values than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value; if set to MAX_TABLES+2, the optimizer will switch to the original find_best (used for testing/comparison).", - (gptr*) &global_system_variables.optimizer_search_depth, - (gptr*) &max_system_variables.optimizer_search_depth, + (uchar**) &global_system_variables.optimizer_search_depth, + (uchar**) &max_system_variables.optimizer_search_depth, 0, GET_ULONG, OPT_ARG, MAX_TABLES+1, 0, MAX_TABLES+2, 0, 1, 0}, {"plugin_dir", OPT_PLUGIN_DIR, "Directory for plugins.", - (gptr*) &opt_plugin_dir_ptr, (gptr*) &opt_plugin_dir_ptr, 0, + (uchar**) &opt_plugin_dir_ptr, (uchar**) &opt_plugin_dir_ptr, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE, "The size of the buffer that is allocated when preloading indexes", - (gptr*) &global_system_variables.preload_buff_size, - (gptr*) &max_system_variables.preload_buff_size, 0, GET_ULONG, + (uchar**) &global_system_variables.preload_buff_size, + (uchar**) &max_system_variables.preload_buff_size, 0, GET_ULONG, REQUIRED_ARG, 32*1024L, 1024, 1024*1024*1024L, 0, 1, 0}, {"query_alloc_block_size", OPT_QUERY_ALLOC_BLOCK_SIZE, "Allocation block size for query parsing and execution", - (gptr*) &global_system_variables.query_alloc_block_size, - (gptr*) &max_system_variables.query_alloc_block_size, 0, GET_ULONG, + (uchar**) &global_system_variables.query_alloc_block_size, + (uchar**) &max_system_variables.query_alloc_block_size, 0, GET_ULONG, REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ~0L, 0, 1024, 0}, #ifdef HAVE_QUERY_CACHE {"query_cache_limit", OPT_QUERY_CACHE_LIMIT, "Don't cache results that are bigger than this.", - (gptr*) &query_cache_limit, (gptr*) &query_cache_limit, 0, GET_ULONG, + (uchar**) &query_cache_limit, (uchar**) &query_cache_limit, 0, GET_ULONG, REQUIRED_ARG, 1024*1024L, 0, (longlong) ULONG_MAX, 0, 1, 0}, {"query_cache_min_res_unit", OPT_QUERY_CACHE_MIN_RES_UNIT, "minimal size of unit in wich space for results is allocated (last unit will be trimed after writing all result data.", - (gptr*) &query_cache_min_res_unit, (gptr*) &query_cache_min_res_unit, + (uchar**) &query_cache_min_res_unit, (uchar**) &query_cache_min_res_unit, 0, GET_ULONG, REQUIRED_ARG, QUERY_CACHE_MIN_RESULT_DATA_SIZE, 0, (longlong) ULONG_MAX, 0, 1, 0}, #endif /*HAVE_QUERY_CACHE*/ {"query_cache_size", OPT_QUERY_CACHE_SIZE, "The memory allocated to store results from old queries.", - (gptr*) &query_cache_size, (gptr*) &query_cache_size, 0, GET_ULONG, + (uchar**) &query_cache_size, (uchar**) &query_cache_size, 0, GET_ULONG, REQUIRED_ARG, 0, 0, (longlong) ULONG_MAX, 0, 1024, 0}, #ifdef HAVE_QUERY_CACHE {"query_cache_type", OPT_QUERY_CACHE_TYPE, "0 = OFF = Don't cache or retrieve results. 1 = ON = Cache all results except SELECT SQL_NO_CACHE ... queries. 2 = DEMAND = Cache only SELECT SQL_CACHE ... queries.", - (gptr*) &global_system_variables.query_cache_type, - (gptr*) &max_system_variables.query_cache_type, + (uchar**) &global_system_variables.query_cache_type, + (uchar**) &max_system_variables.query_cache_type, 0, GET_ULONG, REQUIRED_ARG, 1, 0, 2, 0, 1, 0}, {"query_cache_wlock_invalidate", OPT_QUERY_CACHE_WLOCK_INVALIDATE, "Invalidate queries in query cache on LOCK for write", - (gptr*) &global_system_variables.query_cache_wlock_invalidate, - (gptr*) &max_system_variables.query_cache_wlock_invalidate, + (uchar**) &global_system_variables.query_cache_wlock_invalidate, + (uchar**) &max_system_variables.query_cache_wlock_invalidate, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, #endif /*HAVE_QUERY_CACHE*/ {"query_prealloc_size", OPT_QUERY_PREALLOC_SIZE, "Persistent buffer for query parsing and execution", - (gptr*) &global_system_variables.query_prealloc_size, - (gptr*) &max_system_variables.query_prealloc_size, 0, GET_ULONG, + (uchar**) &global_system_variables.query_prealloc_size, + (uchar**) &max_system_variables.query_prealloc_size, 0, GET_ULONG, REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, QUERY_ALLOC_PREALLOC_SIZE, ~0L, 0, 1024, 0}, {"range_alloc_block_size", OPT_RANGE_ALLOC_BLOCK_SIZE, "Allocation block size for storing ranges during optimization", - (gptr*) &global_system_variables.range_alloc_block_size, - (gptr*) &max_system_variables.range_alloc_block_size, 0, GET_ULONG, + (uchar**) &global_system_variables.range_alloc_block_size, + (uchar**) &max_system_variables.range_alloc_block_size, 0, GET_ULONG, REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, 4096, ~0L, 0, 1024, 0}, {"read_buffer_size", OPT_RECORD_BUFFER, "Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value.", - (gptr*) &global_system_variables.read_buff_size, - (gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, + (uchar**) &global_system_variables.read_buff_size, + (uchar**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, SSIZE_MAX, MALLOC_OVERHEAD, IO_SIZE, 0}, {"read_only", OPT_READONLY, "Make all non-temporary tables read-only, with the exception for replication (slave) threads and users with the SUPER privilege", - (gptr*) &opt_readonly, - (gptr*) &opt_readonly, + (uchar**) &opt_readonly, + (uchar**) &opt_readonly, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, {"read_rnd_buffer_size", OPT_RECORD_RND_BUFFER, "When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks. If not set, then it's set to the value of record_buffer.", - (gptr*) &global_system_variables.read_rnd_buff_size, - (gptr*) &max_system_variables.read_rnd_buff_size, 0, + (uchar**) &global_system_variables.read_rnd_buff_size, + (uchar**) &max_system_variables.read_rnd_buff_size, 0, GET_ULONG, REQUIRED_ARG, 256*1024L, IO_SIZE*2+MALLOC_OVERHEAD, SSIZE_MAX, MALLOC_OVERHEAD, IO_SIZE, 0}, {"record_buffer", OPT_RECORD_BUFFER, "Alias for read_buffer_size", - (gptr*) &global_system_variables.read_buff_size, - (gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, + (uchar**) &global_system_variables.read_buff_size, + (uchar**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, SSIZE_MAX, MALLOC_OVERHEAD, IO_SIZE, 0}, #ifdef HAVE_REPLICATION {"relay_log_purge", OPT_RELAY_LOG_PURGE, "0 = do not purge relay logs. 1 = purge them as soon as they are no more needed.", - (gptr*) &relay_log_purge, - (gptr*) &relay_log_purge, 0, GET_BOOL, NO_ARG, + (uchar**) &relay_log_purge, + (uchar**) &relay_log_purge, 0, GET_BOOL, NO_ARG, 1, 0, 1, 0, 1, 0}, {"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT, "Maximum space to use for all relay logs.", - (gptr*) &relay_log_space_limit, - (gptr*) &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L, + (uchar**) &relay_log_space_limit, + (uchar**) &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L, (longlong) ULONG_MAX, 0, 1, 0}, {"slave_compressed_protocol", OPT_SLAVE_COMPRESSED_PROTOCOL, "Use compression on master/slave protocol.", - (gptr*) &opt_slave_compressed_protocol, - (gptr*) &opt_slave_compressed_protocol, + (uchar**) &opt_slave_compressed_protocol, + (uchar**) &opt_slave_compressed_protocol, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, {"slave_net_timeout", OPT_SLAVE_NET_TIMEOUT, "Number of seconds to wait for more data from a master/slave connection before aborting the read.", - (gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 0, + (uchar**) &slave_net_timeout, (uchar**) &slave_net_timeout, 0, GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, {"slave_transaction_retries", OPT_SLAVE_TRANS_RETRIES, "Number of times the slave SQL thread will retry a transaction in case " "it failed with a deadlock or elapsed lock wait timeout, " "before giving up and stopping.", - (gptr*) &slave_trans_retries, (gptr*) &slave_trans_retries, 0, + (uchar**) &slave_trans_retries, (uchar**) &slave_trans_retries, 0, GET_ULONG, REQUIRED_ARG, 10L, 0L, (longlong) ULONG_MAX, 0, 1, 0}, #endif /* HAVE_REPLICATION */ {"slow_launch_time", OPT_SLOW_LAUNCH_TIME, "If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.", - (gptr*) &slow_launch_time, (gptr*) &slow_launch_time, 0, GET_ULONG, + (uchar**) &slow_launch_time, (uchar**) &slow_launch_time, 0, GET_ULONG, REQUIRED_ARG, 2L, 0L, LONG_TIMEOUT, 0, 1, 0}, {"sort_buffer_size", OPT_SORT_BUFFER, "Each thread that needs to do a sort allocates a buffer of this size.", - (gptr*) &global_system_variables.sortbuff_size, - (gptr*) &max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG, + (uchar**) &global_system_variables.sortbuff_size, + (uchar**) &max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG, MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, ~0L, MALLOC_OVERHEAD, 1, 0}, {"sync-binlog", OPT_SYNC_BINLOG, "Synchronously flush binary log to disk after every #th event. " "Use 0 (default) to disable synchronous flushing.", - (gptr*) &sync_binlog_period, (gptr*) &sync_binlog_period, 0, GET_ULONG, + (uchar**) &sync_binlog_period, (uchar**) &sync_binlog_period, 0, GET_ULONG, REQUIRED_ARG, 0, 0, ~0L, 0, 1, 0}, {"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default.", - (gptr*) &opt_sync_frm, (gptr*) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0, + (uchar**) &opt_sync_frm, (uchar**) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"table_cache", OPT_TABLE_OPEN_CACHE, "Deprecated; use --table_open_cache instead.", - (gptr*) &table_cache_size, (gptr*) &table_cache_size, 0, GET_ULONG, + (uchar**) &table_cache_size, (uchar**) &table_cache_size, 0, GET_ULONG, REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0}, {"table_definition_cache", OPT_TABLE_DEF_CACHE, "The number of cached table definitions.", - (gptr*) &table_def_size, (gptr*) &table_def_size, + (uchar**) &table_def_size, (uchar**) &table_def_size, 0, GET_ULONG, REQUIRED_ARG, 128, 1, 512*1024L, 0, 1, 0}, {"table_open_cache", OPT_TABLE_OPEN_CACHE, "The number of cached open tables.", - (gptr*) &table_cache_size, (gptr*) &table_cache_size, 0, GET_ULONG, + (uchar**) &table_cache_size, (uchar**) &table_cache_size, 0, GET_ULONG, REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0}, {"table_lock_wait_timeout", OPT_TABLE_LOCK_WAIT_TIMEOUT, "Timeout in seconds to wait for a table level lock before returning an " "error. Used only if the connection has active cursors.", - (gptr*) &table_lock_wait_timeout, (gptr*) &table_lock_wait_timeout, + (uchar**) &table_lock_wait_timeout, (uchar**) &table_lock_wait_timeout, 0, GET_ULONG, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0}, {"thread_cache_size", OPT_THREAD_CACHE_SIZE, "How many threads we should keep in a cache for reuse.", - (gptr*) &thread_cache_size, (gptr*) &thread_cache_size, 0, GET_ULONG, + (uchar**) &thread_cache_size, (uchar**) &thread_cache_size, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 16384, 0, 1, 0}, {"thread_concurrency", OPT_THREAD_CONCURRENCY, "Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.", - (gptr*) &concurrency, (gptr*) &concurrency, 0, GET_ULONG, REQUIRED_ARG, + (uchar**) &concurrency, (uchar**) &concurrency, 0, GET_ULONG, REQUIRED_ARG, DEFAULT_CONCURRENCY, 1, 512, 0, 1, 0}, #if HAVE_POOL_OF_THREADS == 1 {"thread_pool_size", OPT_THREAD_CACHE_SIZE, "How many threads we should create to handle query requests in case of 'thread_handling=pool-of-threads'", - (gptr*) &thread_pool_size, (gptr*) &thread_pool_size, 0, GET_ULONG, + (uchar**) &thread_pool_size, (uchar**) &thread_pool_size, 0, GET_ULONG, REQUIRED_ARG, 20, 1, 16384, 0, 1, 0}, #endif {"thread_stack", OPT_THREAD_STACK, - "The stack size for each thread.", (gptr*) &thread_stack, - (gptr*) &thread_stack, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK, + "The stack size for each thread.", (uchar**) &thread_stack, + (uchar**) &thread_stack, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK, 1024L*128L, ~0L, 0, 1024, 0}, { "time_format", OPT_TIME_FORMAT, "The TIME format (for future).", - (gptr*) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME], - (gptr*) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME], + (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME], + (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME], 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"tmp_table_size", OPT_TMP_TABLE_SIZE, "If an in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table.", - (gptr*) &global_system_variables.tmp_table_size, - (gptr*) &max_system_variables.tmp_table_size, 0, GET_ULL, + (uchar**) &global_system_variables.tmp_table_size, + (uchar**) &max_system_variables.tmp_table_size, 0, GET_ULL, REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0}, {"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE, "Allocation block size for various transaction-related structures", - (gptr*) &global_system_variables.trans_alloc_block_size, - (gptr*) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG, + (uchar**) &global_system_variables.trans_alloc_block_size, + (uchar**) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG, REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ~0L, 0, 1024, 0}, {"transaction_prealloc_size", OPT_TRANS_PREALLOC_SIZE, "Persistent buffer for various transaction-related structures", - (gptr*) &global_system_variables.trans_prealloc_size, - (gptr*) &max_system_variables.trans_prealloc_size, 0, GET_ULONG, + (uchar**) &global_system_variables.trans_prealloc_size, + (uchar**) &max_system_variables.trans_prealloc_size, 0, GET_ULONG, REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ~0L, 0, 1024, 0}, {"thread_handling", OPT_THREAD_HANDLING, "Define threads usage for handling queries: " @@ -6492,13 +6492,13 @@ The minimum value for this variable is 4096.", 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"updatable_views_with_limit", OPT_UPDATABLE_VIEWS_WITH_LIMIT, "1 = YES = Don't issue an error message (warning only) if a VIEW without presence of a key of the underlying table is used in queries with a LIMIT clause for updating. 0 = NO = Prohibit update of a VIEW, which does not contain a key of the underlying table and the query uses a LIMIT clause (usually get from GUI tools).", - (gptr*) &global_system_variables.updatable_views_with_limit, - (gptr*) &max_system_variables.updatable_views_with_limit, + (uchar**) &global_system_variables.updatable_views_with_limit, + (uchar**) &max_system_variables.updatable_views_with_limit, 0, GET_ULONG, REQUIRED_ARG, 1, 0, 1, 0, 1, 0}, {"wait_timeout", OPT_WAIT_TIMEOUT, "The number of seconds the server waits for activity on a connection before closing it.", - (gptr*) &global_system_variables.net_wait_timeout, - (gptr*) &max_system_variables.net_wait_timeout, 0, GET_ULONG, + (uchar**) &global_system_variables.net_wait_timeout, + (uchar**) &max_system_variables.net_wait_timeout, 0, GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT), 0, 1, 0}, {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} @@ -7194,7 +7194,7 @@ static void mysql_init_variables(void) prepared_stmt_count= 0; errmesg= 0; mysqld_unix_port= opt_mysql_tmpdir= my_bind_addr_str= NullS; - bzero((gptr) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list)); + bzero((uchar*) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list)); bzero((char *) &global_status_var, sizeof(global_status_var)); opt_large_pages= 0; key_map_full.set_all(); @@ -7894,7 +7894,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; } case OPT_FT_BOOLEAN_SYNTAX: - if (ft_boolean_check_syntax_string((byte*) argument)) + if (ft_boolean_check_syntax_string((uchar*) argument)) { fprintf(stderr, "Invalid ft-boolean-syntax string: %s\n", argument); exit(1); @@ -7915,7 +7915,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), } /* Initiates DEBUG - but no debugging here ! */ -static gptr * +static uchar* * mysql_getopt_value(const char *keyname, uint key_length, const struct my_option *option) { @@ -7930,13 +7930,13 @@ mysql_getopt_value(const char *keyname, uint key_length, exit(1); switch (option->id) { case OPT_KEY_BUFFER_SIZE: - return (gptr*) &key_cache->param_buff_size; + return (uchar**) &key_cache->param_buff_size; case OPT_KEY_CACHE_BLOCK_SIZE: - return (gptr*) &key_cache->param_block_size; + return (uchar**) &key_cache->param_block_size; case OPT_KEY_CACHE_DIVISION_LIMIT: - return (gptr*) &key_cache->param_division_limit; + return (uchar**) &key_cache->param_division_limit; case OPT_KEY_CACHE_AGE_THRESHOLD: - return (gptr*) &key_cache->param_age_threshold; + return (uchar**) &key_cache->param_age_threshold; } } } @@ -8102,7 +8102,7 @@ static char *get_relative_path(const char *path) */ bool -fn_format_relative_to_data_home(my_string to, const char *name, +fn_format_relative_to_data_home(char * to, const char *name, const char *dir, const char *extension) { char tmp_path[FN_REFLEN]; @@ -8220,7 +8220,7 @@ static ulong find_bit_type(const char *x, TYPELIB *bit_lib) found=0; found_end= 0; - pos=(my_string) x; + pos=(char *) x; while (*pos == ' ') pos++; found_end= *pos == 0; while (!found_end) @@ -8317,7 +8317,7 @@ static void create_pid_file() char buff[21], *end; end= int10_to_str((long) getpid(), buff, 10); *end++= '\n'; - if (!my_write(file, (byte*) buff, (uint) (end-buff), MYF(MY_WME | MY_NABP))) + if (!my_write(file, (uchar*) buff, (uint) (end-buff), MYF(MY_WME | MY_NABP))) { (void) my_close(file, MYF(0)); return; diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 719e2ee0d3c..ec12c4cabf3 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -108,7 +108,7 @@ extern void query_cache_insert(NET *net, const char *packet, ulong length); #define TEST_BLOCKING 8 #define MAX_PACKET_LENGTH (256L*256L*256L-1) -static my_bool net_write_buff(NET *net,const char *packet,ulong len); +static my_bool net_write_buff(NET *net,const uchar *packet,ulong len); /* Init with packet info */ @@ -117,7 +117,7 @@ my_bool my_net_init(NET *net, Vio* vio) { DBUG_ENTER("my_net_init"); my_net_local_init(net); /* Set some limits */ - if (!(net->buff=(uchar*) my_malloc((uint32) net->max_packet+ + if (!(net->buff=(uchar*) my_malloc((size_t) net->max_packet+ NET_HEADER_SIZE + COMP_HEADER_SIZE, MYF(MY_WME)))) DBUG_RETURN(1); @@ -157,7 +157,7 @@ my_bool my_net_init(NET *net, Vio* vio) void net_end(NET *net) { DBUG_ENTER("net_end"); - my_free((gptr) net->buff,MYF(MY_ALLOW_ZERO_PTR)); + my_free(net->buff,MYF(MY_ALLOW_ZERO_PTR)); net->buff=0; DBUG_VOID_RETURN; } @@ -165,17 +165,17 @@ void net_end(NET *net) /* Realloc the packet buffer */ -my_bool net_realloc(NET *net, ulong length) +my_bool net_realloc(NET *net, size_t length) { uchar *buff; - ulong pkt_length; + size_t pkt_length; DBUG_ENTER("net_realloc"); - DBUG_PRINT("enter",("length: %lu", length)); + DBUG_PRINT("enter",("length: %lu", (ulong) length)); if (length >= net->max_packet_size) { DBUG_PRINT("error", ("Packet too large. Max size: %lu", - net->max_packet_size)); + net->max_packet_size)); net->error= 1; net->report_error= 1; net->last_errno= ER_NET_PACKET_TOO_LARGE; @@ -186,9 +186,9 @@ my_bool net_realloc(NET *net, ulong length) We must allocate some extra bytes for the end 0 and to be able to read big compressed blocks */ - if (!(buff=(uchar*) my_realloc((char*) net->buff, (uint32) pkt_length + - NET_HEADER_SIZE + COMP_HEADER_SIZE, - MYF(MY_WME)))) + if (!(buff= (uchar*) my_realloc((char*) net->buff, pkt_length + + NET_HEADER_SIZE + COMP_HEADER_SIZE, + MYF(MY_WME)))) { net->error= 1; net->report_error= 1; @@ -196,7 +196,7 @@ my_bool net_realloc(NET *net, ulong length) DBUG_RETURN(1); } net->buff=net->write_pos=buff; - net->buff_end=buff+(net->max_packet=pkt_length); + net->buff_end=buff+(net->max_packet= (ulong) pkt_length); DBUG_RETURN(0); } @@ -283,7 +283,8 @@ static int net_data_is_ready(my_socket sd) void net_clear(NET *net, my_bool clear_buffer) { #if !defined(EMBEDDED_LIBRARY) - int count, ready; + size_t count; + int ready; #endif DBUG_ENTER("net_clear"); @@ -293,14 +294,14 @@ void net_clear(NET *net, my_bool clear_buffer) while ((ready= net_data_is_ready(net->vio->sd)) > 0) { /* The socket is ready */ - if ((count= vio_read(net->vio, (char*) (net->buff), - (uint32) net->max_packet)) > 0) + if ((long) (count= vio_read(net->vio, net->buff, + (size_t) net->max_packet)) > 0) { - DBUG_PRINT("info",("skipped %d bytes from file: %s", - count, vio_description(net->vio))); + DBUG_PRINT("info",("skipped %ld bytes from file: %s", + (long) count, vio_description(net->vio))); #if defined(EXTRA_DEBUG) - fprintf(stderr,"Note: net_clear() skipped %d bytes from file: %s\n", - count, vio_description(net->vio)); + fprintf(stderr,"Note: net_clear() skipped %ld bytes from file: %s\n", + (long) count, vio_description(net->vio)); #endif } else @@ -318,10 +319,10 @@ void net_clear(NET *net, my_bool clear_buffer) my_bool old_mode; if (!vio_blocking(net->vio, FALSE, &old_mode)) { - while ((count= vio_read(net->vio, (char*) (net->buff), - (uint32) net->max_packet)) > 0) - DBUG_PRINT("info",("skipped %d bytes from file: %s", - count, vio_description(net->vio))); + while ((long) (count= vio_read(net->vio, net->buff, + (size_t) net->max_packet)) > 0) + DBUG_PRINT("info",("skipped %ld bytes from file: %s", + (long) count, vio_description(net->vio))); vio_blocking(net->vio, TRUE, &old_mode); } } @@ -342,8 +343,8 @@ my_bool net_flush(NET *net) DBUG_ENTER("net_flush"); if (net->buff != net->write_pos) { - error=test(net_real_write(net,(char*) net->buff, - (ulong) (net->write_pos - net->buff))); + error=test(net_real_write(net, net->buff, + (size_t) (net->write_pos - net->buff))); net->write_pos=net->buff; } /* Sync packet number if using compression */ @@ -367,7 +368,7 @@ my_bool net_flush(NET *net) */ my_bool -my_net_write(NET *net,const char *packet,ulong len) +my_net_write(NET *net,const uchar *packet,size_t len) { uchar buff[NET_HEADER_SIZE]; if (unlikely(!net->vio)) /* nowhere to write */ @@ -382,7 +383,7 @@ my_net_write(NET *net,const char *packet,ulong len) const ulong z_size = MAX_PACKET_LENGTH; int3store(buff, z_size); buff[3]= (uchar) net->pkt_nr++; - if (net_write_buff(net, (char*) buff, NET_HEADER_SIZE) || + if (net_write_buff(net, buff, NET_HEADER_SIZE) || net_write_buff(net, packet, z_size)) return 1; packet += z_size; @@ -391,10 +392,10 @@ my_net_write(NET *net,const char *packet,ulong len) /* Write last packet */ int3store(buff,len); buff[3]= (uchar) net->pkt_nr++; - if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE)) + if (net_write_buff(net, buff, NET_HEADER_SIZE)) return 1; #ifndef DEBUG_DATA_PACKETS - DBUG_DUMP("packet_header",(char*) buff,NET_HEADER_SIZE); + DBUG_DUMP("packet_header", buff, NET_HEADER_SIZE); #endif return test(net_write_buff(net,packet,len)); } @@ -429,8 +430,8 @@ my_net_write(NET *net,const char *packet,ulong len) my_bool net_write_command(NET *net,uchar command, - const char *header, ulong head_len, - const char *packet, ulong len) + const uchar *header, size_t head_len, + const uchar *packet, size_t len) { ulong length=len+1+head_len; /* 1 extra byte for command */ uchar buff[NET_HEADER_SIZE+1]; @@ -448,7 +449,7 @@ net_write_command(NET *net,uchar command, { int3store(buff, MAX_PACKET_LENGTH); buff[3]= (uchar) net->pkt_nr++; - if (net_write_buff(net,(char*) buff, header_size) || + if (net_write_buff(net, buff, header_size) || net_write_buff(net, header, head_len) || net_write_buff(net, packet, len)) DBUG_RETURN(1); @@ -462,9 +463,9 @@ net_write_command(NET *net,uchar command, } int3store(buff,length); buff[3]= (uchar) net->pkt_nr++; - DBUG_RETURN(test(net_write_buff(net, (char*) buff, header_size) || - (head_len && net_write_buff(net, (char*) header, head_len)) || - net_write_buff(net, packet, len) || net_flush(net))); + DBUG_RETURN(test(net_write_buff(net, buff, header_size) || + (head_len && net_write_buff(net, header, head_len)) || + net_write_buff(net, packet, len) || net_flush(net))); } /* @@ -497,7 +498,7 @@ net_write_command(NET *net,uchar command, */ static my_bool -net_write_buff(NET *net,const char *packet,ulong len) +net_write_buff(NET *net, const uchar *packet, ulong len) { ulong left_length; if (net->compress && net->max_packet > MAX_PACKET_LENGTH) @@ -514,8 +515,8 @@ net_write_buff(NET *net,const char *packet,ulong len) { /* Fill up already used packet and write it */ memcpy((char*) net->write_pos,packet,left_length); - if (net_real_write(net,(char*) net->buff, - (ulong) (net->write_pos - net->buff) + left_length)) + if (net_real_write(net, net->buff, + (size_t) (net->write_pos - net->buff) + left_length)) return 1; net->write_pos= net->buff; packet+= left_length; @@ -552,10 +553,10 @@ net_write_buff(NET *net,const char *packet,ulong len) */ int -net_real_write(NET *net,const char *packet,ulong len) +net_real_write(NET *net,const uchar *packet, size_t len) { - long int length; - char *pos,*end; + size_t length; + const uchar *pos,*end; thr_alarm_t alarmed; #ifndef NO_ALARM ALARM alarm_buff; @@ -565,7 +566,7 @@ net_real_write(NET *net,const char *packet,ulong len) DBUG_ENTER("net_real_write"); #if defined(MYSQL_SERVER) && defined(USE_QUERY_CACHE) - query_cache_insert(net, packet, len); + query_cache_insert(net, (char*) packet, len); #endif if (net->error == 2) @@ -575,11 +576,11 @@ net_real_write(NET *net,const char *packet,ulong len) #ifdef HAVE_COMPRESS if (net->compress) { - ulong complen; + size_t complen; uchar *b; uint header_length=NET_HEADER_SIZE+COMP_HEADER_SIZE; - if (!(b=(uchar*) my_malloc((uint32) len + NET_HEADER_SIZE + - COMP_HEADER_SIZE, MYF(MY_WME)))) + if (!(b= (uchar*) my_malloc(len + NET_HEADER_SIZE + + COMP_HEADER_SIZE, MYF(MY_WME)))) { #ifdef MYSQL_SERVER net->last_errno= ER_OUT_OF_RESOURCES; @@ -592,18 +593,18 @@ net_real_write(NET *net,const char *packet,ulong len) } memcpy(b+header_length,packet,len); - if (my_compress((byte*) b+header_length,&len,&complen)) + if (my_compress(b+header_length, &len, &complen)) complen=0; int3store(&b[NET_HEADER_SIZE],complen); int3store(b,len); b[3]=(uchar) (net->compress_pkt_nr++); len+= header_length; - packet= (char*) b; + packet= b; } #endif /* HAVE_COMPRESS */ #ifdef DEBUG_DATA_PACKETS - DBUG_DUMP("data",packet,len); + DBUG_DUMP("data", packet, len); #endif #ifndef NO_ALARM @@ -615,14 +616,15 @@ net_real_write(NET *net,const char *packet,ulong len) /* Write timeout is set in net_set_write_timeout */ #endif /* NO_ALARM */ - pos=(char*) packet; end=pos+len; + pos= packet; + end=pos+len; while (pos != end) { - if ((long) (length=vio_write(net->vio,pos,(uint32) (end-pos))) <= 0) + if ((long) (length= vio_write(net->vio,pos,(size_t) (end-pos))) <= 0) { my_bool interrupted = vio_should_retry(net->vio); #if !defined(__WIN__) - if ((interrupted || length==0) && !thr_alarm_in_use(&alarmed)) + if ((interrupted || length == 0) && !thr_alarm_in_use(&alarmed)) { if (!thr_alarm(&alarmed,(uint) net->write_timeout,&alarm_buff)) { /* Always true for client */ @@ -701,14 +703,14 @@ net_real_write(NET *net,const char *packet,ulong len) #ifndef NO_ALARM -static my_bool net_safe_read(NET *net, char *buff, uint32 length, +static my_bool net_safe_read(NET *net, uchar *buff, size_t length, thr_alarm_t *alarmed) { uint retry_count=0; while (length > 0) { - int tmp; - if ((tmp=vio_read(net->vio,(char*) net->buff, length)) <= 0) + size_t tmp; + if ((long) (tmp= vio_read(net->vio, buff, length)) <= 0) { my_bool interrupted = vio_should_retry(net->vio); if (!thr_got_alarm(alarmed) && interrupted) @@ -719,6 +721,7 @@ static my_bool net_safe_read(NET *net, char *buff, uint32 length, return 1; } length-= tmp; + buff+= tmp; } return 0; } @@ -759,15 +762,15 @@ static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed, { while (remain > 0) { - uint length= min(remain, net->max_packet); - if (net_safe_read(net, (char*) net->buff, length, alarmed)) + size_t length= min(remain, net->max_packet); + if (net_safe_read(net, net->buff, length, alarmed)) DBUG_RETURN(1); update_statistics(thd_increment_bytes_received(length)); remain -= (uint32) length; } if (old != MAX_PACKET_LENGTH) break; - if (net_safe_read(net, (char*) net->buff, NET_HEADER_SIZE, alarmed)) + if (net_safe_read(net, net->buff, NET_HEADER_SIZE, alarmed)) DBUG_RETURN(1); old=remain= uint3korr(net->buff); net->pkt_nr++; @@ -784,10 +787,10 @@ static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed, */ static ulong -my_real_read(NET *net, ulong *complen) +my_real_read(NET *net, size_t *complen) { uchar *pos; - long length; + size_t length; uint i,retry_count=0; ulong len=packet_error; thr_alarm_t alarmed; @@ -814,12 +817,12 @@ my_real_read(NET *net, ulong *complen) while (remain > 0) { /* First read is done with non blocking mode */ - if ((int) (length=vio_read(net->vio,(char*) pos,remain)) <= 0L) + if ((long) (length= vio_read(net->vio, pos, remain)) <= 0L) { my_bool interrupted = vio_should_retry(net->vio); DBUG_PRINT("info",("vio_read returned %ld errno: %d", - length, vio_errno(net->vio))); + (long) length, vio_errno(net->vio))); #if !defined(__WIN__) || defined(MYSQL_SERVER) /* We got an error that there was no data on the socket. We now set up @@ -875,7 +878,7 @@ my_real_read(NET *net, ulong *complen) } #endif DBUG_PRINT("error",("Couldn't read packet: remain: %u errno: %d length: %ld", - remain, vio_errno(net->vio), length)); + remain, vio_errno(net->vio), (long) length)); len= packet_error; net->error= 2; /* Close socket */ net->report_error= 1; @@ -886,13 +889,13 @@ my_real_read(NET *net, ulong *complen) goto end; } remain -= (uint32) length; - pos+= (ulong) length; + pos+= length; update_statistics(thd_increment_bytes_received(length)); } if (i == 0) { /* First parts is packet length */ ulong helping; - DBUG_DUMP("packet_header",(char*) net->buff+net->where_b, + DBUG_DUMP("packet_header", net->buff+net->where_b, NET_HEADER_SIZE); if (net->buff[net->where_b + 3] != (uchar) net->pkt_nr) { @@ -963,7 +966,7 @@ end: net->reading_or_writing=0; #ifdef DEBUG_DATA_PACKETS if (len != packet_error) - DBUG_DUMP("data",(char*) net->buff+net->where_b, len); + DBUG_DUMP("data", net->buff+net->where_b, len); #endif return(len); } @@ -985,7 +988,7 @@ end: ulong my_net_read(NET *net) { - ulong len,complen; + size_t len, complen; #ifdef HAVE_COMPRESS if (!net->compress) @@ -996,7 +999,7 @@ my_net_read(NET *net) { /* First packet of a multi-packet. Concatenate the packets */ ulong save_pos = net->where_b; - ulong total_length=0; + size_t total_length= 0; do { net->where_b += len; @@ -1094,7 +1097,7 @@ my_net_read(NET *net) net->where_b=buf_length; if ((packet_len = my_real_read(net,&complen)) == packet_error) return packet_error; - if (my_uncompress((byte*) net->buff + net->where_b, &packet_len, + if (my_uncompress(net->buff + net->where_b, packet_len, &complen)) { net->error= 2; /* caller will close socket */ @@ -1104,7 +1107,7 @@ my_net_read(NET *net) #endif return packet_error; } - buf_length+=packet_len; + buf_length+= complen; } net->read_pos= net->buff+ first_packet_offset + NET_HEADER_SIZE; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index f5cf79bd609..f606e96e94c 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -80,9 +80,9 @@ */ #define double2rows(x) ((ha_rows)(x)) -static int sel_cmp(Field *f,char *a,char *b,uint8 a_flag,uint8 b_flag); +static int sel_cmp(Field *f,uchar *a,uchar *b,uint8 a_flag,uint8 b_flag); -static char is_null_string[2]= {1,0}; +static uchar is_null_string[2]= {1,0}; class RANGE_OPT_PARAM; /* @@ -274,7 +274,7 @@ public: ulong use_count; Field *field; - char *min_value,*max_value; // Pointer to range + uchar *min_value,*max_value; // Pointer to range SEL_ARG *left,*right; /* R-B tree children */ SEL_ARG *next,*prev; /* Links for bi-directional interval list */ @@ -287,8 +287,8 @@ public: SEL_ARG() {} SEL_ARG(SEL_ARG &); - SEL_ARG(Field *,const char *,const char *); - SEL_ARG(Field *field, uint8 part, char *min_value, char *max_value, + SEL_ARG(Field *,const uchar *, const uchar *); + SEL_ARG(Field *field, uint8 part, uchar *min_value, uchar *max_value, uint8 min_flag, uint8 max_flag, uint8 maybe_flag); SEL_ARG(enum Type type_arg) :min_flag(0),elements(1),use_count(1),left(0),next_key_part(0), @@ -324,7 +324,7 @@ public: } SEL_ARG *clone_and(SEL_ARG* arg) { // Get overlapping range - char *new_min,*new_max; + uchar *new_min,*new_max; uint8 flag_min,flag_max; if (cmp_min_to_min(arg) >= 0) { @@ -398,7 +398,7 @@ public: min_flag=arg->max_flag & NEAR_MAX ? 0 : NEAR_MIN; } /* returns a number of keypart values (0 or 1) appended to the key buffer */ - int store_min(uint length,char **min_key,uint min_key_flag) + int store_min(uint length, uchar **min_key,uint min_key_flag) { if ((min_flag & GEOM_FLAG) || (!(min_flag & NO_MIN_RANGE) && @@ -417,7 +417,7 @@ public: return 0; } /* returns a number of keypart values (0 or 1) appended to the key buffer */ - int store_max(uint length,char **max_key, uint max_key_flag) + int store_max(uint length, uchar **max_key, uint max_key_flag) { if (!(max_flag & NO_MAX_RANGE) && !(max_key_flag & (NO_MAX_RANGE | NEAR_MAX))) @@ -436,7 +436,7 @@ public: } /* returns a number of keypart values appended to the key buffer */ - int store_min_key(KEY_PART *key,char **range_key, uint *range_key_flag) + int store_min_key(KEY_PART *key, uchar **range_key, uint *range_key_flag) { SEL_ARG *key_tree= first(); uint res= key_tree->store_min(key[key_tree->part].store_length, @@ -452,7 +452,7 @@ public: } /* returns a number of keypart values appended to the key buffer */ - int store_max_key(KEY_PART *key,char **range_key, uint *range_key_flag) + int store_max_key(KEY_PART *key, uchar **range_key, uint *range_key_flag) { SEL_ARG *key_tree= last(); uint res=key_tree->store_max(key[key_tree->part].store_length, @@ -534,8 +534,8 @@ public: */ if (min_flag || max_flag) return FALSE; - byte *min_val= (byte *)min_value; - byte *max_val= (byte *)max_value; + uchar *min_val= min_value; + uchar *max_val= max_value; if (maybe_null) { @@ -641,8 +641,7 @@ public: longlong baseflag; uint max_key_part, range_count; - - char min_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH], + uchar min_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH], max_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH]; bool quick; // Don't calulate possible keys @@ -683,8 +682,8 @@ static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts); static ha_rows check_quick_select(PARAM *param,uint index,SEL_ARG *key_tree, bool update_tbl_stats); static ha_rows check_quick_keys(PARAM *param,uint index,SEL_ARG *key_tree, - char *min_key, uint min_key_flag, int, - char *max_key, uint max_key_flag, int); + uchar *min_key, uint min_key_flag, int, + uchar *max_key, uint max_key_flag, int); QUICK_RANGE_SELECT *get_quick_select(PARAM *param,uint index, SEL_ARG *key_tree, @@ -726,12 +725,12 @@ static SEL_ARG *key_and(RANGE_OPT_PARAM *param, SEL_ARG *key1, SEL_ARG *key2, uint clone_flag); static bool get_range(SEL_ARG **e1,SEL_ARG **e2,SEL_ARG *root1); bool get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key, - SEL_ARG *key_tree,char *min_key,uint min_key_flag, - char *max_key,uint max_key_flag); + SEL_ARG *key_tree, uchar *min_key,uint min_key_flag, + uchar *max_key,uint max_key_flag); static bool eq_tree(SEL_ARG* a,SEL_ARG *b); static SEL_ARG null_element(SEL_ARG::IMPOSSIBLE); -static bool null_part_in_key(KEY_PART *key_part, const char *key, +static bool null_part_in_key(KEY_PART *key_part, const uchar *key, uint length); bool sel_trees_can_be_ored(SEL_TREE *tree1, SEL_TREE *tree2, RANGE_OPT_PARAM* param); @@ -986,7 +985,7 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables, select->file= *head->sort.io_cache; select->records=(ha_rows) (select->file.end_of_file/ head->file->ref_length); - my_free((gptr) (head->sort.io_cache),MYF(0)); + my_free(head->sort.io_cache, MYF(0)); head->sort.io_cache=0; } DBUG_RETURN(select); @@ -1192,8 +1191,8 @@ QUICK_ROR_INTERSECT_SELECT::QUICK_ROR_INTERSECT_SELECT(THD *thd_param, init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0); else bzero(&alloc, sizeof(MEM_ROOT)); - last_rowid= (byte*)alloc_root(parent_alloc? parent_alloc : &alloc, - head->file->ref_length); + last_rowid= (uchar*) alloc_root(parent_alloc? parent_alloc : &alloc, + head->file->ref_length); } @@ -1450,7 +1449,7 @@ int QUICK_ROR_UNION_SELECT::init() DBUG_RETURN(1); } - if (!(cur_rowid= (byte*)alloc_root(&alloc, 2*head->file->ref_length))) + if (!(cur_rowid= (uchar*) alloc_root(&alloc, 2*head->file->ref_length))) DBUG_RETURN(1); prev_rowid= cur_rowid + head->file->ref_length; DBUG_RETURN(0); @@ -1468,7 +1467,7 @@ int QUICK_ROR_UNION_SELECT::init() val2 Second merged select */ -int QUICK_ROR_UNION_SELECT::queue_cmp(void *arg, byte *val1, byte *val2) +int QUICK_ROR_UNION_SELECT::queue_cmp(void *arg, uchar *val1, uchar *val2) { QUICK_ROR_UNION_SELECT *self= (QUICK_ROR_UNION_SELECT*)arg; return self->head->file->cmp_ref(((QUICK_SELECT_I*)val1)->last_rowid, @@ -1519,7 +1518,7 @@ int QUICK_ROR_UNION_SELECT::reset() DBUG_RETURN(error); } quick->save_last_pos(); - queue_insert(&queue, (byte*)quick); + queue_insert(&queue, (uchar*)quick); } if (head->file->ha_rnd_init(1)) @@ -1580,16 +1579,18 @@ inline void SEL_ARG::make_root() use_count=0; elements=1; } -SEL_ARG::SEL_ARG(Field *f,const char *min_value_arg,const char *max_value_arg) +SEL_ARG::SEL_ARG(Field *f,const uchar *min_value_arg, + const uchar *max_value_arg) :min_flag(0), max_flag(0), maybe_flag(0), maybe_null(f->real_maybe_null()), - elements(1), use_count(1), field(f), min_value((char*) min_value_arg), - max_value((char*) max_value_arg), next(0),prev(0), + elements(1), use_count(1), field(f), min_value((uchar*) min_value_arg), + max_value((uchar*) max_value_arg), next(0),prev(0), next_key_part(0),color(BLACK),type(KEY_RANGE) { left=right= &null_element; } -SEL_ARG::SEL_ARG(Field *field_,uint8 part_,char *min_value_,char *max_value_, +SEL_ARG::SEL_ARG(Field *field_,uint8 part_, + uchar *min_value_, uchar *max_value_, uint8 min_flag_,uint8 max_flag_,uint8 maybe_flag_) :min_flag(min_flag_),max_flag(max_flag_),maybe_flag(maybe_flag_), part(part_),maybe_null(field_->real_maybe_null()), elements(1),use_count(1), @@ -1667,7 +1668,8 @@ SEL_ARG *SEL_ARG::last() Returns -2 or 2 if the ranges where 'joined' like < 2 and >= 2 */ -static int sel_cmp(Field *field, char *a,char *b,uint8 a_flag,uint8 b_flag) +static int sel_cmp(Field *field, uchar *a, uchar *b, uint8 a_flag, + uint8 b_flag) { int cmp; /* First check if there was a compare to a min or max element */ @@ -1691,7 +1693,7 @@ static int sel_cmp(Field *field, char *a,char *b,uint8 a_flag,uint8 b_flag) goto end; // NULL where equal a++; b++; // Skip NULL marker } - cmp=field->key_cmp((byte*) a,(byte*) b); + cmp=field->key_cmp(a , b); if (cmp) return cmp < 0 ? -1 : 1; // The values differed // Check if the compared equal arguments was defined with open/closed range @@ -1970,7 +1972,7 @@ private: KEY *index_info; uint index; uint key_infix_len; - byte key_infix[MAX_KEY_LENGTH]; + uchar key_infix[MAX_KEY_LENGTH]; SEL_TREE *range_tree; /* Represents all range predicates in the query. */ SEL_ARG *index_tree; /* The SEL_ARG sub-tree corresponding to index_info. */ uint param_idx; /* Index of used key in param->key. */ @@ -1983,7 +1985,7 @@ public: uint group_prefix_len_arg, uint used_key_parts_arg, uint group_key_parts_arg, KEY *index_info_arg, uint index_arg, uint key_infix_len_arg, - byte *key_infix_arg, + uchar *key_infix_arg, SEL_TREE *tree_arg, SEL_ARG *index_tree_arg, uint param_idx_arg, ha_rows quick_prefix_records_arg) : have_min(have_min_arg), have_max(have_max_arg), @@ -2714,7 +2716,7 @@ end: format. */ -void store_key_image_to_rec(Field *field, char *ptr, uint len) +void store_key_image_to_rec(Field *field, uchar *ptr, uint len) { /* Do the same as print_key() does */ my_bitmap_map *old_map; @@ -3416,7 +3418,7 @@ static void dbug_print_segment_range(SEL_ARG *arg, KEY_PART *part) DBUG_LOCK_FILE; if (!(arg->min_flag & NO_MIN_RANGE)) { - store_key_image_to_rec(part->field, (char*)(arg->min_value), part->length); + store_key_image_to_rec(part->field, arg->min_value, part->length); dbug_print_field(part->field); if (arg->min_flag & NEAR_MIN) fputs(" < ", DBUG_FILE); @@ -3432,7 +3434,7 @@ static void dbug_print_segment_range(SEL_ARG *arg, KEY_PART *part) fputs(" < ", DBUG_FILE); else fputs(" <= ", DBUG_FILE); - store_key_image_to_rec(part->field, (char*)(arg->max_value), part->length); + store_key_image_to_rec(part->field, arg->max_value, part->length); dbug_print_field(part->field); } fputs("\n", DBUG_FILE); @@ -4169,8 +4171,8 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info, { double selectivity_mult= 1.0; KEY_PART_INFO *key_part= info->param->table->key_info[scan->keynr].key_part; - byte key_val[MAX_KEY_LENGTH+MAX_FIELD_WIDTH]; /* key values tuple */ - char *key_ptr= (char*) key_val; + uchar key_val[MAX_KEY_LENGTH+MAX_FIELD_WIDTH]; /* key values tuple */ + uchar *key_ptr= key_val; SEL_ARG *sel_arg, *tuple_arg= NULL; key_part_map keypart_map= 0; bool cur_covered; @@ -4178,9 +4180,9 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info, key_part->fieldnr-1)); key_range min_range; key_range max_range; - min_range.key= (byte*) key_val; + min_range.key= key_val; min_range.flag= HA_READ_KEY_EXACT; - max_range.key= (byte*) key_val; + max_range.key= key_val; max_range.flag= HA_READ_AFTER_KEY; ha_rows prev_records= info->param->table->file->stats.records; DBUG_ENTER("ror_scan_selectivity"); @@ -4209,7 +4211,7 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info, &key_ptr, 0); keypart_map= (keypart_map << 1) | 1; } - min_range.length= max_range.length= ((char*) key_ptr - (char*) key_val); + min_range.length= max_range.length= (size_t) (key_ptr - key_val); min_range.keypart_map= max_range.keypart_map= keypart_map; records= (info->param->table->file-> records_in_range(scan->keynr, &min_range, &max_range)); @@ -5549,7 +5551,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, bool optimize_range; SEL_ARG *tree= 0; MEM_ROOT *alloc= param->mem_root; - char *str; + uchar *str; ulong orig_sql_mode; int err; DBUG_ENTER("get_mm_leaf"); @@ -5611,9 +5613,10 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, if (type == Item_func::LIKE_FUNC) { bool like_error; - char buff1[MAX_FIELD_WIDTH],*min_str,*max_str; + char buff1[MAX_FIELD_WIDTH]; + uchar *min_str,*max_str; String tmp(buff1,sizeof(buff1),value->collation.collation),*res; - uint length,offset,min_length,max_length; + size_t length, offset, min_length, max_length; uint field_length= field->pack_length()+maybe_null; if (!optimize_range) @@ -5660,7 +5663,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, field_length= length; } length+=offset; - if (!(min_str= (char*) alloc_root(alloc, length*2))) + if (!(min_str= (uchar*) alloc_root(alloc, length*2))) goto end; max_str=min_str+length; @@ -5673,7 +5676,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, ((Item_func_like*)(param->cond))->escape, wild_one, wild_many, field_length, - min_str+offset, max_str+offset, + (char*) min_str+offset, (char*) max_str+offset, &min_length, &max_length); if (like_error) // Can't optimize with LIKE goto end; @@ -5735,12 +5738,13 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, goto end; } field->table->in_use->variables.sql_mode= orig_sql_mode; - str= (char*) alloc_root(alloc, key_part->store_length+1); + str= (uchar*) alloc_root(alloc, key_part->store_length+1); if (!str) goto end; if (maybe_null) - *str= (char) field->is_real_null(); // Set to 1 if null - field->get_key_image(str+maybe_null, key_part->length, key_part->image_type); + *str= (uchar) field->is_real_null(); // Set to 1 if null + field->get_key_image(str+maybe_null, key_part->length, + key_part->image_type); if (!(tree= new (alloc) SEL_ARG(field, str, str))) goto end; // out of memory @@ -7244,13 +7248,13 @@ check_quick_select(PARAM *param,uint idx,SEL_ARG *tree, bool update_tbl_stats) static ha_rows check_quick_keys(PARAM *param, uint idx, SEL_ARG *key_tree, - char *min_key, uint min_key_flag, int min_keypart, - char *max_key, uint max_key_flag, int max_keypart) + uchar *min_key, uint min_key_flag, int min_keypart, + uchar *max_key, uint max_key_flag, int max_keypart) { ha_rows records=0, tmp; uint tmp_min_flag, tmp_max_flag, keynr, min_key_length, max_key_length; uint tmp_min_keypart= min_keypart, tmp_max_keypart= max_keypart; - char *tmp_min_key, *tmp_max_key; + uchar *tmp_min_key, *tmp_max_key; uint8 save_first_null_comp= param->first_null_comp; param->max_key_part=max(param->max_key_part,key_tree->part); @@ -7370,7 +7374,7 @@ check_quick_keys(PARAM *param, uint idx, SEL_ARG *key_tree, if (tmp_min_flag & GEOM_FLAG) { key_range min_range; - min_range.key= (byte*) param->min_key; + min_range.key= param->min_key; min_range.length= min_key_length; min_range.keypart_map= make_keypart_map(tmp_min_keypart); /* In this case tmp_min_flag contains the handler-read-function */ @@ -7383,12 +7387,12 @@ check_quick_keys(PARAM *param, uint idx, SEL_ARG *key_tree, { key_range min_range, max_range; - min_range.key= (byte*) param->min_key; + min_range.key= param->min_key; min_range.length= min_key_length; min_range.flag= (tmp_min_flag & NEAR_MIN ? HA_READ_AFTER_KEY : HA_READ_KEY_EXACT); min_range.keypart_map= make_keypart_map(tmp_min_keypart); - max_range.key= (byte*) param->max_key; + max_range.key= param->max_key; max_range.length= max_key_length; max_range.flag= (tmp_max_flag & NEAR_MAX ? HA_READ_BEFORE_KEY : HA_READ_AFTER_KEY); @@ -7557,8 +7561,8 @@ get_quick_select(PARAM *param,uint idx,SEL_ARG *key_tree, */ bool get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key, - SEL_ARG *key_tree,char *min_key,uint min_key_flag, - char *max_key, uint max_key_flag) + SEL_ARG *key_tree, uchar *min_key,uint min_key_flag, + uchar *max_key, uint max_key_flag) { QUICK_RANGE *range; uint flag; @@ -7571,7 +7575,7 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key, min_key,min_key_flag, max_key, max_key_flag)) return 1; } - char *tmp_min_key=min_key,*tmp_max_key=max_key; + uchar *tmp_min_key=min_key,*tmp_max_key=max_key; min_part+= key_tree->store_min(key[key_tree->part].store_length, &tmp_min_key,min_key_flag); max_part+= key_tree->store_max(key[key_tree->part].store_length, @@ -7595,10 +7599,10 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key, uint tmp_min_flag=key_tree->min_flag,tmp_max_flag=key_tree->max_flag; if (!tmp_min_flag) min_part+= key_tree->next_key_part->store_min_key(key, &tmp_min_key, - &tmp_min_flag); + &tmp_min_flag); if (!tmp_max_flag) max_part+= key_tree->next_key_part->store_max_key(key, &tmp_max_key, - &tmp_max_flag); + &tmp_max_flag); flag=tmp_min_flag | tmp_max_flag; } } @@ -7646,10 +7650,10 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key, } /* Get range for retrieving rows in QUICK_SELECT::get_next */ - if (!(range= new QUICK_RANGE((const char *) param->min_key, + if (!(range= new QUICK_RANGE(param->min_key, (uint) (tmp_min_key - param->min_key), min_part >=0 ? make_keypart_map(min_part) : 0, - (const char *) param->max_key, + param->max_key, (uint) (tmp_max_key - param->max_key), max_part >=0 ? make_keypart_map(max_part) : 0, flag))) @@ -7658,7 +7662,7 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key, set_if_bigger(quick->max_used_key_length, range->min_length); set_if_bigger(quick->max_used_key_length, range->max_length); set_if_bigger(quick->used_key_parts, (uint) key_tree->part+1); - if (insert_dynamic(&quick->ranges, (gptr)&range)) + if (insert_dynamic(&quick->ranges, (uchar*) &range)) return 1; end: @@ -7691,9 +7695,9 @@ bool QUICK_RANGE_SELECT::unique_key_range() /* Returns TRUE if any part of the key is NULL */ -static bool null_part_in_key(KEY_PART *key_part, const char *key, uint length) +static bool null_part_in_key(KEY_PART *key_part, const uchar *key, uint length) { - for (const char *end=key+length ; + for (const uchar *end=key+length ; key < end; key+= key_part++->store_length) { @@ -7796,7 +7800,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, !(range= new(alloc) QUICK_RANGE())) goto err; // out of memory - range->min_key= range->max_key= (char*) ref->key_buff; + range->min_key= range->max_key= ref->key_buff; range->min_length= range->max_length= ref->key_length; range->min_keypart_map= range->max_keypart_map= make_prev_keypart_map(ref->key_parts); @@ -7817,7 +7821,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, key_part->null_bit= key_info->key_part[part].null_bit; key_part->flag= (uint8) key_info->key_part[part].key_part_flag; } - if (insert_dynamic(&quick->ranges,(gptr)&range)) + if (insert_dynamic(&quick->ranges,(uchar*)&range)) goto err; /* @@ -7832,13 +7836,13 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, *ref->null_ref_key= 1; // Set null byte then create a range if (!(null_range= new (alloc) - QUICK_RANGE((char*)ref->key_buff, ref->key_length, + QUICK_RANGE(ref->key_buff, ref->key_length, make_prev_keypart_map(ref->key_parts), - (char*)ref->key_buff, ref->key_length, + ref->key_buff, ref->key_length, make_prev_keypart_map(ref->key_parts), EQ_RANGE))) goto err; *ref->null_ref_key= 0; // Clear null byte - if (insert_dynamic(&quick->ranges,(gptr)&null_range)) + if (insert_dynamic(&quick->ranges,(uchar*)&null_range)) goto err; } @@ -8093,7 +8097,7 @@ int QUICK_ROR_UNION_SELECT::get_next() { int error, dup_row; QUICK_SELECT_I *quick; - byte *tmp; + uchar *tmp; DBUG_ENTER("QUICK_ROR_UNION_SELECT::get_next"); do @@ -8143,7 +8147,7 @@ int QUICK_ROR_UNION_SELECT::get_next() int QUICK_RANGE_SELECT::reset() { uint mrange_bufsiz; - byte *mrange_buff; + uchar *mrange_buff; DBUG_ENTER("QUICK_RANGE_SELECT::reset"); next=0; last_range= NULL; @@ -8186,8 +8190,9 @@ int QUICK_RANGE_SELECT::reset() while (mrange_bufsiz && ! my_multi_malloc(MYF(MY_WME), - &multi_range_buff, sizeof(*multi_range_buff), - &mrange_buff, mrange_bufsiz, + &multi_range_buff, + (uint) sizeof(*multi_range_buff), + &mrange_buff, (uint) mrange_bufsiz, NullS)) { /* Try to shrink the buffers until both are 0. */ @@ -8282,13 +8287,13 @@ int QUICK_RANGE_SELECT::get_next() end_key= &mrange_slot->end_key; last_range= *(cur_range++); - start_key->key= (const byte*) last_range->min_key; + start_key->key= (const uchar*) last_range->min_key; start_key->length= last_range->min_length; start_key->flag= ((last_range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY : (last_range->flag & EQ_RANGE) ? HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT); start_key->keypart_map= last_range->min_keypart_map; - end_key->key= (const byte*) last_range->max_key; + end_key->key= (const uchar*) last_range->max_key; end_key->length= last_range->max_length; /* We use HA_READ_AFTER_KEY here because if we are reading on a key @@ -8348,7 +8353,7 @@ end: int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length, key_part_map keypart_map, - byte *cur_prefix) + uchar *cur_prefix) { DBUG_ENTER("QUICK_RANGE_SELECT::get_next_prefix"); @@ -8374,13 +8379,13 @@ int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length, } last_range= *(cur_range++); - start_key.key= (const byte*) last_range->min_key; + start_key.key= (const uchar*) last_range->min_key; start_key.length= min(last_range->min_length, prefix_length); start_key.keypart_map= last_range->min_keypart_map & keypart_map; start_key.flag= ((last_range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY : (last_range->flag & EQ_RANGE) ? HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT); - end_key.key= (const byte*) last_range->max_key; + end_key.key= (const uchar*) last_range->max_key; end_key.length= min(last_range->max_length, prefix_length); end_key.keypart_map= last_range->max_keypart_map & keypart_map; /* @@ -8416,7 +8421,7 @@ int QUICK_RANGE_SELECT_GEOM::get_next() if (last_range) { // Already read through key - result= file->index_next_same(record, (byte*) last_range->min_key, + result= file->index_next_same(record, last_range->min_key, last_range->min_length); if (result != HA_ERR_END_OF_FILE) DBUG_RETURN(result); @@ -8431,7 +8436,7 @@ int QUICK_RANGE_SELECT_GEOM::get_next() } last_range= *(cur_range++); - result= file->index_read(record, (byte*) last_range->min_key, + result= file->index_read(record, last_range->min_key, last_range->min_keypart_map, (ha_rkey_function)(last_range->flag ^ GEOM_FLAG)); if (result != HA_ERR_KEY_NOT_FOUND && result != HA_ERR_END_OF_FILE) @@ -8536,7 +8541,7 @@ int QUICK_SELECT_DESC::get_next() if (last_range) { // Already read through key result = ((last_range->flag & EQ_RANGE) - ? file->index_next_same(record, (byte*) last_range->min_key, + ? file->index_next_same(record, last_range->min_key, last_range->min_length) : file->index_prev(record)); if (!result) @@ -8564,14 +8569,14 @@ int QUICK_SELECT_DESC::get_next() if (last_range->flag & EQ_RANGE) { - result = file->index_read(record, (byte*) last_range->max_key, + result = file->index_read(record, last_range->max_key, last_range->max_keypart_map, HA_READ_KEY_EXACT); } else { DBUG_ASSERT(last_range->flag & NEAR_MAX || range_reads_after_key(last_range)); - result=file->index_read(record, (byte*) last_range->max_key, + result=file->index_read(record, last_range->max_key, last_range->max_keypart_map, ((last_range->flag & NEAR_MAX) ? HA_READ_BEFORE_KEY : @@ -8608,7 +8613,7 @@ int QUICK_RANGE_SELECT::cmp_next(QUICK_RANGE *range_arg) KEY_PART *key_part=key_parts; uint store_length; - for (char *key=range_arg->max_key, *end=key+range_arg->max_length; + for (uchar *key=range_arg->max_key, *end=key+range_arg->max_length; key < end; key+= store_length, key_part++) { @@ -8627,7 +8632,7 @@ int QUICK_RANGE_SELECT::cmp_next(QUICK_RANGE *range_arg) key++; // Skip null byte store_length--; } - if ((cmp=key_part->field->key_cmp((byte*) key, key_part->length)) < 0) + if ((cmp=key_part->field->key_cmp(key, key_part->length)) < 0) return 0; if (cmp > 0) return 1; @@ -8646,7 +8651,7 @@ int QUICK_RANGE_SELECT::cmp_prev(QUICK_RANGE *range_arg) if (range_arg->flag & NO_MIN_RANGE) return 0; /* key can't be to small */ - cmp= key_cmp(key_part_info, (byte*) range_arg->min_key, + cmp= key_cmp(key_part_info, range_arg->min_key, range_arg->min_length); if (cmp > 0 || cmp == 0 && !(range_arg->flag & NEAR_MIN)) return 0; @@ -8896,7 +8901,7 @@ static bool get_constant_key_infix(KEY *index_info, SEL_ARG *index_range_tree, KEY_PART_INFO *first_non_group_part, KEY_PART_INFO *min_max_arg_part, KEY_PART_INFO *last_part, THD *thd, - byte *key_infix, uint *key_infix_len, + uchar *key_infix, uint *key_infix_len, KEY_PART_INFO **first_non_infix_part); static bool check_group_min_max_predicates(COND *cond, Item_field *min_max_arg_item, @@ -9053,7 +9058,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree) uint index= 0; /* The id of the chosen index. */ uint group_key_parts= 0; // Number of index key parts in the group prefix. uint used_key_parts= 0; /* Number of index key parts used for access. */ - byte key_infix[MAX_KEY_LENGTH]; /* Constants from equality predicates.*/ + uchar key_infix[MAX_KEY_LENGTH]; /* Constants from equality predicates.*/ uint key_infix_len= 0; /* Length of key_infix. */ TRP_GROUP_MIN_MAX *read_plan= NULL; /* The eventually constructed TRP. */ uint key_part_nr; @@ -9337,7 +9342,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree) /* Check if cur_part is referenced in the WHERE clause. */ if (join->conds->walk(&Item::find_item_in_field_list_processor, 0, - (byte*) key_part_range)) + (uchar*) key_part_range)) goto next_index; } } @@ -9607,7 +9612,7 @@ get_constant_key_infix(KEY *index_info, SEL_ARG *index_range_tree, KEY_PART_INFO *first_non_group_part, KEY_PART_INFO *min_max_arg_part, KEY_PART_INFO *last_part, THD *thd, - byte *key_infix, uint *key_infix_len, + uchar *key_infix, uint *key_infix_len, KEY_PART_INFO **first_non_infix_part) { SEL_ARG *cur_range; @@ -9616,7 +9621,7 @@ get_constant_key_infix(KEY *index_info, SEL_ARG *index_range_tree, KEY_PART_INFO *end_part= min_max_arg_part ? min_max_arg_part : last_part; *key_infix_len= 0; - byte *key_ptr= key_infix; + uchar *key_ptr= key_infix; for (cur_part= first_non_group_part; cur_part != end_part; cur_part++) { /* @@ -10006,7 +10011,7 @@ QUICK_GROUP_MIN_MAX_SELECT(TABLE *table, JOIN *join_arg, bool have_min_arg, uint used_key_parts_arg, KEY *index_info_arg, uint use_index, double read_cost_arg, ha_rows records_arg, uint key_infix_len_arg, - byte *key_infix_arg, MEM_ROOT *parent_alloc) + uchar *key_infix_arg, MEM_ROOT *parent_alloc) :join(join_arg), index_info(index_info_arg), group_prefix_len(group_prefix_len_arg), have_min(have_min_arg), have_max(have_max_arg), seen_first_key(FALSE), @@ -10064,13 +10069,13 @@ int QUICK_GROUP_MIN_MAX_SELECT::init() if (group_prefix) /* Already initialized. */ return 0; - if (!(last_prefix= (byte*) alloc_root(&alloc, group_prefix_len))) + if (!(last_prefix= (uchar*) alloc_root(&alloc, group_prefix_len))) return 1; /* We may use group_prefix to store keys with all select fields, so allocate enough space for it. */ - if (!(group_prefix= (byte*) alloc_root(&alloc, + if (!(group_prefix= (uchar*) alloc_root(&alloc, real_prefix_len + min_max_arg_len))) return 1; @@ -10080,7 +10085,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::init() The memory location pointed to by key_infix will be deleted soon, so allocate a new buffer and copy the key_infix into it. */ - byte *tmp_key_infix= (byte*) alloc_root(&alloc, key_infix_len); + uchar *tmp_key_infix= (uchar*) alloc_root(&alloc, key_infix_len); if (!tmp_key_infix) return 1; memcpy(tmp_key_infix, this->key_infix, key_infix_len); @@ -10195,7 +10200,7 @@ bool QUICK_GROUP_MIN_MAX_SELECT::add_range(SEL_ARG *sel_range) range_flag); if (!range) return TRUE; - if (insert_dynamic(&min_max_ranges, (gptr)&range)) + if (insert_dynamic(&min_max_ranges, (uchar*)&range)) return TRUE; return FALSE; } @@ -10230,7 +10235,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::adjust_prefix_ranges () { QUICK_RANGE *range; - get_dynamic(arr, (gptr)&range, inx); + get_dynamic(arr, (uchar*)&range, inx); range->flag &= ~(NEAR_MIN | NEAR_MAX); } } @@ -10266,7 +10271,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::update_key_stat() QUICK_RANGE *cur_range; if (have_min) { /* Check if the right-most range has a lower boundary. */ - get_dynamic(&min_max_ranges, (gptr)&cur_range, + get_dynamic(&min_max_ranges, (uchar*)&cur_range, min_max_ranges.elements - 1); if (!(cur_range->flag & NO_MIN_RANGE)) { @@ -10277,7 +10282,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::update_key_stat() } if (have_max) { /* Check if the left-most range has an upper boundary. */ - get_dynamic(&min_max_ranges, (gptr)&cur_range, 0); + get_dynamic(&min_max_ranges, (uchar*)&cur_range, 0); if (!(cur_range->flag & NO_MAX_RANGE)) { max_used_key_length+= min_max_arg_len; @@ -10603,7 +10608,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_prefix() if (quick_prefix_select) { - byte *cur_prefix= seen_first_key ? group_prefix : NULL; + uchar *cur_prefix= seen_first_key ? group_prefix : NULL; if ((result= quick_prefix_select->get_next_prefix(group_prefix_len, make_prev_keypart_map(group_key_parts), cur_prefix))) DBUG_RETURN(result); @@ -10673,14 +10678,14 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min_in_range() for (uint range_idx= 0; range_idx < min_max_ranges.elements; range_idx++) { /* Search from the left-most range to the right. */ - get_dynamic(&min_max_ranges, (gptr)&cur_range, range_idx); + get_dynamic(&min_max_ranges, (uchar*)&cur_range, range_idx); /* If the current value for the min/max argument is bigger than the right boundary of cur_range, there is no need to check this range. */ if (range_idx != 0 && !(cur_range->flag & NO_MAX_RANGE) && - (key_cmp(min_max_arg_part, (const byte*) cur_range->max_key, + (key_cmp(min_max_arg_part, (const uchar*) cur_range->max_key, min_max_arg_len) == 1)) continue; @@ -10741,7 +10746,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min_in_range() if ( !(cur_range->flag & NO_MAX_RANGE) ) { /* Compose the MAX key for the range. */ - byte *max_key= (byte*) my_alloca(real_prefix_len + min_max_arg_len); + uchar *max_key= (uchar*) my_alloca(real_prefix_len + min_max_arg_len); memcpy(max_key, group_prefix, real_prefix_len); memcpy(max_key + real_prefix_len, cur_range->max_key, cur_range->max_length); @@ -10805,7 +10810,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range() for (uint range_idx= min_max_ranges.elements; range_idx > 0; range_idx--) { /* Search from the right-most range to the left. */ - get_dynamic(&min_max_ranges, (gptr)&cur_range, range_idx - 1); + get_dynamic(&min_max_ranges, (uchar*)&cur_range, range_idx - 1); /* If the current value for the min/max argument is smaller than the left @@ -10813,7 +10818,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range() */ if (range_idx != min_max_ranges.elements && !(cur_range->flag & NO_MIN_RANGE) && - (key_cmp(min_max_arg_part, (const byte*) cur_range->min_key, + (key_cmp(min_max_arg_part, (const uchar*) cur_range->min_key, min_max_arg_len) == -1)) continue; @@ -10859,7 +10864,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range() if ( !(cur_range->flag & NO_MIN_RANGE) ) { /* Compose the MIN key for the range. */ - byte *min_key= (byte*) my_alloca(real_prefix_len + min_max_arg_len); + uchar *min_key= (uchar*) my_alloca(real_prefix_len + min_max_arg_len); memcpy(min_key, group_prefix, real_prefix_len); memcpy(min_key + real_prefix_len, cur_range->min_key, cur_range->min_length); @@ -11030,10 +11035,10 @@ static void print_ror_scans_arr(TABLE *table, const char *msg, *****************************************************************************/ static void -print_key(KEY_PART *key_part,const char *key,uint used_length) +print_key(KEY_PART *key_part, const uchar *key, uint used_length) { char buff[1024]; - const char *key_end= key+used_length; + const uchar *key_end= key+used_length; String tmp(buff,sizeof(buff),&my_charset_bin); uint store_length; TABLE *table= key_part->field->table; @@ -11056,7 +11061,7 @@ print_key(KEY_PART *key_part,const char *key,uint used_length) key++; // Skip null byte store_length--; } - field->set_key_image((char*) key, key_part->length); + field->set_key_image(key, key_part->length); if (field->type() == MYSQL_TYPE_BIT) (void) field->val_int_as_str(&tmp, 1); else @@ -11111,7 +11116,7 @@ void QUICK_RANGE_SELECT::dbug_dump(int indent, bool verbose) range= *pr; if (!(range->flag & NO_MIN_RANGE)) { - print_key(key_parts,range->min_key,range->min_length); + print_key(key_parts, range->min_key, range->min_length); if (range->flag & NEAR_MIN) fputs(" < ",DBUG_FILE); else @@ -11125,7 +11130,7 @@ void QUICK_RANGE_SELECT::dbug_dump(int indent, bool verbose) fputs(" < ",DBUG_FILE); else fputs(" <= ",DBUG_FILE); - print_key(key_parts,range->max_key,range->max_length); + print_key(key_parts, range->max_key, range->max_length); } fputs("\n",DBUG_FILE); } diff --git a/sql/opt_range.h b/sql/opt_range.h index 1ad9567cddd..d86cab11ef3 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -35,7 +35,7 @@ typedef struct st_key_part { class QUICK_RANGE :public Sql_alloc { public: - char *min_key,*max_key; + uchar *min_key,*max_key; uint16 min_length,max_length,flag; key_part_map min_keypart_map, // bitmap of used keyparts in min_key max_keypart_map; // bitmap of used keyparts in max_key @@ -43,13 +43,13 @@ class QUICK_RANGE :public Sql_alloc { uint16 dummy; /* Avoid warnings on 'flag' */ #endif QUICK_RANGE(); /* Full range */ - QUICK_RANGE(const char *min_key_arg, uint min_length_arg, + QUICK_RANGE(const uchar *min_key_arg, uint min_length_arg, key_part_map min_keypart_map_arg, - const char *max_key_arg, uint max_length_arg, + const uchar *max_key_arg, uint max_length_arg, key_part_map max_keypart_map_arg, uint flag_arg) - : min_key((char*) sql_memdup(min_key_arg,min_length_arg+1)), - max_key((char*) sql_memdup(max_key_arg,max_length_arg+1)), + : min_key((uchar*) sql_memdup(min_key_arg,min_length_arg+1)), + max_key((uchar*) sql_memdup(max_key_arg,max_length_arg+1)), min_length((uint16) min_length_arg), max_length((uint16) max_length_arg), min_keypart_map(min_keypart_map_arg), @@ -241,12 +241,12 @@ public: rowid of last row retrieved by this quick select. This is used only when doing ROR-index_merge selects */ - byte *last_rowid; + uchar *last_rowid; /* Table record buffer used by this quick select. */ - byte *record; + uchar *record; #ifndef DBUG_OFF /* Print quick select information to DBUG_FILE. Caller is responsible @@ -296,8 +296,8 @@ protected: friend bool get_quick_keys(PARAM *param, QUICK_RANGE_SELECT *quick,KEY_PART *key, SEL_ARG *key_tree, - char *min_key, uint min_key_flag, - char *max_key, uint max_key_flag); + uchar *min_key, uint min_key_flag, + uchar *max_key, uint max_key_flag); friend QUICK_RANGE_SELECT *get_quick_select(PARAM*,uint idx, SEL_ARG *key_tree, MEM_ROOT *alloc); @@ -327,7 +327,7 @@ public: int get_next(); void range_end(); int get_next_prefix(uint prefix_length, key_part_map keypart_map, - byte *cur_prefix); + uchar *cur_prefix); bool reverse_sorted() { return 0; } bool unique_key_range(); int init_ror_merged_scan(bool reuse_handler); @@ -561,12 +561,12 @@ public: MEM_ROOT alloc; /* Memory pool for this and merged quick selects data. */ THD *thd; /* current thread */ - byte *cur_rowid; /* buffer used in get_next() */ - byte *prev_rowid; /* rowid of last row returned by get_next() */ + uchar *cur_rowid; /* buffer used in get_next() */ + uchar *prev_rowid; /* rowid of last row returned by get_next() */ bool have_prev_rowid; /* true if prev_rowid has valid data */ uint rowid_length; /* table rowid length */ private: - static int queue_cmp(void *arg, byte *val1, byte *val2); + static int queue_cmp(void *arg, uchar *val1, uchar *val2); bool scans_inited; }; @@ -610,19 +610,19 @@ private: handler *file; /* The handler used to get data. */ JOIN *join; /* Descriptor of the current query */ KEY *index_info; /* The index chosen for data access */ - byte *record; /* Buffer where the next record is returned. */ - byte *tmp_record; /* Temporary storage for next_min(), next_max(). */ - byte *group_prefix; /* Key prefix consisting of the GROUP fields. */ + uchar *record; /* Buffer where the next record is returned. */ + uchar *tmp_record; /* Temporary storage for next_min(), next_max(). */ + uchar *group_prefix; /* Key prefix consisting of the GROUP fields. */ uint group_prefix_len; /* Length of the group prefix. */ uint group_key_parts; /* A number of keyparts in the group prefix */ - byte *last_prefix; /* Prefix of the last group for detecting EOF. */ + uchar *last_prefix; /* Prefix of the last group for detecting EOF. */ bool have_min; /* Specify whether we are computing */ bool have_max; /* a MIN, a MAX, or both. */ bool seen_first_key; /* Denotes whether the first key was retrieved.*/ KEY_PART_INFO *min_max_arg_part; /* The keypart of the only argument field */ /* of all MIN/MAX functions. */ uint min_max_arg_len; /* The length of the MIN/MAX argument field */ - byte *key_infix; /* Infix of constants from equality predicates. */ + uchar *key_infix; /* Infix of constants from equality predicates. */ uint key_infix_len; DYNAMIC_ARRAY min_max_ranges; /* Array of range ptrs for the MIN/MAX field. */ uint real_prefix_len; /* Length of key prefix extended with key_infix. */ @@ -652,7 +652,7 @@ public: uint group_prefix_len, uint group_key_parts, uint used_key_parts, KEY *index_info, uint use_index, double read_cost, ha_rows records, uint - key_infix_len, byte *key_infix, MEM_ROOT + key_infix_len, uchar *key_infix, MEM_ROOT *parent_alloc); ~QUICK_GROUP_MIN_MAX_SELECT(); bool add_range(SEL_ARG *sel_range); @@ -736,7 +736,7 @@ uint get_index_for_order(TABLE *table, ORDER *order, ha_rows limit); #ifdef WITH_PARTITION_STORAGE_ENGINE bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond); -void store_key_image_to_rec(Field *field, char *ptr, uint len); +void store_key_image_to_rec(Field *field, uchar *ptr, uint len); #endif #endif diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index f9a06f3fb6e..83023b59867 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -222,7 +222,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) Item *expr=item_sum->args[0]; if (expr->real_item()->type() == Item::FIELD_ITEM) { - byte key_buff[MAX_KEY_LENGTH]; + uchar key_buff[MAX_KEY_LENGTH]; TABLE_REF ref; uint range_fl, prefix_len; @@ -309,7 +309,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) Item *expr=item_sum->args[0]; if (expr->real_item()->type() == Item::FIELD_ITEM) { - byte key_buff[MAX_KEY_LENGTH]; + uchar key_buff[MAX_KEY_LENGTH]; TABLE_REF ref; uint range_fl, prefix_len; @@ -603,7 +603,7 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo, less_fl= 1-less_fl; // Convert '<' -> '>' (etc) /* Check if field is part of the tested partial key */ - byte *key_ptr= ref->key_buff; + uchar *key_ptr= ref->key_buff; KEY_PART_INFO *part; for (part= keyinfo->key_part; ; key_ptr+= part++->store_length) @@ -652,15 +652,15 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo, if (is_null) { part->field->set_null(); - *key_ptr= (byte) 1; + *key_ptr= (uchar) 1; } else { store_val_in_field(part->field, args[between && max_fl ? 2 : 1], CHECK_FIELD_IGNORE); if (part->null_bit) - *key_ptr++= (byte) test(part->field->is_null()); - part->field->get_key_image((char*) key_ptr, part->length, Field::itRAW); + *key_ptr++= (uchar) test(part->field->is_null()); + part->field->get_key_image(key_ptr, part->length, Field::itRAW); } if (is_field_part) { diff --git a/sql/parse_file.cc b/sql/parse_file.cc index f06c7c15202..5ea49396cb4 100644 --- a/sql/parse_file.cc +++ b/sql/parse_file.cc @@ -49,27 +49,27 @@ write_escaped_string(IO_CACHE *file, LEX_STRING *val_s) */ switch(*ptr) { case '\\': // escape character - if (my_b_append(file, (const byte *)STRING_WITH_LEN("\\\\"))) + if (my_b_append(file, (const uchar *)STRING_WITH_LEN("\\\\"))) return TRUE; break; case '\n': // parameter value delimiter - if (my_b_append(file, (const byte *)STRING_WITH_LEN("\\n"))) + if (my_b_append(file, (const uchar *)STRING_WITH_LEN("\\n"))) return TRUE; break; case '\0': // problem for some string processing utilities - if (my_b_append(file, (const byte *)STRING_WITH_LEN("\\0"))) + if (my_b_append(file, (const uchar *)STRING_WITH_LEN("\\0"))) return TRUE; break; case 26: // problem for windows utilities (Ctrl-Z) - if (my_b_append(file, (const byte *)STRING_WITH_LEN("\\z"))) + if (my_b_append(file, (const uchar *)STRING_WITH_LEN("\\z"))) return TRUE; break; case '\'': // list of string delimiter - if (my_b_append(file, (const byte *)STRING_WITH_LEN("\\\'"))) + if (my_b_append(file, (const uchar *)STRING_WITH_LEN("\\\'"))) return TRUE; break; default: - if (my_b_append(file, (const byte *)ptr, 1)) + if (my_b_append(file, (const uchar *)ptr, 1)) return TRUE; } } @@ -93,7 +93,7 @@ write_escaped_string(IO_CACHE *file, LEX_STRING *val_s) */ static my_bool -write_parameter(IO_CACHE *file, gptr base, File_option *parameter, +write_parameter(IO_CACHE *file, uchar* base, File_option *parameter, ulonglong *old_version) { char num_buf[20]; // buffer for numeric operations @@ -105,7 +105,7 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter, case FILE_OPTIONS_STRING: { LEX_STRING *val_s= (LEX_STRING *)(base + parameter->offset); - if (my_b_append(file, (const byte *)val_s->str, val_s->length)) + if (my_b_append(file, (const uchar *)val_s->str, val_s->length)) DBUG_RETURN(TRUE); break; } @@ -118,7 +118,7 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter, case FILE_OPTIONS_ULONGLONG: { num.set(*((ulonglong *)(base + parameter->offset)), &my_charset_bin); - if (my_b_append(file, (const byte *)num.ptr(), num.length())) + if (my_b_append(file, (const uchar *)num.ptr(), num.length())) DBUG_RETURN(TRUE); break; } @@ -127,7 +127,7 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter, ulonglong *val_i= (ulonglong *)(base + parameter->offset); *old_version= (*val_i)++; num.set(*val_i, &my_charset_bin); - if (my_b_append(file, (const byte *)num.ptr(), num.length())) + if (my_b_append(file, (const uchar *)num.ptr(), num.length())) DBUG_RETURN(TRUE); break; } @@ -140,7 +140,7 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter, get_date(val_s->str, GETDATE_DATE_TIME|GETDATE_GMT|GETDATE_FIXEDLENGTH, tm); val_s->length= PARSE_FILE_TIMESTAMPLENGTH; - if (my_b_append(file, (const byte *)val_s->str, + if (my_b_append(file, (const uchar *)val_s->str, PARSE_FILE_TIMESTAMPLENGTH)) DBUG_RETURN(TRUE); break; @@ -154,10 +154,10 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter, while ((str= it++)) { // We need ' ' after string to detect list continuation - if ((!first && my_b_append(file, (const byte *)STRING_WITH_LEN(" "))) || - my_b_append(file, (const byte *)STRING_WITH_LEN("\'")) || + if ((!first && my_b_append(file, (const uchar *)STRING_WITH_LEN(" "))) || + my_b_append(file, (const uchar *)STRING_WITH_LEN("\'")) || write_escaped_string(file, str) || - my_b_append(file, (const byte *)STRING_WITH_LEN("\'"))) + my_b_append(file, (const uchar *)STRING_WITH_LEN("\'"))) { DBUG_RETURN(TRUE); } @@ -175,8 +175,8 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter, { num.set(*val, &my_charset_bin); // We need ' ' after string to detect list continuation - if ((!first && my_b_append(file, (const byte *)STRING_WITH_LEN(" "))) || - my_b_append(file, (const byte *)num.ptr(), num.length())) + if ((!first && my_b_append(file, (const uchar *)STRING_WITH_LEN(" "))) || + my_b_append(file, (const uchar *)num.ptr(), num.length())) { DBUG_RETURN(TRUE); } @@ -212,7 +212,7 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter, my_bool sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, const LEX_STRING *type, - gptr base, File_option *parameters, + uchar* base, File_option *parameters, uint max_versions) { File handler; @@ -254,19 +254,19 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, goto err_w_file; // write header (file signature) - if (my_b_append(&file, (const byte *)STRING_WITH_LEN("TYPE=")) || - my_b_append(&file, (const byte *)type->str, type->length) || - my_b_append(&file, (const byte *)STRING_WITH_LEN("\n"))) + if (my_b_append(&file, (const uchar *)STRING_WITH_LEN("TYPE=")) || + my_b_append(&file, (const uchar *)type->str, type->length) || + my_b_append(&file, (const uchar *)STRING_WITH_LEN("\n"))) goto err_w_file; // write parameters to temporary file for (param= parameters; param->name.str; param++) { - if (my_b_append(&file, (const byte *)param->name.str, + if (my_b_append(&file, (const uchar *)param->name.str, param->name.length) || - my_b_append(&file, (const byte *)STRING_WITH_LEN("=")) || + my_b_append(&file, (const uchar *)STRING_WITH_LEN("=")) || write_parameter(&file, base, param, &old_version) || - my_b_append(&file, (const byte *)STRING_WITH_LEN("\n"))) + my_b_append(&file, (const uchar *)STRING_WITH_LEN("\n"))) goto err_w_cache; } @@ -423,7 +423,7 @@ sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root, bool bad_format_errors) { MY_STAT stat_info; - uint len; + size_t len; char *end, *sign; File_parser *parser; File file; @@ -445,7 +445,7 @@ sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root, DBUG_RETURN(0); } - if (!(parser->buff= alloc_root(mem_root, stat_info.st_size+1))) + if (!(parser->buff= (char*) alloc_root(mem_root, stat_info.st_size+1))) { DBUG_RETURN(0); } @@ -455,7 +455,7 @@ sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root, DBUG_RETURN(0); } - if ((len= my_read(file, (byte *)parser->buff, + if ((len= my_read(file, (uchar *)parser->buff, stat_info.st_size, MYF(MY_WME))) == MY_FILE_ERROR) { @@ -533,11 +533,8 @@ parse_string(char *ptr, char *end, MEM_ROOT *mem_root, LEX_STRING *str) str->length= eol - ptr; - if (!(str->str= alloc_root(mem_root, str->length+1))) + if (!(str->str= strmake_root(mem_root, ptr, str->length))) return 0; - - memcpy(str->str, ptr, str->length); - str->str[str->length]= '\0'; // just for safety return eol+1; } @@ -623,7 +620,7 @@ parse_escaped_string(char *ptr, char *end, MEM_ROOT *mem_root, LEX_STRING *str) char *eol= strchr(ptr, '\n'); if (eol == 0 || eol >= end || - !(str->str= alloc_root(mem_root, (eol - ptr) + 1)) || + !(str->str= (char*) alloc_root(mem_root, (eol - ptr) + 1)) || read_escaped_string(ptr, eol, str)) return 0; @@ -668,7 +665,7 @@ parse_quoted_escaped_string(char *ptr, char *end, // process string if (eol >= end || - !(str->str= alloc_root(mem_root, result_len + 1)) || + !(str->str= (char*) alloc_root(mem_root, result_len + 1)) || read_escaped_string(ptr, eol, str)) return 0; @@ -691,7 +688,7 @@ parse_quoted_escaped_string(char *ptr, char *end, */ bool get_file_options_ulllist(char *&ptr, char *end, char *line, - gptr base, File_option *parameter, + uchar* base, File_option *parameter, MEM_ROOT *mem_root) { List<ulonglong> *nlist= (List<ulonglong>*)(base + parameter->offset); @@ -754,7 +751,7 @@ nlist_err: */ my_bool -File_parser::parse(gptr base, MEM_ROOT *mem_root, +File_parser::parse(uchar* base, MEM_ROOT *mem_root, struct File_option *parameters, uint required, Unknown_key_hook *hook) { @@ -963,7 +960,7 @@ list_err: bool File_parser_dummy_hook::process_unknown_string(char *&unknown_key, - gptr base, MEM_ROOT *mem_root, + uchar* base, MEM_ROOT *mem_root, char *end) { DBUG_ENTER("file_parser_dummy_hook::process_unknown_string"); diff --git a/sql/parse_file.h b/sql/parse_file.h index 21873b32904..91700959681 100644 --- a/sql/parse_file.h +++ b/sql/parse_file.h @@ -50,7 +50,7 @@ class Unknown_key_hook public: Unknown_key_hook() {} /* Remove gcc warning */ virtual ~Unknown_key_hook() {} /* Remove gcc warning */ - virtual bool process_unknown_string(char *&unknown_key, gptr base, + virtual bool process_unknown_string(char *&unknown_key, uchar* base, MEM_ROOT *mem_root, char *end)= 0; }; @@ -61,14 +61,14 @@ class File_parser_dummy_hook: public Unknown_key_hook { public: File_parser_dummy_hook() {} /* Remove gcc warning */ - virtual bool process_unknown_string(char *&unknown_key, gptr base, + virtual bool process_unknown_string(char *&unknown_key, uchar* base, MEM_ROOT *mem_root, char *end); }; extern File_parser_dummy_hook file_parser_dummy_hook; bool get_file_options_ulllist(char *&ptr, char *end, char *line, - gptr base, File_option *parameter, + uchar* base, File_option *parameter, MEM_ROOT *mem_root); char * @@ -81,7 +81,7 @@ File_parser *sql_parse_prepare(const LEX_STRING *file_name, my_bool sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, const LEX_STRING *type, - gptr base, File_option *parameters, uint versions); + uchar* base, File_option *parameters, uint versions); my_bool rename_in_schema_file(const char *schema, const char *old_name, const char *new_name, ulonglong revision, uint num_view_backups); @@ -97,7 +97,7 @@ public: my_bool ok() { return content_ok; } LEX_STRING *type() { return &file_type; } - my_bool parse(gptr base, MEM_ROOT *mem_root, + my_bool parse(uchar* base, MEM_ROOT *mem_root, struct File_option *parameters, uint required, Unknown_key_hook *hook); diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 3e0257f5b1d..23bc3c96e8f 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -90,10 +90,11 @@ partition_info *partition_info::get_clone() #define MAX_PART_NAME_SIZE 8 -char *partition_info::create_default_partition_names(uint part_no, uint no_parts, +char *partition_info::create_default_partition_names(uint part_no, + uint no_parts, uint start_no) { - char *ptr= sql_calloc(no_parts*MAX_PART_NAME_SIZE); + char *ptr= (char*) sql_calloc(no_parts*MAX_PART_NAME_SIZE); char *move_ptr= ptr; uint i= 0; DBUG_ENTER("create_default_partition_names"); @@ -129,7 +130,7 @@ char *partition_info::create_subpartition_name(uint subpart_no, const char *part_name) { uint size_alloc= strlen(part_name) + MAX_PART_NAME_SIZE; - char *ptr= sql_calloc(size_alloc); + char *ptr= (char*) sql_calloc(size_alloc); DBUG_ENTER("create_subpartition_name"); if (likely(ptr != NULL)) @@ -902,7 +903,7 @@ void partition_info::print_no_partition_found(TABLE *table) bool partition_info::set_up_charset_field_preps() { Field *field, **ptr; - char **char_ptrs; + uchar **char_ptrs; unsigned i; bool found; size_t size; @@ -927,14 +928,14 @@ bool partition_info::set_up_charset_field_preps() } } size= tot_part_fields * sizeof(char*); - if (!(char_ptrs= (char**)sql_calloc(size))) + if (!(char_ptrs= (uchar**)sql_calloc(size))) goto error; part_field_buffers= char_ptrs; - if (!(char_ptrs= (char**)sql_calloc(size))) + if (!(char_ptrs= (uchar**)sql_calloc(size))) goto error; restore_part_field_ptrs= char_ptrs; size= (tot_part_fields + 1) * sizeof(Field*); - if (!(char_ptrs= (char**)sql_alloc(size))) + if (!(char_ptrs= (uchar**)sql_alloc(size))) goto error; part_charset_field_array= (Field**)char_ptrs; ptr= part_field_array; @@ -943,9 +944,9 @@ bool partition_info::set_up_charset_field_preps() { if (field_is_partition_charset(field)) { - char *field_buf; + uchar *field_buf; size= field->pack_length(); - if (!(field_buf= sql_calloc(size))) + if (!(field_buf= (uchar*) sql_calloc(size))) goto error; part_charset_field_array[i]= field; part_field_buffers[i++]= field_buf; @@ -964,14 +965,14 @@ bool partition_info::set_up_charset_field_preps() tot_subpart_fields++; } size= tot_subpart_fields * sizeof(char*); - if (!(char_ptrs= (char**)sql_calloc(size))) + if (!(char_ptrs= (uchar**) sql_calloc(size))) goto error; subpart_field_buffers= char_ptrs; - if (!(char_ptrs= (char**)sql_calloc(size))) + if (!(char_ptrs= (uchar**) sql_calloc(size))) goto error; restore_subpart_field_ptrs= char_ptrs; size= (tot_subpart_fields + 1) * sizeof(Field*); - if (!(char_ptrs= (char**)sql_alloc(size))) + if (!(char_ptrs= (uchar**) sql_alloc(size))) goto error; subpart_charset_field_array= (Field**)char_ptrs; i= 0; @@ -979,7 +980,7 @@ bool partition_info::set_up_charset_field_preps() { unsigned j= 0; CHARSET_INFO *cs; - char *field_buf; + uchar *field_buf; LINT_INIT(field_buf); if (!field_is_partition_charset(field)) @@ -995,12 +996,12 @@ bool partition_info::set_up_charset_field_preps() if (!found) { tot_fields++; - if (!(field_buf= sql_calloc(size))) + if (!(field_buf= (uchar*) sql_calloc(size))) goto error; } subpart_field_buffers[i++]= field_buf; } - if (!(char_ptrs= (char**)sql_calloc(size))) + if (!(char_ptrs= (uchar**) sql_calloc(size))) goto error; restore_subpart_field_ptrs= char_ptrs; } @@ -1009,14 +1010,14 @@ bool partition_info::set_up_charset_field_preps() uint j,k,l; size= tot_fields*sizeof(char**); - if (!(char_ptrs= (char**)sql_calloc(size))) + if (!(char_ptrs= (uchar**)sql_calloc(size))) goto error; full_part_field_buffers= char_ptrs; - if (!(char_ptrs= (char**)sql_calloc(size))) + if (!(char_ptrs= (uchar**)sql_calloc(size))) goto error; restore_full_part_field_ptrs= char_ptrs; size= (tot_fields + 1) * sizeof(char**); - if (!(char_ptrs= (char**)sql_calloc(size))) + if (!(char_ptrs= (uchar**)sql_calloc(size))) goto error; full_part_charset_field_array= (Field**)char_ptrs; for (i= 0; i < tot_part_fields; i++) diff --git a/sql/partition_info.h b/sql/partition_info.h index 6c21002c184..ce2f2a7b358 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -87,12 +87,12 @@ public: partition functions we must allocate field buffers for the field of the fields in the partition function. */ - char **part_field_buffers; - char **subpart_field_buffers; - char **full_part_field_buffers; - char **restore_part_field_ptrs; - char **restore_subpart_field_ptrs; - char **restore_full_part_field_ptrs; + uchar **part_field_buffers; + uchar **subpart_field_buffers; + uchar **full_part_field_buffers; + uchar **restore_part_field_ptrs; + uchar **restore_subpart_field_ptrs; + uchar **restore_full_part_field_ptrs; Item *part_expr; Item *subpart_expr; diff --git a/sql/protocol.cc b/sql/protocol.cc index d537fd346f9..2ed241c4c98 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -33,9 +33,9 @@ static void write_eof_packet(THD *thd, NET *net); #endif #ifndef EMBEDDED_LIBRARY -bool Protocol::net_store_data(const char *from, uint length) +bool Protocol::net_store_data(const uchar *from, size_t length) #else -bool Protocol_binary::net_store_data(const char *from, uint length) +bool Protocol_binary::net_store_data(const uchar *from, size_t length) #endif { ulong packet_length=packet->length(); @@ -46,10 +46,9 @@ bool Protocol_binary::net_store_data(const char *from, uint length) if (packet_length+9+length > packet->alloced_length() && packet->realloc(packet_length+9+length)) return 1; - char *to=(char*) net_store_length((char*) packet->ptr()+packet_length, - length); + uchar *to= net_store_length((uchar*) packet->ptr()+packet_length, length); memcpy(to,from,length); - packet->length((uint) (to+length-packet->ptr())); + packet->length((uint) (to+length-(uchar*) packet->ptr())); return 0; } @@ -227,7 +226,7 @@ net_printf_error(THD *thd, uint errcode, ...) memcpy(pos+3, mysql_errno_to_sqlstate(errcode), SQLSTATE_LENGTH); } } - VOID(net_real_write(net,(char*) net->buff,length+head_length+1+offset)); + VOID(net_real_write(net, net->buff, length+head_length+1+offset)); #else net->last_errno= errcode; strmake(net->last_error, text_pos, length); @@ -271,7 +270,7 @@ void send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message) { NET *net= &thd->net; - char buff[MYSQL_ERRMSG_SIZE+10],*pos; + uchar buff[MYSQL_ERRMSG_SIZE+10],*pos; DBUG_ENTER("send_ok"); if (net->no_send_ok || !net->vio) // hack for re-parsing queries @@ -307,8 +306,8 @@ send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message) pos+=2; } if (message) - pos=net_store_data((char*) pos, message, strlen(message)); - VOID(my_net_write(net,buff,(uint) (pos-buff))); + pos= net_store_data(pos, (uchar*) message, strlen(message)); + VOID(my_net_write(net, buff, (size_t) (pos-buff))); VOID(net_flush(net)); /* We can't anymore send an error to the client */ thd->net.report_error= 0; @@ -318,7 +317,7 @@ send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message) DBUG_VOID_RETURN; } -static char eof_buff[1]= { (char) 254 }; /* Marker for end of fields */ +static uchar eof_buff[1]= { (uchar) 254 }; /* Marker for end of fields */ /* Send eof (= end of result set) to the client @@ -383,7 +382,7 @@ static void write_eof_packet(THD *thd, NET *net) if (thd->is_fatal_error) thd->server_status&= ~SERVER_MORE_RESULTS_EXISTS; int2store(buff+3, thd->server_status); - VOID(my_net_write(net, (char*) buff, 5)); + VOID(my_net_write(net, buff, 5)); } else VOID(my_net_write(net, eof_buff, 1)); @@ -411,7 +410,7 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err) { NET *net= &thd->net; uint length; - char buff[MYSQL_ERRMSG_SIZE+2], *pos; + uchar buff[MYSQL_ERRMSG_SIZE+2], *pos; DBUG_ENTER("send_error_packet"); @@ -433,17 +432,19 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err) { /* The first # is to make the protocol backward compatible */ buff[2]= '#'; - pos= strmov(buff+3, mysql_errno_to_sqlstate(sql_errno)); + pos= (uchar*) strmov((char*) buff+3, mysql_errno_to_sqlstate(sql_errno)); } - length= (uint) (strmake(pos, err, MYSQL_ERRMSG_SIZE-1) - buff); - err=buff; + length= (uint) (strmake((char*) pos, err, MYSQL_ERRMSG_SIZE-1) - + (char*) buff); + err= (char*) buff; } else { length=(uint) strlen(err); set_if_smaller(length,MYSQL_ERRMSG_SIZE-1); } - VOID(net_write_command(net,(uchar) 255, "", 0, (char*) err,length)); + VOID(net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) err, + length)); DBUG_VOID_RETURN; } @@ -459,17 +460,16 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err) ulonglong for bigger numbers. */ -static char *net_store_length_fast(char *pkg, uint length) +static uchar *net_store_length_fast(uchar *packet, uint length) { - uchar *packet=(uchar*) pkg; if (length < 251) { *packet=(uchar) length; - return (char*) packet+1; + return packet+1; } *packet++=252; int2store(packet,(uint) length); - return (char*) packet+2; + return packet+2; } @@ -480,14 +480,14 @@ static char *net_store_length_fast(char *pkg, uint length) /* The following will only be used for short strings < 65K */ -char *net_store_data(char *to,const char *from, uint length) +uchar *net_store_data(uchar *to, const uchar *from, size_t length) { to=net_store_length_fast(to,length); memcpy(to,from,length); return to+length; } -char *net_store_data(char *to,int32 from) +uchar *net_store_data(uchar *to,int32 from) { char buff[20]; uint length=(uint) (int10_to_str(from,buff,10)-buff); @@ -496,7 +496,7 @@ char *net_store_data(char *to,int32 from) return to+length; } -char *net_store_data(char *to,longlong from) +uchar *net_store_data(uchar *to,longlong from) { char buff[22]; uint length=(uint) (longlong10_to_str(from,buff,10)-buff); @@ -555,7 +555,7 @@ bool Protocol::send_fields(List<Item> *list, uint flags) { List_iterator_fast<Item> it(*list); Item *item; - char buff[80]; + uchar buff[80]; String tmp((char*) buff,sizeof(buff),&my_charset_bin); Protocol_text prot(thd); String *local_packet= prot.storage_packet(); @@ -564,8 +564,8 @@ bool Protocol::send_fields(List<Item> *list, uint flags) if (flags & SEND_NUM_ROWS) { // Packet with number of elements - char *pos=net_store_length(buff, list->elements); - (void) my_net_write(&thd->net, buff,(uint) (pos-buff)); + uchar *pos= net_store_length(buff, list->elements); + (void) my_net_write(&thd->net, buff, (size_t) (pos-buff)); } #ifndef DBUG_OFF @@ -698,7 +698,8 @@ err: bool Protocol::write() { DBUG_ENTER("Protocol::write"); - DBUG_RETURN(my_net_write(&thd->net, packet->ptr(), packet->length())); + DBUG_RETURN(my_net_write(&thd->net, (uchar*) packet->ptr(), + packet->length())); } #endif /* EMBEDDED_LIBRARY */ @@ -785,7 +786,7 @@ bool Protocol_text::store_null() and store in network buffer. */ -bool Protocol::store_string_aux(const char *from, uint length, +bool Protocol::store_string_aux(const char *from, size_t length, CHARSET_INFO *fromcs, CHARSET_INFO *tocs) { /* 'tocs' is set 0 when client issues SET character_set_results=NULL */ @@ -794,15 +795,15 @@ bool Protocol::store_string_aux(const char *from, uint length, tocs != &my_charset_bin) { uint dummy_errors; - return convert->copy(from, length, fromcs, tocs, &dummy_errors) || - net_store_data(convert->ptr(), convert->length()); + return (convert->copy(from, length, fromcs, tocs, &dummy_errors) || + net_store_data((uchar*) convert->ptr(), convert->length())); } - return net_store_data(from, length); + return net_store_data((uchar*) from, length); } -bool Protocol_text::store(const char *from, uint length, - CHARSET_INFO *fromcs, CHARSET_INFO *tocs) +bool Protocol_text::store(const char *from, size_t length, + CHARSET_INFO *fromcs, CHARSET_INFO *tocs) { #ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || @@ -817,7 +818,7 @@ bool Protocol_text::store(const char *from, uint length, } -bool Protocol_text::store(const char *from, uint length, +bool Protocol_text::store(const char *from, size_t length, CHARSET_INFO *fromcs) { CHARSET_INFO *tocs= this->thd->variables.character_set_results; @@ -841,8 +842,8 @@ bool Protocol_text::store_tiny(longlong from) field_pos++; #endif char buff[20]; - return net_store_data((char*) buff, - (uint) (int10_to_str((int) from,buff, -10)-buff)); + return net_store_data((uchar*) buff, + (size_t) (int10_to_str((int) from, buff, -10) - buff)); } @@ -855,8 +856,9 @@ bool Protocol_text::store_short(longlong from) field_pos++; #endif char buff[20]; - return net_store_data((char*) buff, - (uint) (int10_to_str((int) from,buff, -10)-buff)); + return net_store_data((uchar*) buff, + (size_t) (int10_to_str((int) from, buff, -10) - + buff)); } @@ -869,8 +871,9 @@ bool Protocol_text::store_long(longlong from) field_pos++; #endif char buff[20]; - return net_store_data((char*) buff, - (uint) (int10_to_str((long int)from,buff, (from <0)?-10:10)-buff)); + return net_store_data((uchar*) buff, + (size_t) (int10_to_str((long int)from, buff, + (from <0)?-10:10)-buff)); } @@ -882,10 +885,10 @@ bool Protocol_text::store_longlong(longlong from, bool unsigned_flag) field_pos++; #endif char buff[22]; - return net_store_data((char*) buff, - (uint) (longlong10_to_str(from,buff, - unsigned_flag ? 10 : -10)- - buff)); + return net_store_data((uchar*) buff, + (size_t) (longlong10_to_str(from,buff, + unsigned_flag ? 10 : -10)- + buff)); } @@ -899,7 +902,7 @@ bool Protocol_text::store_decimal(const my_decimal *d) char buff[DECIMAL_MAX_STR_LENGTH]; String str(buff, sizeof(buff), &my_charset_bin); (void) my_decimal2string(E_DEC_FATAL_ERROR, d, 0, 0, 0, &str); - return net_store_data(str.ptr(), str.length()); + return net_store_data((uchar*) str.ptr(), str.length()); } @@ -911,7 +914,7 @@ bool Protocol_text::store(float from, uint32 decimals, String *buffer) field_pos++; #endif buffer->set_real((double) from, decimals, thd->charset()); - return net_store_data((char*) buffer->ptr(), buffer->length()); + return net_store_data((uchar*) buffer->ptr(), buffer->length()); } @@ -923,7 +926,7 @@ bool Protocol_text::store(double from, uint32 decimals, String *buffer) field_pos++; #endif buffer->set_real(from, decimals, thd->charset()); - return net_store_data((char*) buffer->ptr(), buffer->length()); + return net_store_data((uchar*) buffer->ptr(), buffer->length()); } @@ -979,8 +982,9 @@ bool Protocol_text::store(MYSQL_TIME *tm) (int) tm->minute, (int) tm->second)); if (tm->second_part) - length+= my_sprintf(buff+length,(buff+length, ".%06d", (int)tm->second_part)); - return net_store_data((char*) buff, length); + length+= my_sprintf(buff+length,(buff+length, ".%06d", + (int)tm->second_part)); + return net_store_data((uchar*) buff, length); } @@ -992,8 +996,8 @@ bool Protocol_text::store_date(MYSQL_TIME *tm) field_pos++; #endif char buff[MAX_DATE_STRING_REP_LENGTH]; - int length= my_date_to_str(tm, buff); - return net_store_data(buff, (uint) length); + size_t length= my_date_to_str(tm, buff); + return net_store_data((uchar*) buff, length); } @@ -1020,7 +1024,7 @@ bool Protocol_text::store_time(MYSQL_TIME *tm) (int) tm->second)); if (tm->second_part) length+= my_sprintf(buff+length,(buff+length, ".%06d", (int)tm->second_part)); - return net_store_data((char*) buff, length); + return net_store_data((uchar*) buff, length); } @@ -1057,12 +1061,12 @@ bool Protocol_binary::prepare_for_send(List<Item> *item_list) void Protocol_binary::prepare_for_resend() { packet->length(bit_fields+1); - bzero((char*) packet->ptr(), 1+bit_fields); + bzero((uchar*) packet->ptr(), 1+bit_fields); field_pos=0; } -bool Protocol_binary::store(const char *from, uint length, +bool Protocol_binary::store(const char *from, size_t length, CHARSET_INFO *fromcs) { CHARSET_INFO *tocs= thd->variables.character_set_results; @@ -1070,7 +1074,7 @@ bool Protocol_binary::store(const char *from, uint length, return store_string_aux(from, length, fromcs, tocs); } -bool Protocol_binary::store(const char *from,uint length, +bool Protocol_binary::store(const char *from, size_t length, CHARSET_INFO *fromcs, CHARSET_INFO *tocs) { field_pos++; diff --git a/sql/protocol.h b/sql/protocol.h index e0672240e0e..46a2b6d36b6 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -35,14 +35,14 @@ protected: #endif uint field_count; #ifndef EMBEDDED_LIBRARY - bool net_store_data(const char *from, uint length); + bool net_store_data(const uchar *from, size_t length); #else - virtual bool net_store_data(const char *from, uint length); + virtual bool net_store_data(const uchar *from, size_t length); char **next_field; MYSQL_FIELD *next_mysql_field; MEM_ROOT *alloc; #endif - bool store_string_aux(const char *from, uint length, + bool store_string_aux(const char *from, size_t length, CHARSET_INFO *fromcs, CHARSET_INFO *tocs); public: Protocol() {} @@ -83,8 +83,8 @@ public: virtual bool store_long(longlong from)=0; virtual bool store_longlong(longlong from, bool unsigned_flag)=0; virtual bool store_decimal(const my_decimal *)=0; - virtual bool store(const char *from, uint length, CHARSET_INFO *cs)=0; - virtual bool store(const char *from, uint length, + virtual bool store(const char *from, size_t length, CHARSET_INFO *cs)=0; + virtual bool store(const char *from, size_t length, CHARSET_INFO *fromcs, CHARSET_INFO *tocs)=0; virtual bool store(float from, uint32 decimals, String *buffer)=0; virtual bool store(double from, uint32 decimals, String *buffer)=0; @@ -124,8 +124,8 @@ public: virtual bool store_long(longlong from); virtual bool store_longlong(longlong from, bool unsigned_flag); virtual bool store_decimal(const my_decimal *); - virtual bool store(const char *from, uint length, CHARSET_INFO *cs); - virtual bool store(const char *from, uint length, + virtual bool store(const char *from, size_t length, CHARSET_INFO *cs); + virtual bool store(const char *from, size_t length, CHARSET_INFO *fromcs, CHARSET_INFO *tocs); virtual bool store(MYSQL_TIME *time); virtual bool store_date(MYSQL_TIME *time); @@ -151,7 +151,7 @@ public: virtual void prepare_for_resend(); #ifdef EMBEDDED_LIBRARY virtual bool write(); - bool net_store_data(const char *from, uint length); + bool net_store_data(const uchar *from, size_t length); #endif virtual bool store_null(); virtual bool store_tiny(longlong from); @@ -159,8 +159,8 @@ public: virtual bool store_long(longlong from); virtual bool store_longlong(longlong from, bool unsigned_flag); virtual bool store_decimal(const my_decimal *); - virtual bool store(const char *from,uint length, CHARSET_INFO *cs); - virtual bool store(const char *from, uint length, + virtual bool store(const char *from, size_t length, CHARSET_INFO *cs); + virtual bool store(const char *from, size_t length, CHARSET_INFO *fromcs, CHARSET_INFO *tocs); virtual bool store(MYSQL_TIME *time); virtual bool store_date(MYSQL_TIME *time); @@ -178,7 +178,7 @@ void send_ok(THD *thd, ha_rows affected_rows=0L, ulonglong id=0L, const char *info=0); void send_eof(THD *thd); bool send_old_password_request(THD *thd); -char *net_store_data(char *to,const char *from, uint length); -char *net_store_data(char *to,int32 from); -char *net_store_data(char *to,longlong from); +uchar *net_store_data(uchar *to,const uchar *from, size_t length); +uchar *net_store_data(uchar *to,int32 from); +uchar *net_store_data(uchar *to,longlong from); diff --git a/sql/records.cc b/sql/records.cc index 0fb9f4f9650..81c26da4b4d 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -432,7 +432,7 @@ static int rr_unpack_from_tempfile(READ_RECORD *info) static int rr_from_pointers(READ_RECORD *info) { int tmp; - byte *cache_pos; + uchar *cache_pos; for (;;) { @@ -502,7 +502,7 @@ static int init_rr_cache(THD *thd, READ_RECORD *info) // We have to allocate one more byte to use uint3korr (see comments for it) if (info->cache_records <= 2 || - !(info->cache=(byte*) my_malloc_lock(rec_cache_size+info->cache_records* + !(info->cache=(uchar*) my_malloc_lock(rec_cache_size+info->cache_records* info->struct_length+1, MYF(0)))) DBUG_RETURN(1); @@ -523,7 +523,7 @@ static int rr_from_cache(READ_RECORD *info) ulong length; my_off_t rest_of_file; int16 error; - byte *position,*ref_position,*record_pos; + uchar *position,*ref_position,*record_pos; ulong record; for (;;) @@ -560,7 +560,7 @@ static int rr_from_cache(READ_RECORD *info) ref_position=info->read_positions; for (i=0 ; i < length ; i++,position+=info->ref_length) { - memcpy(ref_position,position,(size_s) info->ref_length); + memcpy(ref_position,position,(size_t) info->ref_length); ref_position+=MAX_REFLENGTH; int3store(ref_position,(long) i); ref_position+=3; @@ -570,7 +570,7 @@ static int rr_from_cache(READ_RECORD *info) position=info->read_positions; for (i=0 ; i < length ; i++) { - memcpy(info->ref_pos,position,(size_s) info->ref_length); + memcpy(info->ref_pos,position,(size_t) info->ref_length); position+=MAX_REFLENGTH; record=uint3korr(position); position+=3; diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 6470f15e458..8bab1ff1ca3 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -134,9 +134,9 @@ void unregister_slave(THD* thd, bool only_mine, bool need_mutex) SLAVE_INFO* old_si; if ((old_si = (SLAVE_INFO*)hash_search(&slave_list, - (byte*)&thd->server_id, 4)) && + (uchar*)&thd->server_id, 4)) && (!only_mine || old_si->thd == thd)) - hash_delete(&slave_list, (byte*)old_si); + hash_delete(&slave_list, (uchar*)old_si); if (need_mutex) pthread_mutex_unlock(&LOCK_slave_list); @@ -180,12 +180,12 @@ int register_slave(THD* thd, uchar* packet, uint packet_length) pthread_mutex_lock(&LOCK_slave_list); unregister_slave(thd,0,0); - res= my_hash_insert(&slave_list, (byte*) si); + res= my_hash_insert(&slave_list, (uchar*) si); pthread_mutex_unlock(&LOCK_slave_list); return res; err: - my_free((gptr) si, MYF(MY_WME)); + my_free(si, MYF(MY_WME)); my_message(ER_UNKNOWN_ERROR, "Wrong parameters to function register_slave", MYF(0)); err2: @@ -193,7 +193,7 @@ err2: } extern "C" uint32 -*slave_list_key(SLAVE_INFO* si, uint* len, +*slave_list_key(SLAVE_INFO* si, size_t *len, my_bool not_used __attribute__((unused))) { *len = 4; @@ -202,7 +202,7 @@ extern "C" uint32 extern "C" void slave_info_free(void *s) { - my_free((gptr) s, MYF(MY_WME)); + my_free(s, MYF(MY_WME)); } void init_slave_list() @@ -531,7 +531,7 @@ HOSTS"; SLAVE_INFO* si, *old_si; log_server_id = atoi(row[0]); if ((old_si= (SLAVE_INFO*)hash_search(&slave_list, - (byte*)&log_server_id,4))) + (uchar*)&log_server_id,4))) si = old_si; else { @@ -542,7 +542,7 @@ HOSTS"; goto err; } si->server_id = log_server_id; - my_hash_insert(&slave_list, (byte*)si); + my_hash_insert(&slave_list, (uchar*)si); } strmake(si->host, row[1], sizeof(si->host)-1); si->port = atoi(row[port_ind]); diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc index f76f798f6a6..bb5db0106eb 100644 --- a/sql/rpl_filter.cc +++ b/sql/rpl_filter.cc @@ -103,12 +103,12 @@ Rpl_filter::tables_ok(const char* db, TABLE_LIST* tables) len= (uint) (strmov(end, tables->table_name) - hash_key); if (do_table_inited) // if there are any do's { - if (hash_search(&do_table, (byte*) hash_key, len)) + if (hash_search(&do_table, (uchar*) hash_key, len)) DBUG_RETURN(1); } if (ignore_table_inited) // if there are any ignores { - if (hash_search(&ignore_table, (byte*) hash_key, len)) + if (hash_search(&ignore_table, (uchar*) hash_key, len)) DBUG_RETURN(0); } if (wild_do_table_inited && @@ -319,7 +319,7 @@ Rpl_filter::add_table_rule(HASH* h, const char* table_spec) e->key_len= len; memcpy(e->db, table_spec, len); - return my_hash_insert(h, (byte*)e); + return my_hash_insert(h, (uchar*)e); } @@ -340,7 +340,7 @@ Rpl_filter::add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec) e->tbl_name= e->db + (dot - table_spec) + 1; e->key_len= len; memcpy(e->db, table_spec, len); - insert_dynamic(a, (gptr)&e); + insert_dynamic(a, (uchar*)&e); return 0; } @@ -363,13 +363,13 @@ Rpl_filter::add_ignore_db(const char* table_spec) } -static byte* get_table_key(const byte* a, uint* len, +static uchar* get_table_key(const uchar* a, size_t *len, my_bool __attribute__((unused))) { TABLE_RULE_ENT *e= (TABLE_RULE_ENT *) a; *len= e->key_len; - return (byte*)e->db; + return (uchar*)e->db; } @@ -377,7 +377,7 @@ static void free_table_ent(void* a) { TABLE_RULE_ENT *e= (TABLE_RULE_ENT *) a; - my_free((gptr) e, MYF(0)); + my_free((uchar*) e, MYF(0)); } @@ -408,7 +408,7 @@ Rpl_filter::find_wild(DYNAMIC_ARRAY *a, const char* key, int len) for (i= 0; i < a->elements; i++) { TABLE_RULE_ENT* e ; - get_dynamic(a, (gptr)&e, i); + get_dynamic(a, (uchar*)&e, i); if (!my_wildcmp(system_charset_info, key, key_end, (const char*)e->db, (const char*)(e->db + e->key_len), @@ -427,7 +427,7 @@ Rpl_filter::free_string_array(DYNAMIC_ARRAY *a) for (i= 0; i < a->elements; i++) { char* p; - get_dynamic(a, (gptr) &p, i); + get_dynamic(a, (uchar*) &p, i); my_free(p, MYF(MY_WME)); } delete_dynamic(a); @@ -474,7 +474,7 @@ Rpl_filter::table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a, for (uint i= 0; i < a->elements; i++) { TABLE_RULE_ENT* e; - get_dynamic(a, (gptr)&e, i); + get_dynamic(a, (uchar*)&e, i); if (s->length()) s->append(','); s->append(e->db,e->key_len); @@ -512,7 +512,7 @@ Rpl_filter::get_wild_ignore_table(String* str) const char* -Rpl_filter::get_rewrite_db(const char* db, uint *new_len) +Rpl_filter::get_rewrite_db(const char* db, size_t *new_len) { if (rewrite_db.is_empty() || !db) return db; diff --git a/sql/rpl_filter.h b/sql/rpl_filter.h index 396207d3a28..ff7e4081bb1 100644 --- a/sql/rpl_filter.h +++ b/sql/rpl_filter.h @@ -69,7 +69,7 @@ public: void get_wild_do_table(String* str); void get_wild_ignore_table(String* str); - const char* get_rewrite_db(const char* db, uint *new_len); + const char* get_rewrite_db(const char* db, size_t *new_len); I_List<i_string>* get_do_db(); I_List<i_string>* get_ignore_db(); diff --git a/sql/rpl_injector.h b/sql/rpl_injector.h index 9c444ee20b3..4ece092c5b8 100644 --- a/sql/rpl_injector.h +++ b/sql/rpl_injector.h @@ -74,7 +74,7 @@ public: friend class injector; public: /* Convenience definitions */ - typedef byte* record_type; + typedef uchar* record_type; typedef uint32 server_id_type; /* diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc index 4c6686cf446..45edb42374b 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -51,14 +51,14 @@ @return The number of bytes written at @c row_data. */ #if !defined(MYSQL_CLIENT) -my_size_t +size_t pack_row(TABLE *table, MY_BITMAP const* cols, - byte *row_data, const byte *record) + uchar *row_data, const uchar *record) { Field **p_field= table->field, *field; int const null_byte_count= (bitmap_bits_set(cols) + 7) / 8; - byte *pack_ptr = row_data + null_byte_count; - byte *null_ptr = row_data; + uchar *pack_ptr = row_data + null_byte_count; + uchar *null_ptr = row_data; my_ptrdiff_t const rec_offset= record - table->record[0]; my_ptrdiff_t const def_offset= table->s->default_values - table->record[0]; @@ -90,7 +90,7 @@ pack_row(TABLE *table, MY_BITMAP const* cols, /* We only store the data of the field if it is non-null */ - pack_ptr= (byte*)field->pack((char *) pack_ptr, field->ptr + offset); + pack_ptr= field->pack(pack_ptr, field->ptr + offset); } null_mask <<= 1; @@ -119,7 +119,7 @@ pack_row(TABLE *table, MY_BITMAP const* cols, */ DBUG_ASSERT(null_ptr == row_data + null_byte_count); - return static_cast<my_size_t>(pack_ptr - row_data); + return static_cast<size_t>(pack_ptr - row_data); } #endif @@ -164,17 +164,17 @@ pack_row(TABLE *table, MY_BITMAP const* cols, int unpack_row(RELAY_LOG_INFO const *rli, TABLE *table, uint const colcnt, - char const *const row_data, MY_BITMAP const *cols, - char const **const row_end, ulong *const master_reclength, + uchar const *const row_data, MY_BITMAP const *cols, + uchar const **const row_end, ulong *const master_reclength, MY_BITMAP* const rw_set, Log_event_type const event_type) { DBUG_ENTER("unpack_row"); DBUG_ASSERT(row_data); - my_size_t const master_null_byte_count= (bitmap_bits_set(cols) + 7) / 8; + size_t const master_null_byte_count= (bitmap_bits_set(cols) + 7) / 8; int error= 0; - char const *null_ptr= row_data; - char const *pack_ptr= row_data + master_null_byte_count; + uchar const *null_ptr= row_data; + uchar const *pack_ptr= row_data + master_null_byte_count; bitmap_clear_all(rw_set); @@ -239,7 +239,7 @@ unpack_row(RELAY_LOG_INFO const *rli, if (master_reclength) { if (*field_ptr) - *master_reclength = (*field_ptr)->ptr - (char*) table->record[0]; + *master_reclength = (*field_ptr)->ptr - table->record[0]; else *master_reclength = table->s->reclength; } diff --git a/sql/rpl_record.h b/sql/rpl_record.h index 7ff1bbc7c8e..12c2f1fc713 100644 --- a/sql/rpl_record.h +++ b/sql/rpl_record.h @@ -17,15 +17,15 @@ #define RPL_RECORD_H #if !defined(MYSQL_CLIENT) -my_size_t pack_row(TABLE* table, MY_BITMAP const* cols, - byte *row_data, const byte *data); +size_t pack_row(TABLE* table, MY_BITMAP const* cols, + uchar *row_data, const uchar *data); #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) int unpack_row(RELAY_LOG_INFO const *rli, TABLE *table, uint const colcnt, - char const *const row_data, MY_BITMAP const *cols, - char const **const row_end, ulong *const master_reclength, + uchar const *const row_data, MY_BITMAP const *cols, + uchar const **const row_end, ulong *const master_reclength, MY_BITMAP* const rw_set, Log_event_type const event_type); #endif diff --git a/sql/rpl_record_old.cc b/sql/rpl_record_old.cc index 73e2f4e7344..b6f170082fe 100644 --- a/sql/rpl_record_old.cc +++ b/sql/rpl_record_old.cc @@ -2,13 +2,13 @@ #include "mysql_priv.h" #include "rpl_record_old.h" -my_size_t +size_t pack_row_old(TABLE *table, MY_BITMAP const* cols, - byte *row_data, const byte *record) + uchar *row_data, const uchar *record) { Field **p_field= table->field, *field; int n_null_bytes= table->s->null_bytes; - byte *ptr; + uchar *ptr; uint i; my_ptrdiff_t const rec_offset= record - table->record[0]; my_ptrdiff_t const def_offset= table->s->default_values - table->record[0]; @@ -22,11 +22,11 @@ pack_row_old(TABLE *table, MY_BITMAP const* cols, my_ptrdiff_t const offset= field->is_null(rec_offset) ? def_offset : rec_offset; field->move_field_offset(offset); - ptr= (byte*)field->pack((char *) ptr, field->ptr); + ptr= field->pack(ptr, field->ptr); field->move_field_offset(-offset); } } - return (static_cast<my_size_t>(ptr - row_data)); + return (static_cast<size_t>(ptr - row_data)); } @@ -70,14 +70,14 @@ pack_row_old(TABLE *table, MY_BITMAP const* cols, #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) int unpack_row_old(RELAY_LOG_INFO *rli, - TABLE *table, uint const colcnt, byte *record, - char const *row, MY_BITMAP const *cols, - char const **row_end, ulong *master_reclength, + TABLE *table, uint const colcnt, uchar *record, + uchar const *row, MY_BITMAP const *cols, + uchar const **row_end, ulong *master_reclength, MY_BITMAP* const rw_set, Log_event_type const event_type) { DBUG_ASSERT(record && row); - my_ptrdiff_t const offset= record - (byte*) table->record[0]; - my_size_t master_null_bytes= table->s->null_bytes; + my_ptrdiff_t const offset= record - (uchar*) table->record[0]; + size_t master_null_bytes= table->s->null_bytes; if (colcnt != table->s->fields) { @@ -108,7 +108,7 @@ unpack_row_old(RELAY_LOG_INFO *rli, Field **const begin_ptr = table->field; Field **field_ptr; - char const *ptr= row + master_null_bytes; + uchar const *ptr= row + master_null_bytes; Field **const end_ptr= begin_ptr + colcnt; for (field_ptr= begin_ptr ; field_ptr < end_ptr ; ++field_ptr) { @@ -130,7 +130,7 @@ unpack_row_old(RELAY_LOG_INFO *rli, if (master_reclength) { if (*field_ptr) - *master_reclength = (*field_ptr)->ptr - (char*) table->record[0]; + *master_reclength = (*field_ptr)->ptr - table->record[0]; else *master_reclength = table->s->reclength; } diff --git a/sql/rpl_record_old.h b/sql/rpl_record_old.h index 6ddb01de07c..6af61141d47 100644 --- a/sql/rpl_record_old.h +++ b/sql/rpl_record_old.h @@ -17,14 +17,14 @@ #define RPL_RECORD_OLD_H #ifndef MYSQL_CLIENT -my_size_t pack_row_old(TABLE *table, MY_BITMAP const* cols, - byte *row_data, const byte *record); +size_t pack_row_old(TABLE *table, MY_BITMAP const* cols, + uchar *row_data, const uchar *record); #ifdef HAVE_REPLICATION int unpack_row_old(RELAY_LOG_INFO *rli, - TABLE *table, uint const colcnt, byte *record, - char const *row, MY_BITMAP const *cols, - char const **row_end, ulong *master_reclength, + TABLE *table, uint const colcnt, uchar *record, + uchar const *row, MY_BITMAP const *cols, + uchar const **row_end, ulong *master_reclength, MY_BITMAP* const rw_set, Log_event_type const event_type); #endif diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 702dec72f56..0c8f74bb35e 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -1078,7 +1078,8 @@ bool st_relay_log_info::cached_charset_compare(char *charset) const { DBUG_ENTER("st_relay_log_info::cached_charset_compare"); - if (bcmp(cached_charset, charset, sizeof(cached_charset))) + if (bcmp((uchar*) cached_charset, (uchar*) charset, + sizeof(cached_charset))) { memcpy(const_cast<char*>(cached_charset), charset, sizeof(cached_charset)); DBUG_RETURN(1); @@ -1168,7 +1169,7 @@ void st_relay_log_info::clear_tables_to_lock() { while (tables_to_lock) { - gptr to_free= reinterpret_cast<gptr>(tables_to_lock); + uchar* to_free= reinterpret_cast<uchar*>(tables_to_lock); if (tables_to_lock->m_tabledef_valid) { tables_to_lock->m_tabledef.table_def::~table_def(); diff --git a/sql/rpl_tblmap.cc b/sql/rpl_tblmap.cc index 7df4bcbdde7..6c8b494dfa9 100644 --- a/sql/rpl_tblmap.cc +++ b/sql/rpl_tblmap.cc @@ -104,11 +104,11 @@ int table_mapping::set_table(ulong table_id, TABLE* table) m_free= m_free->next; } else - hash_delete(&m_table_ids,(byte *)e); + hash_delete(&m_table_ids,(uchar *)e); e->table_id= table_id; e->table= table; - my_hash_insert(&m_table_ids,(byte *)e); + my_hash_insert(&m_table_ids,(uchar *)e); DBUG_PRINT("info", ("tid %lu -> table 0x%lx (%s)", table_id, (long) e->table, @@ -121,7 +121,7 @@ int table_mapping::remove_table(ulong table_id) entry *e= find_entry(table_id); if (e) { - hash_delete(&m_table_ids,(byte *)e); + hash_delete(&m_table_ids,(uchar *)e); /* we add this entry to the chain of free (free for use) entries */ e->next= m_free; m_free= e; diff --git a/sql/rpl_tblmap.h b/sql/rpl_tblmap.h index dbc968d0f67..446833d5ed6 100644 --- a/sql/rpl_tblmap.h +++ b/sql/rpl_tblmap.h @@ -85,7 +85,7 @@ private: entry *find_entry(ulong table_id) { return (entry *)hash_search(&m_table_ids, - (byte*)&table_id, + (uchar*)&table_id, sizeof(table_id)); } int expand(); diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc index 1d7cc808f0c..dcbf85f5939 100644 --- a/sql/rpl_utility.cc +++ b/sql/rpl_utility.cc @@ -17,7 +17,7 @@ uint32 field_length_from_packed(enum_field_types const field_type, - byte const *const data) + uchar const *const data) { uint32 length; diff --git a/sql/rpl_utility.h b/sql/rpl_utility.h index 17879a9ecfc..baca224a3e5 100644 --- a/sql/rpl_utility.h +++ b/sql/rpl_utility.h @@ -26,7 +26,7 @@ struct st_relay_log_info; typedef st_relay_log_info RELAY_LOG_INFO; uint32 -field_length_from_packed(enum_field_types field_type, byte const *data); +field_length_from_packed(enum_field_types field_type, uchar const *data); /** A table definition from the master. @@ -58,7 +58,7 @@ public: @param types Array of types @param size Number of elements in array 'types' */ - table_def(field_type *types, my_size_t size) + table_def(field_type *types, ulong size) : m_type(new unsigned char [size]), m_size(size) { if (m_type) @@ -81,7 +81,7 @@ public: @return The number of fields that there is type data for. */ - my_size_t size() const { return m_size; } + ulong size() const { return m_size; } /* @@ -93,10 +93,9 @@ public: <code>index</code>. Currently, only the type identifier is returned. */ - field_type type(my_ptrdiff_t index) const + field_type type(ulong index) const { - DBUG_ASSERT(0 <= index); - DBUG_ASSERT(static_cast<my_size_t>(index) < m_size); + DBUG_ASSERT(index < m_size); return m_type[index]; } @@ -120,7 +119,7 @@ public: int compatible_with(RELAY_LOG_INFO const *rli, TABLE *table) const; private: - my_size_t m_size; // Number of elements in the types array + ulong m_size; // Number of elements in the types array field_type *m_type; // Array of type descriptors }; diff --git a/sql/set_var.cc b/sql/set_var.cc index 325167ff9fa..283aa0104ce 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -152,9 +152,9 @@ static void fix_trans_mem_root(THD *thd, enum_var_type type); static void fix_server_id(THD *thd, enum_var_type type); static KEY_CACHE *create_key_cache(const char *name, uint length); void fix_sql_mode_var(THD *thd, enum_var_type type); -static byte *get_error_count(THD *thd); -static byte *get_warning_count(THD *thd); -static byte *get_tmpdir(THD *thd); +static uchar *get_error_count(THD *thd); +static uchar *get_warning_count(THD *thd); +static uchar *get_tmpdir(THD *thd); static int sys_check_log_path(THD *thd, set_var *var); static bool sys_update_general_log_path(THD *thd, set_var * var); static void sys_default_general_log_path(THD *thd, enum_var_type type); @@ -1136,7 +1136,7 @@ static void sys_default_init_slave(THD* thd, enum_var_type type) static int sys_check_ftb_syntax(THD *thd, set_var *var) { if (thd->security_ctx->master_access & SUPER_ACL) - return (ft_boolean_check_syntax_string((byte*) + return (ft_boolean_check_syntax_string((uchar*) var->value->str_value.c_ptr()) ? -1 : 0); else @@ -1514,9 +1514,9 @@ bool sys_var_enum::update(THD *thd, set_var *var) } -byte *sys_var_enum::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) +uchar *sys_var_enum::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { - return (byte*) enum_names->type_names[*value]; + return (uchar*) enum_names->type_names[*value]; } bool sys_var_thd_ulong::check(THD *thd, set_var *var) @@ -1561,12 +1561,12 @@ void sys_var_thd_ulong::set_default(THD *thd, enum_var_type type) } -byte *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { if (type == OPT_GLOBAL) - return (byte*) &(global_system_variables.*offset); - return (byte*) &(thd->variables.*offset); + return (uchar*) &(global_system_variables.*offset); + return (uchar*) &(thd->variables.*offset); } @@ -1607,12 +1607,12 @@ void sys_var_thd_ha_rows::set_default(THD *thd, enum_var_type type) } -byte *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { if (type == OPT_GLOBAL) - return (byte*) &(global_system_variables.*offset); - return (byte*) &(thd->variables.*offset); + return (uchar*) &(global_system_variables.*offset); + return (uchar*) &(thd->variables.*offset); } bool sys_var_thd_ulonglong::update(THD *thd, set_var *var) @@ -1650,12 +1650,12 @@ void sys_var_thd_ulonglong::set_default(THD *thd, enum_var_type type) } -byte *sys_var_thd_ulonglong::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_thd_ulonglong::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { if (type == OPT_GLOBAL) - return (byte*) &(global_system_variables.*offset); - return (byte*) &(thd->variables.*offset); + return (uchar*) &(global_system_variables.*offset); + return (uchar*) &(thd->variables.*offset); } @@ -1678,12 +1678,12 @@ void sys_var_thd_bool::set_default(THD *thd, enum_var_type type) } -byte *sys_var_thd_bool::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_thd_bool::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { if (type == OPT_GLOBAL) - return (byte*) &(global_system_variables.*offset); - return (byte*) &(thd->variables.*offset); + return (uchar*) &(global_system_variables.*offset); + return (uchar*) &(thd->variables.*offset); } @@ -1867,13 +1867,13 @@ void sys_var_thd_enum::set_default(THD *thd, enum_var_type type) } -byte *sys_var_thd_enum::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_thd_enum::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { ulong tmp= ((type == OPT_GLOBAL) ? global_system_variables.*offset : thd->variables.*offset); - return (byte*) enum_names->type_names[tmp]; + return (uchar*) enum_names->type_names[tmp]; } bool sys_var_thd_bit::check(THD *thd, set_var *var) @@ -1889,7 +1889,7 @@ bool sys_var_thd_bit::update(THD *thd, set_var *var) } -byte *sys_var_thd_bit::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_thd_bit::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { /* @@ -1898,7 +1898,7 @@ byte *sys_var_thd_bit::value_ptr(THD *thd, enum_var_type type, */ thd->sys_var_tmp.my_bool_value= ((thd->options & bit_flag) ? !reverse : reverse); - return (byte*) &thd->sys_var_tmp.my_bool_value; + return (uchar*) &thd->sys_var_tmp.my_bool_value; } @@ -1909,7 +1909,7 @@ void sys_var_thd_date_time_format::update2(THD *thd, enum_var_type type, { DATE_TIME_FORMAT *old; DBUG_ENTER("sys_var_date_time_format::update2"); - DBUG_DUMP("positions",(char*) new_value->positions, + DBUG_DUMP("positions", (uchar*) new_value->positions, sizeof(new_value->positions)); if (type == OPT_GLOBAL) @@ -1989,7 +1989,7 @@ void sys_var_thd_date_time_format::set_default(THD *thd, enum_var_type type) } -byte *sys_var_thd_date_time_format::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_thd_date_time_format::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { if (type == OPT_GLOBAL) @@ -2002,9 +2002,9 @@ byte *sys_var_thd_date_time_format::value_ptr(THD *thd, enum_var_type type, */ res= thd->strmake((global_system_variables.*offset)->format.str, (global_system_variables.*offset)->format.length); - return (byte*) res; + return (uchar*) res; } - return (byte*) (thd->variables.*offset)->format.str; + return (uchar*) (thd->variables.*offset)->format.str; } @@ -2125,11 +2125,11 @@ bool sys_var_character_set::update(THD *thd, set_var *var) } -byte *sys_var_character_set::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_character_set::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { CHARSET_INFO *cs= ci_ptr(thd,type)[0]; - return cs ? (byte*) cs->csname : (byte*) NULL; + return cs ? (uchar*) cs->csname : (uchar*) NULL; } @@ -2284,13 +2284,13 @@ bool sys_var_collation_connection::update(THD *thd, set_var *var) } -byte *sys_var_collation_connection::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_collation_connection::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { CHARSET_INFO *cs= ((type == OPT_GLOBAL) ? global_system_variables.collation_connection : thd->variables.collation_connection); - return cs ? (byte*) cs->name : (byte*) "NULL"; + return cs ? (uchar*) cs->name : (uchar*) "NULL"; } @@ -2319,13 +2319,13 @@ bool sys_var_collation_database::update(THD *thd, set_var *var) } -byte *sys_var_collation_database::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_collation_database::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { CHARSET_INFO *cs= ((type == OPT_GLOBAL) ? global_system_variables.collation_database : thd->variables.collation_database); - return cs ? (byte*) cs->name : (byte*) "NULL"; + return cs ? (uchar*) cs->name : (uchar*) "NULL"; } @@ -2355,13 +2355,13 @@ bool sys_var_collation_server::update(THD *thd, set_var *var) } -byte *sys_var_collation_server::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_collation_server::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { CHARSET_INFO *cs= ((type == OPT_GLOBAL) ? global_system_variables.collation_server : thd->variables.collation_server); - return cs ? (byte*) cs->name : (byte*) "NULL"; + return cs ? (uchar*) cs->name : (uchar*) "NULL"; } @@ -2392,13 +2392,13 @@ KEY_CACHE *get_key_cache(LEX_STRING *cache_name) } -byte *sys_var_key_cache_param::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_key_cache_param::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { KEY_CACHE *key_cache= get_key_cache(base); if (!key_cache) key_cache= &zero_key_cache; - return (byte*) key_cache + offset ; + return (uchar*) key_cache + offset ; } @@ -2584,11 +2584,12 @@ static int sys_check_log_path(THD *thd, set_var *var) } else { + size_t path_length; /* Check if directory exists and we have permission to create file & write to file */ - (void) dirname_part(path, var_path); + (void) dirname_part(path, var_path, &path_length); if (my_access(path, (F_OK|W_OK))) return -1; } @@ -2714,7 +2715,7 @@ void sys_var_log_output::set_default(THD *thd, enum_var_type type) } -byte *sys_var_log_output::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_log_output::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { char buff[256]; @@ -2735,7 +2736,7 @@ byte *sys_var_log_output::value_ptr(THD *thd, enum_var_type type, if ((length= tmp.length())) length--; - return (byte*) thd->strmake(tmp.ptr(), length); + return (uchar*) thd->strmake(tmp.ptr(), length); } @@ -2774,11 +2775,11 @@ void sys_var_timestamp::set_default(THD *thd, enum_var_type type) } -byte *sys_var_timestamp::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_timestamp::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { thd->sys_var_tmp.long_value= (long) thd->start_time; - return (byte*) &thd->sys_var_tmp.long_value; + return (uchar*) &thd->sys_var_tmp.long_value; } @@ -2790,7 +2791,7 @@ bool sys_var_last_insert_id::update(THD *thd, set_var *var) } -byte *sys_var_last_insert_id::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_last_insert_id::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { /* @@ -2799,7 +2800,7 @@ byte *sys_var_last_insert_id::value_ptr(THD *thd, enum_var_type type, */ thd->sys_var_tmp.ulonglong_value= thd->read_first_successful_insert_id_in_prev_stmt(); - return (byte*) &thd->sys_var_tmp.ulonglong_value; + return (uchar*) &thd->sys_var_tmp.ulonglong_value; } @@ -2810,12 +2811,12 @@ bool sys_var_insert_id::update(THD *thd, set_var *var) } -byte *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { thd->sys_var_tmp.ulonglong_value= thd->auto_inc_intervals_forced.minimum(); - return (byte*) &thd->sys_var_tmp.ulonglong_value; + return (uchar*) &thd->sys_var_tmp.ulonglong_value; } @@ -2908,7 +2909,7 @@ bool sys_var_thd_time_zone::update(THD *thd, set_var *var) } -byte *sys_var_thd_time_zone::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_thd_time_zone::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { /* @@ -2916,7 +2917,7 @@ byte *sys_var_thd_time_zone::value_ptr(THD *thd, enum_var_type type, time zone name is guaranteed to be zero ended. */ if (type == OPT_GLOBAL) - return (byte *)(global_system_variables.time_zone->get_name()->ptr()); + return (uchar *)(global_system_variables.time_zone->get_name()->ptr()); else { /* @@ -2928,7 +2929,7 @@ byte *sys_var_thd_time_zone::value_ptr(THD *thd, enum_var_type type, (binlog code stores session value only). */ thd->time_zone_used= 1; - return (byte *)(thd->variables.time_zone->get_name()->ptr()); + return (uchar *)(thd->variables.time_zone->get_name()->ptr()); } } @@ -2990,13 +2991,13 @@ void sys_var_max_user_conn::set_default(THD *thd, enum_var_type type) } -byte *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { if (type != OPT_GLOBAL && thd->user_connect && thd->user_connect->user_resources.user_conn) - return (byte*) &(thd->user_connect->user_resources.user_conn); - return (byte*) &(max_user_connections); + return (uchar*) &(thd->user_connect->user_resources.user_conn); + return (uchar*) &(max_user_connections); } @@ -3047,12 +3048,12 @@ bool sys_var_thd_lc_time_names::update(THD *thd, set_var *var) } -byte *sys_var_thd_lc_time_names::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_thd_lc_time_names::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { return type == OPT_GLOBAL ? - (byte *) global_system_variables.lc_time_names->name : - (byte *) thd->variables.lc_time_names->name; + (uchar *) global_system_variables.lc_time_names->name : + (uchar *) thd->variables.lc_time_names->name; } @@ -3161,20 +3162,20 @@ static int check_pseudo_thread_id(THD *thd, set_var *var) #endif } -static byte *get_warning_count(THD *thd) +static uchar *get_warning_count(THD *thd) { thd->sys_var_tmp.long_value= (thd->warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_NOTE] + thd->warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_ERROR] + thd->warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_WARN]); - return (byte*) &thd->sys_var_tmp.long_value; + return (uchar*) &thd->sys_var_tmp.long_value; } -static byte *get_error_count(THD *thd) +static uchar *get_error_count(THD *thd) { thd->sys_var_tmp.long_value= thd->warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_ERROR]; - return (byte*) &thd->sys_var_tmp.long_value; + return (uchar*) &thd->sys_var_tmp.long_value; } @@ -3195,11 +3196,11 @@ static byte *get_error_count(THD *thd) RETURN VALUES ptr pointer to NUL-terminated string */ -static byte *get_tmpdir(THD *thd) +static uchar *get_tmpdir(THD *thd) { if (opt_mysql_tmpdir) - return (byte *)opt_mysql_tmpdir; - return (byte*)mysql_tmpdir; + return (uchar *)opt_mysql_tmpdir; + return (uchar*)mysql_tmpdir; } /**************************************************************************** @@ -3245,11 +3246,11 @@ static struct my_option *find_option(struct my_option *opt, const char *name) Return variable name and length for hashing of variables */ -static byte *get_sys_var_length(const sys_var *var, uint *length, - my_bool first) +static uchar *get_sys_var_length(const sys_var *var, size_t *length, + my_bool first) { *length= var->name_length; - return (byte*) var->name; + return (uchar*) var->name; } @@ -3268,7 +3269,7 @@ void set_var_init() { var->name_length= strlen(var->name); var->option_limits= find_option(my_long_options, var->name); - my_hash_insert(&system_variable_hash, (byte*) var); + my_hash_insert(&system_variable_hash, (uchar*) var); } /* Special cases @@ -3303,7 +3304,7 @@ void set_var_free() sys_var *find_sys_var(const char *str, uint length) { sys_var *var= (sys_var*) hash_search(&system_variable_hash, - (byte*) str, + (uchar*) str, length ? length : strlen(str)); if (!var) @@ -3595,13 +3596,13 @@ err: } -byte *sys_var_thd_storage_engine::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_thd_storage_engine::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { handlerton *val; val= (type == OPT_GLOBAL) ? global_system_variables.*offset : thd->variables.*offset; - return (byte *) hton2plugin[val->slot]->name.str; + return (uchar *) hton2plugin[val->slot]->name.str; } @@ -3684,14 +3685,14 @@ symbolic_mode_representation(THD *thd, ulonglong val, LEX_STRING *rep) } -byte *sys_var_thd_sql_mode::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_thd_sql_mode::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { LEX_STRING sql_mode; ulonglong val= ((type == OPT_GLOBAL) ? global_system_variables.*offset : thd->variables.*offset); (void) symbolic_mode_representation(thd, val, &sql_mode); - return (byte *) sql_mode.str; + return (uchar *) sql_mode.str; } @@ -3782,7 +3783,7 @@ ulong fix_sql_mode(ulong sql_mode) Named list handling ****************************************************************************/ -gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length, +uchar* find_named(I_List<NAMED_LIST> *list, const char *name, uint length, NAMED_LIST **found) { I_List_iterator<NAMED_LIST> it(*list); @@ -3801,7 +3802,7 @@ gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length, void delete_elements(I_List<NAMED_LIST> *list, - void (*free_element)(const char *name, gptr)) + void (*free_element)(const char *name, uchar*)) { NAMED_LIST *element; DBUG_ENTER("delete_elements"); @@ -3825,7 +3826,7 @@ static KEY_CACHE *create_key_cache(const char *name, uint length) if ((key_cache= (KEY_CACHE*) my_malloc(sizeof(KEY_CACHE), MYF(MY_ZEROFILL | MY_WME)))) { - if (!new NAMED_LIST(&key_caches, name, length, (gptr) key_cache)) + if (!new NAMED_LIST(&key_caches, name, length, (uchar*) key_cache)) { my_free((char*) key_cache, MYF(0)); key_cache= 0; @@ -3984,14 +3985,14 @@ bool sys_var_thd_dbug::update(THD *thd, set_var *var) } -byte *sys_var_thd_dbug::value_ptr(THD *thd, enum_var_type type, LEX_STRING *b) +uchar *sys_var_thd_dbug::value_ptr(THD *thd, enum_var_type type, LEX_STRING *b) { char buf[256]; if (type == OPT_GLOBAL) DBUG_EXPLAIN_INITIAL(buf, sizeof(buf)); else DBUG_EXPLAIN(buf, sizeof(buf)); - return (byte*) thd->strdup(buf); + return (uchar*) thd->strdup(buf); } @@ -4034,10 +4035,10 @@ sys_var_event_scheduler::update(THD *thd, set_var *var) } -byte *sys_var_event_scheduler::value_ptr(THD *thd, enum_var_type type, +uchar *sys_var_event_scheduler::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { - return (byte *) Events::get_opt_event_scheduler_str(); + return (uchar *) Events::get_opt_event_scheduler_str(); } diff --git a/sql/set_var.h b/sql/set_var.h index a3963171192..8e506734f60 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -35,7 +35,7 @@ typedef int (*sys_check_func)(THD *, set_var *); typedef bool (*sys_update_func)(THD *, set_var *); typedef void (*sys_after_update_func)(THD *,enum_var_type); typedef void (*sys_set_default_func)(THD *, enum_var_type); -typedef byte *(*sys_value_ptr_func)(THD *thd); +typedef uchar *(*sys_value_ptr_func)(THD *thd); class sys_var { @@ -66,7 +66,7 @@ public: virtual bool update(THD *thd, set_var *var)=0; virtual void set_default(THD *thd_arg, enum_var_type type) {} virtual SHOW_TYPE show_type() { return SHOW_UNDEF; } - virtual byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) + virtual uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { return 0; } virtual bool check_type(enum_var_type type) { return type != OPT_GLOBAL; } /* Error if not GLOBAL */ @@ -115,8 +115,8 @@ public: bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type); SHOW_TYPE show_type() { return SHOW_LONG; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) - { return (byte*) value; } + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) + { return (uchar*) value; } }; @@ -144,8 +144,8 @@ public: bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type); SHOW_TYPE show_type() { return SHOW_LONGLONG; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) - { return (byte*) value; } + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) + { return (uchar*) value; } }; @@ -163,8 +163,8 @@ public: bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type); SHOW_TYPE show_type() { return SHOW_MY_BOOL; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) - { return (byte*) value; } + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) + { return (uchar*) value; } bool check_update_type(Item_result type) { return 0; } }; @@ -205,8 +205,8 @@ public: (*set_default_func)(thd, type); } SHOW_TYPE show_type() { return SHOW_CHAR; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) - { return (byte*) value; } + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) + { return (uchar*) value; } bool check_update_type(Item_result type) { return type != STRING_RESULT; /* Only accept strings */ @@ -231,9 +231,9 @@ public: return 1; } SHOW_TYPE show_type() { return SHOW_CHAR; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { - return (byte*) value; + return (uchar*) value; } bool check_update_type(Item_result type) { @@ -260,9 +260,9 @@ public: return 1; } SHOW_TYPE show_type() { return SHOW_CHAR; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { - return (byte*) *value; + return (uchar*) *value; } bool check_update_type(Item_result type) { @@ -288,7 +288,7 @@ public: } bool update(THD *thd, set_var *var); SHOW_TYPE show_type() { return SHOW_CHAR; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); bool check_update_type(Item_result type) { return 0; } }; @@ -323,7 +323,7 @@ public: bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type); SHOW_TYPE show_type() { return SHOW_LONG; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); }; @@ -341,7 +341,7 @@ public: bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type); SHOW_TYPE show_type() { return SHOW_HA_ROWS; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); }; @@ -361,7 +361,7 @@ public: bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type); SHOW_TYPE show_type() { return SHOW_LONGLONG; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); bool check_default(enum_var_type type) { return type == OPT_GLOBAL && !option_limits; @@ -387,7 +387,7 @@ public: bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type); SHOW_TYPE show_type() { return SHOW_MY_BOOL; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); bool check(THD *thd, set_var *var) { return check_enum(thd, var, &bool_typelib); @@ -430,7 +430,7 @@ public: bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type); SHOW_TYPE show_type() { return SHOW_CHAR; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); bool check_update_type(Item_result type) { return 0; } }; @@ -449,7 +449,7 @@ public: return check_set(thd, var, enum_names); } void set_default(THD *thd, enum_var_type type); - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); static bool symbolic_mode_representation(THD *thd, ulonglong sql_mode, LEX_STRING *rep); }; @@ -471,7 +471,7 @@ public: } void set_default(THD *thd, enum_var_type type); bool update(THD *thd, set_var *var); - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); }; class sys_var_thd_table_type :public sys_var_thd_storage_engine @@ -503,7 +503,7 @@ public: bool check_update_type(Item_result type) { return 0; } bool check_type(enum_var_type type) { return type == OPT_GLOBAL; } SHOW_TYPE show_type() { return SHOW_MY_BOOL; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); }; class sys_var_thd_dbug :public sys_var_thd @@ -515,7 +515,7 @@ public: SHOW_TYPE show_type() { return SHOW_CHAR; } bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type) { DBUG_POP(); } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *b); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *b); }; @@ -531,7 +531,7 @@ public: bool check_type(enum_var_type type) { return type == OPT_GLOBAL; } bool check_default(enum_var_type type) { return 0; } SHOW_TYPE show_type() { return SHOW_LONG; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); }; @@ -542,7 +542,7 @@ public: bool update(THD *thd, set_var *var); bool check_type(enum_var_type type) { return type == OPT_GLOBAL; } SHOW_TYPE show_type() { return SHOW_LONGLONG; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); }; @@ -553,7 +553,7 @@ public: bool update(THD *thd, set_var *var); bool check_type(enum_var_type type) { return type == OPT_GLOBAL; } SHOW_TYPE show_type() { return SHOW_LONGLONG; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); }; @@ -636,7 +636,7 @@ public: } bool check_default(enum_var_type type) { return 0; } bool update(THD *thd, set_var *var); - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); virtual void set_default(THD *thd, enum_var_type type)= 0; virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0; }; @@ -702,7 +702,7 @@ public: sys_var_collation_connection(const char *name_arg) :sys_var_collation(name_arg) {} bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type); - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); }; class sys_var_collation_server :public sys_var_collation @@ -711,7 +711,7 @@ public: sys_var_collation_server(const char *name_arg) :sys_var_collation(name_arg) {} bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type); - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); }; class sys_var_collation_database :public sys_var_collation @@ -720,7 +720,7 @@ public: sys_var_collation_database(const char *name_arg) :sys_var_collation(name_arg) {} bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type); - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); }; @@ -732,7 +732,7 @@ public: sys_var_key_cache_param(const char *name_arg, size_t offset_arg) :sys_var(name_arg), offset(offset_arg) {} - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); bool check_default(enum_var_type type) { return 1; } bool is_struct() { return 1; } }; @@ -780,7 +780,7 @@ public: bool check(THD *thd, set_var *var); bool update(THD *thd, set_var *var); void update2(THD *thd, enum_var_type type, DATE_TIME_FORMAT *new_value); - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); void set_default(THD *thd, enum_var_type type); }; @@ -810,7 +810,7 @@ public: return check_set(thd, var, enum_names); } bool update(THD *thd, set_var *var); - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); bool check_update_type(Item_result type) { return 0; } void set_default(THD *thd, enum_var_type type); SHOW_TYPE show_type() { return SHOW_CHAR; } @@ -835,7 +835,7 @@ public: bool check_default(enum_var_type type) { return 1; } bool check_type(enum_var_type type) { return type != var_type; } bool check_update_type(Item_result type) { return 1; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { return (*value_ptr_func)(thd); } @@ -854,9 +854,9 @@ public: sys_var(variable_name), have_variable(have_variable_arg) { } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { - return (byte*) show_comp_option_name[*have_variable]; + return (uchar*) show_comp_option_name[*have_variable]; } bool update(THD *thd, set_var *var) { return 1; } bool check_default(enum_var_type type) { return 1; } @@ -883,7 +883,7 @@ public: } bool check_default(enum_var_type type) { return 0; } bool update(THD *thd, set_var *var); - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); virtual void set_default(THD *thd, enum_var_type type); }; @@ -901,7 +901,7 @@ public: } void set_default(THD *thd, enum_var_type type); SHOW_TYPE show_type() { return SHOW_INT; } - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); }; class sys_var_trust_routine_creators :public sys_var_bool_ptr @@ -948,7 +948,7 @@ public: } bool check_default(enum_var_type type) { return 0; } bool update(THD *thd, set_var *var); - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); virtual void set_default(THD *thd, enum_var_type type); }; @@ -960,7 +960,7 @@ public: sys_var_event_scheduler(const char *name_arg) : sys_var_long_ptr(name_arg, NULL, NULL) {}; bool update(THD *thd, set_var *var); - byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); SHOW_TYPE show_type() { return SHOW_CHAR; } bool check(THD *thd, set_var *var); bool check_update_type(Item_result type) @@ -1102,10 +1102,10 @@ class NAMED_LIST :public ilink const char *name; uint name_length; public: - gptr data; + uchar* data; NAMED_LIST(I_List<NAMED_LIST> *links, const char *name_arg, - uint name_length_arg, gptr data_arg) + uint name_length_arg, uchar* data_arg) :name_length(name_length_arg), data(data_arg) { name= my_strndup(name_arg, name_length, MYF(MY_WME)); @@ -1117,12 +1117,12 @@ public: } ~NAMED_LIST() { - my_free((char*) name, MYF(0)); + my_free((uchar*) name, MYF(0)); } friend bool process_key_caches(int (* func) (const char *name, KEY_CACHE *)); friend void delete_elements(I_List<NAMED_LIST> *list, - void (*free_element)(const char*, gptr)); + void (*free_element)(const char*, uchar*)); }; /* updated in sql_acl.cc */ @@ -1155,7 +1155,7 @@ extern sys_var_str sys_init_slave; extern sys_var_thd_time_zone sys_time_zone; extern sys_var_thd_bit sys_autocommit; CHARSET_INFO *get_old_charset_by_name(const char *old_name); -gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length, +uchar* find_named(I_List<NAMED_LIST> *list, const char *name, uint length, NAMED_LIST **found); extern sys_var_str sys_var_general_log_path, sys_var_slow_log_path; @@ -1166,4 +1166,4 @@ KEY_CACHE *get_or_create_key_cache(const char *name, uint length); void free_key_cache(const char *name, KEY_CACHE *key_cache); bool process_key_caches(int (* func) (const char *name, KEY_CACHE *)); void delete_elements(I_List<NAMED_LIST> *list, - void (*free_element)(const char*, gptr)); + void (*free_element)(const char*, uchar*)); diff --git a/sql/slave.cc b/sql/slave.cc index f1b9ea8476b..54504d18f00 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -450,7 +450,7 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start, #ifdef NOT_USED_YET -static int end_slave_on_walk(MASTER_INFO* mi, gptr /*unused*/) +static int end_slave_on_walk(MASTER_INFO* mi, uchar* /*unused*/) { DBUG_ENTER("end_slave_on_walk"); @@ -620,7 +620,7 @@ void skip_load_data_infile(NET *net) (void)net_request_file(net, "/dev/null"); (void)my_net_read(net); // discard response - (void)net_write_command(net, 0, "", 0, "", 0); // Send ok + (void)net_write_command(net, 0, (uchar*) "", 0, (uchar*) "", 0); // ok DBUG_VOID_RETURN; } @@ -628,7 +628,8 @@ void skip_load_data_infile(NET *net) bool net_request_file(NET* net, const char* fname) { DBUG_ENTER("net_request_file"); - DBUG_RETURN(net_write_command(net, 251, fname, strlen(fname), "", 0)); + DBUG_RETURN(net_write_command(net, 251, (uchar*) fname, strlen(fname), + (uchar*) "", 0)); } /* @@ -1157,7 +1158,7 @@ static void write_ignored_events_info_to_relay_log(THD *thd, MASTER_INFO *mi) int register_slave_on_master(MYSQL* mysql) { - char buf[1024], *pos= buf; + uchar buf[1024], *pos= buf; uint report_host_len, report_user_len=0, report_password_len=0; DBUG_ENTER("register_slave_on_master"); @@ -1174,16 +1175,15 @@ int register_slave_on_master(MYSQL* mysql) DBUG_RETURN(0); // safety int4store(pos, server_id); pos+= 4; - pos= net_store_data(pos, report_host, report_host_len); - pos= net_store_data(pos, report_user, report_user_len); - pos= net_store_data(pos, report_password, report_password_len); + pos= net_store_data(pos, (uchar*) report_host, report_host_len); + pos= net_store_data(pos, (uchar*) report_user, report_user_len); + pos= net_store_data(pos, (uchar*) report_password, report_password_len); int2store(pos, (uint16) report_port); pos+= 2; int4store(pos, rpl_recovery_rank); pos+= 4; /* The master will fill in master_id */ int4store(pos, 0); pos+= 4; - if (simple_command(mysql, COM_REGISTER_SLAVE, (char*) buf, - (uint) (pos- buf), 0)) + if (simple_command(mysql, COM_REGISTER_SLAVE, buf, (size_t) (pos- buf), 0)) { sql_print_error("Error on COM_REGISTER_SLAVE: %d '%s'", mysql_errno(mysql), @@ -1370,7 +1370,7 @@ bool show_master_info(THD* thd, MASTER_INFO* mi) pthread_mutex_unlock(&mi->rli.data_lock); pthread_mutex_unlock(&mi->data_lock); - if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length())) + if (my_net_write(&thd->net, (uchar*) thd->packet.ptr(), packet->length())) DBUG_RETURN(TRUE); } send_eof(thd); @@ -1498,7 +1498,7 @@ static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed, static int request_dump(MYSQL* mysql, MASTER_INFO* mi, bool *suppress_warnings) { - char buf[FN_REFLEN + 10]; + uchar buf[FN_REFLEN + 10]; int len; int binlog_flags = 0; // for now char* logname = mi->master_log_name; @@ -1532,10 +1532,9 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi, static int request_table_dump(MYSQL* mysql, const char* db, const char* table) { - char buf[1024]; + uchar buf[1024], *p = buf; DBUG_ENTER("request_table_dump"); - char * p = buf; uint table_len = (uint) strlen(table); uint db_len = (uint) strlen(db); if (table_len + db_len > sizeof(buf) - 2) @@ -2580,7 +2579,8 @@ static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev) } if (unlikely(!num_bytes)) /* eof */ { - net_write_command(net, 0, "", 0, "", 0);/* 3.23 master wants it */ + /* 3.23 master wants it */ + net_write_command(net, 0, (uchar*) "", 0, (uchar*) "", 0); /* If we wrote Create_file_log_event, then we need to write Execute_load_log_event. If we did not write Create_file_log_event, @@ -3295,7 +3295,7 @@ bool flush_relay_log_info(RELAY_LOG_INFO* rli) *pos++='\n'; pos=longlong2str(rli->group_master_log_pos, pos, 10); *pos='\n'; - if (my_b_write(file, (byte*) buff, (ulong) (pos-buff)+1)) + if (my_b_write(file, (uchar*) buff, (size_t) (pos-buff)+1)) error=1; if (flush_io_cache(file)) error=1; diff --git a/sql/slave.h b/sql/slave.h index cb880c8125d..57806e65af7 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -94,9 +94,9 @@ class MASTER_INFO; extern ulong master_retry_count; extern MY_BITMAP slave_error_mask; extern bool use_slave_mask; -extern char* slave_load_tmpdir; -extern my_string master_info_file,relay_log_info_file; -extern my_string opt_relay_logname, opt_relaylog_index_name; +extern char *slave_load_tmpdir; +extern char *master_info_file, *relay_log_info_file; +extern char *opt_relay_logname, *opt_relaylog_index_name; extern my_bool opt_skip_slave_start, opt_reckless_slave; extern my_bool opt_log_slave_updates; extern ulonglong relay_log_space_limit; @@ -201,13 +201,13 @@ extern int disconnect_slave_event_count, abort_slave_event_count ; /* the master variables are defaults read from my.cnf or command line */ extern uint master_port, master_connect_retry, report_port; -extern my_string master_user, master_password, master_host, - master_info_file, relay_log_info_file, report_user, report_host, - report_password; +extern char * master_user, *master_password, *master_host; +extern char *master_info_file, *relay_log_info_file, *report_user; +extern char *report_host, *report_password; extern my_bool master_ssl; -extern my_string master_ssl_ca, master_ssl_capath, master_ssl_cert, - master_ssl_cipher, master_ssl_key; +extern char *master_ssl_ca, *master_ssl_capath, *master_ssl_cert; +extern char *master_ssl_cipher, *master_ssl_key; extern I_List<THD> threads; diff --git a/sql/sp.cc b/sql/sp.cc index d96e4295a83..244890f200d 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -147,10 +147,10 @@ static TABLE *open_proc_table_for_update(THD *thd) static int db_find_routine_aux(THD *thd, int type, sp_name *name, TABLE *table) { - byte key[MAX_KEY_LENGTH]; // db, name, optional key length type + uchar key[MAX_KEY_LENGTH]; // db, name, optional key length type DBUG_ENTER("db_find_routine_aux"); - DBUG_PRINT("enter", ("type: %d name: %.*s", - type, name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("type: %d name: %.*s", + type, (int) name->m_name.length, name->m_name.str)); /* Create key to find row. We have to use field->store() to be able to @@ -215,7 +215,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp) Open_tables_state open_tables_state_backup; DBUG_ENTER("db_find_routine"); DBUG_PRINT("enter", ("type: %d name: %.*s", - type, name->m_name.length, name->m_name.str)); + type, (int) name->m_name.length, name->m_name.str)); *sphp= 0; // In case of errors if (!(table= open_proc_table_for_read(thd, &open_tables_state_backup))) @@ -444,7 +444,7 @@ db_create_routine(THD *thd, int type, sp_head *sp) TABLE *table; char definer[USER_HOST_BUFF_SIZE]; DBUG_ENTER("db_create_routine"); - DBUG_PRINT("enter", ("type: %d name: %.*s",type,sp->m_name.length, + DBUG_PRINT("enter", ("type: %d name: %.*s",type, (int) sp->m_name.length, sp->m_name.str)); /* @@ -587,8 +587,8 @@ db_drop_routine(THD *thd, int type, sp_name *name) TABLE *table; int ret; DBUG_ENTER("db_drop_routine"); - DBUG_PRINT("enter", ("type: %d name: %.*s", - type, name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("type: %d name: %.*s", + type, (int) name->m_name.length, name->m_name.str)); /* This statement will be replicated as a statement, even when using @@ -626,8 +626,8 @@ db_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics) TABLE *table; int ret; DBUG_ENTER("db_update_routine"); - DBUG_PRINT("enter", ("type: %d name: %.*s", - type, name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("type: %d name: %.*s", + type, (int) name->m_name.length, name->m_name.str)); /* This statement will be replicated as a statement, even when using @@ -875,7 +875,7 @@ sp_drop_db_routines(THD *thd, char *db) ret= SP_OK; table->file->ha_index_init(0, 1); if (! table->file->index_read(table->record[0], - (byte *)table->field[MYSQL_PROC_FIELD_DB]->ptr, + (uchar *)table->field[MYSQL_PROC_FIELD_DB]->ptr, (key_part_map)1, HA_READ_KEY_EXACT)) { int nxtres; @@ -892,7 +892,7 @@ sp_drop_db_routines(THD *thd, char *db) break; } } while (! (nxtres= table->file->index_next_same(table->record[0], - (byte *)table->field[MYSQL_PROC_FIELD_DB]->ptr, + (uchar *)table->field[MYSQL_PROC_FIELD_DB]->ptr, key_len))); if (nxtres != HA_ERR_END_OF_FILE) ret= SP_KEY_NOT_FOUND; @@ -939,9 +939,9 @@ sp_find_routine(THD *thd, int type, sp_name *name, sp_cache **cp, thd->variables.max_sp_recursion_depth : 0); DBUG_ENTER("sp_find_routine"); - DBUG_PRINT("enter", ("name: %.*s.%.*s, type: %d, cache only %d", - name->m_db.length, name->m_db.str, - name->m_name.length, name->m_name.str, + DBUG_PRINT("enter", ("name: %.*s.%.*s type: %d cache only %d", + (int) name->m_db.length, name->m_db.str, + (int) name->m_name.length, name->m_name.str, type, cache_only)); if ((sp= sp_cache_lookup(cp, name))) @@ -1109,7 +1109,7 @@ sp_create_procedure(THD *thd, sp_head *sp) { int ret; DBUG_ENTER("sp_create_procedure"); - DBUG_PRINT("enter", ("name: %.*s", sp->m_name.length, sp->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", (int) sp->m_name.length, sp->m_name.str)); ret= db_create_routine(thd, TYPE_ENUM_PROCEDURE, sp); DBUG_RETURN(ret); @@ -1121,7 +1121,8 @@ sp_drop_procedure(THD *thd, sp_name *name) { int ret; DBUG_ENTER("sp_drop_procedure"); - DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", + (int) name->m_name.length, name->m_name.str)); ret= db_drop_routine(thd, TYPE_ENUM_PROCEDURE, name); if (!ret) @@ -1135,7 +1136,8 @@ sp_update_procedure(THD *thd, sp_name *name, st_sp_chistics *chistics) { int ret; DBUG_ENTER("sp_update_procedure"); - DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", + (int) name->m_name.length, name->m_name.str)); ret= db_update_routine(thd, TYPE_ENUM_PROCEDURE, name, chistics); if (!ret) @@ -1150,7 +1152,8 @@ sp_show_create_procedure(THD *thd, sp_name *name) int ret= SP_KEY_NOT_FOUND; sp_head *sp; DBUG_ENTER("sp_show_create_procedure"); - DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", + (int) name->m_name.length, name->m_name.str)); /* Increase the recursion limit for this statement. SHOW CREATE PROCEDURE @@ -1186,7 +1189,8 @@ sp_create_function(THD *thd, sp_head *sp) { int ret; DBUG_ENTER("sp_create_function"); - DBUG_PRINT("enter", ("name: %.*s", sp->m_name.length, sp->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", + (int) sp->m_name.length, sp->m_name.str)); ret= db_create_routine(thd, TYPE_ENUM_FUNCTION, sp); DBUG_RETURN(ret); @@ -1198,7 +1202,8 @@ sp_drop_function(THD *thd, sp_name *name) { int ret; DBUG_ENTER("sp_drop_function"); - DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", + (int) name->m_name.length, name->m_name.str)); ret= db_drop_routine(thd, TYPE_ENUM_FUNCTION, name); if (!ret) @@ -1212,7 +1217,8 @@ sp_update_function(THD *thd, sp_name *name, st_sp_chistics *chistics) { int ret; DBUG_ENTER("sp_update_procedure"); - DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", + (int) name->m_name.length, name->m_name.str)); ret= db_update_routine(thd, TYPE_ENUM_FUNCTION, name, chistics); if (!ret) @@ -1226,7 +1232,8 @@ sp_show_create_function(THD *thd, sp_name *name) { sp_head *sp; DBUG_ENTER("sp_show_create_function"); - DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", + (int) name->m_name.length, name->m_name.str)); if ((sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, name, &thd->sp_func_cache, FALSE))) @@ -1273,11 +1280,12 @@ struct Sroutine_hash_entry }; -extern "C" byte* sp_sroutine_key(const byte *ptr, uint *plen, my_bool first) +extern "C" uchar* sp_sroutine_key(const uchar *ptr, size_t *plen, + my_bool first) { Sroutine_hash_entry *rn= (Sroutine_hash_entry *)ptr; *plen= rn->key.length; - return (byte *)rn->key.str; + return (uchar *)rn->key.str; } @@ -1358,7 +1366,7 @@ static bool add_used_routine(LEX *lex, Query_arena *arena, Query_tables_list::START_SROUTINES_HASH_SIZE, 0, 0, sp_sroutine_key, 0, 0); - if (!hash_search(&lex->sroutines, (byte *)key->str, key->length)) + if (!hash_search(&lex->sroutines, (uchar *)key->str, key->length)) { Sroutine_hash_entry *rn= (Sroutine_hash_entry *)arena->alloc(sizeof(Sroutine_hash_entry) + @@ -1368,8 +1376,8 @@ static bool add_used_routine(LEX *lex, Query_arena *arena, rn->key.length= key->length; rn->key.str= (char *)rn + sizeof(Sroutine_hash_entry); memcpy(rn->key.str, key->str, key->length); - my_hash_insert(&lex->sroutines, (byte *)rn); - lex->sroutines_list.link_in_list((byte *)rn, (byte **)&rn->next); + my_hash_insert(&lex->sroutines, (uchar *)rn); + lex->sroutines_list.link_in_list((uchar *)rn, (uchar **)&rn->next); rn->belong_to_view= belong_to_view; return TRUE; } @@ -1427,7 +1435,7 @@ void sp_remove_not_own_routines(LEX *lex) but we want to be more future-proof. */ next_rt= not_own_rt->next; - hash_delete(&lex->sroutines, (byte *)not_own_rt); + hash_delete(&lex->sroutines, (uchar *)not_own_rt); } *(Sroutine_hash_entry **)lex->sroutines_list_own_last= NULL; @@ -1459,8 +1467,8 @@ void sp_update_sp_used_routines(HASH *dst, HASH *src) for (uint i=0 ; i < src->records ; i++) { Sroutine_hash_entry *rt= (Sroutine_hash_entry *)hash_element(src, i); - if (!hash_search(dst, (byte *)rt->key.str, rt->key.length)) - my_hash_insert(dst, (byte *)rt); + if (!hash_search(dst, (uchar *)rt->key.str, rt->key.length)) + my_hash_insert(dst, (uchar *)rt); } } @@ -93,7 +93,8 @@ int sp_cache_routines_and_add_tables_for_view(THD *thd, LEX *lex, int sp_cache_routines_and_add_tables_for_triggers(THD *thd, LEX *lex, TABLE_LIST *table); -extern "C" byte* sp_sroutine_key(const byte *ptr, uint *plen, my_bool first); +extern "C" uchar* sp_sroutine_key(const uchar *ptr, size_t *plen, + my_bool first); /* Routines which allow open/lock and close mysql.proc table even when diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc index de4e1efd496..84b15ee15c4 100644 --- a/sql/sp_cache.cc +++ b/sql/sp_cache.cc @@ -39,12 +39,12 @@ public: inline void insert(sp_head *sp) { /* TODO: why don't we check return value? */ - my_hash_insert(&m_hashtable, (const byte *)sp); + my_hash_insert(&m_hashtable, (const uchar *)sp); } inline sp_head *lookup(char *name, uint namelen) { - return (sp_head *)hash_search(&m_hashtable, (const byte *)name, namelen); + return (sp_head *)hash_search(&m_hashtable, (const uchar *)name, namelen); } #ifdef NOT_USED @@ -53,7 +53,7 @@ public: sp_head *sp= lookup(name, namelen); if (sp) { - hash_delete(&m_hashtable, (byte *)sp); + hash_delete(&m_hashtable, (uchar *)sp); return TRUE; } return FALSE; @@ -130,7 +130,7 @@ void sp_cache_insert(sp_cache **cp, sp_head *sp) return; // End of memory error c->version= Cversion; // No need to lock when reading long variable } - DBUG_PRINT("info",("sp_cache: inserting: %.*s", sp->m_qname.length, + DBUG_PRINT("info",("sp_cache: inserting: %.*s", (int) sp->m_qname.length, sp->m_qname.str)); c->insert(sp); *cp= c; // Update *cp if it was NULL @@ -214,12 +214,12 @@ void sp_cache_flush_obsolete(sp_cache **cp) Internal functions *************************************************************************/ -static byte *hash_get_key_for_sp_head(const byte *ptr, uint *plen, - my_bool first) +static uchar *hash_get_key_for_sp_head(const uchar *ptr, size_t *plen, + my_bool first) { sp_head *sp= (sp_head *)ptr; *plen= sp->m_qname.length; - return (byte*) sp->m_qname.str; + return (uchar*) sp->m_qname.str; } diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 04a7b2574a4..8d4cf464be9 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -385,13 +385,13 @@ void sp_name::init_qname(THD *thd) { m_sroutines_key.length= m_db.length + m_name.length + 2; - if (!(m_sroutines_key.str= thd->alloc(m_sroutines_key.length + 1))) + if (!(m_sroutines_key.str= (char*) thd->alloc(m_sroutines_key.length + 1))) return; m_qname.length= m_sroutines_key.length - 1; m_qname.str= m_sroutines_key.str + 1; sprintf(m_qname.str, "%.*s.%.*s", - m_db.length, (m_db.length ? m_db.str : ""), - m_name.length, m_name.str); + (int) m_db.length, (m_db.length ? m_db.str : ""), + (int) m_name.length, m_name.str); } @@ -485,8 +485,7 @@ sp_head::sp_head() */ m_db= m_name= m_qname= str_reset; - extern byte * - sp_table_key(const byte *ptr, uint *plen, my_bool first); + extern uchar *sp_table_key(const uchar *ptr, size_t *plen, my_bool first); DBUG_ENTER("sp_head::sp_head"); m_backpatch.empty(); @@ -713,7 +712,7 @@ sp_head::create_result_field(uint field_max_length, const char *field_name, field_max_length : m_return_field_def.length; field= ::make_field(table->s, /* TABLE_SHARE ptr */ - (char*) 0, /* field ptr */ + (uchar*) 0, /* field ptr */ field_length, /* field [max] length */ (uchar*) "", /* null ptr */ 0, /* null bit */ @@ -977,7 +976,7 @@ sp_head::execute(THD *thd) String old_packet; /* Use some extra margin for possible SP recursion and functions */ - if (check_stack_overrun(thd, 8 * STACK_MIN_SIZE, (char*)&old_packet)) + if (check_stack_overrun(thd, 8 * STACK_MIN_SIZE, (uchar*)&old_packet)) DBUG_RETURN(TRUE); /* init per-instruction memroot */ @@ -1664,7 +1663,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args) { List_iterator<Item> it_args(*args); - DBUG_PRINT("info",(" %.*s: eval args", m_name.length, m_name.str)); + DBUG_PRINT("info",(" %.*s: eval args", (int) m_name.length, m_name.str)); for (uint i= 0 ; i < params ; i++) { @@ -1722,7 +1721,8 @@ sp_head::execute_procedure(THD *thd, List<Item> *args) if (!thd->in_sub_stmt) close_thread_tables(thd, 0, 0); - DBUG_PRINT("info",(" %.*s: eval args done", m_name.length, m_name.str)); + DBUG_PRINT("info",(" %.*s: eval args done", + (int) m_name.length, m_name.str)); } if (!(m_flags & LOG_SLOW_STATEMENTS) && thd->enable_slow_log) { @@ -2181,7 +2181,7 @@ void sp_head::add_instr(sp_instr *instr) entire stored procedure, as their life span is equal. */ instr->mem_root= &main_mem_root; - insert_dynamic(&m_instr, (gptr)&instr); + insert_dynamic(&m_instr, (uchar*)&instr); } @@ -2267,7 +2267,7 @@ void sp_head::optimize() sp_instr *ibp; List_iterator_fast<sp_instr> li(bp); - set_dynamic(&m_instr, (gptr)&i, dst); + set_dynamic(&m_instr, (uchar*)&i, dst); while ((ibp= li++)) { sp_instr_opt_meta *im= static_cast<sp_instr_opt_meta *>(ibp); @@ -3458,12 +3458,12 @@ typedef struct st_sp_table uint query_lock_count; } SP_TABLE; -byte * -sp_table_key(const byte *ptr, uint *plen, my_bool first) +uchar * +sp_table_key(const uchar *ptr, size_t *plen, my_bool first) { SP_TABLE *tab= (SP_TABLE *)ptr; *plen= tab->qname.length; - return (byte *)tab->qname.str; + return (uchar *)tab->qname.str; } @@ -3524,8 +3524,8 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check) (and therefore should not be prelocked). Otherwise we will erroneously treat table with same name but with different alias as non-temporary. */ - if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (byte *)tname, tlen)) || - ((tab= (SP_TABLE *)hash_search(&m_sptabs, (byte *)tname, + if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname, tlen)) || + ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname, tlen - alen - 1)) && tab->temp)) { @@ -3555,7 +3555,7 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check) tab->db_length= table->db_length; tab->lock_type= table->lock_type; tab->lock_count= tab->query_lock_count= 1; - my_hash_insert(&m_sptabs, (byte *)tab); + my_hash_insert(&m_sptabs, (uchar *)tab); } } return TRUE; diff --git a/sql/sp_head.h b/sql/sp_head.h index 551707fa7bd..bea03e5c2a0 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -243,7 +243,7 @@ public: { sp_instr *i; - get_dynamic(&m_instr, (gptr)&i, m_instr.elements-1); + get_dynamic(&m_instr, (uchar*)&i, m_instr.elements-1); return i; } @@ -325,7 +325,7 @@ public: sp_instr *ip; if (i < m_instr.elements) - get_dynamic(&m_instr, (gptr)&ip, i); + get_dynamic(&m_instr, (uchar*)&ip, i); else ip= NULL; return ip; diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc index 780243cc79f..9c96485b8ec 100644 --- a/sql/sp_pcontext.cc +++ b/sql/sp_pcontext.cc @@ -211,7 +211,7 @@ sp_pcontext::find_variable(LEX_STRING *name, my_bool scoped) { sp_variable_t *p; - get_dynamic(&m_vars, (gptr)&p, i); + get_dynamic(&m_vars, (uchar*)&p, i); if (my_strnncoll(system_charset_info, (const uchar *)name->str, name->length, (const uchar *)p->name.str, p->name.length) == 0) @@ -238,7 +238,7 @@ sp_pcontext::find_variable(uint offset) { // This frame sp_variable_t *p; - get_dynamic(&m_vars, (gptr)&p, offset - m_var_offset); + get_dynamic(&m_vars, (uchar*)&p, offset - m_var_offset); return p; } if (m_parent) @@ -263,7 +263,7 @@ sp_pcontext::push_variable(LEX_STRING *name, enum enum_field_types type, p->mode= mode; p->offset= current_var_count(); p->dflt= NULL; - insert_dynamic(&m_vars, (gptr)&p); + insert_dynamic(&m_vars, (uchar*)&p); return p; } @@ -318,7 +318,7 @@ sp_pcontext::push_cond(LEX_STRING *name, sp_cond_type_t *val) p->name.str= name->str; p->name.length= name->length; p->val= val; - insert_dynamic(&m_conds, (gptr)&p); + insert_dynamic(&m_conds, (uchar*)&p); } } @@ -334,7 +334,7 @@ sp_pcontext::find_cond(LEX_STRING *name, my_bool scoped) { sp_cond_t *p; - get_dynamic(&m_conds, (gptr)&p, i); + get_dynamic(&m_conds, (uchar*)&p, i); if (my_strnncoll(system_charset_info, (const uchar *)name->str, name->length, (const uchar *)p->name.str, p->name.length) == 0) @@ -361,7 +361,7 @@ sp_pcontext::find_handler(sp_cond_type_t *cond) { sp_cond_type_t *p; - get_dynamic(&m_handlers, (gptr)&p, i); + get_dynamic(&m_handlers, (uchar*)&p, i); if (cond->type == p->type) { switch (p->type) @@ -391,7 +391,7 @@ sp_pcontext::push_cursor(LEX_STRING *name) m_max_cursor_index+= 1; n.str= name->str; n.length= name->length; - insert_dynamic(&m_cursors, (gptr)&n); + insert_dynamic(&m_cursors, (uchar*)&n); } /* @@ -406,7 +406,7 @@ sp_pcontext::find_cursor(LEX_STRING *name, uint *poff, my_bool scoped) { LEX_STRING n; - get_dynamic(&m_cursors, (gptr)&n, i); + get_dynamic(&m_cursors, (uchar*)&n, i); if (my_strnncoll(system_charset_info, (const uchar *)name->str, name->length, (const uchar *)n.str, n.length) == 0) @@ -429,7 +429,7 @@ sp_pcontext::retrieve_field_definitions(List<create_field> *field_def_lst) for (uint i = 0; i < m_vars.elements; ++i) { sp_variable_t *var_def; - get_dynamic(&m_vars, (gptr) &var_def, i); + get_dynamic(&m_vars, (uchar*) &var_def, i); field_def_lst->push_back(&var_def->field_def); } @@ -453,7 +453,7 @@ sp_pcontext::find_cursor(uint offset, LEX_STRING *n) if (m_cursor_offset <= offset && offset < m_cursor_offset + m_cursors.elements) { // This frame - get_dynamic(&m_cursors, (gptr)n, offset - m_cursor_offset); + get_dynamic(&m_cursors, (uchar*)n, offset - m_cursor_offset); return TRUE; } if (m_parent) diff --git a/sql/sp_pcontext.h b/sql/sp_pcontext.h index 5bffda79f98..3b8b165a6e0 100644 --- a/sql/sp_pcontext.h +++ b/sql/sp_pcontext.h @@ -273,7 +273,7 @@ public: inline bool push_case_expr_id(int case_expr_id) { - return insert_dynamic(&m_case_expr_id_lst, (gptr) &case_expr_id); + return insert_dynamic(&m_case_expr_id_lst, (uchar*) &case_expr_id); } inline void @@ -287,7 +287,7 @@ public: { int case_expr_id; - get_dynamic((DYNAMIC_ARRAY*)&m_case_expr_id_lst, (gptr) &case_expr_id, + get_dynamic((DYNAMIC_ARRAY*)&m_case_expr_id_lst, (uchar*) &case_expr_id, m_case_expr_id_lst.elements - 1); return case_expr_id; @@ -343,7 +343,7 @@ public: inline void push_handler(sp_cond_type_t *cond) { - insert_dynamic(&m_handlers, (gptr)&cond); + insert_dynamic(&m_handlers, (uchar*)&cond); } bool diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ba1ec66fb02..8ab92ced6c1 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -160,11 +160,11 @@ public: }; -static byte* acl_entry_get_key(acl_entry *entry,uint *length, - my_bool not_used __attribute__((unused))) +static uchar* acl_entry_get_key(acl_entry *entry, size_t *length, + my_bool not_used __attribute__((unused))) { *length=(uint) entry->length; - return (byte*) entry->key; + return (uchar*) entry->key; } #define IP_ADDR_STRLEN (3+1+3+1+3+1+3) @@ -362,9 +362,9 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) host.access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL | CREATE_TMP_ACL; } #endif - VOID(push_dynamic(&acl_hosts,(gptr) &host)); + VOID(push_dynamic(&acl_hosts,(uchar*) &host)); } - qsort((gptr) dynamic_element(&acl_hosts,0,ACL_HOST*),acl_hosts.elements, + qsort((uchar*) dynamic_element(&acl_hosts,0,ACL_HOST*),acl_hosts.elements, sizeof(ACL_HOST),(qsort_cmp) acl_compare); end_read_record(&read_record_info); freeze_size(&acl_hosts); @@ -546,13 +546,13 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) user.access|= SUPER_ACL | EXECUTE_ACL; #endif } - VOID(push_dynamic(&acl_users,(gptr) &user)); + VOID(push_dynamic(&acl_users,(uchar*) &user)); if (!user.host.hostname || (user.host.hostname[0] == wild_many && !user.host.hostname[1])) allow_all_hosts=1; // Anyone can connect } } - qsort((gptr) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements, + qsort((uchar*) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements, sizeof(ACL_USER),(qsort_cmp) acl_compare); end_read_record(&read_record_info); freeze_size(&acl_users); @@ -609,9 +609,9 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) db.access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL; } #endif - VOID(push_dynamic(&acl_dbs,(gptr) &db)); + VOID(push_dynamic(&acl_dbs,(uchar*) &db)); } - qsort((gptr) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements, + qsort((uchar*) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements, sizeof(ACL_DB),(qsort_cmp) acl_compare); end_read_record(&read_record_info); freeze_size(&acl_dbs); @@ -1152,11 +1152,11 @@ bool acl_getroot_no_password(Security_context *sctx, char *user, char *host, DBUG_RETURN(res); } -static byte* check_get_key(ACL_USER *buff,uint *length, - my_bool not_used __attribute__((unused))) +static uchar* check_get_key(ACL_USER *buff, size_t *length, + my_bool not_used __attribute__((unused))) { *length=buff->hostname_length; - return (byte*) buff->host.hostname; + return (uchar*) buff->host.hostname; } @@ -1237,11 +1237,11 @@ static void acl_insert_user(const char *user, const char *host, set_user_salt(&acl_user, password, password_len); - VOID(push_dynamic(&acl_users,(gptr) &acl_user)); + VOID(push_dynamic(&acl_users,(uchar*) &acl_user)); if (!acl_user.host.hostname || (acl_user.host.hostname[0] == wild_many && !acl_user.host.hostname[1])) allow_all_hosts=1; // Anyone can connect /* purecov: tested */ - qsort((gptr) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements, + qsort((uchar*) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements, sizeof(ACL_USER),(qsort_cmp) acl_compare); /* Rebuild 'acl_check_hosts' since 'acl_users' has been modified */ @@ -1303,8 +1303,8 @@ static void acl_insert_db(const char *user, const char *host, const char *db, acl_db.db=strdup_root(&mem,db); acl_db.access=privileges; acl_db.sort=get_sort(3,acl_db.host.hostname,acl_db.db,acl_db.user); - VOID(push_dynamic(&acl_dbs,(gptr) &acl_db)); - qsort((gptr) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements, + VOID(push_dynamic(&acl_dbs,(uchar*) &acl_db)); + qsort((uchar*) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements, sizeof(ACL_DB),(qsort_cmp) acl_compare); } @@ -1321,7 +1321,8 @@ ulong acl_get(const char *host, const char *ip, const char *user, const char *db, my_bool db_is_pattern) { ulong host_access= ~(ulong)0, db_access= 0; - uint i,key_length; + uint i; + size_t key_length; char key[ACL_KEY_LENGTH],*tmp_db,*end; acl_entry *entry; DBUG_ENTER("acl_get"); @@ -1333,8 +1334,9 @@ ulong acl_get(const char *host, const char *ip, my_casedn_str(files_charset_info, tmp_db); db=tmp_db; } - key_length=(uint) (end-key); - if (!db_is_pattern && (entry=(acl_entry*) acl_cache->search(key,key_length))) + key_length= (size_t) (end-key); + if (!db_is_pattern && (entry=(acl_entry*) acl_cache->search((uchar*) key, + key_length))) { db_access=entry->access; VOID(pthread_mutex_unlock(&acl_cache->lock)); @@ -1388,7 +1390,7 @@ exit: { entry->access=(db_access & host_access); entry->length=key_length; - memcpy((gptr) entry->key,key,key_length); + memcpy((uchar*) entry->key,key,key_length); acl_cache->add(entry); } VOID(pthread_mutex_unlock(&acl_cache->lock)); @@ -1430,12 +1432,12 @@ static void init_check_host(void) break; // already stored } if (j == acl_wild_hosts.elements) // If new - (void) push_dynamic(&acl_wild_hosts,(char*) &acl_user->host); + (void) push_dynamic(&acl_wild_hosts,(uchar*) &acl_user->host); } - else if (!hash_search(&acl_check_hosts,(byte*) acl_user->host.hostname, - (uint) strlen(acl_user->host.hostname))) + else if (!hash_search(&acl_check_hosts,(uchar*) acl_user->host.hostname, + strlen(acl_user->host.hostname))) { - if (my_hash_insert(&acl_check_hosts,(byte*) acl_user)) + if (my_hash_insert(&acl_check_hosts,(uchar*) acl_user)) { // End of memory allow_all_hosts=1; // Should never happen DBUG_VOID_RETURN; @@ -1473,8 +1475,8 @@ bool acl_check_host(const char *host, const char *ip) return 0; VOID(pthread_mutex_lock(&acl_cache->lock)); - if (host && hash_search(&acl_check_hosts,(byte*) host,(uint) strlen(host)) || - ip && hash_search(&acl_check_hosts,(byte*) ip,(uint) strlen(ip))) + if (host && hash_search(&acl_check_hosts,(uchar*) host,strlen(host)) || + ip && hash_search(&acl_check_hosts,(uchar*) ip, strlen(ip))) { VOID(pthread_mutex_unlock(&acl_cache->lock)); return 0; // Found host @@ -1533,7 +1535,7 @@ bool check_change_password(THD *thd, const char *host, const char *user, MYF(0)); return(1); } - uint len=strlen(new_password); + size_t len= strlen(new_password); if (len && len != SCRAMBLED_PASSWORD_CHAR_LENGTH && len != SCRAMBLED_PASSWORD_CHAR_LENGTH_323) { @@ -1567,7 +1569,7 @@ bool change_password(THD *thd, const char *host, const char *user, /* Buffer should be extended when password length is extended. */ char buff[512]; ulong query_length; - uint new_password_len= strlen(new_password); + uint new_password_len= (uint) strlen(new_password); bool result= 1; DBUG_ENTER("change_password"); DBUG_PRINT("enter",("host: '%s' user: '%s' new_password: '%s'", @@ -1768,8 +1770,8 @@ bool hostname_requires_resolving(const char *hostname) char cur; if (!hostname) return FALSE; - int namelen= strlen(hostname); - int lhlen= strlen(my_localhost); + size_t namelen= strlen(hostname); + size_t lhlen= strlen(my_localhost); if ((namelen == lhlen) && !my_strnncoll(system_charset_info, (const uchar *)hostname, namelen, (const uchar *)my_localhost, strlen(my_localhost))) @@ -1809,11 +1811,11 @@ static bool update_user_table(THD *thd, TABLE *table, table->use_all_columns(); table->field[0]->store(host,(uint) strlen(host), system_charset_info); table->field[1]->store(user,(uint) strlen(user), system_charset_info); - key_copy((byte *) user_key, table->record[0], table->key_info, + key_copy((uchar *) user_key, table->record[0], table->key_info, table->key_info->key_length); if (table->file->index_read_idx(table->record[0], 0, - (byte *) user_key, HA_WHOLE_KEY, + (uchar *) user_key, HA_WHOLE_KEY, HA_READ_KEY_EXACT)) { my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), @@ -1878,7 +1880,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, const char *password= ""; uint password_len= 0; char what= (revoke_grant) ? 'N' : 'Y'; - byte user_key[MAX_KEY_LENGTH]; + uchar user_key[MAX_KEY_LENGTH]; LEX *lex= thd->lex; DBUG_ENTER("replace_user_table"); @@ -2096,7 +2098,7 @@ static int replace_db_table(TABLE *table, const char *db, bool old_row_exists=0; int error; char what= (revoke_grant) ? 'N' : 'Y'; - byte user_key[MAX_KEY_LENGTH]; + uchar user_key[MAX_KEY_LENGTH]; DBUG_ENTER("replace_db_table"); if (!initialized) @@ -2198,16 +2200,16 @@ public: uint key_length; GRANT_COLUMN(String &c, ulong y) :rights (y) { - column= memdup_root(&memex,c.ptr(), key_length=c.length()); + column= (char*) memdup_root(&memex,c.ptr(), key_length=c.length()); } }; -static byte* get_key_column(GRANT_COLUMN *buff,uint *length, +static uchar* get_key_column(GRANT_COLUMN *buff, size_t *length, my_bool not_used __attribute__((unused))) { *length=buff->key_length; - return (byte*) buff->column; + return (uchar*) buff->column; } @@ -2218,7 +2220,7 @@ public: char *db, *user, *tname, *hash_key; ulong privs; ulong sort; - uint key_length; + size_t key_length; GRANT_NAME(const char *h, const char *d,const char *u, const char *t, ulong p); GRANT_NAME (TABLE *form); @@ -2257,8 +2259,8 @@ GRANT_NAME::GRANT_NAME(const char *h, const char *d,const char *u, my_casedn_str(files_charset_info, db); my_casedn_str(files_charset_info, tname); } - key_length =(uint) strlen(d)+(uint) strlen(u)+(uint) strlen(t)+3; - hash_key = (char*) alloc_root(&memex,key_length); + key_length= strlen(d) + strlen(u)+ strlen(t)+3; + hash_key= (char*) alloc_root(&memex,key_length); strmov(strmov(strmov(hash_key,user)+1,db)+1,tname); } @@ -2292,9 +2294,8 @@ GRANT_NAME::GRANT_NAME(TABLE *form) my_casedn_str(files_charset_info, db); my_casedn_str(files_charset_info, tname); } - key_length = ((uint) strlen(db) + (uint) strlen(user) + - (uint) strlen(tname) + 3); - hash_key = (char*) alloc_root(&memex,key_length); + key_length= (strlen(db) + strlen(user) + strlen(tname) + 3); + hash_key= (char*) alloc_root(&memex, key_length); strmov(strmov(strmov(hash_key,user)+1,db)+1,tname); privs = (ulong) form->field[6]->val_int(); privs = fix_rights_for_table(privs); @@ -2304,7 +2305,7 @@ GRANT_NAME::GRANT_NAME(TABLE *form) GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs) :GRANT_NAME(form) { - byte key[MAX_KEY_LENGTH]; + uchar key[MAX_KEY_LENGTH]; if (!db || !tname) { @@ -2338,7 +2339,7 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs) col_privs->field[4]->store("",0, &my_charset_latin1); col_privs->file->ha_index_init(0, 1); - if (col_privs->file->index_read(col_privs->record[0], (byte*) key, + if (col_privs->file->index_read(col_privs->record[0], (uchar*) key, (key_part_map)15, HA_READ_KEY_EXACT)) { cols = 0; /* purecov: deadcode */ @@ -2359,7 +2360,7 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs) privs = cols = 0; /* purecov: deadcode */ return; /* purecov: deadcode */ } - my_hash_insert(&hash_columns, (byte *) mem_check); + my_hash_insert(&hash_columns, (uchar *) mem_check); } while (!col_privs->file->index_next(col_privs->record[0]) && !key_cmp_if_same(col_privs,key,0,key_prefix_len)); col_privs->file->ha_index_end(); @@ -2373,11 +2374,11 @@ GRANT_TABLE::~GRANT_TABLE() } -static byte* get_grant_table(GRANT_NAME *buff,uint *length, +static uchar* get_grant_table(GRANT_NAME *buff, size_t *length, my_bool not_used __attribute__((unused))) { *length=buff->key_length; - return (byte*) buff->hash_key; + return (uchar*) buff->hash_key; } @@ -2401,10 +2402,10 @@ static GRANT_NAME *name_hash_search(HASH *name_hash, HASH_SEARCH_STATE state; len = (uint) (strmov(strmov(strmov(helping,user)+1,db)+1,tname)-helping)+ 1; - for (grant_name= (GRANT_NAME*) hash_first(name_hash, (byte*) helping, + for (grant_name= (GRANT_NAME*) hash_first(name_hash, (uchar*) helping, len, &state); grant_name ; - grant_name= (GRANT_NAME*) hash_next(name_hash,(byte*) helping, + grant_name= (GRANT_NAME*) hash_next(name_hash,(uchar*) helping, len, &state)) { if (exact) @@ -2449,7 +2450,7 @@ table_hash_search(const char *host, const char *ip, const char *db, inline GRANT_COLUMN * column_hash_search(GRANT_TABLE *t, const char *cname, uint length) { - return (GRANT_COLUMN*) hash_search(&t->hash_columns, (byte*) cname,length); + return (GRANT_COLUMN*) hash_search(&t->hash_columns, (uchar*) cname,length); } @@ -2460,7 +2461,7 @@ static int replace_column_table(GRANT_TABLE *g_t, ulong rights, bool revoke_grant) { int error=0,result=0; - byte key[MAX_KEY_LENGTH]; + uchar key[MAX_KEY_LENGTH]; uint key_prefix_length; KEY_PART_INFO *key_part= table->key_info->key_part; DBUG_ENTER("replace_column_table"); @@ -2491,7 +2492,7 @@ static int replace_column_table(GRANT_TABLE *g_t, { ulong privileges= column->rights; bool old_row_exists=0; - byte user_key[MAX_KEY_LENGTH]; + uchar user_key[MAX_KEY_LENGTH]; key_restore(table->record[0],key,table->key_info, key_prefix_length); @@ -2562,7 +2563,7 @@ static int replace_column_table(GRANT_TABLE *g_t, goto end; /* purecov: inspected */ } grant_column= new GRANT_COLUMN(column->column,privileges); - my_hash_insert(&g_t->hash_columns,(byte*) grant_column); + my_hash_insert(&g_t->hash_columns,(uchar*) grant_column); } } @@ -2573,7 +2574,7 @@ static int replace_column_table(GRANT_TABLE *g_t, if (revoke_grant) { - byte user_key[MAX_KEY_LENGTH]; + uchar user_key[MAX_KEY_LENGTH]; key_copy(user_key, table->record[0], table->key_info, key_prefix_length); @@ -2625,7 +2626,7 @@ static int replace_column_table(GRANT_TABLE *g_t, goto end; /* purecov: deadcode */ } if (grant_column) - hash_delete(&g_t->hash_columns,(byte*) grant_column); + hash_delete(&g_t->hash_columns,(uchar*) grant_column); } } } while (!table->file->index_next(table->record[0]) && @@ -2648,7 +2649,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, int old_row_exists = 1; int error=0; ulong store_table_rights, store_col_rights; - byte user_key[MAX_KEY_LENGTH]; + uchar user_key[MAX_KEY_LENGTH]; DBUG_ENTER("replace_table_table"); strxmov(grantor, thd->security_ctx->user, "@", @@ -2748,7 +2749,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, } else { - hash_delete(&column_priv_hash,(byte*) grant_table); + hash_delete(&column_priv_hash,(uchar*) grant_table); } DBUG_RETURN(0); @@ -2802,7 +2803,7 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name, store_record(table,record[1]); // store at pos 1 if (table->file->index_read_idx(table->record[0], 0, - (byte*) table->field[0]->ptr, HA_WHOLE_KEY, + (uchar*) table->field[0]->ptr, HA_WHOLE_KEY, HA_READ_KEY_EXACT)) { /* @@ -2865,7 +2866,7 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name, } else { - hash_delete(is_proc ? &proc_priv_hash : &func_priv_hash,(byte*) grant_name); + hash_delete(is_proc ? &proc_priv_hash : &func_priv_hash,(uchar*) grant_name); } DBUG_RETURN(0); @@ -3081,7 +3082,7 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list, result= TRUE; /* purecov: deadcode */ continue; /* purecov: deadcode */ } - my_hash_insert(&column_priv_hash,(byte*) grant_table); + my_hash_insert(&column_priv_hash,(uchar*) grant_table); } /* If revoke_grant, calculate the new column privilege for tables_priv */ @@ -3300,7 +3301,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc, result= TRUE; continue; } - my_hash_insert(is_proc ? &proc_priv_hash : &func_priv_hash,(byte*) grant_name); + my_hash_insert(is_proc ? &proc_priv_hash : &func_priv_hash,(uchar*) grant_name); } if (replace_routine_table(thd, grant_name, tables[1].table, *Str, @@ -3572,7 +3573,7 @@ static my_bool grant_load(TABLE_LIST *tables) if (! mem_check->ok()) delete mem_check; - else if (my_hash_insert(&column_priv_hash,(byte*) mem_check)) + else if (my_hash_insert(&column_priv_hash,(uchar*) mem_check)) { delete mem_check; grant_option= FALSE; @@ -3628,7 +3629,7 @@ static my_bool grant_load(TABLE_LIST *tables) mem_check->privs= fix_rights_for_procedure(mem_check->privs); if (! mem_check->ok()) delete mem_check; - else if (my_hash_insert(hash, (byte*) mem_check)) + else if (my_hash_insert(hash, (uchar*) mem_check)) { delete mem_check; grant_option= FALSE; @@ -5002,7 +5003,7 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop, char *user_str= user_from->user.str; const char *host; const char *user; - byte user_key[MAX_KEY_LENGTH]; + uchar user_key[MAX_KEY_LENGTH]; uint key_prefix_length; DBUG_ENTER("handle_grant_table"); @@ -5239,11 +5240,11 @@ static int handle_grant_struct(uint struct_no, bool drop, break; case 2: - hash_delete(&column_priv_hash, (byte*) grant_name); + hash_delete(&column_priv_hash, (uchar*) grant_name); break; case 3: - hash_delete(&proc_priv_hash, (byte*) grant_name); + hash_delete(&proc_priv_hash, (uchar*) grant_name); break; } elements--; @@ -6081,15 +6082,15 @@ void update_schema_privilege(TABLE *table, char *buff, const char* db, int i= 2; CHARSET_INFO *cs= system_charset_info; restore_record(table, s->default_values); - table->field[0]->store(buff, strlen(buff), cs); + table->field[0]->store(buff, (uint) strlen(buff), cs); if (db) - table->field[i++]->store(db, strlen(db), cs); + table->field[i++]->store(db, (uint) strlen(db), cs); if (t_name) - table->field[i++]->store(t_name, strlen(t_name), cs); + table->field[i++]->store(t_name, (uint) strlen(t_name), cs); if (column) table->field[i++]->store(column, col_length, cs); table->field[i++]->store(priv, priv_length, cs); - table->field[i]->store(is_grantable, strlen(is_grantable), cs); + table->field[i]->store(is_grantable, (uint) strlen(is_grantable), cs); table->file->ha_write_row(table->record[0]); } diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index e7decf4a8fc..6b4aaa26236 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -498,7 +498,7 @@ void field_decimal::add() if (room_in_tree) { - char buf[DECIMAL_MAX_FIELD_SIZE]; + uchar buf[DECIMAL_MAX_FIELD_SIZE]; my_decimal2binary(E_DEC_FATAL_ERROR, dec, buf, item->max_length, item->decimals); if (!(element = tree_insert(&tree, (void*)buf, 0, tree.custom_arg))) @@ -1108,7 +1108,7 @@ int collect_real(double *element, element_count count __attribute__((unused)), } // collect_real -int collect_decimal(char *element, element_count count, +int collect_decimal(uchar *element, element_count count, TREE_INFO *info) { char buff[DECIMAL_MAX_STR_LENGTH]; diff --git a/sql/sql_analyse.h b/sql/sql_analyse.h index ac671b85e1e..ae5d88bf93e 100644 --- a/sql/sql_analyse.h +++ b/sql/sql_analyse.h @@ -143,7 +143,7 @@ public: }; -int collect_decimal(char *element, element_count count, +int collect_decimal(uchar *element, element_count count, TREE_INFO *info); class field_decimal :public field_info @@ -165,7 +165,7 @@ public: String *get_min_arg(String *); String *get_max_arg(String *); String *avg(String *s, ha_rows rows); - friend int collect_decimal(char *element, element_count count, + friend int collect_decimal(uchar *element, element_count count, TREE_INFO *info); tree_walk_action collect_enum() { return (tree_walk_action) collect_decimal; } diff --git a/sql/sql_array.h b/sql/sql_array.h index e2e12bee241..ab6fdd0c5c0 100644 --- a/sql/sql_array.h +++ b/sql/sql_array.h @@ -45,7 +45,7 @@ public: bool append(Elem &el) { - return (insert_dynamic(&array, (gptr)&el)); + return (insert_dynamic(&array, (uchar*)&el)); } int elements() diff --git a/sql/sql_base.cc b/sql/sql_base.cc index f26d6e5777b..561d176c342 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -104,19 +104,19 @@ static bool has_two_write_locked_tables_with_auto_increment(TABLE_LIST *tables); -extern "C" byte *table_cache_key(const byte *record,uint *length, +extern "C" uchar *table_cache_key(const uchar *record, size_t *length, my_bool not_used __attribute__((unused))) { TABLE *entry=(TABLE*) record; *length= entry->s->table_cache_key.length; - return (byte*) entry->s->table_cache_key.str; + return (uchar*) entry->s->table_cache_key.str; } bool table_cache_init(void) { return hash_init(&open_cache, &my_charset_bin, table_cache_size+16, - 0, 0,table_cache_key, + 0, 0, table_cache_key, (hash_free_key) free_cache_entry, 0) != 0; } @@ -243,12 +243,12 @@ uint create_table_def_key(THD *thd, char *key, TABLE_LIST *table_list, Functions to handle table definition cach (TABLE_SHARE) *****************************************************************************/ -extern "C" byte *table_def_key(const byte *record, uint *length, +extern "C" uchar *table_def_key(const uchar *record, size_t *length, my_bool not_used __attribute__((unused))) { TABLE_SHARE *entry=(TABLE_SHARE*) record; *length= entry->table_cache_key.length; - return (byte*) entry->table_cache_key.str; + return (uchar*) entry->table_cache_key.str; } @@ -334,7 +334,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key, *error= 0; /* Read table definition from cache */ - if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(byte*) key, + if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key, key_length))) goto found; @@ -351,7 +351,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key, pthread_mutex_unlock(&LOCK_open); pthread_mutex_lock(&LOCK_open); /* Check that another thread didn't insert the same table in between */ - if ((old_share= hash_search(&table_def_cache, (byte*) key, key_length))) + if ((old_share= hash_search(&table_def_cache, (uchar*) key, key_length))) { (void) pthread_mutex_lock(&share->mutex); free_table_share(share); @@ -381,7 +381,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key, */ assign_new_table_id(share); - if (my_hash_insert(&table_def_cache, (byte*) share)) + if (my_hash_insert(&table_def_cache, (uchar*) share)) { #ifdef WAITING_FOR_TABLE_DEF_CACHE_STAGE_3 pthread_mutex_unlock(&LOCK_open); @@ -407,7 +407,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key, (void) pthread_mutex_lock(&share->mutex); #endif *error= share->error; - (void) hash_delete(&table_def_cache, (byte*) share); + (void) hash_delete(&table_def_cache, (uchar*) share); DBUG_RETURN(0); } share->ref_count++; // Mark in use @@ -462,7 +462,7 @@ found: oldest_unused_share->next) { pthread_mutex_lock(&oldest_unused_share->mutex); - VOID(hash_delete(&table_def_cache, (byte*) oldest_unused_share)); + VOID(hash_delete(&table_def_cache, (uchar*) oldest_unused_share)); } DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u", @@ -585,7 +585,7 @@ void release_table_share(TABLE_SHARE *share, enum release_type type) if (to_be_deleted) { DBUG_PRINT("info", ("Deleting share")); - hash_delete(&table_def_cache, (byte*) share); + hash_delete(&table_def_cache, (uchar*) share); DBUG_VOID_RETURN; } pthread_mutex_unlock(&share->mutex); @@ -611,13 +611,13 @@ void release_table_share(TABLE_SHARE *share, enum release_type type) This code is execured when someone does FLUSH TABLES while on has locked tables. */ - (void) hash_search(&def_cache,(byte*) key,key_length); - hash_replace(&def_cache, def_cache.current_record,(byte*) name_lock); + (void) hash_search(&def_cache,(uchar*) key,key_length); + hash_replace(&def_cache, def_cache.current_record,(uchar*) name_lock); } else { /* Remove table definition */ - hash_delete(&def_cache,(byte*) share); + hash_delete(&def_cache,(uchar*) share); } pthread_mutex_unlock(&LOCK_open); free_table_share(share); @@ -662,7 +662,7 @@ TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name) table_list.db= (char*) db; table_list.table_name= (char*) table_name; key_length= create_table_def_key((THD*) 0, key, &table_list, 0); - return (TABLE_SHARE*) hash_search(&table_def_cache,(byte*) key, key_length); + return (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key, key_length); } @@ -840,7 +840,7 @@ static void free_cache_entry(TABLE *table) } check_unused(); // consisty check } - my_free((gptr) table,MYF(0)); + my_free((uchar*) table,MYF(0)); DBUG_VOID_RETURN; } @@ -852,7 +852,7 @@ void free_io_cache(TABLE *table) if (table->sort.io_cache) { close_cached_file(table->sort.io_cache); - my_free((gptr) table->sort.io_cache,MYF(0)); + my_free((uchar*) table->sort.io_cache,MYF(0)); table->sort.io_cache=0; } DBUG_VOID_RETURN; @@ -881,17 +881,17 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, while (unused_tables) { #ifdef EXTRA_DEBUG - if (hash_delete(&open_cache,(byte*) unused_tables)) + if (hash_delete(&open_cache,(uchar*) unused_tables)) printf("Warning: Couldn't delete open table from hash\n"); #else - VOID(hash_delete(&open_cache,(byte*) unused_tables)); + VOID(hash_delete(&open_cache,(uchar*) unused_tables)); #endif } /* Free table shares */ while (oldest_unused_share->next) { pthread_mutex_lock(&oldest_unused_share->mutex); - VOID(hash_delete(&table_def_cache, (byte*) oldest_unused_share)); + VOID(hash_delete(&table_def_cache, (uchar*) oldest_unused_share)); } } else @@ -1216,7 +1216,7 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived) /* Free tables to hold down open files */ while (open_cache.records > table_cache_size && unused_tables) - VOID(hash_delete(&open_cache,(byte*) unused_tables)); /* purecov: tested */ + VOID(hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */ check_unused(); if (found_old_table) { @@ -1255,7 +1255,7 @@ bool close_thread_table(THD *thd, TABLE **table_ptr) if (table->s->version != refresh_version || thd->version != refresh_version || !table->db_stat) { - VOID(hash_delete(&open_cache,(byte*) table)); + VOID(hash_delete(&open_cache,(uchar*) table)); found_old_table=1; } else @@ -1799,7 +1799,7 @@ TABLE *unlink_open_table(THD *thd, TABLE *list, TABLE *find) { if (thd->locked_tables) mysql_lock_remove(thd, thd->locked_tables,list); - VOID(hash_delete(&open_cache,(byte*) list)); // Close table + VOID(hash_delete(&open_cache,(uchar*) list)); // Close table } else { @@ -1964,7 +1964,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, *refresh=0; /* an open table operation needs a lot of the stack space */ - if (check_stack_overrun(thd, STACK_MIN_SIZE_FOR_OPEN, (char *)&alias)) + if (check_stack_overrun(thd, STACK_MIN_SIZE_FOR_OPEN, (uchar *)&alias)) DBUG_RETURN(0); if (thd->killed) @@ -2179,10 +2179,10 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, an implicit "pending locks queue" - see wait_for_locked_table_names for details. */ - for (table= (TABLE*) hash_first(&open_cache, (byte*) key, key_length, + for (table= (TABLE*) hash_first(&open_cache, (uchar*) key, key_length, &state); table && table->in_use ; - table= (TABLE*) hash_next(&open_cache, (byte*) key, key_length, + table= (TABLE*) hash_next(&open_cache, (uchar*) key, key_length, &state)) { /* @@ -2271,7 +2271,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, int error; /* Free cache if too big */ while (open_cache.records > table_cache_size && unused_tables) - VOID(hash_delete(&open_cache,(byte*) unused_tables)); /* purecov: tested */ + VOID(hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */ /* make a new table */ if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME)))) @@ -2284,7 +2284,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, mem_root, (flags & OPEN_VIEW_NO_PARSE)); if (error > 0) { - my_free((gptr)table, MYF(0)); + my_free((uchar*)table, MYF(0)); VOID(pthread_mutex_unlock(&LOCK_open)); DBUG_RETURN(NULL); } @@ -2297,12 +2297,12 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, if (error < 0) table_list->view= (st_lex*)1; - my_free((gptr)table, MYF(0)); + my_free((uchar*)table, MYF(0)); VOID(pthread_mutex_unlock(&LOCK_open)); DBUG_RETURN(0); // VIEW } DBUG_PRINT("info", ("inserting table 0x%lx into the cache", (long) table)); - VOID(my_hash_insert(&open_cache,(byte*) table)); + VOID(my_hash_insert(&open_cache,(uchar*) table)); } check_unused(); // Debugging call @@ -2525,7 +2525,7 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh) if (!tables || (!db_stat && reopen_table(table))) { my_error(ER_CANT_REOPEN_TABLE, MYF(0), table->alias); - VOID(hash_delete(&open_cache,(byte*) table)); + VOID(hash_delete(&open_cache,(uchar*) table)); error=1; } else @@ -2556,7 +2556,7 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh) } if (get_locks && tables) { - my_afree((gptr) tables); + my_afree((uchar*) tables); } broadcast_refresh(); *prev=0; @@ -2623,10 +2623,10 @@ bool table_is_used(TABLE *table, bool wait_for_name_lock) DBUG_PRINT("loop", ("table_name: %s", table->alias)); HASH_SEARCH_STATE state; - for (TABLE *search= (TABLE*) hash_first(&open_cache, (byte*) key, + for (TABLE *search= (TABLE*) hash_first(&open_cache, (uchar*) key, key_length, &state); search ; - search= (TABLE*) hash_next(&open_cache, (byte*) key, + search= (TABLE*) hash_next(&open_cache, (uchar*) key, key_length, &state)) { DBUG_PRINT("info", ("share: 0x%lx locked_by_logger: %d " @@ -2741,7 +2741,7 @@ TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name) else { /* We already have a name lock, remove copy */ - VOID(hash_delete(&open_cache,(byte*) table)); + VOID(hash_delete(&open_cache,(uchar*) table)); } } else @@ -2755,7 +2755,7 @@ TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name) broadcast_refresh(); if (thd->locked_tables && thd->locked_tables->table_count == 0) { - my_free((gptr) thd->locked_tables,MYF(0)); + my_free((uchar*) thd->locked_tables,MYF(0)); thd->locked_tables=0; } DBUG_RETURN(found); @@ -4157,7 +4157,7 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, uint length, field_ptr= table->field + cached_field_index; else if (table->s->name_hash.records) { - field_ptr= (Field**) hash_search(&table->s->name_hash, (byte*) name, + field_ptr= (Field**) hash_search(&table->s->name_hash, (uchar*) name, length); if (field_ptr) { @@ -4365,7 +4365,7 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list, else { if (thd->mark_used_columns == MARK_COLUMNS_READ) - it->walk(&Item::register_field_in_read_map, 1, (byte *) 0); + it->walk(&Item::register_field_in_read_map, 1, (uchar *) 0); } } else @@ -4404,7 +4404,7 @@ Field *find_field_in_table_sef(TABLE *table, const char *name) Field **field_ptr; if (table->s->name_hash.records) { - field_ptr= (Field**)hash_search(&table->s->name_hash,(byte*) name, + field_ptr= (Field**)hash_search(&table->s->name_hash,(uchar*) name, strlen(name)); if (field_ptr) { @@ -6496,14 +6496,15 @@ my_bool mysql_rm_tmp_tables(void) (file->name[1] == '.' && !file->name[2]))) continue; - if (!bcmp(file->name,tmp_file_prefix,tmp_file_prefix_length)) + if (!bcmp((uchar*) file->name, (uchar*) tmp_file_prefix, + tmp_file_prefix_length)) { char *ext= fn_ext(file->name); uint ext_len= strlen(ext); uint filePath_len= my_snprintf(filePath, sizeof(filePath), "%s%c%s", tmpdir, FN_LIBCHAR, file->name); - if (!bcmp(reg_ext, ext, ext_len)) + if (!bcmp((uchar*) reg_ext, (uchar*) ext, ext_len)) { handler *handler_file= 0; /* We should cut file extention before deleting of table */ @@ -6566,7 +6567,7 @@ void remove_db_from_cache(const char *db) } } while (unused_tables && !unused_tables->s->version) - VOID(hash_delete(&open_cache,(byte*) unused_tables)); + VOID(hash_delete(&open_cache,(uchar*) unused_tables)); } @@ -6582,7 +6583,7 @@ void flush_tables() { (void) pthread_mutex_lock(&LOCK_open); while (unused_tables) - hash_delete(&open_cache,(byte*) unused_tables); + hash_delete(&open_cache,(uchar*) unused_tables); (void) pthread_mutex_unlock(&LOCK_open); } @@ -6619,10 +6620,10 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, HASH_SEARCH_STATE state; result= signalled= 0; - for (table= (TABLE*) hash_first(&open_cache, (byte*) key, key_length, + for (table= (TABLE*) hash_first(&open_cache, (uchar*) key, key_length, &state); table; - table= (TABLE*) hash_next(&open_cache, (byte*) key, key_length, + table= (TABLE*) hash_next(&open_cache, (uchar*) key, key_length, &state)) { THD *in_use; @@ -6677,11 +6678,11 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, } } while (unused_tables && !unused_tables->s->version) - VOID(hash_delete(&open_cache,(byte*) unused_tables)); + VOID(hash_delete(&open_cache,(uchar*) unused_tables)); DBUG_PRINT("info", ("Removing table from table_def_cache")); /* Remove table from table definition cache if it's not in use */ - if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(byte*) key, + if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key, key_length))) { DBUG_PRINT("info", ("share version: %lu ref_count: %u", @@ -6690,7 +6691,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, if (share->ref_count == 0) { pthread_mutex_lock(&share->mutex); - VOID(hash_delete(&table_def_cache, (byte*) share)); + VOID(hash_delete(&table_def_cache, (uchar*) share)); } } @@ -6932,10 +6933,10 @@ void mysql_wait_completed_table(ALTER_PARTITION_PARAM_TYPE *lpt, TABLE *my_table key_length=(uint) (strmov(strmov(key,lpt->db)+1,lpt->table_name)-key)+1; VOID(pthread_mutex_lock(&LOCK_open)); HASH_SEARCH_STATE state; - for (table= (TABLE*) hash_first(&open_cache,(byte*) key,key_length, + for (table= (TABLE*) hash_first(&open_cache,(uchar*) key,key_length, &state) ; table; - table= (TABLE*) hash_next(&open_cache,(byte*) key,key_length, + table= (TABLE*) hash_next(&open_cache,(uchar*) key,key_length, &state)) { THD *in_use= table->in_use; diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc index d3fdd95707c..77432ce518e 100644 --- a/sql/sql_binlog.cc +++ b/sql/sql_binlog.cc @@ -33,8 +33,8 @@ void mysql_client_binlog_statement(THD* thd) { DBUG_ENTER("mysql_client_binlog_statement"); DBUG_PRINT("info",("binlog base64: '%*s'", - (thd->lex->comment.length < 2048 ? - thd->lex->comment.length : 2048), + (int) (thd->lex->comment.length < 2048 ? + thd->lex->comment.length : 2048), thd->lex->comment.str)); /* @@ -44,8 +44,8 @@ void mysql_client_binlog_statement(THD* thd) my_bool nsok= thd->net.no_send_ok; thd->net.no_send_ok= TRUE; - my_size_t coded_len= thd->lex->comment.length + 1; - my_size_t decoded_len= base64_needed_decoded_length(coded_len); + size_t coded_len= thd->lex->comment.length + 1; + size_t decoded_len= base64_needed_decoded_length(coded_len); DBUG_ASSERT(coded_len > 0); /* diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 8d8838d4585..ae8f82204cb 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -365,7 +365,7 @@ TYPELIB query_cache_type_typelib= inline Query_cache_block * Query_cache_block_table::block() { - return (Query_cache_block *)(((byte*)this) - + return (Query_cache_block *)(((uchar*)this) - ALIGN_SIZE(sizeof(Query_cache_block_table)*n) - ALIGN_SIZE(sizeof(Query_cache_block))); } @@ -401,9 +401,9 @@ inline uint Query_cache_block::headers_len() ALIGN_SIZE(sizeof(Query_cache_block))); } -inline gptr Query_cache_block::data(void) +inline uchar* Query_cache_block::data(void) { - return (gptr)( ((byte*)this) + headers_len() ); + return (uchar*)( ((uchar*)this) + headers_len() ); } inline Query_cache_query * Query_cache_block::query() @@ -437,7 +437,7 @@ inline Query_cache_result * Query_cache_block::result() inline Query_cache_block_table * Query_cache_block::table(TABLE_COUNTER_TYPE n) { return ((Query_cache_block_table *) - (((byte*)this)+ALIGN_SIZE(sizeof(Query_cache_block)) + + (((uchar*)this)+ALIGN_SIZE(sizeof(Query_cache_block)) + n*sizeof(Query_cache_block_table))); } @@ -448,13 +448,13 @@ inline Query_cache_block_table * Query_cache_block::table(TABLE_COUNTER_TYPE n) extern "C" { -byte *query_cache_table_get_key(const byte *record, uint *length, +uchar *query_cache_table_get_key(const uchar *record, size_t *length, my_bool not_used __attribute__((unused))) { Query_cache_block* table_block = (Query_cache_block*) record; *length = (table_block->used - table_block->headers_len() - ALIGN_SIZE(sizeof(Query_cache_table))); - return (((byte *) table_block->data()) + + return (((uchar *) table_block->data()) + ALIGN_SIZE(sizeof(Query_cache_table))); } } @@ -522,7 +522,7 @@ void Query_cache_query::init_n_lock() my_rwlock_init(&lock, NULL); lock_writing(); DBUG_PRINT("qcache", ("inited & locked query for block 0x%lx", - (long) (((byte*) this) - + (long) (((uchar*) this) - ALIGN_SIZE(sizeof(Query_cache_block))))); DBUG_VOID_RETURN; } @@ -532,7 +532,7 @@ void Query_cache_query::unlock_n_destroy() { DBUG_ENTER("Query_cache_query::unlock_n_destroy"); DBUG_PRINT("qcache", ("destroyed & unlocked query for block 0x%lx", - (long) (((byte*) this) - + (long) (((uchar*) this) - ALIGN_SIZE(sizeof(Query_cache_block))))); /* The following call is not needed on system where one can destroy an @@ -546,13 +546,13 @@ void Query_cache_query::unlock_n_destroy() extern "C" { -byte *query_cache_query_get_key(const byte *record, uint *length, +uchar *query_cache_query_get_key(const uchar *record, size_t *length, my_bool not_used) { Query_cache_block *query_block = (Query_cache_block*) record; *length = (query_block->used - query_block->headers_len() - ALIGN_SIZE(sizeof(Query_cache_query))); - return (((byte *) query_block->data()) + + return (((uchar *) query_block->data()) + ALIGN_SIZE(sizeof(Query_cache_query))); } } @@ -639,7 +639,7 @@ void query_cache_insert(NET *net, const char *packet, ulong length) done by query_cache.append_result_data if success (if not we need query_cache.structure_guard_mutex locked to free query) */ - if (!query_cache.append_result_data(&result, length, (gptr) packet, + if (!query_cache.append_result_data(&result, length, (uchar*) packet, query_block)) { DBUG_PRINT("warning", ("Can't append data")); @@ -927,13 +927,13 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu", /* Check if another thread is processing the same query? */ Query_cache_block *competitor = (Query_cache_block *) - hash_search(&queries, (byte*) thd->query, tot_length); + hash_search(&queries, (uchar*) thd->query, tot_length); DBUG_PRINT("qcache", ("competitor 0x%lx", (ulong) competitor)); if (competitor == 0) { /* Query is not in cache and no one is working with it; Store it */ Query_cache_block *query_block; - query_block= write_block_data(tot_length, (gptr) thd->query, + query_block= write_block_data(tot_length, (uchar*) thd->query, ALIGN_SIZE(sizeof(Query_cache_query)), Query_cache_block::QUERY, local_tables, 1); if (query_block != 0) @@ -943,7 +943,7 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu", Query_cache_query *header = query_block->query(); header->init_n_lock(); - if (my_hash_insert(&queries, (byte*) query_block)) + if (my_hash_insert(&queries, (uchar*) query_block)) { refused++; DBUG_PRINT("qcache", ("insertion in query hash")); @@ -956,7 +956,7 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu", { refused++; DBUG_PRINT("warning", ("tables list including failed")); - hash_delete(&queries, (byte *) query_block); + hash_delete(&queries, (uchar *) query_block); header->unlock_n_destroy(); free_memory_block(query_block); STRUCT_UNLOCK(&structure_guard_mutex); @@ -965,7 +965,7 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu", double_linked_list_simple_include(query_block, &queries_blocks); inserts++; queries_in_cache++; - net->query_cache_query= (gptr) query_block; + net->query_cache_query= (uchar*) query_block; header->writer(net); header->tables_type(tables_type); @@ -1130,9 +1130,9 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu", flags.sql_mode, flags.max_sort_length, flags.group_concat_max_len)); - memcpy((void *)(sql + (tot_length - QUERY_CACHE_FLAGS_SIZE)), - &flags, QUERY_CACHE_FLAGS_SIZE); - query_block = (Query_cache_block *) hash_search(&queries, (byte*) sql, + memcpy((uchar *)(sql + (tot_length - QUERY_CACHE_FLAGS_SIZE)), + (uchar*) &flags, QUERY_CACHE_FLAGS_SIZE); + query_block = (Query_cache_block *) hash_search(&queries, (uchar*) sql, tot_length); /* Quick abort on unlocked data */ if (query_block == 0 || @@ -1243,7 +1243,7 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu", ("Handler require invalidation queries of %s.%s %lu-%lu", table_list.db, table_list.alias, (ulong) engine_data, (ulong) table->engine_data())); - invalidate_table((byte *) table->db(), table->key_length()); + invalidate_table((uchar *) table->db(), table->key_length()); } else thd->lex->safe_to_cache_query= 0; // Don't try to cache this @@ -1347,7 +1347,7 @@ void Query_cache::invalidate(CHANGED_TABLE_LIST *tables_used) DUMP(this); for (; tables_used; tables_used= tables_used->next) { - invalidate_table((byte*) tables_used->key, tables_used->key_length); + invalidate_table((uchar*) tables_used->key, tables_used->key_length); DBUG_PRINT("qcache", ("db: %s table: %s", tables_used->key, tables_used->key+ strlen(tables_used->key)+1)); @@ -1428,7 +1428,7 @@ void Query_cache::invalidate(THD *thd, const char *key, uint32 key_length, if (using_transactions) // used for innodb => has_transactions() is TRUE thd->add_changed_table(key, key_length); else - invalidate_table((byte*)key, key_length); + invalidate_table((uchar*)key, key_length); } STRUCT_UNLOCK(&structure_guard_mutex); @@ -1489,8 +1489,8 @@ void Query_cache::invalidate_by_MyISAM_filename(const char *filename) uint key_length= filename_2_table_key(key, filename, &db_length); Query_cache_block *table_block; if ((table_block = (Query_cache_block*) hash_search(&tables, - (byte*) key, - key_length))) + (uchar*) key, + key_length))) invalidate_table(table_block); } STRUCT_UNLOCK(&structure_guard_mutex); @@ -1576,7 +1576,7 @@ ulong Query_cache::init_cache() DBUG_ENTER("Query_cache::init_cache"); approx_additional_data_size = (sizeof(Query_cache) + - sizeof(gptr)*(def_query_hash_size+ + sizeof(uchar*)*(def_query_hash_size+ def_table_hash_size)); if (query_cache_size < approx_additional_data_size) goto err; @@ -1632,7 +1632,7 @@ ulong Query_cache::init_cache() goto err; query_cache_size -= additional_data_size; - if (!(cache= (byte *) + if (!(cache= (uchar *) my_malloc_lock(query_cache_size+additional_data_size, MYF(0)))) goto err; @@ -1800,7 +1800,7 @@ void Query_cache::free_cache() DBUG_PRINT("qcache", ("free memory %lu (should be %lu)", free_memory , query_cache_size)); #endif - my_free((gptr) cache, MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) cache, MYF(MY_ALLOW_ZERO_PTR)); make_disabled(); hash_free(&queries); hash_free(&tables); @@ -2004,7 +2004,7 @@ void Query_cache::free_query(Query_cache_block *query_block) (ulong) query_block, query_block->query()->length() )); - hash_delete(&queries,(byte *) query_block); + hash_delete(&queries,(uchar *) query_block); free_query_internal(query_block); DBUG_VOID_RETURN; @@ -2015,7 +2015,7 @@ void Query_cache::free_query(Query_cache_block *query_block) *****************************************************************************/ Query_cache_block * -Query_cache::write_block_data(ulong data_len, gptr data, +Query_cache::write_block_data(ulong data_len, uchar* data, ulong header_len, Query_cache_block::block_type type, TABLE_COUNTER_TYPE ntab, @@ -2038,8 +2038,7 @@ Query_cache::write_block_data(ulong data_len, gptr data, block->n_tables = ntab; block->used = len; - memcpy((void*) (((byte *) block)+ all_headers_len), - (void*) data, data_len); + memcpy((uchar *) block+ all_headers_len, data, data_len); } DBUG_RETURN(block); } @@ -2051,7 +2050,7 @@ Query_cache::write_block_data(ulong data_len, gptr data, my_bool Query_cache::append_result_data(Query_cache_block **current_block, - ulong data_len, gptr data, + ulong data_len, uchar* data, Query_cache_block *query_block) { DBUG_ENTER("Query_cache::append_result_data"); @@ -2107,7 +2106,7 @@ Query_cache::append_result_data(Query_cache_block **current_block, by the next call */ success = write_result_data(&new_block, data_len-last_block_free_space, - (gptr)(((byte*)data)+last_block_free_space), + (uchar*)(((uchar*)data)+last_block_free_space), query_block, Query_cache_block::RES_CONT); /* @@ -2129,8 +2128,7 @@ Query_cache::append_result_data(Query_cache_block **current_block, ulong to_copy = min(data_len,last_block_free_space); DBUG_PRINT("qcache", ("use free space %lub at block 0x%lx to copy %lub", last_block_free_space, (ulong)last_block, to_copy)); - memcpy((void*) (((byte*) last_block) + last_block->used), (void*) data, - to_copy); + memcpy((uchar*) last_block + last_block->used, data, to_copy); last_block->used+=to_copy; } DBUG_RETURN(success); @@ -2138,7 +2136,7 @@ Query_cache::append_result_data(Query_cache_block **current_block, my_bool Query_cache::write_result_data(Query_cache_block **result_block, - ulong data_len, gptr data, + ulong data_len, uchar* data, Query_cache_block *query_block, Query_cache_block::block_type type) { @@ -2164,7 +2162,7 @@ my_bool Query_cache::write_result_data(Query_cache_block **result_block, ALIGN_SIZE(sizeof(Query_cache_result))); #ifndef EMBEDDED_LIBRARY Query_cache_block *block= *result_block; - byte *rest= (byte*) data; + uchar *rest= data; // Now fill list of blocks that created by allocate_data_chain do { @@ -2172,7 +2170,7 @@ my_bool Query_cache::write_result_data(Query_cache_block **result_block, ulong length = block->used - headers_len; DBUG_PRINT("qcache", ("write %lu byte in block 0x%lx",length, (ulong)block)); - memcpy((void*)(((byte*) block)+headers_len), (void*) rest, length); + memcpy((uchar*) block+headers_len, rest, length); rest += length; block = block->next; type = Query_cache_block::RES_CONT; @@ -2307,18 +2305,18 @@ void Query_cache::invalidate_table(TABLE_LIST *table_list) // We don't store temporary tables => no key_length+=4 ... if ((table_block = (Query_cache_block*) - hash_search(&tables,(byte*) key,key_length))) + hash_search(&tables,(uchar*) key,key_length))) invalidate_table(table_block); } } void Query_cache::invalidate_table(TABLE *table) { - invalidate_table((byte*) table->s->table_cache_key.str, + invalidate_table((uchar*) table->s->table_cache_key.str, table->s->table_cache_key.length); } -void Query_cache::invalidate_table(byte * key, uint32 key_length) +void Query_cache::invalidate_table(uchar * key, uint32 key_length) { Query_cache_block *table_block; if ((table_block = ((Query_cache_block*) @@ -2396,11 +2394,11 @@ Query_cache::register_tables_from_list(TABLE_LIST *tables_used, else { DBUG_PRINT("qcache", - ("table: %s db: %s openinfo: 0x%lx keylen: %u key: 0x%lx", + ("table: %s db: %s openinfo: 0x%lx keylen: %lu key: 0x%lx", tables_used->table->s->table_name.str, tables_used->table->s->table_cache_key.str, (ulong) tables_used->table, - tables_used->table->s->table_cache_key.length, + (ulong) tables_used->table->s->table_cache_key.length, (ulong) tables_used->table->s->table_cache_key.str)); if (!insert_table(tables_used->table->s->table_cache_key.length, tables_used->table->s->table_cache_key.str, @@ -2491,7 +2489,7 @@ Query_cache::insert_table(uint key_len, char *key, (ulong)node, key_len)); Query_cache_block *table_block = ((Query_cache_block *) - hash_search(&tables, (byte*) key, + hash_search(&tables, (uchar*) key, key_len)); if (table_block && @@ -2515,7 +2513,7 @@ Query_cache::insert_table(uint key_len, char *key, { DBUG_PRINT("qcache", ("new table block from 0x%lx (%u)", (ulong) key, (int) key_len)); - table_block = write_block_data(key_len, (gptr) key, + table_block = write_block_data(key_len, (uchar*) key, ALIGN_SIZE(sizeof(Query_cache_table)), Query_cache_block::TABLE, 1, 1); @@ -2530,7 +2528,7 @@ Query_cache::insert_table(uint key_len, char *key, Query_cache_block_table *list_root = table_block->table(0); list_root->n = 0; list_root->next = list_root->prev = list_root; - if (my_hash_insert(&tables, (const byte *) table_block)) + if (my_hash_insert(&tables, (const uchar *) table_block)) { DBUG_PRINT("qcache", ("Can't insert table to hash")); // write_block_data return locked block @@ -2567,7 +2565,7 @@ void Query_cache::unlink_table(Query_cache_block_table *node) Query_cache_block *table_block = neighbour->block(); double_linked_list_exclude(table_block, &tables_blocks); - hash_delete(&tables,(byte *) table_block); + hash_delete(&tables,(uchar *) table_block); free_memory_block(table_block); } DBUG_VOID_RETURN; @@ -2722,7 +2720,7 @@ void Query_cache::free_memory_block(Query_cache_block *block) void Query_cache::split_block(Query_cache_block *block, ulong len) { DBUG_ENTER("Query_cache::split_block"); - Query_cache_block *new_block = (Query_cache_block*)(((byte*) block)+len); + Query_cache_block *new_block = (Query_cache_block*)(((uchar*) block)+len); new_block->init(block->length - len); total_blocks++; @@ -3149,7 +3147,7 @@ void Query_cache::pack_cache() DBUG_EXECUTE("check_querycache",query_cache.check_integrity(1);); - byte *border = 0; + uchar *border = 0; Query_cache_block *before = 0; ulong gap = 0; my_bool ok = 1; @@ -3185,7 +3183,7 @@ void Query_cache::pack_cache() } -my_bool Query_cache::move_by_type(byte **border, +my_bool Query_cache::move_by_type(uchar **border, Query_cache_block **before, ulong *gap, Query_cache_block *block) { @@ -3198,7 +3196,7 @@ my_bool Query_cache::move_by_type(byte **border, DBUG_PRINT("qcache", ("block 0x%lx FREE", (ulong) block)); if (*border == 0) { - *border = (byte *) block; + *border = (uchar *) block; *before = block->pprev; DBUG_PRINT("qcache", ("gap beginning here")); } @@ -3228,10 +3226,10 @@ my_bool Query_cache::move_by_type(byte **border, *new_block =(Query_cache_block *) *border; uint tablename_offset = block->table()->table() - block->table()->db(); char *data = (char*) block->data(); - byte *key; - uint key_length; - key=query_cache_table_get_key((byte*) block, &key_length, 0); - hash_first(&tables, (byte*) key, key_length, &record_idx); + uchar *key; + size_t key_length; + key=query_cache_table_get_key((uchar*) block, &key_length, 0); + hash_first(&tables, (uchar*) key, key_length, &record_idx); block->destroy(); new_block->init(len); @@ -3265,7 +3263,7 @@ my_bool Query_cache::move_by_type(byte **border, /* Fix pointer to table name */ new_block->table()->table(new_block->table()->db() + tablename_offset); /* Fix hash to point at moved block */ - hash_replace(&tables, &record_idx, (byte*) new_block); + hash_replace(&tables, &record_idx, (uchar*) new_block); DBUG_PRINT("qcache", ("moved %lu bytes to 0x%lx, new gap at 0x%lx", len, (ulong) new_block, (ulong) *border)); @@ -3288,10 +3286,10 @@ my_bool Query_cache::move_by_type(byte **border, char *data = (char*) block->data(); Query_cache_block *first_result_block = ((Query_cache_query *) block->data())->result(); - byte *key; - uint key_length; - key=query_cache_query_get_key((byte*) block, &key_length, 0); - hash_first(&queries, (byte*) key, key_length, &record_idx); + uchar *key; + size_t key_length; + key=query_cache_query_get_key((uchar*) block, &key_length, 0); + hash_first(&queries, (uchar*) key, key_length, &record_idx); // Move table of used tables memmove((char*) new_block->table(0), (char*) block->table(0), ALIGN_SIZE(n_tables*sizeof(Query_cache_block_table))); @@ -3307,7 +3305,7 @@ my_bool Query_cache::move_by_type(byte **border, queries_blocks = new_block; Query_cache_block_table *beg_of_table_table= block->table(0), *end_of_table_table= block->table(n_tables); - byte *beg_of_new_table_table= (byte*) new_block->table(0); + uchar *beg_of_new_table_table= (uchar*) new_block->table(0); for (TABLE_COUNTER_TYPE j=0; j < n_tables; j++) { @@ -3317,8 +3315,8 @@ my_bool Query_cache::move_by_type(byte **border, if ((beg_of_table_table <= block_table->next) && (block_table->next < end_of_table_table)) ((Query_cache_block_table *)(beg_of_new_table_table + - (((byte*)block_table->next) - - ((byte*)beg_of_table_table))))->prev= + (((uchar*)block_table->next) - + ((uchar*)beg_of_table_table))))->prev= block_table; else block_table->next->prev= block_table; @@ -3327,8 +3325,8 @@ my_bool Query_cache::move_by_type(byte **border, if ((beg_of_table_table <= block_table->prev) && (block_table->prev < end_of_table_table)) ((Query_cache_block_table *)(beg_of_new_table_table + - (((byte*)block_table->prev) - - ((byte*)beg_of_table_table))))->next= + (((uchar*)block_table->prev) - + ((uchar*)beg_of_table_table))))->next= block_table; else block_table->prev->next = block_table; @@ -3356,10 +3354,10 @@ my_bool Query_cache::move_by_type(byte **border, NET *net = new_block->query()->writer(); if (net != 0) { - net->query_cache_query= (gptr) new_block; + net->query_cache_query= (uchar*) new_block; } /* Fix hash to point at moved block */ - hash_replace(&queries, &record_idx, (byte*) new_block); + hash_replace(&queries, &record_idx, (uchar*) new_block); DBUG_PRINT("qcache", ("moved %lu bytes to 0x%lx, new gap at 0x%lx", len, (ulong) new_block, (ulong) *border)); break; @@ -3495,7 +3493,7 @@ my_bool Query_cache::join_results(ulong join_limit) Query_cache_result *new_result = new_result_block->result(); new_result->parent(block); - byte *write_to = (byte*) new_result->data(); + uchar *write_to = (uchar*) new_result->data(); Query_cache_block *result_block = first_result; do { @@ -3679,18 +3677,18 @@ void Query_cache::queries_dump() Query_cache_block *block = queries_blocks; do { - uint len; - char *str = (char*) query_cache_query_get_key((byte*) block, &len, 0); + size_t len; + char *str = (char*) query_cache_query_get_key((uchar*) block, &len, 0); len-= QUERY_CACHE_FLAGS_SIZE; // Point at flags Query_cache_query_flags flags; memcpy(&flags, str+len, QUERY_CACHE_FLAGS_SIZE); str[len]= 0; // make zero ending DB name - DBUG_PRINT("qcache", ("F: %u C: %u L: %lu T: '%s' (%u) '%s' '%s'", + DBUG_PRINT("qcache", ("F: %u C: %u L: %lu T: '%s' (%lu) '%s' '%s'", flags.client_long_flag, flags.character_set_client_num, (ulong)flags.limit, flags.time_zone->get_name()->ptr(), - len, str, strend(str)+1)); + (ulong) len, str, strend(str)+1)); DBUG_PRINT("qcache", ("-b- 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx", (ulong) block, (ulong) block->next, (ulong) block->prev, (ulong)block->pnext, (ulong)block->pprev)); @@ -3804,25 +3802,25 @@ my_bool Query_cache::check_integrity(bool locked) // Check memory allocation if (block->pnext == first_block) // Is it last block? { - if (((byte*)block) + block->length != - ((byte*)first_block) + query_cache_size) + if (((uchar*)block) + block->length != + ((uchar*)first_block) + query_cache_size) { DBUG_PRINT("error", ("block 0x%lx, type %u, ended at 0x%lx, but cache ended at 0x%lx", (ulong) block, (uint) block->type, - (ulong) (((byte*)block) + block->length), - (ulong) (((byte*)first_block) + query_cache_size))); + (ulong) (((uchar*)block) + block->length), + (ulong) (((uchar*)first_block) + query_cache_size))); result = 1; } } else - if (((byte*)block) + block->length != ((byte*)block->pnext)) + if (((uchar*)block) + block->length != ((uchar*)block->pnext)) { DBUG_PRINT("error", ("block 0x%lx, type %u, ended at 0x%lx, but next block begining at 0x%lx", (ulong) block, (uint) block->type, - (ulong) (((byte*)block) + block->length), - (ulong) ((byte*)block->pnext))); + (ulong) (((uchar*)block) + block->length), + (ulong) ((uchar*)block->pnext))); } if (block->type == Query_cache_block::FREE) free+= block->length; @@ -3834,8 +3832,8 @@ my_bool Query_cache::check_integrity(bool locked) Query_cache_memory_bin *bin = *((Query_cache_memory_bin **) block->data()); //is it correct pointer? - if (((byte*)bin) < ((byte*)bins) || - ((byte*)bin) >= ((byte*)first_block)) + if (((uchar*)bin) < ((uchar*)bins) || + ((uchar*)bin) >= ((uchar*)first_block)) { DBUG_PRINT("error", ("free block 0x%lx have bin pointer 0x%lx beyaond of bins array bounds [0x%lx,0x%lx]", @@ -3847,7 +3845,7 @@ my_bool Query_cache::check_integrity(bool locked) } else { - int idx = (((byte*)bin) - ((byte*)bins)) / + int idx = (((uchar*)bin) - ((uchar*)bins)) / sizeof(Query_cache_memory_bin); if (in_list(bins[idx].free_blocks, block, "free memory")) result = 1; @@ -3869,7 +3867,7 @@ my_bool Query_cache::check_integrity(bool locked) Query_cache_block_table *block_table = block->table(j); Query_cache_block_table *block_table_root = (Query_cache_block_table *) - (((byte*)block_table->parent) - + (((uchar*)block_table->parent) - ALIGN_SIZE(sizeof(Query_cache_block_table))); if (in_table_list(block_table, block_table_root, "table list")) @@ -3885,15 +3883,15 @@ my_bool Query_cache::check_integrity(bool locked) case Query_cache_block::RESULT: { Query_cache_block * query_block = block->result()->parent(); - if (((byte*)query_block) < ((byte*)first_block) || - ((byte*)query_block) >= (((byte*)first_block) + query_cache_size)) + if (((uchar*)query_block) < ((uchar*)first_block) || + ((uchar*)query_block) >= (((uchar*)first_block) + query_cache_size)) { DBUG_PRINT("error", ("result block 0x%lx have query block pointer 0x%lx beyaond of block pool bounds [0x%lx,0x%lx]", (ulong) block, (ulong) query_block, (ulong) first_block, - (ulong) (((byte*)first_block) + query_cache_size))); + (ulong) (((uchar*)first_block) + query_cache_size))); result = 1; } else @@ -3940,10 +3938,10 @@ my_bool Query_cache::check_integrity(bool locked) { DBUG_PRINT("qcache", ("block 0x%lx, type %u...", (ulong) block, (uint) block->type)); - uint length; - byte *key = query_cache_query_get_key((byte*) block, &length, 0); - gptr val = hash_search(&queries, key, length); - if (((gptr)block) != val) + size_t length; + uchar *key = query_cache_query_get_key((uchar*) block, &length, 0); + uchar* val = hash_search(&queries, key, length); + if (((uchar*)block) != val) { DBUG_PRINT("error", ("block 0x%lx found in queries hash like 0x%lx", (ulong) block, (ulong) val)); @@ -3975,10 +3973,10 @@ my_bool Query_cache::check_integrity(bool locked) { DBUG_PRINT("qcache", ("block 0x%lx, type %u...", (ulong) block, (uint) block->type)); - uint length; - byte *key = query_cache_table_get_key((byte*) block, &length, 0); - gptr val = hash_search(&tables, key, length); - if (((gptr)block) != val) + size_t length; + uchar *key = query_cache_table_get_key((uchar*) block, &length, 0); + uchar* val = hash_search(&tables, key, length); + if (((uchar*)block) != val) { DBUG_PRINT("error", ("block 0x%lx found in tables hash like 0x%lx", (ulong) block, (ulong) val)); diff --git a/sql/sql_cache.h b/sql/sql_cache.h index bc00f7ea629..3c5d784ce94 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -98,7 +98,7 @@ struct Query_cache_block void init(ulong length); void destroy(); inline uint headers_len(); - inline gptr data(void); + inline uchar* data(void); inline Query_cache_query *query(); inline Query_cache_table *table(); inline Query_cache_result *result(); @@ -128,17 +128,15 @@ struct Query_cache_query inline ulong length() { return len; } inline ulong add(ulong packet_len) { return(len+= packet_len); } inline void length(ulong length_arg) { len= length_arg; } - inline gptr query() + inline uchar* query() { - return (gptr)(((byte*)this)+ - ALIGN_SIZE(sizeof(Query_cache_query))); + return (((uchar*)this) + ALIGN_SIZE(sizeof(Query_cache_query))); } void lock_writing(); void lock_reading(); my_bool try_lock_writing(); void unlock_writing(); void unlock_reading(); - static byte *cache_key(const byte *record, uint *length, my_bool not_used); }; @@ -164,9 +162,9 @@ struct Query_cache_table inline void callback(qc_engine_callback fn){ callback_func= fn; } inline ulonglong engine_data() { return engine_data_buff; } inline void engine_data(ulonglong data_arg){ engine_data_buff= data_arg; } - inline gptr data() + inline uchar* data() { - return (gptr)(((byte*)this)+ + return (uchar*)(((uchar*)this)+ ALIGN_SIZE(sizeof(Query_cache_table))); } }; @@ -176,9 +174,9 @@ struct Query_cache_result Query_cache_result() {} /* Remove gcc warning */ Query_cache_block *query; - inline gptr data() + inline uchar* data() { - return (gptr)(((byte*) this)+ + return (uchar*)(((uchar*) this)+ ALIGN_SIZE(sizeof(Query_cache_result))); } /* data_continue (if not whole packet contained by this block) */ @@ -189,10 +187,10 @@ struct Query_cache_result extern "C" { - byte *query_cache_query_get_key(const byte *record, uint *length, - my_bool not_used); - byte *query_cache_table_get_key(const byte *record, uint *length, - my_bool not_used); + uchar *query_cache_query_get_key(const uchar *record, size_t *length, + my_bool not_used); + uchar *query_cache_table_get_key(const uchar *record, size_t *length, + my_bool not_used); } extern "C" void query_cache_invalidate_by_MyISAM_filename(const char* filename); @@ -261,7 +259,7 @@ protected: till the end of a flush operation. */ pthread_mutex_t structure_guard_mutex; - byte *cache; // cache memory + uchar *cache; // cache memory Query_cache_block *first_block; // physical location block list Query_cache_block *queries_blocks; // query list (LIFO) Query_cache_block *tables_blocks; @@ -299,7 +297,7 @@ protected: my_bool first_block); void invalidate_table(TABLE_LIST *table); void invalidate_table(TABLE *table); - void invalidate_table(byte *key, uint32 key_length); + void invalidate_table(uchar *key, uint32 key_length); void invalidate_table(Query_cache_block *table_block); TABLE_COUNTER_TYPE register_tables_from_list(TABLE_LIST *tables_used, @@ -324,7 +322,7 @@ protected: ulong add_size); void exclude_from_free_memory_list(Query_cache_block *free_block); void insert_into_free_memory_list(Query_cache_block *new_block); - my_bool move_by_type(byte **border, Query_cache_block **before, + my_bool move_by_type(uchar **border, Query_cache_block **before, ulong *gap, Query_cache_block *i); uint find_bin(ulong size); void move_to_query_list_end(Query_cache_block *block); @@ -346,16 +344,16 @@ protected: ulong init_cache(); void make_disabled(); void free_cache(); - Query_cache_block *write_block_data(ulong data_len, gptr data, + Query_cache_block *write_block_data(ulong data_len, uchar* data, ulong header_len, Query_cache_block::block_type type, TABLE_COUNTER_TYPE ntab = 0, my_bool under_guard=0); my_bool append_result_data(Query_cache_block **result, - ulong data_len, gptr data, + ulong data_len, uchar* data, Query_cache_block *parent); my_bool write_result_data(Query_cache_block **result, - ulong data_len, gptr data, + ulong data_len, uchar* data, Query_cache_block *parent, Query_cache_block::block_type type=Query_cache_block::RESULT); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index fd44817811e..48a165dc34c 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -71,11 +71,11 @@ template class List_iterator<Alter_column>; ** User variables ****************************************************************************/ -extern "C" byte *get_var_key(user_var_entry *entry, uint *length, - my_bool not_used __attribute__((unused))) +extern "C" uchar *get_var_key(user_var_entry *entry, size_t *length, + my_bool not_used __attribute__((unused))) { - *length=(uint) entry->name.length; - return (byte*) entry->name.str; + *length= entry->name.length; + return (uchar*) entry->name.str; } extern "C" void free_user_var(user_var_entry *entry) @@ -545,7 +545,7 @@ THD::~THD() void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var) { - ulong *end= (ulong*) ((byte*) to_var + + ulong *end= (ulong*) ((uchar*) to_var + offsetof(STATUS_VAR, last_system_status_var) + sizeof(ulong)); ulong *to= (ulong*) to_var, *from= (ulong*) from_var; @@ -570,7 +570,7 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var) void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var, STATUS_VAR *dec_var) { - ulong *end= (ulong*) ((byte*) to_var + offsetof(STATUS_VAR, + ulong *end= (ulong*) ((uchar*) to_var + offsetof(STATUS_VAR, last_system_status_var) + sizeof(ulong)); ulong *to= (ulong*) to_var, *from= (ulong*) from_var, *dec= (ulong*) dec_var; @@ -741,9 +741,9 @@ bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs, CHARSET_INFO *from_cs) { DBUG_ENTER("convert_string"); - size_s new_length= to_cs->mbmaxlen * from_length; + size_t new_length= to_cs->mbmaxlen * from_length; uint dummy_errors; - if (!(to->str= alloc(new_length+1))) + if (!(to->str= (char*) alloc(new_length+1))) { to->length= 0; // Safety fix DBUG_RETURN(1); // EOM @@ -887,8 +887,7 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, long key_length) return 0; } - new_table->key = (char *) (((byte*)new_table)+ - ALIGN_SIZE(sizeof(CHANGED_TABLE_LIST))); + new_table->key= ((char*)new_table)+ ALIGN_SIZE(sizeof(CHANGED_TABLE_LIST)); new_table->next = 0; new_table->key_length = key_length; ::memcpy(new_table->key, key, key_length); @@ -1342,7 +1341,7 @@ bool select_export::send_data(List<Item> &items) uint used_length=0,items_left=items.elements; List_iterator_fast<Item> li(items); - if (my_b_write(&cache,(byte*) exchange->line_start->ptr(), + if (my_b_write(&cache,(uchar*) exchange->line_start->ptr(), exchange->line_start->length())) goto err; while ((item=li++)) @@ -1351,7 +1350,7 @@ bool select_export::send_data(List<Item> &items) res=item->str_result(&tmp); if (res && (!exchange->opt_enclosed || result_type == STRING_RESULT)) { - if (my_b_write(&cache,(byte*) exchange->enclosed->ptr(), + if (my_b_write(&cache,(uchar*) exchange->enclosed->ptr(), exchange->enclosed->length())) goto err; } @@ -1363,10 +1362,10 @@ bool select_export::send_data(List<Item> &items) { null_buff[0]=escape_char; null_buff[1]='N'; - if (my_b_write(&cache,(byte*) null_buff,2)) + if (my_b_write(&cache,(uchar*) null_buff,2)) goto err; } - else if (my_b_write(&cache,(byte*) "NULL",4)) + else if (my_b_write(&cache,(uchar*) "NULL",4)) goto err; } else @@ -1406,16 +1405,16 @@ bool select_export::send_data(List<Item> &items) char tmp_buff[2]; tmp_buff[0]= escape_char; tmp_buff[1]= *pos ? *pos : '0'; - if (my_b_write(&cache,(byte*) start,(uint) (pos-start)) || - my_b_write(&cache,(byte*) tmp_buff,2)) + if (my_b_write(&cache,(uchar*) start,(uint) (pos-start)) || + my_b_write(&cache,(uchar*) tmp_buff,2)) goto err; start=pos+1; } } - if (my_b_write(&cache,(byte*) start,(uint) (pos-start))) + if (my_b_write(&cache,(uchar*) start,(uint) (pos-start))) goto err; } - else if (my_b_write(&cache,(byte*) res->ptr(),used_length)) + else if (my_b_write(&cache,(uchar*) res->ptr(),used_length)) goto err; } if (fixed_row_size) @@ -1431,27 +1430,27 @@ bool select_export::send_data(List<Item> &items) uint length=item->max_length-used_length; for (; length > sizeof(space) ; length-=sizeof(space)) { - if (my_b_write(&cache,(byte*) space,sizeof(space))) + if (my_b_write(&cache,(uchar*) space,sizeof(space))) goto err; } - if (my_b_write(&cache,(byte*) space,length)) + if (my_b_write(&cache,(uchar*) space,length)) goto err; } } if (res && (!exchange->opt_enclosed || result_type == STRING_RESULT)) { - if (my_b_write(&cache, (byte*) exchange->enclosed->ptr(), + if (my_b_write(&cache, (uchar*) exchange->enclosed->ptr(), exchange->enclosed->length())) goto err; } if (--items_left) { - if (my_b_write(&cache, (byte*) exchange->field_term->ptr(), + if (my_b_write(&cache, (uchar*) exchange->field_term->ptr(), field_term_length)) goto err; } } - if (my_b_write(&cache,(byte*) exchange->line_term->ptr(), + if (my_b_write(&cache,(uchar*) exchange->line_term->ptr(), exchange->line_term->length())) goto err; DBUG_RETURN(0); @@ -1498,10 +1497,10 @@ bool select_dump::send_data(List<Item> &items) res=item->str_result(&tmp); if (!res) // If NULL { - if (my_b_write(&cache,(byte*) "",1)) + if (my_b_write(&cache,(uchar*) "",1)) goto err; } - else if (my_b_write(&cache,(byte*) res->ptr(),res->length())) + else if (my_b_write(&cache,(uchar*) res->ptr(),res->length())) { my_error(ER_ERROR_ON_WRITE, MYF(0), path, my_errno); goto err; @@ -1836,13 +1835,13 @@ Statement::~Statement() C_MODE_START -static byte * -get_statement_id_as_hash_key(const byte *record, uint *key_length, +static uchar * +get_statement_id_as_hash_key(const uchar *record, size_t *key_length, my_bool not_used __attribute__((unused))) { const Statement *statement= (const Statement *) record; *key_length= sizeof(statement->id); - return (byte *) &((const Statement *) statement)->id; + return (uchar *) &((const Statement *) statement)->id; } static void delete_statement_as_hash_key(void *key) @@ -1850,11 +1849,11 @@ static void delete_statement_as_hash_key(void *key) delete (Statement *) key; } -static byte *get_stmt_name_hash_key(Statement *entry, uint *length, +static uchar *get_stmt_name_hash_key(Statement *entry, size_t *length, my_bool not_used __attribute__((unused))) { - *length=(uint) entry->name.length; - return (byte*) entry->name.str; + *length= entry->name.length; + return (uchar*) entry->name.str; } C_MODE_END @@ -1899,7 +1898,7 @@ Statement_map::Statement_map() : int Statement_map::insert(THD *thd, Statement *statement) { - if (my_hash_insert(&st_hash, (byte*) statement)) + if (my_hash_insert(&st_hash, (uchar*) statement)) { /* Delete is needed only in case of an insert failure. In all other @@ -1909,7 +1908,7 @@ int Statement_map::insert(THD *thd, Statement *statement) my_error(ER_OUT_OF_RESOURCES, MYF(0)); goto err_st_hash; } - if (statement->name.str && my_hash_insert(&names_hash, (byte*) statement)) + if (statement->name.str && my_hash_insert(&names_hash, (uchar*) statement)) { my_error(ER_OUT_OF_RESOURCES, MYF(0)); goto err_names_hash; @@ -1937,9 +1936,9 @@ int Statement_map::insert(THD *thd, Statement *statement) err_max: if (statement->name.str) - hash_delete(&names_hash, (byte*) statement); + hash_delete(&names_hash, (uchar*) statement); err_names_hash: - hash_delete(&st_hash, (byte*) statement); + hash_delete(&st_hash, (uchar*) statement); err_st_hash: return 1; } @@ -1960,9 +1959,9 @@ void Statement_map::erase(Statement *statement) if (statement == last_found_statement) last_found_statement= 0; if (statement->name.str) - hash_delete(&names_hash, (byte *) statement); + hash_delete(&names_hash, (uchar *) statement); - hash_delete(&st_hash, (byte *) statement); + hash_delete(&st_hash, (uchar *) statement); pthread_mutex_lock(&LOCK_prepared_stmt_count); DBUG_ASSERT(prepared_stmt_count > 0); prepared_stmt_count--; @@ -2377,7 +2376,7 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup) pthread_mutex_t LOCK_xid_cache; HASH xid_cache; -static byte *xid_get_hash_key(const byte *ptr,uint *length, +static uchar *xid_get_hash_key(const uchar *ptr, size_t *length, my_bool not_used __attribute__((unused))) { *length=((XID_STATE*)ptr)->xid.key_length(); @@ -2387,7 +2386,7 @@ static byte *xid_get_hash_key(const byte *ptr,uint *length, static void xid_free_hash (void *ptr) { if (!((XID_STATE*)ptr)->in_thd) - my_free((gptr)ptr, MYF(0)); + my_free((uchar*)ptr, MYF(0)); } bool xid_cache_init() @@ -2429,7 +2428,7 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state) xs->xa_state=xa_state; xs->xid.set(xid); xs->in_thd=0; - res=my_hash_insert(&xid_cache, (byte*)xs); + res=my_hash_insert(&xid_cache, (uchar*)xs); } pthread_mutex_unlock(&LOCK_xid_cache); return res; @@ -2441,7 +2440,7 @@ bool xid_cache_insert(XID_STATE *xid_state) pthread_mutex_lock(&LOCK_xid_cache); DBUG_ASSERT(hash_search(&xid_cache, xid_state->xid.key(), xid_state->xid.key_length())==0); - my_bool res=my_hash_insert(&xid_cache, (byte*)xid_state); + my_bool res=my_hash_insert(&xid_cache, (uchar*)xid_state); pthread_mutex_unlock(&LOCK_xid_cache); return res; } @@ -2450,7 +2449,7 @@ bool xid_cache_insert(XID_STATE *xid_state) void xid_cache_delete(XID_STATE *xid_state) { pthread_mutex_lock(&LOCK_xid_cache); - hash_delete(&xid_cache, (byte *)xid_state); + hash_delete(&xid_cache, (uchar *)xid_state); pthread_mutex_unlock(&LOCK_xid_cache); } @@ -2486,8 +2485,8 @@ void xid_cache_delete(XID_STATE *xid_state) template <class RowsEventT> Rows_log_event* THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id, MY_BITMAP const* cols, - my_size_t colcnt, - my_size_t needed, + size_t colcnt, + size_t needed, bool is_transactional, RowsEventT *hint __attribute__((unused))) { @@ -2557,17 +2556,17 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id, */ template Rows_log_event* THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*, - my_size_t, my_size_t, bool, + size_t, size_t, bool, Write_rows_log_event*); template Rows_log_event* THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*, - my_size_t colcnt, my_size_t, bool, + size_t colcnt, size_t, bool, Delete_rows_log_event *); template Rows_log_event* THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*, - my_size_t colcnt, my_size_t, bool, + size_t colcnt, size_t, bool, Update_rows_log_event *); #endif @@ -2636,27 +2635,6 @@ field_type_name(enum_field_types type) #endif -my_size_t THD::max_row_length_blob(TABLE *table, const byte *data) const -{ - my_size_t length= 0; - TABLE_SHARE *table_s= table->s; - uint* const beg= table_s->blob_field; - uint* const end= beg + table_s->blob_fields; - - for (uint *ptr= beg ; ptr != end ; ++ptr) - { - Field_blob* const blob= (Field_blob*) table->field[*ptr]; - length+= blob->get_length((const char*) (data + - blob->offset(table->record[0]))) + - HA_KEY_BLOB_LENGTH; - } - - return length; -} - - - - namespace { /** Class to handle temporary allocation of memory for row data. @@ -2685,7 +2663,7 @@ namespace { @param length Length of data that is needed, if the record contain blobs. */ - Row_data_memory(TABLE *table, my_size_t const len1) + Row_data_memory(TABLE *table, size_t const len1) : m_memory(0) { #ifndef DBUG_OFF @@ -2696,7 +2674,7 @@ namespace { m_ptr[1]= 0; } - Row_data_memory(TABLE *table, my_size_t const len1, my_size_t const len2) + Row_data_memory(TABLE *table, size_t const len1, size_t const len2) : m_memory(0) { #ifndef DBUG_OFF @@ -2710,7 +2688,7 @@ namespace { ~Row_data_memory() { if (m_memory != 0 && m_release_memory_on_destruction) - my_free((gptr) m_memory, MYF(MY_WME)); + my_free((uchar*) m_memory, MYF(MY_WME)); } /** @@ -2726,7 +2704,7 @@ namespace { return m_memory != 0; } - byte *slot(uint s) + uchar *slot(uint s) { DBUG_ASSERT(s < sizeof(m_ptr)/sizeof(*m_ptr)); DBUG_ASSERT(m_ptr[s] != 0); @@ -2735,7 +2713,7 @@ namespace { } private: - void allocate_memory(TABLE *const table, my_size_t const total_length) + void allocate_memory(TABLE *const table, size_t const total_length) { if (table->s->blob_fields == 0) { @@ -2749,7 +2727,7 @@ namespace { to add two bytes for each field, which can potentially be added to hold the length of a packed field. */ - my_size_t const maxlen= table->s->reclength + 2 * table->s->fields; + size_t const maxlen= table->s->reclength + 2 * table->s->fields; /* Allocate memory for two records if memory hasn't been @@ -2758,13 +2736,13 @@ namespace { */ if (table->write_row_record == 0) table->write_row_record= - (byte *) alloc_root(&table->mem_root, 2 * maxlen); + (uchar *) alloc_root(&table->mem_root, 2 * maxlen); m_memory= table->write_row_record; m_release_memory_on_destruction= FALSE; } else { - m_memory= (byte *) my_malloc(total_length, MYF(MY_WME)); + m_memory= (uchar *) my_malloc(total_length, MYF(MY_WME)); m_release_memory_on_destruction= TRUE; } } @@ -2773,15 +2751,15 @@ namespace { mutable bool m_alloc_checked; #endif bool m_release_memory_on_destruction; - byte *m_memory; - byte *m_ptr[2]; + uchar *m_memory; + uchar *m_ptr[2]; }; } int THD::binlog_write_row(TABLE* table, bool is_trans, - MY_BITMAP const* cols, my_size_t colcnt, - byte const *record) + MY_BITMAP const* cols, size_t colcnt, + uchar const *record) { DBUG_ASSERT(current_stmt_binlog_row_based && mysql_bin_log.is_open()); @@ -2793,9 +2771,9 @@ int THD::binlog_write_row(TABLE* table, bool is_trans, if (!memory.has_memory()) return HA_ERR_OUT_OF_MEM; - byte *row_data= memory.slot(0); + uchar *row_data= memory.slot(0); - my_size_t const len= pack_row(table, cols, row_data, record); + size_t const len= pack_row(table, cols, row_data, record); Rows_log_event* const ev= binlog_prepare_pending_rows_event(table, server_id, cols, colcnt, @@ -2809,25 +2787,25 @@ int THD::binlog_write_row(TABLE* table, bool is_trans, } int THD::binlog_update_row(TABLE* table, bool is_trans, - MY_BITMAP const* cols, my_size_t colcnt, - const byte *before_record, - const byte *after_record) + MY_BITMAP const* cols, size_t colcnt, + const uchar *before_record, + const uchar *after_record) { DBUG_ASSERT(current_stmt_binlog_row_based && mysql_bin_log.is_open()); - my_size_t const before_maxlen = max_row_length(table, before_record); - my_size_t const after_maxlen = max_row_length(table, after_record); + size_t const before_maxlen = max_row_length(table, before_record); + size_t const after_maxlen = max_row_length(table, after_record); Row_data_memory row_data(table, before_maxlen, after_maxlen); if (!row_data.has_memory()) return HA_ERR_OUT_OF_MEM; - byte *before_row= row_data.slot(0); - byte *after_row= row_data.slot(1); + uchar *before_row= row_data.slot(0); + uchar *after_row= row_data.slot(1); - my_size_t const before_size= pack_row(table, cols, before_row, + size_t const before_size= pack_row(table, cols, before_row, before_record); - my_size_t const after_size= pack_row(table, cols, after_row, + size_t const after_size= pack_row(table, cols, after_row, after_record); /* @@ -2835,10 +2813,10 @@ int THD::binlog_update_row(TABLE* table, bool is_trans, trigger false warnings. */ #ifndef HAVE_purify - DBUG_DUMP("before_record", (const char *)before_record, table->s->reclength); - DBUG_DUMP("after_record", (const char *)after_record, table->s->reclength); - DBUG_DUMP("before_row", (const char *)before_row, before_size); - DBUG_DUMP("after_row", (const char *)after_row, after_size); + DBUG_DUMP("before_record", before_record, table->s->reclength); + DBUG_DUMP("after_record", after_record, table->s->reclength); + DBUG_DUMP("before_row", before_row, before_size); + DBUG_DUMP("after_row", after_row, after_size); #endif Rows_log_event* const ev= @@ -2855,8 +2833,8 @@ int THD::binlog_update_row(TABLE* table, bool is_trans, } int THD::binlog_delete_row(TABLE* table, bool is_trans, - MY_BITMAP const* cols, my_size_t colcnt, - byte const *record) + MY_BITMAP const* cols, size_t colcnt, + uchar const *record) { DBUG_ASSERT(current_stmt_binlog_row_based && mysql_bin_log.is_open()); @@ -2868,9 +2846,9 @@ int THD::binlog_delete_row(TABLE* table, bool is_trans, if (unlikely(!memory.has_memory())) return HA_ERR_OUT_OF_MEM; - byte *row_data= memory.slot(0); + uchar *row_data= memory.slot(0); - my_size_t const len= pack_row(table, cols, row_data, record); + size_t const len= pack_row(table, cols, row_data, record); Rows_log_event* const ev= binlog_prepare_pending_rows_event(table, server_id, cols, colcnt, diff --git a/sql/sql_class.h b/sql/sql_class.h index 48a88087fd3..95d07c57e46 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -422,30 +422,31 @@ public: inline bool is_conventional() const { return state == CONVENTIONAL_EXECUTION; } - inline gptr alloc(unsigned int size) { return alloc_root(mem_root,size); } - inline gptr calloc(unsigned int size) + inline void* alloc(size_t size) { return alloc_root(mem_root,size); } + inline void* calloc(size_t size) { - gptr ptr; + void *ptr; if ((ptr=alloc_root(mem_root,size))) - bzero((char*) ptr,size); + bzero(ptr, size); return ptr; } inline char *strdup(const char *str) { return strdup_root(mem_root,str); } - inline char *strmake(const char *str, uint size) + inline char *strmake(const char *str, size_t size) { return strmake_root(mem_root,str,size); } - inline bool LEX_STRING_make(LEX_STRING *lex_str, const char *str, uint size) + inline bool LEX_STRING_make(LEX_STRING *lex_str, const char *str, + size_t size) { return ((lex_str->str= strmake_root(mem_root, str, (lex_str->length= size)))) == 0; } - inline char *memdup(const char *str, uint size) + inline void *memdup(const void *str, size_t size) { return memdup_root(mem_root,str,size); } - inline char *memdup_w_gap(const char *str, uint size, uint gap) + inline void *memdup_w_gap(const void *str, size_t size, uint gap) { - gptr ptr; - if ((ptr=alloc_root(mem_root,size+gap))) + void *ptr; + if ((ptr= alloc_root(mem_root,size+gap))) memcpy(ptr,str,size); return ptr; } @@ -567,7 +568,7 @@ public: Statement *find_by_name(LEX_STRING *name) { Statement *stmt; - stmt= (Statement*)hash_search(&names_hash, (byte*)name->str, + stmt= (Statement*)hash_search(&names_hash, (uchar*)name->str, name->length); return stmt; } @@ -577,7 +578,7 @@ public: if (last_found_statement == 0 || id != last_found_statement->id) { Statement *stmt; - stmt= (Statement *) hash_search(&st_hash, (byte *) &id, sizeof(id)); + stmt= (Statement *) hash_search(&st_hash, (uchar *) &id, sizeof(id)); if (stmt && stmt->name.str) return NULL; last_found_statement= stmt; @@ -1020,14 +1021,14 @@ public: void binlog_set_stmt_begin(); int binlog_write_table_map(TABLE *table, bool is_transactional); int binlog_write_row(TABLE* table, bool is_transactional, - MY_BITMAP const* cols, my_size_t colcnt, - const byte *buf); + MY_BITMAP const* cols, size_t colcnt, + const uchar *buf); int binlog_delete_row(TABLE* table, bool is_transactional, - MY_BITMAP const* cols, my_size_t colcnt, - const byte *buf); + MY_BITMAP const* cols, size_t colcnt, + const uchar *buf); int binlog_update_row(TABLE* table, bool is_transactional, - MY_BITMAP const* cols, my_size_t colcnt, - const byte *old_data, const byte *new_data); + MY_BITMAP const* cols, size_t colcnt, + const uchar *old_data, const uchar *new_data); void set_server_id(uint32 sid) { server_id = sid; } @@ -1037,24 +1038,12 @@ public: template <class RowsEventT> Rows_log_event* binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id, MY_BITMAP const* cols, - my_size_t colcnt, - my_size_t needed, + size_t colcnt, + size_t needed, bool is_transactional, RowsEventT* hint); Rows_log_event* binlog_get_pending_rows_event() const; void binlog_set_pending_rows_event(Rows_log_event* ev); - - my_size_t max_row_length_blob(TABLE* table, const byte *data) const; - my_size_t max_row_length(TABLE* table, const byte *data) const - { - TABLE_SHARE *table_s= table->s; - my_size_t length= table_s->reclength + 2 * table_s->fields; - if (table_s->blob_fields == 0) - return length; - - return (length+max_row_length_blob(table,data)); - } - int binlog_flush_pending_rows_event(bool stmt_end); void binlog_delete_pending_rows_event(); @@ -1516,7 +1505,7 @@ public: { return !stmt_arena->is_stmt_prepare(); } - inline gptr trans_alloc(unsigned int size) + inline void* trans_alloc(unsigned int size) { return alloc_root(&transaction.mem_root,size); } @@ -1667,7 +1656,7 @@ public: This way the user will notice the error as there will be no current database selected (in addition to the error message set by malloc). */ - bool set_db(const char *new_db, uint new_db_len) + bool set_db(const char *new_db, size_t new_db_len) { /* Do not reallocate memory if current chunk is big enough. */ if (db && new_db && db_length >= new_db_len) @@ -1680,7 +1669,7 @@ public: db_length= db ? new_db_len : 0; return new_db && !db; } - void reset_db(char *new_db, uint new_db_len) + void reset_db(char *new_db, size_t new_db_len) { db= new_db; db_length= new_db_len; @@ -1690,7 +1679,7 @@ public: allocate memory for a deep copy: current database may be freed after a statement is parsed but before it's executed. */ - bool copy_db_to(char **p_db, uint *p_db_length) + bool copy_db_to(char **p_db, size_t *p_db_length) { if (db == NULL) { @@ -1969,7 +1958,7 @@ public: List<Item> save_copy_funcs; Copy_field *copy_field, *copy_field_end; Copy_field *save_copy_field, *save_copy_field_end; - byte *group_buff; + uchar *group_buff; Item **items_to_copy; /* Fields in tmp table */ MI_COLUMNDEF *recinfo,*start_recinfo; KEY *keyinfo; @@ -2175,7 +2164,7 @@ class Unique :public Sql_alloc ulonglong max_in_memory_size; IO_CACHE file; TREE tree; - byte *record_pointers; + uchar *record_pointers; bool flush(); uint size; @@ -2208,8 +2197,8 @@ public: void reset(); bool walk(tree_walk_action action, void *walk_action_arg); - friend int unique_write_to_file(gptr key, element_count count, Unique *unique); - friend int unique_write_to_ptrs(gptr key, element_count count, Unique *unique); + friend int unique_write_to_file(uchar* key, element_count count, Unique *unique); + friend int unique_write_to_ptrs(uchar* key, element_count count, Unique *unique); }; diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index d03a17079d8..f01d9576c56 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -80,7 +80,7 @@ static int get_or_create_user_conn(THD *thd, const char *user, temp_len= (strmov(strmov(temp_user, user)+1, host) - temp_user)+1; (void) pthread_mutex_lock(&LOCK_user_conn); if (!(uc = (struct user_conn *) hash_search(&hash_user_connections, - (byte*) temp_user, temp_len))) + (uchar*) temp_user, temp_len))) { /* First connection for user; Create a user connection object */ if (!(uc= ((struct user_conn*) @@ -98,7 +98,7 @@ static int get_or_create_user_conn(THD *thd, const char *user, uc->connections= uc->questions= uc->updates= uc->conn_per_hour= 0; uc->user_resources= *mqh; uc->intime= thd->thr_create_time; - if (my_hash_insert(&hash_user_connections, (byte*) uc)) + if (my_hash_insert(&hash_user_connections, (uchar*) uc)) { my_free((char*) uc,0); net_send_error(thd, 0, NullS); // Out of memory @@ -200,7 +200,7 @@ void decrease_user_connections(USER_CONN *uc) if (!--uc->connections && !mqh_used) { /* Last connection for user; Delete it */ - (void) hash_delete(&hash_user_connections,(byte*) uc); + (void) hash_delete(&hash_user_connections,(uchar*) uc); } (void) pthread_mutex_unlock(&LOCK_user_conn); DBUG_VOID_RETURN; @@ -512,11 +512,11 @@ int check_user(THD *thd, enum enum_server_command command, started with corresponding variable that is greater then 0. */ -extern "C" byte *get_key_conn(user_conn *buff, uint *length, +extern "C" uchar *get_key_conn(user_conn *buff, size_t *length, my_bool not_used __attribute__((unused))) { - *length=buff->len; - return (byte*) buff->user; + *length= buff->len; + return (uchar*) buff->user; } @@ -559,7 +559,7 @@ void reset_mqh(LEX_USER *lu, bool get_them= 0) memcpy(temp_user+lu->user.length+1,lu->host.str,lu->host.length); temp_user[lu->user.length]='\0'; temp_user[temp_len-1]=0; if ((uc = (struct user_conn *) hash_search(&hash_user_connections, - (byte*) temp_user, temp_len))) + (uchar*) temp_user, temp_len))) { uc->questions=0; get_mqh(temp_user,&temp_user[lu->user.length+1],uc); @@ -747,8 +747,8 @@ static int check_connection(THD *thd) SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323) + 1; /* At this point we write connection message and read reply */ - if (net_write_command(net, (uchar) protocol_version, "", 0, buff, - (uint) (end-buff)) || + if (net_write_command(net, (uchar) protocol_version, (uchar*) "", 0, + (uchar*) buff, (size_t) (end-buff)) || (pkt_len= my_net_read(net)) == packet_error || pkt_len < MIN_HANDSHAKE_SIZE) { diff --git a/sql/sql_db.cc b/sql/sql_db.cc index cfd610638ce..f9422b5a921 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -59,11 +59,11 @@ typedef struct my_dblock_st lock_db key. */ -static byte* lock_db_get_key(my_dblock_t *ptr, uint *length, - my_bool not_used __attribute__((unused))) +static uchar* lock_db_get_key(my_dblock_t *ptr, size_t *length, + my_bool not_used __attribute__((unused))) { *length= ptr->name_length; - return (byte*) ptr->name; + return (uchar*) ptr->name; } @@ -73,7 +73,7 @@ static byte* lock_db_get_key(my_dblock_t *ptr, uint *length, static void lock_db_free_element(void *ptr) { - my_free((gptr) ptr, MYF(0)); + my_free(ptr, MYF(0)); } @@ -98,12 +98,12 @@ static my_bool lock_db_insert(const char *dbname, uint length) safe_mutex_assert_owner(&LOCK_lock_db); if (!(opt= (my_dblock_t*) hash_search(&lock_db_cache, - (byte*) dbname, length))) + (uchar*) dbname, length))) { /* Db is not in the hash, insert it */ char *tmp_name; if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), - &opt, (uint) sizeof(*opt), &tmp_name, length+1, + &opt, (uint) sizeof(*opt), &tmp_name, (uint) length+1, NullS)) { error= 1; @@ -114,11 +114,8 @@ static my_bool lock_db_insert(const char *dbname, uint length) strmov(opt->name, dbname); opt->name_length= length; - if ((error= my_hash_insert(&lock_db_cache, (byte*) opt))) - { - my_free((gptr) opt, MYF(0)); - goto end; - } + if ((error= my_hash_insert(&lock_db_cache, (uchar*) opt))) + my_free(opt, MYF(0)); } end: @@ -135,8 +132,8 @@ void lock_db_delete(const char *name, uint length) my_dblock_t *opt; safe_mutex_assert_owner(&LOCK_lock_db); if ((opt= (my_dblock_t *)hash_search(&lock_db_cache, - (const byte*) name, length))) - hash_delete(&lock_db_cache, (byte*) opt); + (const uchar*) name, length))) + hash_delete(&lock_db_cache, (uchar*) opt); } @@ -158,11 +155,11 @@ typedef struct my_dbopt_st Function we use in the creation of our hash to get key. */ -static byte* dboptions_get_key(my_dbopt_t *opt, uint *length, - my_bool not_used __attribute__((unused))) +static uchar* dboptions_get_key(my_dbopt_t *opt, size_t *length, + my_bool not_used __attribute__((unused))) { *length= opt->name_length; - return (byte*) opt->name; + return (uchar*) opt->name; } @@ -187,7 +184,7 @@ static inline void write_to_binlog(THD *thd, char *query, uint q_len, static void free_dbopt(void *dbopt) { - my_free((gptr) dbopt, MYF(0)); + my_free((uchar*) dbopt, MYF(0)); } @@ -280,7 +277,7 @@ static my_bool get_dbopt(const char *dbname, HA_CREATE_INFO *create) length= (uint) strlen(dbname); rw_rdlock(&LOCK_dboptions); - if ((opt= (my_dbopt_t*) hash_search(&dboptions, (byte*) dbname, length))) + if ((opt= (my_dbopt_t*) hash_search(&dboptions, (uchar*) dbname, length))) { create->default_table_charset= opt->charset; error= 0; @@ -312,12 +309,12 @@ static my_bool put_dbopt(const char *dbname, HA_CREATE_INFO *create) length= (uint) strlen(dbname); rw_wrlock(&LOCK_dboptions); - if (!(opt= (my_dbopt_t*) hash_search(&dboptions, (byte*) dbname, length))) + if (!(opt= (my_dbopt_t*) hash_search(&dboptions, (uchar*) dbname, length))) { /* Options are not in the hash, insert them */ char *tmp_name; if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), - &opt, (uint) sizeof(*opt), &tmp_name, length+1, + &opt, (uint) sizeof(*opt), &tmp_name, (uint) length+1, NullS)) { error= 1; @@ -328,9 +325,9 @@ static my_bool put_dbopt(const char *dbname, HA_CREATE_INFO *create) strmov(opt->name, dbname); opt->name_length= length; - if ((error= my_hash_insert(&dboptions, (byte*) opt))) + if ((error= my_hash_insert(&dboptions, (uchar*) opt))) { - my_free((gptr) opt, MYF(0)); + my_free(opt, MYF(0)); goto end; } } @@ -352,9 +349,9 @@ void del_dbopt(const char *path) { my_dbopt_t *opt; rw_wrlock(&LOCK_dboptions); - if ((opt= (my_dbopt_t *)hash_search(&dboptions, (const byte*) path, + if ((opt= (my_dbopt_t *)hash_search(&dboptions, (const uchar*) path, strlen(path)))) - hash_delete(&dboptions, (byte*) opt); + hash_delete(&dboptions, (uchar*) opt); rw_unlock(&LOCK_dboptions); } @@ -392,7 +389,7 @@ static bool write_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create) "\n", NullS) - buf); /* Error is written by my_write */ - if (!my_write(file,(byte*) buf, length, MYF(MY_NABP+MY_WME))) + if (!my_write(file,(uchar*) buf, length, MYF(MY_NABP+MY_WME))) error=0; my_close(file,MYF(0)); } @@ -920,7 +917,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) TABLE_LIST *tbl; uint db_len; - if (!(query= thd->alloc(MAX_DROP_TABLE_Q_LEN))) + if (!(query= (char*) thd->alloc(MAX_DROP_TABLE_Q_LEN))) goto exit; /* not much else we can do */ query_pos= query_data_start= strmov(query,"drop table "); query_end= query + MAX_DROP_TABLE_Q_LEN; @@ -1021,7 +1018,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, DBUG_PRINT("my",("New subdir found: %s", newpath)); if ((mysql_rm_known_files(thd, new_dirp, NullS, newpath,1,0)) < 0) goto err; - if (!(copy_of_path= thd->memdup(newpath, length+1)) || + if (!(copy_of_path= (char*) thd->memdup(newpath, length+1)) || !(dir= new (thd->mem_root) String(copy_of_path, length, &my_charset_bin)) || raid_dirs.push_back(dir)) @@ -1511,8 +1508,8 @@ lock_databases(THD *thd, const char *db1, uint length1, { pthread_mutex_lock(&LOCK_lock_db); while (!thd->killed && - (hash_search(&lock_db_cache,(byte*) db1, length1) || - hash_search(&lock_db_cache,(byte*) db2, length2))) + (hash_search(&lock_db_cache,(uchar*) db1, length1) || + hash_search(&lock_db_cache,(uchar*) db2, length2))) { wait_for_condition(thd, &LOCK_lock_db, &COND_refresh); pthread_mutex_lock(&LOCK_lock_db); @@ -1654,7 +1651,7 @@ bool mysql_rename_db(THD *thd, LEX_STRING *old_db, LEX_STRING *new_db) table_str.length= filename_to_tablename(file->name, tname, sizeof(tname)-1); - table_str.str= sql_memdup(tname, table_str.length + 1); + table_str.str= (char*) sql_memdup(tname, table_str.length + 1); Table_ident *old_ident= new Table_ident(thd, *old_db, table_str, 0); Table_ident *new_ident= new Table_ident(thd, *new_db, table_str, 0); if (!old_ident || !new_ident || diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 26c12dea081..c441c70d36f 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -438,7 +438,7 @@ bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds) extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b) { handler *file= (handler*)arg; - return file->cmp_ref((const byte*)a, (const byte*)b); + return file->cmp_ref((const uchar*)a, (const uchar*)b); } /* diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index cd87330cedb..db6fc03cbad 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -92,7 +92,7 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags); Pointer to the TABLE_LIST struct. */ -static char *mysql_ha_hash_get_key(TABLE_LIST *tables, uint *key_len_p, +static char *mysql_ha_hash_get_key(TABLE_LIST *tables, size_t *key_len_p, my_bool first __attribute__((unused))) { *key_len_p= strlen(tables->alias) + 1 ; /* include '\0' in comparisons */ @@ -167,7 +167,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen) } else if (! reopen) /* Otherwise we have 'tables' already. */ { - if (hash_search(&thd->handler_tables_hash, (byte*) tables->alias, + if (hash_search(&thd->handler_tables_hash, (uchar*) tables->alias, strlen(tables->alias) + 1)) { DBUG_PRINT("info",("duplicate '%s'", tables->alias)); @@ -208,10 +208,10 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen) namelen= strlen(tables->table_name) + 1; aliaslen= strlen(tables->alias) + 1; if (!(my_multi_malloc(MYF(MY_WME), - &hash_tables, sizeof(*hash_tables), - &db, dblen, - &name, namelen, - &alias, aliaslen, + &hash_tables, (uint) sizeof(*hash_tables), + &db, (uint) dblen, + &name, (uint) namelen, + &alias, (uint) aliaslen, NullS))) goto err; /* structure copy */ @@ -224,7 +224,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen) memcpy(hash_tables->alias, tables->alias, aliaslen); /* add to hash */ - if (my_hash_insert(&thd->handler_tables_hash, (byte*) hash_tables)) + if (my_hash_insert(&thd->handler_tables_hash, (uchar*) hash_tables)) { my_free((char*) hash_tables, MYF(0)); mysql_ha_close(thd, tables); @@ -270,7 +270,7 @@ bool mysql_ha_close(THD *thd, TABLE_LIST *tables) tables->db, tables->table_name, tables->alias)); if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash, - (byte*) tables->alias, + (uchar*) tables->alias, strlen(tables->alias) + 1))) { /* @@ -295,7 +295,7 @@ bool mysql_ha_close(THD *thd, TABLE_LIST *tables) } VOID(pthread_mutex_unlock(&LOCK_open)); } - hash_delete(&thd->handler_tables_hash, (byte*) hash_tables); + hash_delete(&thd->handler_tables_hash, (uchar*) hash_tables); } else { @@ -345,7 +345,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables, String buffer(buff, sizeof(buff), system_charset_info); int error, keyno= -1; uint num_rows; - byte *key; + uchar *key; uint key_len; bool not_used; DBUG_ENTER("mysql_ha_read"); @@ -362,7 +362,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables, it++; if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash, - (byte*) tables->alias, + (uchar*) tables->alias, strlen(tables->alias) + 1))) { table= hash_tables->table; @@ -536,7 +536,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables, keypart_map= (keypart_map << 1) | 1; } - if (!(key= (byte*) thd->calloc(ALIGN_SIZE(key_len)))) + if (!(key= (uchar*) thd->calloc(ALIGN_SIZE(key_len)))) goto err; table->file->ha_index_or_rnd_end(); table->file->ha_index_init(keyno, 1); @@ -732,13 +732,13 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags) table->alias, mode_flags)); if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash, - (byte*) table->alias, + (uchar*) table->alias, strlen(table->alias) + 1))) { if (! (mode_flags & MYSQL_HA_REOPEN_ON_USAGE)) { /* This is a final close. Remove from hash. */ - hash_delete(&thd->handler_tables_hash, (byte*) hash_tables); + hash_delete(&thd->handler_tables_hash, (uchar*) hash_tables); } else { @@ -785,7 +785,7 @@ void mysql_ha_mark_tables_for_reopen(THD *thd, TABLE *table) { TABLE_LIST *hash_tables; if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash, - (byte*) table->alias, + (uchar*) table->alias, strlen(table->alias) + 1))) { /* Mark table as ready for reopen. */ diff --git a/sql/sql_help.cc b/sql/sql_help.cc index 79d658c2a85..023bd1fec94 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -272,7 +272,7 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations, List<String> *names, String *name, String *description, String *example) { - char buff[8]; // Max int length + uchar buff[8]; // Max int length int count= 0; int iindex_topic, iindex_relations; Field *rtopic_id, *rkey_id; @@ -295,20 +295,20 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations, rkey_id->store((longlong) key_id, TRUE); rkey_id->get_key_image(buff, rkey_id->pack_length(), Field::itRAW); int key_res= relations->file->index_read(relations->record[0], - (byte *) buff, (key_part_map)1, + buff, (key_part_map) 1, HA_READ_KEY_EXACT); for ( ; !key_res && key_id == (int16) rkey_id->val_int() ; key_res= relations->file->index_next(relations->record[0])) { - char topic_id_buff[8]; + uchar topic_id_buff[8]; longlong topic_id= rtopic_id->val_int(); Field *field= find_fields[help_topic_help_topic_id].field; field->store((longlong) topic_id, TRUE); field->get_key_image(topic_id_buff, field->pack_length(), Field::itRAW); - if (!topics->file->index_read(topics->record[0], (byte *)topic_id_buff, + if (!topics->file->index_read(topics->record[0], topic_id_buff, (key_part_map)1, HA_READ_KEY_EXACT)) { memorize_variant_topic(thd,topics,count,find_fields, @@ -637,7 +637,7 @@ bool mysqld_help(THD *thd, const char *mask) MEM_ROOT *mem_root= thd->mem_root; DBUG_ENTER("mysqld_help"); - bzero((gptr)tables,sizeof(tables)); + bzero((uchar*)tables,sizeof(tables)); tables[0].alias= tables[0].table_name= (char*) "help_topic"; tables[0].lock_type= TL_READ; tables[0].next_global= tables[0].next_local= diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index f6ae2df3750..4a7a7e67134 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1256,9 +1256,9 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) goto err; } } - key_copy((byte*) key,table->record[0],table->key_info+key_nr,0); + key_copy((uchar*) key,table->record[0],table->key_info+key_nr,0); if ((error=(table->file->index_read_idx(table->record[1],key_nr, - (byte*) key, HA_WHOLE_KEY, + (uchar*) key, HA_WHOLE_KEY, HA_READ_KEY_EXACT)))) goto err; } @@ -1739,7 +1739,7 @@ TABLE *delayed_insert::get_local_table(THD* client_thd) Field **field,**org_field, *found_next_number_field; TABLE *copy; TABLE_SHARE *share= table->s; - byte *bitmap; + uchar *bitmap; DBUG_ENTER("delayed_insert::get_local_table"); /* First request insert thread to get a lock */ @@ -1784,7 +1784,7 @@ TABLE *delayed_insert::get_local_table(THD* client_thd) /* We don't need to change the file handler here */ /* Assign the pointers for the field pointers array and the record. */ field= copy->field= (Field**) (copy + 1); - bitmap= (byte*) (field + share->fields + 1); + bitmap= (uchar*) (field + share->fields + 1); copy->record[0]= (bitmap + share->column_bitmap_size * 2); memcpy((char*) copy->record[0], (char*) table->record[0], share->reclength); /* @@ -1853,7 +1853,8 @@ write_delayed(THD *thd,TABLE *table, enum_duplicates duplic, delayed_insert *di=thd->di; const Discrete_interval *forced_auto_inc; DBUG_ENTER("write_delayed"); - DBUG_PRINT("enter", ("query = '%s' length %u", query.str, query.length)); + DBUG_PRINT("enter", ("query = '%s' length %lu", query.str, + (ulong) query.length)); thd->proc_info="waiting for handler insert"; pthread_mutex_lock(&di->mutex); @@ -2227,7 +2228,7 @@ static void free_delayed_insert_blobs(register TABLE *table) { if ((*ptr)->flags & BLOB_FLAG) { - char *str; + uchar *str; ((Field_blob *) (*ptr))->get_ptr(&str); my_free(str,MYF(MY_ALLOW_ZERO_PTR)); ((Field_blob *) (*ptr))->reset(); @@ -2289,8 +2290,9 @@ bool delayed_insert::handle_inserts(void) use values from the previous interval (of the previous rows). */ bool log_query= (row->log_query && row->query.str != NULL); - DBUG_PRINT("delayed", ("query: '%s' length: %u", row->query.str ? - row->query.str : "[NULL]", row->query.length)); + DBUG_PRINT("delayed", ("query: '%s' length: %lu", row->query.str ? + row->query.str : "[NULL]", + (ulong) row->query.length)); if (log_query) { /* @@ -2622,7 +2624,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u) while ((item= li++)) { item->transform(&Item::update_value_transformer, - (byte*)lex->current_select); + (uchar*)lex->current_select); } } @@ -3108,7 +3110,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, MYSQL_LOCK_IGNORE_FLUSH, ¬_used))) { VOID(pthread_mutex_lock(&LOCK_open)); - hash_delete(&open_cache,(byte*) table); + hash_delete(&open_cache,(uchar*) table); VOID(pthread_mutex_unlock(&LOCK_open)); quick_rm_table(create_info->db_type, create_table->db, table_case_name(create_info, create_table->table_name), 0); @@ -3369,7 +3371,7 @@ void select_create::abort() { ulong version= table->s->version; table->s->version= 0; - hash_delete(&open_cache,(byte*) table); + hash_delete(&open_cache,(uchar*) table); if (!create_info->table_existed) quick_rm_table(table_type, create_table->db, create_table->table_name, 0); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 26955c18342..5e5308f4ab7 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1214,7 +1214,7 @@ void st_select_lex::init_select() linkage= UNSPECIFIED_TYPE; order_list.elements= 0; order_list.first= 0; - order_list.next= (byte**) &order_list.first; + order_list.next= (uchar**) &order_list.first; /* Set limit and offset to default values */ select_limit= 0; /* denotes the default limit = HA_POS_ERROR */ offset_limit= 0; /* denotes the default offset = 0 */ @@ -2020,7 +2020,7 @@ TABLE_LIST *st_lex::unlink_first_table(bool *link_to_local) { select_lex.context.table_list= select_lex.context.first_name_resolution_table= first->next_local; - select_lex.table_list.first= (byte*) (first->next_local); + select_lex.table_list.first= (uchar*) (first->next_local); select_lex.table_list.elements--; //safety first->next_local= 0; /* @@ -2101,7 +2101,7 @@ void st_lex::link_first_table_back(TABLE_LIST *first, { first->next_local= (TABLE_LIST*) select_lex.table_list.first; select_lex.context.table_list= first; - select_lex.table_list.first= (byte*) first; + select_lex.table_list.first= (uchar*) first; select_lex.table_list.elements++; //safety } } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 5a0e6bfdd0c..e8f319a4dbc 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -221,7 +221,7 @@ enum tablespace_op_type Keep in sync with index_hint_type. */ extern const char * index_hint_type_name[]; -typedef byte index_clause_map; +typedef uchar index_clause_map; /* Bits in index_clause_map : one for each possible FOR clause in @@ -409,7 +409,7 @@ public: static void *operator new(size_t size) { - return (void*) sql_alloc((uint) size); + return sql_alloc(size); } static void *operator new(size_t size, MEM_ROOT *mem_root) { return (void*) alloc_root(mem_root, (uint) size); } @@ -733,7 +733,7 @@ public: { order_list.elements= 0; order_list.first= 0; - order_list.next= (byte**) &order_list.first; + order_list.next= (uchar**) &order_list.first; } /* This method created for reiniting LEX in mysql_admin_table() and can be @@ -913,7 +913,7 @@ public: in which it was right after query parsing. */ SQL_LIST sroutines_list; - byte **sroutines_list_own_last; + uchar **sroutines_list_own_last; uint sroutines_list_own_elements; /* @@ -1024,7 +1024,7 @@ typedef struct st_lex : public Query_tables_list LEX_STRING comment, ident; LEX_USER *grant_user; XID *xid; - gptr yacc_yyss,yacc_yyvs; + uchar* yacc_yyss, *yacc_yyvs; THD *thd; CHARSET_INFO *charset, *underscore_charset; /* store original leaf_tables for INSERT SELECT and PS/SP */ @@ -1312,7 +1312,7 @@ struct st_lex_local: public st_lex { static void *operator new(size_t size) { - return (void*) sql_alloc((uint) size); + return sql_alloc(size); } static void *operator new(size_t size, MEM_ROOT *mem_root) { diff --git a/sql/sql_list.h b/sql/sql_list.h index ba61a931e04..79e3804d208 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -25,16 +25,16 @@ class Sql_alloc public: static void *operator new(size_t size) throw () { - return (void*) sql_alloc((uint) size); + return sql_alloc(size); } static void *operator new[](size_t size) { - return (void*) sql_alloc((uint) size); + return sql_alloc(size); } static void *operator new[](size_t size, MEM_ROOT *mem_root) throw () - { return (void*) alloc_root(mem_root, (uint) size); } + { return alloc_root(mem_root, size); } static void *operator new(size_t size, MEM_ROOT *mem_root) throw () - { return (void*) alloc_root(mem_root, (uint) size); } + { return alloc_root(mem_root, size); } static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); } static void operator delete(void *ptr, MEM_ROOT *mem_root) { /* never called */ } @@ -424,7 +424,7 @@ struct ilink } static void operator delete(void* ptr_arg, size_t size) { - my_free((gptr)ptr_arg, MYF(MY_WME|MY_ALLOW_ZERO_PTR)); + my_free((uchar*)ptr_arg, MYF(MY_WME|MY_ALLOW_ZERO_PTR)); } inline ilink() diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 71cc4c0507c..e137481ccef 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -25,7 +25,7 @@ class READ_INFO { File file; - byte *buffer, /* Buffer for read text */ + uchar *buffer, /* Buffer for read text */ *end_of_buff; /* Data in bufferts ends here */ uint buff_length, /* Length of buffert */ max_length; /* Max length of row */ @@ -40,7 +40,7 @@ class READ_INFO { public: bool error,line_cuted,found_null,enclosed; - byte *row_start, /* Found row starts here */ + uchar *row_start, /* Found row starts here */ *row_end; /* Found row ends here */ CHARSET_INFO *read_charset; @@ -576,7 +576,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, continue; } it.rewind(); - byte *pos=read_info.row_start; + uchar *pos=read_info.row_start; #ifdef HAVE_purify read_info.row_end[0]=0; #endif @@ -609,7 +609,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, else { uint length; - byte save_chr; + uchar save_chr; if ((length=(uint) (read_info.row_end-pos)) > field->field_length) length=field->field_length; @@ -703,7 +703,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, while ((item= it++)) { uint length; - byte *pos; + uchar *pos; if (read_info.read_field()) break; @@ -910,7 +910,7 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs, set_if_bigger(length,line_start.length()); stack=stack_pos=(int*) sql_alloc(sizeof(int)*length); - if (!(buffer=(byte*) my_malloc(buff_length+1,MYF(0)))) + if (!(buffer=(uchar*) my_malloc(buff_length+1,MYF(0)))) error=1; /* purecov: inspected */ else { @@ -920,7 +920,7 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs, (is_fifo ? READ_FIFO : READ_CACHE),0L,1, MYF(MY_WME))) { - my_free((gptr) buffer,MYF(0)); /* purecov: inspected */ + my_free((uchar*) buffer,MYF(0)); /* purecov: inspected */ error=1; } else @@ -951,7 +951,7 @@ READ_INFO::~READ_INFO() { if (need_end_io_cache) ::end_io_cache(&cache); - my_free((gptr) buffer,MYF(0)); + my_free((uchar*) buffer,MYF(0)); error=1; } } @@ -984,7 +984,7 @@ inline int READ_INFO::terminator(char *ptr,uint length) int READ_INFO::read_field() { int chr,found_enclosed_char; - byte *to,*new_buffer; + uchar *to,*new_buffer; found_null=0; if (found_end_of_line) @@ -1007,7 +1007,7 @@ int READ_INFO::read_field() if (chr == enclosed_char) { found_enclosed_char=enclosed_char; - *to++=(byte) chr; // If error + *to++=(uchar) chr; // If error } else { @@ -1049,7 +1049,7 @@ int READ_INFO::read_field() { if ((chr=GET) == my_b_EOF) { - *to++= (byte) escape_char; + *to++= (uchar) escape_char; goto found_eof; } /* @@ -1061,7 +1061,7 @@ int READ_INFO::read_field() */ if (escape_char != enclosed_char || chr == escape_char) { - *to++ = (byte) unescape((char) chr); + *to++ = (uchar) unescape((char) chr); continue; } PUSH(chr); @@ -1086,7 +1086,7 @@ int READ_INFO::read_field() { if ((chr=GET) == found_enclosed_char) { // Remove dupplicated - *to++ = (byte) chr; + *to++ = (uchar) chr; continue; } // End of enclosed field if followed by field_term or line_term @@ -1126,12 +1126,12 @@ int READ_INFO::read_field() return 0; } } - *to++ = (byte) chr; + *to++ = (uchar) chr; } /* ** We come here if buffer is too small. Enlarge it and continue */ - if (!(new_buffer=(byte*) my_realloc((char*) buffer,buff_length+1+IO_SIZE, + if (!(new_buffer=(uchar*) my_realloc((char*) buffer,buff_length+1+IO_SIZE, MYF(MY_WME)))) return (error=1); to=new_buffer + (to-buffer); @@ -1166,7 +1166,7 @@ found_eof: int READ_INFO::read_fixed_length() { int chr; - byte *to; + uchar *to; if (found_end_of_line) return 1; // One have to call next_line @@ -1186,10 +1186,10 @@ int READ_INFO::read_fixed_length() { if ((chr=GET) == my_b_EOF) { - *to++= (byte) escape_char; + *to++= (uchar) escape_char; goto found_eof; } - *to++ =(byte) unescape((char) chr); + *to++ =(uchar) unescape((char) chr); continue; } if (chr == line_term_char) @@ -1201,7 +1201,7 @@ int READ_INFO::read_fixed_length() return 0; } } - *to++ = (byte) chr; + *to++ = (uchar) chr; } row_end=to; // Found full line return 0; @@ -1232,7 +1232,7 @@ int READ_INFO::next_line() #ifdef USE_MB if (my_mbcharlen(read_charset, chr) > 1) { - for (int i=1; + for (uint i=1; chr != my_b_EOF && i<my_mbcharlen(read_charset, chr); i++) chr = GET; diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc index b0ca7667a62..171ab55145a 100644 --- a/sql/sql_manager.cc +++ b/sql/sql_manager.cc @@ -118,7 +118,7 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused))) { struct handler_cb *next= cb->next; cb->action(); - my_free((gptr)cb, MYF(0)); + my_free((uchar*)cb, MYF(0)); cb= next; } diff --git a/sql/sql_map.cc b/sql/sql_map.cc index 36a47f1aefc..0a494377fc6 100644 --- a/sql/sql_map.cc +++ b/sql/sql_map.cc @@ -24,7 +24,7 @@ #include <sys/mman.h> #endif -mapped_files::mapped_files(const my_string filename,byte *magic,uint magic_length) +mapped_files::mapped_files(const char * filename,uchar *magic,uint magic_length) { #ifdef HAVE_MMAP name=my_strdup(filename,MYF(0)); @@ -37,12 +37,12 @@ mapped_files::mapped_files(const my_string filename,byte *magic,uint magic_lengt struct stat stat_buf; if (!fstat(file,&stat_buf)) { - if (!(map=(byte*) my_mmap(0,(size=(ulong) stat_buf.st_size),PROT_READ, + if (!(map=(uchar*) my_mmap(0,(size=(ulong) stat_buf.st_size),PROT_READ, MAP_SHARED | MAP_NORESERVE,file, 0L))) { error=errno; - my_error(ER_NO_FILE_MAPPING, MYF(0), (my_string) name, error); + my_error(ER_NO_FILE_MAPPING, MYF(0), (char *) name, error); } } if (map && memcmp(map,magic,magic_length)) @@ -82,7 +82,7 @@ static I_List<mapped_files> maps_in_use; ** else alloc new object */ -mapped_files *map_file(const my_string name,byte *magic,uint magic_length) +mapped_files *map_file(const char * name,uchar *magic,uint magic_length) { #ifdef HAVE_MMAP VOID(pthread_mutex_lock(&LOCK_mapped_file)); diff --git a/sql/sql_map.h b/sql/sql_map.h index d8eb64995aa..a1efba0da6f 100644 --- a/sql/sql_map.h +++ b/sql/sql_map.h @@ -21,11 +21,11 @@ #endif class mapped_files; -mapped_files *map_file(const my_string name,byte *magic,uint magic_length); +mapped_files *map_file(const char * name,uchar *magic,uint magic_length); void unmap_file(mapped_files *map); class mapped_files :public ilink { - byte *map; + uchar *map; ha_rows size; char *name; // name of mapped file File file; // >= 0 if open @@ -33,11 +33,11 @@ class mapped_files :public ilink { uint use_count; public: - mapped_files(const my_string name,byte *magic,uint magic_length); + mapped_files(const char * name,uchar *magic,uint magic_length); ~mapped_files(); friend class mapped_file; - friend mapped_files *map_file(const my_string name,byte *magic, + friend mapped_files *map_file(const char * name,uchar *magic, uint magic_length); friend void unmap_file(mapped_files *map); }; @@ -47,7 +47,7 @@ class mapped_file { mapped_files *file; public: - mapped_file(const my_string name,byte *magic,uint magic_length) + mapped_file(const char * name,uchar *magic,uint magic_length) { file=map_file(name,magic,magic_length); /* old or new map */ } @@ -55,7 +55,7 @@ public: { unmap_file(file); /* free map */ } - byte *map() + uchar *map() { return file->map; } diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc index 818825d566b..dccfcbaf8ac 100644 --- a/sql/sql_olap.cc +++ b/sql/sql_olap.cc @@ -54,8 +54,8 @@ static int make_new_olap_select(LEX *lex, SELECT_LEX *select_lex, List<Item> new new_select->linkage=OLAP_TYPE; new_select->olap=NON_EXISTING_ONE; new_select->group_list.elements=0; - new_select->group_list.first=(byte *)0; - new_select->group_list.next=(byte **)&new_select->group_list.first; + new_select->group_list.first=(uchar *)0; + new_select->group_list.next=(uchar **)&new_select->group_list.first; List<Item> privlist; List_iterator<Item> list_it(select_lex->item_list); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index af80ea91397..ae297c11e4e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -192,7 +192,7 @@ uint sql_command_flags[SQLCOM_END+1]; void init_update_queries(void) { - bzero((gptr) &sql_command_flags, sizeof(sql_command_flags)); + bzero((uchar*) &sql_command_flags, sizeof(sql_command_flags)); sql_command_flags[SQLCOM_CREATE_TABLE]= CF_CHANGES_DATA; sql_command_flags[SQLCOM_CREATE_INDEX]= CF_CHANGES_DATA; @@ -370,8 +370,9 @@ pthread_handler_t handle_bootstrap(void *arg) continue; thd->query_length=length; - thd->query= thd->memdup_w_gap(buff, length+1, - thd->db_length+1+QUERY_CACHE_FLAGS_SIZE); + thd->query= (char*) thd->memdup_w_gap(buff, length+1, + thd->db_length+1+ + QUERY_CACHE_FLAGS_SIZE); thd->query[length] = '\0'; DBUG_PRINT("query",("%-.4096s",thd->query)); /* @@ -758,13 +759,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd, statistic_increment(thd->status_var.com_other, &LOCK_status); thd->enable_slow_log= opt_log_slow_admin_statements; - db.str= thd->alloc(db_len + tbl_len + 2); - db.length= db_len; + db.str= (char*) thd->alloc(db_len + tbl_len + 2); if (!db.str) { my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); break; } + db.length= db_len; tbl_name= strmake(db.str, packet + 1, db_len)+1; strmake(tbl_name, packet + db_len + 2, tbl_len); mysql_table_dump(thd, &db, tbl_name); @@ -852,8 +853,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (save_user_connect) decrease_user_connections(save_user_connect); #endif /* NO_EMBEDDED_ACCESS_CHECKS */ - x_free((gptr) save_db); - x_free((gptr) save_security_ctx.user); + x_free((uchar*) save_db); + x_free((uchar*) save_security_ctx.user); } break; } @@ -948,7 +949,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, /* Locked closure of all tables */ TABLE_LIST table_list; LEX_STRING conv_name; - uint dummy; + size_t dummy; /* used as fields initializator */ lex_start(thd, 0, 0); @@ -976,7 +977,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, } thd->query_length= (uint) (packet_end - packet); // Don't count end \0 - if (!(thd->query=fields=thd->memdup(packet,thd->query_length+1))) + if (!(thd->query=fields= (char*) thd->memdup(packet,thd->query_length+1))) break; general_log_print(thd, command, "%s %s", table_list.table_name, fields); if (lower_case_table_names) @@ -992,8 +993,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, table_list.select_lex= &(thd->lex->select_lex); mysql_init_query(thd, "", 0); thd->lex-> - select_lex.table_list.link_in_list((byte*) &table_list, - (byte**) &table_list.next_local); + select_lex.table_list.link_in_list((uchar*) &table_list, + (uchar**) &table_list.next_local); thd->lex->add_to_query_tables(&table_list); /* switch on VIEW optimisation: do not fill temporary tables */ @@ -1189,7 +1190,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, } #endif #ifndef EMBEDDED_LIBRARY - VOID(my_net_write(net, buff, length)); + VOID(my_net_write(net, (uchar*) buff, length)); VOID(net_flush(net)); #endif break; @@ -1388,7 +1389,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident, #else { LEX_STRING db; - uint dummy; + size_t dummy; if (lex->select_lex.db == NULL && thd->copy_db_to(&lex->select_lex.db, &dummy)) { @@ -1489,7 +1490,7 @@ bool alloc_query(THD *thd, const char *packet, uint packet_length) } /* We must allocate some extra memory for query cache */ thd->query_length= 0; // Extra safety: Avoid races - if (!(thd->query= (char*) thd->memdup_w_gap((gptr) (packet), + if (!(thd->query= (char*) thd->memdup_w_gap((uchar*) (packet), packet_length, thd->db_length+ 1 + QUERY_CACHE_FLAGS_SIZE))) @@ -1954,7 +1955,7 @@ mysql_execute_command(THD *thd) goto error; /* purecov: inspected */ thd->enable_slow_log= opt_log_slow_admin_statements; res = mysql_backup_table(thd, first_table); - select_lex->table_list.first= (byte*) first_table; + select_lex->table_list.first= (uchar*) first_table; lex->query_tables=all_tables; break; } @@ -1966,7 +1967,7 @@ mysql_execute_command(THD *thd) goto error; /* purecov: inspected */ thd->enable_slow_log= opt_log_slow_admin_statements; res = mysql_restore_table(thd, first_table); - select_lex->table_list.first= (byte*) first_table; + select_lex->table_list.first= (uchar*) first_table; lex->query_tables=all_tables; break; } @@ -2449,7 +2450,7 @@ end_with_restore_list: thd->query, thd->query_length, 0, FALSE); } } - select_lex->table_list.first= (byte*) first_table; + select_lex->table_list.first= (uchar*) first_table; lex->query_tables=all_tables; break; } @@ -2460,7 +2461,7 @@ end_with_restore_list: goto error; /* purecov: inspected */ thd->enable_slow_log= opt_log_slow_admin_statements; res = mysql_check_table(thd, first_table, &lex->check_opt); - select_lex->table_list.first= (byte*) first_table; + select_lex->table_list.first= (uchar*) first_table; lex->query_tables=all_tables; break; } @@ -2484,7 +2485,7 @@ end_with_restore_list: thd->query, thd->query_length, 0, FALSE); } } - select_lex->table_list.first= (byte*) first_table; + select_lex->table_list.first= (uchar*) first_table; lex->query_tables=all_tables; break; } @@ -2511,7 +2512,7 @@ end_with_restore_list: thd->query, thd->query_length, 0, FALSE); } } - select_lex->table_list.first= (byte*) first_table; + select_lex->table_list.first= (uchar*) first_table; lex->query_tables=all_tables; break; } @@ -2677,7 +2678,7 @@ end_with_restore_list: { /* Skip first table, which is the table we are inserting in */ TABLE_LIST *second_table= first_table->next_local; - select_lex->table_list.first= (byte*) second_table; + select_lex->table_list.first= (uchar*) second_table; select_lex->context.table_list= select_lex->context.first_name_resolution_table= second_table; res= mysql_insert_select_prepare(thd); @@ -2710,7 +2711,7 @@ end_with_restore_list: delete sel_result; } /* revert changes for SP */ - select_lex->table_list.first= (byte*) first_table; + select_lex->table_list.first= (uchar*) first_table; } /* @@ -4991,7 +4992,7 @@ long max_stack_used; - Passing to check_stack_overrun() prevents the compiler from removing it. */ bool check_stack_overrun(THD *thd, long margin, - char *buf __attribute__((unused))) + uchar *buf __attribute__((unused))) { long stack_used; DBUG_ASSERT(thd == current_thd); @@ -5023,19 +5024,19 @@ bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, ulong *yystacksize) if (!lex->yacc_yyvs) old_info= *yystacksize; *yystacksize= set_zone((*yystacksize)*2,MY_YACC_INIT,MY_YACC_MAX); - if (!(lex->yacc_yyvs= (char*) - my_realloc((gptr) lex->yacc_yyvs, + if (!(lex->yacc_yyvs= (uchar*) + my_realloc(lex->yacc_yyvs, *yystacksize*sizeof(**yyvs), MYF(MY_ALLOW_ZERO_PTR | MY_FREE_ON_ERROR))) || - !(lex->yacc_yyss= (char*) - my_realloc((gptr) lex->yacc_yyss, + !(lex->yacc_yyss= (uchar*) + my_realloc(lex->yacc_yyss, *yystacksize*sizeof(**yyss), MYF(MY_ALLOW_ZERO_PTR | MY_FREE_ON_ERROR)))) return 1; if (old_info) { // Copy old info from stack - memcpy(lex->yacc_yyss, (gptr) *yyss, old_info*sizeof(**yyss)); - memcpy(lex->yacc_yyvs, (gptr) *yyvs, old_info*sizeof(**yyvs)); + memcpy(lex->yacc_yyss, (uchar*) *yyss, old_info*sizeof(**yyss)); + memcpy(lex->yacc_yyvs, (uchar*) *yyvs, old_info*sizeof(**yyvs)); } *yyss=(short*) lex->yacc_yyss; *yyvs=(YYSTYPE*) lex->yacc_yyvs; @@ -5488,7 +5489,7 @@ add_proc_to_list(THD* thd, Item *item) *item_ptr= item; order->item=item_ptr; order->free_me=0; - thd->lex->proc_list.link_in_list((byte*) order,(byte**) &order->next); + thd->lex->proc_list.link_in_list((uchar*) order,(uchar**) &order->next); return 0; } @@ -5510,7 +5511,7 @@ bool add_to_list(THD *thd, SQL_LIST &list,Item *item,bool asc) order->free_me=0; order->used=0; order->counter_used= 0; - list.link_in_list((byte*) order,(byte**) &order->next); + list.link_in_list((uchar*) order,(uchar**) &order->next); DBUG_RETURN(0); } @@ -5575,7 +5576,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ER(ER_DERIVED_MUST_HAVE_ALIAS), MYF(0)); DBUG_RETURN(0); } - if (!(alias_str=thd->memdup(alias_str,table->table.length+1))) + if (!(alias_str= (char*) thd->memdup(alias_str,table->table.length+1))) DBUG_RETURN(0); } if (!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST)))) @@ -5662,7 +5663,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, previous table reference to 'ptr'. Here we also add one element to the list 'table_list'. */ - table_list.link_in_list((byte*) ptr, (byte**) &ptr->next_local); + table_list.link_in_list((uchar*) ptr, (uchar**) &ptr->next_local); ptr->next_name_resolution_table= NULL; /* Link table in global list (all used tables) */ lex->add_to_query_tables(ptr); @@ -5701,7 +5702,7 @@ bool st_select_lex::init_nested_join(THD *thd) sizeof(NESTED_JOIN)))) DBUG_RETURN(1); nested_join= ptr->nested_join= - ((NESTED_JOIN*) ((byte*) ptr + ALIGN_SIZE(sizeof(TABLE_LIST)))); + ((NESTED_JOIN*) ((uchar*) ptr + ALIGN_SIZE(sizeof(TABLE_LIST)))); join_list->push_front(ptr); ptr->embedding= embedding; @@ -5787,7 +5788,7 @@ TABLE_LIST *st_select_lex::nest_last_join(THD *thd) sizeof(NESTED_JOIN)))) DBUG_RETURN(0); nested_join= ptr->nested_join= - ((NESTED_JOIN*) ((byte*) ptr + ALIGN_SIZE(sizeof(TABLE_LIST)))); + ((NESTED_JOIN*) ((uchar*) ptr + ALIGN_SIZE(sizeof(TABLE_LIST)))); ptr->embedding= embedding; ptr->join_list= join_list; @@ -6380,7 +6381,7 @@ bool append_file_to_dir(THD *thd, const char **filename_ptr, /* Fix is using unix filename format on dos */ strmov(buff,*filename_ptr); end=convert_dirname(buff, *filename_ptr, NullS); - if (!(ptr=thd->alloc((uint) (end-buff)+(uint) strlen(table_name)+1))) + if (!(ptr= (char*) thd->alloc((size_t) (end-buff) + strlen(table_name)+1))) return 1; // End of memory *filename_ptr=ptr; strxmov(ptr,buff,table_name,NullS); diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index d445c8bfbe0..149db3e6adf 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -123,23 +123,23 @@ uint32 get_partition_id_hash_sub(partition_info *part_info); uint32 get_partition_id_key_sub(partition_info *part_info); uint32 get_partition_id_linear_hash_sub(partition_info *part_info); uint32 get_partition_id_linear_key_sub(partition_info *part_info); -#endif - static uint32 get_next_partition_via_walking(PARTITION_ITERATOR*); +static void set_up_range_analysis_info(partition_info *part_info); static uint32 get_next_subpartition_via_walking(PARTITION_ITERATOR*); +#endif + uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter); uint32 get_next_partition_id_list(PARTITION_ITERATOR* part_iter); int get_part_iter_for_interval_via_mapping(partition_info *part_info, bool is_subpart, - char *min_value, char *max_value, + uchar *min_value, uchar *max_value, uint flags, PARTITION_ITERATOR *part_iter); int get_part_iter_for_interval_via_walking(partition_info *part_info, bool is_subpart, - char *min_value, char *max_value, + uchar *min_value, uchar *max_value, uint flags, PARTITION_ITERATOR *part_iter); -static void set_up_range_analysis_info(partition_info *part_info); /* A routine used by the parser to decide whether we are specifying a full @@ -318,8 +318,8 @@ bool check_reorganise_list(partition_info *new_part_info, > 0 Error code */ -int get_parts_for_update(const byte *old_data, byte *new_data, - const byte *rec0, partition_info *part_info, +int get_parts_for_update(const uchar *old_data, uchar *new_data, + const uchar *rec0, partition_info *part_info, uint32 *old_part_id, uint32 *new_part_id, longlong *new_func_value) { @@ -392,7 +392,7 @@ int get_parts_for_update(const byte *old_data, byte *new_data, calculate the partition id. */ -int get_part_for_delete(const byte *buf, const byte *rec0, +int get_part_for_delete(const uchar *buf, const uchar *rec0, partition_info *part_info, uint32 *part_id) { int error; @@ -931,7 +931,7 @@ bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table, context->table_list= &tables; context->first_name_resolution_table= &tables; context->last_name_resolution_table= NULL; - func_expr->walk(&Item::change_context_processor, 0, (byte*) context); + func_expr->walk(&Item::change_context_processor, 0, (uchar*) context); save_where= thd->where; thd->where= "partition function"; /* @@ -1697,7 +1697,7 @@ end: static int add_write(File fptr, const char *buf, uint len) { - uint len_written= my_write(fptr, (const byte*)buf, len, MYF(0)); + uint len_written= my_write(fptr, (const uchar*)buf, len, MYF(0)); if (likely(len == len_written)) return 0; @@ -2144,13 +2144,13 @@ char *generate_partition_syntax(partition_info *part_info, goto close_file; *buf_length= (uint)buffer_length; if (use_sql_alloc) - buf= sql_alloc(*buf_length+1); + buf= (char*) sql_alloc(*buf_length+1); else - buf= my_malloc(*buf_length+1, MYF(MY_WME)); + buf= (char*) my_malloc(*buf_length+1, MYF(MY_WME)); if (!buf) goto close_file; - if (unlikely(my_read(fptr, (byte*)buf, *buf_length, MYF(MY_FNABP)))) + if (unlikely(my_read(fptr, (uchar*)buf, *buf_length, MYF(MY_FNABP)))) { if (!use_sql_alloc) my_free(buf, MYF(0)); @@ -2413,8 +2413,8 @@ static uint32 get_part_id_linear_key(partition_info *part_info, */ static void copy_to_part_field_buffers(Field **ptr, - char **field_bufs, - char **restore_ptr) + uchar **field_bufs, + uchar **restore_ptr) { Field *field; while ((field= *(ptr++))) @@ -2425,7 +2425,7 @@ static void copy_to_part_field_buffers(Field **ptr, { CHARSET_INFO *cs= ((Field_str*)field)->charset(); uint len= field->pack_length(); - char *field_buf= *field_bufs; + uchar *field_buf= *field_bufs; /* We only use the field buffer for VARCHAR and CHAR strings which isn't of a binary collation. We also only use the @@ -2436,17 +2436,17 @@ static void copy_to_part_field_buffers(Field **ptr, if (field->type() == MYSQL_TYPE_VARCHAR) { uint len_bytes= ((Field_varstring*)field)->length_bytes; - my_strnxfrm(cs, (uchar*)(field_buf + len_bytes), (len - len_bytes), - (uchar*)(field->ptr + len_bytes), field->field_length); + my_strnxfrm(cs, field_buf + len_bytes, (len - len_bytes), + field->ptr + len_bytes, field->field_length); if (len_bytes == 1) - *field_buf= (uchar)field->field_length; + *field_buf= (uchar) field->field_length; else int2store(field_buf, field->field_length); } else { - my_strnxfrm(cs, (uchar*)field_buf, len, - (uchar*)field->ptr, field->field_length); + my_strnxfrm(cs, field_buf, len, + field->ptr, field->field_length); } field->ptr= field_buf; } @@ -2465,7 +2465,7 @@ static void copy_to_part_field_buffers(Field **ptr, RETURN VALUES */ -static void restore_part_field_pointers(Field **ptr, char **restore_ptr) +static void restore_part_field_pointers(Field **ptr, uchar **restore_ptr) { Field *field; while ((field= *(ptr++))) @@ -3307,16 +3307,16 @@ static bool check_part_func_bound(Field **ptr) get the partition identity and restore field pointers afterwards. */ -static uint32 get_sub_part_id_from_key(const TABLE *table,byte *buf, +static uint32 get_sub_part_id_from_key(const TABLE *table,uchar *buf, KEY *key_info, const key_range *key_spec) { - byte *rec0= table->record[0]; + uchar *rec0= table->record[0]; partition_info *part_info= table->part_info; uint32 part_id; DBUG_ENTER("get_sub_part_id_from_key"); - key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length); + key_restore(buf, (uchar*)key_spec->key, key_info, key_spec->length); if (likely(rec0 == buf)) part_id= part_info->get_subpartition_id(part_info); else @@ -3350,16 +3350,16 @@ static uint32 get_sub_part_id_from_key(const TABLE *table,byte *buf, get the partition identity and restore field pointers afterwards. */ -bool get_part_id_from_key(const TABLE *table, byte *buf, KEY *key_info, +bool get_part_id_from_key(const TABLE *table, uchar *buf, KEY *key_info, const key_range *key_spec, uint32 *part_id) { bool result; - byte *rec0= table->record[0]; + uchar *rec0= table->record[0]; partition_info *part_info= table->part_info; longlong func_value; DBUG_ENTER("get_part_id_from_key"); - key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length); + key_restore(buf, (uchar*)key_spec->key, key_info, key_spec->length); if (likely(rec0 == buf)) result= part_info->get_part_partition_id(part_info, part_id, &func_value); @@ -3395,18 +3395,18 @@ bool get_part_id_from_key(const TABLE *table, byte *buf, KEY *key_info, get the partition identity and restore field pointers afterwards. */ -void get_full_part_id_from_key(const TABLE *table, byte *buf, +void get_full_part_id_from_key(const TABLE *table, uchar *buf, KEY *key_info, const key_range *key_spec, part_id_range *part_spec) { bool result; partition_info *part_info= table->part_info; - byte *rec0= table->record[0]; + uchar *rec0= table->record[0]; longlong func_value; DBUG_ENTER("get_full_part_id_from_key"); - key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length); + key_restore(buf, (uchar*)key_spec->key, key_info, key_spec->length); if (likely(rec0 == buf)) result= part_info->get_partition_id(part_info, &part_spec->start_part, &func_value); @@ -3494,7 +3494,7 @@ void prune_partition_set(const TABLE *table, part_id_range *part_spec) RETURN VALUE part_spec */ -void get_partition_set(const TABLE *table, byte *buf, const uint index, +void get_partition_set(const TABLE *table, uchar *buf, const uint index, const key_range *key_spec, part_id_range *part_spec) { partition_info *part_info= table->part_info; @@ -3831,9 +3831,9 @@ bool mysql_unpack_partition(THD *thd, char *part_func_string= NULL; char *subpart_func_string= NULL; if ((part_func_len && - !((part_func_string= thd->alloc(part_func_len)))) || + !((part_func_string= (char*) thd->alloc(part_func_len)))) || (subpart_func_len && - !((subpart_func_string= thd->alloc(subpart_func_len))))) + !((subpart_func_string= (char*) thd->alloc(subpart_func_len))))) { mem_alloc_error(part_func_len); thd->free_items(); @@ -6404,8 +6404,8 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, also for other programs. */ -void set_field_ptr(Field **ptr, const byte *new_buf, - const byte *old_buf) +void set_field_ptr(Field **ptr, const uchar *new_buf, + const uchar *old_buf) { my_ptrdiff_t diff= (new_buf - old_buf); DBUG_ENTER("set_field_ptr"); @@ -6438,8 +6438,8 @@ void set_field_ptr(Field **ptr, const byte *new_buf, also for other programs. */ -void set_key_field_ptr(KEY *key_info, const byte *new_buf, - const byte *old_buf) +void set_key_field_ptr(KEY *key_info, const uchar *new_buf, + const uchar *old_buf) { KEY_PART_INFO *key_part= key_info->key_part; uint key_parts= key_info->key_parts; @@ -6690,7 +6690,7 @@ typedef uint32 (*get_endpoint_func)(partition_info*, bool left_endpoint, int get_part_iter_for_interval_via_mapping(partition_info *part_info, bool is_subpart, - char *min_value, char *max_value, + uchar *min_value, uchar *max_value, uint flags, PARTITION_ITERATOR *part_iter) { @@ -6846,7 +6846,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, int get_part_iter_for_interval_via_walking(partition_info *part_info, bool is_subpart, - char *min_value, char *max_value, + uchar *min_value, uchar *max_value, uint flags, PARTITION_ITERATOR *part_iter) { diff --git a/sql/sql_partition.h b/sql/sql_partition.h index e0c0f1c5bd3..d0c66083768 100644 --- a/sql/sql_partition.h +++ b/sql/sql_partition.h @@ -56,11 +56,11 @@ bool check_reorganise_list(partition_info *new_part_info, partition_info *old_part_info, List<char> list_part_names); handler *get_ha_partition(partition_info *part_info); -int get_parts_for_update(const byte *old_data, byte *new_data, - const byte *rec0, partition_info *part_info, +int get_parts_for_update(const uchar *old_data, uchar *new_data, + const uchar *rec0, partition_info *part_info, uint32 *old_part_id, uint32 *new_part_id, longlong *func_value); -int get_part_for_delete(const byte *buf, const byte *rec0, +int get_part_for_delete(const uchar *buf, const uchar *rec0, partition_info *part_info, uint32 *part_id); void prune_partition_set(const TABLE *table, part_id_range *part_spec); bool check_partition_info(partition_info *part_info,handlerton **eng_type, @@ -70,10 +70,10 @@ char *generate_partition_syntax(partition_info *part_info, uint *buf_length, bool use_sql_alloc, bool show_partition_options); bool partition_key_modified(TABLE *table, const MY_BITMAP *fields); -void get_partition_set(const TABLE *table, byte *buf, const uint index, +void get_partition_set(const TABLE *table, uchar *buf, const uint index, const key_range *key_spec, part_id_range *part_spec); -void get_full_part_id_from_key(const TABLE *table, byte *buf, +void get_full_part_id_from_key(const TABLE *table, uchar *buf, KEY *key_info, const key_range *key_spec, part_id_range *part_spec); @@ -201,7 +201,7 @@ typedef struct st_partition_iter typedef int (*get_partitions_in_range_iter)(partition_info *part_info, bool is_subpart, - char *min_val, char *max_val, + uchar *min_val, uchar *max_val, uint flags, PARTITION_ITERATOR *part_iter); diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index bc3e3cf0b05..0344ce2fbb0 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -128,7 +128,7 @@ static st_plugin_dl *plugin_dl_insert_or_reuse(struct st_plugin_dl *plugin_dl) DBUG_RETURN(tmp); } } - if (insert_dynamic(&plugin_dl_array, (gptr)plugin_dl)) + if (insert_dynamic(&plugin_dl_array, (uchar*)plugin_dl)) DBUG_RETURN(0); DBUG_RETURN(dynamic_element(&plugin_dl_array, plugin_dl_array.elements - 1, struct st_plugin_dl *)); @@ -144,7 +144,7 @@ static inline void free_plugin_mem(struct st_plugin_dl *p) #endif my_free(p->dl.str, MYF(MY_ALLOW_ZERO_PTR)); if (p->version != MYSQL_PLUGIN_INTERFACE_VERSION) - my_free((gptr)p->plugins, MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*)p->plugins, MYF(MY_ALLOW_ZERO_PTR)); } static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) @@ -295,7 +295,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) /* Duplicate and convert dll name */ plugin_dl.dl.length= dl->length * files_charset_info->mbmaxlen + 1; - if (! (plugin_dl.dl.str= my_malloc(plugin_dl.dl.length, MYF(0)))) + if (! (plugin_dl.dl.str= (char*) my_malloc(plugin_dl.dl.length, MYF(0)))) { free_plugin_mem(&plugin_dl); if (report & REPORT_TO_USER) @@ -369,14 +369,14 @@ static struct st_plugin_int *plugin_find_internal(const LEX_STRING *name, int ty for (i= 0; i < MYSQL_MAX_PLUGIN_TYPE_NUM; i++) { struct st_plugin_int *plugin= (st_plugin_int *) - hash_search(&plugin_hash[i], (const byte *)name->str, name->length); + hash_search(&plugin_hash[i], (const uchar *)name->str, name->length); if (plugin) DBUG_RETURN(plugin); } } else DBUG_RETURN((st_plugin_int *) - hash_search(&plugin_hash[type], (const byte *)name->str, name->length)); + hash_search(&plugin_hash[type], (const uchar *)name->str, name->length)); DBUG_RETURN(0); } @@ -426,7 +426,7 @@ static st_plugin_int *plugin_insert_or_reuse(struct st_plugin_int *plugin) DBUG_RETURN(tmp); } } - if (insert_dynamic(&plugin_array, (gptr)plugin)) + if (insert_dynamic(&plugin_array, (uchar*)plugin)) DBUG_RETURN(0); DBUG_RETURN(dynamic_element(&plugin_array, plugin_array.elements - 1, struct st_plugin_int *)); @@ -481,7 +481,7 @@ static my_bool plugin_add(const LEX_STRING *name, const LEX_STRING *dl, int repo if (! (tmp_plugin_ptr= plugin_insert_or_reuse(&tmp))) goto err; plugin_array_version++; - if (my_hash_insert(&plugin_hash[plugin->type], (byte*)tmp_plugin_ptr)) + if (my_hash_insert(&plugin_hash[plugin->type], (uchar*)tmp_plugin_ptr)) { tmp_plugin_ptr->state= PLUGIN_IS_FREED; goto err; @@ -546,7 +546,7 @@ void plugin_deinitialize(struct st_plugin_int *plugin) static void plugin_del(struct st_plugin_int *plugin) { DBUG_ENTER("plugin_del(plugin)"); - hash_delete(&plugin_hash[plugin->plugin->type], (byte*)plugin); + hash_delete(&plugin_hash[plugin->plugin->type], (uchar*)plugin); plugin_dl_del(&plugin->plugin_dl->dl); plugin->state= PLUGIN_IS_FREED; plugin_array_version++; @@ -633,12 +633,12 @@ err: DBUG_RETURN(1); } -static byte *get_hash_key(const byte *buff, uint *length, +static uchar *get_hash_key(const uchar *buff, size_t *length, my_bool not_used __attribute__((unused))) { struct st_plugin_int *plugin= (st_plugin_int *)buff; *length= (uint)plugin->name.length; - return((byte *)plugin->name.str); + return((uchar *)plugin->name.str); } @@ -738,11 +738,11 @@ my_bool plugin_register_builtin(struct st_mysql_plugin *plugin) tmp.ref_count= 1; tmp.plugin_dl= 0; - if (insert_dynamic(&plugin_array, (gptr)&tmp)) + if (insert_dynamic(&plugin_array, (uchar*)&tmp)) DBUG_RETURN(1); if (my_hash_insert(&plugin_hash[plugin->type], - (byte*)dynamic_element(&plugin_array, + (uchar*)dynamic_element(&plugin_array, plugin_array.elements - 1, struct st_plugin_int *))) DBUG_RETURN(1); @@ -772,7 +772,7 @@ void plugin_load(void) new_thd->store_globals(); new_thd->db= my_strdup("mysql", MYF(0)); new_thd->db_length= 5; - bzero((gptr)&tables, sizeof(tables)); + bzero((uchar*)&tables, sizeof(tables)); tables.alias= tables.table_name= (char*)"plugin"; tables.lock_type= TL_READ; tables.db= new_thd->db; @@ -945,7 +945,7 @@ my_bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name) table->use_all_columns(); table->field[0]->store(name->str, name->length, system_charset_info); if (! table->file->index_read_idx(table->record[0], 0, - (byte *)table->field[0]->ptr, HA_WHOLE_KEY, + (uchar *)table->field[0]->ptr, HA_WHOLE_KEY, HA_READ_KEY_EXACT)) { int error; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 31a6c7af04a..73f315b2441 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -229,7 +229,7 @@ find_prepared_statement(THD *thd, ulong id, const char *where) static bool send_prep_stmt(Prepared_statement *stmt, uint columns) { NET *net= &stmt->thd->net; - char buff[12]; + uchar buff[12]; uint tmp; DBUG_ENTER("send_prep_stmt"); @@ -946,7 +946,7 @@ static bool insert_params_from_vars(Prepared_statement *stmt, Item_param *param= *it; varname= var_it++; entry= (user_var_entry*)hash_search(&stmt->thd->user_vars, - (byte*) varname->str, + (uchar*) varname->str, varname->length); if (param->set_from_user_var(stmt->thd, entry) || param->convert_str_value(stmt->thd)) @@ -1077,7 +1077,7 @@ static bool mysql_test_insert(Prepared_statement *stmt, if (table_list->table) { // don't allocate insert_values - table_list->table->insert_values=(byte *)1; + table_list->table->insert_values=(uchar *)1; } if (mysql_prepare_insert(thd, table_list, table_list->table, @@ -1590,7 +1590,7 @@ static bool mysql_insert_select_prepare_tester(THD *thd) next_local; /* Skip first table, which is the table we are inserting in */ - first_select->table_list.first= (byte *) second_table; + first_select->table_list.first= (uchar *) second_table; thd->lex->select_lex.context.table_list= thd->lex->select_lex.context.first_name_resolution_table= second_table; @@ -1621,7 +1621,7 @@ static bool mysql_test_insert_select(Prepared_statement *stmt, if (tables->table) { // don't allocate insert_values - tables->table->insert_values=(byte *)1; + tables->table->insert_values=(uchar *)1; } if (insert_precheck(stmt->thd, tables)) @@ -1636,7 +1636,7 @@ static bool mysql_test_insert_select(Prepared_statement *stmt, &mysql_insert_select_prepare_tester, OPTION_SETUP_TABLES_DONE); /* revert changes made by mysql_insert_select_prepare_tester */ - lex->select_lex.table_list.first= (byte*) first_local_table; + lex->select_lex.table_list.first= (uchar*) first_local_table; return res; } @@ -1970,7 +1970,7 @@ static const char *get_dynamic_sql_string(LEX *lex, uint *query_len) */ if ((entry= (user_var_entry*)hash_search(&thd->user_vars, - (byte*)lex->prepared_stmt_code.str, + (uchar*)lex->prepared_stmt_code.str, lex->prepared_stmt_code.length)) && entry->value) { @@ -1999,7 +1999,7 @@ static const char *get_dynamic_sql_string(LEX *lex, uint *query_len) len= (needs_conversion ? var_value->length() * to_cs->mbmaxlen : var_value->length()); - if (!(query_str= alloc_root(thd->mem_root, len+1))) + if (!(query_str= (char*) alloc_root(thd->mem_root, len+1))) goto end; if (needs_conversion) @@ -2352,7 +2352,7 @@ void mysql_sql_stmt_execute(THD *thd) /* Query text for binary, general or slow log, if any of them is open */ String expanded_query; DBUG_ENTER("mysql_sql_stmt_execute"); - DBUG_PRINT("info", ("EXECUTE: %.*s\n", name->length, name->str)); + DBUG_PRINT("info", ("EXECUTE: %.*s\n", (int) name->length, name->str)); if (!(stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name))) { @@ -2540,7 +2540,8 @@ void mysql_sql_stmt_close(THD *thd) { Prepared_statement* stmt; LEX_STRING *name= &thd->lex->prepared_stmt_name; - DBUG_PRINT("info", ("DEALLOCATE PREPARE: %.*s\n", name->length, name->str)); + DBUG_PRINT("info", ("DEALLOCATE PREPARE: %.*s\n", (int) name->length, + name->str)); if (! (stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name))) { @@ -2785,7 +2786,7 @@ void Prepared_statement::cleanup_stmt() bool Prepared_statement::set_name(LEX_STRING *name_arg) { name.length= name_arg->length; - name.str= memdup_root(mem_root, (char*) name_arg->str, name_arg->length); + name.str= (char*) memdup_root(mem_root, name_arg->str, name_arg->length); return name.str == 0; } diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index a7200a772bd..596b13b5123 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -72,7 +72,7 @@ static int fake_rotate_event(NET* net, String* packet, char* log_file_name, int8store(buf+R_POS_OFFSET,position); packet->append(buf, ROTATE_HEADER_LEN); packet->append(p,ident_len); - if (my_net_write(net, (char*)packet->ptr(), packet->length())) + if (my_net_write(net, (uchar*) packet->ptr(), packet->length())) { *errmsg = "failed on my_net_write()"; DBUG_RETURN(-1); @@ -83,12 +83,13 @@ static int fake_rotate_event(NET* net, String* packet, char* log_file_name, static int send_file(THD *thd) { NET* net = &thd->net; - int fd = -1,bytes, error = 1; + int fd = -1, error = 1; + size_t bytes; char fname[FN_REFLEN+1]; const char *errmsg = 0; int old_timeout; unsigned long packet_len; - char buf[IO_SIZE]; // It's safe to alloc this + uchar buf[IO_SIZE]; // It's safe to alloc this DBUG_ENTER("send_file"); /* @@ -121,7 +122,7 @@ static int send_file(THD *thd) goto err; } - while ((bytes = (int) my_read(fd, (byte*) buf, IO_SIZE, MYF(0))) > 0) + while ((long) (bytes= my_read(fd, buf, IO_SIZE, MYF(0))) > 0) { if (my_net_write(net, buf, bytes)) { @@ -131,7 +132,7 @@ static int send_file(THD *thd) } end: - if (my_net_write(net, "", 0) || net_flush(net) || + if (my_net_write(net, (uchar*) "", 0) || net_flush(net) || (my_net_read(net) == packet_error)) { errmsg = "while negotiating file transfer close"; @@ -217,7 +218,8 @@ bool log_in_use(const char* log_name) if ((linfo = tmp->current_linfo)) { pthread_mutex_lock(&linfo->lock); - result = !bcmp(log_name, linfo->log_file_name, log_name_len); + result = !bcmp((uchar*) log_name, (uchar*) linfo->log_file_name, + log_name_len); pthread_mutex_unlock(&linfo->lock); if (result) break; @@ -480,7 +482,7 @@ impossible position"; int4store((char*) packet->ptr()+LOG_EVENT_MINIMAL_HEADER_LEN+ ST_CREATED_OFFSET+1, (ulong) 0); /* send it */ - if (my_net_write(net, (char*)packet->ptr(), packet->length())) + if (my_net_write(net, (uchar*) packet->ptr(), packet->length())) { errmsg = "Failed on my_net_write()"; my_errno= ER_UNKNOWN_ERROR; @@ -538,7 +540,7 @@ impossible position"; else if ((*packet)[EVENT_TYPE_OFFSET+1] == STOP_EVENT) binlog_can_be_corrupted= FALSE; - if (my_net_write(net, (char*)packet->ptr(), packet->length())) + if (my_net_write(net, (uchar*) packet->ptr(), packet->length())) { errmsg = "Failed on my_net_write()"; my_errno= ER_UNKNOWN_ERROR; @@ -651,7 +653,7 @@ impossible position"; if (read_packet) { thd->proc_info = "Sending binlog event to slave"; - if (my_net_write(net, (char*)packet->ptr(), packet->length()) ) + if (my_net_write(net, (uchar*) packet->ptr(), packet->length()) ) { errmsg = "Failed on my_net_write()"; my_errno= ER_UNKNOWN_ERROR; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index dff810e57b0..e67495a08f6 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -76,7 +76,7 @@ static double prev_record_reads(JOIN *join, uint idx, table_map found_ref); static bool get_best_combination(JOIN *join); static store_key *get_store_key(THD *thd, KEYUSE *keyuse, table_map used_tables, - KEY_PART_INFO *key_part, char *key_buff, + KEY_PART_INFO *key_part, uchar *key_buff, uint maybe_null); static bool make_simple_join(JOIN *join,TABLE *tmp_table); static void make_outerjoin_info(JOIN *join); @@ -1298,7 +1298,7 @@ JOIN::optimize() for (ORDER *tmp_order= order; tmp_order ; tmp_order=tmp_order->next) { Item *item= *tmp_order->item; - if (item->walk(&Item::is_expensive_processor, 0, (byte*)0)) + if (item->walk(&Item::is_expensive_processor, 0, (uchar*)0)) { /* Force tmp table without sort */ need_tmp=1; simple_order=simple_group=0; @@ -1511,7 +1511,7 @@ JOIN::save_join_tab() { if (!join_tab_save && select_lex->master_unit()->uncacheable) { - if (!(join_tab_save= (JOIN_TAB*)thd->memdup((gptr) join_tab, + if (!(join_tab_save= (JOIN_TAB*)thd->memdup((uchar*) join_tab, sizeof(JOIN_TAB) * tables))) return 1; } @@ -2733,7 +2733,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds, } else { - memcpy((gptr) join->best_positions,(gptr) join->positions, + memcpy((uchar*) join->best_positions,(uchar*) join->positions, sizeof(POSITION)*join->const_tables); join->best_read=1.0; } @@ -3354,7 +3354,7 @@ add_key_part(DYNAMIC_ARRAY *keyuse_array,KEY_FIELD *key_field) keyuse.optimize= key_field->optimize & KEY_OPTIMIZE_REF_OR_NULL; keyuse.null_rejecting= key_field->null_rejecting; keyuse.cond_guard= key_field->cond_guard; - VOID(insert_dynamic(keyuse_array,(gptr) &keyuse)); + VOID(insert_dynamic(keyuse_array,(uchar*) &keyuse)); } } } @@ -3421,7 +3421,7 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array, keyuse.used_tables=cond_func->key_item()->used_tables(); keyuse.optimize= 0; keyuse.keypart_map= 0; - VOID(insert_dynamic(keyuse_array,(gptr) &keyuse)); + VOID(insert_dynamic(keyuse_array,(uchar*) &keyuse)); } @@ -3636,7 +3636,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab, (qsort_cmp) sort_keyuse); bzero((char*) &key_end,sizeof(key_end)); /* Add for easy testing */ - VOID(insert_dynamic(keyuse,(gptr) &key_end)); + VOID(insert_dynamic(keyuse,(uchar*) &key_end)); use=save_pos=dynamic_element(keyuse,0,KEYUSE*); prev= &key_end; @@ -3671,7 +3671,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab, save_pos++; } i=(uint) (save_pos-(KEYUSE*) keyuse->buffer); - VOID(set_dynamic(keyuse,(gptr) &key_end,i)); + VOID(set_dynamic(keyuse,(uchar*) &key_end,i)); keyuse->elements=i; } return FALSE; @@ -3752,7 +3752,7 @@ add_group_and_distinct_keys(JOIN *join, JOIN_TAB *join_tab) { /* Collect all query fields referenced in the GROUP clause. */ for (cur_group= join->group_list; cur_group; cur_group= cur_group->next) (*cur_group->item)->walk(&Item::collect_item_field_processor, 0, - (byte*) &indexed_fields); + (uchar*) &indexed_fields); } else if (join->select_distinct) { /* Collect all query fields referenced in the SELECT clause. */ @@ -3761,7 +3761,7 @@ add_group_and_distinct_keys(JOIN *join, JOIN_TAB *join_tab) Item *item; while ((item= select_items_it++)) item->walk(&Item::collect_item_field_processor, 0, - (byte*) &indexed_fields); + (uchar*) &indexed_fields); } else return; @@ -4582,7 +4582,7 @@ optimize_straight_join(JOIN *join, table_map join_tables) if (join->sort_by_table && join->sort_by_table != join->positions[join->const_tables].table->table) read_time+= record_count; // We have to make a temp table - memcpy((gptr) join->best_positions, (gptr) join->positions, + memcpy((uchar*) join->best_positions, (uchar*) join->positions, sizeof(POSITION)*idx); join->best_read= read_time; } @@ -4964,7 +4964,7 @@ best_extension_by_limited_search(JOIN *join, current_read_time+= current_record_count; if ((search_depth == 1) || (current_read_time < join->best_read)) { - memcpy((gptr) join->best_positions, (gptr) join->positions, + memcpy((uchar*) join->best_positions, (uchar*) join->positions, sizeof(POSITION) * (idx + 1)); join->best_read= current_read_time - 0.001; } @@ -5002,7 +5002,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count, read_time+=record_count; // We have to make a temp table if (read_time < join->best_read) { - memcpy((gptr) join->best_positions,(gptr) join->positions, + memcpy((uchar*) join->best_positions,(uchar*) join->positions, sizeof(POSITION)*idx); join->best_read= read_time - 0.001; } @@ -5313,7 +5313,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse, j->ref.key_parts=keyparts; j->ref.key_length=length; j->ref.key=(int) key; - if (!(j->ref.key_buff= (byte*) thd->calloc(ALIGN_SIZE(length)*2)) || + if (!(j->ref.key_buff= (uchar*) thd->calloc(ALIGN_SIZE(length)*2)) || !(j->ref.key_copy= (store_key**) thd->alloc((sizeof(store_key*) * (keyparts+1)))) || !(j->ref.items= (Item**) thd->alloc(sizeof(Item*)*keyparts)) || @@ -5327,7 +5327,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse, keyuse=org_keyuse; store_key **ref_key= j->ref.key_copy; - byte *key_buff=j->ref.key_buff, *null_ref_key= 0; + uchar *key_buff=j->ref.key_buff, *null_ref_key= 0; bool keyuse_uses_no_tables= TRUE; if (ftkey) { @@ -5358,8 +5358,8 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse, !(join->select_options & SELECT_DESCRIBE)) { // Compare against constant store_key_item tmp(thd, keyinfo->key_part[i].field, - (char*)key_buff + maybe_null, - maybe_null ? (char*) key_buff : 0, + key_buff + maybe_null, + maybe_null ? key_buff : 0, keyinfo->key_part[i].length, keyuse->val); if (thd->is_fatal_error) DBUG_RETURN(TRUE); @@ -5369,7 +5369,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse, *ref_key++= get_store_key(thd, keyuse,join->const_table_map, &keyinfo->key_part[i], - (char*) key_buff,maybe_null); + key_buff, maybe_null); /* Remember if we are going to use REF_OR_NULL But only if field _really_ can be null i.e. we force JT_REF @@ -5413,7 +5413,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse, static store_key * get_store_key(THD *thd, KEYUSE *keyuse, table_map used_tables, - KEY_PART_INFO *key_part, char *key_buff, uint maybe_null) + KEY_PART_INFO *key_part, uchar *key_buff, uint maybe_null) { if (!((~used_tables) & keyuse->used_tables)) // if const item { @@ -5906,7 +5906,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) { DBUG_EXECUTE("where",print_where(tmp,tab->table->alias);); SQL_SELECT *sel= tab->select= ((SQL_SELECT*) - thd->memdup((gptr) select, + thd->memdup((uchar*) select, sizeof(*select))); if (!sel) DBUG_RETURN(1); // End of memory @@ -6058,7 +6058,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) { DBUG_EXECUTE("where",print_where(tmp,"cache");); tab->cache.select=(SQL_SELECT*) - thd->memdup((gptr) sel, sizeof(SQL_SELECT)); + thd->memdup((uchar*) sel, sizeof(SQL_SELECT)); tab->cache.select->cond=tmp; tab->cache.select->read_tables=join->const_table_map; } @@ -7497,11 +7497,11 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond, as soon the field is not of a string type or the field reference is an argument of a comparison predicate. */ - byte *is_subst_valid= (byte *) 1; + uchar *is_subst_valid= (uchar *) 1; cond= cond->compile(&Item::subst_argument_checker, &is_subst_valid, &Item::equal_fields_propagator, - (byte *) inherited); + (uchar *) inherited); cond->update_used_tables(); } return cond; @@ -9261,7 +9261,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, a tmp_set bitmap to be used by things like filesort. */ -void setup_tmp_table_column_bitmaps(TABLE *table, byte *bitmaps) +void setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps) { uint field_count= table->s->fields; bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count, @@ -9331,7 +9331,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, bool use_packed_rows= 0; bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS); char *tmpname,path[FN_REFLEN]; - byte *pos, *group_buff, *bitmaps; + uchar *pos, *group_buff, *bitmaps; uchar *null_flags; Field **reg_field, **from_field, **default_field; uint *blob_field; @@ -9672,7 +9672,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, { uint alloc_length=ALIGN_SIZE(reclength+MI_UNIQUE_HASH_LENGTH+1); share->rec_buff_length= alloc_length; - if (!(table->record[0]= (byte*) + if (!(table->record[0]= (uchar*) alloc_root(&table->mem_root, alloc_length*3))) goto err; table->record[1]= table->record[0]+alloc_length; @@ -9688,7 +9688,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, pos=table->record[0]+ null_pack_length; if (null_pack_length) { - bzero((byte*) recinfo,sizeof(*recinfo)); + bzero((uchar*) recinfo,sizeof(*recinfo)); recinfo->type=FIELD_NORMAL; recinfo->length=null_pack_length; recinfo++; @@ -9704,7 +9704,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, { Field *field= *reg_field; uint length; - bzero((byte*) recinfo,sizeof(*recinfo)); + bzero((uchar*) recinfo,sizeof(*recinfo)); if (!(field->flags & NOT_NULL_FLAG)) { @@ -9718,19 +9718,19 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, recinfo->length=1; recinfo->type=FIELD_NORMAL; recinfo++; - bzero((byte*) recinfo,sizeof(*recinfo)); + bzero((uchar*) recinfo,sizeof(*recinfo)); } else { recinfo->null_bit= 1 << (null_count & 7); recinfo->null_pos= null_count/8; } - field->move_field((char*) pos,null_flags+null_count/8, + field->move_field(pos,null_flags+null_count/8, 1 << (null_count & 7)); null_count++; } else - field->move_field((char*) pos,(uchar*) 0,0); + field->move_field(pos,(uchar*) 0,0); if (field->type() == MYSQL_TYPE_BIT) { /* We have to reserve place for extra bits among null bits */ @@ -9848,10 +9848,10 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, { cur_group->buff=(char*) group_buff; if (!(cur_group->field= field->new_key_field(thd->mem_root,table, - (char*) group_buff + - test(maybe_null), - field->null_ptr, - field->null_bit))) + group_buff + + test(maybe_null), + field->null_ptr, + field->null_bit))) goto err; /* purecov: inspected */ if (maybe_null) { @@ -9913,7 +9913,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, key_part_info->null_bit=0; key_part_info->offset=hidden_null_pack_length; key_part_info->length=null_pack_length; - key_part_info->field= new Field_string((char*) table->record[0], + key_part_info->field= new Field_string(table->record[0], (uint32) key_part_info->length, (uchar*) 0, (uint) 0, @@ -10002,7 +10002,7 @@ TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list) uint null_count= 0; /* number of columns which may be null */ uint null_pack_length; /* NULL representation array length */ uint *blob_field; - byte *bitmaps; + uchar *bitmaps; TABLE *table; TABLE_SHARE *share; @@ -10053,7 +10053,7 @@ TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list) null_pack_length= (null_count + 7)/8; share->reclength= record_length + null_pack_length; share->rec_buff_length= ALIGN_SIZE(share->reclength + 1); - table->record[0]= (byte*) thd->alloc(share->rec_buff_length); + table->record[0]= (uchar*) thd->alloc(share->rec_buff_length); if (!table->record[0]) goto error; @@ -10067,18 +10067,18 @@ TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list) table->in_use= thd; /* field->reset() may access table->in_use */ { /* Set up field pointers */ - byte *null_pos= table->record[0]; - byte *field_pos= null_pos + share->null_bytes; + uchar *null_pos= table->record[0]; + uchar *field_pos= null_pos + share->null_bytes; uint null_bit= 1; for (field= table->field; *field; ++field) { Field *cur_field= *field; if ((cur_field->flags & NOT_NULL_FLAG)) - cur_field->move_field((char*) field_pos); + cur_field->move_field(field_pos); else { - cur_field->move_field((char*) field_pos, (uchar*) null_pos, null_bit); + cur_field->move_field(field_pos, (uchar*) null_pos, null_bit); null_bit<<= 1; if (null_bit == (1 << 8)) { @@ -10147,7 +10147,7 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param, uniquedef.null_are_equal=1; /* Create extra column for hash value */ - bzero((byte*) param->recinfo,sizeof(*param->recinfo)); + bzero((uchar*) param->recinfo,sizeof(*param->recinfo)); param->recinfo->type= FIELD_CHECK; param->recinfo->length=MI_UNIQUE_HASH_LENGTH; param->recinfo++; @@ -11193,7 +11193,7 @@ join_read_const(JOIN_TAB *tab) else { error=table->file->index_read_idx(table->record[0],tab->ref.key, - (byte*) tab->ref.key_buff, + (uchar*) tab->ref.key_buff, make_prev_keypart_map(tab->ref.key_parts), HA_READ_KEY_EXACT); } @@ -11770,7 +11770,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), if (item->maybe_null) { Field *field=item->get_tmp_table_field(); - field->ptr[-1]= (byte) (field->is_null() ? 1 : 0); + field->ptr[-1]= (uchar) (field->is_null() ? 1 : 0); } } } @@ -12953,7 +12953,7 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field, { handler *file=table->file; char *org_record,*new_record; - byte *record; + uchar *record; int error; ulong reclength= table->s->reclength-offset; DBUG_ENTER("remove_dup_with_compare"); @@ -13044,7 +13044,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, ulong key_length, Item *having) { - byte *key_buffer, *key_pos, *record=table->record[0]; + uchar *key_buffer, *key_pos, *record=table->record[0]; int error; handler *file= table->file; ulong extra_length= ALIGN_SIZE(key_length)-key_length; @@ -13088,7 +13088,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, key_pos=key_buffer; for (;;) { - byte *org_key_pos; + uchar *org_key_pos; if (thd->killed) { thd->send_kill_message(); @@ -13115,7 +13115,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, field_length=field_lengths; for (Field **ptr= first_field ; *ptr ; ptr++) { - (*ptr)->sort_string((char*) key_pos,*field_length); + (*ptr)->sort_string(key_pos,*field_length); key_pos+= *field_length++; } /* Check if it exists before */ @@ -13218,7 +13218,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) sizeof(CACHE_FIELD*)))) { - my_free((gptr) cache->buff,MYF(0)); /* purecov: inspected */ + my_free((uchar*) cache->buff,MYF(0)); /* purecov: inspected */ cache->buff=0; /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */ } @@ -13251,7 +13251,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) /* Copy null bits from table */ if (null_fields && tables[i].table->s->null_fields) { /* must copy null bits */ - copy->str=(char*) tables[i].table->null_flags; + copy->str= tables[i].table->null_flags; copy->length= tables[i].table->s->null_bytes; copy->strip=0; copy->blob_field=0; @@ -13262,7 +13262,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) /* If outer join table, copy null_row flag */ if (tables[i].table->maybe_null) { - copy->str= (char*) &tables[i].table->null_row; + copy->str= (uchar*) &tables[i].table->null_row; copy->length=sizeof(tables[i].table->null_row); copy->strip=0; copy->blob_field=0; @@ -13325,13 +13325,13 @@ store_record_in_cache(JOIN_CACHE *cache) { if (last_record) { - copy->blob_field->get_image((char*) pos,copy->length+sizeof(char*), + copy->blob_field->get_image(pos, copy->length+sizeof(char*), copy->blob_field->charset()); pos+=copy->length+sizeof(char*); } else { - copy->blob_field->get_image((char*) pos,copy->length, // blob length + copy->blob_field->get_image(pos, copy->length, // blob length copy->blob_field->charset()); memcpy(pos+copy->length,copy->str,copy->blob_length); // Blob data pos+=copy->length+copy->blob_length; @@ -13341,7 +13341,7 @@ store_record_in_cache(JOIN_CACHE *cache) { if (copy->strip) { - char *str,*end; + uchar *str,*end; for (str=copy->str,end= str+copy->length; end > str && end[-1] == ' ' ; end--) ; @@ -13397,13 +13397,13 @@ read_cached_record(JOIN_TAB *tab) { if (last_record) { - copy->blob_field->set_image((char*) pos,copy->length+sizeof(char*), + copy->blob_field->set_image(pos, copy->length+sizeof(char*), copy->blob_field->charset()); pos+=copy->length+sizeof(char*); } else { - copy->blob_field->set_ptr((char*) pos,(char*) pos+copy->length); + copy->blob_field->set_ptr(pos, pos+copy->length); pos+=copy->length+copy->blob_field->get_length(); } } @@ -14153,7 +14153,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, for (i= 0; (pos= li++); i++) { Field *field; - char *tmp; + uchar *tmp; Item *real_pos= pos->real_item(); if (real_pos->type() == Item::FIELD_ITEM) { @@ -14198,8 +14198,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, another extra byte to not get warnings from purify in Field_string::val_int */ - tmp= (char*) sql_alloc(field->pack_length()+2); - if (!tmp) + if (!(tmp= (uchar*) sql_alloc(field->pack_length()+2))) goto err; if (copy) { diff --git a/sql/sql_select.h b/sql/sql_select.h index ca37c7bd274..4b8d07ff88b 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -56,8 +56,8 @@ typedef struct st_table_ref uint key_parts; // num of ... uint key_length; // length of key_buff int key; // key no - byte *key_buff; // value to look for with key - byte *key_buff2; // key_buff+key_length + uchar *key_buff; // value to look for with key + uchar *key_buff2; // key_buff+key_length store_key **key_copy; // Item **items; // val()'s for each keypart /* @@ -79,7 +79,7 @@ typedef struct st_table_ref key_part_map null_rejecting; table_map depend_map; // Table depends on these tables. /* null byte position in the key_buf. Used for REF_OR_NULL optimization */ - byte *null_ref_key; + uchar *null_ref_key; } TABLE_REF; @@ -89,8 +89,8 @@ typedef struct st_table_ref */ typedef struct st_cache_field { - char *str; - uint length,blob_length; + uchar *str; + uint length, blob_length; Field_blob *blob_field; bool strip; } CACHE_FIELD; @@ -530,20 +530,20 @@ class store_key :public Sql_alloc public: bool null_key; /* TRUE <=> the value of the key has a null part */ enum store_key_result { STORE_KEY_OK, STORE_KEY_FATAL, STORE_KEY_CONV }; - store_key(THD *thd, Field *field_arg, char *ptr, char *null, uint length) + store_key(THD *thd, Field *field_arg, uchar *ptr, uchar *null, uint length) :null_key(0), null_ptr(null), err(0) { if (field_arg->type() == MYSQL_TYPE_BLOB) { /* Key segments are always packed with a 2 byte length prefix */ - to_field= new Field_varstring(ptr, length, 2, (uchar*) null, 1, + to_field= new Field_varstring(ptr, length, 2, null, 1, Field::NONE, field_arg->field_name, field_arg->table->s, field_arg->charset()); to_field->init(field_arg->table); } else to_field=field_arg->new_key_field(thd->mem_root, field_arg->table, - ptr, (uchar*) null, 1); + ptr, null, 1); } virtual ~store_key() {} /* Not actually needed */ virtual const char *name() const=0; @@ -571,8 +571,8 @@ public: protected: Field *to_field; // Store data here - char *null_ptr; - char err; + uchar *null_ptr; + uchar err; virtual enum store_key_result copy_inner()=0; }; @@ -583,11 +583,12 @@ class store_key_field: public store_key Copy_field copy_field; const char *field_name; public: - store_key_field(THD *thd, Field *to_field_arg, char *ptr, char *null_ptr_arg, + store_key_field(THD *thd, Field *to_field_arg, uchar *ptr, + uchar *null_ptr_arg, uint length, Field *from_field, const char *name_arg) :store_key(thd, to_field_arg,ptr, null_ptr_arg ? null_ptr_arg : from_field->maybe_null() ? &err - : NullS,length), field_name(name_arg) + : (uchar*) 0, length), field_name(name_arg) { if (to_field) { @@ -615,11 +616,11 @@ class store_key_item :public store_key protected: Item *item; public: - store_key_item(THD *thd, Field *to_field_arg, char *ptr, char *null_ptr_arg, - uint length, Item *item_arg) - :store_key(thd, to_field_arg,ptr, + store_key_item(THD *thd, Field *to_field_arg, uchar *ptr, + uchar *null_ptr_arg, uint length, Item *item_arg) + :store_key(thd, to_field_arg, ptr, null_ptr_arg ? null_ptr_arg : item_arg->maybe_null ? - &err : NullS, length), item(item_arg) + &err : (uchar*) 0, length), item(item_arg) {} const char *name() const { return "func"; } @@ -641,12 +642,12 @@ class store_key_const_item :public store_key_item { bool inited; public: - store_key_const_item(THD *thd, Field *to_field_arg, char *ptr, - char *null_ptr_arg, uint length, + store_key_const_item(THD *thd, Field *to_field_arg, uchar *ptr, + uchar *null_ptr_arg, uint length, Item *item_arg) :store_key_item(thd, to_field_arg,ptr, null_ptr_arg ? null_ptr_arg : item_arg->maybe_null ? - &err : NullS, length, item_arg), inited(0) + &err : (uchar*) 0, length, item_arg), inited(0) { } const char *name() const { return "const"; } diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc index a62ce98850b..195e6743a72 100644 --- a/sql/sql_servers.cc +++ b/sql/sql_servers.cc @@ -77,7 +77,7 @@ static void merge_server_struct(FOREIGN_SERVER *from, FOREIGN_SERVER *to); -static byte *servers_cache_get_key(FOREIGN_SERVER *server, uint *length, +static uchar *servers_cache_get_key(FOREIGN_SERVER *server, size_t *length, my_bool not_used __attribute__((unused))) { DBUG_ENTER("servers_cache_get_key"); @@ -86,7 +86,7 @@ static byte *servers_cache_get_key(FOREIGN_SERVER *server, uint *length, server->server_name)); *length= (uint) server->server_name_length; - DBUG_RETURN((byte*) server->server_name); + DBUG_RETURN((uchar*) server->server_name); } @@ -323,7 +323,7 @@ get_server_from_table_to_cache(TABLE *table) DBUG_PRINT("info", ("server->username %s", server->username)); DBUG_PRINT("info", ("server->password %s", server->password)); DBUG_PRINT("info", ("server->socket %s", server->socket)); - if (my_hash_insert(&servers_cache, (byte*) server)) + if (my_hash_insert(&servers_cache, (uchar*) server)) { DBUG_PRINT("info", ("had a problem inserting server %s at %lx", server->server_name, (long unsigned int) server)); @@ -411,7 +411,7 @@ insert_server_record_into_cache(FOREIGN_SERVER *server) DBUG_PRINT("info", ("inserting server %s at %lx, length %d", server->server_name, (long unsigned int) server, server->server_name_length)); - if (my_hash_insert(&servers_cache, (byte*) server)) + if (my_hash_insert(&servers_cache, (uchar*) server)) { DBUG_PRINT("info", ("had a problem inserting server %s at %lx", server->server_name, (long unsigned int) server)); @@ -517,7 +517,7 @@ int insert_server_record(TABLE *table, FOREIGN_SERVER *server) /* read index until record is that specified in server_name */ if ((error= table->file->index_read_idx(table->record[0], 0, - (byte *)table->field[0]->ptr, HA_WHOLE_KEY, + (uchar *)table->field[0]->ptr, HA_WHOLE_KEY, HA_READ_KEY_EXACT))) { /* if not found, err */ @@ -642,7 +642,7 @@ delete_server_record_in_cache(LEX_SERVER_OPTIONS *server_options) if (!(server= (FOREIGN_SERVER *) hash_search(&servers_cache, - (byte*) server_options->server_name, + (uchar*) server_options->server_name, server_options->server_name_length))) { DBUG_PRINT("info", ("server_name %s length %d not found!", @@ -658,7 +658,7 @@ delete_server_record_in_cache(LEX_SERVER_OPTIONS *server_options) server->server_name, server->server_name_length)); - VOID(hash_delete(&servers_cache, (byte*) server)); + VOID(hash_delete(&servers_cache, (uchar*) server)); error= 0; @@ -765,12 +765,12 @@ int update_server_record_in_cache(FOREIGN_SERVER *existing, /* delete the existing server struct from the server cache */ - VOID(hash_delete(&servers_cache, (byte*)existing)); + VOID(hash_delete(&servers_cache, (uchar*)existing)); /* Insert the altered server struct into the server cache */ - if (my_hash_insert(&servers_cache, (byte*)altered)) + if (my_hash_insert(&servers_cache, (uchar*)altered)) { DBUG_PRINT("info", ("had a problem inserting server %s at %lx", altered->server_name, (long unsigned int) altered)); @@ -859,7 +859,7 @@ update_server_record(TABLE *table, FOREIGN_SERVER *server) system_charset_info); if ((error= table->file->index_read_idx(table->record[0], 0, - (byte *)table->field[0]->ptr, ~(longlong)0, + (uchar *)table->field[0]->ptr, ~(longlong)0, HA_READ_KEY_EXACT))) { if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE) @@ -911,7 +911,7 @@ delete_server_record(TABLE *table, table->field[0]->store(server_name, server_name_length, system_charset_info); if ((error= table->file->index_read_idx(table->record[0], 0, - (byte *)table->field[0]->ptr, HA_WHOLE_KEY, + (uchar *)table->field[0]->ptr, HA_WHOLE_KEY, HA_READ_KEY_EXACT))) { if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE) @@ -954,7 +954,7 @@ int create_server(THD *thd, LEX_SERVER_OPTIONS *server_options) rw_wrlock(&THR_LOCK_servers); /* hit the memory first */ - if (hash_search(&servers_cache, (byte*) server_options->server_name, + if (hash_search(&servers_cache, (uchar*) server_options->server_name, server_options->server_name_length)) goto end; @@ -1000,7 +1000,7 @@ int alter_server(THD *thd, LEX_SERVER_OPTIONS *server_options) rw_wrlock(&THR_LOCK_servers); if (!(existing= (FOREIGN_SERVER *) hash_search(&servers_cache, - (byte*) name.str, + (uchar*) name.str, name.length))) goto end; @@ -1260,7 +1260,7 @@ FOREIGN_SERVER *get_server_by_name(MEM_ROOT *mem, const char *server_name, DBUG_PRINT("info", ("locking servers_cache")); rw_rdlock(&THR_LOCK_servers); if (!(server= (FOREIGN_SERVER *) hash_search(&servers_cache, - (byte*) server_name, + (uchar*) server_name, server_name_length))) { DBUG_PRINT("info", ("server_name %s length %d not found!", diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e4e0fb22a5e..09a00901dda 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -830,7 +830,7 @@ mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd) } else { - if (my_write(fd, (const byte*) packet->ptr(), packet->length(), + if (my_write(fd, (const uchar*) packet->ptr(), packet->length(), MYF(MY_WME))) DBUG_RETURN(-1); } @@ -1659,7 +1659,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) if (tmp->peer_port && (tmp_sctx->host || tmp_sctx->ip) && thd->security_ctx->host_or_ip[0]) { - if ((thd_info->host= thd->alloc(LIST_PROCESS_HOST_LEN+1))) + if ((thd_info->host= (char*) thd->alloc(LIST_PROCESS_HOST_LEN+1))) my_snprintf((char *) thd_info->host, LIST_PROCESS_HOST_LEN, "%s:%u", tmp_sctx->host_or_ip, tmp->peer_port); } @@ -1911,8 +1911,8 @@ int add_status_vars(SHOW_VAR *list) goto err; } while (list->name) - res|= insert_dynamic(&all_status_vars, (gptr)list++); - res|= insert_dynamic(&all_status_vars, (gptr)list); // appending NULL-element + res|= insert_dynamic(&all_status_vars, (uchar*)list++); + res|= insert_dynamic(&all_status_vars, (uchar*)list); // appending NULL-element all_status_vars.elements--; // but next insert_dynamic should overwite it if (status_vars_inited) sort_dynamic(&all_status_vars, show_var_cmp); @@ -3080,7 +3080,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, for (ptr=show_table->field; (field= *ptr) ; ptr++) { const char *tmp_buff; - byte *pos; + uchar *pos; bool is_blob; uint flags=field->flags; char tmp[MAX_FIELD_WIDTH]; @@ -3158,7 +3158,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, table->field[5]->store("",0, cs); table->field[5]->set_notnull(); } - pos=(byte*) ((flags & NOT_NULL_FLAG) ? "NO" : "YES"); + pos=(uchar*) ((flags & NOT_NULL_FLAG) ? "NO" : "YES"); table->field[6]->store((const char*) pos, strlen((const char*) pos), cs); is_blob= (field->type() == MYSQL_TYPE_BLOB); @@ -3226,16 +3226,16 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, if (field->has_charset()) { - pos=(byte*) field->charset()->csname; + pos=(uchar*) field->charset()->csname; table->field[12]->store((const char*) pos, strlen((const char*) pos), cs); table->field[12]->set_notnull(); - pos=(byte*) field->charset()->name; + pos=(uchar*) field->charset()->name; table->field[13]->store((const char*) pos, strlen((const char*) pos), cs); table->field[13]->set_notnull(); } - pos=(byte*) ((field->flags & PRI_KEY_FLAG) ? "PRI" : + pos=(uchar*) ((field->flags & PRI_KEY_FLAG) ? "PRI" : (field->flags & UNIQUE_KEY_FLAG) ? "UNI" : (field->flags & MULTIPLE_KEY_FLAG) ? "MUL":""); table->field[15]->store((const char*) pos, @@ -3955,6 +3955,7 @@ static int get_schema_key_column_usage_record(THD *thd, } +#ifdef WITH_PARTITION_STORAGE_ENGINE static void collect_partition_expr(List<char> &field_list, String *str) { List_iterator<char> part_it(field_list); @@ -3969,6 +3970,7 @@ static void collect_partition_expr(List<char> &field_list, String *str) } return; } +#endif static void store_schema_partitions_record(THD *thd, TABLE *schema_table, @@ -5985,7 +5987,7 @@ int initialize_schema_table(st_plugin_int *plugin) DBUG_RETURN(0); err: - my_free((gptr)schema_table, MYF(0)); + my_free(schema_table, MYF(0)); DBUG_RETURN(1); } @@ -6002,8 +6004,7 @@ int finalize_schema_table(st_plugin_int *plugin) DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.", plugin->name.str)); } - my_free((gptr)schema_table, MYF(0)); + my_free(schema_table, MYF(0)); } - DBUG_RETURN(0); } diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 52af2f2dd90..6c7dea6bf22 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -32,7 +32,7 @@ required by the string function */ -extern gptr sql_alloc(unsigned size); +extern uchar* sql_alloc(unsigned size); extern void sql_element_free(void *ptr); #include "sql_string.h" @@ -496,7 +496,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; @@ -510,7 +510,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; @@ -635,7 +635,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) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 1047b1ec35d..d19fcfd57fb 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -409,11 +409,11 @@ static bool read_ddl_log_file_entry(uint entry_no) { bool error= FALSE; File file_id= global_ddl_log.file_id; - char *file_entry_buf= (char*)global_ddl_log.file_entry_buf; + uchar *file_entry_buf= (uchar*)global_ddl_log.file_entry_buf; uint io_size= global_ddl_log.io_size; DBUG_ENTER("read_ddl_log_file_entry"); - if (my_pread(file_id, (byte*)file_entry_buf, io_size, io_size * entry_no, + if (my_pread(file_id, file_entry_buf, io_size, io_size * entry_no, MYF(MY_WME)) != io_size) error= TRUE; DBUG_RETURN(error); @@ -437,7 +437,7 @@ static bool write_ddl_log_file_entry(uint entry_no) char *file_entry_buf= (char*)global_ddl_log.file_entry_buf; DBUG_ENTER("write_ddl_log_file_entry"); - if (my_pwrite(file_id, (byte*)file_entry_buf, + if (my_pwrite(file_id, (uchar*)file_entry_buf, IO_SIZE, IO_SIZE * entry_no, MYF(MY_WME)) != IO_SIZE) error= TRUE; DBUG_RETURN(error); @@ -650,7 +650,9 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry) int error= TRUE; char to_path[FN_REFLEN]; char from_path[FN_REFLEN]; +#ifdef WITH_PARTITION_STORAGE_ENGINE char *par_ext= (char*)".par"; +#endif handlerton *hton; DBUG_ENTER("execute_ddl_log_action"); @@ -1235,13 +1237,13 @@ void release_ddl_log() while (used_list) { DDL_LOG_MEMORY_ENTRY *tmp= used_list->next_log_entry; - my_free((char*)used_list, MYF(0)); + my_free(used_list, MYF(0)); used_list= tmp; } while (free_list) { DDL_LOG_MEMORY_ENTRY *tmp= free_list->next_log_entry; - my_free((char*)free_list, MYF(0)); + my_free(free_list, MYF(0)); free_list= tmp; } close_ddl_log(); @@ -1365,13 +1367,13 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) handlers that have the main version of the frm file stored in the handler. */ - const void *data= 0; - uint length= 0; + uchar *data; + size_t length; if (readfrm(shadow_path, &data, &length) || packfrm(data, length, &lpt->pack_frm_data, &lpt->pack_frm_len)) { - my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*)lpt->pack_frm_data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(lpt->pack_frm_data, MYF(MY_ALLOW_ZERO_PTR)); mem_alloc_error(length); error= 1; goto end; @@ -3024,7 +3026,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, DBUG_RETURN(-1); } /* Sort keys in optimized order */ - qsort((gptr) *key_info_buffer, *key_count, sizeof(KEY), + qsort((uchar*) *key_info_buffer, *key_count, sizeof(KEY), (qsort_cmp) sort_keys); create_info->null_bits= null_fields; @@ -3597,7 +3599,7 @@ bool mysql_create_table(THD *thd, const char *db, const char *table_name, /* Wait for any database locks */ pthread_mutex_lock(&LOCK_lock_db); while (!thd->killed && - hash_search(&lock_db_cache,(byte*) db, strlen(db))) + hash_search(&lock_db_cache,(uchar*) db, strlen(db))) { wait_for_condition(thd, &LOCK_lock_db, &COND_refresh); pthread_mutex_lock(&LOCK_lock_db); @@ -4107,7 +4109,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, table->next_global= 0; save_next_local= table->next_local; table->next_local= 0; - select->table_list.first= (byte*)table; + select->table_list.first= (uchar*)table; /* Time zone tables and SP tables can be add to lex->query_tables list, so it have to be prepared. @@ -4719,7 +4721,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, } } - bzero((gptr)&src_tables_list, sizeof(src_tables_list)); + bzero((uchar*)&src_tables_list, sizeof(src_tables_list)); src_tables_list.db= src_db; src_tables_list.db_length= table_ident->db.length; src_tables_list.lock_type= TL_READ; @@ -4853,7 +4855,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, if (open_tables(thd, &table, &counter, 0)) goto err; - bzero((gptr)&dst_tables_list, sizeof(dst_tables_list)); + bzero((uchar*)&dst_tables_list, sizeof(dst_tables_list)); dst_tables_list.db= table->db; dst_tables_list.table_name= table->table_name; @@ -6505,7 +6507,7 @@ view_err: { /* Close the intermediate table that will be the new table */ intern_close_table(new_table); - my_free((gptr) new_table,MYF(0)); + my_free(new_table,MYF(0)); } VOID(pthread_mutex_lock(&LOCK_open)); if (error) @@ -6720,7 +6722,7 @@ view_err: if (table) { intern_close_table(table); - my_free((char*) table, MYF(0)); + my_free(table, MYF(0)); } else sql_print_warning("Could not open table %s.%s after rename\n", @@ -6885,7 +6887,7 @@ copy_data_between_tables(TABLE *from,TABLE *to, copy_ptr->do_copy(copy_ptr); } prev_insert_id= to->file->next_insert_id; - error=to->file->write_row((byte*) to->record[0]); + error=to->file->write_row(to->record[0]); to->auto_increment_field_not_null= FALSE; if (error) { @@ -7071,10 +7073,10 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables, { String tmp; f->val_str(&tmp); - row_crc= my_checksum(row_crc, (byte*) tmp.ptr(), tmp.length()); + row_crc= my_checksum(row_crc, (uchar*) tmp.ptr(), tmp.length()); } else - row_crc= my_checksum(row_crc, (byte*) f->ptr, + row_crc= my_checksum(row_crc, f->ptr, f->pack_length()); } diff --git a/sql/sql_test.cc b/sql/sql_test.cc index d7573b42c5f..d36175908df 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -349,7 +349,7 @@ static void push_locks_into_array(DYNAMIC_ARRAY *ar, THR_LOCK_DATA *data, table_lock_info.lock_text=text; // lock_type is also obtainable from THR_LOCK_DATA table_lock_info.type=table->reginfo.lock_type; - VOID(push_dynamic(ar,(gptr) &table_lock_info)); + VOID(push_dynamic(ar,(uchar*) &table_lock_info)); } } } @@ -394,7 +394,7 @@ static void display_table_locks(void) VOID(pthread_mutex_unlock(&THR_LOCK_lock)); if (!saved_table_locks.elements) goto end; - qsort((gptr) dynamic_element(&saved_table_locks,0,TABLE_LOCK_INFO *),saved_table_locks.elements,sizeof(TABLE_LOCK_INFO),(qsort_cmp) dl_compare); + qsort((uchar*) dynamic_element(&saved_table_locks,0,TABLE_LOCK_INFO *),saved_table_locks.elements,sizeof(TABLE_LOCK_INFO),(qsort_cmp) dl_compare); freeze_size(&saved_table_locks); puts("\nThread database.table_name Locked/Waiting Lock_type\n"); diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 7b4deba527a..4540cab99c3 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -114,7 +114,7 @@ public: Handle_old_incorrect_sql_modes_hook(char *file_path) :path(file_path) {}; - virtual bool process_unknown_string(char *&unknown_key, gptr base, + virtual bool process_unknown_string(char *&unknown_key, uchar* base, MEM_ROOT *mem_root, char *end); }; @@ -125,7 +125,7 @@ public: LEX_STRING *trigger_table_arg) :path(file_path), trigger_table_value(trigger_table_arg) {}; - virtual bool process_unknown_string(char *&unknown_key, gptr base, + virtual bool process_unknown_string(char *&unknown_key, uchar* base, MEM_ROOT *mem_root, char *end); private: char *path; @@ -484,7 +484,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, trigname.trigger_table.length= tables->table_name_length; if (sql_create_definition_file(NULL, &trigname_file, &trigname_file_type, - (gptr)&trigname, trigname_file_parameters, 0)) + (uchar*)&trigname, trigname_file_parameters, 0)) return 1; /* @@ -574,7 +574,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, /* Create trigger definition file. */ if (!sql_create_definition_file(NULL, &file, &triggers_file_type, - (gptr)this, triggers_file_parameters, 0)) + (uchar*)this, triggers_file_parameters, 0)) return 0; err_with_cleanup: @@ -654,7 +654,7 @@ static bool save_trigger_file(Table_triggers_list *triggers, const char *db, triggers_file_ext, 0); file.str= file_buff; return sql_create_definition_file(NULL, &file, &triggers_file_type, - (gptr)triggers, triggers_file_parameters, + (uchar*)triggers, triggers_file_parameters, 0); } @@ -865,7 +865,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, triggers->definition_modes_list.empty(); triggers->definers_list.empty(); - if (parser->parse((gptr)triggers, &table->mem_root, + if (parser->parse((uchar*)triggers, &table->mem_root, triggers_file_parameters, TRG_NUM_REQUIRED_PARAMETERS, &sql_modes_hook)) @@ -945,7 +945,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, of routines used by statement. */ triggers->sroutines_key.length= 1+strlen(db)+1+strlen(table_name)+1; - if (!(triggers->sroutines_key.str= + if (!(triggers->sroutines_key.str= (char*) alloc_root(&table->mem_root, triggers->sroutines_key.length))) DBUG_RETURN(1); triggers->sroutines_key.str[0]= TYPE_ENUM_TRIGGER; @@ -1219,7 +1219,7 @@ add_table_for_trigger(THD *thd, sp_name *trig, bool if_exists, DBUG_RETURN(1); } - if (parser->parse((gptr)&trigname, thd->mem_root, + if (parser->parse((uchar*)&trigname, thd->mem_root, trigname_file_parameters, 1, &trigger_table_hook)) DBUG_RETURN(1); @@ -1356,8 +1356,8 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd, It is OK to allocate some memory on table's MEM_ROOT since this table instance will be thrown out at the end of rename anyway. */ - new_def.str= memdup_root(&trigger_table->mem_root, buff.ptr(), - buff.length()); + new_def.str= (char*) memdup_root(&trigger_table->mem_root, buff.ptr(), + buff.length()); new_def.length= buff.length(); on_table_name->str= new_def.str + before_on_len; on_table_name->length= on_q_table_name_len; @@ -1418,7 +1418,7 @@ Table_triggers_list::change_table_name_in_trignames(const char *db_name, trigname.trigger_table= *new_table_name; if (sql_create_definition_file(NULL, &trigname_file, &trigname_file_type, - (gptr)&trigname, trigname_file_parameters, + (uchar*)&trigname, trigname_file_parameters, 0)) return trigger; } @@ -1659,7 +1659,7 @@ void Table_triggers_list::mark_fields_used(trg_event_type event) bool Handle_old_incorrect_sql_modes_hook::process_unknown_string(char *&unknown_key, - gptr base, + uchar* base, MEM_ROOT *mem_root, char *end) { @@ -1702,7 +1702,7 @@ Handle_old_incorrect_sql_modes_hook::process_unknown_string(char *&unknown_key, bool Handle_old_incorrect_trigger_table_hook:: -process_unknown_string(char *&unknown_key, gptr base, MEM_ROOT *mem_root, +process_unknown_string(char *&unknown_key, uchar* base, MEM_ROOT *mem_root, char *end) { DBUG_ENTER("Handle_old_incorrect_trigger_table_hook::process_unknown_string"); diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 89084c21c0c..2ebdbdf0cd0 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -92,12 +92,12 @@ static char *init_syms(udf_func *tmp, char *nm) } -extern "C" byte* get_hash_key(const byte *buff,uint *length, +extern "C" uchar* get_hash_key(const uchar *buff, size_t *length, my_bool not_used __attribute__((unused))) { udf_func *udf=(udf_func*) buff; *length=(uint) udf->name.length; - return (byte*) udf->name.str; + return (uchar*) udf->name.str; } @@ -137,7 +137,7 @@ void udf_init() new_thd->store_globals(); new_thd->set_db(db, sizeof(db)-1); - bzero((gptr) &tables,sizeof(tables)); + bzero((uchar*) &tables,sizeof(tables)); tables.alias= tables.table_name= (char*) "func"; tables.lock_type = TL_READ; tables.db= db; @@ -260,7 +260,7 @@ static void del_udf(udf_func *udf) DBUG_ENTER("del_udf"); if (!--udf->usage_count) { - hash_delete(&udf_hash,(byte*) udf); + hash_delete(&udf_hash,(uchar*) udf); using_udf_functions=udf_hash.records != 0; } else @@ -274,7 +274,7 @@ static void del_udf(udf_func *udf) uint name_length=udf->name.length; udf->name.str=(char*) "*"; udf->name.length=1; - hash_update(&udf_hash,(byte*) udf,(byte*) name,name_length); + hash_update(&udf_hash,(uchar*) udf,(uchar*) name,name_length); } DBUG_VOID_RETURN; } @@ -294,7 +294,7 @@ void free_udf(udf_func *udf) We come here when someone has deleted the udf function while another thread still was using the udf */ - hash_delete(&udf_hash,(byte*) udf); + hash_delete(&udf_hash,(uchar*) udf); using_udf_functions=udf_hash.records != 0; if (!find_udf_dl(udf->dl)) dlclose(udf->dlhandle); @@ -320,7 +320,7 @@ udf_func *find_udf(const char *name,uint length,bool mark_used) else rw_rdlock(&THR_LOCK_udf); /* Called during parsing */ - if ((udf=(udf_func*) hash_search(&udf_hash,(byte*) name, + if ((udf=(udf_func*) hash_search(&udf_hash,(uchar*) name, length ? length : (uint) strlen(name)))) { if (!udf->dlhandle) @@ -367,7 +367,7 @@ static udf_func *add_udf(LEX_STRING *name, Item_result ret, char *dl, tmp->returns = ret; tmp->type = type; tmp->usage_count=1; - if (my_hash_insert(&udf_hash,(byte*) tmp)) + if (my_hash_insert(&udf_hash,(uchar*) tmp)) return 0; using_udf_functions=1; return tmp; @@ -415,7 +415,7 @@ int mysql_create_function(THD *thd,udf_func *udf) thd->clear_current_stmt_binlog_row_based(); rw_wrlock(&THR_LOCK_udf); - if ((hash_search(&udf_hash,(byte*) udf->name.str, udf->name.length))) + if ((hash_search(&udf_hash,(uchar*) udf->name.str, udf->name.length))) { my_error(ER_UDF_EXISTS, MYF(0), udf->name); goto err; @@ -519,7 +519,7 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name) thd->clear_current_stmt_binlog_row_based(); rw_wrlock(&THR_LOCK_udf); - if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name->str, + if (!(udf=(udf_func*) hash_search(&udf_hash,(uchar*) udf_name->str, (uint) udf_name->length))) { my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), udf_name->str); @@ -543,7 +543,7 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name) table->use_all_columns(); table->field[0]->store(exact_name_str, exact_name_len, &my_charset_bin); if (!table->file->index_read_idx(table->record[0], 0, - (byte*) table->field[0]->ptr, HA_WHOLE_KEY, + (uchar*) table->field[0]->ptr, HA_WHOLE_KEY, HA_READ_KEY_EXACT)) { int error; diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 2a1db422058..0197b9a9abc 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -144,8 +144,8 @@ void st_select_lex_unit::init_prepare_fake_select_lex(THD *thd_arg) { thd_arg->lex->current_select= fake_select_lex; - fake_select_lex->table_list.link_in_list((byte *)&result_table_list, - (byte **) + fake_select_lex->table_list.link_in_list((uchar *)&result_table_list, + (uchar **) &result_table_list.next_local); fake_select_lex->context.table_list= fake_select_lex->context.first_name_resolution_table= fake_select_lex->get_table_list(); @@ -154,7 +154,7 @@ st_select_lex_unit::init_prepare_fake_select_lex(THD *thd_arg) order=order->next) { (*order->item)->walk(&Item::change_context_processor, 0, - (byte*) &fake_select_lex->context); + (uchar*) &fake_select_lex->context); } } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 6c501562b1c..0ce8d7e9113 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -544,8 +544,8 @@ int mysql_update(THD *thd, else { /* Non-batched update */ - error= table->file->ha_update_row((byte*) table->record[1], - (byte*) table->record[0]); + error= table->file->ha_update_row(table->record[1], + table->record[0]); } if (!error) { @@ -1131,7 +1131,7 @@ int multi_update::prepare(List<Item> ¬_used_values, sizeof(*tl)); if (!tl) DBUG_RETURN(1); - update.link_in_list((byte*) tl, (byte**) &tl->next_local); + update.link_in_list((uchar*) tl, (uchar**) &tl->next_local); tl->shared= table_count++; table->no_keyread=1; table->covering_keys.clear_all(); @@ -1536,7 +1536,7 @@ int multi_update::do_updates(bool from_send_error) DBUG_RETURN(0); for (cur_table= update_tables; cur_table; cur_table= cur_table->next_local) { - byte *ref_pos; + uchar *ref_pos; bool can_compare_record; table = cur_table->table; @@ -1569,7 +1569,7 @@ int multi_update::do_updates(bool from_send_error) bitmap_is_subset(table->write_set, table->read_set)); - ref_pos= (byte*) tmp_table->field[0]->ptr; + ref_pos= tmp_table->field[0]->ptr; for (;;) { if (thd->killed && trans_safe) diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 9dc7d2100d6..a8816d611c5 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -754,7 +754,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, TODO: read dependence list, too, to process cascade/restrict TODO: special cascade/restrict procedure for alter? */ - if (parser->parse((gptr)view, thd->mem_root, + if (parser->parse((uchar*)view, thd->mem_root, view_parameters + revision_number_position, 1, &file_parser_dummy_hook)) { @@ -846,7 +846,7 @@ loop_out: } if (sql_create_definition_file(&dir, &file, view_file_type, - (gptr)view, view_parameters, num_view_backups)) + (uchar*)view, view_parameters, num_view_backups)) { DBUG_RETURN(thd->net.report_error? -1 : 1); } @@ -945,7 +945,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, TODO: when VIEWs will be stored in cache, table mem_root should be used here */ - if (parser->parse((gptr)table, thd->mem_root, view_parameters, + if (parser->parse((uchar*)table, thd->mem_root, view_parameters, required_view_parameters, &file_parser_dummy_hook)) goto err; @@ -1484,7 +1484,7 @@ frm_type_enum mysql_frm_type(THD *thd, char *path, enum legacy_db_type *dbt) if ((file= my_open(path, O_RDONLY | O_SHARE, MYF(0))) < 0) DBUG_RETURN(FRMTYPE_ERROR); - error= my_read(file, (byte*) header, sizeof(header), MYF(MY_WME | MY_NABP)); + error= my_read(file, (uchar*) header, sizeof(header), MYF(MY_WME | MY_NABP)); my_close(file, MYF(MY_WME)); if (error) @@ -1747,7 +1747,7 @@ mysql_rename_view(THD *thd, view_def.view_suid= TRUE; /* get view definition and source */ - if (parser->parse((gptr)&view_def, thd->mem_root, view_parameters, + if (parser->parse((uchar*)&view_def, thd->mem_root, view_parameters, array_elements(view_parameters)-1, &file_parser_dummy_hook)) goto err; @@ -1769,7 +1769,7 @@ mysql_rename_view(THD *thd, file.length= pathstr.length - dir.length; if (sql_create_definition_file(&dir, &file, view_file_type, - (gptr)&view_def, view_parameters, + (uchar*)&view_def, view_parameters, num_view_backups)) { /* restore renamed view in case of error */ diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 87cd33117dc..d46eeb985c9 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4328,10 +4328,10 @@ create_table_option: lex->create_info.merge_list= lex->select_lex.table_list; lex->create_info.merge_list.elements--; lex->create_info.merge_list.first= - (byte*) (table_list->next_local); + (uchar*) (table_list->next_local); lex->select_lex.table_list.elements=1; lex->select_lex.table_list.next= - (byte**) &(table_list->next_local); + (uchar**) &(table_list->next_local); table_list->next_local= 0; lex->create_info.used_fields|= HA_CREATE_USED_UNION; } @@ -5558,10 +5558,10 @@ alter_list_item: { THD *thd= YYTHD; LEX *lex= thd->lex; - uint dummy; + size_t dummy; lex->select_lex.db=$3->db.str; if (lex->select_lex.db == NULL && - thd->copy_db_to(&lex->select_lex.db, &dummy)) + thd->copy_db_to(&lex->select_lex.db, &dummy)) { MYSQL_YYABORT; } @@ -7961,7 +7961,7 @@ procedure_clause: } lex->proc_list.elements=0; lex->proc_list.first=0; - lex->proc_list.next= (byte**) &lex->proc_list.first; + lex->proc_list.next= (uchar**) &lex->proc_list.first; if (add_proc_to_list(lex->thd, new Item_field(&lex-> current_select-> context, @@ -9518,8 +9518,9 @@ simple_ident_q: Let us add this item to list of all Item_trigger_field objects in trigger. */ - lex->trg_table_fields.link_in_list((byte *)trg_fld, - (byte**)&trg_fld->next_trg_field); + lex->trg_table_fields.link_in_list((uchar*) trg_fld, + (uchar**) &trg_fld-> + next_trg_field); $$= (Item *)trg_fld; } @@ -10142,7 +10143,8 @@ option_type_value: else qbuff.length= lex->tok_end - sp->m_tmp_query; - if (!(qbuff.str= alloc_root(YYTHD->mem_root, qbuff.length + 5))) + if (!(qbuff.str= (char*) alloc_root(YYTHD->mem_root, + qbuff.length + 5))) MYSQL_YYABORT; strmake(strmake(qbuff.str, "SET ", 4), sp->m_tmp_query, @@ -10228,8 +10230,9 @@ sys_option_value: Let us add this item to list of all Item_trigger_field objects in trigger. */ - lex->trg_table_fields.link_in_list((byte *)trg_fld, - (byte **)&trg_fld->next_trg_field); + lex->trg_table_fields.link_in_list((uchar *)trg_fld, + (uchar **) &trg_fld-> + next_trg_field); lex->sphead->add_instr(sp_fld); } @@ -10802,7 +10805,7 @@ grant_ident: { THD *thd= YYTHD; LEX *lex= thd->lex; - uint dummy; + size_t dummy; if (thd->copy_db_to(&lex->current_select->db, &dummy)) MYSQL_YYABORT; if (lex->grant == GLOBAL_ACLS) diff --git a/sql/stacktrace.c b/sql/stacktrace.c index 078f62c6b2b..36e64087c5e 100644 --- a/sql/stacktrace.c +++ b/sql/stacktrace.c @@ -94,7 +94,7 @@ inline uint32* find_prev_pc(uint32* pc, uchar** fp) #endif /* defined(__alpha__) && defined(__GNUC__) */ -void print_stacktrace(gptr stack_bottom, ulong thread_stack) +void print_stacktrace(uchar* stack_bottom, ulong thread_stack) { uchar** fp; uint frame_count = 0, sigreturn_frame_count; @@ -129,11 +129,11 @@ terribly wrong...\n"); return; } - if (!stack_bottom || (gptr) stack_bottom > (gptr) &fp) + if (!stack_bottom || (uchar*) stack_bottom > (uchar*) &fp) { ulong tmp= min(0x10000,thread_stack); /* Assume that the stack starts at the previous even 65K */ - stack_bottom= (gptr) (((ulong) &fp + tmp) & + stack_bottom= (uchar*) (((ulong) &fp + tmp) & ~(ulong) 0xFFFF); fprintf(stderr, "Cannot determine thread, fp=%p, backtrace may not be correct.\n", fp); } diff --git a/sql/stacktrace.h b/sql/stacktrace.h index 56b9877180a..1a0b80c88d3 100644 --- a/sql/stacktrace.h +++ b/sql/stacktrace.h @@ -28,7 +28,7 @@ extern char* heap_start; #define init_stacktrace() do { \ heap_start = (char*) &__bss_start; \ } while(0); -void print_stacktrace(gptr stack_bottom, ulong thread_stack); +void print_stacktrace(uchar* stack_bottom, ulong thread_stack); void safe_print_str(const char* name, const char* val, int max_len); #endif /* (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) */ #endif /* TARGET_OS_LINUX */ diff --git a/sql/structs.h b/sql/structs.h index 4cf9379d2bb..22d08e51961 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -28,8 +28,8 @@ typedef struct st_date_time_format { typedef struct st_keyfile_info { /* used with ha_info() */ - byte ref[MAX_REFLENGTH]; /* Pointer to current row */ - byte dupp_ref[MAX_REFLENGTH]; /* Pointer to dupp row */ + uchar ref[MAX_REFLENGTH]; /* Pointer to current row */ + uchar dupp_ref[MAX_REFLENGTH]; /* Pointer to dupp row */ uint ref_length; /* Length of ref (1-8) */ uint block_size; /* index block size */ File filenr; /* (uniq) filenr for table */ @@ -126,10 +126,10 @@ typedef struct st_read_record { /* Parameter to read_record */ uint cache_records; uint ref_length,struct_length,reclength,rec_cache_size,error_offset; uint index; - byte *ref_pos; /* pointer to form->refpos */ - byte *record; - byte *rec_buf; /* to read field values after filesort */ - byte *cache,*cache_pos,*cache_end,*read_positions; + uchar *ref_pos; /* pointer to form->refpos */ + uchar *record; + uchar *rec_buf; /* to read field values after filesort */ + uchar *cache,*cache_pos,*cache_end,*read_positions; IO_CACHE *io_cache; bool print_error, ignore_not_found_rows; } READ_RECORD; diff --git a/sql/table.cc b/sql/table.cc index 9be98eb14b9..e0690107f4e 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -29,16 +29,16 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, File file); static void fix_type_pointers(const char ***array, TYPELIB *point_to_type, uint types, char **names); -static uint find_field(Field **fields, byte *record, uint start, uint length); +static uint find_field(Field **fields, uchar *record, uint start, uint length); /* Get column name from column hash */ -static byte *get_field_name(Field **buff, uint *length, - my_bool not_used __attribute__((unused))) +static uchar *get_field_name(Field **buff, size_t *length, + my_bool not_used __attribute__((unused))) { *length= (uint) strlen((*buff)->field_name); - return (byte*) (*buff)->field_name; + return (uchar*) (*buff)->field_name; } @@ -370,7 +370,7 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags) } error= 4; - if (my_read(file,(byte*) head, 64, MYF(MY_NABP))) + if (my_read(file, head, 64, MYF(MY_NABP))) goto err; if (head[0] == (uchar) 254 && head[1] == 1) @@ -460,7 +460,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, uint extra_rec_buf_length; uint i,j; bool use_hash; - char *keynames, *record, *names, *comment_pos; + char *keynames, *names, *comment_pos; + uchar *record; uchar *disk_buff, *strpos, *null_flags, *null_pos; ulong pos, record_offset, *rec_per_key, rec_buff_length; handler *handler_file= 0; @@ -537,7 +538,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, /* Read keyinformation */ key_info_length= (uint) uint2korr(head+28); VOID(my_seek(file,(ulong) uint2korr(head+6),MY_SEEK_SET,MYF(0))); - if (read_string(file,(gptr*) &disk_buff,key_info_length)) + if (read_string(file,(uchar**) &disk_buff,key_info_length)) goto err; /* purecov: inspected */ if (disk_buff[0] & 0x80) { @@ -636,19 +637,21 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, if ((n_length= uint4korr(head+55))) { /* Read extra data segment */ - char *buff, *next_chunk, *buff_end; + uchar *buff, *next_chunk, *buff_end; DBUG_PRINT("info", ("extra segment size is %u bytes", n_length)); - if (!(next_chunk= buff= my_malloc(n_length, MYF(MY_WME)))) + if (!(next_chunk= buff= (uchar*) my_malloc(n_length, MYF(MY_WME)))) goto err; - if (my_pread(file, (byte*)buff, n_length, record_offset + share->reclength, + if (my_pread(file, buff, n_length, record_offset + share->reclength, MYF(MY_NABP))) { my_free(buff, MYF(0)); goto err; } share->connect_string.length= uint2korr(buff); - if (! (share->connect_string.str= strmake_root(&share->mem_root, - next_chunk + 2, share->connect_string.length))) + if (!(share->connect_string.str= strmake_root(&share->mem_root, + (char*) next_chunk + 2, + share->connect_string. + length))) { my_free(buff, MYF(0)); goto err; @@ -658,8 +661,13 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, if (next_chunk + 2 < buff_end) { uint str_db_type_length= uint2korr(next_chunk); - LEX_STRING name= { next_chunk + 2, str_db_type_length }; - handlerton *tmp_db_type= ha_resolve_by_name(thd, &name); + LEX_STRING name; + handlerton *tmp_db_type; + + name.str= (char*) next_chunk + 2; + name.length= str_db_type_length; + tmp_db_type= ha_resolve_by_name(thd, &name); + if (tmp_db_type != NULL) { share->db_type= tmp_db_type; @@ -670,7 +678,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, #ifdef WITH_PARTITION_STORAGE_ENGINE else { - if (!strncmp(next_chunk + 2, "partition", str_db_type_length)) + if (!strncmp((char*) next_chunk + 2, "partition", str_db_type_length)) { /* Use partition handler */ share->db_type= partition_hton; @@ -688,7 +696,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, #ifdef WITH_PARTITION_STORAGE_ENGINE if ((share->partition_info_len= partition_info_len)) { - if (!(share->partition_info= + if (!(share->partition_info= (char*) memdup_root(&share->mem_root, next_chunk + 4, partition_info_len + 1))) { @@ -740,8 +748,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, my_free(buff, MYF(0)); goto err; } - parser_name.str= next_chunk; - parser_name.length= strlen(next_chunk); + parser_name.str= (char*) next_chunk; + parser_name.length= strlen((char*) next_chunk); keyinfo->parser= plugin_lock(&parser_name, MYSQL_FTPARSER_PLUGIN); if (! keyinfo->parser) { @@ -759,16 +767,16 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, extra_rec_buf_length= uint2korr(head+59); rec_buff_length= ALIGN_SIZE(share->reclength + 1 + extra_rec_buf_length); share->rec_buff_length= rec_buff_length; - if (!(record= (char *) alloc_root(&share->mem_root, - rec_buff_length))) + if (!(record= (uchar *) alloc_root(&share->mem_root, + rec_buff_length))) goto err; /* purecov: inspected */ - share->default_values= (byte *) record; - if (my_pread(file,(byte*) record, (uint) share->reclength, + share->default_values= record; + if (my_pread(file, record, (size_t) share->reclength, record_offset, MYF(MY_NABP))) goto err; /* purecov: inspected */ VOID(my_seek(file,pos,MY_SEEK_SET,MYF(0))); - if (my_read(file,(byte*) head,288,MYF(MY_NABP))) + if (my_read(file, head,288,MYF(MY_NABP))) goto err; #ifdef HAVE_CRYPTED_FRM if (crypted) @@ -798,14 +806,14 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, (uint) ((share->fields+1)*sizeof(Field*)+ interval_count*sizeof(TYPELIB)+ (share->fields+interval_parts+ - keys+3)*sizeof(my_string)+ + keys+3)*sizeof(char *)+ (n_length+int_length+com_length))))) goto err; /* purecov: inspected */ share->field= field_ptr; read_length=(uint) (share->fields * field_pack_length + pos+ (uint) (n_length+int_length+com_length)); - if (read_string(file,(gptr*) &disk_buff,read_length)) + if (read_string(file,(uchar**) &disk_buff,read_length)) goto err; /* purecov: inspected */ #ifdef HAVE_CRYPTED_FRM if (crypted) @@ -861,7 +869,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, share->db_type))) goto err; - record= (char*) share->default_values-1; /* Fieldstart = 1 */ + record= share->default_values-1; /* Fieldstart = 1 */ if (share->null_field_first) { null_flags= null_pos= (uchar*) record+1; @@ -1055,7 +1063,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, if (use_hash) (void) my_hash_insert(&share->name_hash, - (byte*) field_ptr); // never fail + (uchar*) field_ptr); // never fail } *field_ptr=0; // End marker @@ -1114,7 +1122,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, key_part->type= field->key_type(); if (field->null_ptr) { - key_part->null_offset=(uint) ((byte*) field->null_ptr - + key_part->null_offset=(uint) ((uchar*) field->null_ptr - share->default_values); key_part->null_bit= field->null_bit; key_part->store_length+=HA_KEY_NULL_LENGTH; @@ -1255,7 +1263,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, } else share->primary_key= MAX_KEY; - x_free((gptr) disk_buff); + x_free((uchar*) disk_buff); disk_buff=0; if (new_field_pack_flag <= 1) { @@ -1327,7 +1335,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, share->error= error; share->open_errno= my_errno; share->errarg= errarg; - x_free((gptr) disk_buff); + x_free((uchar*) disk_buff); delete crypted; delete handler_file; hash_free(&share->name_hash); @@ -1369,7 +1377,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, int error; uint records, i, bitmap_size; bool error_reported= FALSE; - byte *record, *bitmaps; + uchar *record, *bitmaps; Field **field_ptr; DBUG_ENTER("open_table_from_share"); DBUG_PRINT("enter",("name: '%s.%s' form: 0x%lx", share->db.str, @@ -1404,7 +1412,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, if (prgflag & (READ_ALL+EXTRA_RECORD)) records++; - if (!(record= (byte*) alloc_root(&outparam->mem_root, + if (!(record= (uchar*) alloc_root(&outparam->mem_root, share->rec_buff_length * records))) goto err; /* purecov: inspected */ @@ -1444,7 +1452,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, outparam->field= field_ptr; - record= (byte*) outparam->record[0]-1; /* Fieldstart = 1 */ + record= (uchar*) outparam->record[0]-1; /* Fieldstart = 1 */ if (share->null_field_first) outparam->null_flags= (uchar*) record+1; else @@ -1566,7 +1574,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, /* Allocate bitmaps */ bitmap_size= share->column_bitmap_size; - if (!(bitmaps= (byte*) alloc_root(&outparam->mem_root, bitmap_size*3))) + if (!(bitmaps= (uchar*) alloc_root(&outparam->mem_root, bitmap_size*3))) goto err; bitmap_init(&outparam->def_read_set, (my_bitmap_map*) bitmaps, share->fields, FALSE); @@ -1733,7 +1741,7 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names) DBUG_ENTER("get_form_pos"); names=uint2korr(head+8); - a_length=(names+2)*sizeof(my_string); /* Room for two extra */ + a_length=(names+2)*sizeof(char *); /* Room for two extra */ if (!save_names) a_length=0; @@ -1744,12 +1752,12 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names) { length=uint2korr(head+4); VOID(my_seek(file,64L,MY_SEEK_SET,MYF(0))); - if (!(buf= (uchar*) my_malloc((uint) length+a_length+names*4, + if (!(buf= (uchar*) my_malloc((size_t) length+a_length+names*4, MYF(MY_WME))) || - my_read(file,(byte*) buf+a_length,(uint) (length+names*4), + my_read(file, buf+a_length, (size_t) (length+names*4), MYF(MY_NABP))) { /* purecov: inspected */ - x_free((gptr) buf); /* purecov: inspected */ + x_free((uchar*) buf); /* purecov: inspected */ DBUG_RETURN(0L); /* purecov: inspected */ } pos= buf+a_length+length; @@ -1758,7 +1766,7 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names) if (! save_names) { if (names) - my_free((gptr) buf,MYF(0)); + my_free((uchar*) buf,MYF(0)); } else if (!names) bzero((char*) save_names,sizeof(save_names)); @@ -1772,19 +1780,24 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names) } - /* Read string from a file with malloc */ +/* + Read string from a file with malloc -int read_string(File file, gptr *to, uint length) + NOTES: + We add an \0 at end of the read string to make reading of C strings easier +*/ + +int read_string(File file, uchar**to, size_t length) { DBUG_ENTER("read_string"); - x_free((gptr) *to); - if (!(*to= (gptr) my_malloc(length+1,MYF(MY_WME))) || - my_read(file,(byte*) *to,length,MYF(MY_NABP))) + x_free(*to); + if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) || + my_read(file, *to, length,MYF(MY_NABP))) { - x_free((gptr) *to); /* purecov: inspected */ - *to= 0; /* purecov: inspected */ - DBUG_RETURN(1); /* purecov: inspected */ + x_free(*to); /* purecov: inspected */ + *to= 0; /* purecov: inspected */ + DBUG_RETURN(1); /* purecov: inspected */ } *((char*) *to+length)= '\0'; DBUG_RETURN (0); @@ -1798,7 +1811,7 @@ ulong make_new_entry(File file, uchar *fileinfo, TYPELIB *formnames, { uint i,bufflength,maxlength,n_length,length,names; ulong endpos,newpos; - char buff[IO_SIZE]; + uchar buff[IO_SIZE]; uchar *pos; DBUG_ENTER("make_new_entry"); @@ -1818,17 +1831,17 @@ ulong make_new_entry(File file, uchar *fileinfo, TYPELIB *formnames, while (endpos > maxlength) { VOID(my_seek(file,(ulong) (endpos-bufflength),MY_SEEK_SET,MYF(0))); - if (my_read(file,(byte*) buff,bufflength,MYF(MY_NABP+MY_WME))) + if (my_read(file, buff, bufflength, MYF(MY_NABP+MY_WME))) DBUG_RETURN(0L); VOID(my_seek(file,(ulong) (endpos-bufflength+IO_SIZE),MY_SEEK_SET, MYF(0))); - if ((my_write(file,(byte*) buff,bufflength,MYF(MY_NABP+MY_WME)))) + if ((my_write(file, buff,bufflength,MYF(MY_NABP+MY_WME)))) DBUG_RETURN(0); endpos-=bufflength; bufflength=IO_SIZE; } bzero(buff,IO_SIZE); /* Null new block */ VOID(my_seek(file,(ulong) maxlength,MY_SEEK_SET,MYF(0))); - if (my_write(file,(byte*) buff,bufflength,MYF(MY_NABP+MY_WME))) + if (my_write(file,buff,bufflength,MYF(MY_NABP+MY_WME))) DBUG_RETURN(0L); maxlength+=IO_SIZE; /* Fix old ref */ int2store(fileinfo+6,maxlength); @@ -1843,15 +1856,15 @@ ulong make_new_entry(File file, uchar *fileinfo, TYPELIB *formnames, if (n_length == 1 ) { /* First name */ length++; - VOID(strxmov(buff,"/",newname,"/",NullS)); + VOID(strxmov((char*) buff,"/",newname,"/",NullS)); } else - VOID(strxmov(buff,newname,"/",NullS)); /* purecov: inspected */ + VOID(strxmov((char*) buff,newname,"/",NullS)); /* purecov: inspected */ VOID(my_seek(file,63L+(ulong) n_length,MY_SEEK_SET,MYF(0))); - if (my_write(file,(byte*) buff,(uint) length+1,MYF(MY_NABP+MY_WME)) || - (names && my_write(file,(byte*) (*formnames->type_names+n_length-1), + if (my_write(file, buff, (size_t) length+1,MYF(MY_NABP+MY_WME)) || + (names && my_write(file,(uchar*) (*formnames->type_names+n_length-1), names*4, MYF(MY_NABP+MY_WME))) || - my_write(file,(byte*) fileinfo+10,(uint) 4,MYF(MY_NABP+MY_WME))) + my_write(file, fileinfo+10, 4,MYF(MY_NABP+MY_WME))) DBUG_RETURN(0L); /* purecov: inspected */ int2store(fileinfo+8,names+1); @@ -2011,7 +2024,7 @@ TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings) # field number +1 */ -static uint find_field(Field **fields, byte *record, uint start, uint length) +static uint find_field(Field **fields, uchar *record, uint start, uint length) { Field **field; uint i, pos; @@ -2124,7 +2137,7 @@ File create_frm(THD *thd, const char *name, const char *db, { register File file; ulong length; - char fill[IO_SIZE]; + uchar fill[IO_SIZE]; int create_flags= O_RDWR | O_TRUNC; if (create_info->options & HA_LEX_CREATE_TMP_TABLE) @@ -2187,7 +2200,7 @@ File create_frm(THD *thd, const char *name, const char *db, bzero(fill,IO_SIZE); for (; length > IO_SIZE ; length-= IO_SIZE) { - if (my_write(file,(byte*) fill,IO_SIZE,MYF(MY_WME | MY_NABP))) + if (my_write(file,fill, IO_SIZE, MYF(MY_WME | MY_NABP))) { VOID(my_close(file,MYF(0))); VOID(my_delete(name,MYF(0))); @@ -2298,7 +2311,7 @@ char *get_field(MEM_ROOT *mem, Field *field) given a buffer with a key value, and a map of keyparts that are present in this value, returns the length of the value */ -uint calculate_key_len(TABLE *table, uint key, const byte *buf, +uint calculate_key_len(TABLE *table, uint key, const uchar *buf, key_part_map keypart_map) { /* works only with key prefixes */ @@ -2743,7 +2756,7 @@ bool st_table_list::setup_underlying(THD *thd) List_iterator_fast<Item> it(select->item_list); uint field_count= 0; - if (check_stack_overrun(thd, STACK_MIN_SIZE, (char *)&field_count)) + if (check_stack_overrun(thd, STACK_MIN_SIZE, (uchar*) &field_count)) { DBUG_RETURN(TRUE); } @@ -3118,7 +3131,7 @@ bool st_table_list::set_insert_values(MEM_ROOT *mem_root) if (table) { if (!table->insert_values && - !(table->insert_values= (byte *)alloc_root(mem_root, + !(table->insert_values= (uchar *)alloc_root(mem_root, table->s->rec_buff_length))) return TRUE; } @@ -4371,6 +4384,24 @@ bool st_table_list::process_index_hints(TABLE *table) return 0; } + +size_t max_row_length(TABLE *table, const uchar *data) +{ + TABLE_SHARE *table_s= table->s; + size_t length= table_s->reclength + 2 * table_s->fields; + uint *const beg= table_s->blob_field; + uint *const end= beg + table_s->blob_fields; + + for (uint *ptr= beg ; ptr != end ; ++ptr) + { + Field_blob* const blob= (Field_blob*) table->field[*ptr]; + length+= blob->get_length((const uchar*) + (data + blob->offset(table->record[0]))) + + HA_KEY_BLOB_LENGTH; + } + return length; +} + /***************************************************************************** ** Instansiate templates *****************************************************************************/ diff --git a/sql/table.h b/sql/table.h index 5b6aa2a8a7c..f3fc33c2719 100644 --- a/sql/table.h +++ b/sql/table.h @@ -73,16 +73,16 @@ enum release_type { RELEASE_NORMAL, RELEASE_WAIT_FOR_DROP }; typedef struct st_filesort_info { - IO_CACHE *io_cache; /* If sorted through filebyte */ - uchar **sort_keys; /* Buffer for sorting keys */ - byte *buffpek; /* Buffer for buffpek structures */ - uint buffpek_len; /* Max number of buffpeks in the buffer */ - byte *addon_buf; /* Pointer to a buffer if sorted with fields */ - uint addon_length; /* Length of the buffer */ + IO_CACHE *io_cache; /* If sorted through filesort */ + uchar **sort_keys; /* Buffer for sorting keys */ + uchar *buffpek; /* Buffer for buffpek structures */ + uint buffpek_len; /* Max number of buffpeks in the buffer */ + uchar *addon_buf; /* Pointer to a buffer if sorted with fields */ + size_t addon_length; /* Length of the buffer */ struct st_sort_addon_field *addon_field; /* Pointer to the fields info */ - void (*unpack)(struct st_sort_addon_field *, byte *); /* To unpack back */ - byte *record_pointers; /* If sorted in memory */ - ha_rows found_records; /* How many records in sort */ + void (*unpack)(struct st_sort_addon_field *, uchar *); /* To unpack back */ + uchar *record_pointers; /* If sorted in memory */ + ha_rows found_records; /* How many records in sort */ } FILESORT_INFO; @@ -137,7 +137,7 @@ typedef struct st_table_share KEY *key_info; /* data of keys in database */ uint *blob_field; /* Index to blobs in Field arrray*/ - byte *default_values; /* row with default values */ + uchar *default_values; /* row with default values */ LEX_STRING comment; /* Comment about table */ CHARSET_INFO *table_charset; /* Default charset of string fields */ @@ -321,10 +321,10 @@ struct st_table { THD *in_use; /* Which thread uses this */ Field **field; /* Pointer to fields */ - byte *record[2]; /* Pointer to records */ - byte *write_row_record; /* Used as optimisation in + uchar *record[2]; /* Pointer to records */ + uchar *write_row_record; /* Used as optimisation in THD::write_row */ - byte *insert_values; /* used by INSERT ... UPDATE */ + uchar *insert_values; /* used by INSERT ... UPDATE */ /* Map of keys that can be used to retrieve all data from this table needed by the query without reading the row. @@ -422,12 +422,14 @@ struct st_table { /* If true, the current table row is considered to have all columns set to NULL, including columns declared as "not null" (see maybe_null). + */ + my_bool null_row; - TODO: Each of these flags take up 8 bits. They can just as easily + /* + TODO: Each of the following flags take up 8 bits. They can just as easily be put into one single unsigned long and instead of taking up 18 bytes, it would take up 4. */ - my_bool null_row; my_bool force_index; my_bool distinct,const_table,no_rows; my_bool key_read, no_keyread; @@ -857,8 +859,8 @@ typedef struct st_table_list thr_lock_type lock_type; uint outer_join; /* Which join type */ uint shared; /* Used in multi-upd */ - uint db_length; - uint32 table_name_length; + size_t db_length; + size_t table_name_length; bool updatable; /* VIEW/TABLE can be updated now */ bool straight; /* optimize with prev table */ bool updating; /* for replicate-do/ignore table */ @@ -1152,3 +1154,6 @@ static inline void dbug_tmp_restore_column_map(MY_BITMAP *bitmap, tmp_restore_column_map(bitmap, old); #endif } + +size_t max_row_length(TABLE *table, const uchar *data); + diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc index 392db9224c3..ddf35002880 100644 --- a/sql/thr_malloc.cc +++ b/sql/thr_malloc.cc @@ -35,26 +35,25 @@ void init_sql_alloc(MEM_ROOT *mem_root, uint block_size, uint pre_alloc) } -gptr sql_alloc(uint Size) +void *sql_alloc(size_t Size) { MEM_ROOT *root= *my_pthread_getspecific_ptr(MEM_ROOT**,THR_MALLOC); - char *ptr= (char*) alloc_root(root,Size); - return ptr; + return alloc_root(root,Size); } -gptr sql_calloc(uint size) +void *sql_calloc(size_t size) { - gptr ptr; + void *ptr; if ((ptr=sql_alloc(size))) - bzero((char*) ptr,size); + bzero(ptr,size); return ptr; } char *sql_strdup(const char *str) { - uint len=(uint) strlen(str)+1; + size_t len= strlen(str)+1; char *pos; if ((pos= (char*) sql_alloc(len))) memcpy(pos,str,len); @@ -62,7 +61,7 @@ char *sql_strdup(const char *str) } -char *sql_strmake(const char *str,uint len) +char *sql_strmake(const char *str, size_t len) { char *pos; if ((pos= (char*) sql_alloc(len+1))) @@ -74,10 +73,10 @@ char *sql_strmake(const char *str,uint len) } -gptr sql_memdup(const void *ptr,uint len) +void* sql_memdup(const void *ptr, size_t len) { - char *pos; - if ((pos= (char*) sql_alloc(len))) + void *pos; + if ((pos= sql_alloc(len))) memcpy(pos,ptr,len); return pos; } @@ -87,17 +86,17 @@ void sql_element_free(void *ptr __attribute__((unused))) -char *sql_strmake_with_convert(const char *str, uint32 arg_length, +char *sql_strmake_with_convert(const char *str, size_t arg_length, CHARSET_INFO *from_cs, - uint32 max_res_length, - CHARSET_INFO *to_cs, uint32 *result_length) + size_t max_res_length, + CHARSET_INFO *to_cs, size_t *result_length) { char *pos; - uint32 new_length= to_cs->mbmaxlen*arg_length; + size_t new_length= to_cs->mbmaxlen*arg_length; max_res_length--; // Reserve place for end null set_if_smaller(new_length, max_res_length); - if (!(pos= sql_alloc(new_length+1))) + if (!(pos= (char*) sql_alloc(new_length+1))) return pos; // Error if ((from_cs == &my_charset_bin) || (to_cs == &my_charset_bin)) diff --git a/sql/tzfile.h b/sql/tzfile.h index 1a57c0c5f69..1ff82d62329 100644 --- a/sql/tzfile.h +++ b/sql/tzfile.h @@ -34,14 +34,14 @@ #define TZ_MAGIC "TZif" struct tzhead { - char tzh_magic[4]; /* TZ_MAGIC */ - char tzh_reserved[16]; /* reserved for future use */ - char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */ - char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ - char tzh_leapcnt[4]; /* coded number of leap seconds */ - char tzh_timecnt[4]; /* coded number of transition times */ - char tzh_typecnt[4]; /* coded number of local time types */ - char tzh_charcnt[4]; /* coded number of abbr. chars */ + uchar tzh_magic[4]; /* TZ_MAGIC */ + uchar tzh_reserved[16]; /* reserved for future use */ + uchar tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */ + uchar tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ + uchar tzh_leapcnt[4]; /* coded number of leap seconds */ + uchar tzh_timecnt[4]; /* coded number of transition times */ + uchar tzh_typecnt[4]; /* coded number of local time types */ + uchar tzh_charcnt[4]; /* coded number of abbr. chars */ }; /* diff --git a/sql/tztime.cc b/sql/tztime.cc index 08b93cfd203..0c717dd2ece 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -153,7 +153,7 @@ static my_bool prepare_tz_info(TIME_ZONE_INFO *sp, MEM_ROOT *storage); static my_bool tz_load(const char *name, TIME_ZONE_INFO *sp, MEM_ROOT *storage) { - char *p; + uchar *p; int read_from_file; uint i; FILE *file; @@ -164,8 +164,8 @@ tz_load(const char *name, TIME_ZONE_INFO *sp, MEM_ROOT *storage) union { struct tzhead tzhead; - char buf[sizeof(struct tzhead) + sizeof(my_time_t) * TZ_MAX_TIMES + - TZ_MAX_TIMES + sizeof(TRAN_TYPE_INFO) * TZ_MAX_TYPES + + uchar buf[sizeof(struct tzhead) + sizeof(my_time_t) * TZ_MAX_TIMES + + TZ_MAX_TIMES + sizeof(TRAN_TYPE_INFO) * TZ_MAX_TYPES + #ifdef ABBR_ARE_USED max(TZ_MAX_CHARS + 1, (2 * (MY_TZNAME_MAX + 1))) + #endif @@ -189,7 +189,7 @@ tz_load(const char *name, TIME_ZONE_INFO *sp, MEM_ROOT *storage) sp->timecnt= int4net(u.tzhead.tzh_timecnt); sp->typecnt= int4net(u.tzhead.tzh_typecnt); sp->charcnt= int4net(u.tzhead.tzh_charcnt); - p= u.tzhead.tzh_charcnt + sizeof u.tzhead.tzh_charcnt; + p= u.tzhead.tzh_charcnt + sizeof(u.tzhead.tzh_charcnt); if (sp->leapcnt > TZ_MAX_LEAPS || sp->typecnt == 0 || sp->typecnt > TZ_MAX_TYPES || sp->timecnt > TZ_MAX_TIMES || @@ -1489,18 +1489,21 @@ public: they should obey C calling conventions. */ -extern "C" byte* my_tz_names_get_key(Tz_names_entry *entry, uint *length, - my_bool not_used __attribute__((unused))) +extern "C" uchar * +my_tz_names_get_key(Tz_names_entry *entry, size_t *length, + my_bool not_used __attribute__((unused))) { *length= entry->name.length(); - return (byte*) entry->name.ptr(); + return (uchar*) entry->name.ptr(); } -extern "C" byte* my_offset_tzs_get_key(Time_zone_offset *entry, uint *length, - my_bool not_used __attribute__((unused))) +extern "C" uchar * +my_offset_tzs_get_key(Time_zone_offset *entry, + size_t *length, + my_bool not_used __attribute__((unused))) { *length= sizeof(long); - return (byte*) &entry->offset; + return (uchar*) &entry->offset; } @@ -1586,7 +1589,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap) /* Init all memory structures that require explicit destruction */ if (hash_init(&tz_names, &my_charset_latin1, 20, - 0, 0, (hash_get_key)my_tz_names_get_key, 0, 0)) + 0, 0, (hash_get_key) my_tz_names_get_key, 0, 0)) { sql_print_error("Fatal error: OOM while initializing time zones"); goto end; @@ -1610,7 +1613,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap) } tmp_tzname->name.set(STRING_WITH_LEN("SYSTEM"), &my_charset_latin1); tmp_tzname->tz= my_tz_SYSTEM; - if (my_hash_insert(&tz_names, (const byte *)tmp_tzname)) + if (my_hash_insert(&tz_names, (const uchar *)tmp_tzname)) { sql_print_error("Fatal error: OOM while initializing time zones"); goto end_with_cleanup; @@ -1832,8 +1835,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) DBUG_ENTER("tz_load_from_open_tables"); /* Prepare tz_info for loading also let us make copy of time zone name */ - if (!(alloc_buff= alloc_root(&tz_storage, sizeof(TIME_ZONE_INFO) + - tz_name->length() + 1))) + if (!(alloc_buff= (char*) alloc_root(&tz_storage, sizeof(TIME_ZONE_INFO) + + tz_name->length() + 1))) { sql_print_error("Out of memory while loading time zone description"); return 0; @@ -1862,7 +1865,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) */ (void)table->file->ha_index_init(0, 1); - if (table->file->index_read(table->record[0], (byte*)table->field[0]->ptr, + if (table->file->index_read(table->record[0], table->field[0]->ptr, HA_WHOLE_KEY, HA_READ_KEY_EXACT)) { #ifdef EXTRA_DEBUG @@ -1889,7 +1892,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) table->field[0]->store((longlong) tzid, TRUE); (void)table->file->ha_index_init(0, 1); - if (table->file->index_read(table->record[0], (byte*)table->field[0]->ptr, + if (table->file->index_read(table->record[0], table->field[0]->ptr, HA_WHOLE_KEY, HA_READ_KEY_EXACT)) { sql_print_error("Can't find description of time zone '%u'", tzid); @@ -1916,7 +1919,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) table->field[0]->store((longlong) tzid, TRUE); (void)table->file->ha_index_init(0, 1); - res= table->file->index_read(table->record[0], (byte*)table->field[0]->ptr, + res= table->file->index_read(table->record[0], table->field[0]->ptr, (key_part_map)1, HA_READ_KEY_EXACT); while (!res) { @@ -1965,7 +1968,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) tz_info->typecnt= ttid + 1; res= table->file->index_next_same(table->record[0], - (byte*)table->field[0]->ptr, 4); + table->field[0]->ptr, 4); } if (res != HA_ERR_END_OF_FILE) @@ -1987,7 +1990,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) table->field[0]->store((longlong) tzid, TRUE); (void)table->file->ha_index_init(0, 1); - res= table->file->index_read(table->record[0], (byte*)table->field[0]->ptr, + res= table->file->index_read(table->record[0], table->field[0]->ptr, (key_part_map)1, HA_READ_KEY_EXACT); while (!res) { @@ -2018,7 +2021,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) tzid, (ulong) ttime, ttid)); res= table->file->index_next_same(table->record[0], - (byte*)table->field[0]->ptr, 4); + table->field[0]->ptr, 4); } /* @@ -2038,21 +2041,21 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) /* Now we will allocate memory and init TIME_ZONE_INFO structure. */ - if (!(alloc_buff= alloc_root(&tz_storage, - ALIGN_SIZE(sizeof(my_time_t) * - tz_info->timecnt) + - ALIGN_SIZE(tz_info->timecnt) + + if (!(alloc_buff= (char*) alloc_root(&tz_storage, + ALIGN_SIZE(sizeof(my_time_t) * + tz_info->timecnt) + + ALIGN_SIZE(tz_info->timecnt) + #ifdef ABBR_ARE_USED - ALIGN_SIZE(tz_info->charcnt) + + ALIGN_SIZE(tz_info->charcnt) + #endif - sizeof(TRAN_TYPE_INFO) * tz_info->typecnt))) + sizeof(TRAN_TYPE_INFO) * + tz_info->typecnt))) { sql_print_error("Out of memory while loading time zone description"); goto end; } - - tz_info->ats= (my_time_t *)alloc_buff; + tz_info->ats= (my_time_t *) alloc_buff; memcpy(tz_info->ats, ats, tz_info->timecnt * sizeof(my_time_t)); alloc_buff+= ALIGN_SIZE(sizeof(my_time_t) * tz_info->timecnt); tz_info->types= (uchar *)alloc_buff; @@ -2087,7 +2090,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) &(tmp_tzname->name))) || (tmp_tzname->name.set(tz_name_buff, tz_name->length(), &my_charset_latin1), - my_hash_insert(&tz_names, (const byte *)tmp_tzname))) + my_hash_insert(&tz_names, (const uchar *)tmp_tzname))) { sql_print_error("Out of memory while loading time zone"); goto end; @@ -2244,13 +2247,13 @@ my_tz_find(THD *thd, const String *name) { if (!(result_tz= (Time_zone_offset *)hash_search(&offset_tzs, - (const byte *)&offset, + (const uchar *)&offset, sizeof(long)))) { DBUG_PRINT("info", ("Creating new Time_zone_offset object")); if (!(result_tz= new (&tz_storage) Time_zone_offset(offset)) || - my_hash_insert(&offset_tzs, (const byte *) result_tz)) + my_hash_insert(&offset_tzs, (const uchar *) result_tz)) { result_tz= 0; sql_print_error("Fatal error: Out of memory " @@ -2262,7 +2265,7 @@ my_tz_find(THD *thd, const String *name) { result_tz= 0; if ((tmp_tzname= (Tz_names_entry *)hash_search(&tz_names, - (const byte *)name->ptr(), + (const uchar *)name->ptr(), name->length()))) result_tz= tmp_tzname->tz; else if (time_zone_tables_exist) diff --git a/sql/uniques.cc b/sql/uniques.cc index 9eb827f62a3..7a05ceaddfc 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -34,7 +34,7 @@ #include "sql_sort.h" -int unique_write_to_file(gptr key, element_count count, Unique *unique) +int unique_write_to_file(uchar* key, element_count count, Unique *unique) { /* Use unique->size (size of element stored in the tree) and not @@ -42,11 +42,10 @@ int unique_write_to_file(gptr key, element_count count, Unique *unique) when tree implementation chooses to store pointer to key in TREE_ELEMENT (instead of storing the element itself there) */ - return my_b_write(&unique->file, (byte*) key, - unique->size) ? 1 : 0; + return my_b_write(&unique->file, key, unique->size) ? 1 : 0; } -int unique_write_to_ptrs(gptr key, element_count count, Unique *unique) +int unique_write_to_ptrs(uchar* key, element_count count, Unique *unique) { memcpy(unique->record_pointers, key, unique->size); unique->record_pointers+=unique->size; @@ -330,7 +329,7 @@ bool Unique::flush() if (tree_walk(&tree, (tree_walk_action) unique_write_to_file, (void*) this, left_root_right) || - insert_dynamic(&file_ptrs, (gptr) &file_ptr)) + insert_dynamic(&file_ptrs, (uchar*) &file_ptr)) return 1; delete_tree(&tree); return 0; @@ -374,11 +373,11 @@ struct BUFFPEK_COMPARE_CONTEXT C_MODE_START -static int buffpek_compare(void *arg, byte *key_ptr1, byte *key_ptr2) +static int buffpek_compare(void *arg, uchar *key_ptr1, uchar *key_ptr2) { BUFFPEK_COMPARE_CONTEXT *ctx= (BUFFPEK_COMPARE_CONTEXT *) arg; return ctx->key_compare(ctx->key_compare_arg, - *((byte **) key_ptr1), *((byte **)key_ptr2)); + *((uchar **) key_ptr1), *((uchar **)key_ptr2)); } C_MODE_END @@ -455,7 +454,7 @@ static bool merge_walk(uchar *merge_buffer, ulong merge_buffer_size, if (bytes_read == (uint) (-1)) goto end; DBUG_ASSERT(bytes_read); - queue_insert(&queue, (byte *) top); + queue_insert(&queue, (uchar *) top); } top= (BUFFPEK *) queue_top(&queue); while (queue.elements > 1) @@ -586,7 +585,7 @@ bool Unique::get(TABLE *table) if (my_b_tell(&file) == 0) { /* Whole tree is in memory; Don't use disk if you don't need to */ - if ((record_pointers=table->sort.record_pointers= (byte*) + if ((record_pointers=table->sort.record_pointers= (uchar*) my_malloc(size * tree.elements_in_tree, MYF(0)))) { (void) tree_walk(&tree, (tree_walk_action) unique_write_to_ptrs, @@ -641,7 +640,7 @@ bool Unique::get(TABLE *table) goto err; error=0; err: - x_free((gptr) sort_buffer); + x_free(sort_buffer); if (flush_io_cache(outfile)) error=1; diff --git a/sql/unireg.cc b/sql/unireg.cc index a69a9be6a43..a02d24d8ae5 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -104,7 +104,7 @@ bool mysql_create_frm(THD *thd, const char *file_name, screens, create_info->table_options, data_offset, db_file)) { - my_free((gptr) screen_buff,MYF(0)); + my_free(screen_buff, MYF(0)); if (thd->net.last_errno != ER_TOO_MANY_FIELDS) DBUG_RETURN(1); @@ -116,7 +116,7 @@ bool mysql_create_frm(THD *thd, const char *file_name, create_fields,info_length, screens, create_info->table_options, data_offset, db_file)) { - my_free((gptr) screen_buff,MYF(0)); + my_free(screen_buff, MYF(0)); DBUG_RETURN(1); } } @@ -152,7 +152,7 @@ bool mysql_create_frm(THD *thd, const char *file_name, if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo, create_info, keys)) < 0) { - my_free((gptr) screen_buff,MYF(0)); + my_free(screen_buff, MYF(0)); DBUG_RETURN(1); } @@ -200,8 +200,8 @@ bool mysql_create_frm(THD *thd, const char *file_name, #endif int2store(fileinfo+59,db_file->extra_rec_buf_length()); - if (my_pwrite(file,(byte*) fileinfo,64,0L,MYF_RW) || - my_pwrite(file,(byte*) keybuff,key_info_length, + if (my_pwrite(file, fileinfo, 64, 0L, MYF_RW) || + my_pwrite(file, keybuff, key_info_length, (ulong) uint2korr(fileinfo+6),MYF_RW)) goto err; VOID(my_seek(file, @@ -213,14 +213,14 @@ bool mysql_create_frm(THD *thd, const char *file_name, goto err; int2store(buff, create_info->connect_string.length); - if (my_write(file, (const byte*)buff, 2, MYF(MY_NABP)) || - my_write(file, (const byte*)create_info->connect_string.str, + if (my_write(file, (const uchar*)buff, 2, MYF(MY_NABP)) || + my_write(file, (const uchar*)create_info->connect_string.str, create_info->connect_string.length, MYF(MY_NABP))) goto err; int2store(buff, str_db_type.length); - if (my_write(file, (const byte*)buff, 2, MYF(MY_NABP)) || - my_write(file, (const byte*)str_db_type.str, + if (my_write(file, (const uchar*)buff, 2, MYF(MY_NABP)) || + my_write(file, (const uchar*)str_db_type.str, str_db_type.length, MYF(MY_NABP))) goto err; @@ -229,32 +229,32 @@ bool mysql_create_frm(THD *thd, const char *file_name, { char auto_partitioned= part_info->is_auto_partitioned ? 1 : 0; int4store(buff, part_info->part_info_len); - if (my_write(file, (const byte*)buff, 4, MYF_RW) || - my_write(file, (const byte*)part_info->part_info_string, + if (my_write(file, (const uchar*)buff, 4, MYF_RW) || + my_write(file, (const uchar*)part_info->part_info_string, part_info->part_info_len + 1, MYF_RW) || - my_write(file, (const byte*)&auto_partitioned, 1, MYF_RW)) + my_write(file, (const uchar*)&auto_partitioned, 1, MYF_RW)) goto err; } else #endif { - bzero(buff, 6); - if (my_write(file, (byte*) buff, 6, MYF_RW)) + bzero((uchar*) buff, 6); + if (my_write(file, (uchar*) buff, 6, MYF_RW)) goto err; } for (i= 0; i < keys; i++) { if (key_info[i].parser_name) { - if (my_write(file, (const byte*)key_info[i].parser_name->str, + if (my_write(file, (const uchar*)key_info[i].parser_name->str, key_info[i].parser_name->length + 1, MYF(MY_NABP))) goto err; } } VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0))); - if (my_write(file,(byte*) forminfo,288,MYF_RW) || - my_write(file,(byte*) screen_buff,info_length,MYF_RW) || + if (my_write(file, forminfo, 288, MYF_RW) || + my_write(file, screen_buff, info_length, MYF_RW) || pack_fields(file, create_fields, data_offset)) goto err; @@ -267,7 +267,7 @@ bool mysql_create_frm(THD *thd, const char *file_name, goto err; uint read_length=uint2korr(forminfo)-256; VOID(my_seek(file,filepos+256,MY_SEEK_SET,MYF(0))); - if (read_string(file,(gptr*) &disk_buff,read_length)) + if (read_string(file,(uchar**) &disk_buff,read_length)) goto err; crypted->encode(disk_buff,read_length); delete crypted; @@ -280,8 +280,8 @@ bool mysql_create_frm(THD *thd, const char *file_name, } #endif - my_free((gptr) screen_buff,MYF(0)); - my_free((gptr) keybuff, MYF(0)); + my_free(screen_buff,MYF(0)); + my_free(keybuff, MYF(0)); if (opt_sync_frm && !(create_info->options & HA_LEX_CREATE_TMP_TABLE) && my_sync(file, MYF(MY_WME))) @@ -308,8 +308,8 @@ bool mysql_create_frm(THD *thd, const char *file_name, DBUG_RETURN(0); err: - my_free((gptr) screen_buff,MYF(0)); - my_free((gptr) keybuff, MYF(0)); + my_free(screen_buff, MYF(0)); + my_free(keybuff, MYF(0)); err2: VOID(my_close(file,MYF(MY_WME))); err3: @@ -417,7 +417,7 @@ static uchar *pack_screens(List<create_field> &create_fields, pos[0]= (uchar) start_row-2; /* Header string */ pos[1]= (uchar) (cols >> 2); pos[2]= (uchar) (cols >> 1) +1; - strfill((my_string) pos+3,(uint) (cols >> 1),' '); + strfill((char *) pos+3,(uint) (cols >> 1),' '); pos+=(cols >> 1)+4; } length=(uint) strlen(cfield->field_name); @@ -626,7 +626,8 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type, length= field->save_interval->type_lengths[pos]; hex_length= length * 2; field->interval->type_lengths[pos]= hex_length; - field->interval->type_names[pos]= dst= sql_alloc(hex_length + 1); + field->interval->type_names[pos]= dst= (char*) sql_alloc(hex_length + + 1); octet2hex(dst, src, length); } } @@ -756,13 +757,13 @@ static bool pack_fields(File file, List<create_field> &create_fields, int2store(buff+15, field->comment.length); comment_length+= field->comment.length; set_if_bigger(int_count,field->interval_id); - if (my_write(file,(byte*) buff,FCOMP,MYF_RW)) + if (my_write(file, buff, FCOMP, MYF_RW)) DBUG_RETURN(1); } /* Write fieldnames */ buff[0]=(uchar) NAMES_SEP_CHAR; - if (my_write(file,(byte*) buff,1,MYF_RW)) + if (my_write(file, buff, 1, MYF_RW)) DBUG_RETURN(1); i=0; it.rewind(); @@ -772,7 +773,7 @@ static bool pack_fields(File file, List<create_field> &create_fields, *pos++=NAMES_SEP_CHAR; if (i == create_fields.elements-1) *pos++=0; - if (my_write(file,(byte*) buff,(uint) (pos-(char*) buff),MYF_RW)) + if (my_write(file, buff, (size_t) (pos-(char*) buff),MYF_RW)) DBUG_RETURN(1); i++; } @@ -832,7 +833,7 @@ static bool pack_fields(File file, List<create_field> &create_fields, tmp.append('\0'); // End of intervall } } - if (my_write(file,(byte*) tmp.ptr(),tmp.length(),MYF_RW)) + if (my_write(file,(uchar*) tmp.ptr(),tmp.length(),MYF_RW)) DBUG_RETURN(1); } if (comment_length) @@ -842,7 +843,7 @@ static bool pack_fields(File file, List<create_field> &create_fields, while ((field=it++)) { if (field->comment.length) - if (my_write(file, (byte*) field->comment.str, field->comment.length, + if (my_write(file, (uchar*) field->comment.str, field->comment.length, MYF_RW)) DBUG_RETURN(1); } @@ -875,7 +876,7 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type, bzero((char*) &share, sizeof(share)); table.s= &share; - if (!(buff=(uchar*) my_malloc((uint) reclength,MYF(MY_WME | MY_ZEROFILL)))) + if (!(buff=(uchar*) my_malloc((size_t) reclength,MYF(MY_WME | MY_ZEROFILL)))) { DBUG_RETURN(1); } @@ -900,7 +901,7 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type, regfield don't have to be deleted as it's allocated with sql_alloc() */ Field *regfield= make_field(&share, - (char*) buff+field->offset + data_offset, + buff+field->offset + data_offset, field->length, null_pos + null_count / 8, null_count & 7, @@ -968,10 +969,10 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type, if (null_count & 7) *(null_pos + null_count / 8)|= ~(((uchar) 1 << (null_count & 7)) - 1); - error=(int) my_write(file,(byte*) buff, (uint) reclength,MYF_RW); + error= my_write(file, buff, (size_t) reclength,MYF_RW) != 0; err: - my_free((gptr) buff,MYF(MY_FAE)); + my_free(buff, MYF(MY_FAE)); thd->count_cuted_fields= old_count_cuted_fields; DBUG_RETURN(error); } /* make_empty_rec */ |