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 | f252f9248ab31bbd53132db2c72267592c716c85 (patch) | |
tree | 6480cbef09e9dec2fa347b1899963ab3658d692f /sql/log_event.cc | |
parent | 02af55835fe1f6c3e5dd836dbf2daa7067a140b3 (diff) | |
download | mariadb-git-f252f9248ab31bbd53132db2c72267592c716c85.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/log_event.cc')
-rw-r--r-- | sql/log_event.cc | 414 |
1 files changed, 210 insertions, 204 deletions
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))); } |