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 /strings | |
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 'strings')
41 files changed, 755 insertions, 714 deletions
diff --git a/strings/bchange.c b/strings/bchange.c index f17fb9bea27..0b2c62019b5 100644 --- a/strings/bchange.c +++ b/strings/bchange.c @@ -26,10 +26,10 @@ #include <my_global.h> #include "m_string.h" -void bchange(register char *dst, uint old_length, register const char *src, - uint new_length, uint tot_length) +void bchange(register uchar *dst, size_t old_length, register const uchar *src, + size_t new_length, size_t tot_length) { - uint rest=tot_length-old_length; + size_t rest=tot_length-old_length; if (old_length < new_length) bmove_upp(dst+rest+new_length,dst+tot_length,rest); else diff --git a/strings/bcmp.c b/strings/bcmp.c index fd9ee5c1b96..1b6ed22fc22 100644 --- a/strings/bcmp.c +++ b/strings/bcmp.c @@ -51,9 +51,11 @@ uint len; /* 0 <= len <= 65535 */ #else #ifndef HAVE_purify -int bcmp(register const char *s1,register const char *s2, register uint len) +size_t bcmp(register const uchar *s1,register const uchar *s2, + register size_t len) #else -int my_bcmp(register const char *s1,register const char *s2, register uint len) +size_t my_bcmp(register const uchar *s1,register const uchar *s2, + register size_t len) #endif { while (len-- != 0 && *s1++ == *s2++) ; diff --git a/strings/bmove512.c b/strings/bmove512.c index c3a4b7dfe4e..c3f0446ead6 100644 --- a/strings/bmove512.c +++ b/strings/bmove512.c @@ -36,7 +36,7 @@ #define LONG ulonglong #endif -void bmove512(gptr to, const gptr from, register uint length) +void bmove512(uchar *to, const uchar *from, register size_t length) { reg1 LONG *f,*t,*end= (LONG*) ((char*) from+length); diff --git a/strings/bmove_upp.c b/strings/bmove_upp.c index 02b59bdb703..fb47bda2d1d 100644 --- a/strings/bmove_upp.c +++ b/strings/bmove_upp.c @@ -41,7 +41,8 @@ asm(".L5: "); } #else -void bmove_upp(register char *dst, register const char *src, register uint len) +void bmove_upp(register uchar *dst, register const uchar *src, + register size_t len) { while (len-- != 0) *--dst = *--src; } diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index dba5064ba0c..a0571ff0b22 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -220,7 +220,7 @@ static uint16 big5strokexfrm(uint16 i) static int my_strnncoll_big5_internal(const uchar **a_res, - const uchar **b_res, uint length) + const uchar **b_res, size_t length) { const uchar *a= *a_res, *b= *b_res; @@ -249,11 +249,11 @@ static int my_strnncoll_big5_internal(const uchar **a_res, /* Compare strings */ static int my_strnncoll_big5(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool b_is_prefix) { - uint length= min(a_length, b_length); + size_t length= min(a_length, b_length); int res= my_strnncoll_big5_internal(&a, &b, length); return res ? res : (int)((b_is_prefix ? length : a_length) - b_length); } @@ -262,11 +262,11 @@ static int my_strnncoll_big5(CHARSET_INFO *cs __attribute__((unused)), /* compare strings, ignore end space */ static int my_strnncollsp_big5(CHARSET_INFO * cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference) { - uint length= min(a_length, b_length); + size_t length= min(a_length, b_length); int res= my_strnncoll_big5_internal(&a, &b, length); #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE @@ -301,12 +301,12 @@ static int my_strnncollsp_big5(CHARSET_INFO * cs __attribute__((unused)), } -static int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint len, - const uchar * src, uint srclen) +static size_t my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { uint16 e; - uint dstlen= len; + size_t dstlen= len; len = srclen; while (len--) @@ -327,7 +327,7 @@ static int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)), } #if 0 -static int my_strcoll_big5(const uchar * s1, const uchar * s2) +static int my_strcoll_big5(const uchar *s1, const uchar *s2) { while (*s1 && *s2) @@ -346,7 +346,7 @@ static int my_strcoll_big5(const uchar * s1, const uchar * s2) return 0; } -static int my_strxfrm_big5(uchar * dest, const uchar * src, int len) +static int my_strxfrm_big5(uchar *dest, const uchar *src, int len) { uint16 e; uchar *d = dest; @@ -395,15 +395,16 @@ static int my_strxfrm_big5(uchar * dest, const uchar * src, int len) #define max_sort_char ((char) 255) static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr,uint ptr_length, + const char *ptr,size_t ptr_length, pbool escape, pbool w_one, pbool w_many, - uint res_length, char *min_str,char *max_str, - uint *min_length,uint *max_length) + size_t res_length, + char *min_str, char *max_str, + size_t *min_length, size_t *max_length) { const char *end= ptr + ptr_length; char *min_org=min_str; char *min_end=min_str+res_length; - uint charlen= res_length / cs->mbmaxlen; + size_t charlen= res_length / cs->mbmaxlen; for (; ptr != end && min_str != min_end && charlen > 0; ptr++, charlen--) { @@ -435,7 +436,7 @@ static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)), 'a\0\0... is the smallest possible string when we have space expand a\ff\ff... is the biggest possible string */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (uint) (min_str - min_org) : + *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : res_length); *max_length= res_length; do { @@ -447,21 +448,21 @@ static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)), *min_str++= *max_str++ = *ptr; } - *min_length= *max_length= (uint) (min_str-min_org); + *min_length= *max_length= (size_t) (min_str-min_org); while (min_str != min_end) *min_str++= *max_str++= ' '; return 0; } -static int ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)), - const char* p, const char *e) +static uint ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)), + const char* p, const char *e) { return (isbig5head(*(p)) && (e)-(p)>1 && isbig5tail(*((p)+1))? 2: 0); } -static int mbcharlen_big5(CHARSET_INFO *cs __attribute__((unused)), uint c) +static uint mbcharlen_big5(CHARSET_INFO *cs __attribute__((unused)), uint c) { return (isbig5head(c)? 2 : 1); } @@ -6239,7 +6240,7 @@ static int func_uni_big5_onechar(int code){ static int my_wc_mb_big5(CHARSET_INFO *cs __attribute__((unused)), - my_wc_t wc, unsigned char *s, unsigned char *e) + my_wc_t wc, uchar *s, uchar *e) { int code; @@ -6297,9 +6298,9 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)), CP950 and HKSCS additional characters are also accepted. */ static -uint my_well_formed_len_big5(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e, - uint pos, int *error) +size_t my_well_formed_len_big5(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t pos, int *error) { const char *b0= b; const char *emb= e - 1; /* Last possible end of an MB character */ @@ -6324,7 +6325,7 @@ uint my_well_formed_len_big5(CHARSET_INFO *cs __attribute__((unused)), break; } } - return (uint) (b - b0); + return (size_t) (b - b0); } diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 69f712c5c44..2c30f5402b5 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -69,26 +69,26 @@ static uchar bin_char_array[] = static my_bool my_coll_init_8bit_bin(CHARSET_INFO *cs, - void *(*alloc)(uint) __attribute__((unused))) + void *(*alloc)(size_t) __attribute__((unused))) { cs->max_sort_char=255; return FALSE; } static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)), - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { - uint len=min(slen,tlen); + size_t len=min(slen,tlen); int cmp= memcmp(s,t,len); return cmp ? cmp : (int)((t_is_prefix ? len : slen) - tlen); } -uint my_lengthsp_binary(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr __attribute__((unused)), - uint length) +size_t my_lengthsp_binary(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr __attribute__((unused)), + size_t length) { return length; } @@ -117,8 +117,8 @@ uint my_lengthsp_binary(CHARSET_INFO *cs __attribute__((unused)), */ static int my_strnncollsp_binary(CHARSET_INFO * cs __attribute__((unused)), - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference __attribute__((unused))) { @@ -127,11 +127,11 @@ static int my_strnncollsp_binary(CHARSET_INFO * cs __attribute__((unused)), static int my_strnncoll_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { - uint len=min(slen,tlen); + size_t len=min(slen,tlen); int cmp= memcmp(s,t,len); return cmp ? cmp : (int)((t_is_prefix ? len : slen) - tlen); } @@ -163,12 +163,12 @@ static int my_strnncoll_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), */ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference) { const uchar *end; - uint length; + size_t length; int res; #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE @@ -211,17 +211,18 @@ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), /* This function is used for all conversion functions */ -static uint my_case_str_bin(CHARSET_INFO *cs __attribute__((unused)), - char *str __attribute__((unused))) +static size_t my_case_str_bin(CHARSET_INFO *cs __attribute__((unused)), + char *str __attribute__((unused))) { return 0; } -static uint my_case_bin(CHARSET_INFO *cs __attribute__((unused)), - char *src __attribute__((unused)), - uint srclen, - char *dst __attribute__((unused)), - uint dstlen __attribute__((unused))) + +static size_t my_case_bin(CHARSET_INFO *cs __attribute__((unused)), + char *src __attribute__((unused)), + size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) { return srclen; } @@ -234,8 +235,8 @@ static int my_strcasecmp_bin(CHARSET_INFO * cs __attribute__((unused)), } -int my_mbcharlen_8bit(CHARSET_INFO *cs __attribute__((unused)), - uint c __attribute__((unused))) +uint my_mbcharlen_8bit(CHARSET_INFO *cs __attribute__((unused)), + uint c __attribute__((unused))) { return 1; } @@ -243,8 +244,8 @@ int my_mbcharlen_8bit(CHARSET_INFO *cs __attribute__((unused)), static int my_mb_wc_bin(CHARSET_INFO *cs __attribute__((unused)), my_wc_t *wc, - const unsigned char *str, - const unsigned char *end __attribute__((unused))) + const uchar *str, + const uchar *end __attribute__((unused))) { if (str >= end) return MY_CS_TOOSMALL; @@ -256,8 +257,8 @@ static int my_mb_wc_bin(CHARSET_INFO *cs __attribute__((unused)), static int my_wc_mb_bin(CHARSET_INFO *cs __attribute__((unused)), my_wc_t wc, - unsigned char *s, - unsigned char *e __attribute__((unused))) + uchar *s, + uchar *e __attribute__((unused))) { if (s >= e) return MY_CS_TOOSMALL; @@ -272,7 +273,7 @@ static int my_wc_mb_bin(CHARSET_INFO *cs __attribute__((unused)), void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *key, uint len,ulong *nr1, ulong *nr2) + const uchar *key, size_t len,ulong *nr1, ulong *nr2) { const uchar *pos = key; @@ -374,9 +375,9 @@ int my_wildcmp_bin(CHARSET_INFO *cs, } -static int my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint dstlen, - const uchar *src, uint srclen) +static size_t my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t dstlen, + const uchar *src, size_t srclen) { if (dest != src) memcpy(dest, src, min(dstlen,srclen)); @@ -387,9 +388,9 @@ static int my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)), static -int my_strnxfrm_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint dstlen, - const uchar *src, uint srclen) +size_t my_strnxfrm_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t dstlen, + const uchar *src, size_t srclen) { if (dest != src) memcpy(dest, src, min(dstlen,srclen)); @@ -401,8 +402,8 @@ int my_strnxfrm_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), static uint my_instr_bin(CHARSET_INFO *cs __attribute__((unused)), - const char *b, uint b_length, - const char *s, uint s_length, + const char *b, size_t b_length, + const char *s, size_t s_length, my_match_t *match, uint nmatch) { register const uchar *str, *search, *end, *search_end; @@ -442,7 +443,7 @@ skip: if (nmatch > 0) { match[0].beg= 0; - match[0].end= (uint) (str- (const uchar*)b-1); + match[0].end= (size_t) (str- (const uchar*)b-1); match[0].mb_len= match[0].end; if (nmatch > 1) @@ -462,65 +463,65 @@ skip: MY_COLLATION_HANDLER my_collation_8bit_bin_handler = { - my_coll_init_8bit_bin, - my_strnncoll_8bit_bin, - my_strnncollsp_8bit_bin, - my_strnxfrm_8bit_bin, - my_strnxfrmlen_simple, - my_like_range_simple, - my_wildcmp_bin, - my_strcasecmp_bin, - my_instr_bin, - my_hash_sort_bin, - my_propagate_simple + my_coll_init_8bit_bin, + my_strnncoll_8bit_bin, + my_strnncollsp_8bit_bin, + my_strnxfrm_8bit_bin, + my_strnxfrmlen_simple, + my_like_range_simple, + my_wildcmp_bin, + my_strcasecmp_bin, + my_instr_bin, + my_hash_sort_bin, + my_propagate_simple }; static MY_COLLATION_HANDLER my_collation_binary_handler = { - NULL, /* init */ - my_strnncoll_binary, - my_strnncollsp_binary, - my_strnxfrm_bin, - my_strnxfrmlen_simple, - my_like_range_simple, - my_wildcmp_bin, - my_strcasecmp_bin, - my_instr_bin, - my_hash_sort_bin, - my_propagate_simple + NULL, /* init */ + my_strnncoll_binary, + my_strnncollsp_binary, + my_strnxfrm_bin, + my_strnxfrmlen_simple, + my_like_range_simple, + my_wildcmp_bin, + my_strcasecmp_bin, + my_instr_bin, + my_hash_sort_bin, + my_propagate_simple }; static MY_CHARSET_HANDLER my_charset_handler= { - NULL, /* init */ - NULL, /* ismbchar */ - my_mbcharlen_8bit, /* mbcharlen */ - my_numchars_8bit, - my_charpos_8bit, - my_well_formed_len_8bit, - my_lengthsp_binary, - my_numcells_8bit, - my_mb_wc_bin, - my_wc_mb_bin, - my_mb_ctype_8bit, - my_case_str_bin, - my_case_str_bin, - my_case_bin, - my_case_bin, - my_snprintf_8bit, - my_long10_to_str_8bit, - my_longlong10_to_str_8bit, - my_fill_8bit, - my_strntol_8bit, - my_strntoul_8bit, - my_strntoll_8bit, - my_strntoull_8bit, - my_strntod_8bit, - my_strtoll10_8bit, - my_strntoull10rnd_8bit, - my_scan_8bit + NULL, /* init */ + NULL, /* ismbchar */ + my_mbcharlen_8bit, /* mbcharlen */ + my_numchars_8bit, + my_charpos_8bit, + my_well_formed_len_8bit, + my_lengthsp_binary, + my_numcells_8bit, + my_mb_wc_bin, + my_wc_mb_bin, + my_mb_ctype_8bit, + my_case_str_bin, + my_case_str_bin, + my_case_bin, + my_case_bin, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit }; diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c index dc8d1d7cb22..72b00679e1c 100644 --- a/strings/ctype-cp932.c +++ b/strings/ctype-cp932.c @@ -182,13 +182,13 @@ static uchar NEAR sort_order_cp932[]= (0x80<=(c) && (c)<=0xfc)) -static int ismbchar_cp932(CHARSET_INFO *cs __attribute__((unused)), +static uint ismbchar_cp932(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) { return (iscp932head((uchar) *p) && (e-p)>1 && iscp932tail((uchar)p[1]) ? 2: 0); } -static int mbcharlen_cp932(CHARSET_INFO *cs __attribute__((unused)),uint c) +static uint mbcharlen_cp932(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (iscp932head((uchar) c) ? 2 : 1); } @@ -198,8 +198,8 @@ static int mbcharlen_cp932(CHARSET_INFO *cs __attribute__((unused)),uint c) static int my_strnncoll_cp932_internal(CHARSET_INFO *cs, - const uchar **a_res, uint a_length, - const uchar **b_res, uint b_length) + const uchar **a_res, size_t a_length, + const uchar **b_res, size_t b_length) { const uchar *a= *a_res, *b= *b_res; const uchar *a_end= a + a_length; @@ -230,8 +230,8 @@ static int my_strnncoll_cp932_internal(CHARSET_INFO *cs, static int my_strnncoll_cp932(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool b_is_prefix) { int res= my_strnncoll_cp932_internal(cs, &a, a_length, &b, b_length); @@ -242,8 +242,8 @@ static int my_strnncoll_cp932(CHARSET_INFO *cs __attribute__((unused)), static int my_strnncollsp_cp932(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference __attribute__((unused))) { @@ -275,9 +275,9 @@ static int my_strnncollsp_cp932(CHARSET_INFO *cs __attribute__((unused)), -static int my_strnxfrm_cp932(CHARSET_INFO *cs __attribute__((unused)), - uchar *dest, uint len, - const uchar *src, uint srclen) +static size_t my_strnxfrm_cp932(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { uchar *d_end = dest + len; uchar *s_end = (uchar*) src + srclen; @@ -318,10 +318,11 @@ static int my_strnxfrm_cp932(CHARSET_INFO *cs __attribute__((unused)), #define max_sort_char ((char) 255) static my_bool my_like_range_cp932(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr,uint ptr_length, - pbool escape, pbool w_one, pbool w_many, - uint res_length, char *min_str,char *max_str, - uint *min_length,uint *max_length) + const char *ptr,size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str,char *max_str, + size_t *min_length, size_t *max_length) { const char *end=ptr+ptr_length; char *min_org=min_str; @@ -350,7 +351,7 @@ static my_bool my_like_range_cp932(CHARSET_INFO *cs __attribute__((unused)), } if (*ptr == w_many) { /* '%' in SQL */ - *min_length = (uint)(min_str - min_org); + *min_length = (size_t)(min_str - min_org); *max_length = res_length; do { @@ -361,7 +362,7 @@ static my_bool my_like_range_cp932(CHARSET_INFO *cs __attribute__((unused)), } *min_str++ = *max_str++ = *ptr++; } - *min_length = *max_length = (uint)(min_str - min_org); + *min_length = *max_length = (size_t) (min_str - min_org); while (min_str < min_end) *min_str++ = *max_str++ = ' '; /* Because if key compression */ return 0; @@ -5378,12 +5379,12 @@ my_mb_wc_cp932(CHARSET_INFO *cs __attribute__((unused)), } static -uint my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)), +size_t my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)), const char *str, const char *str_end) { - uint clen= 0; - const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) str_end; + size_t clen= 0; + const uchar *b= (const uchar *) str; + const uchar *e= (const uchar *) str_end; for (clen= 0; b < e; ) { @@ -5410,9 +5411,11 @@ uint my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)), Returns a well formed length of a cp932 string. cp932 additional characters are also accepted. */ + static -uint my_well_formed_len_cp932(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e, uint pos, int *error) +size_t my_well_formed_len_cp932(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t pos, int *error) { const char *b0= b; *error= 0; @@ -5445,7 +5448,7 @@ uint my_well_formed_len_cp932(CHARSET_INFO *cs __attribute__((unused)), break; } } - return (uint) (b - b0); + return (size_t) (b - b0); } diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c index d0104a50f4a..a5df86cc6b3 100644 --- a/strings/ctype-czech.c +++ b/strings/ctype-czech.c @@ -83,7 +83,7 @@ below for what are the "special values" */ -static uchar * CZ_SORT_TABLE[] = { +static uchar *CZ_SORT_TABLE[] = { (uchar*) "\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\043\044\045\046\047\050\051\052\053\054\000\000\000\000\000\000\000\003\004\377\007\010\011\012\013\015\016\017\020\022\023\024\025\026\027\031\033\034\035\036\037\040\041\000\000\000\000\000\000\003\004\377\007\010\011\012\013\015\016\017\020\022\023\024\025\026\027\031\033\034\035\036\037\040\041\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\003\000\021\000\020\032\000\000\032\032\033\042\000\042\042\000\003\000\021\000\020\032\000\000\032\032\033\042\000\042\042\027\003\003\003\003\020\006\006\006\010\010\010\010\015\015\007\007\023\023\024\024\024\024\000\030\034\034\034\034\040\033\000\027\003\003\003\003\020\006\006\006\010\010\010\010\015\015\007\007\023\023\024\024\024\024\000\030\034\034\034\034\040\033\000", (uchar*) "\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\106\107\110\111\112\113\114\115\116\117\000\000\000\000\000\000\000\003\011\377\016\021\026\027\030\032\035\036\037\043\044\047\054\055\056\061\065\070\075\076\077\100\102\000\000\000\000\000\000\003\011\377\016\021\026\027\030\032\035\036\037\043\044\047\054\055\056\061\065\070\075\076\077\100\102\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\010\000\042\000\041\063\000\000\062\064\066\104\000\103\105\000\010\000\042\000\041\063\000\000\062\064\066\104\000\103\105\057\004\005\007\006\040\014\015\013\022\025\024\023\033\034\017\020\046\045\050\051\053\052\000\060\072\071\074\073\101\067\000\057\004\005\007\006\040\014\015\013\022\025\024\023\033\034\017\020\046\045\050\051\053\052\000\060\072\071\074\073\101\067\000", (uchar*) "\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\212\213\214\215\216\217\220\221\222\223\000\000\000\000\000\000\000\004\020\377\032\040\052\054\056\063\071\073\075\105\107\115\127\131\133\141\151\157\171\173\175\177\203\000\000\000\000\000\000\003\017\377\031\037\051\053\055\062\070\072\074\104\106\114\126\130\132\140\150\156\170\172\174\176\202\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\016\000\103\000\101\145\000\000\143\147\153\207\000\205\211\000\015\000\102\000\100\144\000\000\142\146\152\206\000\204\210\135\006\010\014\012\077\026\030\024\042\050\046\044\065\067\034\036\113\111\117\121\125\123\000\137\163\161\167\165\201\155\000\134\005\007\013\011\076\025\027\023\041\047\045\043\064\066\033\035\112\110\116\120\124\122\000\136\162\160\166\164\200\154\000", @@ -99,7 +99,7 @@ static uchar * CZ_SORT_TABLE[] = { struct wordvalue { const char * word; - uchar * outvalue; + uchar *outvalue; }; static struct wordvalue doubles[] = { { "ch", (uchar*) "\014\031\057\057" }, @@ -190,8 +190,8 @@ while (1) \ { p++; continue; } /* ignore value */ \ if (value == 2) /* space */ \ { \ - const uchar * tmp; \ - const uchar * runner = ++p; \ + const uchar *tmp; \ + const uchar *runner = ++p; \ while (!(IS_END(runner, src, len)) && (CZ_SORT_TABLE[pass][*runner] == 2)) \ runner++; /* skip all spaces */ \ if (IS_END(runner, src, len) && SKIP_TRAILING_SPACES) \ @@ -240,12 +240,12 @@ while (1) \ */ static int my_strnncoll_czech(CHARSET_INFO *cs __attribute__((unused)), - const uchar * s1, uint len1, - const uchar * s2, uint len2, + const uchar *s1, size_t len1, + const uchar *s2, size_t len2, my_bool s2_is_prefix) { int v1, v2; - const uchar * p1, * p2, * store1, * store2; + const uchar *p1, * p2, * store1, * store2; int pass1 = 0, pass2 = 0; if (s2_is_prefix && len1 > len2) @@ -274,8 +274,8 @@ static int my_strnncoll_czech(CHARSET_INFO *cs __attribute__((unused)), static int my_strnncollsp_czech(CHARSET_INFO * cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference __attribute__((unused))) { @@ -290,14 +290,14 @@ int my_strnncollsp_czech(CHARSET_INFO * cs, the length of the strings being specified */ -static int my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint len, - const uchar * src, uint srclen) +static size_t my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { int value; - const uchar * p, * store; + const uchar *p, * store; int pass = 0; - uint totlen = 0; + size_t totlen = 0; p = src; store = src; do @@ -361,11 +361,11 @@ static int my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)), #define EXAMPLE static my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr,uint ptr_length, + const char *ptr,size_t ptr_length, pbool escape, pbool w_one, pbool w_many, - uint res_length, char *min_str, + size_t res_length, char *min_str, char *max_str, - uint *min_length,uint *max_length) + size_t *min_length,size_t *max_length) { #ifdef EXAMPLE uchar value; @@ -396,7 +396,7 @@ static my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)), } if (cs->state & MY_CS_BINSORT) - *min_length= (uint) (min_str - min_org); + *min_length= (size_t) (min_str - min_org); else { /* 'a\0\0... is the smallest possible string */ diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index a90489cf7c6..844d8cc3ff5 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -182,15 +182,15 @@ static uchar NEAR sort_order_euc_kr[]= #define iseuc_kr(c) ((0xa1<=(uchar)(c) && (uchar)(c)<=0xfe)) -static int ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)), - const char* p, const char *e) +static uint ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)), + const char* p, const char *e) { return ((*(uchar*)(p)<0x80)? 0:\ iseuc_kr(*(p)) && (e)-(p)>1 && iseuc_kr(*((p)+1))? 2:\ 0); } -static int mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c) +static uint mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (iseuc_kr(c) ? 2 : 1); } @@ -8608,6 +8608,7 @@ my_wc_mb_euc_kr(CHARSET_INFO *cs __attribute__((unused)), return 2; } + static int my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)), my_wc_t *pwc, const uchar *s, const uchar *e) @@ -8637,10 +8638,10 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)), /* Returns well formed length of a EUC-KR string. */ -static uint +static size_t my_well_formed_len_euckr(CHARSET_INFO *cs __attribute__((unused)), const char *b, const char *e, - uint pos, int *error) + size_t pos, int *error) { const char *b0= b; const char *emb= e - 1; /* Last possible end of an MB character */ @@ -8665,7 +8666,7 @@ my_well_formed_len_euckr(CHARSET_INFO *cs __attribute__((unused)), break; } } - return (uint) (b - b0); + return (size_t) (b - b0); } diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c index eb1811b19bf..14be5e84d21 100644 --- a/strings/ctype-eucjpms.c +++ b/strings/ctype-eucjpms.c @@ -185,7 +185,7 @@ static uchar NEAR sort_order_eucjpms[]= #define iseucjpms_ss3(c) (((c)&0xff) == 0x8f) -static int ismbchar_eucjpms(CHARSET_INFO *cs __attribute__((unused)), +static uint ismbchar_eucjpms(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) { return ((*(uchar*)(p)<0x80)? 0:\ @@ -195,7 +195,7 @@ static int ismbchar_eucjpms(CHARSET_INFO *cs __attribute__((unused)), 0); } -static int mbcharlen_eucjpms(CHARSET_INFO *cs __attribute__((unused)),uint c) +static uint mbcharlen_eucjpms(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (iseucjpms(c)? 2: iseucjpms_ss2(c)? 2: iseucjpms_ss3(c)? 3: 1); } @@ -8387,8 +8387,9 @@ my_jisx0212_uni_onechar(int code){ */ static -uint my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)), - const char *beg, const char *end, uint pos, int *error) +size_t my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)), + const char *beg, const char *end, size_t pos, + int *error) { const uchar *b= (uchar *) beg; *error=0; @@ -8427,19 +8428,19 @@ uint my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)), *b >= 0xA1 && *b <= 0xFE) /* [xA1-xFE][xA1-xFE] */ continue; *error=1; - return (uint) (chbeg - beg); /* invalid sequence */ + return (size_t) (chbeg - beg); /* invalid sequence */ } - return (uint) (b - (uchar *) beg); + return (size_t) (b - (uchar *) beg); } static -uint my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), - const char *str, const char *str_end) +size_t my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), + const char *str, const char *str_end) { - uint clen= 0; - const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) str_end; + size_t clen; + const uchar *b= (const uchar *) str; + const uchar *e= (const uchar *) str_end; for (clen= 0; b < e; ) { @@ -8555,9 +8556,9 @@ my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *pwc, const uchar *s, const uchar *e) } static int -my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e) +my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, uchar *s, uchar *e) { - unsigned char c1; + uchar c1; int jp; if (s >= e) diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index 6b4238859d5..21aeb8b7990 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -165,13 +165,13 @@ static uchar NEAR sort_order_gb2312[]= #define isgb2312tail(c) (0xa1<=(uchar)(c) && (uchar)(c)<=0xfe) -static int ismbchar_gb2312(CHARSET_INFO *cs __attribute__((unused)), +static uint ismbchar_gb2312(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) { return (isgb2312head(*(p)) && (e)-(p)>1 && isgb2312tail(*((p)+1))? 2: 0); } -static int mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c) +static uint mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (isgb2312head(c)? 2 : 1); } @@ -5688,10 +5688,10 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)), /* Returns well formed length of a EUC-KR string. */ -static uint +static size_t my_well_formed_len_gb2312(CHARSET_INFO *cs __attribute__((unused)), const char *b, const char *e, - uint pos, int *error) + size_t pos, int *error) { const char *b0= b; const char *emb= e - 1; /* Last possible end of an MB character */ @@ -5716,7 +5716,7 @@ my_well_formed_len_gb2312(CHARSET_INFO *cs __attribute__((unused)), break; } } - return (uint) (b - b0); + return (size_t) (b - b0); } diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index d88f4786017..e9a2b7cf832 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -2582,7 +2582,7 @@ static uint16 gbksortorder(uint16 i) int my_strnncoll_gbk_internal(const uchar **a_res, const uchar **b_res, - uint length) + size_t length) { const uchar *a= *a_res, *b= *b_res; uint a_char,b_char; @@ -2612,22 +2612,22 @@ int my_strnncoll_gbk_internal(const uchar **a_res, const uchar **b_res, int my_strnncoll_gbk(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool b_is_prefix) { - uint length= min(a_length, b_length); + size_t length= min(a_length, b_length); int res= my_strnncoll_gbk_internal(&a, &b, length); return res ? res : (int) ((b_is_prefix ? length : a_length) - b_length); } static int my_strnncollsp_gbk(CHARSET_INFO * cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference) { - uint length= min(a_length, b_length); + size_t length= min(a_length, b_length); int res= my_strnncoll_gbk_internal(&a, &b, length); #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE @@ -2662,12 +2662,12 @@ static int my_strnncollsp_gbk(CHARSET_INFO * cs __attribute__((unused)), } -static int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint len, - const uchar * src, uint srclen) +static size_t my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { uint16 e; - uint dstlen= len; + size_t dstlen= len; len = srclen; while (len--) @@ -2708,15 +2708,16 @@ static int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)), #define max_sort_char ((uchar) 255) static my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr,uint ptr_length, + const char *ptr,size_t ptr_length, pbool escape, pbool w_one, pbool w_many, - uint res_length, char *min_str,char *max_str, - uint *min_length,uint *max_length) + size_t res_length, + char *min_str,char *max_str, + size_t *min_length,size_t *max_length) { const char *end= ptr + ptr_length; char *min_org=min_str; char *min_end=min_str+res_length; - uint charlen= res_length / cs->mbmaxlen; + size_t charlen= res_length / cs->mbmaxlen; for (; ptr != end && min_str != min_end && charlen > 0; ptr++, charlen--) { @@ -2748,7 +2749,7 @@ static my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)), 'a\0\0... is the smallest possible string when we have space expand a\ff\ff... is the biggest possible string */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (uint) (min_str - min_org) : + *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : res_length); *max_length= res_length; do { @@ -2760,20 +2761,20 @@ static my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)), *min_str++= *max_str++ = *ptr; } - *min_length= *max_length = (uint) (min_str - min_org); + *min_length= *max_length = (size_t) (min_str - min_org); while (min_str != min_end) *min_str++= *max_str++= ' '; /* Because if key compression */ return 0; } -static int ismbchar_gbk(CHARSET_INFO *cs __attribute__((unused)), +static uint ismbchar_gbk(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) { return (isgbkhead(*(p)) && (e)-(p)>1 && isgbktail(*((p)+1))? 2: 0); } -static int mbcharlen_gbk(CHARSET_INFO *cs __attribute__((unused)),uint c) +static uint mbcharlen_gbk(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (isgbkhead(c)? 2 : 1); } @@ -9940,9 +9941,9 @@ my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)), Returns well formed length of a GBK string. */ static -uint my_well_formed_len_gbk(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e, - uint pos, int *error) +size_t my_well_formed_len_gbk(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t pos, int *error) { const char *b0= b; const char *emb= e - 1; /* Last possible end of an MB character */ @@ -9967,7 +9968,7 @@ uint my_well_formed_len_gbk(CHARSET_INFO *cs __attribute__((unused)), break; } } - return (uint) (b - b0); + return (size_t) (b - b0); } diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index 30e0abb35d5..e5333c4101b 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -150,7 +150,7 @@ unsigned short cs_to_uni[256]={ 0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF }; -unsigned char pl00[256]={ +uchar pl00[256]={ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, @@ -184,7 +184,7 @@ unsigned char pl00[256]={ 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7, 0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF }; -unsigned char pl01[256]={ +uchar pl01[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -218,7 +218,7 @@ unsigned char pl01[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; -unsigned char pl02[256]={ +uchar pl02[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -252,7 +252,7 @@ unsigned char pl02[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; -unsigned char pl20[256]={ +uchar pl20[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x96,0x97,0x00,0x00,0x00, @@ -286,7 +286,7 @@ unsigned char pl20[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; -unsigned char pl21[256]={ +uchar pl21[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -320,7 +320,7 @@ unsigned char pl21[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; -unsigned char *uni_to_cs[256]={ +uchar *uni_to_cs[256]={ pl00,pl01,pl02,NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, @@ -358,8 +358,8 @@ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL static int my_mb_wc_latin1(CHARSET_INFO *cs __attribute__((unused)), my_wc_t *wc, - const unsigned char *str, - const unsigned char *end __attribute__((unused))) + const uchar *str, + const uchar *end __attribute__((unused))) { if (str >= end) return MY_CS_TOOSMALL; @@ -371,10 +371,10 @@ int my_mb_wc_latin1(CHARSET_INFO *cs __attribute__((unused)), static int my_wc_mb_latin1(CHARSET_INFO *cs __attribute__((unused)), my_wc_t wc, - unsigned char *str, - unsigned char *end __attribute__((unused))) + uchar *str, + uchar *end __attribute__((unused))) { - unsigned char *pl; + uchar *pl; if (str >= end) return MY_CS_TOOSMALL; @@ -543,8 +543,8 @@ uchar combo2map[]={ static int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool b_is_prefix) { const uchar *a_end= a + a_length; @@ -584,8 +584,8 @@ static int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)), static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference) { const uchar *a_end= a + a_length, *b_end= b + b_length; @@ -655,9 +655,9 @@ static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)), } -static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint len, - const uchar * src, uint srclen) +static size_t my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { const uchar *de = dest + len; const uchar *se = src + srclen; @@ -675,7 +675,7 @@ static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)), void my_hash_sort_latin1_de(CHARSET_INFO *cs __attribute__((unused)), - const uchar *key, uint len, + const uchar *key, size_t len, ulong *nr1, ulong *nr2) { const uchar *end= key+len; diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 4234ac091cd..bcdb23096f3 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -20,7 +20,7 @@ #ifdef USE_MB -uint my_caseup_str_mb(CHARSET_INFO * cs, char *str) +size_t my_caseup_str_mb(CHARSET_INFO * cs, char *str) { register uint32 l; register uchar *map= cs->to_upper; @@ -37,10 +37,11 @@ uint my_caseup_str_mb(CHARSET_INFO * cs, char *str) str++; } } - return str - str_orig; + return (size_t) (str - str_orig); } -uint my_casedn_str_mb(CHARSET_INFO * cs, char *str) + +size_t my_casedn_str_mb(CHARSET_INFO * cs, char *str) { register uint32 l; register uchar *map= cs->to_lower; @@ -57,12 +58,13 @@ uint my_casedn_str_mb(CHARSET_INFO * cs, char *str) str++; } } - return str - str_orig; + return (size_t) (str - str_orig); } -uint my_caseup_mb(CHARSET_INFO * cs, char *src, uint srclen, - char *dst __attribute__((unused)), - uint dstlen __attribute__((unused))) + +size_t my_caseup_mb(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) { register uint32 l; register char *srcend= src + srclen; @@ -82,9 +84,10 @@ uint my_caseup_mb(CHARSET_INFO * cs, char *src, uint srclen, return srclen; } -uint my_casedn_mb(CHARSET_INFO * cs, char *src, uint srclen, - char *dst __attribute__((unused)), - uint dstlen __attribute__((unused))) + +size_t my_casedn_mb(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) { register uint32 l; register char *srcend= src + srclen; @@ -104,9 +107,11 @@ uint my_casedn_mb(CHARSET_INFO * cs, char *src, uint srclen, return srclen; } + /* my_strcasecmp_mb() returns 0 if strings are equal, non-zero otherwise. */ + int my_strcasecmp_mb(CHARSET_INFO * cs,const char *s, const char *t) { register uint32 l; @@ -250,10 +255,10 @@ int my_wildcmp_mb(CHARSET_INFO *cs, } -uint my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)), +size_t my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)), const char *pos, const char *end) { - register uint32 count=0; + register size_t count= 0; while (pos < end) { uint mb_len; @@ -264,8 +269,8 @@ uint my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)), } -uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)), - const char *pos, const char *end, uint length) +size_t my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)), + const char *pos, const char *end, size_t length) { const char *start= pos; @@ -275,12 +280,12 @@ uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)), pos+= (mb_len= my_ismbchar(cs, pos, end)) ? mb_len : 1; length--; } - return (uint) (length ? end+2-start : pos-start); + return (size_t) (length ? end+2-start : pos-start); } -uint my_well_formed_len_mb(CHARSET_INFO *cs, const char *b, const char *e, - uint pos, int *error) +size_t my_well_formed_len_mb(CHARSET_INFO *cs, const char *b, const char *e, + size_t pos, int *error) { const char *b_start= b; *error= 0; @@ -297,14 +302,13 @@ uint my_well_formed_len_mb(CHARSET_INFO *cs, const char *b, const char *e, b+= mb_len; pos--; } - return (uint) (b - b_start); + return (size_t) (b - b_start); } - uint my_instr_mb(CHARSET_INFO *cs, - const char *b, uint b_length, - const char *s, uint s_length, + const char *b, size_t b_length, + const char *s, size_t s_length, my_match_t *match, uint nmatch) { register const char *end, *b0; @@ -330,13 +334,13 @@ uint my_instr_mb(CHARSET_INFO *cs, { int mb_len; - if (!cs->coll->strnncoll(cs, (unsigned char*) b, s_length, - (unsigned char*) s, s_length, 0)) + if (!cs->coll->strnncoll(cs, (uchar*) b, s_length, + (uchar*) s, s_length, 0)) { if (nmatch) { match[0].beg= 0; - match[0].end= (uint) (b-b0); + match[0].end= (size_t) (b-b0); match[0].mb_len= res; if (nmatch > 1) { @@ -360,11 +364,11 @@ uint my_instr_mb(CHARSET_INFO *cs, /* BINARY collations handlers for MB charsets */ static int my_strnncoll_mb_bin(CHARSET_INFO * cs __attribute__((unused)), - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { - uint len=min(slen,tlen); + size_t len=min(slen,tlen); int cmp= memcmp(s,t,len); return cmp ? cmp : (int) ((t_is_prefix ? len : slen) - tlen); } @@ -396,12 +400,12 @@ static int my_strnncoll_mb_bin(CHARSET_INFO * cs __attribute__((unused)), */ static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference) { const uchar *end; - uint length; + size_t length; int res; #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE @@ -442,9 +446,9 @@ static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), } -static int my_strnxfrm_mb_bin(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint dstlen, - const uchar *src, uint srclen) +static size_t my_strnxfrm_mb_bin(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t dstlen, + const uchar *src, size_t srclen) { if (dest != src) memcpy(dest, src, min(dstlen, srclen)); @@ -461,7 +465,7 @@ static int my_strcasecmp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), } static void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *key, uint len,ulong *nr1, ulong *nr2) + const uchar *key, size_t len,ulong *nr1, ulong *nr2) { const uchar *pos = key; @@ -544,18 +548,18 @@ static void pad_max_char(CHARSET_INFO *cs, char *str, char *end) */ my_bool my_like_range_mb(CHARSET_INFO *cs, - const char *ptr,uint ptr_length, + const char *ptr,size_t ptr_length, pbool escape, pbool w_one, pbool w_many, - uint res_length, + size_t res_length, char *min_str,char *max_str, - uint *min_length,uint *max_length) + size_t *min_length,size_t *max_length) { uint mb_len; const char *end= ptr + ptr_length; char *min_org= min_str; char *min_end= min_str + res_length; char *max_end= max_str + res_length; - uint maxcharlen= res_length / cs->mbmaxlen; + size_t maxcharlen= res_length / cs->mbmaxlen; for (; ptr != end && min_str != min_end && maxcharlen ; maxcharlen--) { @@ -569,7 +573,7 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, 'a\0\0... is the smallest possible string when we have space expand a\ff\ff... is the biggest possible string */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (uint) (min_str - min_org) : + *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : res_length); *max_length= res_length; /* Create min key */ @@ -599,7 +603,7 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, } - *min_length= *max_length = (uint) (min_str - min_org); + *min_length= *max_length = (size_t) (min_str - min_org); while (min_str != min_end) *min_str++= *max_str++= ' '; /* Because if key compression */ return 0; @@ -919,10 +923,11 @@ static struct {int page; char *p;} utr11_data[256]= {0,NULL},{1,NULL},{0,pgFA},{0,NULL},{0,NULL},{0,NULL},{0,pgFE},{0,pgFF} }; -uint my_numcells_mb(CHARSET_INFO *cs, const char *b, const char *e) + +size_t my_numcells_mb(CHARSET_INFO *cs, const char *b, const char *e) { my_wc_t wc; - int clen= 0; + size_t clen= 0; while (b < e) { @@ -944,7 +949,7 @@ uint my_numcells_mb(CHARSET_INFO *cs, const char *b, const char *e) int my_mb_ctype_mb(CHARSET_INFO *cs, int *ctype, - const unsigned char *s, const unsigned char *e) + const uchar *s, const uchar *e) { my_wc_t wc; int res= cs->cset->mb_wc(cs, &wc, s, e); @@ -958,7 +963,6 @@ int my_mb_ctype_mb(CHARSET_INFO *cs, int *ctype, } - MY_COLLATION_HANDLER my_collation_mb_bin_handler = { NULL, /* init */ diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index c129f117744..99e41611eaa 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -24,7 +24,8 @@ /* Returns the number of bytes required for strnxfrm(). */ -uint my_strnxfrmlen_simple(CHARSET_INFO *cs, uint len) + +size_t my_strnxfrmlen_simple(CHARSET_INFO *cs, size_t len) { return len * (cs->strxfrm_multiply ? cs->strxfrm_multiply : 1); } @@ -70,12 +71,12 @@ uint my_strnxfrmlen_simple(CHARSET_INFO *cs, uint len) */ -int my_strnxfrm_simple(CHARSET_INFO * cs, - uchar *dest, uint len, - const uchar *src, uint srclen) +size_t my_strnxfrm_simple(CHARSET_INFO * cs, + uchar *dest, size_t len, + const uchar *src, size_t srclen) { uchar *map= cs->sort_order; - uint dstlen= len; + size_t dstlen= len; set_if_smaller(len, srclen); if (dest != src) { @@ -94,11 +95,12 @@ int my_strnxfrm_simple(CHARSET_INFO * cs, return dstlen; } -int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, uint slen, - const uchar *t, uint tlen, + +int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { - int len = ( slen > tlen ) ? tlen : slen; + size_t len = ( slen > tlen ) ? tlen : slen; uchar *map= cs->sort_order; if (t_is_prefix && slen > tlen) slen=tlen; @@ -107,7 +109,11 @@ int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, uint slen, if (map[*s++] != map[*t++]) return ((int) map[s[-1]] - (int) map[t[-1]]); } - return (int) (slen - tlen); + /* + We can't use (slen - tlen) here as the result may be outside of the + precision of a signed int + */ + return slen > tlen ? 1 : slen < tlen ? -1 : 0 ; } @@ -141,12 +147,12 @@ int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, uint slen, > 0 a > b */ -int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_length, - const uchar *b, uint b_length, +int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference) { const uchar *map= cs->sort_order, *end; - uint length; + size_t length; int res; #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE @@ -187,48 +193,49 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_length, } -uint my_caseup_str_8bit(CHARSET_INFO * cs,char *str) +size_t my_caseup_str_8bit(CHARSET_INFO * cs,char *str) { register uchar *map= cs->to_upper; char *str_orig= str; while ((*str= (char) map[(uchar) *str]) != 0) str++; - return str - str_orig; + return (size_t) (str - str_orig); } -uint my_casedn_str_8bit(CHARSET_INFO * cs,char *str) +size_t my_casedn_str_8bit(CHARSET_INFO * cs,char *str) { register uchar *map= cs->to_lower; char *str_orig= str; while ((*str= (char) map[(uchar) *str]) != 0) str++; - return str - str_orig; + return (size_t) (str - str_orig); } -uint my_caseup_8bit(CHARSET_INFO * cs, char *src, uint srclen, - char *dst __attribute__((unused)), - uint dstlen __attribute__((unused))) +size_t my_caseup_8bit(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) { - uint srclen0= srclen; + char *end= src + srclen; register uchar *map= cs->to_upper; DBUG_ASSERT(src == dst && srclen == dstlen); - for ( ; srclen > 0 ; srclen--, src++) + for ( ; src != end ; src++) *src= (char) map[(uchar) *src]; - return srclen0; + return srclen; } -uint my_casedn_8bit(CHARSET_INFO * cs, char *src, uint srclen, - char *dst __attribute__((unused)), - uint dstlen __attribute__((unused))) + +size_t my_casedn_8bit(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) { - uint srclen0= srclen; + char *end= src + srclen; register uchar *map=cs->to_lower; DBUG_ASSERT(src == dst && srclen == dstlen); - for ( ; srclen > 0 ; srclen--, src++) + for ( ; src != end ; src++) *src= (char) map[(uchar) *src]; - return srclen0; + return srclen; } int my_strcasecmp_8bit(CHARSET_INFO * cs,const char *s, const char *t) @@ -241,8 +248,8 @@ int my_strcasecmp_8bit(CHARSET_INFO * cs,const char *s, const char *t) int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, - const unsigned char *str, - const unsigned char *end __attribute__((unused))) + const uchar *str, + const uchar *end __attribute__((unused))) { if (str >= end) return MY_CS_TOOSMALL; @@ -252,8 +259,8 @@ int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, } int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, - unsigned char *str, - unsigned char *end __attribute__((unused))) + uchar *str, + uchar *end) { MY_UNI_IDX *idx; @@ -279,8 +286,8 @@ int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, end buffer must be checked. */ -int my_snprintf_8bit(CHARSET_INFO *cs __attribute__((unused)), - char* to, uint n __attribute__((unused)), +size_t my_snprintf_8bit(CHARSET_INFO *cs __attribute__((unused)), + char* to, size_t n __attribute__((unused)), const char* fmt, ...) { va_list args; @@ -293,7 +300,7 @@ int my_snprintf_8bit(CHARSET_INFO *cs __attribute__((unused)), void my_hash_sort_simple(CHARSET_INFO *cs, - const uchar *key, uint len, + const uchar *key, size_t len, ulong *nr1, ulong *nr2) { register uchar *sort_order=cs->sort_order; @@ -316,15 +323,15 @@ void my_hash_sort_simple(CHARSET_INFO *cs, long my_strntol_8bit(CHARSET_INFO *cs, - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr, int *err) { int negative; register uint32 cutoff; - register unsigned int cutlim; + register uint cutlim; register uint32 i; register const char *s; - register unsigned char c; + register uchar c; const char *save, *e; int overflow; @@ -439,15 +446,15 @@ noconv: ulong my_strntoul_8bit(CHARSET_INFO *cs, - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr, int *err) { int negative; register uint32 cutoff; - register unsigned int cutlim; + register uint cutlim; register uint32 i; register const char *s; - register unsigned char c; + register uchar c; const char *save, *e; int overflow; @@ -553,12 +560,12 @@ noconv: longlong my_strntoll_8bit(CHARSET_INFO *cs __attribute__((unused)), - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr,int *err) { int negative; register ulonglong cutoff; - register unsigned int cutlim; + register uint cutlim; register ulonglong i; register const char *s, *e; const char *save; @@ -625,7 +632,7 @@ longlong my_strntoll_8bit(CHARSET_INFO *cs __attribute__((unused)), i = 0; for ( ; s != e; s++) { - register unsigned char c= *s; + register uchar c= *s; if (c>='0' && c<='9') c -= '0'; else if (c>='A' && c<='Z') @@ -676,12 +683,12 @@ noconv: ulonglong my_strntoull_8bit(CHARSET_INFO *cs, - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr, int *err) { int negative; register ulonglong cutoff; - register unsigned int cutlim; + register uint cutlim; register ulonglong i; register const char *s, *e; const char *save; @@ -748,7 +755,7 @@ ulonglong my_strntoull_8bit(CHARSET_INFO *cs, i = 0; for ( ; s != e; s++) { - register unsigned char c= *s; + register uchar c= *s; if (c>='0' && c<='9') c -= '0'; @@ -790,6 +797,7 @@ noconv: return 0L; } + /* Read double from string @@ -814,7 +822,7 @@ noconv: double my_strntod_8bit(CHARSET_INFO *cs __attribute__((unused)), - char *str, uint length, + char *str, size_t length, char **end, int *err) { if (length == INT_MAX32) @@ -830,8 +838,8 @@ double my_strntod_8bit(CHARSET_INFO *cs __attribute__((unused)), Assume len >= 1 */ -int my_long10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), - char *dst, uint len, int radix, long int val) +size_t my_long10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), + char *dst, size_t len, int radix, long int val) { char buffer[66]; register char *p, *e; @@ -863,14 +871,15 @@ int my_long10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), val= new_val; } - len= min(len, (uint) (e-p)); + len= min(len, (size_t) (e-p)); memcpy(dst, p, len); - return (int) len+sign; + return len+sign; } -int my_longlong10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), - char *dst, uint len, int radix, longlong val) +size_t my_longlong10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), + char *dst, size_t len, int radix, + longlong val) { char buffer[65]; register char *p, *e; @@ -914,7 +923,7 @@ int my_longlong10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), long_val= quo; } - len= min(len, (uint) (e-p)); + len= min(len, (size_t) (e-p)); cnv: memcpy(dst, p, len); return len+sign; @@ -1034,16 +1043,16 @@ int my_wildcmp_8bit(CHARSET_INFO *cs, */ my_bool my_like_range_simple(CHARSET_INFO *cs, - const char *ptr,uint ptr_length, + const char *ptr, size_t ptr_length, pbool escape, pbool w_one, pbool w_many, - uint res_length, + size_t res_length, char *min_str,char *max_str, - uint *min_length,uint *max_length) + size_t *min_length, size_t *max_length) { const char *end= ptr + ptr_length; char *min_org=min_str; char *min_end=min_str+res_length; - uint charlen= res_length / cs->mbmaxlen; + size_t charlen= res_length / cs->mbmaxlen; for (; ptr != end && min_str != min_end && charlen > 0 ; ptr++, charlen--) { @@ -1062,7 +1071,8 @@ my_bool my_like_range_simple(CHARSET_INFO *cs, if (*ptr == w_many) /* '%' in SQL */ { /* Calculate length of keys */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (uint) (min_str - min_org) : + *min_length= ((cs->state & MY_CS_BINSORT) ? + (size_t) (min_str - min_org) : res_length); *max_length= res_length; do @@ -1075,14 +1085,14 @@ my_bool my_like_range_simple(CHARSET_INFO *cs, *min_str++= *max_str++ = *ptr; } - *min_length= *max_length = (uint) (min_str - min_org); + *min_length= *max_length = (size_t) (min_str - min_org); while (min_str != min_end) *min_str++= *max_str++ = ' '; /* Because if key compression */ return 0; } -ulong my_scan_8bit(CHARSET_INFO *cs, const char *str, const char *end, int sq) +size_t my_scan_8bit(CHARSET_INFO *cs, const char *str, const char *end, int sq) { const char *str0= str; switch (sq) @@ -1091,7 +1101,7 @@ ulong my_scan_8bit(CHARSET_INFO *cs, const char *str, const char *end, int sq) if (*str == '.') { for(str++ ; str != end && *str == '0' ; str++); - return (ulong) (str - str0); + return (size_t) (str - str0); } return 0; @@ -1101,7 +1111,7 @@ ulong my_scan_8bit(CHARSET_INFO *cs, const char *str, const char *end, int sq) if (!my_isspace(cs,*str)) break; } - return (ulong) (str - str0); + return (size_t) (str - str0); default: return 0; } @@ -1109,59 +1119,59 @@ ulong my_scan_8bit(CHARSET_INFO *cs, const char *str, const char *end, int sq) void my_fill_8bit(CHARSET_INFO *cs __attribute__((unused)), - char *s, uint l, int fill) + char *s, size_t l, int fill) { - bfill(s,l,fill); + bfill((uchar*) s,l,fill); } -uint my_numchars_8bit(CHARSET_INFO *cs __attribute__((unused)), +size_t my_numchars_8bit(CHARSET_INFO *cs __attribute__((unused)), const char *b, const char *e) { - return (uint) (e - b); + return (size_t) (e - b); } -uint my_numcells_8bit(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e) +size_t my_numcells_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e) { - return (uint) (e - b); + return (size_t) (e - b); } -uint my_charpos_8bit(CHARSET_INFO *cs __attribute__((unused)), - const char *b __attribute__((unused)), - const char *e __attribute__((unused)), - uint pos) +size_t my_charpos_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *b __attribute__((unused)), + const char *e __attribute__((unused)), + size_t pos) { return pos; } -uint my_well_formed_len_8bit(CHARSET_INFO *cs __attribute__((unused)), - const char *start, const char *end, - uint nchars, int *error) +size_t my_well_formed_len_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *start, const char *end, + size_t nchars, int *error) { - uint nbytes= (uint) (end-start); + size_t nbytes= (size_t) (end-start); *error= 0; return min(nbytes, nchars); } -uint my_lengthsp_8bit(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr, uint length) +size_t my_lengthsp_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr, size_t length) { const char *end= ptr+length; while (end > ptr && end[-1] == ' ') end--; - return (uint) (end-ptr); + return (size_t) (end-ptr); } uint my_instr_simple(CHARSET_INFO *cs, - const char *b, uint b_length, - const char *s, uint s_length, - my_match_t *match, uint nmatch) + const char *b, size_t b_length, + const char *s, size_t s_length, + my_match_t *match, uint nmatch) { register const uchar *str, *search, *end, *search_end; @@ -1200,7 +1210,7 @@ skip: if (nmatch > 0) { match[0].beg= 0; - match[0].end= (uint) (str- (const uchar*)b-1); + match[0].end= (size_t) (str- (const uchar*)b-1); match[0].mb_len= match[0].end; if (nmatch > 1) @@ -1239,7 +1249,7 @@ static int pcmp(const void * f, const void * s) return res; } -static my_bool create_fromuni(CHARSET_INFO *cs, void *(*alloc)(uint)) +static my_bool create_fromuni(CHARSET_INFO *cs, void *(*alloc)(size_t)) { uni_idx idx[PLANE_NUM]; int i,n; @@ -1318,7 +1328,7 @@ static my_bool create_fromuni(CHARSET_INFO *cs, void *(*alloc)(uint)) return FALSE; } -static my_bool my_cset_init_8bit(CHARSET_INFO *cs, void *(*alloc)(uint)) +static my_bool my_cset_init_8bit(CHARSET_INFO *cs, void *(*alloc)(size_t)) { cs->caseup_multiply= 1; cs->casedn_multiply= 1; @@ -1346,7 +1356,7 @@ static void set_max_sort_char(CHARSET_INFO *cs) } static my_bool my_coll_init_simple(CHARSET_INFO *cs, - void *(*alloc)(uint) __attribute__((unused))) + void *(*alloc)(size_t) __attribute__((unused))) { set_max_sort_char(cs); return FALSE; @@ -1361,7 +1371,7 @@ longlong my_strtoll10_8bit(CHARSET_INFO *cs __attribute__((unused)), int my_mb_ctype_8bit(CHARSET_INFO *cs, int *ctype, - const unsigned char *s, const unsigned char *e) + const uchar *s, const uchar *e) { if (s >= e) { @@ -1473,13 +1483,13 @@ static ulonglong d10[DIGITS_IN_ULONGLONG]= ulonglong my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)), - const char *str, uint length, int unsigned_flag, + const char *str, size_t length, int unsigned_flag, char **endptr, int *error) { const char *dot, *end9, *beg, *end= str + length; ulonglong ull; ulong ul; - unsigned char ch; + uchar ch; int shift= 0, digits= 0, negative, addon; /* Skip leading spaces and tabs */ @@ -1497,7 +1507,7 @@ my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)), beg= str; end9= (str + 9) > end ? end : (str + 9); /* Accumulate small number into ulong, for performance purposes */ - for (ul= 0 ; str < end9 && (ch= (unsigned char) (*str - '0')) < 10; str++) + for (ul= 0 ; str < end9 && (ch= (uchar) (*str - '0')) < 10; str++) { ul= ul * 10 + ch; } @@ -1530,7 +1540,7 @@ my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)), /* Continue to accumulate into ulonglong */ for (dot= NULL, ull= ul; str < end; str++) { - if ((ch= (unsigned char) (*str - '0')) < 10) + if ((ch= (uchar) (*str - '0')) < 10) { if (ull < CUTOFF || (ull == CUTOFF && ch <= CUTLIM)) { @@ -1551,7 +1561,7 @@ my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)), } else addon= (*str >= '5'); - for ( ; str < end && (ch= (unsigned char) (*str - '0')) < 10; str++) + for ( ; str < end && (ch= (uchar) (*str - '0')) < 10; str++) { if (!dot) shift++; @@ -1559,7 +1569,7 @@ my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)), if (str < end && *str == '.' && !dot) { str++; - for ( ; str < end && (ch= (unsigned char) (*str - '0')) < 10; str++); + for ( ; str < end && (ch= (uchar) (*str - '0')) < 10; str++); } goto exp; } @@ -1605,7 +1615,7 @@ exp: /* [ E [ <sign> ] <unsigned integer> ] */ goto ret_sign; } for (exponent= 0 ; - str < end && (ch= (unsigned char) (*str - '0')) < 10; + str < end && (ch= (uchar) (*str - '0')) < 10; str++) { exponent= exponent * 10 + ch; @@ -1748,7 +1758,7 @@ ret_too_big: my_bool my_propagate_simple(CHARSET_INFO *cs __attribute__((unused)), const uchar *str __attribute__((unused)), - uint length __attribute__((unused))) + size_t length __attribute__((unused))) { return 1; } @@ -1756,7 +1766,7 @@ my_bool my_propagate_simple(CHARSET_INFO *cs __attribute__((unused)), my_bool my_propagate_complex(CHARSET_INFO *cs __attribute__((unused)), const uchar *str __attribute__((unused)), - uint length __attribute__((unused))) + size_t length __attribute__((unused))) { return 0; } diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 8f7158cc9c9..dfa8819a4db 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -182,13 +182,13 @@ static uchar NEAR sort_order_sjis[]= (0x80<=(c) && (c)<=0xfc)) -static int ismbchar_sjis(CHARSET_INFO *cs __attribute__((unused)), +static uint ismbchar_sjis(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) { return (issjishead((uchar) *p) && (e-p)>1 && issjistail((uchar)p[1]) ? 2: 0); } -static int mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c) +static uint mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (issjishead((uchar) c) ? 2 : 1); } @@ -198,8 +198,8 @@ static int mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c) static int my_strnncoll_sjis_internal(CHARSET_INFO *cs, - const uchar **a_res, uint a_length, - const uchar **b_res, uint b_length) + const uchar **a_res, size_t a_length, + const uchar **b_res, size_t b_length) { const uchar *a= *a_res, *b= *b_res; const uchar *a_end= a + a_length; @@ -230,9 +230,9 @@ static int my_strnncoll_sjis_internal(CHARSET_INFO *cs, static int my_strnncoll_sjis(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, - my_bool b_is_prefix) + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool b_is_prefix) { int res= my_strnncoll_sjis_internal(cs, &a, a_length, &b, b_length); if (b_is_prefix && a_length > b_length) @@ -242,8 +242,8 @@ static int my_strnncoll_sjis(CHARSET_INFO *cs __attribute__((unused)), static int my_strnncollsp_sjis(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference) { const uchar *a_end= a + a_length, *b_end= b + b_length; @@ -281,9 +281,9 @@ static int my_strnncollsp_sjis(CHARSET_INFO *cs __attribute__((unused)), -static int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)), - uchar *dest, uint len, - const uchar *src, uint srclen) +static size_t my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { uchar *d_end = dest + len; uchar *s_end = (uchar*) src + srclen; @@ -324,15 +324,16 @@ static int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)), #define max_sort_char ((char) 255) static my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr,uint ptr_length, + const char *ptr,size_t ptr_length, pbool escape, pbool w_one, pbool w_many, - uint res_length, char *min_str,char *max_str, - uint *min_length,uint *max_length) + size_t res_length, + char *min_str,char *max_str, + size_t *min_length,size_t *max_length) { const char *end= ptr + ptr_length; char *min_org=min_str; char *min_end=min_str+res_length; - uint charlen= res_length / cs->mbmaxlen; + size_t charlen= res_length / cs->mbmaxlen; for ( ; ptr < end && min_str < min_end && charlen > 0 ; charlen--) { @@ -363,7 +364,7 @@ static my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)), 'a\0\0... is the smallest possible string when we have space expand a\ff\ff... is the biggest possible string */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (uint) (min_str - min_org) : + *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : res_length); *max_length= res_length; do @@ -376,7 +377,7 @@ static my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)), *min_str++ = *max_str++ = *ptr++; } - *min_length= *max_length= (uint) (min_str - min_org); + *min_length= *max_length= (size_t) (min_str - min_org); while (min_str != min_end) *min_str++= *max_str++= ' '; /* Because if key compression */ return 0; @@ -4553,12 +4554,12 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)), } static -uint my_numcells_sjis(CHARSET_INFO *cs __attribute__((unused)), +size_t my_numcells_sjis(CHARSET_INFO *cs __attribute__((unused)), const char *str, const char *str_end) { - uint clen= 0; - const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) str_end; + size_t clen; + const uchar *b= (const uchar *) str; + const uchar *e= (const uchar *) str_end; for (clen= 0; b < e; ) { @@ -4586,9 +4587,9 @@ uint my_numcells_sjis(CHARSET_INFO *cs __attribute__((unused)), CP932 additional characters are also accepted. */ static -uint my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e, - uint pos, int *error) +size_t my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t pos, int *error) { const char *b0= b; *error= 0; @@ -4616,7 +4617,7 @@ uint my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)), break; } } - return (uint) (b - b0); + return (size_t) (b - b0); } diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index 4babe9917dc..a8c05dc4fd0 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -462,7 +462,7 @@ static uchar NEAR sort_order_tis620[]= len Length of tstr */ -static uint thai2sortable(uchar *tstr, uint len) +static size_t thai2sortable(uchar *tstr, size_t len) { uchar *p; int tlen; @@ -527,8 +527,8 @@ static uint thai2sortable(uchar *tstr, uint len) static int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)), - const uchar * s1, uint len1, - const uchar * s2, uint len2, + const uchar *s1, size_t len1, + const uchar *s2, size_t len2, my_bool s2_is_prefix) { uchar buf[80] ; @@ -557,12 +557,12 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)), static int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)), - const uchar *a0, uint a_length, - const uchar *b0, uint b_length, + const uchar *a0, size_t a_length, + const uchar *b0, size_t b_length, my_bool diff_if_only_endspace_difference) { uchar buf[80], *end, *a, *b, *alloced= NULL; - uint length; + size_t length; int res= 0; #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE @@ -633,13 +633,13 @@ ret: */ static -int my_strnxfrm_tis620(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint len, - const uchar * src, uint srclen) +size_t my_strnxfrm_tis620(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { - uint dstlen= len; - len= (uint) (strmake((char*) dest, (char*) src, min(len, srclen)) - - (char*) dest); + size_t dstlen= len; + len= (size_t) (strmake((char*) dest, (char*) src, min(len, srclen)) - + (char*) dest); len= thai2sortable(dest, len); if (dstlen > len) bfill(dest + len, dstlen - len, ' '); @@ -681,7 +681,7 @@ static unsigned short cs_to_uni[256]={ 0x0E50,0x0E51,0x0E52,0x0E53,0x0E54,0x0E55,0x0E56,0x0E57, 0x0E58,0x0E59,0x0E5A,0x0E5B,0xFFFD,0xFFFD,0xFFFD,0xFFFD }; -static unsigned char pl00[256]={ +static uchar pl00[256]={ 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, @@ -715,7 +715,7 @@ static unsigned char pl00[256]={ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 }; -static unsigned char pl0E[256]={ +static uchar pl0E[256]={ 0x0000,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, 0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, @@ -749,7 +749,7 @@ static unsigned char pl0E[256]={ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 }; -static unsigned char plFF[256]={ +static uchar plFF[256]={ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, @@ -783,7 +783,7 @@ static unsigned char plFF[256]={ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x00FF,0x0000,0x0000 }; -static unsigned char *uni_to_cs[256]={ +static uchar *uni_to_cs[256]={ pl00,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL,NULL,pl0E,NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, @@ -822,8 +822,8 @@ NULL,NULL,NULL,NULL,NULL,NULL,NULL,plFF static int my_mb_wc_tis620(CHARSET_INFO *cs __attribute__((unused)), my_wc_t *wc, - const unsigned char *str, - const unsigned char *end __attribute__((unused))) + const uchar *str, + const uchar *end __attribute__((unused))) { if (str >= end) return MY_CS_TOOSMALL; @@ -835,10 +835,10 @@ int my_mb_wc_tis620(CHARSET_INFO *cs __attribute__((unused)), static int my_wc_mb_tis620(CHARSET_INFO *cs __attribute__((unused)), my_wc_t wc, - unsigned char *str, - unsigned char *end __attribute__((unused))) + uchar *str, + uchar *end __attribute__((unused))) { - unsigned char *pl; + uchar *pl; if (str >= end) return MY_CS_TOOSMALL; diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 1263882846d..ea0d5a1436a 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -6740,7 +6740,7 @@ typedef struct my_uca_scanner_st typedef struct my_uca_scanner_handler_st { void (*init)(my_uca_scanner *scanner, CHARSET_INFO *cs, - const uchar *str, uint length); + const uchar *str, size_t length); int (*next)(my_uca_scanner *scanner); } my_uca_scanner_handler; @@ -6767,7 +6767,7 @@ static uint16 nochar[]= {0,0}; static void my_uca_scanner_init_ucs2(my_uca_scanner *scanner, CHARSET_INFO *cs __attribute__((unused)), - const uchar *str, uint length) + const uchar *str, size_t length) { scanner->wbeg= nochar; if (length) @@ -6859,8 +6859,8 @@ static int my_uca_scanner_next_ucs2(my_uca_scanner *scanner) if (scanner->sbeg > scanner->send) return -1; - scanner->page= (unsigned char)scanner->sbeg[0]; - scanner->code= (unsigned char)scanner->sbeg[1]; + scanner->page= (uchar)scanner->sbeg[0]; + scanner->code= (uchar)scanner->sbeg[1]; scanner->sbeg+= 2; if (scanner->contractions && (scanner->sbeg <= scanner->send)) @@ -6919,7 +6919,7 @@ static my_uca_scanner_handler my_ucs2_uca_scanner_handler= */ static void my_uca_scanner_init_any(my_uca_scanner *scanner, CHARSET_INFO *cs __attribute__((unused)), - const uchar *str, uint length) + const uchar *str, size_t length) { /* Note, no needs to initialize scanner->wbeg */ scanner->sbeg= str; @@ -7055,8 +7055,8 @@ static my_uca_scanner_handler my_any_uca_scanner_handler= static int my_strnncoll_uca(CHARSET_INFO *cs, my_uca_scanner_handler *scanner_handler, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { my_uca_scanner sscanner; @@ -7126,8 +7126,8 @@ static int my_strnncoll_uca(CHARSET_INFO *cs, static int my_strnncollsp_uca(CHARSET_INFO *cs, my_uca_scanner_handler *scanner_handler, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference) { my_uca_scanner sscanner, tscanner; @@ -7204,7 +7204,7 @@ static int my_strnncollsp_uca(CHARSET_INFO *cs, static void my_hash_sort_uca(CHARSET_INFO *cs, my_uca_scanner_handler *scanner_handler, - const uchar *s, uint slen, + const uchar *s, size_t slen, ulong *n1, ulong *n2) { int s_res; @@ -7254,12 +7254,12 @@ static void my_hash_sort_uca(CHARSET_INFO *cs, Number of bytes that have been written into the binary image. */ -static int my_strnxfrm_uca(CHARSET_INFO *cs, - my_uca_scanner_handler *scanner_handler, - uchar *dst, uint dstlen, - const uchar *src, uint srclen) +static size_t my_strnxfrm_uca(CHARSET_INFO *cs, + my_uca_scanner_handler *scanner_handler, + uchar *dst, size_t dstlen, + const uchar *src, size_t srclen) { - uchar *de = dst + (dstlen & (uint) ~1); /* add even length for easier code */ + uchar *de= dst + (dstlen & (size_t) ~1); /* add even length for easier code */ int s_res; my_uca_scanner scanner; scanner_handler->init(&scanner, cs, src, srclen); @@ -7292,6 +7292,7 @@ static int my_strnxfrm_uca(CHARSET_INFO *cs, This fact allows us to use memcmp() safely, on both little-endian and big-endian machines. */ + static int my_uca_charcmp(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2) { size_t page1= wc1 >> MY_UCA_PSHIFT; @@ -7334,7 +7335,7 @@ int my_wildcmp_uca(CHARSET_INFO *cs, my_wc_t s_wc, w_wc; int scan; int (*mb_wc)(struct charset_info_st *, my_wc_t *, - const unsigned char *, const unsigned char *); + const uchar *, const uchar *); mb_wc= cs->cset->mb_wc; while (wildstr != wildend) @@ -7566,7 +7567,7 @@ static void my_coll_lexem_print_error(MY_COLL_LEXEM *lexem, { char tail[30]; size_t len= lexem->end - lexem->prev; - strmake (tail, lexem->prev, (uint) min(len, sizeof(tail)-1)); + strmake (tail, lexem->prev, (size_t) min(len, sizeof(tail)-1)); errstr[errsize-1]= '\0'; my_snprintf(errstr,errsize-1,"%s at '%s'", txt, tail); } @@ -7830,7 +7831,7 @@ static int my_coll_rule_parse(MY_COLL_RULE *rule, size_t mitems, default weights. */ -static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(uint)) +static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(size_t)) { MY_COLL_RULE rule[MY_MAX_COLL_RULE]; char errstr[128]; @@ -7979,15 +7980,15 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(uint)) Should work for any character set. */ -static my_bool my_coll_init_uca(CHARSET_INFO *cs, void *(*alloc)(uint)) +static my_bool my_coll_init_uca(CHARSET_INFO *cs, void *(*alloc)(size_t)) { cs->pad_char= ' '; return create_tailoring(cs, alloc); } static int my_strnncoll_any_uca(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { return my_strnncoll_uca(cs, &my_any_uca_scanner_handler, @@ -7995,8 +7996,8 @@ static int my_strnncoll_any_uca(CHARSET_INFO *cs, } static int my_strnncollsp_any_uca(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference) { return my_strnncollsp_uca(cs, &my_any_uca_scanner_handler, @@ -8005,15 +8006,15 @@ static int my_strnncollsp_any_uca(CHARSET_INFO *cs, } static void my_hash_sort_any_uca(CHARSET_INFO *cs, - const uchar *s, uint slen, + const uchar *s, size_t slen, ulong *n1, ulong *n2) { my_hash_sort_uca(cs, &my_any_uca_scanner_handler, s, slen, n1, n2); } -static int my_strnxfrm_any_uca(CHARSET_INFO *cs, - uchar *dst, uint dstlen, - const uchar *src, uint srclen) +static size_t my_strnxfrm_any_uca(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, + const uchar *src, size_t srclen) { return my_strnxfrm_uca(cs, &my_any_uca_scanner_handler, dst, dstlen, src, srclen); @@ -8025,8 +8026,8 @@ static int my_strnxfrm_any_uca(CHARSET_INFO *cs, UCS2 optimized CHARSET_INFO compatible wrappers. */ static int my_strnncoll_ucs2_uca(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { return my_strnncoll_uca(cs, &my_ucs2_uca_scanner_handler, @@ -8034,8 +8035,8 @@ static int my_strnncoll_ucs2_uca(CHARSET_INFO *cs, } static int my_strnncollsp_ucs2_uca(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference) { return my_strnncollsp_uca(cs, &my_ucs2_uca_scanner_handler, @@ -8044,15 +8045,15 @@ static int my_strnncollsp_ucs2_uca(CHARSET_INFO *cs, } static void my_hash_sort_ucs2_uca(CHARSET_INFO *cs, - const uchar *s, uint slen, + const uchar *s, size_t slen, ulong *n1, ulong *n2) { my_hash_sort_uca(cs, &my_ucs2_uca_scanner_handler, s, slen, n1, n2); } -static int my_strnxfrm_ucs2_uca(CHARSET_INFO *cs, - uchar *dst, uint dstlen, - const uchar *src, uint srclen) +static size_t my_strnxfrm_ucs2_uca(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, + const uchar *src, size_t srclen) { return my_strnxfrm_uca(cs, &my_ucs2_uca_scanner_handler, dst, dstlen, src, srclen); @@ -8060,17 +8061,17 @@ static int my_strnxfrm_ucs2_uca(CHARSET_INFO *cs, MY_COLLATION_HANDLER my_collation_ucs2_uca_handler = { - my_coll_init_uca, /* init */ - my_strnncoll_ucs2_uca, - my_strnncollsp_ucs2_uca, - my_strnxfrm_ucs2_uca, - my_strnxfrmlen_simple, - my_like_range_ucs2, - my_wildcmp_uca, - NULL, - my_instr_mb, - my_hash_sort_ucs2_uca, - my_propagate_complex + my_coll_init_uca, /* init */ + my_strnncoll_ucs2_uca, + my_strnncollsp_ucs2_uca, + my_strnxfrm_ucs2_uca, + my_strnxfrmlen_simple, + my_like_range_ucs2, + my_wildcmp_uca, + NULL, + my_instr_mb, + my_hash_sort_ucs2_uca, + my_propagate_complex }; CHARSET_INFO my_charset_ucs2_general_uca= diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index d3b65aa1643..88a686ff256 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -22,6 +22,7 @@ #include "m_string.h" #include "m_ctype.h" #include <errno.h> +#include <stdarg.h> #ifdef HAVE_CHARSET_ucs2 @@ -96,7 +97,7 @@ static int my_ucs2_uni(CHARSET_INFO *cs __attribute__((unused)), if (s+2 > e) /* Need 2 characters */ return MY_CS_TOOSMALL2; - *pwc= ((unsigned char)s[0]) * 256 + ((unsigned char)s[1]); + *pwc= ((uchar)s[0]) * 256 + ((uchar)s[1]); return 2; } @@ -112,9 +113,9 @@ static int my_uni_ucs2(CHARSET_INFO *cs __attribute__((unused)) , } -static uint my_caseup_ucs2(CHARSET_INFO *cs, char *src, uint srclen, +static size_t my_caseup_ucs2(CHARSET_INFO *cs, char *src, size_t srclen, char *dst __attribute__((unused)), - uint dstlen __attribute__((unused))) + size_t dstlen __attribute__((unused))) { my_wc_t wc; int res; @@ -135,7 +136,7 @@ static uint my_caseup_ucs2(CHARSET_INFO *cs, char *src, uint srclen, } -static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, uint slen, +static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, size_t slen, ulong *n1, ulong *n2) { my_wc_t wc; @@ -159,16 +160,16 @@ static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, uint slen, } -static uint my_caseup_str_ucs2(CHARSET_INFO * cs __attribute__((unused)), +static size_t my_caseup_str_ucs2(CHARSET_INFO * cs __attribute__((unused)), char * s __attribute__((unused))) { return 0; } -static uint my_casedn_ucs2(CHARSET_INFO *cs, char *src, uint srclen, +static size_t my_casedn_ucs2(CHARSET_INFO *cs, char *src, size_t srclen, char *dst __attribute__((unused)), - uint dstlen __attribute__((unused))) + size_t dstlen __attribute__((unused))) { my_wc_t wc; int res; @@ -189,7 +190,7 @@ static uint my_casedn_ucs2(CHARSET_INFO *cs, char *src, uint srclen, } -static uint my_casedn_str_ucs2(CHARSET_INFO *cs __attribute__((unused)), +static size_t my_casedn_str_ucs2(CHARSET_INFO *cs __attribute__((unused)), char * s __attribute__((unused))) { return 0; @@ -197,8 +198,8 @@ static uint my_casedn_str_ucs2(CHARSET_INFO *cs __attribute__((unused)), static int my_strnncoll_ucs2(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { int s_res,t_res; @@ -263,13 +264,13 @@ static int my_strnncoll_ucs2(CHARSET_INFO *cs, */ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference __attribute__((unused))) { const uchar *se, *te; - uint minlen; + size_t minlen; MY_UNICASE_INFO **uni_plane= cs->caseinfo; /* extra safety to make sure the lengths are even numbers */ @@ -314,7 +315,7 @@ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)), static int my_strncasecmp_ucs2(CHARSET_INFO *cs, - const char *s, const char *t, uint len) + const char *s, const char *t, size_t len) { int s_res,t_res; my_wc_t s_wc,t_wc; @@ -355,15 +356,16 @@ static int my_strncasecmp_ucs2(CHARSET_INFO *cs, static int my_strcasecmp_ucs2(CHARSET_INFO *cs, const char *s, const char *t) { - uint s_len= (uint) strlen(s); - uint t_len= (uint) strlen(t); - uint len = (s_len > t_len) ? s_len : t_len; - return my_strncasecmp_ucs2(cs, s, t, len); + size_t s_len= strlen(s); + size_t t_len= strlen(t); + size_t len = (s_len > t_len) ? s_len : t_len; + return my_strncasecmp_ucs2(cs, s, t, len); } -static int my_strnxfrm_ucs2(CHARSET_INFO *cs, - uchar *dst, uint dstlen, const uchar *src, uint srclen) +static size_t my_strnxfrm_ucs2(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, const uchar *src, + size_t srclen) { my_wc_t wc; int res; @@ -391,30 +393,27 @@ static int my_strnxfrm_ucs2(CHARSET_INFO *cs, dst+=res; } if (dst < de) - cs->cset->fill(cs, (char*) dst, (uint) (de - dst), ' '); + cs->cset->fill(cs, (char*) dst, (size_t) (de - dst), ' '); return dstlen; } -static int my_ismbchar_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *b __attribute__((unused)), - const char *e __attribute__((unused))) +static uint my_ismbchar_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *b __attribute__((unused)), + const char *e __attribute__((unused))) { return 2; } -static int my_mbcharlen_ucs2(CHARSET_INFO *cs __attribute__((unused)) , - uint c __attribute__((unused))) +static uint my_mbcharlen_ucs2(CHARSET_INFO *cs __attribute__((unused)) , + uint c __attribute__((unused))) { return 2; } -#include <m_string.h> -#include <stdarg.h> - -static int my_vsnprintf_ucs2(char *dst, uint n, const char* fmt, va_list ap) +static int my_vsnprintf_ucs2(char *dst, size_t n, const char* fmt, va_list ap) { char *start=dst, *end=dst+n-1; for (; *fmt ; fmt++) @@ -440,10 +439,10 @@ static int my_vsnprintf_ucs2(char *dst, uint n, const char* fmt, va_list ap) if (*fmt == 's') /* String parameter */ { reg2 char *par = va_arg(ap, char *); - uint plen; - uint left_len = (uint)(end-dst); + size_t plen; + size_t left_len = (size_t)(end-dst); if (!par) par = (char*)"(null)"; - plen = (uint) strlen(par); + plen= strlen(par); if (left_len <= plen*2) plen = left_len/2 - 1; @@ -460,7 +459,7 @@ static int my_vsnprintf_ucs2(char *dst, uint n, const char* fmt, va_list ap) char nbuf[16]; char *pbuf=nbuf; - if ((uint) (end-dst) < 32) + if ((size_t) (end-dst) < 32) break; iarg = va_arg(ap, int); if (*fmt == 'd') @@ -485,11 +484,11 @@ static int my_vsnprintf_ucs2(char *dst, uint n, const char* fmt, va_list ap) DBUG_ASSERT(dst <= end); *dst='\0'; /* End of errmessage */ - return (uint) (dst - start); + return (size_t) (dst - start); } -static int my_snprintf_ucs2(CHARSET_INFO *cs __attribute__((unused)), - char* to, uint n, const char* fmt, ...) +static size_t my_snprintf_ucs2(CHARSET_INFO *cs __attribute__((unused)), + char* to, size_t n, const char* fmt, ...) { va_list args; va_start(args,fmt); @@ -498,7 +497,7 @@ static int my_snprintf_ucs2(CHARSET_INFO *cs __attribute__((unused)), long my_strntol_ucs2(CHARSET_INFO *cs, - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr, int *err) { int negative=0; @@ -613,7 +612,7 @@ bs: ulong my_strntoul_ucs2(CHARSET_INFO *cs, - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr, int *err) { int negative=0; @@ -722,7 +721,7 @@ bs: longlong my_strntoll_ucs2(CHARSET_INFO *cs, - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr, int *err) { int negative=0; @@ -839,7 +838,7 @@ bs: ulonglong my_strntoull_ucs2(CHARSET_INFO *cs, - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr, int *err) { int negative=0; @@ -947,7 +946,7 @@ bs: double my_strntod_ucs2(CHARSET_INFO *cs __attribute__((unused)), - char *nptr, uint length, + char *nptr, size_t length, char **endptr, int *err) { char buf[256]; @@ -974,13 +973,14 @@ double my_strntod_ucs2(CHARSET_INFO *cs __attribute__((unused)), *endptr= b; res= my_strtod(buf, endptr, err); - *endptr= nptr + (uint) (*endptr- buf); + *endptr= nptr + (size_t) (*endptr- buf); return res; } ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *nptr, uint length, int unsign_fl, + const char *nptr, size_t length, + int unsign_fl, char **endptr, int *err) { char buf[256], *b= buf; @@ -1003,7 +1003,7 @@ ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs __attribute__((unused)), } res= my_strntoull10rnd_8bit(cs, buf, b - buf, unsign_fl, endptr, err); - *endptr= (char*) nptr + 2 * (uint) (*endptr- buf); + *endptr= (char*) nptr + 2 * (size_t) (*endptr- buf); return res; } @@ -1012,8 +1012,8 @@ ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs __attribute__((unused)), This is a fast version optimized for the case of radix 10 / -10 */ -int my_l10tostr_ucs2(CHARSET_INFO *cs, - char *dst, uint len, int radix, long int val) +size_t my_l10tostr_ucs2(CHARSET_INFO *cs, + char *dst, size_t len, int radix, long int val) { char buffer[66]; register char *p, *db, *de; @@ -1059,8 +1059,9 @@ int my_l10tostr_ucs2(CHARSET_INFO *cs, return (int) (dst-db); } -int my_ll10tostr_ucs2(CHARSET_INFO *cs __attribute__((unused)), - char *dst, uint len, int radix, longlong val) + +size_t my_ll10tostr_ucs2(CHARSET_INFO *cs __attribute__((unused)), + char *dst, size_t len, int radix, longlong val) { char buffer[65]; register char *p, *db, *de; @@ -1087,7 +1088,7 @@ int my_ll10tostr_ucs2(CHARSET_INFO *cs __attribute__((unused)), while ((ulonglong) val > (ulonglong) LONG_MAX) { - ulonglong quo=(ulonglong) val/(uint) 10; + ulonglong quo=(ulonglong) val/(size_t) 10; uint rem= (uint) (val- quo* (uint) 10); *--p = '0' + rem; val= quo; @@ -1137,7 +1138,7 @@ longlong my_strtoll10_ucs2(CHARSET_INFO *cs __attribute__((unused)), const char *nptr, char **endptr, int *error) { const char *s, *end, *start, *n_end, *true_end; - unsigned char c; + uchar c; unsigned long i, j, k; ulonglong li; int negative; @@ -1273,7 +1274,7 @@ end_i: return (negative ? ((longlong) -(long) i) : (longlong) i); end_i_and_j: - li= (ulonglong) i * lfactor[(uint) (s-start) / 2] + j; + li= (ulonglong) i * lfactor[(size_t) (s-start) / 2] + j; *endptr= (char*) s; return (negative ? -((longlong) li) : (longlong) li); @@ -1302,31 +1303,31 @@ no_conv: static -uint my_numchars_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e) +size_t my_numchars_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e) { - return (uint) (e-b)/2; + return (size_t) (e-b)/2; } static -uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *b __attribute__((unused)), - const char *e __attribute__((unused)), - uint pos) +size_t my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *b __attribute__((unused)), + const char *e __attribute__((unused)), + size_t pos) { - uint string_length= (uint) (e - b); + size_t string_length= (size_t) (e - b); return pos > string_length ? string_length + 2 : pos * 2; } static -uint my_well_formed_len_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e, - uint nchars, int *error) +size_t my_well_formed_len_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t nchars, int *error) { /* Ensure string length is dividable with 2 */ - uint nbytes= ((uint) (e-b)) & ~(uint) 1; + size_t nbytes= ((size_t) (e-b)) & ~(size_t) 1; *error= 0; nchars*= 2; return min(nbytes, nchars); @@ -1335,20 +1336,20 @@ uint my_well_formed_len_ucs2(CHARSET_INFO *cs __attribute__((unused)), static void my_fill_ucs2(CHARSET_INFO *cs __attribute__((unused)), - char *s, uint l, int fill) + char *s, size_t l, int fill) { for ( ; l >= 2; s[0]= 0, s[1]= fill, s+=2, l-=2); } static -uint my_lengthsp_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr, uint length) +size_t my_lengthsp_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr, size_t length) { const char *end= ptr+length; while (end > ptr+1 && end[-1] == ' ' && end[-2] == '\0') end-=2; - return (uint) (end-ptr); + return (size_t) (end-ptr); } @@ -1377,8 +1378,8 @@ int my_wildcmp_ucs2_bin(CHARSET_INFO *cs, static int my_strnncoll_ucs2_bin(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { int s_res,t_res; @@ -1410,13 +1411,13 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *cs, } static int my_strnncollsp_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference __attribute__((unused))) { const uchar *se, *te; - uint minlen; + size_t minlen; /* extra safety to make sure the lengths are even numbers */ slen= (slen >> 1) << 1; @@ -1459,17 +1460,17 @@ static int my_strnncollsp_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), static int my_strcasecmp_ucs2_bin(CHARSET_INFO *cs, const char *s, const char *t) { - uint s_len= (uint) strlen(s); - uint t_len= (uint) strlen(t); - uint len = (s_len > t_len) ? s_len : t_len; + size_t s_len= strlen(s); + size_t t_len= strlen(t); + size_t len = (s_len > t_len) ? s_len : t_len; return my_strncasecmp_ucs2(cs, s, t, len); } static -int my_strnxfrm_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), - uchar *dst, uint dstlen, - const uchar *src, uint srclen) +size_t my_strnxfrm_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), + uchar *dst, size_t dstlen, + const uchar *src, size_t srclen) { if (dst != src) memcpy(dst,src,srclen= min(dstlen,srclen)); @@ -1481,7 +1482,7 @@ int my_strnxfrm_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), static void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *key, uint len,ulong *nr1, ulong *nr2) + const uchar *key, size_t len,ulong *nr1, ulong *nr2) { const uchar *pos = key; @@ -1513,16 +1514,16 @@ void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), */ my_bool my_like_range_ucs2(CHARSET_INFO *cs, - const char *ptr,uint ptr_length, + const char *ptr, size_t ptr_length, pbool escape, pbool w_one, pbool w_many, - uint res_length, + size_t res_length, char *min_str,char *max_str, - uint *min_length,uint *max_length) + size_t *min_length,size_t *max_length) { const char *end=ptr+ptr_length; char *min_org=min_str; char *min_end=min_str+res_length; - uint charlen= res_length / cs->mbmaxlen; + size_t charlen= res_length / cs->mbmaxlen; for ( ; ptr + 1 < end && min_str + 1 < min_end && charlen > 0 ; ptr+=2, charlen--) @@ -1549,7 +1550,7 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs, 'a\0\0... is the smallest possible string when we have space expand a\ff\ff... is the biggest possible string */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (uint) (min_str - min_org) : + *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : res_length); *max_length= res_length; do { @@ -1574,7 +1575,7 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs, } } - *min_length= *max_length = (uint) (min_str - min_org); + *min_length= *max_length = (size_t) (min_str - min_org); while (min_str + 1 < min_end) { *min_str++ = *max_str++ = '\0'; diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index d1e11071886..12d14667b28 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -184,7 +184,7 @@ static uchar NEAR sort_order_ujis[]= #define isujis_ss3(c) (((c)&0xff) == 0x8f) -static int ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)), +static uint ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) { return ((*(uchar*)(p)<0x80)? 0:\ @@ -194,7 +194,7 @@ static int ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)), 0); } -static int mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c) +static uint mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 1); } @@ -8252,9 +8252,9 @@ my_jisx0212_uni_onechar(int code){ */ static -uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), - const char *beg, const char *end, - uint pos, int *error) +size_t my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), + const char *beg, const char *end, + size_t pos, int *error) { const uchar *b= (uchar *) beg; @@ -8270,7 +8270,7 @@ uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), if (b >= (uchar *) end) /* need more bytes */ { *error= 1; - return (uint) (chbeg - beg); /* unexpected EOL */ + return (size_t) (chbeg - beg); /* unexpected EOL */ } if (ch == 0x8E) /* [x8E][xA0-xDF] */ @@ -8278,7 +8278,7 @@ uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), if (*b >= 0xA0 && *b <= 0xDF) continue; *error= 1; - return (uint) (chbeg - beg); /* invalid sequence */ + return (size_t) (chbeg - beg); /* invalid sequence */ } if (ch == 0x8F) /* [x8F][xA1-xFE][xA1-xFE] */ @@ -8287,7 +8287,7 @@ uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), if (b >= (uchar*) end) { *error= 1; - return (uint) (chbeg - beg); /* unexpected EOL */ + return (size_t) (chbeg - beg); /* unexpected EOL */ } } @@ -8295,19 +8295,19 @@ uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), *b >= 0xA1 && *b <= 0xFE) /* [xA1-xFE][xA1-xFE] */ continue; *error= 1; - return (uint) (chbeg - beg); /* invalid sequence */ + return (size_t) (chbeg - beg); /* invalid sequence */ } - return (uint) (b - (uchar *) beg); + return (size_t) (b - (uchar *) beg); } static -uint my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), +size_t my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), const char *str, const char *str_end) { - uint clen= 0; - const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) str_end; + size_t clen; + const uchar *b= (const uchar *) str; + const uchar *e= (const uchar *) str_end; for (clen= 0; b < e; ) { @@ -8335,6 +8335,7 @@ uint my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), return clen; } + static int my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *pwc, const uchar *s, const uchar *e) { @@ -8422,10 +8423,11 @@ my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *pwc, const uchar *s, const uchar *e) return MY_CS_ILSEQ; } + static int -my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e) +my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, uchar *s, uchar *e) { - unsigned char c1; + uchar c1; int jp; if (s >= e) diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 16882e9b25d..851cef54b5b 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1722,7 +1722,7 @@ int my_wildcmp_unicode(CHARSET_INFO *cs, my_wc_t s_wc, w_wc; int scan, plane; int (*mb_wc)(struct charset_info_st *, my_wc_t *, - const unsigned char *, const unsigned char *); + const uchar *, const uchar *); mb_wc= cs->cset->mb_wc; while (wildstr != wildend) @@ -1946,7 +1946,7 @@ static inline int bincmp(const uchar *s, const uchar *se, static int my_utf8_uni(CHARSET_INFO *cs __attribute__((unused)), my_wc_t * pwc, const uchar *s, const uchar *e) { - unsigned char c; + uchar c; if (s >= e) return MY_CS_TOOSMALL; @@ -1975,7 +1975,8 @@ static int my_utf8_uni(CHARSET_INFO *cs __attribute__((unused)), if (s+3 > e) /* We need 3 characters */ return MY_CS_TOOSMALL3; - if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && (c >= 0xe1 || s[1] >= 0xa0))) + if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && + (c >= 0xe1 || s[1] >= 0xa0))) return MY_CS_ILSEQ; *pwc = ((my_wc_t) (c & 0x0f) << 12) | @@ -2055,7 +2056,7 @@ static int my_utf8_uni(CHARSET_INFO *cs __attribute__((unused)), static int my_utf8_uni_no_range(CHARSET_INFO *cs __attribute__((unused)), my_wc_t * pwc, const uchar *s) { - unsigned char c; + uchar c; c= s[0]; if (c < 0x80) @@ -2093,8 +2094,8 @@ static int my_utf8_uni_no_range(CHARSET_INFO *cs __attribute__((unused)), } -static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)) , - my_wc_t wc, uchar *r, uchar *e) +static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *r, uchar *e) { int count; @@ -2167,8 +2168,8 @@ static int my_uni_utf8_no_range(CHARSET_INFO *cs __attribute__((unused)), } -static uint my_caseup_utf8(CHARSET_INFO *cs, char *src, uint srclen, - char *dst, uint dstlen) +static size_t my_caseup_utf8(CHARSET_INFO *cs, char *src, size_t srclen, + char *dst, size_t dstlen) { my_wc_t wc; int srcres, dstres; @@ -2186,10 +2187,11 @@ static uint my_caseup_utf8(CHARSET_INFO *cs, char *src, uint srclen, src+= srcres; dst+= dstres; } - return (uint) (dst - dst0); + return (size_t) (dst - dst0); } -static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen, + +static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, size_t slen, ulong *n1, ulong *n2) { my_wc_t wc; @@ -2217,7 +2219,7 @@ static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen, } -static uint my_caseup_str_utf8(CHARSET_INFO *cs, char *src) +static size_t my_caseup_str_utf8(CHARSET_INFO *cs, char *src) { my_wc_t wc; int srcres, dstres; @@ -2236,12 +2238,12 @@ static uint my_caseup_str_utf8(CHARSET_INFO *cs, char *src) dst+= dstres; } *dst= '\0'; - return (uint) (dst - dst0); + return (size_t) (dst - dst0); } -static uint my_casedn_utf8(CHARSET_INFO *cs, char *src, uint srclen, - char *dst, uint dstlen) +static size_t my_casedn_utf8(CHARSET_INFO *cs, char *src, size_t srclen, + char *dst, size_t dstlen) { my_wc_t wc; int srcres, dstres; @@ -2259,11 +2261,11 @@ static uint my_casedn_utf8(CHARSET_INFO *cs, char *src, uint srclen, src+= srcres; dst+= dstres; } - return (uint) (dst - dst0); + return (size_t) (dst - dst0); } -static uint my_casedn_str_utf8(CHARSET_INFO *cs, char *src) +static size_t my_casedn_str_utf8(CHARSET_INFO *cs, char *src) { my_wc_t wc; int srcres, dstres; @@ -2298,13 +2300,13 @@ static uint my_casedn_str_utf8(CHARSET_INFO *cs, char *src) */ *dst= '\0'; - return (uint) (dst - dst0); + return (size_t) (dst - dst0); } static int my_strnncoll_utf8(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { int s_res,t_res; @@ -2375,8 +2377,8 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs, */ static int my_strnncollsp_utf8(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference) { int s_res, t_res, res; @@ -2415,8 +2417,8 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs, t+=t_res; } - slen= (uint) (se-s); - tlen= (uint) (te-t); + slen= (size_t) (se-s); + tlen= (size_t) (te-t); res= 0; if (slen != tlen) @@ -2564,14 +2566,16 @@ int my_wildcmp_utf8(CHARSET_INFO *cs, static -uint my_strnxfrmlen_utf8(CHARSET_INFO *cs __attribute__((unused)), uint len) +size_t my_strnxfrmlen_utf8(CHARSET_INFO *cs __attribute__((unused)), + size_t len) { return (len * 2 + 2) / 3; } -static int my_strnxfrm_utf8(CHARSET_INFO *cs, - uchar *dst, uint dstlen, - const uchar *src, uint srclen) + +static size_t my_strnxfrm_utf8(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, + const uchar *src, size_t srclen) { my_wc_t wc; int res; @@ -2607,14 +2611,15 @@ static int my_strnxfrm_utf8(CHARSET_INFO *cs, return dstlen; } -static int my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e) +static uint my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e) { my_wc_t wc; - int res=my_utf8_uni(cs,&wc, (const uchar*)b, (const uchar*)e); + int res= my_utf8_uni(cs,&wc, (const uchar*)b, (const uchar*)e); return (res>1) ? res : 0; } -static int my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint c) +static uint my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)), + uint c) { if (c < 0x80) return 1; @@ -2759,8 +2764,8 @@ CHARSET_INFO my_charset_utf8_bin= */ static int my_strnncoll_utf8_cs(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { int s_res,t_res; @@ -2805,8 +2810,8 @@ static int my_strnncoll_utf8_cs(CHARSET_INFO *cs, } static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference __attribute__((unused))) { @@ -4104,7 +4109,7 @@ my_mb_wc_filename(CHARSET_INFO *cs __attribute__((unused)), static int my_wc_mb_filename(CHARSET_INFO *cs __attribute__((unused)), - my_wc_t wc, unsigned char *s, unsigned char *e) + my_wc_t wc, uchar *s, uchar *e) { int code; char hex[]= "0123456789abcdef"; @@ -4230,7 +4235,7 @@ static void test_mb(CHARSET_INFO *cs, uchar *s) { if (my_ismbhead_utf8(cs,*s)) { - int len=my_mbcharlen_utf8(cs,*s); + uint len=my_mbcharlen_utf8(cs,*s); while(len--) { printf("%c",*s); diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index d5be20f7b1b..b22b4364e8a 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -400,7 +400,7 @@ static uchar NEAR _sort_order_win1250ch2[] = { }; struct wordvalue { - const uchar * word; + const uchar *word; uchar pass1; uchar pass2; }; @@ -423,8 +423,8 @@ static struct wordvalue doubles[] = { if (value == 0xff) { \ int i; \ for (i = 0; i < (int) sizeof(doubles); i++) { \ - const uchar * patt = doubles[i].word; \ - const uchar * q = (const uchar *) p; \ + const uchar *patt = doubles[i].word; \ + const uchar *q = (const uchar *) p; \ while (*patt \ && !(IS_END(q, src, len)) \ && (*patt == *q)) { \ @@ -446,12 +446,12 @@ static struct wordvalue doubles[] = { #define IS_END(p, src, len) (((char *)p - (char *)src) >= (len)) static int my_strnncoll_win1250ch(CHARSET_INFO *cs __attribute__((unused)), - const uchar * s1, uint len1, - const uchar * s2, uint len2, + const uchar *s1, size_t len1, + const uchar *s2, size_t len2, my_bool s2_is_prefix) { int v1, v2; - const uchar * p1, * p2; + const uchar *p1, * p2; int pass1 = 0, pass2 = 0; int diff; @@ -477,8 +477,8 @@ static int my_strnncoll_win1250ch(CHARSET_INFO *cs __attribute__((unused)), static int my_strnncollsp_win1250ch(CHARSET_INFO * cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference __attribute__((unused))) { @@ -488,14 +488,14 @@ int my_strnncollsp_win1250ch(CHARSET_INFO * cs, } -static int my_strnxfrm_win1250ch(CHARSET_INFO * cs __attribute__((unused)), - uchar * dest, uint len, - const uchar * src, uint srclen) +static size_t my_strnxfrm_win1250ch(CHARSET_INFO * cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { int value; - const uchar * p; + const uchar *p; int pass = 0; - uint totlen = 0; + size_t totlen = 0; p = src; do { @@ -615,11 +615,11 @@ static uchar NEAR like_range_prefix_max_win1250ch[]= static my_bool my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr, uint ptr_length, + const char *ptr, size_t ptr_length, pbool escape, pbool w_one, pbool w_many, - uint res_length, + size_t res_length, char *min_str, char *max_str, - uint *min_length, uint *max_length) + size_t *min_length, size_t *max_length) { int only_min_found= 1; @@ -643,7 +643,7 @@ my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)), } if (cs->state & MY_CS_BINSORT) - *min_length= (uint) (min_str - min_org); + *min_length= (size_t) (min_str - min_org); else { /* 'a\0\0... is the smallest possible string */ diff --git a/strings/ctype.c b/strings/ctype.c index 8cb6b23c58e..de5625ef074 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -111,7 +111,7 @@ static struct my_cs_file_section_st sec[] = {0, NULL} }; -static struct my_cs_file_section_st * cs_file_sec(const char *attr, uint len) +static struct my_cs_file_section_st * cs_file_sec(const char *attr, size_t len) { struct my_cs_file_section_st *s; for (s=sec; s->str; s++) @@ -160,7 +160,7 @@ static int fill_uchar(uchar *a,uint size,const char *str, uint len) return 0; } -static int fill_uint16(uint16 *a,uint size,const char *str, uint len) +static int fill_uint16(uint16 *a,uint size,const char *str, size_t len) { uint i= 0; @@ -178,7 +178,7 @@ static int fill_uint16(uint16 *a,uint size,const char *str, uint len) } -static int cs_enter(MY_XML_PARSER *st,const char *attr, uint len) +static int cs_enter(MY_XML_PARSER *st,const char *attr, size_t len) { struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; struct my_cs_file_section_st *s= cs_file_sec(attr,len); @@ -193,7 +193,7 @@ static int cs_enter(MY_XML_PARSER *st,const char *attr, uint len) } -static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len) +static int cs_leave(MY_XML_PARSER *st,const char *attr, size_t len) { struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; struct my_cs_file_section_st *s= cs_file_sec(attr,len); @@ -211,11 +211,12 @@ static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len) } -static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) +static int cs_value(MY_XML_PARSER *st,const char *attr, size_t len) { struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; struct my_cs_file_section_st *s; - int state= (int)((s=cs_file_sec(st->attr, (int) strlen(st->attr))) ? s->state : 0); + int state= (int)((s=cs_file_sec(st->attr, strlen(st->attr))) ? s->state : + 0); switch (state) { case _CS_ID: @@ -289,8 +290,8 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) } -my_bool my_parse_charset_xml(const char *buf, uint len, - int (*add_collation)(CHARSET_INFO *cs)) +my_bool my_parse_charset_xml(const char *buf, size_t len, + int (*add_collation)(CHARSET_INFO *cs)) { MY_XML_PARSER p; struct my_cs_file_info i; diff --git a/strings/decimal.c b/strings/decimal.c index b29017aa6cb..f08b959ad37 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1186,7 +1186,7 @@ int decimal2longlong(decimal_t *from, longlong *to) 7E F2 04 37 2D FB 2D */ -int decimal2bin(decimal_t *from, char *to, int precision, int frac) +int decimal2bin(decimal_t *from, uchar *to, int precision, int frac) { dec1 mask=from->sign ? -1 : 0, *buf1=from->buf, *stop1; int error=E_DEC_OK, intg=precision-frac, @@ -1202,7 +1202,7 @@ int decimal2bin(decimal_t *from, char *to, int precision, int frac) fsize1=frac1*sizeof(dec1)+dig2bytes[frac1x]; const int orig_isize0= isize0; const int orig_fsize0= fsize0; - char *orig_to= to; + uchar *orig_to= to; buf1= remove_leading_zeroes(from, &from_intg); @@ -1292,10 +1292,10 @@ int decimal2bin(decimal_t *from, char *to, int precision, int frac) } if (fsize0 > fsize1) { - char *to_end= orig_to + orig_fsize0 + orig_isize0; + uchar *to_end= orig_to + orig_fsize0 + orig_isize0; while (fsize0-- > fsize1 && to < to_end) - *to++=(uchar)mask; + *to++= (uchar)mask; } orig_to[0]^= 0x80; @@ -1321,19 +1321,19 @@ int decimal2bin(decimal_t *from, char *to, int precision, int frac) E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW */ -int bin2decimal(char *from, decimal_t *to, int precision, int scale) +int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale) { int error=E_DEC_OK, intg=precision-scale, intg0=intg/DIG_PER_DEC1, frac0=scale/DIG_PER_DEC1, intg0x=intg-intg0*DIG_PER_DEC1, frac0x=scale-frac0*DIG_PER_DEC1, intg1=intg0+(intg0x>0), frac1=frac0+(frac0x>0); dec1 *buf=to->buf, mask=(*from & 0x80) ? 0 : -1; - char *stop; - char *d_copy; + const uchar *stop; + uchar *d_copy; int bin_size= decimal_bin_size(precision, scale); sanity(to); - d_copy= (char *)my_alloca(bin_size); + d_copy= (uchar*) my_alloca(bin_size); memcpy(d_copy, from, bin_size); d_copy[0]^= 0x80; from= d_copy; diff --git a/strings/do_ctype.c b/strings/do_ctype.c index b8eca68debf..f33ddc5eb81 100644 --- a/strings/do_ctype.c +++ b/strings/do_ctype.c @@ -141,22 +141,22 @@ void init_case_convert() #endif #ifdef MSDOS - higher_pos= (uchar * ) "\217\216\231\232\220"; /* Extra chars to konv. */ - lower_pos= (uchar * ) "\206\204\224\201\202"; + higher_pos= (uchar *) "\217\216\231\232\220"; /* Extra chars to konv. */ + lower_pos= (uchar *) "\206\204\224\201\202"; #else #if defined(HPUX10) && ASCII_BITS_USED == 8 - higher_pos= (uchar * ) "\xd0\xd8\xda\xdb\xdc\xd3"; - lower_pos= (uchar * ) "\xd4\xcc\xce\xdf\xc9\xd7"; + higher_pos= (uchar *) "\xd0\xd8\xda\xdb\xdc\xd3"; + lower_pos= (uchar *) "\xd4\xcc\xce\xdf\xc9\xd7"; #else #ifdef USE_INTERNAL_CTYPE higher_pos=lower_pos= (uchar* ) ""; /* System converts chars */ #else #if defined(DEC_MULTINATIONAL_CHAR) || defined(HP_MULTINATIONAL_CHAR) - higher_pos= (uchar * ) "\305\304\326\311\334"; - lower_pos= (uchar * ) "\345\344\366\351\374"; + higher_pos= (uchar *) "\305\304\326\311\334"; + lower_pos= (uchar *) "\345\344\366\351\374"; #else - higher_pos= (uchar * ) "[]\\@^"; - lower_pos= (uchar * ) "{}|`~"; + higher_pos= (uchar *) "[]\\@^"; + lower_pos= (uchar *) "{}|`~"; #endif #endif /* USE_INTERNAL_CTYPE */ #endif /* HPUX10 */ diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c index 165d3e38095..4f73b1f8e71 100644 --- a/strings/my_strtoll10.c +++ b/strings/my_strtoll10.c @@ -86,7 +86,7 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error) { const char *s, *end, *start, *n_end, *true_end; char *dummy; - unsigned char c; + uchar c; unsigned long i, j, k; ulonglong li; int negative; diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 93d228a1954..9fdbfa1fa89 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -40,10 +40,11 @@ length of result string */ -int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) +size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) { char *start=to, *end=to+n-1; - uint length, width, pre_zero, have_long; + size_t length, width; + uint pre_zero, have_long; for (; *fmt ; fmt++) { @@ -58,7 +59,8 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) /* Read max fill size (only used with %d and %u) */ if (*fmt == '-') fmt++; - length= width= pre_zero= have_long= 0; + length= width= 0; + pre_zero= have_long= 0; if (*fmt == '*') { fmt++; @@ -93,9 +95,9 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) if (*fmt == 's') /* String parameter */ { reg2 char *par = va_arg(ap, char *); - uint plen,left_len = (uint)(end-to)+1; + size_t plen,left_len = (size_t) (end - to) + 1; if (!par) par = (char*)"(null)"; - plen = (uint) strlen(par); + plen= strlen(par); set_if_smaller(plen,width); if (left_len <= plen) plen = left_len - 1; @@ -115,11 +117,11 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) else if (*fmt == 'd' || *fmt == 'u'|| *fmt== 'x') /* Integer parameter */ { register long larg; - uint res_length, to_length; + size_t res_length, to_length; char *store_start= to, *store_end; char buff[32]; - if ((to_length= (uint) (end-to)) < 16 || length) + if ((to_length= (size_t) (end-to)) < 16 || length) store_start= buff; if (have_long) larg = va_arg(ap, long); @@ -135,7 +137,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) store_end= int10_to_str(larg, store_start, 10); else store_end= int2str(larg, store_start, 16, 0); - if ((res_length= (uint) (store_end - store_start)) > to_length) + if ((res_length= (size_t) (store_end - store_start)) > to_length) break; /* num doesn't fit in output */ /* If %#d syntax was used, we have to pre-zero/pre-space the string */ if (store_start == buff) @@ -143,7 +145,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) length= min(length, to_length); if (res_length < length) { - uint diff= (length- res_length); + size_t diff= (length- res_length); bfill(to, diff, pre_zero ? '0' : ' '); to+= diff; } @@ -169,10 +171,11 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) } DBUG_ASSERT(to <= end); *to='\0'; /* End of errmessage */ - return (uint) (to - start); + return (size_t) (to - start); } -int my_snprintf(char* to, size_t n, const char* fmt, ...) + +size_t my_snprintf(char* to, size_t n, const char* fmt, ...) { int result; va_list args; diff --git a/strings/r_strinstr.c b/strings/r_strinstr.c index 98118015456..fb1e0c5a090 100644 --- a/strings/r_strinstr.c +++ b/strings/r_strinstr.c @@ -25,14 +25,14 @@ #include <my_global.h> #include "m_string.h" -uint r_strinstr(reg1 my_string str,int from, reg4 my_string search) +size_t r_strinstr(reg1 const char * str, size_t from, reg4 const char * search) { - reg2 my_string i, j; - uint len = (uint) strlen(search); + reg2 const char *i, *j; + size_t len = strlen(search); /* pointer to the last char of buff */ - my_string start = str + from - 1; + const char * start = str + from - 1; /* pointer to the last char of search */ - my_string search_end = search + len - 1; + const char * search_end = search + len - 1; skip: while (start >= str) /* Cant be != because the first char */ @@ -43,7 +43,7 @@ uint r_strinstr(reg1 my_string str,int from, reg4 my_string search) while (j >= search && start > str) if (*i-- != *j--) goto skip; - return (uint) ((start - len) - str + 3); + return (size_t) ((start - len) - str + 3); } } return (0); diff --git a/strings/str_test.c b/strings/str_test.c index 7863dce8688..3ddfca39419 100644 --- a/strings/str_test.c +++ b/strings/str_test.c @@ -29,12 +29,12 @@ #define T_PREFILL '1' static char from_buff[100],to_buff[100]; -static my_string from,to; +static char * from, *to; static int errors,tests; static int test_strarg(const char *name,...); static void init_strings (void); /* Init from and to */ void test_arg (const char *message,long func_value,long value); -int compare_buff(const char *message,my_string b1,my_string b2,int length, +int compare_buff(const char *message,char * b1,char * b2,int length, pchar fill, pchar prefill); static int my_test(int a) @@ -228,7 +228,7 @@ static int test_strarg(const char *message,...) /* test if function made right value */ -int compare_buff(const char *message, my_string b1, my_string b2, int length, +int compare_buff(const char *message, char * b1, char * b2, int length, pchar fill, pchar prefill) { int i,error=0; diff --git a/strings/strappend.c b/strings/strappend.c index 3a5da658709..bb926f74665 100644 --- a/strings/strappend.c +++ b/strings/strappend.c @@ -27,7 +27,7 @@ #include "m_string.h" -void strappend(register char *s, uint len, pchar fill) +void strappend(register char *s, size_t len, pchar fill) { register char *endpos; diff --git a/strings/strcont.c b/strings/strcont.c index d57af77804d..5a518a3550f 100644 --- a/strings/strcont.c +++ b/strings/strcont.c @@ -27,9 +27,9 @@ #include <my_global.h> #include "m_string.h" -my_string strcont(reg1 const char *str,reg2 const char *set) +char * strcont(reg1 const char *str,reg2 const char *set) { - reg3 my_string start = (my_string) set; + reg3 char * start = (char *) set; while (*str) { diff --git a/strings/strfill.c b/strings/strfill.c index 7d3f25e3ff4..4b1fe67b206 100644 --- a/strings/strfill.c +++ b/strings/strfill.c @@ -26,7 +26,7 @@ #include <my_global.h> #include "m_string.h" -my_string strfill(my_string s,uint len,pchar fill) +char * strfill(char *s, size_t len, pchar fill) { while (len--) *s++ = fill; *(s) = '\0'; diff --git a/strings/strinstr.c b/strings/strinstr.c index 10f83a54c29..dce498d61e8 100644 --- a/strings/strinstr.c +++ b/strings/strinstr.c @@ -28,20 +28,20 @@ #include <my_global.h> #include "m_string.h" -uint strinstr(reg1 const char *str,reg4 const char *search) +size_t strinstr(reg1 const char *str,reg4 const char *search) { - reg2 my_string i,j; - my_string start = (my_string) str; + reg2 const char *i, *j; + const char *start= str; skip: while (*str != '\0') { if (*str++ == *search) { - i=(my_string) str; j= (my_string) search+1; + i= str; j= search+1; while (*j) if (*i++ != *j++) goto skip; - return ((uint) (str - start)); + return ((size_t) (str - start)); } } return (0); diff --git a/strings/strlen.c b/strings/strlen.c index b3c901739b1..1469dd096ee 100644 --- a/strings/strlen.c +++ b/strings/strlen.c @@ -31,7 +31,7 @@ #if VaxAsm -size_s strlen(char *s) +size_t strlen(char *s) { asm("locc $0,$65535,*4(ap)"); asm("subl3 r0,$65535,r0"); @@ -40,7 +40,7 @@ size_s strlen(char *s) #else #if defined(MC68000) && defined(DS90) -size_s strlen(char *s) +size_t strlen(char *s) { asm(" movl 4(a7),a0 "); asm(" movl a0,a1 "); @@ -52,13 +52,13 @@ asm(" subql #1,d0 "); } #else -size_s strlen(register char *s) +size_t strlen(register char *s) { register char *startpos; startpos = s; while (*s++); - return ((size_s) (s-startpos-1)); + return ((size_t) (s-startpos-1)); } #endif diff --git a/strings/strmake.c b/strings/strmake.c index 5ca4688de46..0d26e1b61a9 100644 --- a/strings/strmake.c +++ b/strings/strmake.c @@ -42,7 +42,7 @@ char *strmake(char *dst,const char *src,uint length) #define strmake strmake_overlapp /* Use orginal for overlapping str */ #endif -char *strmake(register char *dst, register const char *src, uint length) +char *strmake(register char *dst, register const char *src, size_t length) { while (length--) if (! (*dst++ = *src++)) diff --git a/strings/strnlen.c b/strings/strnlen.c index 11ecf718746..826cd5ae5dd 100644 --- a/strings/strnlen.c +++ b/strings/strnlen.c @@ -25,10 +25,10 @@ #ifndef HAVE_STRNLEN -uint strnlen(register const char *s, register uint maxlen) +size_t strnlen(register const char *s, register size_t maxlen) { const char *end= (const char *)memchr(s, '\0', maxlen); - return end ? (uint) (end - s) : maxlen; + return end ? (size_t) (end - s) : maxlen; } #endif diff --git a/strings/strnmov.c b/strings/strnmov.c index b2099452d98..7e26877637b 100644 --- a/strings/strnmov.c +++ b/strings/strnmov.c @@ -23,7 +23,7 @@ #include <my_global.h> #include "m_string.h" -char *strnmov(register char *dst, register const char *src, uint n) +char *strnmov(register char *dst, register const char *src, size_t n) { while (n-- != 0) { if (!(*dst++ = *src++)) { diff --git a/strings/strto.c b/strings/strto.c index 934b5d88e90..fcb0d800b81 100644 --- a/strings/strto.c +++ b/strings/strto.c @@ -88,7 +88,7 @@ function (const char *nptr,char **endptr,int base) register unsigned int cutlim; register ulongtype i; register const char *s; - register unsigned char c; + register uchar c; const char *save; int overflow; diff --git a/strings/strtod.c b/strings/strtod.c index 15707a9b944..75710c9c722 100644 --- a/strings/strtod.c +++ b/strings/strtod.c @@ -56,7 +56,8 @@ static double scaler1[] = { double my_strtod(const char *str, char **end_ptr, int *error) { double result= 0.0; - uint negative= 0, ndigits, dec_digits= 0, neg_exp= 0; + uint negative= 0, neg_exp= 0; + size_t ndigits, dec_digits= 0; int exponent= 0, digits_after_dec_point= 0, tmp_exp; const char *old_str, *end= *end_ptr, *start_of_number; char next_char; @@ -100,7 +101,7 @@ double my_strtod(const char *str, char **end_ptr, int *error) } start_of_number= 0; /* Found digit */ } - ndigits= (uint) (str-old_str); + ndigits= (size_t) (str-old_str); if (next_char == '.' && str < end-1) { @@ -124,7 +125,7 @@ double my_strtod(const char *str, char **end_ptr, int *error) } } /* If we found just '+.' or '.' then point at first character */ - if (!(dec_digits= (uint) (str-old_str)) && start_of_number) + if (!(dec_digits= (size_t) (str-old_str)) && start_of_number) str= start_of_number; /* Point at '+' or '.' */ } if ((next_char == 'e' || next_char == 'E') && diff --git a/strings/strxnmov.c b/strings/strxnmov.c index 377133de69e..16469be6e45 100644 --- a/strings/strxnmov.c +++ b/strings/strxnmov.c @@ -39,7 +39,7 @@ #include "m_string.h" #include <stdarg.h> -char *strxnmov(char *dst,uint len, const char *src, ...) +char *strxnmov(char *dst, size_t len, const char *src, ...) { va_list pvar; char *end_of_dst=dst+len; diff --git a/strings/xml.c b/strings/xml.c index fc6c61c8a3c..5c62a8e8603 100644 --- a/strings/xml.c +++ b/strings/xml.c @@ -110,7 +110,7 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a) { int lex; - for( ; ( p->cur < p->end) && my_xml_is_space(p->cur[0]) ; p->cur++); + for (; ( p->cur < p->end) && my_xml_is_space(p->cur[0]) ; p->cur++); if (p->cur >= p->end) { @@ -125,7 +125,7 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a) if ((p->end - p->cur > 3) && !bcmp(p->cur,"<!--",4)) { - for( ; (p->cur < p->end) && bcmp(p->cur, "-->", 3); p->cur++) + for (; (p->cur < p->end) && bcmp(p->cur, "-->", 3); p->cur++) {} if (!bcmp(p->cur, "-->", 3)) p->cur+=3; @@ -155,7 +155,7 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a) else if ( (p->cur[0] == '"') || (p->cur[0] == '\'') ) { p->cur++; - for( ; ( p->cur < p->end ) && (p->cur[0] != a->beg[0]); p->cur++) + for (; ( p->cur < p->end ) && (p->cur[0] != a->beg[0]); p->cur++) {} a->end=p->cur; if (a->beg[0] == p->cur[0])p->cur++; @@ -185,15 +185,15 @@ ret: } -static int my_xml_value(MY_XML_PARSER *st, const char *str, uint len) +static int my_xml_value(MY_XML_PARSER *st, const char *str, size_t len) { return (st->value) ? (st->value)(st,str,len) : MY_XML_OK; } -static int my_xml_enter(MY_XML_PARSER *st, const char *str, uint len) +static int my_xml_enter(MY_XML_PARSER *st, const char *str, size_t len) { - if ((uint) (st->attrend-st->attr+len+1) > sizeof(st->attr)) + if ((size_t) (st->attrend-st->attr+len+1) > sizeof(st->attr)) { sprintf(st->errstr,"To deep XML"); return MY_XML_ERROR; @@ -213,7 +213,7 @@ static int my_xml_enter(MY_XML_PARSER *st, const char *str, uint len) } -static void mstr(char *s,const char *src,uint l1, uint l2) +static void mstr(char *s,const char *src,size_t l1, size_t l2) { l1 = l1<l2 ? l1 : l2; memcpy(s,src,l1); @@ -221,17 +221,17 @@ static void mstr(char *s,const char *src,uint l1, uint l2) } -static int my_xml_leave(MY_XML_PARSER *p, const char *str, uint slen) +static int my_xml_leave(MY_XML_PARSER *p, const char *str, size_t slen) { char *e; - uint glen; + size_t glen; char s[32]; char g[32]; int rc; /* Find previous '/' or beginning */ - for( e=p->attrend; (e>p->attr) && (e[0] != '/') ; e--); - glen = (uint) ((e[0] == '/') ? (p->attrend-e-1) : p->attrend-e); + for (e=p->attrend; (e>p->attr) && (e[0] != '/') ; e--); + glen = (size_t) ((e[0] == '/') ? (p->attrend-e-1) : p->attrend-e); if (str && (slen != glen)) { @@ -249,7 +249,8 @@ static int my_xml_leave(MY_XML_PARSER *p, const char *str, uint slen) if (p->flags & MY_XML_FLAG_RELATIVE_NAMES) rc= p->leave_xml ? p->leave_xml(p, str, slen) : MY_XML_OK; else - rc = p->leave_xml ? p->leave_xml(p,p->attr,p->attrend-p->attr) : MY_XML_OK; + rc= (p->leave_xml ? p->leave_xml(p,p->attr,p->attrend-p->attr) : + MY_XML_OK); *e='\0'; p->attrend=e; @@ -258,7 +259,7 @@ static int my_xml_leave(MY_XML_PARSER *p, const char *str, uint slen) } -int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len) +int my_xml_parse(MY_XML_PARSER *p,const char *str, size_t len) { p->attrend=p->attr; p->beg=str; @@ -283,7 +284,7 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len) { a.beg+= 9; a.end-= 3; - my_xml_value(p, a.beg, (uint) (a.end-a.beg)); + my_xml_value(p, a.beg, (size_t) (a.end-a.beg)); continue; } @@ -296,7 +297,7 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len) sprintf(p->errstr,"%s unexpected (ident wanted)",lex2str(lex)); return MY_XML_ERROR; } - if (MY_XML_OK != my_xml_leave(p,a.beg,(uint) (a.end-a.beg))) + if (MY_XML_OK != my_xml_leave(p,a.beg,(size_t) (a.end-a.beg))) return MY_XML_ERROR; lex=my_xml_scan(p,&a); goto gt; @@ -316,7 +317,7 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len) if (MY_XML_IDENT == lex) { p->current_node_type= MY_XML_NODE_TAG; - if (MY_XML_OK != my_xml_enter(p,a.beg,(uint) (a.end-a.beg))) + if (MY_XML_OK != my_xml_enter(p,a.beg,(size_t) (a.end-a.beg))) return MY_XML_ERROR; } else @@ -336,9 +337,9 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len) if ( (lex == MY_XML_IDENT) || (lex == MY_XML_STRING) ) { p->current_node_type= MY_XML_NODE_ATTR; - if ((MY_XML_OK != my_xml_enter(p,a.beg,(uint) (a.end-a.beg))) || - (MY_XML_OK != my_xml_value(p,b.beg,(uint) (b.end-b.beg))) || - (MY_XML_OK != my_xml_leave(p,a.beg,(uint) (a.end-a.beg)))) + if ((MY_XML_OK != my_xml_enter(p,a.beg,(size_t) (a.end-a.beg))) || + (MY_XML_OK != my_xml_value(p,b.beg,(size_t) (b.end-b.beg))) || + (MY_XML_OK != my_xml_leave(p,a.beg,(size_t) (a.end-a.beg)))) return MY_XML_ERROR; } else @@ -351,8 +352,8 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len) else if ((MY_XML_STRING == lex) || (MY_XML_IDENT == lex)) { p->current_node_type= MY_XML_NODE_ATTR; - if ((MY_XML_OK != my_xml_enter(p,a.beg,(uint) (a.end-a.beg))) || - (MY_XML_OK != my_xml_leave(p,a.beg,(uint) (a.end-a.beg)))) + if ((MY_XML_OK != my_xml_enter(p,a.beg,(size_t) (a.end-a.beg))) || + (MY_XML_OK != my_xml_leave(p,a.beg,(size_t) (a.end-a.beg)))) return MY_XML_ERROR; } else @@ -401,7 +402,7 @@ gt: my_xml_norm_text(&a); if (a.beg != a.end) { - my_xml_value(p,a.beg,(uint) (a.end-a.beg)); + my_xml_value(p,a.beg,(size_t) (a.end-a.beg)); } } } @@ -428,14 +429,14 @@ void my_xml_parser_free(MY_XML_PARSER *p __attribute__((unused))) void my_xml_set_value_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, - uint l)) + size_t l)) { p->value=action; } void my_xml_set_enter_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, - uint l)) + size_t l)) { p->enter=action; } @@ -443,7 +444,7 @@ void my_xml_set_enter_handler(MY_XML_PARSER *p, void my_xml_set_leave_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, - uint l)) + size_t l)) { p->leave_xml=action; } @@ -461,7 +462,7 @@ const char *my_xml_error_string(MY_XML_PARSER *p) } -uint my_xml_error_pos(MY_XML_PARSER *p) +size_t my_xml_error_pos(MY_XML_PARSER *p) { const char *beg=p->beg; const char *s; @@ -470,7 +471,7 @@ uint my_xml_error_pos(MY_XML_PARSER *p) if (s[0] == '\n') beg=s; } - return (uint) (p->cur-beg); + return (size_t) (p->cur-beg); } uint my_xml_error_lineno(MY_XML_PARSER *p) |