summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore3
-rw-r--r--client/completion_hash.cc2
-rw-r--r--client/my_readline.h2
-rw-r--r--client/mysql.cc128
-rw-r--r--client/mysql_upgrade.c19
-rw-r--r--client/mysqladmin.cc64
-rw-r--r--client/mysqlbinlog.cc86
-rw-r--r--client/mysqlcheck.c60
-rw-r--r--client/mysqldump.c184
-rw-r--r--client/mysqlimport.c80
-rw-r--r--client/mysqlshow.c51
-rw-r--r--client/mysqlslap.c123
-rw-r--r--client/mysqltest.c211
-rw-r--r--client/readline.cc34
-rw-r--r--client/sql_string.cc8
-rw-r--r--dbug/dbug.c35
-rw-r--r--extra/comp_err.c62
-rw-r--r--extra/innochecksum.c14
-rw-r--r--extra/my_print_defaults.c16
-rw-r--r--extra/mysql_waitpid.c2
-rw-r--r--extra/perror.c10
-rw-r--r--extra/replace.c103
-rw-r--r--extra/resolve_stack_dump.c16
-rw-r--r--extra/resolveip.c4
-rw-r--r--include/config-win.h6
-rw-r--r--include/decimal.h4
-rw-r--r--include/ft_global.h6
-rw-r--r--include/hash.h29
-rw-r--r--include/heap.h54
-rw-r--r--include/keycache.h16
-rw-r--r--include/m_ctype.h233
-rw-r--r--include/m_string.h55
-rw-r--r--include/my_alloc.h4
-rw-r--r--include/my_base.h2
-rw-r--r--include/my_dbug.h8
-rw-r--r--include/my_getopt.h6
-rw-r--r--include/my_global.h151
-rw-r--r--include/my_list.h4
-rw-r--r--include/my_nosys.h5
-rw-r--r--include/my_pthread.h2
-rw-r--r--include/my_sys.h277
-rw-r--r--include/my_tree.h4
-rw-r--r--include/my_trie.h16
-rw-r--r--include/my_user.h6
-rw-r--r--include/my_vle.h4
-rw-r--r--include/my_xml.h16
-rw-r--r--include/myisam.h40
-rw-r--r--include/myisammrg.h22
-rw-r--r--include/mysql.h15
-rw-r--r--include/mysql_com.h14
-rw-r--r--include/queues.h12
-rw-r--r--include/sql_common.h6
-rw-r--r--include/sslopt-longopts.h14
-rw-r--r--include/violite.h20
-rw-r--r--libmysql/client_settings.h2
-rw-r--r--libmysql/libmysql.c10
-rw-r--r--libmysql/manager.c4
-rw-r--r--libmysqld/emb_qcache.cc16
-rw-r--r--libmysqld/emb_qcache.h8
-rw-r--r--libmysqld/lib_sql.cc26
-rw-r--r--mysys/array.c18
-rw-r--r--mysys/charset.c20
-rw-r--r--mysys/checksum.c9
-rw-r--r--mysys/default.c23
-rw-r--r--mysys/default_modify.c13
-rw-r--r--mysys/hash.c65
-rw-r--r--mysys/list.c6
-rw-r--r--mysys/mf_cache.c2
-rw-r--r--mysys/mf_dirname.c28
-rw-r--r--mysys/mf_fn_ext.c11
-rw-r--r--mysys/mf_format.c36
-rw-r--r--mysys/mf_getdate.c2
-rw-r--r--mysys/mf_iocache.c253
-rw-r--r--mysys/mf_iocache2.c105
-rw-r--r--mysys/mf_keycache.c46
-rw-r--r--mysys/mf_keycaches.c44
-rw-r--r--mysys/mf_loadpath.c4
-rw-r--r--mysys/mf_pack.c184
-rw-r--r--mysys/mf_path.c12
-rw-r--r--mysys/mf_radix.c4
-rw-r--r--mysys/mf_same.c5
-rw-r--r--mysys/mf_sort.c8
-rw-r--r--mysys/mf_soundex.c4
-rw-r--r--mysys/mf_strip.c12
-rw-r--r--mysys/mf_tempdir.c2
-rw-r--r--mysys/mf_unixpath.c2
-rw-r--r--mysys/mf_wfile.c14
-rw-r--r--mysys/mulalloc.c6
-rw-r--r--mysys/my_alloc.c62
-rw-r--r--mysys/my_chsize.c8
-rw-r--r--mysys/my_compress.c160
-rw-r--r--mysys/my_conio.c12
-rw-r--r--mysys/my_create.c6
-rw-r--r--mysys/my_div.c2
-rw-r--r--mysys/my_error.c6
-rw-r--r--mysys/my_fopen.c4
-rw-r--r--mysys/my_fstream.c92
-rw-r--r--mysys/my_getopt.c18
-rw-r--r--mysys/my_getwd.c38
-rw-r--r--mysys/my_init.c2
-rw-r--r--mysys/my_largepage.c26
-rw-r--r--mysys/my_lib.c22
-rw-r--r--mysys/my_lockmem.c18
-rw-r--r--mysys/my_malloc.c38
-rw-r--r--mysys/my_memmem.c3
-rw-r--r--mysys/my_once.c26
-rw-r--r--mysys/my_open.c8
-rw-r--r--mysys/my_pread.c153
-rw-r--r--mysys/my_quick.c18
-rw-r--r--mysys/my_read.c25
-rw-r--r--mysys/my_realloc.c10
-rw-r--r--mysys/my_static.c6
-rw-r--r--mysys/my_static.h2
-rw-r--r--mysys/my_vle.c20
-rw-r--r--mysys/my_wincond.c2
-rw-r--r--mysys/my_windac.c8
-rw-r--r--mysys/my_write.c26
-rw-r--r--mysys/ptr_cmp.c26
-rw-r--r--mysys/queues.c36
-rw-r--r--mysys/safemalloc.c72
-rw-r--r--mysys/string.c40
-rw-r--r--mysys/testhash.c6
-rw-r--r--mysys/thr_alarm.c12
-rw-r--r--mysys/thr_lock.c4
-rw-r--r--mysys/tree.c8
-rw-r--r--mysys/trie.c8
-rw-r--r--mysys/typelib.c7
-rw-r--r--plugin/daemon_example/daemon_example.cc6
-rw-r--r--regex/reginit.c2
-rw-r--r--server-tools/instance-manager/buffer.cc10
-rw-r--r--server-tools/instance-manager/buffer.h8
-rw-r--r--server-tools/instance-manager/commands.cc37
-rw-r--r--server-tools/instance-manager/instance_map.cc28
-rw-r--r--server-tools/instance-manager/instance_options.cc12
-rw-r--r--server-tools/instance-manager/mysql_connection.cc19
-rw-r--r--server-tools/instance-manager/options.cc74
-rw-r--r--server-tools/instance-manager/parse.cc10
-rw-r--r--server-tools/instance-manager/parse.h10
-rw-r--r--server-tools/instance-manager/protocol.cc28
-rw-r--r--server-tools/instance-manager/protocol.h7
-rw-r--r--server-tools/instance-manager/user_map.cc16
-rw-r--r--sql-common/client.c24
-rw-r--r--sql-common/my_user.c6
-rw-r--r--sql-common/pack.c4
-rw-r--r--sql/derror.cc34
-rw-r--r--sql/discover.cc18
-rw-r--r--sql/event_data_objects.cc13
-rw-r--r--sql/event_db_repository.cc13
-rw-r--r--sql/event_queue.cc6
-rw-r--r--sql/field.cc583
-rw-r--r--sql/field.h386
-rw-r--r--sql/field_conv.cc33
-rw-r--r--sql/filesort.cc82
-rw-r--r--sql/gen_lex_hash.cc4
-rw-r--r--sql/gstream.h2
-rw-r--r--sql/ha_ndbcluster.cc292
-rw-r--r--sql/ha_ndbcluster.h84
-rw-r--r--sql/ha_ndbcluster_binlog.cc79
-rw-r--r--sql/ha_ndbcluster_binlog.h2
-rw-r--r--sql/ha_ndbcluster_cond.cc8
-rw-r--r--sql/ha_ndbcluster_cond.h6
-rw-r--r--sql/ha_partition.cc92
-rw-r--r--sql/ha_partition.h68
-rw-r--r--sql/handler.cc70
-rw-r--r--sql/handler.h78
-rw-r--r--sql/hash_filo.h8
-rw-r--r--sql/hostname.cc10
-rw-r--r--sql/item.cc54
-rw-r--r--sql/item.h108
-rw-r--r--sql/item_cmpfunc.cc44
-rw-r--r--sql/item_cmpfunc.h58
-rw-r--r--sql/item_create.cc15
-rw-r--r--sql/item_func.cc114
-rw-r--r--sql/item_func.h76
-rw-r--r--sql/item_row.cc4
-rw-r--r--sql/item_row.h4
-rw-r--r--sql/item_strfunc.cc5
-rw-r--r--sql/item_strfunc.h36
-rw-r--r--sql/item_subselect.cc6
-rw-r--r--sql/item_subselect.h2
-rw-r--r--sql/item_sum.cc48
-rw-r--r--sql/item_sum.h22
-rw-r--r--sql/item_timefunc.cc8
-rw-r--r--sql/item_timefunc.h60
-rw-r--r--sql/item_xmlfunc.cc8
-rw-r--r--sql/item_xmlfunc.h2
-rw-r--r--sql/key.cc35
-rw-r--r--sql/lock.cc42
-rw-r--r--sql/log.cc101
-rw-r--r--sql/log_event.cc414
-rw-r--r--sql/log_event.h69
-rw-r--r--sql/log_event_old.cc17
-rw-r--r--sql/log_event_old.h6
-rw-r--r--sql/mf_iocache.cc6
-rw-r--r--sql/my_decimal.cc4
-rw-r--r--sql/my_decimal.h9
-rw-r--r--sql/mysql_priv.h74
-rw-r--r--sql/mysqld.cc828
-rw-r--r--sql/net_serv.cc139
-rw-r--r--sql/opt_range.cc229
-rw-r--r--sql/opt_range.h40
-rw-r--r--sql/opt_sum.cc12
-rw-r--r--sql/parse_file.cc67
-rw-r--r--sql/parse_file.h10
-rw-r--r--sql/partition_info.cc37
-rw-r--r--sql/partition_info.h12
-rw-r--r--sql/protocol.cc114
-rw-r--r--sql/protocol.h26
-rw-r--r--sql/records.cc10
-rw-r--r--sql/repl_failsafe.cc16
-rw-r--r--sql/rpl_filter.cc22
-rw-r--r--sql/rpl_filter.h2
-rw-r--r--sql/rpl_injector.h2
-rw-r--r--sql/rpl_record.cc24
-rw-r--r--sql/rpl_record.h8
-rw-r--r--sql/rpl_record_old.cc24
-rw-r--r--sql/rpl_record_old.h10
-rw-r--r--sql/rpl_rli.cc5
-rw-r--r--sql/rpl_tblmap.cc6
-rw-r--r--sql/rpl_tblmap.h2
-rw-r--r--sql/rpl_utility.cc2
-rw-r--r--sql/rpl_utility.h13
-rw-r--r--sql/set_var.cc155
-rw-r--r--sql/set_var.h94
-rw-r--r--sql/slave.cc30
-rw-r--r--sql/slave.h16
-rw-r--r--sql/sp.cc68
-rw-r--r--sql/sp.h3
-rw-r--r--sql/sp_cache.cc14
-rw-r--r--sql/sp_head.cc34
-rw-r--r--sql/sp_head.h4
-rw-r--r--sql/sp_pcontext.cc20
-rw-r--r--sql/sp_pcontext.h6
-rw-r--r--sql/sql_acl.cc143
-rw-r--r--sql/sql_analyse.cc4
-rw-r--r--sql/sql_analyse.h4
-rw-r--r--sql/sql_array.h2
-rw-r--r--sql/sql_base.cc101
-rw-r--r--sql/sql_binlog.cc8
-rw-r--r--sql/sql_cache.cc186
-rw-r--r--sql/sql_cache.h36
-rw-r--r--sql/sql_class.cc176
-rw-r--r--sql/sql_class.h69
-rw-r--r--sql/sql_connect.cc18
-rw-r--r--sql/sql_db.cc57
-rw-r--r--sql/sql_delete.cc2
-rw-r--r--sql/sql_handler.cc30
-rw-r--r--sql/sql_help.cc10
-rw-r--r--sql/sql_insert.cc24
-rw-r--r--sql/sql_lex.cc6
-rw-r--r--sql/sql_lex.h12
-rw-r--r--sql/sql_list.h10
-rw-r--r--sql/sql_load.cc40
-rw-r--r--sql/sql_manager.cc2
-rw-r--r--sql/sql_map.cc8
-rw-r--r--sql/sql_map.h12
-rw-r--r--sql/sql_olap.cc4
-rw-r--r--sql/sql_parse.cc73
-rw-r--r--sql/sql_partition.cc80
-rw-r--r--sql/sql_partition.h12
-rw-r--r--sql/sql_plugin.cc28
-rw-r--r--sql/sql_prepare.cc23
-rw-r--r--sql/sql_repl.cc20
-rw-r--r--sql/sql_select.cc119
-rw-r--r--sql/sql_select.h39
-rw-r--r--sql/sql_servers.cc28
-rw-r--r--sql/sql_show.cc25
-rw-r--r--sql/sql_string.cc8
-rw-r--r--sql/sql_table.cc40
-rw-r--r--sql/sql_test.cc4
-rw-r--r--sql/sql_trigger.cc26
-rw-r--r--sql/sql_udf.cc22
-rw-r--r--sql/sql_union.cc6
-rw-r--r--sql/sql_update.cc10
-rw-r--r--sql/sql_view.cc12
-rw-r--r--sql/sql_yacc.yy25
-rw-r--r--sql/stacktrace.c6
-rw-r--r--sql/stacktrace.h2
-rw-r--r--sql/structs.h12
-rw-r--r--sql/table.cc155
-rw-r--r--sql/table.h39
-rw-r--r--sql/thr_malloc.cc31
-rw-r--r--sql/tzfile.h16
-rw-r--r--sql/tztime.cc67
-rw-r--r--sql/uniques.cc19
-rw-r--r--sql/unireg.cc67
-rw-r--r--storage/archive/archive_reader.c14
-rw-r--r--storage/archive/azio.c26
-rw-r--r--storage/archive/ha_archive.cc101
-rw-r--r--storage/archive/ha_archive.h34
-rw-r--r--storage/blackhole/ha_blackhole.cc22
-rw-r--r--storage/blackhole/ha_blackhole.h22
-rw-r--r--storage/csv/ha_tina.cc52
-rw-r--r--storage/csv/ha_tina.h22
-rw-r--r--storage/csv/transparent_file.cc46
-rw-r--r--storage/csv/transparent_file.h4
-rw-r--r--storage/example/ha_example.cc36
-rw-r--r--storage/example/ha_example.h22
-rw-r--r--storage/federated/ha_federated.cc54
-rw-r--r--storage/federated/ha_federated.h26
-rw-r--r--storage/heap/_check.c4
-rw-r--r--storage/heap/_rectest.c2
-rw-r--r--storage/heap/ha_heap.cc28
-rw-r--r--storage/heap/ha_heap.h28
-rw-r--r--storage/heap/heapdef.h52
-rw-r--r--storage/heap/hp_block.c23
-rw-r--r--storage/heap/hp_clear.c4
-rw-r--r--storage/heap/hp_close.c2
-rw-r--r--storage/heap/hp_create.c20
-rw-r--r--storage/heap/hp_delete.c10
-rw-r--r--storage/heap/hp_hash.c48
-rw-r--r--storage/heap/hp_info.c2
-rw-r--r--storage/heap/hp_open.c4
-rw-r--r--storage/heap/hp_rfirst.c6
-rw-r--r--storage/heap/hp_rkey.c8
-rw-r--r--storage/heap/hp_rlast.c6
-rw-r--r--storage/heap/hp_rnext.c6
-rw-r--r--storage/heap/hp_rprev.c6
-rw-r--r--storage/heap/hp_rrnd.c4
-rw-r--r--storage/heap/hp_rsame.c2
-rw-r--r--storage/heap/hp_scan.c2
-rw-r--r--storage/heap/hp_test1.c2
-rw-r--r--storage/heap/hp_test2.c4
-rw-r--r--storage/heap/hp_update.c4
-rw-r--r--storage/heap/hp_write.c32
-rw-r--r--storage/innobase/handler/ha_innodb.cc45
-rw-r--r--storage/innobase/handler/ha_innodb.h40
-rw-r--r--storage/myisam/ft_boolean_search.c35
-rw-r--r--storage/myisam/ft_nlq_search.c10
-rw-r--r--storage/myisam/ft_parser.c29
-rw-r--r--storage/myisam/ft_static.c4
-rw-r--r--storage/myisam/ft_stopwords.c4
-rw-r--r--storage/myisam/ft_update.c28
-rw-r--r--storage/myisam/ftdefs.h32
-rw-r--r--storage/myisam/fulltext.h6
-rw-r--r--storage/myisam/ha_myisam.cc54
-rw-r--r--storage/myisam/ha_myisam.h34
-rw-r--r--storage/myisam/mi_cache.c6
-rw-r--r--storage/myisam/mi_check.c146
-rw-r--r--storage/myisam/mi_checksum.c8
-rw-r--r--storage/myisam/mi_close.c10
-rw-r--r--storage/myisam/mi_create.c4
-rw-r--r--storage/myisam/mi_delete.c68
-rw-r--r--storage/myisam/mi_delete_all.c2
-rw-r--r--storage/myisam/mi_dynrec.c163
-rw-r--r--storage/myisam/mi_extra.c10
-rw-r--r--storage/myisam/mi_key.c56
-rw-r--r--storage/myisam/mi_locking.c2
-rw-r--r--storage/myisam/mi_log.c8
-rw-r--r--storage/myisam/mi_open.c49
-rw-r--r--storage/myisam/mi_packrec.c99
-rw-r--r--storage/myisam/mi_page.c8
-rw-r--r--storage/myisam/mi_preload.c6
-rw-r--r--storage/myisam/mi_range.c4
-rw-r--r--storage/myisam/mi_rfirst.c2
-rw-r--r--storage/myisam/mi_rkey.c2
-rw-r--r--storage/myisam/mi_rlast.c2
-rw-r--r--storage/myisam/mi_rnext.c2
-rw-r--r--storage/myisam/mi_rnext_same.c2
-rw-r--r--storage/myisam/mi_rprev.c2
-rw-r--r--storage/myisam/mi_rrnd.c2
-rw-r--r--storage/myisam/mi_rsame.c2
-rw-r--r--storage/myisam/mi_rsamepos.c2
-rw-r--r--storage/myisam/mi_scan.c2
-rw-r--r--storage/myisam/mi_search.c24
-rw-r--r--storage/myisam/mi_static.c2
-rw-r--r--storage/myisam/mi_statrec.c26
-rw-r--r--storage/myisam/mi_test1.c36
-rw-r--r--storage/myisam/mi_test2.c8
-rw-r--r--storage/myisam/mi_test3.c4
-rw-r--r--storage/myisam/mi_unique.c16
-rw-r--r--storage/myisam/mi_update.c4
-rw-r--r--storage/myisam/mi_write.c56
-rw-r--r--storage/myisam/myisam_ftdump.c2
-rw-r--r--storage/myisam/myisamchk.c92
-rw-r--r--storage/myisam/myisamdef.h117
-rw-r--r--storage/myisam/myisamlog.c60
-rw-r--r--storage/myisam/myisampack.c118
-rw-r--r--storage/myisam/rt_index.c32
-rw-r--r--storage/myisam/rt_split.c4
-rw-r--r--storage/myisam/sort.c62
-rw-r--r--storage/myisam/sp_defs.h2
-rw-r--r--storage/myisam/sp_key.c14
-rw-r--r--storage/myisammrg/ha_myisammrg.cc38
-rw-r--r--storage/myisammrg/ha_myisammrg.h28
-rw-r--r--storage/myisammrg/myrg_close.c2
-rw-r--r--storage/myisammrg/myrg_def.h2
-rw-r--r--storage/myisammrg/myrg_delete.c2
-rw-r--r--storage/myisammrg/myrg_open.c13
-rw-r--r--storage/myisammrg/myrg_queue.c4
-rw-r--r--storage/myisammrg/myrg_rfirst.c4
-rw-r--r--storage/myisammrg/myrg_rkey.c10
-rw-r--r--storage/myisammrg/myrg_rlast.c4
-rw-r--r--storage/myisammrg/myrg_rnext.c4
-rw-r--r--storage/myisammrg/myrg_rnext_same.c4
-rw-r--r--storage/myisammrg/myrg_rprev.c4
-rw-r--r--storage/myisammrg/myrg_rrnd.c12
-rw-r--r--storage/myisammrg/myrg_rsame.c2
-rw-r--r--storage/myisammrg/myrg_update.c2
-rw-r--r--storage/myisammrg/myrg_write.c2
-rw-r--r--storage/ndb/include/util/ndb_opts.h22
-rw-r--r--storage/ndb/src/cw/cpcd/main.cpp12
-rw-r--r--storage/ndb/src/kernel/vm/Configuration.cpp16
-rw-r--r--storage/ndb/src/mgmclient/main.cpp4
-rw-r--r--storage/ndb/src/mgmsrv/InitConfigFileParser.cpp36
-rw-r--r--storage/ndb/src/mgmsrv/main.cpp14
-rw-r--r--storage/ndb/src/ndbapi/NdbBlob.cpp7
-rw-r--r--storage/ndb/src/ndbapi/NdbOperationDefine.cpp1
-rw-r--r--storage/ndb/src/ndbapi/NdbOperationInt.cpp2
-rw-r--r--storage/ndb/src/ndbapi/NdbScanOperation.cpp2
-rw-r--r--storage/ndb/tools/delete_all.cpp8
-rw-r--r--storage/ndb/tools/desc.cpp8
-rw-r--r--storage/ndb/tools/drop_index.cpp2
-rw-r--r--storage/ndb/tools/drop_tab.cpp2
-rw-r--r--storage/ndb/tools/listTables.cpp12
-rw-r--r--storage/ndb/tools/ndb_config.cpp22
-rw-r--r--storage/ndb/tools/restore/consumer_restore.cpp11
-rw-r--r--storage/ndb/tools/restore/restore_main.cpp54
-rw-r--r--storage/ndb/tools/select_all.cpp26
-rw-r--r--storage/ndb/tools/select_count.cpp6
-rw-r--r--storage/ndb/tools/waiter.cpp8
-rw-r--r--strings/bchange.c6
-rw-r--r--strings/bcmp.c6
-rw-r--r--strings/bmove512.c2
-rw-r--r--strings/bmove_upp.c3
-rw-r--r--strings/ctype-big5.c55
-rw-r--r--strings/ctype-bin.c175
-rw-r--r--strings/ctype-cp932.c51
-rw-r--r--strings/ctype-czech.c36
-rw-r--r--strings/ctype-euc_kr.c13
-rw-r--r--strings/ctype-eucjpms.c27
-rw-r--r--strings/ctype-gb2312.c10
-rw-r--r--strings/ctype-gbk.c47
-rw-r--r--strings/ctype-latin1.c38
-rw-r--r--strings/ctype-mb.c92
-rw-r--r--strings/ctype-simple.c208
-rw-r--r--strings/ctype-sjis.c53
-rw-r--r--strings/ctype-tis620.c42
-rw-r--r--strings/ctype-uca.c93
-rw-r--r--strings/ctype-ucs2.c173
-rw-r--r--strings/ctype-ujis.c34
-rw-r--r--strings/ctype-utf8.c77
-rw-r--r--strings/ctype-win1250ch.c34
-rw-r--r--strings/ctype.c17
-rw-r--r--strings/decimal.c16
-rw-r--r--strings/do_ctype.c16
-rw-r--r--strings/my_strtoll10.c2
-rw-r--r--strings/my_vsnprintf.c25
-rw-r--r--strings/r_strinstr.c12
-rw-r--r--strings/str_test.c6
-rw-r--r--strings/strappend.c2
-rw-r--r--strings/strcont.c4
-rw-r--r--strings/strfill.c2
-rw-r--r--strings/strinstr.c10
-rw-r--r--strings/strlen.c8
-rw-r--r--strings/strmake.c2
-rw-r--r--strings/strnlen.c4
-rw-r--r--strings/strnmov.c2
-rw-r--r--strings/strto.c2
-rw-r--r--strings/strtod.c7
-rw-r--r--strings/strxnmov.c2
-rw-r--r--strings/xml.c55
-rw-r--r--tests/mysql_client_test.c36
-rw-r--r--tests/thread_test.c28
-rw-r--r--vio/test-ssl.c26
-rw-r--r--vio/test-sslclient.c6
-rw-r--r--vio/test-sslserver.c8
-rw-r--r--vio/vio.c4
-rw-r--r--vio/vio_priv.h4
-rw-r--r--vio/viosocket.c95
-rw-r--r--vio/viossl.c26
-rw-r--r--vio/viosslfactories.c2
-rw-r--r--vio/viotest-ssl.c26
-rw-r--r--win/README18
474 files changed, 8483 insertions, 8353 deletions
diff --git a/.bzrignore b/.bzrignore
index 70d966f9ccc..a385e4bed3f 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -2989,3 +2989,6 @@ win/vs71cache.txt
win/vs8cache.txt
zlib/*.ds?
zlib/*.vcproj
+libmysqld/ha_ndbcluster_cond.cc
+debian/defs.mk
+debian/control
diff --git a/client/completion_hash.cc b/client/completion_hash.cc
index 4c777f8a704..cd0ea17dfaf 100644
--- a/client/completion_hash.cc
+++ b/client/completion_hash.cc
@@ -213,7 +213,7 @@ void completion_hash_clean(HashTable *ht)
void completion_hash_free(HashTable *ht)
{
completion_hash_clean(ht);
- my_free((gptr) ht->arBuckets,MYF(0));
+ my_free(ht->arBuckets, MYF(0));
}
diff --git a/client/my_readline.h b/client/my_readline.h
index 47be7fa9294..3ebe24b75b8 100644
--- a/client/my_readline.h
+++ b/client/my_readline.h
@@ -28,6 +28,6 @@ typedef struct st_line_buffer
} LINE_BUFFER;
extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file);
-extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, my_string str);
+extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, char * str);
extern char *batch_readline(LINE_BUFFER *buffer);
extern void batch_readline_end(LINE_BUFFER *buffer);
diff --git a/client/mysql.cc b/client/mysql.cc
index 49d5ae4f449..202ac78dde8 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -51,7 +51,7 @@ const char *VER= "14.13";
/* Buffer to hold 'version' and 'version_comment' */
#define MAX_SERVER_VERSION_LENGTH 128
-gptr sql_alloc(unsigned size); // Don't use mysqld alloc for these
+void* sql_alloc(unsigned size); // Don't use mysqld alloc for these
void sql_element_free(void *ptr);
#include "sql_string.h"
@@ -142,7 +142,7 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
static my_bool column_types_flag;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
-static my_string opt_mysql_unix_port=0;
+static char * opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE;
static char *current_host,*current_db,*current_user=0,*opt_password=0,
*current_prompt=0, *delimiter_str= 0,
@@ -587,7 +587,7 @@ static struct my_option my_long_options[] =
#endif
{"auto-rehash", OPT_AUTO_REHASH,
"Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash.",
- (gptr*) &opt_rehash, (gptr*) &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
+ (uchar**) &opt_rehash, (uchar**) &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
0, 0},
{"no-auto-rehash", 'A',
"No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.",
@@ -595,42 +595,42 @@ static struct my_option my_long_options[] =
{"batch", 'B',
"Don't use history file. Disable interactive behavior. (Enables --silent)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory where character sets are.", (gptr*) &charsets_dir,
- (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory where character sets are.", (uchar**) &charsets_dir,
+ (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"column-type-info", OPT_COLUMN_TYPES, "Display column type information.",
- (gptr*) &column_types_flag, (gptr*) &column_types_flag,
+ (uchar**) &column_types_flag, (uchar**) &column_types_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
- (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
- {"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
- (gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
+ (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"debug-info", 'T', "Print some debug info at exit.", (gptr*) &info_flag,
- (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"database", 'D', "Database to use.", (gptr*) &current_db,
- (gptr*) &current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &info_flag,
+ (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"database", 'D', "Database to use.", (uchar**) &current_db,
+ (uchar**) &current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
- "Set the default character set.", (gptr*) &default_charset,
- (gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"delimiter", OPT_DELIMITER, "Delimiter to be used.", (gptr*) &delimiter_str,
- (gptr*) &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Set the default character set.", (uchar**) &default_charset,
+ (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"delimiter", OPT_DELIMITER, "Delimiter to be used.", (uchar**) &delimiter_str,
+ (uchar**) &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"execute", 'e', "Execute command and quit. (Disables --force and history file)", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"vertical", 'E', "Print the output of a query (rows) vertically.",
- (gptr*) &vertical, (gptr*) &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+ (uchar**) &vertical, (uchar**) &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"force", 'f', "Continue even if we get an sql error.",
- (gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
+ (uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"named-commands", 'G',
"Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.",
- (gptr*) &named_cmds, (gptr*) &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &named_cmds, (uchar**) &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"no-named-commands", 'g',
"Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead.",
@@ -638,25 +638,25 @@ static struct my_option my_long_options[] =
{"ignore-spaces", 'i', "Ignore space after function names.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
- (gptr*) &opt_local_infile,
- (gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"no-beep", 'b', "Turn off beep on error.", (gptr*) &opt_nobeep,
- (gptr*) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host.", (gptr*) &current_host,
- (gptr*) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"html", 'H', "Produce HTML output.", (gptr*) &opt_html, (gptr*) &opt_html,
+ (uchar**) &opt_local_infile,
+ (uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"no-beep", 'b', "Turn off beep on error.", (uchar**) &opt_nobeep,
+ (uchar**) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"host", 'h', "Connect to host.", (uchar**) &current_host,
+ (uchar**) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"html", 'H', "Produce HTML output.", (uchar**) &opt_html, (uchar**) &opt_html,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"xml", 'X', "Produce XML output", (gptr*) &opt_xml, (gptr*) &opt_xml, 0,
+ {"xml", 'X', "Produce XML output", (uchar**) &opt_xml, (uchar**) &opt_xml, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"line-numbers", OPT_LINE_NUMBERS, "Write line numbers for errors.",
- (gptr*) &line_numbers, (gptr*) &line_numbers, 0, GET_BOOL,
+ (uchar**) &line_numbers, (uchar**) &line_numbers, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"unbuffered", 'n', "Flush buffer after each query.", (gptr*) &unbuffered,
- (gptr*) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"unbuffered", 'n', "Flush buffer after each query.", (uchar**) &unbuffered,
+ (uchar**) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"column-names", OPT_COLUMN_NAMES, "Write column names in results.",
- (gptr*) &column_names, (gptr*) &column_names, 0, GET_BOOL,
+ (uchar**) &column_names, (uchar**) &column_names, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-column-names", 'N',
"Don't write column names in results. WARNING: -N is deprecated, use long version of this options instead.",
@@ -665,7 +665,7 @@ static struct my_option my_long_options[] =
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"sigint-ignore", OPT_SIGINT_IGNORE, "Ignore SIGINT (CTRL-C)",
- (gptr*) &opt_sigint_ignore, (gptr*) &opt_sigint_ignore, 0, GET_BOOL,
+ (uchar**) &opt_sigint_ignore, (uchar**) &opt_sigint_ignore, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"one-database", 'o',
"Only update the default database. This is useful for skipping updates to other database in the update log.",
@@ -685,49 +685,49 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
- (gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
+ {"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
+ (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
{"prompt", OPT_PROMPT, "Set the mysql prompt to this value.",
- (gptr*) &current_prompt, (gptr*) &current_prompt, 0, GET_STR_ALLOC,
+ (uchar**) &current_prompt, (uchar**) &current_prompt, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"quick", 'q',
"Don't cache result, print it row by row. This may slow down the server if the output is suspended. Doesn't use history file.",
- (gptr*) &quick, (gptr*) &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &quick, (uchar**) &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"raw", 'r', "Write fields without conversion. Used with --batch.",
- (gptr*) &opt_raw_data, (gptr*) &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_raw_data, (uchar**) &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"reconnect", OPT_RECONNECT, "Reconnect if the connection is lost. Disable with --disable-reconnect. This option is enabled by default.",
- (gptr*) &opt_reconnect, (gptr*) &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ (uchar**) &opt_reconnect, (uchar**) &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"silent", 's', "Be more silent. Print results with a tab as separator, each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
+ "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"socket", 'S', "Socket file to use for connection.",
- (gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR_ALLOC,
+ (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include "sslopt-longopts.h"
- {"table", 't', "Output in table format.", (gptr*) &output_tables,
- (gptr*) &output_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"table", 't', "Output in table format.", (uchar**) &output_tables,
+ (uchar**) &output_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"tee", OPT_TEE,
"Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode. Disable with --disable-tee. This option is disabled by default.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: option deprecated; use --disable-tee instead", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user.", (gptr*) &current_user,
- (gptr*) &current_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user.", (uchar**) &current_user,
+ (uchar**) &current_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"safe-updates", 'U', "Only allow UPDATE and DELETE that uses keys.",
- (gptr*) &safe_updates, (gptr*) &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
+ (uchar**) &safe_updates, (uchar**) &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"i-am-a-dummy", 'U', "Synonym for option --safe-updates, -U.",
- (gptr*) &safe_updates, (gptr*) &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
+ (uchar**) &safe_updates, (uchar**) &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"verbose", 'v', "Write more. (-v -v -v gives the table output format).", 0,
0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -737,32 +737,32 @@ static struct my_option my_long_options[] =
NO_ARG, 0, 0, 0, 0, 0, 0},
{"connect_timeout", OPT_CONNECT_TIMEOUT,
"Number of seconds before connection timeout.",
- (gptr*) &opt_connect_timeout,
- (gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
+ (uchar**) &opt_connect_timeout,
+ (uchar**) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
0, 1},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
"Max packet length to send to, or receive from server",
- (gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0, GET_ULONG,
+ (uchar**) &opt_max_allowed_packet, (uchar**) &opt_max_allowed_packet, 0, GET_ULONG,
REQUIRED_ARG, 16 *1024L*1024L, 4096, (longlong) 2*1024L*1024L*1024L,
MALLOC_OVERHEAD, 1024, 0},
{"net_buffer_length", OPT_NET_BUFFER_LENGTH,
"Buffer for TCP/IP and socket communication",
- (gptr*) &opt_net_buffer_length, (gptr*) &opt_net_buffer_length, 0, GET_ULONG,
+ (uchar**) &opt_net_buffer_length, (uchar**) &opt_net_buffer_length, 0, GET_ULONG,
REQUIRED_ARG, 16384, 1024, 512*1024*1024L, MALLOC_OVERHEAD, 1024, 0},
{"select_limit", OPT_SELECT_LIMIT,
"Automatic limit for SELECT when using --safe-updates",
- (gptr*) &select_limit,
- (gptr*) &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ~0L, 0, 1, 0},
+ (uchar**) &select_limit,
+ (uchar**) &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ~0L, 0, 1, 0},
{"max_join_size", OPT_MAX_JOIN_SIZE,
"Automatic limit for rows in a join when using --safe-updates",
- (gptr*) &max_join_size,
- (gptr*) &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L, 1, ~0L, 0, 1,
+ (uchar**) &max_join_size,
+ (uchar**) &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L, 1, ~0L, 0, 1,
0},
{"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it"
- " uses old (pre-4.1.1) protocol", (gptr*) &opt_secure_auth,
- (gptr*) &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ " uses old (pre-4.1.1) protocol", (uchar**) &opt_secure_auth,
+ (uchar**) &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"show-warnings", OPT_SHOW_WARNINGS, "Show warnings after every statement.",
- (gptr*) &show_warnings, (gptr*) &show_warnings, 0, GET_BOOL, NO_ARG,
+ (uchar**) &show_warnings, (uchar**) &show_warnings, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -1079,7 +1079,7 @@ static int read_and_execute(bool interactive)
tmpbuf.alloc(65535);
tmpbuf.length(0);
buffer.length(0);
- unsigned long clen;
+ size_t clen;
do
{
line= my_cgets((char*)tmpbuf.ptr(), tmpbuf.alloced_length()-1, &clen);
@@ -2443,7 +2443,7 @@ print_table_data(MYSQL_RES *result)
(void) tee_fputs("\n", PAGER);
}
tee_puts((char*) separator.ptr(), PAGER);
- my_afree((gptr) num_flag);
+ my_afree((uchar*) num_flag);
}
@@ -2842,10 +2842,10 @@ com_edit(String *buffer,char *line __attribute__((unused)))
MYF(MY_WME))) < 0)
goto err;
if (buffer->is_empty() && !old_buffer.is_empty())
- (void) my_write(fd,(byte*) old_buffer.ptr(),old_buffer.length(),
+ (void) my_write(fd,(uchar*) old_buffer.ptr(),old_buffer.length(),
MYF(MY_WME));
else
- (void) my_write(fd,(byte*) buffer->ptr(),buffer->length(),MYF(MY_WME));
+ (void) my_write(fd,(uchar*) buffer->ptr(),buffer->length(),MYF(MY_WME));
(void) my_close(fd,MYF(0));
if (!(editor = (char *)getenv("EDITOR")) &&
@@ -3893,13 +3893,13 @@ static int com_prompt(String *buffer, char *line)
#ifndef EMBEDDED_LIBRARY
/* Keep sql_string library happy */
-gptr sql_alloc(unsigned int Size)
+void *sql_alloc(size_t Size)
{
return my_malloc(Size,MYF(MY_WME));
}
void sql_element_free(void *ptr)
{
- my_free((gptr) ptr,MYF(0));
+ my_free(ptr,MYF(0));
}
#endif /* EMBEDDED_LIBRARY */
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 64de3d19882..504b4c95a8b 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -63,8 +63,8 @@ static struct my_option my_long_options[]=
{"debug", '#', "This is a non-debug version. Catch this and exit",
0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
- {"debug", '#', "Output debug log", (gptr *) & default_dbug_option,
- (gptr *) & default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log", (uchar* *) & default_dbug_option,
+ (uchar* *) & default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", 0,
@@ -73,16 +73,16 @@ static struct my_option my_long_options[]=
"Directory where character sets are.", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compress", OPT_COMPRESS, "Use compression in server/client protocol.",
- (gptr*)&not_used, (gptr*)&not_used, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**)&not_used, (uchar**)&not_used, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f', "Force execution of mysqlcheck even if mysql_upgrade "
"has already been executed for the current version of MySQL.",
- (gptr*)&opt_force, (gptr*)&opt_force, 0,
+ (uchar**)&opt_force, (uchar**)&opt_force, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host",'h', "Connect to host.", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given"
- " it's solicited on the tty.", (gptr*) &opt_password,(gptr*) &opt_password,
+ " it's solicited on the tty.", (uchar**) &opt_password,(uchar**) &opt_password,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __WIN__
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0,
@@ -100,11 +100,11 @@ static struct my_option my_long_options[]=
#endif
{"socket", 'S', "Socket file to use for connection.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"user", 'u', "User for login if not current user.", (gptr*) &opt_user,
- (gptr*) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user.", (uchar**) &opt_user,
+ (uchar**) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
{"verbose", 'v', "Display more output about the process",
- (gptr*) &opt_verbose, (gptr*) &opt_verbose, 0,
+ (uchar**) &opt_verbose, (uchar**) &opt_verbose, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -387,13 +387,14 @@ static void find_tool(char *tool_path, const char *tool_name)
}
do
{
+ size_t path_len;
DBUG_PRINT("enter", ("path: %s", path));
/* Chop off last char(since it might be a /) */
path[max((strlen(path)-1), 0)]= 0;
/* Chop off last dir part */
- dirname_part(path, path);
+ dirname_part(path, path, &path_len);
/* Format name of the tool to search for */
fn_format(tool_path, tool_name,
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index 03b37f2ba3a..f6ff44c7d56 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -44,7 +44,7 @@ static my_bool option_force=0,interrupted=0,new_line=0,
static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations,
opt_count_iterations= 0;
static ulong opt_connect_timeout, opt_shutdown_timeout;
-static my_string unix_port=0;
+static char * unix_port=0;
#ifdef LATER_HAVE_NDBCLUSTER_DB
static my_bool opt_ndbcluster=0;
static char *opt_ndb_connectstring=0;
@@ -132,31 +132,31 @@ static struct my_option my_long_options[] =
#endif
{"count", 'c',
"Number of iterations to make. This works with -i (--sleep) only.",
- (gptr*) &nr_iterations, (gptr*) &nr_iterations, 0, GET_UINT,
+ (uchar**) &nr_iterations, (uchar**) &nr_iterations, 0, GET_UINT,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
- (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
+ (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f',
"Don't ask for confirmation on drop database; with multiple commands, continue even if an error occurs.",
- (gptr*) &option_force, (gptr*) &option_force, 0, GET_BOOL, NO_ARG, 0, 0,
+ (uchar**) &option_force, (uchar**) &option_force, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
- (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory where character sets are.", (gptr*) &charsets_dir,
- (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory where character sets are.", (uchar**) &charsets_dir,
+ (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
- "Set the default character set.", (gptr*) &default_charset,
- (gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Set the default character set.", (uchar**) &default_charset,
+ (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR,
+ {"host", 'h', "Connect to host.", (uchar**) &host, (uchar**) &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"no-beep", 'b', "Turn off beep on error.", (gptr*) &opt_nobeep,
- (gptr*) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"no-beep", 'b', "Turn off beep on error.", (uchar**) &opt_nobeep,
+ (uchar**) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -164,58 +164,58 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"port", 'P', "Port number to use for connection.", (gptr*) &tcp_port,
- (gptr*) &tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"port", 'P', "Port number to use for connection.", (uchar**) &tcp_port,
+ (uchar**) &tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"relative", 'r',
"Show difference between current and previous values when used with -i. Currently works only with extended-status.",
- (gptr*) &opt_relative, (gptr*) &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_relative, (uchar**) &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
+ "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Silently exit if one can't connect to server.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
- (gptr*) &unix_port, (gptr*) &unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ (uchar**) &unix_port, (uchar**) &unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"sleep", 'i', "Execute commands again and again with a sleep between.",
- (gptr*) &interval, (gptr*) &interval, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0,
+ (uchar**) &interval, (uchar**) &interval, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
#include <sslopt-longopts.h>
#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user.", (gptr*) &user,
- (gptr*) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user.", (uchar**) &user,
+ (uchar**) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"verbose", 'v', "Write more information.", (gptr*) &opt_verbose,
- (gptr*) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"verbose", 'v', "Write more information.", (uchar**) &opt_verbose,
+ (uchar**) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"vertical", 'E',
"Print output vertically. Is similar to --relative, but prints output vertically.",
- (gptr*) &opt_vertical, (gptr*) &opt_vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_vertical, (uchar**) &opt_vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"wait", 'w', "Wait and retry if connection is down.", 0, 0, 0, GET_UINT,
OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"connect_timeout", OPT_CONNECT_TIMEOUT, "", (gptr*) &opt_connect_timeout,
- (gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 3600*12, 0,
+ {"connect_timeout", OPT_CONNECT_TIMEOUT, "", (uchar**) &opt_connect_timeout,
+ (uchar**) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 3600*12, 0,
3600*12, 0, 1, 0},
- {"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", (gptr*) &opt_shutdown_timeout,
- (gptr*) &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG,
+ {"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", (uchar**) &opt_shutdown_timeout,
+ (uchar**) &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG,
SHUTDOWN_DEF_TIMEOUT, 0, 3600*12, 0, 1, 0},
#ifdef LATER_HAVE_NDBCLUSTER_DB
{"ndbcluster", OPT_NDBCLUSTER, ""
- "", (gptr*) &opt_ndbcluster,
- (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ "", (uchar**) &opt_ndbcluster,
+ (uchar**) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"ndb-connectstring", OPT_NDB_CONNECTSTRING, ""
- "", (gptr*) &opt_ndb_connectstring,
- (gptr*) &opt_ndb_connectstring, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "", (uchar**) &opt_ndb_connectstring,
+ (uchar**) &opt_ndb_connectstring, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 033c55707fc..7df13da6cd8 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -296,7 +296,7 @@ File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le,
int Load_log_processor::load_old_format_file(NET* net, const char*server_fname,
uint server_fname_len, File file)
{
- char buf[FN_REFLEN+1];
+ uchar buf[FN_REFLEN+1];
buf[0] = 0;
memcpy(buf + 1, server_fname, server_fname_len + 1);
if (my_net_write(net, buf, server_fname_len +2) || net_flush(net))
@@ -310,7 +310,7 @@ int Load_log_processor::load_old_format_file(NET* net, const char*server_fname,
ulong packet_len = my_net_read(net);
if (packet_len == 0)
{
- if (my_net_write(net, "", 0) || net_flush(net))
+ if (my_net_write(net, (uchar*) "", 0) || net_flush(net))
{
sql_print_error("Failed sending the ack packet");
return -1;
@@ -334,7 +334,7 @@ int Load_log_processor::load_old_format_file(NET* net, const char*server_fname,
sql_print_error("Illegal length of packet read from net");
return -1;
}
- if (my_write(file, (byte*) net->read_pos,
+ if (my_write(file, (uchar*) net->read_pos,
(uint) packet_len, MYF(MY_WME|MY_NABP)))
return -1;
}
@@ -379,7 +379,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
File_name_record rec;
DBUG_ENTER("Load_log_processor::process_first_event");
- if (!(fname= my_malloc(full_len,MYF(MY_WME))))
+ if (!(fname= (char*) my_malloc(full_len,MYF(MY_WME))))
DBUG_RETURN(-1);
memcpy(fname, target_dir_name, target_dir_name_len);
@@ -398,7 +398,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
rec.fname= fname;
rec.event= ce;
- if (set_dynamic(&file_names, (gptr)&rec, file_id))
+ if (set_dynamic(&file_names, (uchar*)&rec, file_id))
{
sql_print_error("Could not construct local filename %s%s",
target_dir_name, bname);
@@ -408,7 +408,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
if (ce)
ce->set_fname_outside_temp_buf(fname, strlen(fname));
- if (my_write(file, (byte*)block, block_len, MYF(MY_WME|MY_NABP)))
+ if (my_write(file, (uchar*)block, block_len, MYF(MY_WME|MY_NABP)))
error= -1;
if (my_close(file, MYF(MY_WME)))
error= -1;
@@ -447,7 +447,7 @@ int Load_log_processor::process(Append_block_log_event *ae)
if (((file= my_open(fname,
O_APPEND|O_BINARY|O_WRONLY,MYF(MY_WME))) < 0))
DBUG_RETURN(-1);
- if (my_write(file,(byte*)ae->block,ae->block_len,MYF(MY_WME|MY_NABP)))
+ if (my_write(file,(uchar*)ae->block,ae->block_len,MYF(MY_WME|MY_NABP)))
error= -1;
if (my_close(file,MYF(MY_WME)))
error= -1;
@@ -700,7 +700,7 @@ static struct my_option my_long_options[] =
"Print all binlog entries using base64 encoding. "
"This is for debugging only. Logs produced using this option "
"should not be applied on production systems.",
- (gptr*) &opt_base64_output, (gptr*) &opt_base64_output, 0, GET_BOOL,
+ (uchar**) &opt_base64_output, (uchar**) &opt_base64_output, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
/*
mysqlbinlog needs charsets knowledge, to be able to convert a charset
@@ -709,47 +709,47 @@ static struct my_option my_long_options[] =
SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`;
*/
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory where character sets are.", (gptr*) &charsets_dir,
- (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory where character sets are.", (uchar**) &charsets_dir,
+ (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'd', "List entries for just this database (local log only).",
- (gptr*) &database, (gptr*) &database, 0, GET_STR_ALLOC, REQUIRED_ARG,
+ (uchar**) &database, (uchar**) &database, 0, GET_STR_ALLOC, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#ifndef DBUG_OFF
- {"debug", '#', "Output debug log.", (gptr*) &default_dbug_option,
- (gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log.", (uchar**) &default_dbug_option,
+ (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
- (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
+ (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"disable-log-bin", 'D', "Disable binary log. This is useful, if you "
"enabled --to-last-log and are sending the output to the same MySQL server. "
"This way you could avoid an endless loop. You would also like to use it "
"when restoring after a crash to avoid duplication of the statements you "
"already have. NOTE: you will need a SUPER privilege to use this option.",
- (gptr*) &disable_log_bin, (gptr*) &disable_log_bin, 0, GET_BOOL,
+ (uchar**) &disable_log_bin, (uchar**) &disable_log_bin, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"force-if-open", 'F', "Force if binlog was not closed properly.",
- (gptr*) &force_if_open_opt, (gptr*) &force_if_open_opt, 0, GET_BOOL, NO_ARG,
+ (uchar**) &force_if_open_opt, (uchar**) &force_if_open_opt, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"force-read", 'f', "Force reading unknown binlog events.",
- (gptr*) &force_opt, (gptr*) &force_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &force_opt, (uchar**) &force_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"hexdump", 'H', "Augment output with hexadecimal and ASCII event dump.",
- (gptr*) &opt_hexdump, (gptr*) &opt_hexdump, 0, GET_BOOL, NO_ARG,
+ (uchar**) &opt_hexdump, (uchar**) &opt_hexdump, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"host", 'h', "Get the binlog from server.", (gptr*) &host, (gptr*) &host,
+ {"host", 'h', "Get the binlog from server.", (uchar**) &host, (uchar**) &host,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"local-load", 'l', "Prepare local temporary files for LOAD DATA INFILE in the specified directory.",
- (gptr*) &dirname_for_local_load, (gptr*) &dirname_for_local_load, 0,
+ (uchar**) &dirname_for_local_load, (uchar**) &dirname_for_local_load, 0,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"offset", 'o', "Skip the first N entries.", (gptr*) &offset, (gptr*) &offset,
+ {"offset", 'o', "Skip the first N entries.", (uchar**) &offset, (uchar**) &offset,
0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p', "Password to connect to remote server.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Use port to connect to the remote server.",
- (gptr*) &port, (gptr*) &port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
+ (uchar**) &port, (uchar**) &port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"position", 'j', "Deprecated. Use --start-position instead.",
- (gptr*) &start_position, (gptr*) &start_position, 0, GET_ULL,
+ (uchar**) &start_position, (uchar**) &start_position, 0, GET_ULL,
REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE,
/* COM_BINLOG_DUMP accepts only 4 bytes for the position */
(ulonglong)(~(uint32)0), 0, 0, 0},
@@ -757,22 +757,22 @@ static struct my_option my_long_options[] =
"The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"read-from-remote-server", 'R', "Read binary logs from a MySQL server",
- (gptr*) &remote_opt, (gptr*) &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &remote_opt, (uchar**) &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"result-file", 'r', "Direct output to a given file.", 0, 0, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-id", OPT_SERVER_ID,
"Extract only binlog entries created by the server having the given id.",
- (gptr*) &server_id, (gptr*) &server_id, 0, GET_ULONG,
+ (uchar**) &server_id, (uchar**) &server_id, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"set-charset", OPT_SET_CHARSET,
- "Add 'SET NAMES character_set' to the output.", (gptr*) &charset,
- (gptr*) &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Add 'SET NAMES character_set' to the output.", (uchar**) &charset,
+ (uchar**) &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"short-form", 's', "Just show the queries, no extra info.",
- (gptr*) &short_form, (gptr*) &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &short_form, (uchar**) &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"socket", 'S', "Socket file to use for connection.",
- (gptr*) &sock, (gptr*) &sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
+ (uchar**) &sock, (uchar**) &sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"start-datetime", OPT_START_DATETIME,
"Start reading the binlog at first event having a datetime equal or "
@@ -780,12 +780,12 @@ static struct my_option my_long_options[] =
"in the local time zone, in any format accepted by the MySQL server "
"for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
"(you should probably use quotes for your shell to set it properly).",
- (gptr*) &start_datetime_str, (gptr*) &start_datetime_str,
+ (uchar**) &start_datetime_str, (uchar**) &start_datetime_str,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"start-position", OPT_START_POSITION,
"Start reading the binlog at position N. Applies to the first binlog "
"passed on the command line.",
- (gptr*) &start_position, (gptr*) &start_position, 0, GET_ULL,
+ (uchar**) &start_position, (uchar**) &start_position, 0, GET_ULL,
REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE,
/* COM_BINLOG_DUMP accepts only 4 bytes for the position */
(ulonglong)(~(uint32)0), 0, 0, 0},
@@ -795,28 +795,28 @@ static struct my_option my_long_options[] =
"in the local time zone, in any format accepted by the MySQL server "
"for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
"(you should probably use quotes for your shell to set it properly).",
- (gptr*) &stop_datetime_str, (gptr*) &stop_datetime_str,
+ (uchar**) &stop_datetime_str, (uchar**) &stop_datetime_str,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"stop-position", OPT_STOP_POSITION,
"Stop reading the binlog at position N. Applies to the last binlog "
"passed on the command line.",
- (gptr*) &stop_position, (gptr*) &stop_position, 0, GET_ULL,
+ (uchar**) &stop_position, (uchar**) &stop_position, 0, GET_ULL,
REQUIRED_ARG, (ulonglong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
(ulonglong)(~(my_off_t)0), 0, 0, 0},
{"to-last-log", 't', "Requires -R. Will not stop at the end of the \
requested binlog but rather continue printing until the end of the last \
binlog of the MySQL server. If you send the output to the same MySQL server, \
that may lead to an endless loop.",
- (gptr*) &to_last_remote_log, (gptr*) &to_last_remote_log, 0, GET_BOOL,
+ (uchar**) &to_last_remote_log, (uchar**) &to_last_remote_log, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "Connect to the remote server as username.",
- (gptr*) &user, (gptr*) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0,
+ (uchar**) &user, (uchar**) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
{"open_files_limit", OPT_OPEN_FILES_LIMIT,
"Used to reserve file descriptors for usage by this program",
- (gptr*) &open_files_limit, (gptr*) &open_files_limit, 0, GET_ULONG,
+ (uchar**) &open_files_limit, (uchar**) &open_files_limit, 0, GET_ULONG,
REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -1094,7 +1094,7 @@ static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
const char* logname)
{
- char buf[128];
+ uchar buf[128];
ulong len;
uint logname_len;
NET* net;
@@ -1130,7 +1130,7 @@ could be out of memory");
int4store(buf, (uint32)start_position);
int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
- size_s tlen = strlen(logname);
+ size_t tlen = strlen(logname);
if (tlen > UINT_MAX)
{
fprintf(stderr,"Log name too long\n");
@@ -1278,8 +1278,8 @@ err:
static void check_header(IO_CACHE* file,
Format_description_log_event **description_event)
{
- byte header[BIN_LOG_HEADER_SIZE];
- byte buf[PROBE_HEADER_LEN];
+ uchar header[BIN_LOG_HEADER_SIZE];
+ uchar buf[PROBE_HEADER_LEN];
my_off_t tmp_pos, pos;
*description_event= new Format_description_log_event(3);
@@ -1379,7 +1379,7 @@ static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
{
File fd = -1;
IO_CACHE cache,*file= &cache;
- byte tmp_buff[BIN_LOG_HEADER_SIZE];
+ uchar tmp_buff[BIN_LOG_HEADER_SIZE];
int error= 0;
if (logname && logname[0] != '-')
@@ -1418,7 +1418,7 @@ static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
if (start_position)
{
/* skip 'start_position' characters from stdin */
- byte buff[IO_SIZE];
+ uchar buff[IO_SIZE];
my_off_t length,tmp;
for (length= start_position_mot ; length > 0 ; length-=tmp)
{
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 43a938badbe..372dfe860df 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -37,7 +37,7 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0,
opt_write_binlog= 1;
static uint verbose = 0, opt_mysql_port=0;
-static my_string opt_mysql_unix_port = 0;
+static char * opt_mysql_unix_port = 0;
static char *opt_password = 0, *current_user = 0,
*default_charset = (char *)MYSQL_DEFAULT_CHARSET_NAME,
*current_host = 0;
@@ -55,13 +55,13 @@ static struct my_option my_long_options[] =
{
{"all-databases", 'A',
"Check all the databases. This will be same as --databases with all databases selected.",
- (gptr*) &opt_alldbs, (gptr*) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &opt_alldbs, (uchar**) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"analyze", 'a', "Analyze given tables.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
{"all-in-1", '1',
"Instead of issuing one query for each table, use one query per database, naming all tables in the database in a comma-separated list.",
- (gptr*) &opt_all_in_1, (gptr*) &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_all_in_1, (uchar**) &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
#ifdef __NETWARE__
{"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.",
@@ -69,11 +69,11 @@ static struct my_option my_long_options[] =
#endif
{"auto-repair", OPT_AUTO_REPAIR,
"If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been checked, if corrupted ones were found.",
- (gptr*) &opt_auto_repair, (gptr*) &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0,
+ (uchar**) &opt_auto_repair, (uchar**) &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0,
0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory where character sets are.", (gptr*) &charsets_dir,
- (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory where character sets are.", (uchar**) &charsets_dir,
+ (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"check", 'c', "Check table for errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
{"check-only-changed", 'C',
@@ -83,11 +83,11 @@ static struct my_option my_long_options[] =
"Check tables for version-dependent changes. May be used with --auto-repair to correct tables requiring version-dependent updates.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", OPT_COMPRESS, "Use compression in server/client protocol.",
- (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"databases", 'B',
"To check several databases. Note the difference in usage; In this case no tables are given. All name arguments are regarded as databasenames.",
- (gptr*) &opt_databases, (gptr*) &opt_databases, 0, GET_BOOL, NO_ARG,
+ (uchar**) &opt_databases, (uchar**) &opt_databases, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit.",
@@ -96,37 +96,37 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
- (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
+ (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
- "Set the default character set.", (gptr*) &default_charset,
- (gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Set the default character set.", (uchar**) &default_charset,
+ (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fast",'F', "Check only tables that haven't been closed properly.",
- (gptr*) &opt_fast, (gptr*) &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+ (uchar**) &opt_fast, (uchar**) &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"fix-db-names", OPT_FIX_DB_NAMES, "Fix database names.",
- (gptr*) &opt_fix_db_names, (gptr*) &opt_fix_db_names,
+ (uchar**) &opt_fix_db_names, (uchar**) &opt_fix_db_names,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"fix-table-names", OPT_FIX_TABLE_NAMES, "Fix table names.",
- (gptr*) &opt_fix_table_names, (gptr*) &opt_fix_table_names,
+ (uchar**) &opt_fix_table_names, (uchar**) &opt_fix_table_names,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f', "Continue even if we get an sql-error.",
- (gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
+ (uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"extended", 'e',
"If you are using this option with CHECK TABLE, it will ensure that the table is 100 percent consistent, but will take a long time. If you are using this option with REPAIR TABLE, it will force using old slow repair with keycache method, instead of much faster repair by sorting.",
- (gptr*) &opt_extended, (gptr*) &opt_extended, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_extended, (uchar**) &opt_extended, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"host",'h', "Connect to host.", (gptr*) &current_host,
- (gptr*) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"host",'h', "Connect to host.", (uchar**) &current_host,
+ (uchar**) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"medium-check", 'm',
"Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"write-binlog", OPT_WRITE_BINLOG,
"Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Enabled by default; use --skip-write-binlog when commands should not be sent to replication slaves.",
- (gptr*) &opt_write_binlog, (gptr*) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
+ (uchar**) &opt_write_binlog, (uchar**) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"optimize", 'o', "Optimize table.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
0, 0},
@@ -137,38 +137,38 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
- (gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
+ {"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
+ (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"quick", 'q',
"If you are using this option with CHECK TABLE, it prevents the check from scanning the rows to check for wrong links. This is the fastest check. If you are using this option with REPAIR TABLE, it will try to repair only the index tree. This is the fastest repair method for a table.",
- (gptr*) &opt_quick, (gptr*) &opt_quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+ (uchar**) &opt_quick, (uchar**) &opt_quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"repair", 'r',
"Can fix almost anything except unique keys that aren't unique.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
+ "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"silent", 's', "Print only error messages.", (gptr*) &opt_silent,
- (gptr*) &opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"silent", 's', "Print only error messages.", (uchar**) &opt_silent,
+ (uchar**) &opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
- (gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
+ (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
{"tables", OPT_TABLES, "Overrides option --databases (-B).", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"use-frm", OPT_FRM,
"When used with REPAIR, get table structure from .frm file, so the table can be repaired even if .MYI header is corrupted.",
- (gptr*) &opt_frm, (gptr*) &opt_frm, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+ (uchar**) &opt_frm, (uchar**) &opt_frm, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user.", (gptr*) &current_user,
- (gptr*) &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user.", (uchar**) &current_user,
+ (uchar**) &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v', "Print info about the various stages.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/client/mysqldump.c b/client/mysqldump.c
index afefa467cce..773c4c5c8a6 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -117,7 +117,7 @@ static ulong opt_compatible_mode= 0;
#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
#define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
static uint opt_mysql_port= 0, opt_master_data;
-static my_string opt_mysql_unix_port=0;
+static char * opt_mysql_unix_port=0;
static int first_error=0;
static DYNAMIC_STRING extended_row;
#include <sslopt-vars.h>
@@ -177,106 +177,106 @@ HASH ignore_table;
static struct my_option my_long_options[] =
{
{"all", 'a', "Deprecated. Use --create-options instead.",
- (gptr*) &create_options, (gptr*) &create_options, 0, GET_BOOL, NO_ARG, 1,
+ (uchar**) &create_options, (uchar**) &create_options, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"all-databases", 'A',
"Dump all the databases. This will be same as --databases with all databases selected.",
- (gptr*) &opt_alldbs, (gptr*) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &opt_alldbs, (uchar**) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"all-tablespaces", 'Y',
"Dump all the tablespaces.",
- (gptr*) &opt_alltspcs, (gptr*) &opt_alltspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &opt_alltspcs, (uchar**) &opt_alltspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"no-tablespaces", 'y',
"Do not dump any tablespace information.",
- (gptr*) &opt_notspcs, (gptr*) &opt_notspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &opt_notspcs, (uchar**) &opt_notspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"add-drop-database", OPT_DROP_DATABASE, "Add a 'DROP DATABASE' before each create.",
- (gptr*) &opt_drop_database, (gptr*) &opt_drop_database, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+ (uchar**) &opt_drop_database, (uchar**) &opt_drop_database, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"add-drop-table", OPT_DROP, "Add a 'drop table' before each create.",
- (gptr*) &opt_drop, (gptr*) &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
+ (uchar**) &opt_drop, (uchar**) &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
0},
{"add-locks", OPT_LOCKS, "Add locks around insert statements.",
- (gptr*) &opt_lock, (gptr*) &opt_lock, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
+ (uchar**) &opt_lock, (uchar**) &opt_lock, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
0},
{"allow-keywords", OPT_KEYWORDS,
- "Allow creation of column names that are keywords.", (gptr*) &opt_keywords,
- (gptr*) &opt_keywords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ "Allow creation of column names that are keywords.", (uchar**) &opt_keywords,
+ (uchar**) &opt_keywords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NETWARE__
{"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory where character sets are.", (gptr*) &charsets_dir,
- (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory where character sets are.", (uchar**) &charsets_dir,
+ (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"comments", 'i', "Write additional information.",
- (gptr*) &opt_comments, (gptr*) &opt_comments, 0, GET_BOOL, NO_ARG,
+ (uchar**) &opt_comments, (uchar**) &opt_comments, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"compatible", OPT_COMPATIBLE,
"Change the dump to be compatible with a given mode. By default tables are dumped in a format optimized for MySQL. Legal modes are: ansi, mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, no_table_options, no_field_options. One can use several modes separated by commas. Note: Requires MySQL server version 4.1.0 or higher. This option is ignored with earlier server versions.",
- (gptr*) &opt_compatible_mode_str, (gptr*) &opt_compatible_mode_str, 0,
+ (uchar**) &opt_compatible_mode_str, (uchar**) &opt_compatible_mode_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compact", OPT_COMPACT,
"Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs. Enables options --skip-add-drop-table --no-set-names --skip-disable-keys --skip-add-locks",
- (gptr*) &opt_compact, (gptr*) &opt_compact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &opt_compact, (uchar**) &opt_compact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"complete-insert", 'c', "Use complete insert statements.",
- (gptr*) &opt_complete_insert, (gptr*) &opt_complete_insert, 0, GET_BOOL,
+ (uchar**) &opt_complete_insert, (uchar**) &opt_complete_insert, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
- (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"create-options", OPT_CREATE_OPTIONS,
"Include all MySQL specific create options.",
- (gptr*) &create_options, (gptr*) &create_options, 0, GET_BOOL, NO_ARG, 1,
+ (uchar**) &create_options, (uchar**) &create_options, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"databases", 'B',
"To dump several databases. Note the difference in usage; In this case no tables are given. All name arguments are regarded as databasenames. 'USE db_name;' will be included in the output.",
- (gptr*) &opt_databases, (gptr*) &opt_databases, 0, GET_BOOL, NO_ARG, 0, 0,
+ (uchar**) &opt_databases, (uchar**) &opt_databases, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
- {"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
- (gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
+ (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
- (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
+ (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
- "Set the default character set.", (gptr*) &default_charset,
- (gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Set the default character set.", (uchar**) &default_charset,
+ (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delayed-insert", OPT_DELAYED, "Insert rows with INSERT DELAYED; ",
- (gptr*) &opt_delayed, (gptr*) &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &opt_delayed, (uchar**) &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"delete-master-logs", OPT_DELETE_MASTER_LOGS,
"Delete logs on master after backup. This automatically enables --master-data.",
- (gptr*) &opt_delete_master_logs, (gptr*) &opt_delete_master_logs, 0,
+ (uchar**) &opt_delete_master_logs, (uchar**) &opt_delete_master_logs, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"disable-keys", 'K',
- "'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put in the output.", (gptr*) &opt_disable_keys,
- (gptr*) &opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ "'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put in the output.", (uchar**) &opt_disable_keys,
+ (uchar**) &opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"events", 'E', "Dump events.",
- (gptr*) &opt_events, (gptr*) &opt_events, 0, GET_BOOL,
+ (uchar**) &opt_events, (uchar**) &opt_events, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"extended-insert", 'e',
"Allows utilization of the new, much faster INSERT syntax.",
- (gptr*) &extended_insert, (gptr*) &extended_insert, 0, GET_BOOL, NO_ARG,
+ (uchar**) &extended_insert, (uchar**) &extended_insert, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"fields-terminated-by", OPT_FTB,
- "Fields in the textfile are terminated by ...", (gptr*) &fields_terminated,
- (gptr*) &fields_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Fields in the textfile are terminated by ...", (uchar**) &fields_terminated,
+ (uchar**) &fields_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-enclosed-by", OPT_ENC,
- "Fields in the importfile are enclosed by ...", (gptr*) &enclosed,
- (gptr*) &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
+ "Fields in the importfile are enclosed by ...", (uchar**) &enclosed,
+ (uchar**) &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
{"fields-optionally-enclosed-by", OPT_O_ENC,
- "Fields in the i.file are opt. enclosed by ...", (gptr*) &opt_enclosed,
- (gptr*) &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
+ "Fields in the i.file are opt. enclosed by ...", (uchar**) &opt_enclosed,
+ (uchar**) &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
{"fields-escaped-by", OPT_ESC, "Fields in the i.file are escaped by ...",
- (gptr*) &escaped, (gptr*) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &escaped, (uchar**) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"first-slave", 'x', "Deprecated, renamed to --lock-all-tables.",
- (gptr*) &opt_lock_all_tables, (gptr*) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
+ (uchar**) &opt_lock_all_tables, (uchar**) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"flush-logs", 'F', "Flush logs file in server before starting dump. "
"Note that if you dump many databases at once (using the option "
@@ -287,44 +287,44 @@ static struct my_option my_long_options[] =
"to the moment all tables are locked. So if you want your dump and "
"the log flush to happen at the same exact moment you should use "
"--lock-all-tables or --master-data with --flush-logs",
- (gptr*) &flush_logs, (gptr*) &flush_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &flush_logs, (uchar**) &flush_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"flush-privileges", OPT_ESC, "Emit a FLUSH PRIVILEGES statement "
"after dumping the mysql database. This option should be used any "
"time the dump contains the mysql database and any other database "
"that depends on the data in the mysql database for proper restore. ",
- (gptr*) &flush_privileges, (gptr*) &flush_privileges, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &flush_privileges, (uchar**) &flush_privileges, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"force", 'f', "Continue even if we get an sql-error.",
- (gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG,
+ (uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"hex-blob", OPT_HEXBLOB, "Dump binary strings (BINARY, "
"VARBINARY, BLOB) in hexadecimal format.",
- (gptr*) &opt_hex_blob, (gptr*) &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host.", (gptr*) &current_host,
- (gptr*) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &opt_hex_blob, (uchar**) &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"host", 'h', "Connect to host.", (uchar**) &current_host,
+ (uchar**) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ignore-table", OPT_IGNORE_TABLE,
"Do not dump the specified table. To specify more than one table to ignore, "
"use the directive multiple times, once for each table. Each table must "
"be specified with both database and table names, e.g. --ignore-table=database.table",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"insert-ignore", OPT_INSERT_IGNORE, "Insert rows with INSERT IGNORE.",
- (gptr*) &opt_ignore, (gptr*) &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &opt_ignore, (uchar**) &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
- (gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR,
+ (uchar**) &lines_terminated, (uchar**) &lines_terminated, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"lock-all-tables", 'x', "Locks all tables across all databases. This "
"is achieved by taking a global read lock for the duration of the whole "
"dump. Automatically turns --single-transaction and --lock-tables off.",
- (gptr*) &opt_lock_all_tables, (gptr*) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
+ (uchar**) &opt_lock_all_tables, (uchar**) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"lock-tables", 'l', "Lock all tables for read.", (gptr*) &lock_tables,
- (gptr*) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ {"lock-tables", 'l', "Lock all tables for read.", (uchar**) &lock_tables,
+ (uchar**) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"log-error", OPT_ERROR_LOG_FILE, "Append warnings and errors to given file.",
- (gptr*) &log_error_file, (gptr*) &log_error_file, 0, GET_STR,
+ (uchar**) &log_error_file, (uchar**) &log_error_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"master-data", OPT_MASTER_DATA,
"This causes the binary log position and filename to be appended to the "
@@ -336,29 +336,29 @@ static struct my_option my_long_options[] =
"- don't forget to read about --single-transaction below). In all cases "
"any action on logs will happen at the exact moment of the dump."
"Option automatically turns --lock-tables off.",
- (gptr*) &opt_master_data, (gptr*) &opt_master_data, 0,
+ (uchar**) &opt_master_data, (uchar**) &opt_master_data, 0,
GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_MASTER_DATA_COMMENTED_SQL, 0, 0, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
- (gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0,
+ (uchar**) &opt_max_allowed_packet, (uchar**) &opt_max_allowed_packet, 0,
GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096,
(longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
{"net_buffer_length", OPT_NET_BUFFER_LENGTH, "",
- (gptr*) &opt_net_buffer_length, (gptr*) &opt_net_buffer_length, 0,
+ (uchar**) &opt_net_buffer_length, (uchar**) &opt_net_buffer_length, 0,
GET_ULONG, REQUIRED_ARG, 1024*1024L-1025, 4096, 16*1024L*1024L,
MALLOC_OVERHEAD-1024, 1024, 0},
{"no-autocommit", OPT_AUTOCOMMIT,
"Wrap tables with autocommit/commit statements.",
- (gptr*) &opt_autocommit, (gptr*) &opt_autocommit, 0, GET_BOOL, NO_ARG,
+ (uchar**) &opt_autocommit, (uchar**) &opt_autocommit, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"no-create-db", 'n',
"'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;' will not be put in the output. The above line will be added otherwise, if --databases or --all-databases option was given.}.",
- (gptr*) &opt_create_db, (gptr*) &opt_create_db, 0, GET_BOOL, NO_ARG, 0, 0,
+ (uchar**) &opt_create_db, (uchar**) &opt_create_db, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"no-create-info", 't', "Don't write table creation info.",
- (gptr*) &opt_no_create_info, (gptr*) &opt_no_create_info, 0, GET_BOOL,
+ (uchar**) &opt_no_create_info, (uchar**) &opt_no_create_info, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"no-data", 'd', "No row information.", (gptr*) &opt_no_data,
- (gptr*) &opt_no_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"no-data", 'd', "No row information.", (uchar**) &opt_no_data,
+ (uchar**) &opt_no_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-set-names", 'N',
"Deprecated. Use --skip-set-charset instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -367,7 +367,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"order-by-primary", OPT_ORDER_BY_PRIMARY,
"Sorts each table's rows by primary key, or first unique key, if such a key exists. Useful when dumping a MyISAM table to be loaded into an InnoDB table, but will make the dump itself take considerably longer.",
- (gptr*) &opt_order_by_primary, (gptr*) &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &opt_order_by_primary, (uchar**) &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's solicited on the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -375,35 +375,35 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
- (gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
+ {"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
+ (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"quick", 'q', "Don't buffer query, dump directly to stdout.",
- (gptr*) &quick, (gptr*) &quick, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ (uchar**) &quick, (uchar**) &quick, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"quote-names",'Q', "Quote table and column names with backticks (`).",
- (gptr*) &opt_quoted, (gptr*) &opt_quoted, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
+ (uchar**) &opt_quoted, (uchar**) &opt_quoted, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
0, 0},
{"replace", OPT_MYSQL_REPLACE_INTO, "Use REPLACE INTO instead of INSERT INTO.",
- (gptr*) &opt_replace_into, (gptr*) &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &opt_replace_into, (uchar**) &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"result-file", 'r',
"Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"routines", 'R', "Dump stored routines (functions and procedures).",
- (gptr*) &opt_routines, (gptr*) &opt_routines, 0, GET_BOOL,
+ (uchar**) &opt_routines, (uchar**) &opt_routines, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-charset", OPT_SET_CHARSET,
"Add 'SET NAMES default_character_set' to the output. Enabled by default; suppress with --skip-set-charset.",
- (gptr*) &opt_set_charset, (gptr*) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
+ (uchar**) &opt_set_charset, (uchar**) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
+ "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
/*
@@ -417,37 +417,37 @@ static struct my_option my_long_options[] =
"support multiversioning (currently only InnoDB does); the dump is NOT "
"guaranteed to be consistent for other storage engines. Option "
"automatically turns off --lock-tables.",
- (gptr*) &opt_single_transaction, (gptr*) &opt_single_transaction, 0,
+ (uchar**) &opt_single_transaction, (uchar**) &opt_single_transaction, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-opt", OPT_SKIP_OPTIMIZATION,
"Disable --opt. Disables --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
- (gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
+ (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
{"tab",'T',
"Creates tab separated textfile for each table to given path. (creates .sql and .txt files). NOTE: This only works if mysqldump is run on the same machine as the mysqld daemon.",
- (gptr*) &path, (gptr*) &path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &path, (uchar**) &path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tables", OPT_TABLES, "Overrides option --databases (-B).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"triggers", OPT_TRIGGERS, "Dump triggers for each dumped table",
- (gptr*) &opt_dump_triggers, (gptr*) &opt_dump_triggers, 0, GET_BOOL,
+ (uchar**) &opt_dump_triggers, (uchar**) &opt_dump_triggers, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"tz-utc", OPT_TZ_UTC,
"SET TIME_ZONE='+00:00' at top of dump to allow dumping of TIMESTAMP data when a server has data in different time zones or data is being moved between servers with different time zones.",
- (gptr*) &opt_tz_utc, (gptr*) &opt_tz_utc, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ (uchar**) &opt_tz_utc, (uchar**) &opt_tz_utc, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.",
- (gptr*) &current_user, (gptr*) &current_user, 0, GET_STR, REQUIRED_ARG,
+ (uchar**) &current_user, (uchar**) &current_user, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v', "Print info about the various stages.",
- (gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version",'V', "Output version information and exit.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"where", 'w', "Dump only selected records; QUOTES mandatory!",
- (gptr*) &where, (gptr*) &where, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &where, (uchar**) &where, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"xml", 'X', "Dump a database as well formed XML.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
@@ -655,18 +655,18 @@ static void write_footer(FILE *sql_file)
}
} /* write_footer */
-static void free_table_ent(char *key)
+static void free_table_ent(char *key)
{
- my_free((gptr) key, MYF(0));
+ my_free(key, MYF(0));
}
-byte* get_table_key(const char *entry, uint *length,
- my_bool not_used __attribute__((unused)))
+uchar* get_table_key(const char *entry, size_t *length,
+ my_bool not_used __attribute__((unused)))
{
*length= strlen(entry);
- return (byte*) entry;
+ return (uchar*) entry;
}
@@ -753,7 +753,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
fprintf(stderr, "Illegal use of option --ignore-table=<database>.<table>\n");
exit(1);
}
- if (my_hash_insert(&ignore_table, (byte*)my_strdup(argument, MYF(0))))
+ if (my_hash_insert(&ignore_table, (uchar*)my_strdup(argument, MYF(0))))
exit(EX_EOM);
break;
}
@@ -832,13 +832,13 @@ static int get_options(int *argc, char ***argv)
return(EX_EOM);
/* Don't copy internal log tables */
if (my_hash_insert(&ignore_table,
- (byte*) my_strdup("mysql.apply_status", MYF(MY_WME))) ||
+ (uchar*) my_strdup("mysql.apply_status", MYF(MY_WME))) ||
my_hash_insert(&ignore_table,
- (byte*) my_strdup("mysql.schema", MYF(MY_WME))) ||
+ (uchar*) my_strdup("mysql.schema", MYF(MY_WME))) ||
my_hash_insert(&ignore_table,
- (byte*) my_strdup("mysql.general_log", MYF(MY_WME))) ||
+ (uchar*) my_strdup("mysql.general_log", MYF(MY_WME))) ||
my_hash_insert(&ignore_table,
- (byte*) my_strdup("mysql.slow_log", MYF(MY_WME))))
+ (uchar*) my_strdup("mysql.slow_log", MYF(MY_WME))))
return(EX_EOM);
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
@@ -2281,10 +2281,10 @@ DELIMITER ;;\n");
we should check if we have this column before accessing it.
*/
- uint user_name_len;
+ size_t user_name_len;
char user_name_str[USERNAME_LENGTH + 1];
char quoted_user_name_str[USERNAME_LENGTH * 2 + 3];
- uint host_name_len;
+ size_t host_name_len;
char host_name_str[HOSTNAME_LENGTH + 1];
char quoted_host_name_str[HOSTNAME_LENGTH * 2 + 3];
@@ -3336,9 +3336,9 @@ static int init_dumping(char *database, int init_func(char*))
/* Return 1 if we should copy the table */
-my_bool include_table(byte* hash_key, uint len)
+my_bool include_table(uchar* hash_key, uint len)
{
- return !hash_search(&ignore_table, (byte*) hash_key, len);
+ return !hash_search(&ignore_table, (uchar*) hash_key, len);
}
@@ -4126,10 +4126,10 @@ static my_bool get_view_structure(char *table, char* db)
Surround it with !50013 comments
*/
{
- uint user_name_len;
+ size_t user_name_len;
char user_name_str[USERNAME_LENGTH + 1];
char quoted_user_name_str[USERNAME_LENGTH * 2 + 3];
- uint host_name_len;
+ size_t host_name_len;
char host_name_str[HOSTNAME_LENGTH + 1];
char quoted_host_name_str[HOSTNAME_LENGTH * 2 + 3];
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index c037da9c0b9..396063731cf 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -57,7 +57,7 @@ static char *opt_password=0, *current_user=0,
*escaped=0, *opt_columns=0,
*default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
static uint opt_mysql_port= 0, opt_protocol= 0;
-static my_string opt_mysql_unix_port=0;
+static char * opt_mysql_unix_port=0;
static longlong opt_ignore_lines= -1;
static CHARSET_INFO *charset_info= &my_charset_latin1;
#include <sslopt-vars.h>
@@ -73,59 +73,59 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory where character sets are.", (gptr*) &charsets_dir,
- (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory where character sets are.", (uchar**) &charsets_dir,
+ (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
- "Set the default character set.", (gptr*) &default_charset,
- (gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Set the default character set.", (uchar**) &default_charset,
+ (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"columns", 'c',
"Use only these columns to import the data to. Give the column names in a comma separated list. This is same as giving columns to LOAD DATA INFILE.",
- (gptr*) &opt_columns, (gptr*) &opt_columns, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ (uchar**) &opt_columns, (uchar**) &opt_columns, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
- (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"debug",'#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
- (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"delete", 'd', "First delete all rows from table.", (gptr*) &opt_delete,
- (gptr*) &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
+ (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"delete", 'd', "First delete all rows from table.", (uchar**) &opt_delete,
+ (uchar**) &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"fields-terminated-by", OPT_FTB,
- "Fields in the textfile are terminated by ...", (gptr*) &fields_terminated,
- (gptr*) &fields_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Fields in the textfile are terminated by ...", (uchar**) &fields_terminated,
+ (uchar**) &fields_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-enclosed-by", OPT_ENC,
- "Fields in the importfile are enclosed by ...", (gptr*) &enclosed,
- (gptr*) &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Fields in the importfile are enclosed by ...", (uchar**) &enclosed,
+ (uchar**) &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-optionally-enclosed-by", OPT_O_ENC,
- "Fields in the i.file are opt. enclosed by ...", (gptr*) &opt_enclosed,
- (gptr*) &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Fields in the i.file are opt. enclosed by ...", (uchar**) &opt_enclosed,
+ (uchar**) &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-escaped-by", OPT_ESC, "Fields in the i.file are escaped by ...",
- (gptr*) &escaped, (gptr*) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
+ (uchar**) &escaped, (uchar**) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"force", 'f', "Continue even if we get an sql-error.",
- (gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
+ (uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host.", (gptr*) &current_host,
- (gptr*) &current_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"host", 'h', "Connect to host.", (uchar**) &current_host,
+ (uchar**) &current_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ignore", 'i', "If duplicate unique key was found, keep old row.",
- (gptr*) &ignore, (gptr*) &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &ignore, (uchar**) &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"ignore-lines", OPT_IGN_LINES, "Ignore first n lines of data infile.",
- (gptr*) &opt_ignore_lines, (gptr*) &opt_ignore_lines, 0, GET_LL,
+ (uchar**) &opt_ignore_lines, (uchar**) &opt_ignore_lines, 0, GET_LL,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
- (gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR,
+ (uchar**) &lines_terminated, (uchar**) &lines_terminated, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"local", 'L', "Read all files through the client.", (gptr*) &opt_local_file,
- (gptr*) &opt_local_file, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"local", 'L', "Read all files through the client.", (uchar**) &opt_local_file,
+ (uchar**) &opt_local_file, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"lock-tables", 'l', "Lock all tables for write (this disables threads).",
- (gptr*) &lock_tables, (gptr*) &lock_tables, 0, GET_BOOL, NO_ARG,
+ (uchar**) &lock_tables, (uchar**) &lock_tables, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"low-priority", OPT_LOW_PRIORITY,
- "Use LOW_PRIORITY when updating the table.", (gptr*) &opt_low_priority,
- (gptr*) &opt_low_priority, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ "Use LOW_PRIORITY when updating the table.", (uchar**) &opt_low_priority,
+ (uchar**) &opt_low_priority, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -133,35 +133,35 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
- (gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
+ {"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
+ (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replace", 'r', "If duplicate unique key was found, replace old row.",
- (gptr*) &replace, (gptr*) &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &replace, (uchar**) &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
+ "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"silent", 's', "Be more silent.", (gptr*) &silent, (gptr*) &silent, 0,
+ {"silent", 's', "Be more silent.", (uchar**) &silent, (uchar**) &silent, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
- (gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
+ (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
{"use-threads", OPT_USE_THREADS,
"Load files in parallel. The argument is the number "
"of threads to use for loading data.",
- (gptr*) &opt_use_threads, (gptr*) &opt_use_threads, 0,
+ (uchar**) &opt_use_threads, (uchar**) &opt_use_threads, 0,
GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user.", (gptr*) &current_user,
- (gptr*) &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user.", (uchar**) &current_user,
+ (uchar**) &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"verbose", 'v', "Print info about the various stages.", (gptr*) &verbose,
- (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"verbose", 'v', "Print info about the various stages.", (uchar**) &verbose,
+ (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index 0c6a6229964..649658d6223 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -26,7 +26,7 @@
#include <stdarg.h>
#include <sslopt-vars.h>
-static my_string host=0,opt_password=0,user=0;
+static char * host=0, *opt_password=0, *user=0;
static my_bool opt_show_keys= 0, opt_compress= 0, opt_count=0, opt_status= 0;
static my_bool tty_password= 0, opt_table_type= 0, info_flag= 0;
static uint opt_verbose=0;
@@ -52,7 +52,7 @@ static void print_res_top(MYSQL_RES *result);
static void print_res_row(MYSQL_RES *result,MYSQL_ROW cur);
static const char *load_default_groups[]= { "mysqlshow","client",0 };
-static my_string opt_mysql_unix_port=0;
+static char * opt_mysql_unix_port=0;
int main(int argc, char **argv)
{
@@ -120,7 +120,8 @@ int main(int argc, char **argv)
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (!(mysql_real_connect(&mysql,host,user,opt_password,
- (first_argument_uses_wildcards) ? "" : argv[0],opt_mysql_port,opt_mysql_unix_port,
+ (first_argument_uses_wildcards) ? "" :
+ argv[0],opt_mysql_port,opt_mysql_unix_port,
0)))
{
fprintf(stderr,"%s: %s\n",my_progname,mysql_error(&mysql));
@@ -161,36 +162,36 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"character-sets-dir", 'c', "Directory where character sets are.",
- (gptr*) &charsets_dir, (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0,
+ (uchar**) &charsets_dir, (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0,
0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
- "Set the default character set.", (gptr*) &default_charset,
- (gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Set the default character set.", (uchar**) &default_charset,
+ (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"count", OPT_COUNT,
"Show number of rows per table (may be slow for not MyISAM tables)",
- (gptr*) &opt_count, (gptr*) &opt_count, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_count, (uchar**) &opt_count, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
- (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
- (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
+ (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR,
+ {"host", 'h', "Connect to host.", (uchar**) &host, (uchar**) &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"status", 'i', "Shows a lot of extra information about each table.",
- (gptr*) &opt_status, (gptr*) &opt_status, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &opt_status, (uchar**) &opt_status, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
- {"keys", 'k', "Show keys for table.", (gptr*) &opt_show_keys,
- (gptr*) &opt_show_keys, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"keys", 'k', "Show keys for table.", (uchar**) &opt_show_keys,
+ (uchar**) &opt_show_keys, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
- (gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
+ {"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
+ (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
#ifdef __WIN__
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
@@ -200,19 +201,19 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
+ "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"show-table-type", 't', "Show table type column.",
- (gptr*) &opt_table_type, (gptr*) &opt_table_type, 0, GET_BOOL,
+ (uchar**) &opt_table_type, (uchar**) &opt_table_type, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
- (gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
+ (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user.", (gptr*) &user,
- (gptr*) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user.", (uchar**) &user,
+ (uchar**) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v',
"More verbose output; You can use this multiple times to get even more verbose output.",
@@ -733,7 +734,7 @@ print_header(const char *header,uint head_length,...)
for (i=0 ; i < length+2 ; i++)
putchar('-');
putchar('+');
- if (!(field=va_arg(args,my_string)))
+ if (!(field=va_arg(args,char *)))
break;
length=va_arg(args,uint);
}
@@ -757,7 +758,7 @@ print_header(const char *header,uint head_length,...)
for (i=0 ; i < length ; i++)
putchar(' ');
putchar('|');
- if (!(field=va_arg(args,my_string)))
+ if (!(field=va_arg(args,char *)))
break;
length=va_arg(args,uint);
}
@@ -772,7 +773,7 @@ print_header(const char *header,uint head_length,...)
for (i=0 ; i < length+2 ; i++)
putchar('-');
putchar('+');
- if (!(field=va_arg(args,my_string)))
+ if (!(field=va_arg(args,char *)))
break;
length=va_arg(args,uint);
}
@@ -798,7 +799,7 @@ print_row(const char *header,uint head_length,...)
field_length=(uint) strlen(field);
for (i=field_length ; i <= length ; i++)
putchar(' ');
- if (!(field=va_arg(args,my_string)))
+ if (!(field=va_arg(args,char *)))
break;
length=va_arg(args,uint);
}
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index 0335922881a..86f024a9b6f 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -387,9 +387,9 @@ int main(int argc, char **argv)
/* now free all the strings we created */
if (opt_password)
- my_free((gptr)opt_password, MYF(0));
+ my_free(opt_password, MYF(0));
- my_free((gptr)concurrency, MYF(0));
+ my_free(concurrency, MYF(0));
statement_cleanup(create_statements);
statement_cleanup(query_statements);
@@ -399,7 +399,7 @@ int main(int argc, char **argv)
#ifdef HAVE_SMEM
if (shared_memory_base_name)
- my_free((gptr)shared_memory_base_name, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(shared_memory_base_name, MYF(MY_ALLOW_ZERO_PTR));
#endif
free_defaults(defaults_argv);
my_end(0);
@@ -473,7 +473,7 @@ void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr)
if (opt_csv_str)
print_conclusions_csv(&conclusion);
- my_free((gptr)head_sptr, MYF(0));
+ my_free(head_sptr, MYF(0));
}
@@ -484,94 +484,94 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0, 0},
{"auto-generate-sql", 'a',
"Generate SQL where not supplied by file or command line.",
- (gptr*) &auto_generate_sql, (gptr*) &auto_generate_sql,
+ (uchar**) &auto_generate_sql, (uchar**) &auto_generate_sql,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-add-autoincrement", OPT_SLAP_AUTO_GENERATE_ADD_AUTO,
"Add autoincrement to auto-generated tables.",
- (gptr*) &auto_generate_sql_autoincrement,
- (gptr*) &auto_generate_sql_autoincrement,
+ (uchar**) &auto_generate_sql_autoincrement,
+ (uchar**) &auto_generate_sql_autoincrement,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-execute-number", OPT_SLAP_AUTO_GENERATE_EXECUTE_QUERIES,
"Set this number to generate a set number of queries to run.\n",
- (gptr*) &auto_actual_queries, (gptr*) &auto_actual_queries,
+ (uchar**) &auto_actual_queries, (uchar**) &auto_actual_queries,
0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-guid-primary", OPT_SLAP_AUTO_GENERATE_GUID_PRIMARY,
"Add GUID based primary keys to auto-generated tables.",
- (gptr*) &auto_generate_sql_guid_primary,
- (gptr*) &auto_generate_sql_guid_primary,
+ (uchar**) &auto_generate_sql_guid_primary,
+ (uchar**) &auto_generate_sql_guid_primary,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-load-type", OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE,
"Load types are mixed, update, write, key, or read. Default is mixed\n",
- (gptr*) &auto_generate_sql_type, (gptr*) &auto_generate_sql_type,
+ (uchar**) &auto_generate_sql_type, (uchar**) &auto_generate_sql_type,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-secondary-indexes",
OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES,
"Number of secondary indexes to add auto-generated tables.",
- (gptr*) &auto_generate_sql_secondary_indexes,
- (gptr*) &auto_generate_sql_secondary_indexes, 0,
+ (uchar**) &auto_generate_sql_secondary_indexes,
+ (uchar**) &auto_generate_sql_secondary_indexes, 0,
GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-unique-query-number",
OPT_SLAP_AUTO_GENERATE_UNIQUE_QUERY_NUM,
"Number of unique queries auto tests",
- (gptr*) &auto_generate_sql_unique_query_number,
- (gptr*) &auto_generate_sql_unique_query_number,
+ (uchar**) &auto_generate_sql_unique_query_number,
+ (uchar**) &auto_generate_sql_unique_query_number,
0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
{"auto-generate-sql-unique-write-number",
OPT_SLAP_AUTO_GENERATE_UNIQUE_WRITE_NUM,
"Number of unique queries for auto-generate-sql-write-number",
- (gptr*) &auto_generate_sql_unique_write_number,
- (gptr*) &auto_generate_sql_unique_write_number,
+ (uchar**) &auto_generate_sql_unique_write_number,
+ (uchar**) &auto_generate_sql_unique_write_number,
0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
{"auto-generate-sql-write-number", OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
"Number of rows to insert to used in read and write loads (default is 100).\n",
- (gptr*) &auto_generate_sql_number, (gptr*) &auto_generate_sql_number,
+ (uchar**) &auto_generate_sql_number, (uchar**) &auto_generate_sql_number,
0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
- (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"concurrency", 'c', "Number of clients to simulate for query to run.",
- (gptr*) &concurrency_str, (gptr*) &concurrency_str, 0, GET_STR,
+ (uchar**) &concurrency_str, (uchar**) &concurrency_str, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"create", OPT_SLAP_CREATE_STRING, "File or string to use create tables.",
- (gptr*) &create_string, (gptr*) &create_string, 0, GET_STR, REQUIRED_ARG,
+ (uchar**) &create_string, (uchar**) &create_string, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"create-schema", OPT_CREATE_SLAP_SCHEMA, "Schema to run tests in.",
- (gptr*) &create_schema_string, (gptr*) &create_schema_string, 0, GET_STR,
+ (uchar**) &create_schema_string, (uchar**) &create_schema_string, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"csv", OPT_SLAP_CSV,
"Generate CSV output to named file or to stdout if no file is named.",
- (gptr*) &opt_csv_str, (gptr*) &opt_csv_str, 0, GET_STR,
+ (uchar**) &opt_csv_str, (uchar**) &opt_csv_str, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
- (gptr*) &default_dbug_option, (gptr*) &default_dbug_option, 0, GET_STR,
+ (uchar**) &default_dbug_option, (uchar**) &default_dbug_option, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"delimiter", 'F',
"Delimiter to use in SQL statements supplied in file or command line.",
- (gptr*) &delimiter, (gptr*) &delimiter, 0, GET_STR, REQUIRED_ARG,
+ (uchar**) &delimiter, (uchar**) &delimiter, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"engine", 'e', "Storage engine to use for creating the table.",
- (gptr*) &default_engine, (gptr*) &default_engine, 0,
+ (uchar**) &default_engine, (uchar**) &default_engine, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR,
+ {"host", 'h', "Connect to host.", (uchar**) &host, (uchar**) &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"iterations", 'i', "Number of times too run the tests.", (gptr*) &iterations,
- (gptr*) &iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
+ {"iterations", 'i', "Number of times too run the tests.", (uchar**) &iterations,
+ (uchar**) &iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
{"number-char-cols", 'x',
"Number of VARCHAR columns to create table with if specifying --auto-generate-sql ",
- (gptr*) &num_char_cols_opt, (gptr*) &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG,
+ (uchar**) &num_char_cols_opt, (uchar**) &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"number-int-cols", 'y',
"Number of INT columns to create table with if specifying --auto-generate-sql.",
- (gptr*) &num_int_cols_opt, (gptr*) &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG,
+ (uchar**) &num_int_cols_opt, (uchar**) &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"number-of-queries", OPT_MYSQL_NUMBER_OF_QUERY,
"Limit each client to this number of queries (this is not exact).",
- (gptr*) &num_of_query, (gptr*) &num_of_query, 0,
+ (uchar**) &num_of_query, (uchar**) &num_of_query, 0,
GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"only-print", OPT_MYSQL_ONLY_PRINT,
"This causes mysqlslap to not connect to the databases, but instead print "
"out what it would have done instead.",
- (gptr*) &opt_only_print, (gptr*) &opt_only_print, 0, GET_BOOL, NO_ARG,
+ (uchar**) &opt_only_print, (uchar**) &opt_only_print, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's "
@@ -580,50 +580,50 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
- (gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
+ {"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
+ (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
0},
{"post-query", OPT_SLAP_POST_QUERY,
"Query to run or file containing query to run after executing.",
- (gptr*) &user_supplied_post_statements,
- (gptr*) &user_supplied_post_statements,
+ (uchar**) &user_supplied_post_statements,
+ (uchar**) &user_supplied_post_statements,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"pre-query", OPT_SLAP_PRE_QUERY,
"Query to run or file containing query to run before executing.",
- (gptr*) &user_supplied_pre_statements,
- (gptr*) &user_supplied_pre_statements,
+ (uchar**) &user_supplied_pre_statements,
+ (uchar**) &user_supplied_pre_statements,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"preserve-schema", OPT_MYSQL_PRESERVE_SCHEMA,
"Preserve the schema from the mysqlslap run, this happens unless "
"--auto-generate-sql or --create are used.",
- (gptr*) &opt_preserve, (gptr*) &opt_preserve, 0, GET_BOOL,
+ (uchar**) &opt_preserve, (uchar**) &opt_preserve, 0, GET_BOOL,
NO_ARG, TRUE, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL,
"The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"query", 'q', "Query to run or file containing query to run.",
- (gptr*) &user_supplied_query, (gptr*) &user_supplied_query,
+ (uchar**) &user_supplied_query, (uchar**) &user_supplied_query,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (gptr*) &shared_memory_base_name,
- (gptr*) &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG,
+ "Base name of shared memory.", (uchar**) &shared_memory_base_name,
+ (uchar**) &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Run program in silent mode - no output.",
- (gptr*) &opt_silent, (gptr*) &opt_silent, 0, GET_BOOL, NO_ARG,
+ (uchar**) &opt_silent, (uchar**) &opt_silent, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
- (gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
+ (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user.", (gptr*) &user,
- (gptr*) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user.", (uchar**) &user,
+ (uchar**) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v',
"More verbose output; You can use this multiple times to get even more "
- "verbose output.", (gptr*) &verbose, (gptr*) &verbose, 0,
+ "verbose output.", (uchar**) &verbose, (uchar**) &verbose, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -673,7 +673,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (argument)
{
char *start= argument;
- my_free((gptr)opt_password, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
opt_password= my_strdup(argument,MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */
if (*start)
@@ -1312,7 +1312,7 @@ get_options(int *argc,char ***argv)
tmp_string[sbuf.st_size]= '\0';
my_close(data_file,MYF(0));
parse_delimiter(tmp_string, &create_statements, delimiter[0]);
- my_free((gptr)tmp_string, MYF(0));
+ my_free(tmp_string, MYF(0));
}
else if (create_string)
{
@@ -1341,7 +1341,7 @@ get_options(int *argc,char ***argv)
if (user_supplied_query)
actual_queries= parse_delimiter(tmp_string, &query_statements,
delimiter[0]);
- my_free((gptr)tmp_string, MYF(0));
+ my_free(tmp_string, MYF(0));
}
else if (user_supplied_query)
{
@@ -1372,11 +1372,12 @@ get_options(int *argc,char ***argv)
if (user_supplied_pre_statements)
actual_queries= parse_delimiter(tmp_string, &pre_statements,
delimiter[0]);
- my_free((gptr)tmp_string, MYF(0));
+ my_free(tmp_string, MYF(0));
}
else if (user_supplied_pre_statements)
{
- actual_queries= parse_delimiter(user_supplied_pre_statements, &pre_statements,
+ actual_queries= parse_delimiter(user_supplied_pre_statements,
+ &pre_statements,
delimiter[0]);
}
@@ -1402,7 +1403,7 @@ get_options(int *argc,char ***argv)
if (user_supplied_post_statements)
parse_delimiter(tmp_string, &post_statements,
delimiter[0]);
- my_free((gptr)tmp_string, MYF(0));
+ my_free(tmp_string, MYF(0));
}
else if (user_supplied_post_statements)
{
@@ -1499,9 +1500,9 @@ drop_primary_key_list(void)
if (primary_keys_number_of)
{
for (counter= 0; counter < primary_keys_number_of; counter++)
- my_free((gptr)primary_keys[counter], MYF(0));
+ my_free(primary_keys[counter], MYF(0));
- my_free((gptr)primary_keys, MYF(0));
+ my_free(primary_keys, MYF(0));
}
return 0;
@@ -2080,10 +2081,10 @@ option_cleanup(option_string *stmt)
{
nptr= ptr->next;
if (ptr->string)
- my_free((gptr)ptr->string, MYF(0));
+ my_free(ptr->string, MYF(0));
if (ptr->option)
- my_free((gptr)ptr->option, MYF(0));
- my_free((gptr)(byte *)ptr, MYF(0));
+ my_free(ptr->option, MYF(0));
+ my_free(ptr, MYF(0));
}
}
@@ -2098,7 +2099,7 @@ statement_cleanup(statement *stmt)
{
nptr= ptr->next;
if (ptr->string)
- my_free((gptr)ptr->string, MYF(0));
- my_free((gptr)(byte *)ptr, MYF(0));
+ my_free(ptr->string, MYF(0));
+ my_free(ptr, MYF(0));
}
}
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 8dc70249f60..869dc3e2364 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -747,7 +747,7 @@ void close_files()
DBUG_PRINT("info", ("closing file: %s", cur_file->file_name));
my_fclose(cur_file->file, MYF(0));
}
- my_free((gptr)cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR));
cur_file->file_name= 0;
}
DBUG_VOID_RETURN;
@@ -766,8 +766,8 @@ void free_used_memory()
for (i= 0 ; i < q_lines.elements ; i++)
{
struct st_command **q= dynamic_element(&q_lines, i, struct st_command**);
- my_free((gptr) (*q)->query_buf,MYF(MY_ALLOW_ZERO_PTR));
- my_free((gptr) (*q),MYF(0));
+ my_free((*q)->query_buf,MYF(MY_ALLOW_ZERO_PTR));
+ my_free((*q),MYF(0));
}
for (i= 0; i < 10; i++)
{
@@ -1014,7 +1014,7 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
if (!eval_result && (uint) stat_info.st_size != ds->length)
{
DBUG_PRINT("info",("Size differs: result size: %u file size: %lu",
- ds->length, (ulong) stat_info.st_size));
+ (uint) ds->length, (ulong) stat_info.st_size));
DBUG_PRINT("info",("result: '%s'", ds->str));
DBUG_RETURN(RESULT_LENGTH_MISMATCH);
}
@@ -1023,7 +1023,7 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
if ((fd = my_open(eval_file, O_RDONLY, MYF(MY_WME))) < 0)
die("Failed to open file %s", eval_file);
- if (my_read(fd, (byte*)tmp, stat_info.st_size, MYF(MY_WME|MY_NABP)))
+ if (my_read(fd, (uchar*)tmp, stat_info.st_size, MYF(MY_WME|MY_NABP)))
die("Failed to read from file %s, errno: %d", eval_file, errno);
tmp[stat_info.st_size] = 0;
init_dynamic_string(&res_ds, "", stat_info.st_size+256, 256);
@@ -1054,7 +1054,7 @@ err:
res_ptr, res_len);
dynstr_free(&res_ds);
- my_free((gptr) tmp, MYF(0));
+ my_free(tmp, MYF(0));
my_close(fd, MYF(MY_WME));
DBUG_RETURN(res);
@@ -1127,13 +1127,13 @@ void check_require(DYNAMIC_STRING* ds, const char *fname)
}
-static byte *get_var_key(const byte* var, uint* len,
- my_bool __attribute__((unused)) t)
+static uchar *get_var_key(const uchar* var, size_t *len,
+ my_bool __attribute__((unused)) t)
{
register char* key;
key = ((VAR*)var)->name;
*len = ((VAR*)var)->name_len;
- return (byte*)key;
+ return (uchar*)key;
}
@@ -1177,7 +1177,7 @@ void var_free(void *v)
{
my_free(((VAR*) v)->str_val, MYF(MY_WME));
if (((VAR*)v)->alloced)
- my_free((char*) v, MYF(MY_WME));
+ my_free(v, MYF(MY_WME));
}
@@ -1189,7 +1189,7 @@ VAR* var_from_env(const char *name, const char *def_val)
tmp = def_val;
v = var_init(0, name, strlen(name), tmp, strlen(tmp));
- my_hash_insert(&var_hash, (byte*)v);
+ my_hash_insert(&var_hash, (uchar*)v);
return v;
}
@@ -1256,7 +1256,7 @@ VAR *var_obtain(const char *name, int len)
if ((v = (VAR*)hash_search(&var_hash, name, len)))
return v;
v = var_init(0, name, len, "", 0);
- my_hash_insert(&var_hash, (byte*)v);
+ my_hash_insert(&var_hash, (uchar*)v);
return v;
}
@@ -1308,7 +1308,7 @@ void var_set(const char *var_name, const char *var_name_end,
if (!(v->env_s= my_strdup(buf, MYF(MY_WME))))
die("Out of memory");
putenv(v->env_s);
- my_free((gptr)old_env_s, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(old_env_s, MYF(MY_ALLOW_ZERO_PTR));
}
DBUG_VOID_RETURN;
}
@@ -1613,9 +1613,10 @@ FILE* my_popen(DYNAMIC_STRING *ds_cmd, const char *mode)
static void init_builtin_echo(void)
{
#ifdef __WIN__
+ size_t echo_length;
/* Look for "echo.exe" in same dir as mysqltest was started from */
- dirname_part(builtin_echo, my_progname);
+ dirname_part(builtin_echo, my_progname, &echo_length);
fn_format(builtin_echo, ".\\echo.exe",
builtin_echo, "", MYF(MY_REPLACE_DIR));
@@ -2087,8 +2088,8 @@ void read_until_delimiter(DYNAMIC_STRING *ds,
{
char c;
DBUG_ENTER("read_until_delimiter");
- DBUG_PRINT("enter", ("delimiter: %s, length: %d",
- ds_delimiter->str, ds_delimiter->length));
+ DBUG_PRINT("enter", ("delimiter: %s, length: %u",
+ ds_delimiter->str, (uint) ds_delimiter->length));
if (ds_delimiter->length > MAX_DELIMITER_LENGTH)
die("Max delimiter length(%d) exceeded", MAX_DELIMITER_LENGTH);
@@ -2246,7 +2247,7 @@ void do_cat_file(struct st_command *command)
if ((fd= my_open(ds_filename.str, O_RDONLY, MYF(0))) < 0)
die("Failed to open file %s", ds_filename.str);
- while((len= my_read(fd, (byte*)&buff,
+ while((len= my_read(fd, (uchar*)&buff,
sizeof(buff), MYF(0))) > 0)
{
char *p= buff, *start= buff;
@@ -2314,10 +2315,10 @@ void do_diff_files(struct st_command *command)
my_close(fd, MYF(0));
die("Failed to open second file %s", ds_filename2.str);
}
- while((len= my_read(fd, (byte*)&buff,
+ while((len= my_read(fd, (uchar*)&buff,
sizeof(buff), MYF(0))) > 0)
{
- if ((len2= my_read(fd2, (byte*)&buff2,
+ if ((len2= my_read(fd2, (uchar*)&buff2,
sizeof(buff2), MYF(0))) != len)
{
/* File 2 was smaller */
@@ -2331,7 +2332,7 @@ void do_diff_files(struct st_command *command)
break;
}
}
- if (my_read(fd2, (byte*)&buff2,
+ if (my_read(fd2, (uchar*)&buff2,
sizeof(buff2), MYF(0)) > 0)
{
/* File 1 was smaller */
@@ -3823,7 +3824,7 @@ int read_line(char *buf, int size)
my_fclose(cur_file->file, MYF(0));
cur_file->file= 0;
}
- my_free((gptr)cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR));
cur_file->file_name= 0;
if (cur_file == file_stack)
{
@@ -4176,12 +4177,12 @@ int read_command(struct st_command** command_ptr)
if (parser.current_line < parser.read_lines)
{
- get_dynamic(&q_lines, (gptr) command_ptr, parser.current_line) ;
+ get_dynamic(&q_lines, (uchar*) command_ptr, parser.current_line) ;
DBUG_RETURN(0);
}
if (!(*command_ptr= command=
(struct st_command*) my_malloc(sizeof(*command), MYF(MY_WME))) ||
- insert_dynamic(&q_lines, (gptr) &command))
+ insert_dynamic(&q_lines, (uchar*) &command))
die(NullS);
command->require_file[0]= 0;
@@ -4237,18 +4238,18 @@ static struct my_option my_long_options[] =
{
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"basedir", 'b', "Basedir for tests.", (gptr*) &opt_basedir,
- (gptr*) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"basedir", 'b', "Basedir for tests.", (uchar**) &opt_basedir,
+ (uchar**) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory where character sets are.", (gptr*) &opt_charsets_dir,
- (gptr*) &opt_charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory where character sets are.", (uchar**) &opt_charsets_dir,
+ (uchar**) &opt_charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use the compressed server/client protocol.",
- (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statements.",
- (gptr*) &cursor_protocol, (gptr*) &cursor_protocol, 0,
+ (uchar**) &cursor_protocol, (uchar**) &cursor_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"database", 'D', "Database to use.", (gptr*) &opt_db, (gptr*) &opt_db, 0,
+ {"database", 'D', "Database to use.", (uchar**) &opt_db, (uchar**) &opt_db, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit",
@@ -4257,51 +4258,51 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"host", 'h', "Connect to host.", (gptr*) &opt_host, (gptr*) &opt_host, 0,
+ {"host", 'h', "Connect to host.", (uchar**) &opt_host, (uchar**) &opt_host, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"include", 'i', "Include SQL before each test case.", (gptr*) &opt_include,
- (gptr*) &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"logdir", OPT_LOG_DIR, "Directory for log files", (gptr*) &opt_logdir,
- (gptr*) &opt_logdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"include", 'i', "Include SQL before each test case.", (uchar**) &opt_include,
+ (uchar**) &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"logdir", OPT_LOG_DIR, "Directory for log files", (uchar**) &opt_logdir,
+ (uchar**) &opt_logdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"mark-progress", OPT_MARK_PROGRESS,
"Write linenumber and elapsed time to <testname>.progress ",
- (gptr*) &opt_mark_progress, (gptr*) &opt_mark_progress, 0,
+ (uchar**) &opt_mark_progress, (uchar**) &opt_mark_progress, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"max-connect-retries", OPT_MAX_CONNECT_RETRIES,
"Max number of connection attempts when connecting to server",
- (gptr*) &opt_max_connect_retries, (gptr*) &opt_max_connect_retries, 0,
+ (uchar**) &opt_max_connect_retries, (uchar**) &opt_max_connect_retries, 0,
GET_INT, REQUIRED_ARG, 500, 1, 10000, 0, 0, 0},
{"password", 'p', "Password to use when connecting to server.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"port", 'P', "Port number to use for connection.", (gptr*) &opt_port,
- (gptr*) &opt_port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"port", 'P', "Port number to use for connection.", (uchar**) &opt_port,
+ (uchar**) &opt_port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ps-protocol", OPT_PS_PROTOCOL, "Use prepared statements protocol for communication",
- (gptr*) &ps_protocol, (gptr*) &ps_protocol, 0,
+ (uchar**) &ps_protocol, (uchar**) &ps_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"quiet", 's', "Suppress all normal output.", (gptr*) &silent,
- (gptr*) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"quiet", 's', "Suppress all normal output.", (uchar**) &silent,
+ (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"record", 'r', "Record output of test_file into result file.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"result-file", 'R', "Read/Store result from/in this file.",
- (gptr*) &result_file_name, (gptr*) &result_file_name, 0,
+ (uchar**) &result_file_name, (uchar**) &result_file_name, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-arg", 'A', "Send option value to embedded server as a parameter.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-file", 'F', "Read embedded server arguments from file.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Suppress all normal output. Synonym for --quiet.",
- (gptr*) &silent, (gptr*) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
"Don't use the memory allocation checking.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"sleep", 'T', "Sleep always this many seconds on sleep commands.",
- (gptr*) &opt_sleep, (gptr*) &opt_sleep, 0, GET_INT, REQUIRED_ARG, -1, 0, 0,
+ (uchar**) &opt_sleep, (uchar**) &opt_sleep, 0, GET_INT, REQUIRED_ARG, -1, 0, 0,
0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
- (gptr*) &unix_sock, (gptr*) &unix_sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ (uchar**) &unix_sock, (uchar**) &unix_sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"sp-protocol", OPT_SP_PROTOCOL, "Use stored procedures for select",
- (gptr*) &sp_protocol, (gptr*) &sp_protocol, 0,
+ (uchar**) &sp_protocol, (uchar**) &sp_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#include "sslopt-longopts.h"
{"test-file", 'x', "Read test from/in this file (default stdin).",
@@ -4310,14 +4311,14 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't', "Temporary directory where sockets are put.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"user", 'u', "User for login.", (gptr*) &opt_user, (gptr*) &opt_user, 0,
+ {"user", 'u', "User for login.", (uchar**) &opt_user, (uchar**) &opt_user, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"verbose", 'v', "Write more.", (gptr*) &verbose, (gptr*) &verbose, 0,
+ {"verbose", 'v', "Write more.", (uchar**) &verbose, (uchar**) &verbose, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"view-protocol", OPT_VIEW_PROTOCOL, "Use views for select",
- (gptr*) &view_protocol, (gptr*) &view_protocol, 0,
+ (uchar**) &view_protocol, (uchar**) &view_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -4533,7 +4534,7 @@ void str_to_file2(const char *fname, char *str, int size, my_bool append)
die("Could not open %s: errno = %d", buff, errno);
if (append && my_seek(fd, 0, SEEK_END, MYF(0)) == MY_FILEPOS_ERROR)
die("Could not find end of file %s: errno = %d", buff, errno);
- if (my_write(fd, (byte*)str, size, MYF(MY_WME|MY_FNABP)))
+ if (my_write(fd, (uchar*)str, size, MYF(MY_WME|MY_FNABP)))
die("write failed");
my_close(fd, MYF(0));
}
@@ -4650,7 +4651,7 @@ void init_win_path_patterns()
continue;
}
- if (insert_dynamic(&patterns, (gptr) &p))
+ if (insert_dynamic(&patterns, (uchar*) &p))
die(NullS);
DBUG_PRINT("info", ("p: %s", p));
@@ -4670,7 +4671,7 @@ void free_win_path_patterns()
for (i=0 ; i < patterns.elements ; i++)
{
const char** pattern= dynamic_element(&patterns, i, const char**);
- my_free((gptr) *pattern, MYF(0));
+ my_free(*pattern, MYF(0));
}
delete_dynamic(&patterns);
}
@@ -4852,12 +4853,12 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
for (i= 0; i < num_fields; i++)
{
/* Free data for output */
- my_free((gptr)my_bind[i].buffer, MYF(MY_WME | MY_FAE));
+ my_free(my_bind[i].buffer, MYF(MY_WME | MY_FAE));
}
/* Free array with bind structs, lengths and NULL flags */
- my_free((gptr)my_bind , MYF(MY_WME | MY_FAE));
- my_free((gptr)length , MYF(MY_WME | MY_FAE));
- my_free((gptr)is_null , MYF(MY_WME | MY_FAE));
+ my_free(my_bind , MYF(MY_WME | MY_FAE));
+ my_free(length , MYF(MY_WME | MY_FAE));
+ my_free(is_null , MYF(MY_WME | MY_FAE));
}
@@ -6554,15 +6555,15 @@ void free_replace_column()
typedef struct st_pointer_array { /* when using array-strings */
TYPELIB typelib; /* Pointer to strings */
- byte *str; /* Strings is here */
+ uchar *str; /* Strings is here */
int7 *flag; /* Flag about each var. */
uint array_allocs,max_count,length,max_length;
} POINTER_ARRAY;
struct st_replace;
-struct st_replace *init_replace(my_string *from, my_string *to, uint count,
- my_string word_end_chars);
-int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name);
+struct st_replace *init_replace(char * *from, char * *to, uint count,
+ char * word_end_chars);
+int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name);
void replace_strings_append(struct st_replace *rep, DYNAMIC_STRING* ds,
const char *from, int len);
void free_pointer_array(POINTER_ARRAY *pa);
@@ -6626,7 +6627,7 @@ void free_replace()
DBUG_ENTER("free_replace");
if (glob_replace)
{
- my_free((char*) glob_replace,MYF(0));
+ my_free(glob_replace,MYF(0));
glob_replace=0;
}
DBUG_VOID_RETURN;
@@ -6837,7 +6838,7 @@ struct st_replace_regex* init_replace_regex(char* expr)
reg.icase= 1;
/* done parsing the statement, now place it in regex_arr */
- if (insert_dynamic(&res->regex_arr,(gptr) &reg))
+ if (insert_dynamic(&res->regex_arr,(uchar*) &reg))
die("Out of memory");
}
res->odd_buf_len= res->even_buf_len= 8192;
@@ -6848,7 +6849,7 @@ struct st_replace_regex* init_replace_regex(char* expr)
return res;
err:
- my_free((gptr)res,0);
+ my_free(res,0);
die("Error parsing replace_regex \"%s\"", expr);
return 0;
}
@@ -6889,7 +6890,7 @@ int multi_reg_replace(struct st_replace_regex* r,char* val)
struct st_regex re;
char* save_out_buf= out_buf;
- get_dynamic(&r->regex_arr,(gptr)&re,i);
+ get_dynamic(&r->regex_arr,(uchar*)&re,i);
if (!reg_replace(&out_buf, buf_len_p, re.pattern, re.replace,
in_buf, re.icase))
@@ -6942,7 +6943,7 @@ void free_replace_regex()
delete_dynamic(&glob_replace_regex->regex_arr);
my_free(glob_replace_regex->even_buf,MYF(MY_ALLOW_ZERO_PTR));
my_free(glob_replace_regex->odd_buf,MYF(MY_ALLOW_ZERO_PTR));
- my_free((char*) glob_replace_regex,MYF(0));
+ my_free(glob_replace_regex,MYF(0));
glob_replace_regex=0;
}
}
@@ -7137,7 +7138,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
str_p= str_end;
}
}
- my_free((gptr)subs, MYF(0));
+ my_free(subs, MYF(0));
my_regfree(&r);
*res_p= 0;
*buf_p= buf;
@@ -7197,13 +7198,13 @@ int get_next_bit(REP_SET *set,uint lastpos);
int find_set(REP_SETS *sets,REP_SET *find);
int find_found(FOUND_SET *found_set,uint table_offset,
int found_offset);
-uint start_at_word(my_string pos);
-uint end_of_word(my_string pos);
+uint start_at_word(char * pos);
+uint end_of_word(char * pos);
static uint found_sets=0;
-uint replace_len(my_string str)
+uint replace_len(char * str)
{
uint len=0;
while (*str)
@@ -7218,8 +7219,8 @@ uint replace_len(my_string str)
/* Init a replace structure for further calls */
-REPLACE *init_replace(my_string *from, my_string *to,uint count,
- my_string word_end_chars)
+REPLACE *init_replace(char * *from, char * *to,uint count,
+ char * word_end_chars)
{
static const int SPACE_CHAR= 256;
static const int START_OF_LINE= 257;
@@ -7228,7 +7229,7 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count,
uint i,j,states,set_nr,len,result_len,max_length,found_end,bits_set,bit_nr;
int used_sets,chr,default_state;
char used_chars[LAST_CHAR_CODE],is_word_end[256];
- my_string pos,to_pos,*to_array;
+ char * pos, *to_pos, **to_array;
REP_SETS sets;
REP_SET *set,*start_states,*word_states,*new_set;
FOLLOWS *follow,*follow_ptr;
@@ -7273,7 +7274,7 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count,
if (!(follow=(FOLLOWS*) my_malloc((states+2)*sizeof(FOLLOWS),MYF(MY_WME))))
{
free_sets(&sets);
- my_free((gptr) found_set,MYF(0));
+ my_free(found_set,MYF(0));
DBUG_RETURN(0);
}
@@ -7464,12 +7465,12 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count,
if ((replace=(REPLACE*) my_malloc(sizeof(REPLACE)*(sets.count)+
sizeof(REPLACE_STRING)*(found_sets+1)+
- sizeof(my_string)*count+result_len,
+ sizeof(char *)*count+result_len,
MYF(MY_WME | MY_ZEROFILL))))
{
rep_str=(REPLACE_STRING*) (replace+sets.count);
- to_array=(my_string*) (rep_str+found_sets+1);
- to_pos=(my_string) (to_array+count);
+ to_array= (char **) (rep_str+found_sets+1);
+ to_pos=(char *) (to_array+count);
for (i=0 ; i < count ; i++)
{
to_array[i]=to_pos;
@@ -7495,9 +7496,9 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count,
replace[i].next[j]=(REPLACE*) (rep_str+(-sets.set[i].next[j]-1));
}
}
- my_free((gptr) follow,MYF(0));
+ my_free(follow,MYF(0));
free_sets(&sets);
- my_free((gptr) found_set,MYF(0));
+ my_free(found_set,MYF(0));
DBUG_PRINT("exit",("Replace table has %d states",sets.count));
DBUG_RETURN(replace);
}
@@ -7513,7 +7514,7 @@ int init_sets(REP_SETS *sets,uint states)
if (!(sets->bit_buffer=(uint*) my_malloc(sizeof(uint)*sets->size_of_bits*
SET_MALLOC_HUNC,MYF(MY_WME))))
{
- my_free((gptr) sets->set,MYF(0));
+ my_free(sets->set,MYF(0));
return 1;
}
return 0;
@@ -7545,13 +7546,13 @@ REP_SET *make_new_set(REP_SETS *sets)
return set;
}
count=sets->count+sets->invisible+SET_MALLOC_HUNC;
- if (!(set=(REP_SET*) my_realloc((gptr) sets->set_buffer,
+ if (!(set=(REP_SET*) my_realloc((uchar*) sets->set_buffer,
sizeof(REP_SET)*count,
MYF(MY_WME))))
return 0;
sets->set_buffer=set;
sets->set=set+sets->invisible;
- if (!(bit_buffer=(uint*) my_realloc((gptr) sets->bit_buffer,
+ if (!(bit_buffer=(uint*) my_realloc((uchar*) sets->bit_buffer,
(sizeof(uint)*sets->size_of_bits)*count,
MYF(MY_WME))))
return 0;
@@ -7574,8 +7575,8 @@ void free_last_set(REP_SETS *sets)
void free_sets(REP_SETS *sets)
{
- my_free((gptr)sets->set_buffer,MYF(0));
- my_free((gptr)sets->bit_buffer,MYF(0));
+ my_free(sets->set_buffer,MYF(0));
+ my_free(sets->bit_buffer,MYF(0));
return;
}
@@ -7602,13 +7603,13 @@ void or_bits(REP_SET *to,REP_SET *from)
void copy_bits(REP_SET *to,REP_SET *from)
{
- memcpy((byte*) to->bits,(byte*) from->bits,
+ memcpy((uchar*) to->bits,(uchar*) from->bits,
(size_t) (sizeof(uint) * to->size_of_bits));
}
int cmp_bits(REP_SET *set1,REP_SET *set2)
{
- return bcmp((byte*) set1->bits,(byte*) set2->bits,
+ return bcmp((uchar*) set1->bits,(uchar*) set2->bits,
sizeof(uint) * set1->size_of_bits);
}
@@ -7676,14 +7677,14 @@ int find_found(FOUND_SET *found_set,uint table_offset, int found_offset)
/* Return 1 if regexp starts with \b or ends with \b*/
-uint start_at_word(my_string pos)
+uint start_at_word(char * pos)
{
return (((!bcmp(pos,"\\b",2) && pos[2]) || !bcmp(pos,"\\^",2)) ? 1 : 0);
}
-uint end_of_word(my_string pos)
+uint end_of_word(char * pos)
{
- my_string end=strend(pos);
+ char * end=strend(pos);
return ((end > pos+2 && !bcmp(end-2,"\\b",2)) ||
(end >= pos+2 && !bcmp(end-2,"\\$",2))) ?
1 : 0;
@@ -7696,10 +7697,10 @@ uint end_of_word(my_string pos)
#define PC_MALLOC 256 /* Bytes for pointers */
#define PS_MALLOC 512 /* Bytes for data */
-int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
+int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
{
uint i,length,old_count;
- byte *new_pos;
+ uchar *new_pos;
const char **new_array;
DBUG_ENTER("insert_pointer_name");
@@ -7707,16 +7708,16 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
{
if (!(pa->typelib.type_names=(const char **)
my_malloc(((PC_MALLOC-MALLOC_OVERHEAD)/
- (sizeof(my_string)+sizeof(*pa->flag))*
- (sizeof(my_string)+sizeof(*pa->flag))),MYF(MY_WME))))
+ (sizeof(char *)+sizeof(*pa->flag))*
+ (sizeof(char *)+sizeof(*pa->flag))),MYF(MY_WME))))
DBUG_RETURN(-1);
- if (!(pa->str= (byte*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
+ if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
MYF(MY_WME))))
{
- my_free((gptr) pa->typelib.type_names,MYF(0));
+ my_free(pa->typelib.type_names,MYF(0));
DBUG_RETURN (-1);
}
- pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(byte*)+
+ pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+
sizeof(*pa->flag));
pa->flag= (int7*) (pa->typelib.type_names+pa->max_count);
pa->length=0;
@@ -7726,7 +7727,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
length=(uint) strlen(name)+1;
if (pa->length+length >= pa->max_length)
{
- if (!(new_pos= (byte*) my_realloc((gptr) pa->str,
+ if (!(new_pos= (uchar*) my_realloc((uchar*) pa->str,
(uint) (pa->max_length+PS_MALLOC),
MYF(MY_WME))))
DBUG_RETURN(1);
@@ -7745,17 +7746,17 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
int len;
pa->array_allocs++;
len=(PC_MALLOC*pa->array_allocs - MALLOC_OVERHEAD);
- if (!(new_array=(const char **) my_realloc((gptr) pa->typelib.type_names,
+ if (!(new_array=(const char **) my_realloc((uchar*) pa->typelib.type_names,
(uint) len/
- (sizeof(byte*)+sizeof(*pa->flag))*
- (sizeof(byte*)+sizeof(*pa->flag)),
+ (sizeof(uchar*)+sizeof(*pa->flag))*
+ (sizeof(uchar*)+sizeof(*pa->flag)),
MYF(MY_WME))))
DBUG_RETURN(1);
pa->typelib.type_names=new_array;
old_count=pa->max_count;
- pa->max_count=len/(sizeof(byte*) + sizeof(*pa->flag));
+ pa->max_count=len/(sizeof(uchar*) + sizeof(*pa->flag));
pa->flag= (int7*) (pa->typelib.type_names+pa->max_count);
- memcpy((byte*) pa->flag,(my_string) (pa->typelib.type_names+old_count),
+ memcpy((uchar*) pa->flag,(char *) (pa->typelib.type_names+old_count),
old_count*sizeof(*pa->flag));
}
pa->flag[pa->typelib.count]=0; /* Reset flag */
@@ -7774,9 +7775,9 @@ void free_pointer_array(POINTER_ARRAY *pa)
if (pa->typelib.count)
{
pa->typelib.count=0;
- my_free((gptr) pa->typelib.type_names,MYF(0));
+ my_free(pa->typelib.type_names,MYF(0));
pa->typelib.type_names=0;
- my_free((gptr) pa->str,MYF(0));
+ my_free(pa->str,MYF(0));
}
} /* free_pointer_array */
@@ -7873,7 +7874,7 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input)
*line_end= 0;
/* Insert pointer to the line in array */
- if (insert_dynamic(&lines, (gptr) &start))
+ if (insert_dynamic(&lines, (uchar*) &start))
die("Out of memory inserting lines to sort");
start= line_end+1;
diff --git a/client/readline.cc b/client/readline.cc
index ad42ed2ee10..7afdbc9531e 100644
--- a/client/readline.cc
+++ b/client/readline.cc
@@ -22,8 +22,8 @@
static bool init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,
ulong max_size);
-static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str);
-static uint fill_buffer(LINE_BUFFER *buffer);
+static bool init_line_buffer_from_string(LINE_BUFFER *buffer,char * str);
+static size_t fill_buffer(LINE_BUFFER *buffer);
static char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length);
@@ -35,7 +35,7 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
return 0;
if (init_line_buffer(line_buff,fileno(file),IO_SIZE,max_size))
{
- my_free((char*) line_buff,MYF(0));
+ my_free(line_buff,MYF(0));
return 0;
}
return line_buff;
@@ -62,13 +62,13 @@ void batch_readline_end(LINE_BUFFER *line_buff)
{
if (line_buff)
{
- my_free((gptr) line_buff->buffer,MYF(MY_ALLOW_ZERO_PTR));
- my_free((char*) line_buff,MYF(0));
+ my_free(line_buff->buffer,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(line_buff,MYF(0));
}
}
-LINE_BUFFER *batch_readline_command(LINE_BUFFER *line_buff, my_string str)
+LINE_BUFFER *batch_readline_command(LINE_BUFFER *line_buff, char * str)
{
if (!line_buff)
if (!(line_buff=(LINE_BUFFER*)
@@ -76,7 +76,7 @@ LINE_BUFFER *batch_readline_command(LINE_BUFFER *line_buff, my_string str)
return 0;
if (init_line_buffer_from_string(line_buff,str))
{
- my_free((char*) line_buff,MYF(0));
+ my_free(line_buff,MYF(0));
return 0;
}
return line_buff;
@@ -106,13 +106,13 @@ init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,ulong max_buffer)
several times. the resulting buffer will contain a
concatenation of all strings separated by spaces
*/
-static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str)
+static bool init_line_buffer_from_string(LINE_BUFFER *buffer,char * str)
{
uint old_length=(uint)(buffer->end - buffer->buffer);
uint length= (uint) strlen(str);
if (!(buffer->buffer= buffer->start_of_line= buffer->end_of_line=
- (char*)my_realloc(buffer->buffer, old_length+length+2,
- MYF(MY_FAE|MY_ALLOW_ZERO_PTR))))
+ (char*) my_realloc((uchar*) buffer->buffer, old_length+length+2,
+ MYF(MY_FAE|MY_ALLOW_ZERO_PTR))))
return 1;
buffer->end= buffer->buffer + old_length;
if (old_length)
@@ -133,9 +133,9 @@ static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str)
bytes read from disk.
*/
-static uint fill_buffer(LINE_BUFFER *buffer)
+static size_t fill_buffer(LINE_BUFFER *buffer)
{
- uint read_count;
+ size_t read_count;
uint bufbytes= (uint) (buffer->end - buffer->start_of_line);
if (buffer->eof)
@@ -166,11 +166,11 @@ static uint fill_buffer(LINE_BUFFER *buffer)
}
/* Read in new stuff. */
- if ((read_count= my_read(buffer->file, (byte*) buffer->end, read_count,
+ if ((read_count= my_read(buffer->file, (uchar*) buffer->end, read_count,
MYF(MY_WME))) == MY_FILE_ERROR)
- return read_count;
+ return (size_t) -1;
- DBUG_PRINT("fill_buff", ("Got %d bytes", read_count));
+ DBUG_PRINT("fill_buff", ("Got %lu bytes", (ulong) read_count));
/* Kludge to pretend every nonempty file ends with a newline. */
if (!read_count && bufbytes && buffer->end[-1] != '\n')
@@ -189,7 +189,7 @@ static uint fill_buffer(LINE_BUFFER *buffer)
char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length)
{
char *pos;
- uint length;
+ size_t length;
DBUG_ENTER("intern_read_line");
buffer->start_of_line=buffer->end_of_line;
@@ -202,7 +202,7 @@ char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length)
{
if ((uint) (pos - buffer->start_of_line) < buffer->max_size)
{
- if (!(length=fill_buffer(buffer)) || length == (uint) -1)
+ if (!(length=fill_buffer(buffer)) || length == (size_t) -1)
DBUG_RETURN(0);
continue;
}
diff --git a/client/sql_string.cc b/client/sql_string.cc
index 9d887ff031c..57a5df7ce96 100644
--- a/client/sql_string.cc
+++ b/client/sql_string.cc
@@ -32,7 +32,7 @@
required by the string function
*/
-extern gptr sql_alloc(unsigned size);
+extern void sql_alloc(size_t size);
extern void sql_element_free(void *ptr);
#include "sql_string.h"
@@ -506,7 +506,7 @@ bool String::append(FILE* file, uint32 arg_length, myf my_flags)
{
if (realloc(str_length+arg_length))
return TRUE;
- if (my_fread(file, (byte*) Ptr + str_length, arg_length, my_flags))
+ if (my_fread(file, (uchar*) Ptr + str_length, arg_length, my_flags))
{
shrink(str_length);
return TRUE;
@@ -520,7 +520,7 @@ bool String::append(IO_CACHE* file, uint32 arg_length)
{
if (realloc(str_length+arg_length))
return TRUE;
- if (my_b_read(file, (byte*) Ptr + str_length, arg_length))
+ if (my_b_read(file, (uchar*) Ptr + str_length, arg_length))
{
shrink(str_length);
return TRUE;
@@ -645,7 +645,7 @@ bool String::replace(uint32 offset,uint32 arg_length,
{
if (realloc(str_length+(uint32) diff))
return TRUE;
- bmove_upp(Ptr+str_length+diff,Ptr+str_length,
+ bmove_upp((uchar*) Ptr+str_length+diff, (uchar*) Ptr+str_length,
str_length-offset-arg_length);
}
if (to_length)
diff --git a/dbug/dbug.c b/dbug/dbug.c
index e482fd95073..83c9ea37de1 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -264,7 +264,7 @@ static BOOLEAN DoTrace(CODE_STATE *cs);
/* Test to see if file is writable */
#if !(!defined(HAVE_ACCESS) || defined(MSDOS))
-static BOOLEAN Writable(char *pathname);
+static BOOLEAN Writable(const char *pathname);
/* Change file owner and group */
static void ChangeOwner(CODE_STATE *cs, char *pathname);
/* Allocate memory for runtime support */
@@ -343,12 +343,12 @@ static CODE_STATE *code_state(void)
if (!(cs=(CODE_STATE *) tmp->dbug))
{
cs=(CODE_STATE*) DbugMalloc(sizeof(*cs));
- bzero((char*) cs,sizeof(*cs));
+ bzero((uchar*) cs,sizeof(*cs));
cs->process= db_process ? db_process : "dbug";
cs->func="?func";
cs->file="?file";
cs->stack=&init_settings;
- tmp->dbug=(gptr) cs;
+ tmp->dbug= (void*) cs;
}
}
return cs;
@@ -715,7 +715,7 @@ void _db_push_(const char *control)
void _db_set_init_(const char *control)
{
CODE_STATE tmp_cs;
- bzero((char*) &tmp_cs, sizeof(tmp_cs));
+ bzero((uchar*) &tmp_cs, sizeof(tmp_cs));
tmp_cs.stack= &init_settings;
_db_set_(&tmp_cs, control);
}
@@ -830,7 +830,7 @@ void _db_pop_()
} \
} while (0)
-int _db_explain_ (CODE_STATE *cs, char *buf, int len)
+int _db_explain_ (CODE_STATE *cs, char *buf, size_t len)
{
char *start=buf, *end=buf+len-4;
@@ -887,10 +887,10 @@ overflow:
* see _db_explain_
*/
-int _db_explain_init_(char *buf, int len)
+int _db_explain_init_(char *buf, size_t len)
{
CODE_STATE cs;
- bzero((char*) &cs,sizeof(cs));
+ bzero((uchar*) &cs,sizeof(cs));
cs.stack=&init_settings;
return _db_explain_(&cs, buf, len);
}
@@ -1083,7 +1083,7 @@ void _db_pargs_(uint _line_, const char *keyword)
CODE_STATE *cs=0;
get_code_state_or_return;
cs->u_line= _line_;
- cs->u_keyword= (char*) keyword;
+ cs->u_keyword= keyword;
}
@@ -1160,7 +1160,8 @@ void _db_doprnt_(const char *format,...)
* Is used to examine corrputed memory or arrays.
*/
-void _db_dump_(uint _line_, const char *keyword, const char *memory, uint length)
+void _db_dump_(uint _line_, const char *keyword,
+ const unsigned char *memory, size_t length)
{
int pos;
char dbuff[90];
@@ -1168,7 +1169,7 @@ void _db_dump_(uint _line_, const char *keyword, const char *memory, uint length
CODE_STATE *cs=0;
get_code_state_or_return;
- if (_db_keyword_(cs, (char*) keyword))
+ if (_db_keyword_(cs, keyword))
{
if (!cs->locked)
pthread_mutex_lock(&THR_LOCK_dbug);
@@ -1182,7 +1183,7 @@ void _db_dump_(uint _line_, const char *keyword, const char *memory, uint length
{
fprintf(cs->stack->out_file, "%s: ", cs->func);
}
- sprintf(dbuff,"%s: Memory: 0x%lx Bytes: (%d)\n",
+ sprintf(dbuff,"%s: Memory: 0x%lx Bytes: (%ld)\n",
keyword,(ulong) memory, length);
(void) fputs(dbuff,cs->stack->out_file);
@@ -1292,7 +1293,7 @@ static struct link *ListDel(struct link *head,
{
struct link *delme=*cur;
*cur=(*cur)->next_link;
- free((char*)delme);
+ free((void*) delme);
}
} while (*cur && *(cur=&((*cur)->next_link)));
}
@@ -1451,7 +1452,7 @@ static void FreeState(CODE_STATE *cs, struct settings *state, int free_state)
if (state->prof_file)
DBUGCloseFile(cs, state->prof_file);
if (free_state)
- free((char *) state);
+ free((void*) state);
}
@@ -1696,7 +1697,7 @@ static void FreeList(struct link *linkp)
{
old= linkp;
linkp= linkp->next_link;
- free((char *) old);
+ free((void*) old);
}
}
@@ -1815,7 +1816,7 @@ static void DBUGOpenFile(CODE_STATE *cs,
}
else
{
- if (!Writable((char*)name))
+ if (!Writable(name))
{
(void) fprintf(stderr, ERR_OPEN, cs->process, name);
perror("");
@@ -1988,7 +1989,7 @@ static char *DbugMalloc(size_t size)
{
register char *new_malloc;
- if (!(new_malloc= (char*) malloc((size_t) size)))
+ if (!(new_malloc= (char*) malloc(size)))
DbugExit("out of memory");
return new_malloc;
}
@@ -2062,7 +2063,7 @@ static const char *BaseName(const char *pathname)
#ifndef Writable
-static BOOLEAN Writable(char *pathname)
+static BOOLEAN Writable(const char *pathname)
{
REGISTER BOOLEAN granted;
REGISTER char *lastslash;
diff --git a/extra/comp_err.c b/extra/comp_err.c
index 3f7664405ad..6902d63dbc8 100644
--- a/extra/comp_err.c
+++ b/extra/comp_err.c
@@ -99,31 +99,31 @@ static struct my_option my_long_options[]=
{"debug", '#', "This is a non-debug version. Catch this and exit",
0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
- {"debug", '#', "Output debug log", (gptr *) & default_dbug_option,
- (gptr *) & default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log", (uchar**) & default_dbug_option,
+ (uchar**) & default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"debug-info", 'T', "Print some debug info at exit.", (gptr *) & info_flag,
- (gptr *) & info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug-info", 'T', "Print some debug info at exit.", (uchar**) & info_flag,
+ (uchar**) & info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Prints version", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"charset", 'C', "Charset dir", (gptr *) & charsets_dir,
- (gptr *) & charsets_dir,
+ {"charset", 'C', "Charset dir", (uchar**) & charsets_dir,
+ (uchar**) & charsets_dir,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"in_file", 'F', "Input file", (gptr *) & TXTFILE, (gptr *) & TXTFILE,
+ {"in_file", 'F', "Input file", (uchar**) & TXTFILE, (uchar**) & TXTFILE,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"out_dir", 'D', "Output base directory", (gptr *) & DATADIRECTORY,
- (gptr *) & DATADIRECTORY,
+ {"out_dir", 'D', "Output base directory", (uchar**) & DATADIRECTORY,
+ (uchar**) & DATADIRECTORY,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"out_file", 'O', "Output filename (errmsg.sys)", (gptr *) & OUTFILE,
- (gptr *) & OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"header_file", 'H', "mysqld_error.h file ", (gptr *) & HEADERFILE,
- (gptr *) & HEADERFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"name_file", 'N', "mysqld_ername.h file ", (gptr *) & NAMEFILE,
- (gptr *) & NAMEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"state_file", 'S', "sql_state.h file", (gptr *) & STATEFILE,
- (gptr *) & STATEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"out_file", 'O', "Output filename (errmsg.sys)", (uchar**) & OUTFILE,
+ (uchar**) & OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"header_file", 'H', "mysqld_error.h file ", (uchar**) & HEADERFILE,
+ (uchar**) & HEADERFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"name_file", 'N', "mysqld_ername.h file ", (uchar**) & NAMEFILE,
+ (uchar**) & NAMEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"state_file", 'S', "sql_state.h file", (uchar**) & STATEFILE,
+ (uchar**) & STATEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -329,21 +329,21 @@ static int create_sys_files(struct languages *lang_head,
/* continue with header of the errmsg.sys file */
length= ftell(to) - HEADER_LENGTH - row_count * 2;
- bzero((gptr) head, HEADER_LENGTH);
- bmove((byte *) head, (byte *) file_head, 4);
+ bzero((uchar*) head, HEADER_LENGTH);
+ bmove((uchar *) head, (uchar *) file_head, 4);
head[4]= 1;
int2store(head + 6, length);
int2store(head + 8, row_count);
head[30]= csnum;
my_fseek(to, 0l, MY_SEEK_SET, MYF(0));
- if (my_fwrite(to, (byte*) head, HEADER_LENGTH, MYF(MY_WME | MY_FNABP)))
+ if (my_fwrite(to, (uchar*) head, HEADER_LENGTH, MYF(MY_WME | MY_FNABP)))
goto err;
for (i= 0; i < row_count; i++)
{
int2store(head, file_pos[i]);
- if (my_fwrite(to, (byte*) head, 2, MYF(MY_WME | MY_FNABP)))
+ if (my_fwrite(to, (uchar*) head, 2, MYF(MY_WME | MY_FNABP)))
goto err;
}
my_fclose(to, MYF(0));
@@ -362,7 +362,7 @@ static void clean_up(struct languages *lang_head, struct errors *error_head)
struct errors *tmp_error, *next_error;
uint count, i;
- my_free((gptr) default_language, MYF(0));
+ my_free((uchar*) default_language, MYF(0));
for (tmp_lang= lang_head; tmp_lang; tmp_lang= next_language)
{
@@ -370,7 +370,7 @@ static void clean_up(struct languages *lang_head, struct errors *error_head)
my_free(tmp_lang->lang_short_name, MYF(0));
my_free(tmp_lang->lang_long_name, MYF(0));
my_free(tmp_lang->charset, MYF(0));
- my_free((gptr) tmp_lang, MYF(0));
+ my_free((uchar*) tmp_lang, MYF(0));
}
for (tmp_error= error_head; tmp_error; tmp_error= next_error)
@@ -381,17 +381,17 @@ static void clean_up(struct languages *lang_head, struct errors *error_head)
{
struct message *tmp;
tmp= dynamic_element(&tmp_error->msg, i, struct message*);
- my_free((gptr) tmp->lang_short_name, MYF(0));
- my_free((gptr) tmp->text, MYF(0));
+ my_free((uchar*) tmp->lang_short_name, MYF(0));
+ my_free((uchar*) tmp->text, MYF(0));
}
delete_dynamic(&tmp_error->msg);
if (tmp_error->sql_code1[0])
- my_free((gptr) tmp_error->sql_code1, MYF(0));
+ my_free((uchar*) tmp_error->sql_code1, MYF(0));
if (tmp_error->sql_code2[0])
- my_free((gptr) tmp_error->sql_code2, MYF(0));
- my_free((gptr) tmp_error->er_name, MYF(0));
- my_free((gptr) tmp_error, MYF(0));
+ my_free((uchar*) tmp_error->sql_code2, MYF(0));
+ my_free((uchar*) tmp_error->er_name, MYF(0));
+ my_free((uchar*) tmp_error, MYF(0));
}
}
@@ -471,7 +471,7 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
current_error->er_name, current_message.lang_short_name);
DBUG_RETURN(0);
}
- if (insert_dynamic(&current_error->msg, (byte *) & current_message))
+ if (insert_dynamic(&current_error->msg, (uchar *) & current_message))
DBUG_RETURN(0);
continue;
}
@@ -534,7 +534,7 @@ static uint parse_error_offset(char *str)
end= 0;
ioffset= (uint) my_strtoll10(soffset, &end, &error);
- my_free((gptr) soffset, MYF(0));
+ my_free((uchar*) soffset, MYF(0));
DBUG_RETURN(ioffset);
}
diff --git a/extra/innochecksum.c b/extra/innochecksum.c
index 33f925a4cad..524637a1729 100644
--- a/extra/innochecksum.c
+++ b/extra/innochecksum.c
@@ -51,10 +51,10 @@
/* another argument to specify page ranges... seek to right spot and go from there */
typedef unsigned long int ulint;
-typedef unsigned char byte;
+typedef unsigned char uchar;
/* innodb function in name; modified slightly to not have the ASM version (lots of #ifs that didn't apply) */
-ulint mach_read_from_4(byte *b)
+ulint mach_read_from_4(uchar *b)
{
return( ((ulint)(b[0]) << 24)
+ ((ulint)(b[1]) << 16)
@@ -78,7 +78,7 @@ ulint
ut_fold_binary(
/*===========*/
/* out: folded value */
- byte* str, /* in: string of bytes */
+ uchar* str, /* in: string of bytes */
ulint len) /* in: length */
{
ulint i;
@@ -98,7 +98,7 @@ ulint
buf_calc_page_new_checksum(
/*=======================*/
/* out: checksum */
- byte* page) /* in: buffer page */
+ uchar* page) /* in: buffer page */
{
ulint checksum;
@@ -123,7 +123,7 @@ ulint
buf_calc_page_old_checksum(
/*=======================*/
/* out: checksum */
- byte* page) /* in: buffer page */
+ uchar* page) /* in: buffer page */
{
ulint checksum;
@@ -138,7 +138,7 @@ buf_calc_page_old_checksum(
int main(int argc, char **argv)
{
FILE *f; /* our input file */
- byte *p; /* storage of pages read */
+ uchar *p; /* storage of pages read */
int bytes; /* bytes read count */
ulint ct; /* current page number (0 based) */
int now; /* current time */
@@ -256,7 +256,7 @@ int main(int argc, char **argv)
}
/* allocate buffer for reading (so we don't realloc every time) */
- p= (byte *)malloc(UNIV_PAGE_SIZE);
+ p= (uchar *)malloc(UNIV_PAGE_SIZE);
/* main checksumming loop */
ct= start_page;
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c
index f5f7e68c9e6..06f7e51c380 100644
--- a/extra/my_print_defaults.c
+++ b/extra/my_print_defaults.c
@@ -47,30 +47,30 @@ static struct my_option my_long_options[] =
added if the file has no extension)
*/
{"config-file", 'c', "Deprecated, please use --defaults-file instead. Name of config file to read; if no extension is given, default extension (e.g., .ini or .cnf) will be added",
- (gptr*) &config_file, (gptr*) &config_file, 0, GET_STR, REQUIRED_ARG,
+ (uchar**) &config_file, (uchar**) &config_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
- {"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
- (gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
+ (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"defaults-file", 'c', "Like --config-file, except: if first option, then read this file only, do not read global or per-user config files; should be the first option",
- (gptr*) &config_file, (gptr*) &config_file, 0, GET_STR, REQUIRED_ARG,
+ (uchar**) &config_file, (uchar**) &config_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"defaults-extra-file", 'e',
"Read this file after the global config file and before the config file in the users home directory; should be the first option",
- (gptr*) &my_defaults_extra_file, (gptr*) &my_defaults_extra_file, 0,
+ (uchar**) &my_defaults_extra_file, (uchar**) &my_defaults_extra_file, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"defaults-group-suffix", 'g',
"In addition to the given groups, read also groups with this suffix",
- (gptr*) &my_defaults_group_suffix, (gptr*) &my_defaults_group_suffix,
+ (uchar**) &my_defaults_group_suffix, (uchar**) &my_defaults_group_suffix,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extra-file", 'e',
"Deprecated. Synonym for --defaults-extra-file.",
- (gptr*) &my_defaults_extra_file,
- (gptr*) &my_defaults_extra_file, 0, GET_STR,
+ (uchar**) &my_defaults_extra_file,
+ (uchar**) &my_defaults_extra_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"no-defaults", 'n', "Return an empty string (useful for scripts).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/extra/mysql_waitpid.c b/extra/mysql_waitpid.c
index a166e6b15af..42465998862 100644
--- a/extra/mysql_waitpid.c
+++ b/extra/mysql_waitpid.c
@@ -38,7 +38,7 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0},
{"verbose", 'v',
"Be more verbose. Give a warning, if kill can't handle signal 0.",
- (gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Print version information and exit.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
diff --git a/extra/perror.c b/extra/perror.c
index c49869be681..9b87bfa3d2a 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -41,18 +41,18 @@ static struct my_option my_long_options[] =
{"info", 'I', "Synonym for --help.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
- {"ndb", 257, "Ndbcluster storage engine specific error codes.", (gptr*) &ndb_code,
- (gptr*) &ndb_code, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"ndb", 257, "Ndbcluster storage engine specific error codes.", (uchar**) &ndb_code,
+ (uchar**) &ndb_code, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
#ifdef HAVE_SYS_ERRLIST
{"all", 'a', "Print all the error messages and the number.",
- (gptr*) &print_all_codes, (gptr*) &print_all_codes, 0, GET_BOOL, NO_ARG,
+ (uchar**) &print_all_codes, (uchar**) &print_all_codes, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Only print the error message.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"verbose", 'v', "Print error code and message (default).", (gptr*) &verbose,
- (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ {"verbose", 'v', "Print error code and message (default).", (uchar**) &verbose,
+ (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"version", 'V', "Displays version information and exits.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
diff --git a/extra/replace.c b/extra/replace.c
index de0a4b05764..f7112403b06 100644
--- a/extra/replace.c
+++ b/extra/replace.c
@@ -51,7 +51,7 @@
typedef struct st_pointer_array { /* when using array-strings */
TYPELIB typelib; /* Pointer to strings */
- byte *str; /* Strings is here */
+ uchar *str; /* Strings is here */
int7 *flag; /* Flag about each var. */
uint array_allocs,max_count,length,max_length;
} POINTER_ARRAY;
@@ -83,14 +83,14 @@ static int static_get_options(int *argc,char * * *argv);
static int get_replace_strings(int *argc,char * * *argv,
POINTER_ARRAY *from_array,
POINTER_ARRAY *to_array);
-static int insert_pointer_name(POINTER_ARRAY *pa, my_string name);
+static int insert_pointer_name(POINTER_ARRAY *pa, char * name);
static void free_pointer_array(POINTER_ARRAY *pa);
static int convert_pipe(REPLACE *,FILE *,FILE *);
-static int convert_file(REPLACE *, my_string);
-static REPLACE *init_replace(my_string *from, my_string *to,uint count,
- my_string word_end_chars);
-static uint replace_strings(REPLACE *rep, my_string *start,uint *max_length,
- my_string from);
+static int convert_file(REPLACE *, char *);
+static REPLACE *init_replace(char * *from, char * *to,uint count,
+ char * word_end_chars);
+static uint replace_strings(REPLACE *rep, char * *start,uint *max_length,
+ char * from);
static int initialize_buffer(void);
static void reset_buffer(void);
static void free_buffer(void);
@@ -245,10 +245,10 @@ POINTER_ARRAY *from_array,*to_array;
return 0;
}
-static int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
+static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
{
uint i,length,old_count;
- byte *new_pos;
+ uchar *new_pos;
const char **new_array;
DBUG_ENTER("insert_pointer_name");
@@ -256,16 +256,16 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
{
if (!(pa->typelib.type_names=(const char **)
my_malloc(((PC_MALLOC-MALLOC_OVERHEAD)/
- (sizeof(my_string)+sizeof(*pa->flag))*
- (sizeof(my_string)+sizeof(*pa->flag))),MYF(MY_WME))))
+ (sizeof(char *)+sizeof(*pa->flag))*
+ (sizeof(char *)+sizeof(*pa->flag))),MYF(MY_WME))))
DBUG_RETURN(-1);
- if (!(pa->str= (byte*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
+ if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
MYF(MY_WME))))
{
- my_free((gptr) pa->typelib.type_names,MYF(0));
+ my_free((uchar*) pa->typelib.type_names,MYF(0));
DBUG_RETURN (-1);
}
- pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(byte*)+
+ pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+
sizeof(*pa->flag));
pa->flag= (int7*) (pa->typelib.type_names+pa->max_count);
pa->length=0;
@@ -277,7 +277,7 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
{
pa->max_length=(pa->length+length+MALLOC_OVERHEAD+PS_MALLOC-1)/PS_MALLOC;
pa->max_length=pa->max_length*PS_MALLOC-MALLOC_OVERHEAD;
- if (!(new_pos= (byte*) my_realloc((gptr) pa->str,
+ if (!(new_pos= (uchar*) my_realloc((uchar*) pa->str,
(uint) pa->max_length,
MYF(MY_WME))))
DBUG_RETURN(1);
@@ -295,17 +295,17 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
int len;
pa->array_allocs++;
len=(PC_MALLOC*pa->array_allocs - MALLOC_OVERHEAD);
- if (!(new_array=(const char **) my_realloc((gptr) pa->typelib.type_names,
+ if (!(new_array=(const char **) my_realloc((uchar*) pa->typelib.type_names,
(uint) len/
- (sizeof(byte*)+sizeof(*pa->flag))*
- (sizeof(byte*)+sizeof(*pa->flag)),
+ (sizeof(uchar*)+sizeof(*pa->flag))*
+ (sizeof(uchar*)+sizeof(*pa->flag)),
MYF(MY_WME))))
DBUG_RETURN(1);
pa->typelib.type_names=new_array;
old_count=pa->max_count;
- pa->max_count=len/(sizeof(byte*) + sizeof(*pa->flag));
+ pa->max_count=len/(sizeof(uchar*) + sizeof(*pa->flag));
pa->flag= (int7*) (pa->typelib.type_names+pa->max_count);
- memcpy((byte*) pa->flag,(my_string) (pa->typelib.type_names+old_count),
+ memcpy((uchar*) pa->flag,(char *) (pa->typelib.type_names+old_count),
old_count*sizeof(*pa->flag));
}
pa->flag[pa->typelib.count]=0; /* Reset flag */
@@ -324,9 +324,9 @@ static void free_pointer_array(reg1 POINTER_ARRAY *pa)
if (pa->typelib.count)
{
pa->typelib.count=0;
- my_free((gptr) pa->typelib.type_names,MYF(0));
+ my_free((uchar*) pa->typelib.type_names,MYF(0));
pa->typelib.type_names=0;
- my_free((gptr) pa->str,MYF(0));
+ my_free((uchar*) pa->str,MYF(0));
}
return;
} /* free_pointer_array */
@@ -380,23 +380,23 @@ static int get_next_bit(REP_SET *set,uint lastpos);
static short find_set(REP_SETS *sets,REP_SET *find);
static short find_found(FOUND_SET *found_set,uint table_offset,
int found_offset);
-static uint start_at_word(my_string pos);
-static uint end_of_word(my_string pos);
-static uint replace_len(my_string pos);
+static uint start_at_word(char * pos);
+static uint end_of_word(char * pos);
+static uint replace_len(char * pos);
static uint found_sets=0;
/* Init a replace structure for further calls */
-static REPLACE *init_replace(my_string *from, my_string *to,uint count,
- my_string word_end_chars)
+static REPLACE *init_replace(char * *from, char * *to,uint count,
+ char * word_end_chars)
{
uint i,j,states,set_nr,len,result_len,max_length,found_end,bits_set,bit_nr;
int used_sets,chr;
short default_state;
char used_chars[LAST_CHAR_CODE],is_word_end[256];
- my_string pos,to_pos,*to_array;
+ char * pos, *to_pos, **to_array;
REP_SETS sets;
REP_SET *set,*start_states,*word_states,*new_set;
FOLLOWS *follow,*follow_ptr;
@@ -441,7 +441,7 @@ static REPLACE *init_replace(my_string *from, my_string *to,uint count,
if (!(follow=(FOLLOWS*) my_malloc((states+2)*sizeof(FOLLOWS),MYF(MY_WME))))
{
free_sets(&sets);
- my_free((gptr) found_set,MYF(0));
+ my_free((uchar*) found_set,MYF(0));
DBUG_RETURN(0);
}
@@ -632,12 +632,12 @@ static REPLACE *init_replace(my_string *from, my_string *to,uint count,
if ((replace=(REPLACE*) my_malloc(sizeof(REPLACE)*(sets.count)+
sizeof(REPLACE_STRING)*(found_sets+1)+
- sizeof(my_string)*count+result_len,
+ sizeof(char *)*count+result_len,
MYF(MY_WME | MY_ZEROFILL))))
{
rep_str=(REPLACE_STRING*) (replace+sets.count);
- to_array=(my_string*) (rep_str+found_sets+1);
- to_pos=(my_string) (to_array+count);
+ to_array=(char **) (rep_str+found_sets+1);
+ to_pos=(char *) (to_array+count);
for (i=0 ; i < count ; i++)
{
to_array[i]=to_pos;
@@ -663,9 +663,9 @@ static REPLACE *init_replace(my_string *from, my_string *to,uint count,
replace[i].next[j]=(REPLACE*) (rep_str+(-sets.set[i].next[j]-1));
}
}
- my_free((gptr) follow,MYF(0));
+ my_free((uchar*) follow,MYF(0));
free_sets(&sets);
- my_free((gptr) found_set,MYF(0));
+ my_free((uchar*) found_set,MYF(0));
DBUG_PRINT("exit",("Replace table has %d states",sets.count));
DBUG_RETURN(replace);
}
@@ -681,7 +681,7 @@ static int init_sets(REP_SETS *sets,uint states)
if (!(sets->bit_buffer=(uint*) my_malloc(sizeof(uint)*sets->size_of_bits*
SET_MALLOC_HUNC,MYF(MY_WME))))
{
- my_free((gptr) sets->set,MYF(0));
+ my_free((uchar*) sets->set,MYF(0));
return 1;
}
return 0;
@@ -713,13 +713,13 @@ static REP_SET *make_new_set(REP_SETS *sets)
return set;
}
count=sets->count+sets->invisible+SET_MALLOC_HUNC;
- if (!(set=(REP_SET*) my_realloc((gptr) sets->set_buffer,
+ if (!(set=(REP_SET*) my_realloc((uchar*) sets->set_buffer,
sizeof(REP_SET)*count,
MYF(MY_WME))))
return 0;
sets->set_buffer=set;
sets->set=set+sets->invisible;
- if (!(bit_buffer=(uint*) my_realloc((gptr) sets->bit_buffer,
+ if (!(bit_buffer=(uint*) my_realloc((uchar*) sets->bit_buffer,
(sizeof(uint)*sets->size_of_bits)*count,
MYF(MY_WME))))
return 0;
@@ -742,8 +742,8 @@ static void free_last_set(REP_SETS *sets)
static void free_sets(REP_SETS *sets)
{
- my_free((gptr)sets->set_buffer,MYF(0));
- my_free((gptr)sets->bit_buffer,MYF(0));
+ my_free((uchar*)sets->set_buffer,MYF(0));
+ my_free((uchar*)sets->bit_buffer,MYF(0));
return;
}
@@ -770,13 +770,13 @@ static void or_bits(REP_SET *to,REP_SET *from)
static void copy_bits(REP_SET *to,REP_SET *from)
{
- memcpy((byte*) to->bits,(byte*) from->bits,
+ memcpy((uchar*) to->bits,(uchar*) from->bits,
(size_t) (sizeof(uint) * to->size_of_bits));
}
static int cmp_bits(REP_SET *set1,REP_SET *set2)
{
- return bcmp((byte*) set1->bits,(byte*) set2->bits,
+ return bcmp((uchar*) set1->bits,(uchar*) set2->bits,
sizeof(uint) * set1->size_of_bits);
}
@@ -847,21 +847,21 @@ static short find_found(FOUND_SET *found_set,uint table_offset,
/* Return 1 if regexp starts with \b or ends with \b*/
-static uint start_at_word(my_string pos)
+static uint start_at_word(char * pos)
{
return (((!bcmp(pos,"\\b",2) && pos[2]) || !bcmp(pos,"\\^",2)) ? 1 : 0);
}
-static uint end_of_word(my_string pos)
+static uint end_of_word(char * pos)
{
- my_string end=strend(pos);
+ char * end=strend(pos);
return ((end > pos+2 && !bcmp(end-2,"\\b",2)) ||
(end >= pos+2 && !bcmp(end-2,"\\$",2))) ?
1 : 0;
}
-static uint replace_len(my_string str)
+static uint replace_len(char * str)
{
uint len=0;
while (*str)
@@ -877,12 +877,12 @@ static uint replace_len(my_string str)
/* The actual loop */
-static uint replace_strings(REPLACE *rep, my_string *start,uint *max_length,
- my_string from)
+static uint replace_strings(REPLACE *rep, char **start, uint *max_length,
+ char *from)
{
reg1 REPLACE *rep_pos;
reg2 REPLACE_STRING *rep_str;
- my_string to,end,pos,new;
+ char *to, *end, *pos, *new;
end=(to= *start) + *max_length-1;
rep_pos=rep+1;
@@ -903,7 +903,7 @@ static uint replace_strings(REPLACE *rep, my_string *start,uint *max_length,
}
if (!(rep_str = ((REPLACE_STRING*) rep_pos))->replace_string)
return (uint) (to - *start)-1;
- updated=1; /* Some my_string is replaced */
+ updated=1; /* Some char * is replaced */
to-=rep_str->to_offset;
for (pos=rep_str->replace_string; *pos ; pos++)
{
@@ -1047,7 +1047,7 @@ FILE *in,*out;
}
-static int convert_file(REPLACE *rep, my_string name)
+static int convert_file(REPLACE *rep, char * name)
{
int error;
FILE *in,*out;
@@ -1056,6 +1056,7 @@ static int convert_file(REPLACE *rep, my_string name)
char link_name[FN_REFLEN];
#endif
File temp_file;
+ size_t dir_buff_length;
DBUG_ENTER("convert_file");
/* check if name is a symlink */
@@ -1065,7 +1066,7 @@ static int convert_file(REPLACE *rep, my_string name)
#endif
if (!(in= my_fopen(org_name,O_RDONLY,MYF(MY_WME))))
DBUG_RETURN(1);
- dirname_part(dir_buff,org_name);
+ dirname_part(dir_buff, org_name, &dir_buff_length);
if ((temp_file= create_temp_file(tempname, dir_buff, "PR", O_WRONLY,
MYF(MY_WME))) < 0)
{
diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c
index 04ab8a30f0d..5606c17ecf3 100644
--- a/extra/resolve_stack_dump.c
+++ b/extra/resolve_stack_dump.c
@@ -53,10 +53,10 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"symbols-file", 's', "Use specified symbols file.", (gptr*) &sym_fname,
- (gptr*) &sym_fname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"symbols-file", 's', "Use specified symbols file.", (uchar**) &sym_fname,
+ (uchar**) &sym_fname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"numeric-dump-file", 'n', "Read the dump from specified file.",
- (gptr*) &dump_fname, (gptr*) &dump_fname, 0, GET_STR, REQUIRED_ARG,
+ (uchar**) &dump_fname, (uchar**) &dump_fname, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -235,7 +235,7 @@ static void init_sym_table()
SYM_ENTRY se;
if (init_sym_entry(&se, buf))
continue;
- if (insert_dynamic(&sym_table, (gptr)&se))
+ if (insert_dynamic(&sym_table, (uchar*)&se))
die("insert_dynamic() failed - looks like we are out of memory");
}
@@ -255,7 +255,7 @@ static void verify_sort()
for (i = 0; i < sym_table.elements; i++)
{
SYM_ENTRY se;
- get_dynamic(&sym_table, (gptr)&se, i);
+ get_dynamic(&sym_table, (uchar*)&se, i);
if (se.addr < last)
die("sym table does not appear to be sorted, did you forget \
--numeric-sort arg to nm? trouble addr = %p, last = %p", se.addr, last);
@@ -267,16 +267,16 @@ static void verify_sort()
static SYM_ENTRY* resolve_addr(uchar* addr, SYM_ENTRY* se)
{
uint i;
- get_dynamic(&sym_table, (gptr)se, 0);
+ get_dynamic(&sym_table, (uchar*)se, 0);
if (addr < se->addr)
return 0;
for (i = 1; i < sym_table.elements; i++)
{
- get_dynamic(&sym_table, (gptr)se, i);
+ get_dynamic(&sym_table, (uchar*)se, i);
if (addr < se->addr)
{
- get_dynamic(&sym_table, (gptr)se, i - 1);
+ get_dynamic(&sym_table, (uchar*)se, i - 1);
return se;
}
}
diff --git a/extra/resolveip.c b/extra/resolveip.c
index 5bbecab5e6b..b61c0871aaf 100644
--- a/extra/resolveip.c
+++ b/extra/resolveip.c
@@ -43,7 +43,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"info", 'I', "Synonym for --help.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"silent", 's', "Be more silent.", (gptr*) &silent, (gptr*) &silent,
+ {"silent", 's', "Be more silent.", (uchar**) &silent, (uchar**) &silent,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Displays version information and exits.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -83,7 +83,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
return 0;
}
-/*static my_string load_default_groups[]= { "resolveip","client",0 }; */
+/*static char * load_default_groups[]= { "resolveip","client",0 }; */
static int get_options(int *argc,char ***argv)
{
diff --git a/include/config-win.h b/include/config-win.h
index 8d6f8885626..69c5b20a509 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -310,10 +310,10 @@ inline double ulonglong2double(ulonglong value)
#define doublestore(T,V) do { *((long *) T) = *((long*) &V); \
*(((long *) T)+1) = *(((long*) &V)+1); } while(0)
#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); }
-#define floatstore(T,V) memcpy((byte*)(T), (byte*)(&V), sizeof(float))
-#define floatget(V,M) memcpy((byte*)(&V), (byte*)(M), sizeof(float))
+#define floatstore(T,V) memcpy((uchar*)(T), (uchar*)(&V), sizeof(float))
+#define floatget(V,M) memcpy((uchar*)(&V), (uchar*)(M), sizeof(float))
#define float8get(V,M) doubleget((V),(M))
-#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
+#define float4store(V,M) memcpy((uchar*) V,(uchar*) (&M),sizeof(float))
#define float8store(V,M) doublestore((V),(M))
#endif /* _WIN64 */
diff --git a/include/decimal.h b/include/decimal.h
index c5385b58658..530ed9e1757 100644
--- a/include/decimal.h
+++ b/include/decimal.h
@@ -39,8 +39,8 @@ int longlong2decimal(longlong from, decimal_t *to);
int decimal2double(decimal_t *from, double *to);
int double2decimal(double from, decimal_t *to);
int decimal_actual_fraction(decimal_t *from);
-int decimal2bin(decimal_t *from, char *to, int precision, int scale);
-int bin2decimal(char *from, decimal_t *to, int precision, int scale);
+int decimal2bin(decimal_t *from, uchar *to, int precision, int scale);
+int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale);
int decimal_size(int precision, int scale);
int decimal_bin_size(int precision, int scale);
diff --git a/include/ft_global.h b/include/ft_global.h
index 6c3457541a5..752371d6bc6 100644
--- a/include/ft_global.h
+++ b/include/ft_global.h
@@ -32,7 +32,7 @@ typedef struct st_ft_info FT_INFO;
struct _ft_vft
{
int (*read_next)(FT_INFO *, char *);
- float (*find_relevance)(FT_INFO *, byte *, uint);
+ float (*find_relevance)(FT_INFO *, uchar *, uint);
void (*close_search)(FT_INFO *);
float (*get_relevance)(FT_INFO *);
void (*reinit_search)(FT_INFO *);
@@ -62,8 +62,8 @@ void ft_free_stopwords(void);
#define FT_SORTED 2
#define FT_EXPAND 4 /* query expansion */
-FT_INFO *ft_init_search(uint,void *, uint, byte *, uint,CHARSET_INFO *, byte *);
-my_bool ft_boolean_check_syntax_string(const byte *);
+FT_INFO *ft_init_search(uint,void *, uint, uchar *, uint,CHARSET_INFO *, uchar *);
+my_bool ft_boolean_check_syntax_string(const uchar *);
#ifdef __cplusplus
}
diff --git a/include/hash.h b/include/hash.h
index 97e947d7c6a..1cf231130bb 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -27,12 +27,13 @@ extern "C" {
*/
#define HASH_OVERHEAD (sizeof(char*)*2)
-typedef byte *(*hash_get_key)(const byte *,uint*,my_bool);
+typedef uchar *(*hash_get_key)(const uchar *,size_t*,my_bool);
typedef void (*hash_free_key)(void *);
typedef struct st_hash {
- uint key_offset,key_length; /* Length of key if const length */
- uint records, blength;
+ size_t key_offset,key_length; /* Length of key if const length */
+ size_t blength;
+ ulong records;
uint flags;
DYNAMIC_ARRAY array; /* Place for hash_keys */
hash_get_key get_key;
@@ -45,21 +46,21 @@ typedef uint HASH_SEARCH_STATE;
#define hash_init(A,B,C,D,E,F,G,H) _hash_init(A,B,C,D,E,F,G, H CALLER_INFO)
my_bool _hash_init(HASH *hash, CHARSET_INFO *charset,
- uint default_array_elements, uint key_offset,
- uint key_length, hash_get_key get_key,
+ ulong default_array_elements, size_t key_offset,
+ size_t key_length, hash_get_key get_key,
void (*free_element)(void*), uint flags CALLER_INFO_PROTO);
void hash_free(HASH *tree);
void my_hash_reset(HASH *hash);
-byte *hash_element(HASH *hash,uint idx);
-gptr hash_search(const HASH *info, const byte *key, uint length);
-gptr hash_first(const HASH *info, const byte *key, uint length,
+uchar *hash_element(HASH *hash,ulong idx);
+uchar *hash_search(const HASH *info, const uchar *key, size_t length);
+uchar *hash_first(const HASH *info, const uchar *key, size_t length,
HASH_SEARCH_STATE *state);
-gptr hash_next(const HASH *info, const byte *key, uint length,
- HASH_SEARCH_STATE *state);
-my_bool my_hash_insert(HASH *info,const byte *data);
-my_bool hash_delete(HASH *hash,byte *record);
-my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length);
-void hash_replace(HASH *hash, HASH_SEARCH_STATE *state, byte *new_row);
+uchar *hash_next(const HASH *info, const uchar *key, size_t length,
+ HASH_SEARCH_STATE *state);
+my_bool my_hash_insert(HASH *info,const uchar *data);
+my_bool hash_delete(HASH *hash,uchar *record);
+my_bool hash_update(HASH *hash,uchar *record,uchar *old_key,size_t old_key_length);
+void hash_replace(HASH *hash, HASH_SEARCH_STATE *state, uchar *new_row);
my_bool hash_check(HASH *hash); /* Only in debug library */
#define hash_clear(H) bzero((char*) (H),sizeof(*(H)))
diff --git a/include/heap.h b/include/heap.h
index 6cacb7fc529..d309fb4f162 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -57,7 +57,7 @@ typedef struct st_heapinfo /* Struct from heap_info */
typedef struct st_heap_ptrs
{
- byte *blocks[HP_PTRS_IN_NOD]; /* pointers to HP_PTRS or records */
+ uchar *blocks[HP_PTRS_IN_NOD]; /* pointers to HP_PTRS or records */
} HP_PTRS;
struct st_level_info
@@ -70,7 +70,7 @@ struct st_level_info
of last_blocks array. For level 0 - 1, for level 1 - HP_PTRS_IN_NOD, for
level 2 - HP_PTRS_IN_NOD^2 and so forth.
*/
- uint records_under_level;
+ ulong records_under_level;
/*
Ptr to last allocated HP_PTRS (or records buffer for level 0) on this
@@ -123,10 +123,10 @@ typedef struct st_hp_keydef /* Key definition with open */
ha_rows hash_buckets;
TREE rb_tree;
int (*write_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo,
- const byte *record, byte *recpos);
+ const uchar *record, uchar *recpos);
int (*delete_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo,
- const byte *record, byte *recpos, int flag);
- uint (*get_key_length)(struct st_hp_keydef *keydef, const byte *key);
+ const uchar *record, uchar *recpos, int flag);
+ uint (*get_key_length)(struct st_hp_keydef *keydef, const uchar *key);
} HP_KEYDEF;
typedef struct st_heap_share
@@ -144,8 +144,8 @@ typedef struct st_heap_share
uint keys,max_key_length;
uint currently_disabled_keys; /* saved value from "keys" when disabled */
uint open_count;
- byte *del_link; /* Link to next block with del. rec */
- my_string name; /* Name of "memory-file" */
+ uchar *del_link; /* Link to next block with del. rec */
+ char * name; /* Name of "memory-file" */
#ifdef THREAD
THR_LOCK lock;
pthread_mutex_t intern_lock; /* Locking for use with _locking */
@@ -162,14 +162,14 @@ struct st_hp_hash_info;
typedef struct st_heap_info
{
HP_SHARE *s;
- byte *current_ptr;
+ uchar *current_ptr;
struct st_hp_hash_info *current_hash_ptr;
ulong current_record,next_block;
int lastinx,errkey;
int mode; /* Mode of file (READONLY..) */
uint opt_flag,update;
- byte *lastkey; /* Last used key with rkey */
- byte *recbuf; /* Record buffer for rb-tree keys */
+ uchar *lastkey; /* Last used key with rkey */
+ uchar *recbuf; /* Record buffer for rb-tree keys */
enum ha_rkey_function last_find_flag;
TREE_ELEMENT *parents[MAX_TREE_HEIGHT+1];
TREE_ELEMENT **last_pos;
@@ -195,12 +195,12 @@ typedef struct st_heap_create_info
extern HP_INFO *heap_open(const char *name, int mode);
extern int heap_close(HP_INFO *info);
-extern int heap_write(HP_INFO *info,const byte *buff);
-extern int heap_update(HP_INFO *info,const byte *old,const byte *newdata);
-extern int heap_rrnd(HP_INFO *info,byte *buf,byte *pos);
+extern int heap_write(HP_INFO *info,const uchar *buff);
+extern int heap_update(HP_INFO *info,const uchar *old,const uchar *newdata);
+extern int heap_rrnd(HP_INFO *info,uchar *buf,uchar *pos);
extern int heap_scan_init(HP_INFO *info);
-extern int heap_scan(register HP_INFO *info, byte *record);
-extern int heap_delete(HP_INFO *info,const byte *buff);
+extern int heap_scan(register HP_INFO *info, uchar *record);
+extern int heap_delete(HP_INFO *info,const uchar *buff);
extern int heap_info(HP_INFO *info,HEAPINFO *x,int flag);
extern int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
uint reclength, ulong max_records, ulong min_records,
@@ -211,32 +211,32 @@ extern int heap_extra(HP_INFO *info,enum ha_extra_function function);
extern int heap_reset(HP_INFO *info);
extern int heap_rename(const char *old_name,const char *new_name);
extern int heap_panic(enum ha_panic_function flag);
-extern int heap_rsame(HP_INFO *info,byte *record,int inx);
-extern int heap_rnext(HP_INFO *info,byte *record);
-extern int heap_rprev(HP_INFO *info,byte *record);
-extern int heap_rfirst(HP_INFO *info,byte *record,int inx);
-extern int heap_rlast(HP_INFO *info,byte *record,int inx);
+extern int heap_rsame(HP_INFO *info,uchar *record,int inx);
+extern int heap_rnext(HP_INFO *info,uchar *record);
+extern int heap_rprev(HP_INFO *info,uchar *record);
+extern int heap_rfirst(HP_INFO *info,uchar *record,int inx);
+extern int heap_rlast(HP_INFO *info,uchar *record,int inx);
extern void heap_clear(HP_INFO *info);
extern void heap_clear_keys(HP_INFO *info);
extern int heap_disable_indexes(HP_INFO *info);
extern int heap_enable_indexes(HP_INFO *info);
extern int heap_indexes_are_disabled(HP_INFO *info);
-extern void heap_update_auto_increment(HP_INFO *info, const byte *record);
+extern void heap_update_auto_increment(HP_INFO *info, const uchar *record);
ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, key_range *min_key,
key_range *max_key);
int hp_panic(enum ha_panic_function flag);
-int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
+int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function find_flag);
-extern gptr heap_find(HP_INFO *info,int inx,const byte *key);
+extern uchar * heap_find(HP_INFO *info,int inx,const uchar *key);
extern int heap_check_heap(HP_INFO *info, my_bool print_status);
-extern byte *heap_position(HP_INFO *info);
+extern uchar *heap_position(HP_INFO *info);
/* The following is for programs that uses the old HEAP interface where
- pointer to rows where a long instead of a (byte*).
+ pointer to rows where a long instead of a (uchar*).
*/
#if defined(WANT_OLD_HEAP_VERSION) || defined(OLD_HEAP_VERSION)
-extern int heap_rrnd_old(HP_INFO *info,byte *buf,ulong pos);
+extern int heap_rrnd_old(HP_INFO *info,uchar *buf,ulong pos);
extern ulong heap_position_old(HP_INFO *info);
#endif
#ifdef OLD_HEAP_VERSION
@@ -244,7 +244,7 @@ typedef ulong HEAP_PTR;
#define heap_position(A) heap_position_old(A)
#define heap_rrnd(A,B,C) heap_rrnd_old(A,B,C)
#else
-typedef byte *HEAP_PTR;
+typedef uchar *HEAP_PTR;
#endif
#ifdef __cplusplus
diff --git a/include/keycache.h b/include/keycache.h
index dc763b8cc08..626b5a06f54 100644
--- a/include/keycache.h
+++ b/include/keycache.h
@@ -65,9 +65,9 @@ typedef struct st_key_cache
HASH_LINK **hash_root; /* arr. of entries into hash table buckets */
HASH_LINK *hash_link_root; /* memory for hash table links */
HASH_LINK *free_hash_list; /* list of free hash links */
- BLOCK_LINK *free_block_list; /* list of free blocks */
+ BLOCK_LINK *free_block_list; /* list of free blocks */
BLOCK_LINK *block_root; /* memory for block links */
- byte HUGE_PTR *block_mem; /* memory for block buffers */
+ uchar HUGE_PTR *block_mem; /* memory for block buffers */
BLOCK_LINK *used_last; /* ptr to the last block of the LRU chain */
BLOCK_LINK *used_ins; /* ptr to the insertion block in LRU chain */
pthread_mutex_t cache_lock; /* to lock access to the cache structure */
@@ -109,16 +109,16 @@ extern int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
uint age_threshold);
extern void change_key_cache_param(KEY_CACHE *keycache, uint division_limit,
uint age_threshold);
-extern byte *key_cache_read(KEY_CACHE *keycache,
+extern uchar *key_cache_read(KEY_CACHE *keycache,
File file, my_off_t filepos, int level,
- byte *buff, uint length,
+ uchar *buff, uint length,
uint block_length,int return_buffer);
extern int key_cache_insert(KEY_CACHE *keycache,
File file, my_off_t filepos, int level,
- byte *buff, uint length);
+ uchar *buff, uint length);
extern int key_cache_write(KEY_CACHE *keycache,
File file, my_off_t filepos, int level,
- byte *buff, uint length,
+ uchar *buff, uint length,
uint block_length,int force_write);
extern int flush_key_blocks(KEY_CACHE *keycache,
int file, enum flush_type type);
@@ -127,8 +127,8 @@ extern void end_key_cache(KEY_CACHE *keycache, my_bool cleanup);
/* Functions to handle multiple key caches */
extern my_bool multi_keycache_init(void);
extern void multi_keycache_free(void);
-extern KEY_CACHE *multi_key_cache_search(byte *key, uint length);
-extern my_bool multi_key_cache_set(const byte *key, uint length,
+extern KEY_CACHE *multi_key_cache_search(uchar *key, uint length);
+extern my_bool multi_key_cache_set(const uchar *key, uint length,
KEY_CACHE *key_cache);
extern void multi_key_cache_change(KEY_CACHE *old_data,
KEY_CACHE *new_data);
diff --git a/include/m_ctype.h b/include/m_ctype.h
index f2b49c63fe3..e5debc6e032 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -51,8 +51,8 @@ extern MY_UNICASE_INFO *my_unicase_turkish[256];
typedef struct uni_ctype_st
{
- unsigned char pctype;
- unsigned char *ctype;
+ uchar pctype;
+ uchar *ctype;
} MY_UNI_CTYPE;
extern MY_UNI_CTYPE my_uni_ctype[256];
@@ -125,22 +125,22 @@ struct charset_info_st;
/* See strings/CHARSET_INFO.txt for information about this structure */
typedef struct my_collation_handler_st
{
- my_bool (*init)(struct charset_info_st *, void *(*alloc)(uint));
+ my_bool (*init)(struct charset_info_st *, void *(*alloc)(size_t));
/* Collation routines */
int (*strnncoll)(struct charset_info_st *,
- const uchar *, uint, const uchar *, uint, my_bool);
+ const uchar *, size_t, const uchar *, size_t, my_bool);
int (*strnncollsp)(struct charset_info_st *,
- const uchar *, uint, const uchar *, uint,
+ const uchar *, size_t, const uchar *, size_t,
my_bool diff_if_only_endspace_difference);
- int (*strnxfrm)(struct charset_info_st *,
- uchar *, uint, const uchar *, uint);
- uint (*strnxfrmlen)(struct charset_info_st *, uint);
+ size_t (*strnxfrm)(struct charset_info_st *,
+ uchar *, size_t, const uchar *, size_t);
+ size_t (*strnxfrmlen)(struct charset_info_st *, size_t);
my_bool (*like_range)(struct charset_info_st *,
- const char *s, uint s_length,
+ const char *s, size_t s_length,
pchar w_prefix, pchar w_one, pchar w_many,
- uint res_length,
+ size_t res_length,
char *min_str, char *max_str,
- uint *min_len, uint *max_len);
+ size_t *min_len, size_t *max_len);
int (*wildcmp)(struct charset_info_st *,
const char *str,const char *str_end,
const char *wildstr,const char *wildend,
@@ -149,14 +149,14 @@ typedef struct my_collation_handler_st
int (*strcasecmp)(struct charset_info_st *, const char *, const char *);
uint (*instr)(struct charset_info_st *,
- const char *b, uint b_length,
- const char *s, uint s_length,
+ const char *b, size_t b_length,
+ const char *s, size_t s_length,
my_match_t *match, uint nmatch);
/* Hash calculation */
- void (*hash_sort)(struct charset_info_st *cs, const uchar *key, uint len,
+ void (*hash_sort)(struct charset_info_st *cs, const uchar *key, size_t len,
ulong *nr1, ulong *nr2);
- my_bool (*propagate)(struct charset_info_st *cs, const uchar *str, uint len);
+ my_bool (*propagate)(struct charset_info_st *cs, const uchar *str, size_t len);
} MY_COLLATION_HANDLER;
extern MY_COLLATION_HANDLER my_collation_mb_bin_handler;
@@ -168,64 +168,67 @@ extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler;
/* See strings/CHARSET_INFO.txt about information on this structure */
typedef struct my_charset_handler_st
{
- my_bool (*init)(struct charset_info_st *, void *(*alloc)(uint));
+ my_bool (*init)(struct charset_info_st *, void *(*alloc)(size_t));
/* Multibyte routines */
- int (*ismbchar)(struct charset_info_st *, const char *, const char *);
- int (*mbcharlen)(struct charset_info_st *, uint);
- uint (*numchars)(struct charset_info_st *, const char *b, const char *e);
- uint (*charpos)(struct charset_info_st *, const char *b, const char *e, uint pos);
- uint (*well_formed_len)(struct charset_info_st *,
+ uint (*ismbchar)(struct charset_info_st *, const char *, const char *);
+ uint (*mbcharlen)(struct charset_info_st *, uint c);
+ size_t (*numchars)(struct charset_info_st *, const char *b, const char *e);
+ size_t (*charpos)(struct charset_info_st *, const char *b, const char *e,
+ size_t pos);
+ size_t (*well_formed_len)(struct charset_info_st *,
const char *b,const char *e,
- uint nchars, int *error);
- uint (*lengthsp)(struct charset_info_st *, const char *ptr, uint length);
- uint (*numcells)(struct charset_info_st *, const char *b, const char *e);
+ size_t nchars, int *error);
+ size_t (*lengthsp)(struct charset_info_st *, const char *ptr, size_t length);
+ size_t (*numcells)(struct charset_info_st *, const char *b, const char *e);
/* Unicode conversion */
int (*mb_wc)(struct charset_info_st *cs,my_wc_t *wc,
- const unsigned char *s,const unsigned char *e);
+ const uchar *s,const uchar *e);
int (*wc_mb)(struct charset_info_st *cs,my_wc_t wc,
- unsigned char *s,unsigned char *e);
+ uchar *s,uchar *e);
/* CTYPE scanner */
int (*ctype)(struct charset_info_st *cs, int *ctype,
- const unsigned char *s, const unsigned char *e);
+ const uchar *s, const uchar *e);
/* Functions for case and sort conversion */
- uint (*caseup_str)(struct charset_info_st *, char *);
- uint (*casedn_str)(struct charset_info_st *, char *);
- uint (*caseup)(struct charset_info_st *, char *src, uint srclen,
- char *dst, uint dstlen);
- uint (*casedn)(struct charset_info_st *, char *src, uint srclen,
- char *dst, uint dstlen);
+ size_t (*caseup_str)(struct charset_info_st *, char *);
+ size_t (*casedn_str)(struct charset_info_st *, char *);
+ size_t (*caseup)(struct charset_info_st *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
+ size_t (*casedn)(struct charset_info_st *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
/* Charset dependant snprintf() */
- int (*snprintf)(struct charset_info_st *, char *to, uint n, const char *fmt,
- ...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5);
- int (*long10_to_str)(struct charset_info_st *, char *to, uint n, int radix,
- long int val);
- int (*longlong10_to_str)(struct charset_info_st *, char *to, uint n,
- int radix, longlong val);
+ size_t (*snprintf)(struct charset_info_st *, char *to, size_t n,
+ const char *fmt,
+ ...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5);
+ size_t (*long10_to_str)(struct charset_info_st *, char *to, size_t n,
+ int radix, long int val);
+ size_t (*longlong10_to_str)(struct charset_info_st *, char *to, size_t n,
+ int radix, longlong val);
- void (*fill)(struct charset_info_st *, char *to, uint len, int fill);
+ void (*fill)(struct charset_info_st *, char *to, size_t len, int fill);
/* String-to-number conversion routines */
- long (*strntol)(struct charset_info_st *, const char *s, uint l,
+ long (*strntol)(struct charset_info_st *, const char *s, size_t l,
int base, char **e, int *err);
- ulong (*strntoul)(struct charset_info_st *, const char *s, uint l,
+ ulong (*strntoul)(struct charset_info_st *, const char *s, size_t l,
int base, char **e, int *err);
- longlong (*strntoll)(struct charset_info_st *, const char *s, uint l,
+ longlong (*strntoll)(struct charset_info_st *, const char *s, size_t l,
int base, char **e, int *err);
- ulonglong (*strntoull)(struct charset_info_st *, const char *s, uint l,
+ ulonglong (*strntoull)(struct charset_info_st *, const char *s, size_t l,
int base, char **e, int *err);
- double (*strntod)(struct charset_info_st *, char *s, uint l, char **e,
+ double (*strntod)(struct charset_info_st *, char *s, size_t l, char **e,
int *err);
longlong (*strtoll10)(struct charset_info_st *cs,
const char *nptr, char **endptr, int *error);
ulonglong (*strntoull10rnd)(struct charset_info_st *cs,
- const char *str, uint length, int unsigned_fl,
+ const char *str, size_t length,
+ int unsigned_fl,
char **endptr, int *error);
- ulong (*scan)(struct charset_info_st *, const char *b, const char *e,
- int sq);
+ size_t (*scan)(struct charset_info_st *, const char *b, const char *e,
+ int sq);
} MY_CHARSET_HANDLER;
extern MY_CHARSET_HANDLER my_charset_8bit_handler;
@@ -302,35 +305,35 @@ extern CHARSET_INFO my_charset_cp1250_czech_ci;
extern CHARSET_INFO my_charset_filename;
/* declarations for simple charsets */
-extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *,
- uint);
-uint my_strnxfrmlen_simple(CHARSET_INFO *, uint);
-extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint,
- const uchar *, uint, my_bool);
-
-extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, uint,
- const uchar *, uint,
+extern size_t my_strnxfrm_simple(CHARSET_INFO *, uchar *, size_t,
+ const uchar *, size_t);
+size_t my_strnxfrmlen_simple(CHARSET_INFO *, size_t);
+extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, size_t,
+ const uchar *, size_t, my_bool);
+
+extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t,
+ const uchar *, size_t,
my_bool diff_if_only_endspace_difference);
extern void my_hash_sort_simple(CHARSET_INFO *cs,
- const uchar *key, uint len,
+ const uchar *key, size_t len,
ulong *nr1, ulong *nr2);
-extern uint my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, uint length);
+extern size_t my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, size_t length);
extern uint my_instr_simple(struct charset_info_st *,
- const char *b, uint b_length,
- const char *s, uint s_length,
+ const char *b, size_t b_length,
+ const char *s, size_t s_length,
my_match_t *match, uint nmatch);
/* Functions for 8bit */
-extern uint my_caseup_str_8bit(CHARSET_INFO *, char *);
-extern uint my_casedn_str_8bit(CHARSET_INFO *, char *);
-extern uint my_caseup_8bit(CHARSET_INFO *, char *src, uint srclen,
- char *dst, uint dstlen);
-extern uint my_casedn_8bit(CHARSET_INFO *, char *src, uint srclen,
- char *dst, uint dstlen);
+extern size_t my_caseup_str_8bit(CHARSET_INFO *, char *);
+extern size_t my_casedn_str_8bit(CHARSET_INFO *, char *);
+extern size_t my_caseup_8bit(CHARSET_INFO *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
+extern size_t my_casedn_8bit(CHARSET_INFO *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *);
@@ -340,26 +343,26 @@ int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
int my_mb_ctype_8bit(CHARSET_INFO *,int *, const uchar *,const uchar *);
int my_mb_ctype_mb(CHARSET_INFO *,int *, const uchar *,const uchar *);
-ulong my_scan_8bit(CHARSET_INFO *cs, const char *b, const char *e, int sq);
+size_t my_scan_8bit(CHARSET_INFO *cs, const char *b, const char *e, int sq);
-int my_snprintf_8bit(struct charset_info_st *, char *to, uint n,
- const char *fmt, ...)
+size_t my_snprintf_8bit(struct charset_info_st *, char *to, size_t n,
+ const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 4, 5);
-long my_strntol_8bit(CHARSET_INFO *, const char *s, uint l, int base,
+long my_strntol_8bit(CHARSET_INFO *, const char *s, size_t l, int base,
+ char **e, int *err);
+ulong my_strntoul_8bit(CHARSET_INFO *, const char *s, size_t l, int base,
char **e, int *err);
-ulong my_strntoul_8bit(CHARSET_INFO *, const char *s, uint l, int base,
+longlong my_strntoll_8bit(CHARSET_INFO *, const char *s, size_t l, int base,
char **e, int *err);
-longlong my_strntoll_8bit(CHARSET_INFO *, const char *s, uint l, int base,
+ulonglong my_strntoull_8bit(CHARSET_INFO *, const char *s, size_t l, int base,
char **e, int *err);
-ulonglong my_strntoull_8bit(CHARSET_INFO *, const char *s, uint l, int base,
- char **e, int *err);
-double my_strntod_8bit(CHARSET_INFO *, char *s, uint l,char **e,
+double my_strntod_8bit(CHARSET_INFO *, char *s, size_t l,char **e,
int *err);
-int my_long10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix,
- long int val);
-int my_longlong10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix,
- longlong val);
+size_t my_long10_to_str_8bit(CHARSET_INFO *, char *to, size_t l, int radix,
+ long int val);
+size_t my_longlong10_to_str_8bit(CHARSET_INFO *, char *to, size_t l, int radix,
+ longlong val);
longlong my_strtoll10_8bit(CHARSET_INFO *cs,
const char *nptr, char **endptr, int *error);
@@ -367,34 +370,34 @@ longlong my_strtoll10_ucs2(CHARSET_INFO *cs,
const char *nptr, char **endptr, int *error);
ulonglong my_strntoull10rnd_8bit(CHARSET_INFO *cs,
- const char *str, uint length, int unsigned_fl,
- char **endptr, int *error);
+ const char *str, size_t length, int
+ unsigned_fl, char **endptr, int *error);
ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs,
- const char *str, uint length, int unsigned_fl,
- char **endptr, int *error);
+ const char *str, size_t length,
+ int unsigned_fl, char **endptr, int *error);
-void my_fill_8bit(CHARSET_INFO *cs, char* to, uint l, int fill);
+void my_fill_8bit(CHARSET_INFO *cs, char* to, size_t l, int fill);
my_bool my_like_range_simple(CHARSET_INFO *cs,
- const char *ptr, uint ptr_length,
+ const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
- uint res_length,
+ size_t res_length,
char *min_str, char *max_str,
- uint *min_length, uint *max_length);
+ size_t *min_length, size_t *max_length);
my_bool my_like_range_mb(CHARSET_INFO *cs,
- const char *ptr, uint ptr_length,
+ const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
- uint res_length,
+ size_t res_length,
char *min_str, char *max_str,
- uint *min_length, uint *max_length);
+ size_t *min_length, size_t *max_length);
my_bool my_like_range_ucs2(CHARSET_INFO *cs,
- const char *ptr, uint ptr_length,
+ const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
- uint res_length,
+ size_t res_length,
char *min_str, char *max_str,
- uint *min_length, uint *max_length);
+ size_t *min_length, size_t *max_length);
int my_wildcmp_8bit(CHARSET_INFO *,
@@ -407,35 +410,35 @@ int my_wildcmp_bin(CHARSET_INFO *,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many);
-uint my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e);
-uint my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e);
-uint my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
-uint my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e,
- uint pos, int *error);
-int my_mbcharlen_8bit(CHARSET_INFO *, uint c);
+size_t my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e);
+size_t my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e);
+size_t my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, size_t pos);
+size_t my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e,
+ size_t pos, int *error);
+uint my_mbcharlen_8bit(CHARSET_INFO *, uint c);
/* Functions for multibyte charsets */
-extern uint my_caseup_str_mb(CHARSET_INFO *, char *);
-extern uint my_casedn_str_mb(CHARSET_INFO *, char *);
-extern uint my_caseup_mb(CHARSET_INFO *, char *src, uint srclen,
- char *dst, uint dstlen);
-extern uint my_casedn_mb(CHARSET_INFO *, char *src, uint srclen,
- char *dst, uint dstlen);
+extern size_t my_caseup_str_mb(CHARSET_INFO *, char *);
+extern size_t my_casedn_str_mb(CHARSET_INFO *, char *);
+extern size_t my_caseup_mb(CHARSET_INFO *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
+extern size_t my_casedn_mb(CHARSET_INFO *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *);
int my_wildcmp_mb(CHARSET_INFO *,
const char *str,const char *str_end,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many);
-uint my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
-uint my_numcells_mb(CHARSET_INFO *, const char *b, const char *e);
-uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
-uint my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e,
- uint pos, int *error);
+size_t my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
+size_t my_numcells_mb(CHARSET_INFO *, const char *b, const char *e);
+size_t my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, size_t pos);
+size_t my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e,
+ size_t pos, int *error);
uint my_instr_mb(struct charset_info_st *,
- const char *b, uint b_length,
- const char *s, uint s_length,
+ const char *b, size_t b_length,
+ const char *s, size_t s_length,
my_match_t *match, uint nmatch);
int my_wildcmp_unicode(CHARSET_INFO *cs,
@@ -444,13 +447,13 @@ int my_wildcmp_unicode(CHARSET_INFO *cs,
int escape, int w_one, int w_many,
MY_UNICASE_INFO **weights);
-extern my_bool my_parse_charset_xml(const char *bug, uint len,
+extern my_bool my_parse_charset_xml(const char *bug, size_t len,
int (*add)(CHARSET_INFO *cs));
extern char *my_strchr(CHARSET_INFO *cs, const char *str, const char *end,
pchar c);
-my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, uint len);
-my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len);
+my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, size_t len);
+my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, size_t len);
#define _MY_U 01 /* Upper case */
diff --git a/include/m_string.h b/include/m_string.h
index 4f098c3206d..ea5e04f48bc 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -112,59 +112,59 @@ extern char NEAR _dig_vec_lower[];
/* Prototypes for string functions */
#if !defined(bfill) && !defined(HAVE_BFILL)
-extern void bfill(gptr dst,uint len,pchar fill);
+extern void bfill(uchar *dst,size_t len,pchar fill);
#endif
#if !defined(bzero) && !defined(HAVE_BZERO)
-extern void bzero(gptr dst,uint len);
+extern void bzero(uchar * dst,size_t len);
#endif
#if !defined(bcmp) && !defined(HAVE_BCMP)
-extern int bcmp(const char *s1,const char *s2,uint len);
+extern size_t bcmp(const uchar *s1,const uchar *s2,size_t len);
#endif
#ifdef HAVE_purify
-extern int my_bcmp(const char *s1,const char *s2,uint len);
+extern size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len);
#undef bcmp
#define bcmp(A,B,C) my_bcmp((A),(B),(C))
#endif
#ifndef bmove512
-extern void bmove512(gptr dst,const gptr src,uint len);
+extern void bmove512(uchar *dst,const uchar *src,size_t len);
#endif
#if !defined(HAVE_BMOVE) && !defined(bmove)
-extern void bmove(char *dst, const char *src,uint len);
+extern void bmove(uuchar *dst, const uchar *src,size_t len);
#endif
-extern void bmove_upp(char *dst,const char *src,uint len);
-extern void bchange(char *dst,uint old_len,const char *src,
- uint new_len,uint tot_len);
-extern void strappend(char *s,uint len,pchar fill);
+extern void bmove_upp(uchar *dst,const uchar *src,size_t len);
+extern void bchange(uchar *dst,size_t old_len,const uchar *src,
+ size_t new_len,size_t tot_len);
+extern void strappend(char *s,size_t len,pchar fill);
extern char *strend(const char *s);
extern char *strcend(const char *, pchar);
extern char *strfield(char *src,int fields,int chars,int blanks,
int tabch);
-extern char *strfill(my_string s,uint len,pchar fill);
-extern uint strinstr(const char *str,const char *search);
-extern uint r_strinstr(reg1 my_string str,int from, reg4 my_string search);
+extern char *strfill(char * s,size_t len,pchar fill);
+extern size_t strinstr(const char *str,const char *search);
+extern size_t r_strinstr(const char *str, size_t from, const char *search);
extern char *strkey(char *dst,char *head,char *tail,char *flags);
-extern char *strmake(char *dst,const char *src,uint length);
+extern char *strmake(char *dst,const char *src,size_t length);
#ifndef strmake_overlapp
-extern char *strmake_overlapp(char *dst,const char *src, uint length);
+extern char *strmake_overlapp(char *dst,const char *src, size_t length);
#endif
#ifndef strmov
extern char *strmov(char *dst,const char *src);
#endif
-extern char *strnmov(char *dst,const char *src,uint n);
+extern char *strnmov(char *dst,const char *src,size_t n);
extern char *strsuff(const char *src,const char *suffix);
extern char *strcont(const char *src,const char *set);
extern char *strxcat _VARARGS((char *dst,const char *src, ...));
extern char *strxmov _VARARGS((char *dst,const char *src, ...));
extern char *strxcpy _VARARGS((char *dst,const char *src, ...));
-extern char *strxncat _VARARGS((char *dst,uint len, const char *src, ...));
-extern char *strxnmov _VARARGS((char *dst,uint len, const char *src, ...));
-extern char *strxncpy _VARARGS((char *dst,uint len, const char *src, ...));
+extern char *strxncat _VARARGS((char *dst,size_t len, const char *src, ...));
+extern char *strxnmov _VARARGS((char *dst,size_t len, const char *src, ...));
+extern char *strxncpy _VARARGS((char *dst,size_t len, const char *src, ...));
/* Prototypes of normal stringfunctions (with may ours) */
@@ -179,7 +179,7 @@ extern size_t strlen(const char *);
#endif
#endif
#ifndef HAVE_STRNLEN
-extern uint strnlen(const char *s, uint n);
+extern size_t strnlen(const char *s, size_t n);
#endif
#if !defined(__cplusplus)
@@ -232,9 +232,9 @@ extern ulonglong strtoull(const char *str, char **ptr, int base);
/* my_vsnprintf.c */
-extern int my_vsnprintf( char *str, size_t n,
- const char *format, va_list ap );
-extern int my_snprintf(char *to, size_t n, const char *fmt, ...)
+extern size_t my_vsnprintf(char *str, size_t n,
+ const char *format, va_list ap);
+extern size_t my_snprintf(char *to, size_t n, const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 3, 4);
#if defined(__cplusplus)
@@ -245,17 +245,18 @@ extern int my_snprintf(char *to, size_t n, const char *fmt, ...)
LEX_STRING -- a pair of a C-string and its length.
NOTE: this exactly form of declaration is required for some C-compilers
- (for one, Sun C 5.7 2005/01/07). Unfortunatelt with such declaration
+ (for one, Sun C 5.7 2005/01/07). Unfortunately with such declaration
LEX_STRING can not be forward declared.
*/
typedef struct
{
char *str;
- uint length;
+ size_t length;
} LEX_STRING;
-#define STRING_WITH_LEN(X) (X), ((uint) (sizeof(X) - 1))
-#define C_STRING_WITH_LEN(X) ((char *) (X)), ((uint) (sizeof(X) - 1))
+#define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1))
+#define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1))
+#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1))
#endif
diff --git a/include/my_alloc.h b/include/my_alloc.h
index 657394a363b..93b7438a1df 100644
--- a/include/my_alloc.h
+++ b/include/my_alloc.h
@@ -37,8 +37,8 @@ typedef struct st_mem_root
USED_MEM *used; /* blocks almost without free memory */
USED_MEM *pre_alloc; /* preallocated block */
/* if block have less memory it will be put in 'used' list */
- unsigned int min_malloc;
- unsigned int block_size; /* initial block size */
+ size_t min_malloc;
+ size_t block_size; /* initial block size */
unsigned int block_num; /* allocated blocks counter */
/*
first free block in queue test counter (if it exceed
diff --git a/include/my_base.h b/include/my_base.h
index 37110810558..617cdb8c3f0 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -478,7 +478,7 @@ enum data_file_type {
typedef struct st_key_range
{
- const byte *key;
+ const uchar *key;
uint length;
key_part_map keypart_map;
enum ha_rkey_function flag;
diff --git a/include/my_dbug.h b/include/my_dbug.h
index 0541cf00c29..514cd17099b 100644
--- a/include/my_dbug.h
+++ b/include/my_dbug.h
@@ -23,8 +23,8 @@ extern "C" {
struct _db_code_state_;
extern int _db_keyword_(struct _db_code_state_ *cs, const char *keyword);
extern int _db_strict_keyword_(const char *keyword);
-extern int _db_explain_(struct _db_code_state_ *cs, char *buf, int len);
-extern int _db_explain_init_(char *buf, int len);
+extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len);
+extern int _db_explain_init_(char *buf, size_t len);
extern void _db_setjmp_(void);
extern void _db_longjmp_(void);
extern void _db_process_(const char *name);
@@ -40,8 +40,8 @@ extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_,
extern void _db_pargs_(uint _line_,const char *keyword);
extern void _db_doprnt_ _VARARGS((const char *format,...))
ATTRIBUTE_FORMAT(printf, 1, 2);
-extern void _db_dump_(uint _line_,const char *keyword,const char *memory,
- uint length);
+extern void _db_dump_(uint _line_,const char *keyword,
+ const unsigned char *memory, size_t length);
extern void _db_end_(void);
extern void _db_lock_file_(void);
extern void _db_unlock_file_(void);
diff --git a/include/my_getopt.h b/include/my_getopt.h
index dcd6ad9d79b..86e6b7d76e9 100644
--- a/include/my_getopt.h
+++ b/include/my_getopt.h
@@ -40,8 +40,8 @@ struct my_option
const char *name; /* Name of the option */
int id; /* unique id or short option */
const char *comment; /* option comment, for autom. --help */
- gptr *value; /* The variable value */
- gptr *u_max_value; /* The user def. max variable value */
+ uchar **value; /* The variable value */
+ uchar **u_max_value; /* The user def. max variable value */
const char **str_values; /* Pointer to possible values */
ulong var_type;
enum get_opt_arg_type arg_type;
@@ -64,7 +64,7 @@ extern int handle_options (int *argc, char ***argv,
const struct my_option *longopts, my_get_one_option);
extern void my_print_help(const struct my_option *options);
extern void my_print_variables(const struct my_option *options);
-extern void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
+extern void my_getopt_register_get_addr(uchar ** (*func_addr)(const char *, uint,
const struct my_option *));
ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp);
diff --git a/include/my_global.h b/include/my_global.h
index 71a2d087a43..97ba8e583fe 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -884,21 +884,14 @@ typedef long my_ptrdiff_t;
typedef long long my_ptrdiff_t;
#endif
-/* We can't set my_size_t to size_t as we want my_size_t to be unsigned */
-#if SIZEOF_CHARP <= SIZEOF_LONG
-typedef unsigned long my_size_t;
-#else
-typedef unsigned long long my_size_t;
-#endif
-
#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1))
#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double))
/* Size to make adressable obj. */
#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t)))
/* Offset of field f in structure t */
#define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f)
-#define ADD_TO_PTR(ptr,size,type) (type) ((byte*) (ptr)+size)
-#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((byte*) (A) - (byte*) (B))
+#define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size)
+#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B))
/*
Custom version of standard offsetof() macro which can be used to get
@@ -933,11 +926,6 @@ typedef unsigned long long my_size_t;
/* Typdefs for easyier portability */
-#if defined(VOIDTYPE)
-typedef void *gptr; /* Generic pointer */
-#else
-typedef char *gptr; /* Generic pointer */
-#endif
#ifndef HAVE_UCHAR
typedef unsigned char uchar; /* Short for unsigned char */
#endif
@@ -1058,12 +1046,7 @@ typedef off_t os_off_t;
typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */
typedef short int15; /* Most effective integer 0 <= x <= 32767 */
-typedef char *my_string; /* String of characters */
-typedef unsigned long size_s; /* Size of strings (In string-funcs) */
typedef int myf; /* Type of MyFlags in my_funcs */
-#ifndef byte_defined
-typedef char byte; /* Smallest addressable unit */
-#endif
typedef char my_bool; /* Small bool */
#if !defined(bool) && !defined(bool_defined) && (!defined(HAVE_BOOL) || !defined(__cplusplus))
typedef char bool; /* Ordinary boolean values 0 1 */
@@ -1209,9 +1192,9 @@ do { doubleget_union _tmp; \
} while (0)
#define float4get(V,M) do { *((float *) &(V)) = *((float*) (M)); } while(0)
#define float8get(V,M) doubleget((V),(M))
-#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
-#define floatstore(T,V) memcpy((byte*)(T), (byte*)(&V),sizeof(float))
-#define floatget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(float))
+#define float4store(V,M) memcpy((uchar*) V,(uchar*) (&M),sizeof(float))
+#define floatstore(T,V) memcpy((uchar*)(T), (uchar*)(&V),sizeof(float))
+#define floatget(V,M) memcpy((uchar*) &V,(uchar*) (M),sizeof(float))
#define float8store(V,M) doublestore((V),(M))
#endif /* __i386__ */
@@ -1294,59 +1277,59 @@ do { doubleget_union _tmp; \
int4store((T),def_temp); \
int4store((T+4),def_temp2); } while(0)
#ifdef WORDS_BIGENDIAN
-#define float4store(T,A) do { *(T)= ((byte *) &A)[3];\
- *((T)+1)=(char) ((byte *) &A)[2];\
- *((T)+2)=(char) ((byte *) &A)[1];\
- *((T)+3)=(char) ((byte *) &A)[0]; } while(0)
+#define float4store(T,A) do { *(T)= ((uchar *) &A)[3];\
+ *((T)+1)=(char) ((uchar *) &A)[2];\
+ *((T)+2)=(char) ((uchar *) &A)[1];\
+ *((T)+3)=(char) ((uchar *) &A)[0]; } while(0)
#define float4get(V,M) do { float def_temp;\
- ((byte*) &def_temp)[0]=(M)[3];\
- ((byte*) &def_temp)[1]=(M)[2];\
- ((byte*) &def_temp)[2]=(M)[1];\
- ((byte*) &def_temp)[3]=(M)[0];\
+ ((uchar*) &def_temp)[0]=(M)[3];\
+ ((uchar*) &def_temp)[1]=(M)[2];\
+ ((uchar*) &def_temp)[2]=(M)[1];\
+ ((uchar*) &def_temp)[3]=(M)[0];\
(V)=def_temp; } while(0)
-#define float8store(T,V) do { *(T)= ((byte *) &V)[7];\
- *((T)+1)=(char) ((byte *) &V)[6];\
- *((T)+2)=(char) ((byte *) &V)[5];\
- *((T)+3)=(char) ((byte *) &V)[4];\
- *((T)+4)=(char) ((byte *) &V)[3];\
- *((T)+5)=(char) ((byte *) &V)[2];\
- *((T)+6)=(char) ((byte *) &V)[1];\
- *((T)+7)=(char) ((byte *) &V)[0]; } while(0)
+#define float8store(T,V) do { *(T)= ((uchar *) &V)[7];\
+ *((T)+1)=(char) ((uchar *) &V)[6];\
+ *((T)+2)=(char) ((uchar *) &V)[5];\
+ *((T)+3)=(char) ((uchar *) &V)[4];\
+ *((T)+4)=(char) ((uchar *) &V)[3];\
+ *((T)+5)=(char) ((uchar *) &V)[2];\
+ *((T)+6)=(char) ((uchar *) &V)[1];\
+ *((T)+7)=(char) ((uchar *) &V)[0]; } while(0)
#define float8get(V,M) do { double def_temp;\
- ((byte*) &def_temp)[0]=(M)[7];\
- ((byte*) &def_temp)[1]=(M)[6];\
- ((byte*) &def_temp)[2]=(M)[5];\
- ((byte*) &def_temp)[3]=(M)[4];\
- ((byte*) &def_temp)[4]=(M)[3];\
- ((byte*) &def_temp)[5]=(M)[2];\
- ((byte*) &def_temp)[6]=(M)[1];\
- ((byte*) &def_temp)[7]=(M)[0];\
+ ((uchar*) &def_temp)[0]=(M)[7];\
+ ((uchar*) &def_temp)[1]=(M)[6];\
+ ((uchar*) &def_temp)[2]=(M)[5];\
+ ((uchar*) &def_temp)[3]=(M)[4];\
+ ((uchar*) &def_temp)[4]=(M)[3];\
+ ((uchar*) &def_temp)[5]=(M)[2];\
+ ((uchar*) &def_temp)[6]=(M)[1];\
+ ((uchar*) &def_temp)[7]=(M)[0];\
(V) = def_temp; } while(0)
#else
-#define float4get(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float))
-#define float4store(V,M) memcpy_fixed((byte*) V,(byte*) (&M),sizeof(float))
+#define float4get(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(float))
+#define float4store(V,M) memcpy_fixed((uchar*) V,(uchar*) (&M),sizeof(float))
#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
-#define doublestore(T,V) do { *(((char*)T)+0)=(char) ((byte *) &V)[4];\
- *(((char*)T)+1)=(char) ((byte *) &V)[5];\
- *(((char*)T)+2)=(char) ((byte *) &V)[6];\
- *(((char*)T)+3)=(char) ((byte *) &V)[7];\
- *(((char*)T)+4)=(char) ((byte *) &V)[0];\
- *(((char*)T)+5)=(char) ((byte *) &V)[1];\
- *(((char*)T)+6)=(char) ((byte *) &V)[2];\
- *(((char*)T)+7)=(char) ((byte *) &V)[3]; }\
+#define doublestore(T,V) do { *(((char*)T)+0)=(char) ((uchar *) &V)[4];\
+ *(((char*)T)+1)=(char) ((uchar *) &V)[5];\
+ *(((char*)T)+2)=(char) ((uchar *) &V)[6];\
+ *(((char*)T)+3)=(char) ((uchar *) &V)[7];\
+ *(((char*)T)+4)=(char) ((uchar *) &V)[0];\
+ *(((char*)T)+5)=(char) ((uchar *) &V)[1];\
+ *(((char*)T)+6)=(char) ((uchar *) &V)[2];\
+ *(((char*)T)+7)=(char) ((uchar *) &V)[3]; }\
while(0)
#define doubleget(V,M) do { double def_temp;\
- ((byte*) &def_temp)[0]=(M)[4];\
- ((byte*) &def_temp)[1]=(M)[5];\
- ((byte*) &def_temp)[2]=(M)[6];\
- ((byte*) &def_temp)[3]=(M)[7];\
- ((byte*) &def_temp)[4]=(M)[0];\
- ((byte*) &def_temp)[5]=(M)[1];\
- ((byte*) &def_temp)[6]=(M)[2];\
- ((byte*) &def_temp)[7]=(M)[3];\
+ ((uchar*) &def_temp)[0]=(M)[4];\
+ ((uchar*) &def_temp)[1]=(M)[5];\
+ ((uchar*) &def_temp)[2]=(M)[6];\
+ ((uchar*) &def_temp)[3]=(M)[7];\
+ ((uchar*) &def_temp)[4]=(M)[0];\
+ ((uchar*) &def_temp)[5]=(M)[1];\
+ ((uchar*) &def_temp)[6]=(M)[2];\
+ ((uchar*) &def_temp)[7]=(M)[3];\
(V) = def_temp; } while(0)
#endif /* __FLOAT_WORD_ORDER */
@@ -1377,16 +1360,16 @@ do { doubleget_union _tmp; \
#define shortget(V,M) do { V = (short) (((short) ((uchar) (M)[1]))+\
((short) ((short) (M)[0]) << 8)); } while(0)
#define longget(V,M) do { int32 def_temp;\
- ((byte*) &def_temp)[0]=(M)[0];\
- ((byte*) &def_temp)[1]=(M)[1];\
- ((byte*) &def_temp)[2]=(M)[2];\
- ((byte*) &def_temp)[3]=(M)[3];\
+ ((uchar*) &def_temp)[0]=(M)[0];\
+ ((uchar*) &def_temp)[1]=(M)[1];\
+ ((uchar*) &def_temp)[2]=(M)[2];\
+ ((uchar*) &def_temp)[3]=(M)[3];\
(V)=def_temp; } while(0)
#define ulongget(V,M) do { uint32 def_temp;\
- ((byte*) &def_temp)[0]=(M)[0];\
- ((byte*) &def_temp)[1]=(M)[1];\
- ((byte*) &def_temp)[2]=(M)[2];\
- ((byte*) &def_temp)[3]=(M)[3];\
+ ((uchar*) &def_temp)[0]=(M)[0];\
+ ((uchar*) &def_temp)[1]=(M)[1];\
+ ((uchar*) &def_temp)[2]=(M)[2];\
+ ((uchar*) &def_temp)[3]=(M)[3];\
(V)=def_temp; } while(0)
#define shortstore(T,A) do { uint def_temp=(uint) (A) ;\
*(((char*)T)+1)=(char)(def_temp); \
@@ -1396,12 +1379,12 @@ do { doubleget_union _tmp; \
*(((char*)T)+1)=(((A) >> 16));\
*(((char*)T)+0)=(((A) >> 24)); } while(0)
-#define floatget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float))
-#define floatstore(T,V) memcpy_fixed((byte*) (T),(byte*)(&V),sizeof(float))
-#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
-#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double))
-#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong))
-#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong))
+#define floatget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(float))
+#define floatstore(T,V) memcpy_fixed((uchar*) (T),(uchar*)(&V),sizeof(float))
+#define doubleget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(double))
+#define doublestore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(double))
+#define longlongget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(ulonglong))
+#define longlongstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(ulonglong))
#else
@@ -1412,15 +1395,15 @@ do { doubleget_union _tmp; \
#define shortstore(T,V) int2store(T,V)
#define longstore(T,V) int4store(T,V)
#ifndef floatstore
-#define floatstore(T,V) memcpy_fixed((byte*) (T),(byte*) (&V),sizeof(float))
-#define floatget(V,M) memcpy_fixed((byte*) &V, (byte*) (M), sizeof(float))
+#define floatstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) (&V),sizeof(float))
+#define floatget(V,M) memcpy_fixed((uchar*) &V, (uchar*) (M), sizeof(float))
#endif
#ifndef doubleget
-#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
-#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double))
+#define doubleget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(double))
+#define doublestore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(double))
#endif /* doubleget */
-#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong))
-#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong))
+#define longlongget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(ulonglong))
+#define longlongstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(ulonglong))
#endif /* WORDS_BIGENDIAN */
diff --git a/include/my_list.h b/include/my_list.h
index 4a1737d4c53..775b56587b8 100644
--- a/include/my_list.h
+++ b/include/my_list.h
@@ -33,11 +33,11 @@ extern LIST *list_cons(void *data,LIST *root);
extern LIST *list_reverse(LIST *root);
extern void list_free(LIST *root,unsigned int free_data);
extern unsigned int list_length(LIST *);
-extern int list_walk(LIST *,list_walk_action action,gptr argument);
+extern int list_walk(LIST *,list_walk_action action,unsigned char * argument);
#define list_rest(a) ((a)->next)
#define list_push(a,b) (a)=list_cons((b),(a))
-#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((gptr) old,MYF(MY_FAE)); }
+#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((unsigned char *) old,MYF(MY_FAE)); }
#ifdef __cplusplus
}
diff --git a/include/my_nosys.h b/include/my_nosys.h
index f8422699041..df5639b81e2 100644
--- a/include/my_nosys.h
+++ b/include/my_nosys.h
@@ -35,8 +35,9 @@ extern "C" {
#undef my_seek
#define my_read(a,b,c,d) my_quick_read(a,b,c,d)
#define my_write(a,b,c,d) my_quick_write(a,b,c)
-extern uint my_quick_read(File Filedes,byte *Buffer,uint Count,myf myFlags);
-extern uint my_quick_write(File Filedes,const byte *Buffer,uint Count);
+extern size_t my_quick_read(File Filedes,uchar *Buffer,size_t Count,
+ myf myFlags);
+extern size_t my_quick_write(File Filedes,const uchar *Buffer,size_t Count);
#if !defined(SAFEMALLOC) && defined(USE_HALLOC)
#define my_malloc(a,b) halloc(a,1)
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 340dc32981a..14c4895883c 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -688,7 +688,7 @@ struct st_my_thread_var
struct st_my_thread_var *next,**prev;
void *opt_info;
#ifndef DBUG_OFF
- gptr dbug;
+ void *dbug;
char name[THREAD_NAME_SIZE+1];
#endif
};
diff --git a/include/my_sys.h b/include/my_sys.h
index 15de73d65a0..83bd7d2b982 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -41,7 +41,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define ERRMSGSIZE (SC_MAXWIDTH) /* Max length of a error message */
#define NRERRBUFFS (2) /* Buffers for parameters */
-#define MY_FILE_ERROR ((uint) ~0)
+#define MY_FILE_ERROR ((size_t) -1)
/* General bitmaps for my_func's */
#define MY_FFNF 1 /* Fatal if file not found */
@@ -153,13 +153,13 @@ extern ulonglong sf_malloc_mem_limit;
#define TERMINATE(A) {}
#define QUICK_SAFEMALLOC
#define NORMAL_SAFEMALLOC
-extern gptr my_malloc(uint Size,myf MyFlags);
+extern void *my_malloc(size_t Size,myf MyFlags);
#define my_malloc_ci(SZ,FLAG) my_malloc( SZ, FLAG )
-extern gptr my_realloc(gptr oldpoint,uint Size,myf MyFlags);
-extern void my_no_flags_free(gptr ptr);
-extern gptr my_memdup(const byte *from,uint length,myf MyFlags);
+extern void *my_realloc(void *oldpoint, size_t Size, myf MyFlags);
+extern void my_no_flags_free(void *ptr);
+extern void *my_memdup(const void *from,size_t length,myf MyFlags);
extern char *my_strdup(const char *from,myf MyFlags);
-extern char *my_strndup(const char *from, uint length,
+extern char *my_strndup(const char *from, size_t length,
myf MyFlags);
/* we do use FG (as a no-op) in below so that a typo on FG is caught */
#define my_free(PTR,FG) ((void)FG,my_no_flags_free(PTR))
@@ -171,8 +171,8 @@ extern char *my_strndup(const char *from, uint length,
#ifdef HAVE_LARGE_PAGES
extern uint my_get_large_page_size(void);
-extern gptr my_large_malloc(uint size, myf my_flags);
-extern void my_large_free(gptr ptr, myf my_flags);
+extern uchar * my_large_malloc(size_t size, myf my_flags);
+extern void my_large_free(uchar * ptr, myf my_flags);
#else
#define my_get_large_page_size() (0)
#define my_large_malloc(A,B) my_malloc_lock((A),(B))
@@ -258,7 +258,7 @@ typedef struct wild_file_pack /* Struct to hold info when selecting files */
{
uint wilds; /* How many wildcards */
uint not_pos; /* Start of not-theese-files */
- my_string *wild; /* Pointer to wildcards */
+ char * *wild; /* Pointer to wildcards */
} WF_PACK;
enum loglevel {
@@ -284,7 +284,7 @@ typedef struct st_record_cache /* Used when cacheing records */
int rc_seek,error,inited;
uint rc_length,read_length,reclength;
my_off_t rc_record_pos,end_of_file;
- byte *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos;
+ uchar *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos;
#ifdef HAVE_AIOWAIT
int use_async_io;
my_aio_result aio_result;
@@ -300,7 +300,7 @@ enum file_type
struct st_my_file_info
{
- my_string name;
+ char * name;
enum file_type type;
#if defined(THREAD) && !defined(HAVE_PREAD)
pthread_mutex_t mutex;
@@ -311,7 +311,7 @@ extern struct st_my_file_info *my_file_info;
typedef struct st_dynamic_array
{
- char *buffer;
+ uchar *buffer;
uint elements,max_element;
uint alloc_increment;
uint size_of_element;
@@ -330,7 +330,7 @@ typedef struct st_my_tmpdir
typedef struct st_dynamic_string
{
char *str;
- uint length,max_length,alloc_increment;
+ size_t length,max_length,alloc_increment;
} DYNAMIC_STRING;
struct st_io_cache;
@@ -346,8 +346,8 @@ typedef struct st_io_cache_share
my_off_t pos_in_file;
/* If a synchronized write cache is the source of the data. */
struct st_io_cache *source_cache;
- byte *buffer; /* The read buffer. */
- byte *read_end; /* Behind last valid byte of buffer. */
+ uchar *buffer; /* The read buffer. */
+ uchar *read_end; /* Behind last valid byte of buffer. */
int running_threads; /* threads not in lock. */
int total_threads; /* threads sharing the cache. */
int error; /* Last error. */
@@ -360,7 +360,7 @@ typedef struct st_io_cache_share
typedef struct st_io_cache /* Used when cacheing files */
{
- /* Offset in file corresponding to the first byte of byte* buffer. */
+ /* Offset in file corresponding to the first byte of uchar* buffer. */
my_off_t pos_in_file;
/*
The offset of end of file for READ_CACHE and WRITE_CACHE.
@@ -369,26 +369,26 @@ typedef struct st_io_cache /* Used when cacheing files */
*/
my_off_t end_of_file;
/* Points to current read position in the buffer */
- byte *read_pos;
+ uchar *read_pos;
/* the non-inclusive boundary in the buffer for the currently valid read */
- byte *read_end;
- byte *buffer; /* The read buffer */
+ uchar *read_end;
+ uchar *buffer; /* The read buffer */
/* Used in ASYNC_IO */
- byte *request_pos;
+ uchar *request_pos;
/* Only used in WRITE caches and in SEQ_READ_APPEND to buffer writes */
- byte *write_buffer;
+ uchar *write_buffer;
/*
Only used in SEQ_READ_APPEND, and points to the current read position
in the write buffer. Note that reads in SEQ_READ_APPEND caches can
- happen from both read buffer (byte* buffer) and write buffer
- (byte* write_buffer).
+ happen from both read buffer (uchar* buffer) and write buffer
+ (uchar* write_buffer).
*/
- byte *append_read_pos;
+ uchar *append_read_pos;
/* Points to current write position in the write buffer */
- byte *write_pos;
+ uchar *write_pos;
/* The non-inclusive boundary of the valid write area */
- byte *write_end;
+ uchar *write_end;
/*
Current_pos and current_end are convenience variables used by
@@ -396,7 +396,7 @@ typedef struct st_io_cache /* Used when cacheing files */
current_pos points to &write_pos, and current_end to &write_end in a
WRITE_CACHE, and &read_pos and &read_end respectively otherwise
*/
- byte **current_pos, **current_end;
+ uchar **current_pos, **current_end;
#ifdef THREAD
/*
The lock is for append buffer used in SEQ_READ_APPEND cache
@@ -420,12 +420,12 @@ typedef struct st_io_cache /* Used when cacheing files */
my_b_read() will call read_function to fetch the data. read_function
must never be invoked directly.
*/
- int (*read_function)(struct st_io_cache *,byte *,uint);
+ int (*read_function)(struct st_io_cache *,uchar *,size_t);
/*
Same idea as in the case of read_function, except my_b_write() needs to
be replaced with my_b_append() for a SEQ_READ_APPEND cache
*/
- int (*write_function)(struct st_io_cache *,const byte *,uint);
+ int (*write_function)(struct st_io_cache *,const uchar *,size_t);
/*
Specifies the type of the cache. Depending on the type of the cache
certain operations might not be available and yield unpredicatable
@@ -460,9 +460,9 @@ typedef struct st_io_cache /* Used when cacheing files */
*/
int seek_not_done,error;
/* buffer_length is memory size allocated for buffer or write_buffer */
- uint buffer_length;
+ size_t buffer_length;
/* read_length is the same as buffer_length except when we use async io */
- uint read_length;
+ size_t read_length;
myf myflags; /* Flags used to my_read/my_write */
/*
alloced_buffer is 1 if the buffer was allocated by init_io_cache() and
@@ -518,14 +518,14 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
(((info)->read_end=(info)->read_pos),(*(info)->read_function)(info,0,0))
#define my_b_tell(info) ((info)->pos_in_file + \
- (uint) (*(info)->current_pos - (info)->request_pos))
+ (size_t) (*(info)->current_pos - (info)->request_pos))
/* tell write offset in the SEQ_APPEND cache */
int my_b_copy_to_file(IO_CACHE *cache, FILE *file);
my_off_t my_b_append_tell(IO_CACHE* info);
my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */
-#define my_b_bytes_in_cache(info) (uint) (*(info)->current_end - \
+#define my_b_bytes_in_cache(info) (size_t) (*(info)->current_end - \
*(info)->current_pos)
typedef uint32 ha_checksum;
@@ -542,13 +542,13 @@ typedef int (*Process_option_func)(void *ctx, const char *group_name,
extern int my_copy(const char *from,const char *to,myf MyFlags);
extern int my_append(const char *from,const char *to,myf MyFlags);
extern int my_delete(const char *name,myf MyFlags);
-extern int my_getwd(my_string buf,uint size,myf MyFlags);
+extern int my_getwd(char * buf,size_t size,myf MyFlags);
extern int my_setwd(const char *dir,myf MyFlags);
extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFlags);
-extern gptr my_once_alloc(uint Size,myf MyFlags);
+extern void *my_once_alloc(size_t Size,myf MyFlags);
extern void my_once_free(void);
extern char *my_once_strdup(const char *src,myf myflags);
-extern char *my_once_memdup(const char *src, uint len, myf myflags);
+extern void *my_once_memdup(const void *src, size_t len, myf myflags);
extern File my_open(const char *FileName,int Flags,myf MyFlags);
extern File my_register_filename(File fd, const char *FileName,
enum file_type type_of_file,
@@ -566,39 +566,39 @@ extern File my_create_with_symlink(const char *linkname, const char *filename,
extern int my_delete_with_symlink(const char *name, myf MyFlags);
extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags);
extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
-extern uint my_read(File Filedes,byte *Buffer,uint Count,myf MyFlags);
-extern uint my_pread(File Filedes,byte *Buffer,uint Count,my_off_t offset,
+extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags);
+extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset,
myf MyFlags);
extern int my_rename(const char *from,const char *to,myf MyFlags);
extern my_off_t my_seek(File fd,my_off_t pos,int whence,myf MyFlags);
extern my_off_t my_tell(File fd,myf MyFlags);
-extern uint my_write(File Filedes,const byte *Buffer,uint Count,
+extern size_t my_write(File Filedes,const uchar *Buffer,size_t Count,
myf MyFlags);
-extern uint my_pwrite(File Filedes,const byte *Buffer,uint Count,
+extern size_t my_pwrite(File Filedes,const uchar *Buffer,size_t Count,
my_off_t offset,myf MyFlags);
-extern uint my_fread(FILE *stream,byte *Buffer,uint Count,myf MyFlags);
-extern uint my_fwrite(FILE *stream,const byte *Buffer,uint Count,
+extern size_t my_fread(FILE *stream,uchar *Buffer,size_t Count,myf MyFlags);
+extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count,
myf MyFlags);
extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags);
extern my_off_t my_ftell(FILE *stream,myf MyFlags);
-extern gptr _mymalloc(uint uSize,const char *sFile,
- uint uLine, myf MyFlag);
-extern gptr _myrealloc(gptr pPtr,uint uSize,const char *sFile,
+extern void *_mymalloc(size_t uSize,const char *sFile,
+ uint uLine, myf MyFlag);
+extern void *_myrealloc(void *pPtr,size_t uSize,const char *sFile,
uint uLine, myf MyFlag);
-extern gptr my_multi_malloc _VARARGS((myf MyFlags, ...));
-extern void _myfree(gptr pPtr,const char *sFile,uint uLine, myf MyFlag);
-extern int _sanity(const char *sFile,unsigned int uLine);
-extern gptr _my_memdup(const byte *from,uint length,
- const char *sFile, uint uLine,myf MyFlag);
-extern my_string _my_strdup(const char *from, const char *sFile, uint uLine,
- myf MyFlag);
-extern char *_my_strndup(const char *from, uint length,
- const char *sFile, uint uLine,
- myf MyFlag);
+extern void * my_multi_malloc _VARARGS((myf MyFlags, ...));
+extern void _myfree(void *pPtr,const char *sFile,uint uLine, myf MyFlag);
+extern int _sanity(const char *sFile, uint uLine);
+extern void *_my_memdup(const void *from, size_t length,
+ const char *sFile, uint uLine,myf MyFlag);
+extern char * _my_strdup(const char *from, const char *sFile, uint uLine,
+ myf MyFlag);
+extern char *_my_strndup(const char *from, size_t length,
+ const char *sFile, uint uLine,
+ myf MyFlag);
/* implemented in my_memmem.c */
extern void *my_memmem(const void *haystack, size_t haystacklen,
- const void *needle, size_t needlelen);
+ const void *needle, size_t needlelen);
#ifdef __WIN__
@@ -639,7 +639,7 @@ extern my_bool my_init(void);
extern void my_end(int infoflag);
extern int my_redel(const char *from, const char *to, int MyFlags);
extern int my_copystat(const char *from, const char *to, int MyFlags);
-extern my_string my_filename(File fd);
+extern char * my_filename(File fd);
#ifndef THREAD
extern void dont_break(void);
@@ -660,97 +660,97 @@ extern char *my_tmpdir(MY_TMPDIR *tmpdir);
extern void free_tmpdir(MY_TMPDIR *tmpdir);
extern void my_remember_signal(int signal_number,sig_handler (*func)(int));
-extern uint dirname_part(my_string to,const char *name);
-extern uint dirname_length(const char *name);
+extern size_t dirname_part(char * to, const char *name, size_t *to_res_length);
+extern size_t dirname_length(const char *name);
#define base_name(A) (A+dirname_length(A))
extern int test_if_hard_path(const char *dir_name);
extern my_bool has_path(const char *name);
extern char *convert_dirname(char *to, const char *from, const char *from_end);
-extern void to_unix_path(my_string name);
-extern my_string fn_ext(const char *name);
-extern my_string fn_same(my_string toname,const char *name,int flag);
-extern my_string fn_format(my_string to,const char *name,const char *dir,
+extern void to_unix_path(char * name);
+extern char * fn_ext(const char *name);
+extern char * fn_same(char * toname,const char *name,int flag);
+extern char * fn_format(char * to,const char *name,const char *dir,
const char *form, uint flag);
-extern size_s strlength(const char *str);
-extern void pack_dirname(my_string to,const char *from);
-extern uint unpack_dirname(my_string to,const char *from);
-extern uint cleanup_dirname(my_string to,const char *from);
-extern uint system_filename(my_string to,const char *from);
-extern uint unpack_filename(my_string to,const char *from);
-extern my_string intern_filename(my_string to,const char *from);
-extern my_string directory_file_name(my_string dst, const char *src);
-extern int pack_filename(my_string to, const char *name, size_s max_length);
-extern my_string my_path(my_string to,const char *progname,
+extern size_t strlength(const char *str);
+extern void pack_dirname(char * to,const char *from);
+extern size_t unpack_dirname(char * to,const char *from);
+extern size_t cleanup_dirname(char * to,const char *from);
+extern size_t system_filename(char * to,const char *from);
+extern size_t unpack_filename(char * to,const char *from);
+extern char * intern_filename(char * to,const char *from);
+extern char * directory_file_name(char * dst, const char *src);
+extern int pack_filename(char * to, const char *name, size_t max_length);
+extern char * my_path(char * to,const char *progname,
const char *own_pathname_part);
-extern my_string my_load_path(my_string to, const char *path,
+extern char * my_load_path(char * to, const char *path,
const char *own_path_prefix);
extern int wild_compare(const char *str,const char *wildstr,
pbool str_is_pattern);
-extern WF_PACK *wf_comp(my_string str);
+extern WF_PACK *wf_comp(char * str);
extern int wf_test(struct wild_file_pack *wf_pack,const char *name);
extern void wf_end(struct wild_file_pack *buffer);
-extern size_s strip_sp(my_string str);
-extern void get_date(my_string to,int timeflag,time_t use_time);
-extern void soundex(CHARSET_INFO *, my_string out_pntr, my_string in_pntr,
+extern size_t strip_sp(char * str);
+extern void get_date(char * to,int timeflag,time_t use_time);
+extern void soundex(CHARSET_INFO *, char * out_pntr, char * in_pntr,
pbool remove_garbage);
-extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file,
- uint reclength,enum cache_type type,
+extern int init_record_cache(RECORD_CACHE *info,size_t cachesize,File file,
+ size_t reclength,enum cache_type type,
pbool use_async_io);
-extern int read_cache_record(RECORD_CACHE *info,byte *to);
+extern int read_cache_record(RECORD_CACHE *info,uchar *to);
extern int end_record_cache(RECORD_CACHE *info);
extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos,
- const byte *record,uint length);
+ const uchar *record,size_t length);
extern int flush_write_cache(RECORD_CACHE *info);
extern long my_clock(void);
extern sig_handler sigtstp_handler(int signal_number);
extern void handle_recived_signals(void);
extern sig_handler my_set_alarm_variable(int signo);
-extern void my_string_ptr_sort(void *base,uint items,size_s size);
+extern void my_string_ptr_sort(uchar *base, uint items, size_t size);
extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements,
- size_s size_of_element,uchar *buffer[]);
+ size_t size_of_element,uchar *buffer[]);
extern qsort_t qsort2(void *base_ptr, size_t total_elems, size_t size,
qsort2_cmp cmp, void *cmp_argument);
-extern qsort2_cmp get_ptr_compare(uint);
-void my_store_ptr(byte *buff, uint pack_length, my_off_t pos);
-my_off_t my_get_ptr(byte *ptr, uint pack_length);
-extern int init_io_cache(IO_CACHE *info,File file,uint cachesize,
+extern qsort2_cmp get_ptr_compare(size_t);
+void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos);
+my_off_t my_get_ptr(uchar *ptr, size_t pack_length);
+extern int init_io_cache(IO_CACHE *info,File file,size_t cachesize,
enum cache_type type,my_off_t seek_offset,
pbool use_async_io, myf cache_myflags);
extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type,
my_off_t seek_offset,pbool use_async_io,
pbool clear_cache);
extern void setup_io_cache(IO_CACHE* info);
-extern int _my_b_read(IO_CACHE *info,byte *Buffer,uint Count);
+extern int _my_b_read(IO_CACHE *info,uchar *Buffer,size_t Count);
#ifdef THREAD
-extern int _my_b_read_r(IO_CACHE *info,byte *Buffer,uint Count);
+extern int _my_b_read_r(IO_CACHE *info,uchar *Buffer,size_t Count);
extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare,
IO_CACHE *write_cache, uint num_threads);
extern void remove_io_thread(IO_CACHE *info);
#endif
-extern int _my_b_seq_read(IO_CACHE *info,byte *Buffer,uint Count);
-extern int _my_b_net_read(IO_CACHE *info,byte *Buffer,uint Count);
+extern int _my_b_seq_read(IO_CACHE *info,uchar *Buffer,size_t Count);
+extern int _my_b_net_read(IO_CACHE *info,uchar *Buffer,size_t Count);
extern int _my_b_get(IO_CACHE *info);
-extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count);
-extern int _my_b_write(IO_CACHE *info,const byte *Buffer,uint Count);
-extern int my_b_append(IO_CACHE *info,const byte *Buffer,uint Count);
-extern int my_b_safe_write(IO_CACHE *info,const byte *Buffer,uint Count);
+extern int _my_b_async_read(IO_CACHE *info,uchar *Buffer,size_t Count);
+extern int _my_b_write(IO_CACHE *info,const uchar *Buffer,size_t Count);
+extern int my_b_append(IO_CACHE *info,const uchar *Buffer,size_t Count);
+extern int my_b_safe_write(IO_CACHE *info,const uchar *Buffer,size_t Count);
-extern int my_block_write(IO_CACHE *info, const byte *Buffer,
- uint Count, my_off_t pos);
+extern int my_block_write(IO_CACHE *info, const uchar *Buffer,
+ size_t Count, my_off_t pos);
extern int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock);
#define flush_io_cache(info) my_b_flush_io_cache((info),1)
extern int end_io_cache(IO_CACHE *info);
-extern uint my_b_fill(IO_CACHE *info);
+extern size_t my_b_fill(IO_CACHE *info);
extern void my_b_seek(IO_CACHE *info,my_off_t pos);
-extern uint my_b_gets(IO_CACHE *info, char *to, uint max_length);
+extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length);
extern my_off_t my_b_filelength(IO_CACHE *info);
-extern uint my_b_printf(IO_CACHE *info, const char* fmt, ...);
-extern uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap);
+extern size_t my_b_printf(IO_CACHE *info, const char* fmt, ...);
+extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap);
extern my_bool open_cached_file(IO_CACHE *cache,const char *dir,
- const char *prefix, uint cache_size,
+ const char *prefix, size_t cache_size,
myf cache_myflags);
extern my_bool real_open_cached_file(IO_CACHE *cache);
extern void close_cached_file(IO_CACHE *cache);
@@ -761,15 +761,15 @@ File create_temp_file(char *to, const char *dir, const char *pfx,
extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size,
uint init_alloc,uint alloc_increment
CALLER_INFO_PROTO);
-extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,gptr element);
-extern byte *alloc_dynamic(DYNAMIC_ARRAY *array);
-extern byte *pop_dynamic(DYNAMIC_ARRAY*);
-extern my_bool set_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index);
-extern void get_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index);
+extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,uchar * element);
+extern uchar *alloc_dynamic(DYNAMIC_ARRAY *array);
+extern uchar *pop_dynamic(DYNAMIC_ARRAY*);
+extern my_bool set_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_index);
+extern void get_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_index);
extern void delete_dynamic(DYNAMIC_ARRAY *array);
extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index);
extern void freeze_size(DYNAMIC_ARRAY *array);
-extern int get_index_dynamic(DYNAMIC_ARRAY *array, gptr element);
+extern int get_index_dynamic(DYNAMIC_ARRAY *array, uchar * element);
#define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element)
#define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index))
#define push_dynamic(A,B) insert_dynamic((A),(B))
@@ -777,19 +777,19 @@ extern int get_index_dynamic(DYNAMIC_ARRAY *array, gptr element);
#define sort_dynamic(A,cmp) qsort((A)->buffer, (A)->elements, (A)->size_of_element, (cmp))
extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
- uint init_alloc,uint alloc_increment);
+ size_t init_alloc,size_t alloc_increment);
extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append);
my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
- uint length);
+ size_t length);
extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append,
...);
extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str);
-extern my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size);
-extern my_bool dynstr_trunc(DYNAMIC_STRING *str, int n);
+extern my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size);
+extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n);
extern void dynstr_free(DYNAMIC_STRING *str);
#ifdef HAVE_MLOCK
-extern byte *my_malloc_lock(uint length,myf flags);
-extern void my_free_lock(byte *ptr,myf flags);
+extern void *my_malloc_lock(size_t length,myf flags);
+extern void my_free_lock(void *ptr,myf flags);
#else
#define my_malloc_lock(A,B) my_malloc((A),(B))
#define my_free_lock(A,B) my_free((A),(B))
@@ -797,17 +797,17 @@ extern void my_free_lock(byte *ptr,myf flags);
#define alloc_root_inited(A) ((A)->min_malloc != 0)
#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8)
#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0)
-extern void init_alloc_root(MEM_ROOT *mem_root, uint block_size,
- uint pre_alloc_size);
-extern gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size);
-extern gptr multi_alloc_root(MEM_ROOT *mem_root, ...);
+extern void init_alloc_root(MEM_ROOT *mem_root, size_t block_size,
+ size_t pre_alloc_size);
+extern void *alloc_root(MEM_ROOT *mem_root, size_t Size);
+extern void *multi_alloc_root(MEM_ROOT *mem_root, ...);
extern void free_root(MEM_ROOT *root, myf MyFLAGS);
extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
-extern void reset_root_defaults(MEM_ROOT *mem_root, uint block_size,
- uint prealloc_size);
+extern void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
+ size_t prealloc_size);
extern char *strdup_root(MEM_ROOT *root,const char *str);
-extern char *strmake_root(MEM_ROOT *root,const char *str,uint len);
-extern char *memdup_root(MEM_ROOT *root,const char *str,uint len);
+extern char *strmake_root(MEM_ROOT *root,const char *str,size_t len);
+extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len);
extern int get_defaults_options(int argc, char **argv,
char **defaults, char **extra_defaults,
char **group_suffix);
@@ -822,19 +822,20 @@ extern int my_search_option_files(const char *conf_file, int *argc,
extern void free_defaults(char **argv);
extern void my_print_default_files(const char *conf_file);
extern void print_defaults(const char *conf_file, const char **groups);
-extern my_bool my_compress(byte *, ulong *, ulong *);
-extern my_bool my_uncompress(byte *, ulong *, ulong *);
-extern byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen);
-extern int packfrm(const void *, uint, const void **, uint *);
-extern int unpackfrm(const void **, uint *, const void *);
-
-extern ha_checksum my_checksum(ha_checksum crc, const byte *mem, uint count);
+extern my_bool my_compress(uchar *, size_t *, size_t *);
+extern my_bool my_uncompress(uchar *, size_t , size_t *);
+extern uchar *my_compress_alloc(const uchar *packet, size_t *len,
+ size_t *complen);
+extern int packfrm(const uchar *, size_t, uchar **, size_t *);
+extern int unpackfrm(uchar **, size_t *, const uchar *);
+
+extern ha_checksum my_checksum(ha_checksum crc, const uchar *mem,
+ size_t count);
extern uint my_bit_log2(ulong value);
extern uint32 my_round_up_to_next_power(uint32 v);
extern uint my_count_bits(ulonglong v);
extern uint my_count_bits_ushort(ushort v);
extern void my_sleep(ulong m_seconds);
-extern ulong crc32(ulong crc, const uchar *buf, uint len);
extern uint my_set_max_open_files(uint files);
void my_free_open_file_info(void);
@@ -901,17 +902,17 @@ extern char *get_charsets_dir(char *buf);
extern my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2);
extern my_bool init_compiled_charsets(myf flags);
extern void add_compiled_collation(CHARSET_INFO *cs);
-extern ulong escape_string_for_mysql(CHARSET_INFO *charset_info,
- char *to, ulong to_length,
- const char *from, ulong length);
+extern size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
+ char *to, size_t to_length,
+ const char *from, size_t length);
#ifdef __WIN__
#define BACKSLASH_MBTAIL
/* File system character set */
extern CHARSET_INFO *fs_character_set(void);
#endif
-extern ulong escape_quotes_for_mysql(CHARSET_INFO *charset_info,
- char *to, ulong to_length,
- const char *from, ulong length);
+extern size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info,
+ char *to, size_t to_length,
+ const char *from, size_t length);
extern void thd_increment_bytes_sent(ulong length);
extern void thd_increment_bytes_received(ulong length);
@@ -928,7 +929,7 @@ int my_security_attr_create(SECURITY_ATTRIBUTES **psa, const char **perror,
void my_security_attr_free(SECURITY_ATTRIBUTES *sa);
/* implemented in my_conio.c */
-char* my_cgets(char *string, unsigned long clen, unsigned long* plen);
+char* my_cgets(char *string, size_t clen, size_t* plen);
#endif
#ifdef __NETWARE__
diff --git a/include/my_tree.h b/include/my_tree.h
index 380fc1c9b26..24bbdd54019 100644
--- a/include/my_tree.h
+++ b/include/my_tree.h
@@ -25,10 +25,10 @@ extern "C" {
#define MAX_TREE_HEIGHT 64
#define ELEMENT_KEY(tree,element)\
-(tree->offset_to_key ? (void*)((byte*) element+tree->offset_to_key) :\
+(tree->offset_to_key ? (void*)((uchar*) element+tree->offset_to_key) :\
*((void**) (element+1)))
-#define tree_set_pointer(element,ptr) *((byte **) (element+1))=((byte*) (ptr))
+#define tree_set_pointer(element,ptr) *((uchar **) (element+1))=((uchar*) (ptr))
#define TREE_NO_DUPS 1
diff --git a/include/my_trie.h b/include/my_trie.h
index 264a2595c52..72dd485af04 100644
--- a/include/my_trie.h
+++ b/include/my_trie.h
@@ -22,7 +22,7 @@ extern "C" {
typedef struct st_trie_node
{
uint16 leaf; /* Depth from root node if match, 0 else */
- byte c; /* Label on this edge */
+ uchar c; /* Label on this edge */
struct st_trie_node *next; /* Next label */
struct st_trie_node *links; /* Array of edges leaving this node */
struct st_trie_node *fail; /* AC failure function */
@@ -45,14 +45,14 @@ typedef struct st_ac_trie_state
extern TRIE *trie_init (TRIE *trie, CHARSET_INFO *charset);
extern void trie_free (TRIE *trie);
-extern my_bool trie_insert (TRIE *trie, const byte *key, uint keylen);
+extern my_bool trie_insert (TRIE *trie, const uchar *key, uint keylen);
extern my_bool ac_trie_prepare (TRIE *trie);
extern void ac_trie_init (TRIE *trie, AC_TRIE_STATE *state);
/* `trie_goto' is internal function and shouldn't be used. */
-static inline TRIE_NODE *trie_goto (TRIE_NODE *root, TRIE_NODE *node, byte c)
+static inline TRIE_NODE *trie_goto (TRIE_NODE *root, TRIE_NODE *node, uchar c)
{
TRIE_NODE *next;
DBUG_ENTER("trie_goto");
@@ -67,7 +67,7 @@ static inline TRIE_NODE *trie_goto (TRIE_NODE *root, TRIE_NODE *node, byte c)
/*
SYNOPSIS
- int ac_trie_next (AC_TRIE_STATE *state, byte *c);
+ int ac_trie_next (AC_TRIE_STATE *state, uchar *c);
state - valid pointer to `AC_TRIE_STATE'
c - character to lookup
@@ -79,7 +79,7 @@ static inline TRIE_NODE *trie_goto (TRIE_NODE *root, TRIE_NODE *node, byte c)
`ac_trie_next' returns length of matched word or 0.
*/
-static inline int ac_trie_next (AC_TRIE_STATE *state, byte *c)
+static inline int ac_trie_next (AC_TRIE_STATE *state, uchar *c)
{
TRIE_NODE *root, *node;
DBUG_ENTER("ac_trie_next");
@@ -94,7 +94,7 @@ static inline int ac_trie_next (AC_TRIE_STATE *state, byte *c)
/*
SYNOPSIS
- my_bool trie_search (TRIE *trie, const byte *key, uint keylen);
+ my_bool trie_search (TRIE *trie, const uchar *key, uint keylen);
trie - valid pointer to `TRIE'
key - valid pointer to key to insert
keylen - non-0 key length
@@ -113,7 +113,7 @@ static inline int ac_trie_next (AC_TRIE_STATE *state, byte *c)
consecutive loop better (tested)
*/
-static inline my_bool trie_search (TRIE *trie, const byte *key, uint keylen)
+static inline my_bool trie_search (TRIE *trie, const uchar *key, uint keylen)
{
TRIE_NODE *node;
uint k;
@@ -123,7 +123,7 @@ static inline my_bool trie_search (TRIE *trie, const byte *key, uint keylen)
for (k= 0; k < keylen; k++)
{
- byte p;
+ uchar p;
if (! (node= node->links))
DBUG_RETURN(FALSE);
p= key[k];
diff --git a/include/my_user.h b/include/my_user.h
index 0c86d0f90f6..44eebf1551d 100644
--- a/include/my_user.h
+++ b/include/my_user.h
@@ -25,9 +25,9 @@
C_MODE_START
-void parse_user(const char *user_id_str, uint user_id_len,
- char *user_name_str, uint *user_name_len,
- char *host_name_str, uint *host_name_len);
+void parse_user(const char *user_id_str, size_t user_id_len,
+ char *user_name_str, size_t *user_name_len,
+ char *host_name_str, size_t *host_name_len);
C_MODE_END
diff --git a/include/my_vle.h b/include/my_vle.h
index 21db8eeb6e1..c09f82229c4 100644
--- a/include/my_vle.h
+++ b/include/my_vle.h
@@ -28,8 +28,8 @@ extern "C" {
*/
#define my_vle_sizeof(ITEM) (((sizeof(ITEM) * CHAR_BIT) + 6) / 7)
-byte *my_vle_encode(byte *vle, my_size_t max, ulong value);
-byte const *my_vle_decode(ulong *value_ptr, byte const *vle);
+uchar *my_vle_encode(uchar *vle, size_t max, ulong value);
+uchar const *my_vle_decode(ulong *value_ptr, uchar const *vle);
#ifdef __cplusplus
}
diff --git a/include/my_xml.h b/include/my_xml.h
index 114805c7cc0..6a453ee90be 100644
--- a/include/my_xml.h
+++ b/include/my_xml.h
@@ -57,27 +57,27 @@ typedef struct xml_stack_st
const char *cur;
const char *end;
void *user_data;
- int (*enter)(struct xml_stack_st *st,const char *val, uint len);
- int (*value)(struct xml_stack_st *st,const char *val, uint len);
- int (*leave_xml)(struct xml_stack_st *st,const char *val, uint len);
+ int (*enter)(struct xml_stack_st *st,const char *val, size_t len);
+ int (*value)(struct xml_stack_st *st,const char *val, size_t len);
+ int (*leave_xml)(struct xml_stack_st *st,const char *val, size_t len);
} MY_XML_PARSER;
void my_xml_parser_create(MY_XML_PARSER *st);
void my_xml_parser_free(MY_XML_PARSER *st);
-int my_xml_parse(MY_XML_PARSER *st,const char *str, uint len);
+int my_xml_parse(MY_XML_PARSER *st,const char *str, size_t len);
void my_xml_set_value_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
const char *,
- uint len));
+ size_t len));
void my_xml_set_enter_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
const char *,
- uint len));
+ size_t len));
void my_xml_set_leave_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
const char *,
- uint len));
+ size_t len));
void my_xml_set_user_data(MY_XML_PARSER *st, void *);
-uint my_xml_error_pos(MY_XML_PARSER *st);
+size_t my_xml_error_pos(MY_XML_PARSER *st);
uint my_xml_error_lineno(MY_XML_PARSER *st);
const char *my_xml_error_string(MY_XML_PARSER *st);
diff --git a/include/myisam.h b/include/myisam.h
index b05440e5ae4..5d93ded3d6e 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -227,7 +227,7 @@ typedef struct st_mi_decode_tree /* Decode huff-table */
{
uint16 *table;
uint quick_table_bits;
- byte *intervalls;
+ uchar *intervalls;
} MI_DECODE_TREE;
@@ -259,7 +259,7 @@ typedef struct st_columndef /* column information */
/* invalidator function reference for Query Cache */
typedef void (* invalidator_by_filename)(const char * filename);
-extern my_string myisam_log_filename; /* Name of logfile */
+extern char * myisam_log_filename; /* Name of logfile */
extern ulong myisam_block_size;
extern ulong myisam_concurrent_insert;
extern my_bool myisam_flush,myisam_delay_key_write,myisam_single_user;
@@ -269,26 +269,26 @@ extern ulong myisam_bulk_insert_tree_size, myisam_data_pointer_size;
/* Prototypes for myisam-functions */
extern int mi_close(struct st_myisam_info *file);
-extern int mi_delete(struct st_myisam_info *file,const byte *buff);
+extern int mi_delete(struct st_myisam_info *file,const uchar *buff);
extern struct st_myisam_info *mi_open(const char *name,int mode,
uint wait_if_locked);
extern int mi_panic(enum ha_panic_function function);
-extern int mi_rfirst(struct st_myisam_info *file,byte *buf,int inx);
-extern int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key,
+extern int mi_rfirst(struct st_myisam_info *file,uchar *buf,int inx);
+extern int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function search_flag);
-extern int mi_rlast(struct st_myisam_info *file,byte *buf,int inx);
-extern int mi_rnext(struct st_myisam_info *file,byte *buf,int inx);
-extern int mi_rnext_same(struct st_myisam_info *info, byte *buf);
-extern int mi_rprev(struct st_myisam_info *file,byte *buf,int inx);
-extern int mi_rrnd(struct st_myisam_info *file,byte *buf, my_off_t pos);
+extern int mi_rlast(struct st_myisam_info *file,uchar *buf,int inx);
+extern int mi_rnext(struct st_myisam_info *file,uchar *buf,int inx);
+extern int mi_rnext_same(struct st_myisam_info *info, uchar *buf);
+extern int mi_rprev(struct st_myisam_info *file,uchar *buf,int inx);
+extern int mi_rrnd(struct st_myisam_info *file,uchar *buf, my_off_t pos);
extern int mi_scan_init(struct st_myisam_info *file);
-extern int mi_scan(struct st_myisam_info *file,byte *buf);
-extern int mi_rsame(struct st_myisam_info *file,byte *record,int inx);
-extern int mi_rsame_with_pos(struct st_myisam_info *file,byte *record,
+extern int mi_scan(struct st_myisam_info *file,uchar *buf);
+extern int mi_rsame(struct st_myisam_info *file,uchar *record,int inx);
+extern int mi_rsame_with_pos(struct st_myisam_info *file,uchar *record,
int inx, my_off_t pos);
-extern int mi_update(struct st_myisam_info *file,const byte *old,
- byte *new_record);
-extern int mi_write(struct st_myisam_info *file,byte *buff);
+extern int mi_update(struct st_myisam_info *file,const uchar *old,
+ uchar *new_record);
+extern int mi_write(struct st_myisam_info *file,uchar *buff);
extern my_off_t mi_position(struct st_myisam_info *file);
extern int mi_status(struct st_myisam_info *info, MI_ISAMINFO *x, uint flag);
extern int mi_lock_database(struct st_myisam_info *file,int lock_type);
@@ -307,7 +307,7 @@ extern ha_rows mi_records_in_range(MI_INFO *info, int inx,
extern int mi_log(int activate_log);
extern int mi_is_changed(struct st_myisam_info *info);
extern int mi_delete_all_rows(struct st_myisam_info *info);
-extern ulong _mi_calc_blob_length(uint length , const byte *pos);
+extern ulong _mi_calc_blob_length(uint length , const uchar *pos);
extern uint mi_get_pointer_length(ulonglong file_length, uint def);
/* this is used to pass to mysql_myisamchk_table -- by Sasha Pachev */
@@ -474,8 +474,8 @@ int chk_size(MI_CHECK *param, MI_INFO *info);
int chk_key(MI_CHECK *param, MI_INFO *info);
int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend);
int mi_repair(MI_CHECK *param, register MI_INFO *info,
- my_string name, int rep_quick);
-int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name);
+ char * name, int rep_quick);
+int mi_sort_index(MI_CHECK *param, register MI_INFO *info, char * name);
int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
const char * name, int rep_quick);
int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
@@ -494,7 +494,7 @@ void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part,
ulonglong records);
int filecopy(MI_CHECK *param, File to,File from,my_off_t start,
my_off_t length, const char *type);
-int movepoint(MI_INFO *info,byte *record,my_off_t oldpos,
+int movepoint(MI_INFO *info,uchar *record,my_off_t oldpos,
my_off_t newpos, uint prot_key);
int write_data_suffix(SORT_INFO *sort_info, my_bool fix_datafile);
int test_if_almost_full(MI_INFO *info);
diff --git a/include/myisammrg.h b/include/myisammrg.h
index 02e81cf806d..eed50bebaee 100644
--- a/include/myisammrg.h
+++ b/include/myisammrg.h
@@ -78,20 +78,20 @@ typedef struct st_myrg_info
/* Prototypes for merge-functions */
extern int myrg_close(MYRG_INFO *file);
-extern int myrg_delete(MYRG_INFO *file,const byte *buff);
+extern int myrg_delete(MYRG_INFO *file,const uchar *buff);
extern MYRG_INFO *myrg_open(const char *name,int mode,int wait_if_locked);
extern int myrg_panic(enum ha_panic_function function);
-extern int myrg_rfirst(MYRG_INFO *file,byte *buf,int inx);
-extern int myrg_rlast(MYRG_INFO *file,byte *buf,int inx);
-extern int myrg_rnext(MYRG_INFO *file,byte *buf,int inx);
-extern int myrg_rprev(MYRG_INFO *file,byte *buf,int inx);
-extern int myrg_rnext_same(MYRG_INFO *file,byte *buf);
-extern int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
+extern int myrg_rfirst(MYRG_INFO *file,uchar *buf,int inx);
+extern int myrg_rlast(MYRG_INFO *file,uchar *buf,int inx);
+extern int myrg_rnext(MYRG_INFO *file,uchar *buf,int inx);
+extern int myrg_rprev(MYRG_INFO *file,uchar *buf,int inx);
+extern int myrg_rnext_same(MYRG_INFO *file,uchar *buf);
+extern int myrg_rkey(MYRG_INFO *info,uchar *buf,int inx, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function search_flag);
-extern int myrg_rrnd(MYRG_INFO *file,byte *buf,ulonglong pos);
-extern int myrg_rsame(MYRG_INFO *file,byte *record,int inx);
-extern int myrg_update(MYRG_INFO *file,const byte *old,byte *new_rec);
-extern int myrg_write(MYRG_INFO *info,byte *rec);
+extern int myrg_rrnd(MYRG_INFO *file,uchar *buf,ulonglong pos);
+extern int myrg_rsame(MYRG_INFO *file,uchar *record,int inx);
+extern int myrg_update(MYRG_INFO *file,const uchar *old,uchar *new_rec);
+extern int myrg_write(MYRG_INFO *info,uchar *rec);
extern int myrg_status(MYRG_INFO *file,MYMERGE_INFO *x,int flag);
extern int myrg_lock_database(MYRG_INFO *file,int lock_type);
extern int myrg_create(const char *name, const char **table_names,
diff --git a/include/mysql.h b/include/mysql.h
index 33bdf80ef73..b2133fa7292 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -53,7 +53,6 @@ typedef char my_bool;
#else
#define STDCALL __stdcall
#endif
-typedef char * gptr;
#ifndef my_socket_defined
#ifdef __WIN__
@@ -251,9 +250,9 @@ struct st_mysql_stmt;
typedef struct st_mysql
{
NET net; /* Communication parameters */
- gptr connector_fd; /* ConnectorFd for SSL */
- char *host,*user,*passwd,*unix_socket,*server_version,*host_info,*info;
- char *db;
+ unsigned char *connector_fd; /* ConnectorFd for SSL */
+ char *host,*user,*passwd,*unix_socket,*server_version,*host_info;
+ char *info, *db;
struct charset_info_st *charset;
MYSQL_FIELD *fields;
MEM_ROOT field_alloc;
@@ -752,9 +751,9 @@ typedef struct st_mysql_methods
my_bool (*read_query_result)(MYSQL *mysql);
my_bool (*advanced_command)(MYSQL *mysql,
enum enum_server_command command,
- const char *header,
+ const unsigned char *header,
unsigned long header_length,
- const char *arg,
+ const unsigned char *arg,
unsigned long arg_length,
my_bool skip_check,
MYSQL_STMT *stmt);
@@ -847,10 +846,10 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
*/
#define simple_command(mysql, command, arg, length, skip_check) \
- (*(mysql)->methods->advanced_command)(mysql, command, NullS, \
+ (*(mysql)->methods->advanced_command)(mysql, command, 0, \
0, arg, length, skip_check, NULL)
#define stmt_command(mysql, command, arg, length, stmt) \
- (*(mysql)->methods->advanced_command)(mysql, command, NullS, \
+ (*(mysql)->methods->advanced_command)(mysql, command, 0, \
0, arg, length, 1, stmt)
#ifdef __NETWARE__
diff --git a/include/mysql_com.h b/include/mysql_com.h
index 2223dbad6ab..acfc326bc9c 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -223,7 +223,7 @@ typedef struct st_net {
'query_cache_query' should be accessed only via query cache
functions and methods to maintain proper locking.
*/
- gptr query_cache_query;
+ unsigned char *query_cache_query;
my_bool report_error; /* We should report error (we have unreported error) */
my_bool return_errno;
@@ -344,13 +344,13 @@ my_bool my_net_init(NET *net, Vio* vio);
void my_net_local_init(NET *net);
void net_end(NET *net);
void net_clear(NET *net, my_bool clear_buffer);
-my_bool net_realloc(NET *net, unsigned long length);
+my_bool net_realloc(NET *net, size_t length);
my_bool net_flush(NET *net);
-my_bool my_net_write(NET *net,const char *packet,unsigned long len);
+my_bool my_net_write(NET *net,const unsigned char *packet, size_t len);
my_bool net_write_command(NET *net,unsigned char command,
- const char *header, unsigned long head_len,
- const char *packet, unsigned long len);
-int net_real_write(NET *net,const char *packet,unsigned long len);
+ const unsigned char *header, size_t head_len,
+ const unsigned char *packet, size_t len);
+int net_real_write(NET *net,const unsigned char *packet, size_t len);
unsigned long my_net_read(NET *net);
/*
@@ -446,7 +446,7 @@ void my_thread_end(void);
#ifdef _global_h
ulong STDCALL net_field_length(uchar **packet);
my_ulonglong net_field_length_ll(uchar **packet);
-char *net_store_length(char *pkg, ulonglong length);
+uchar *net_store_length(uchar *pkg, ulonglong length);
#endif
#ifdef __cplusplus
diff --git a/include/queues.h b/include/queues.h
index d46f867f3bf..4fd0f72484e 100644
--- a/include/queues.h
+++ b/include/queues.h
@@ -27,13 +27,13 @@ extern "C" {
#endif
typedef struct st_queue {
- byte **root;
+ uchar **root;
void *first_cmp_arg;
uint elements;
uint max_elements;
uint offset_to_key; /* compare is done on element+offset */
int max_at_top; /* Set if queue_top gives max */
- int (*compare)(void *, byte *,byte *);
+ int (*compare)(void *, uchar *,uchar *);
uint auto_extent;
} QUEUE;
@@ -44,7 +44,7 @@ typedef struct st_queue {
#define queue_set_cmp_arg(queue, set_arg) (queue)->first_cmp_arg= set_arg
#define queue_set_max_at_top(queue, set_arg) \
(queue)->max_at_top= set_arg ? (-1 ^ 1) : 0
-typedef int (*queue_compare)(void *,byte *, byte *);
+typedef int (*queue_compare)(void *,uchar *, uchar *);
int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
pbool max_at_top, queue_compare compare,
@@ -57,9 +57,9 @@ int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
void *first_cmp_arg);
int resize_queue(QUEUE *queue, uint max_elements);
void delete_queue(QUEUE *queue);
-void queue_insert(QUEUE *queue,byte *element);
-int queue_insert_safe(QUEUE *queue, byte *element);
-byte *queue_remove(QUEUE *queue,uint idx);
+void queue_insert(QUEUE *queue,uchar *element);
+int queue_insert_safe(QUEUE *queue, uchar *element);
+uchar *queue_remove(QUEUE *queue,uint idx);
#define queue_remove_all(queue) { (queue)->elements= 0; }
#define queue_is_full(queue) (queue->elements == queue->max_elements)
void _downheap(QUEUE *queue,uint idx);
diff --git a/include/sql_common.h b/include/sql_common.h
index a549fe6aeb5..80504140fae 100644
--- a/include/sql_common.h
+++ b/include/sql_common.h
@@ -32,9 +32,9 @@ void mysql_read_default_options(struct st_mysql_options *options,
const char *filename,const char *group);
my_bool
cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
- const char *header, ulong header_length,
- const char *arg, ulong arg_length, my_bool skip_check,
- MYSQL_STMT *stmt);
+ const unsigned char *header, ulong header_length,
+ const unsigned char *arg, ulong arg_length,
+ my_bool skip_check, MYSQL_STMT *stmt);
unsigned long cli_safe_read(MYSQL *mysql);
void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
const char *sqlstate);
diff --git a/include/sslopt-longopts.h b/include/sslopt-longopts.h
index d4aaf50992d..c76b5dcd252 100644
--- a/include/sslopt-longopts.h
+++ b/include/sslopt-longopts.h
@@ -17,29 +17,29 @@
{"ssl", OPT_SSL_SSL,
"Enable SSL for connection (automatically enabled with other flags). Disable with --skip-ssl.",
- (gptr*) &opt_use_ssl, (gptr*) &opt_use_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar **) &opt_use_ssl, (uchar **) &opt_use_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"ssl-ca", OPT_SSL_CA,
"CA file in PEM format (check OpenSSL docs, implies --ssl).",
- (gptr*) &opt_ssl_ca, (gptr*) &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
+ (uchar **) &opt_ssl_ca, (uchar **) &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-capath", OPT_SSL_CAPATH,
"CA directory (check OpenSSL docs, implies --ssl).",
- (gptr*) &opt_ssl_capath, (gptr*) &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
+ (uchar **) &opt_ssl_capath, (uchar **) &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format (implies --ssl).",
- (gptr*) &opt_ssl_cert, (gptr*) &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
+ (uchar **) &opt_ssl_cert, (uchar **) &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-cipher", OPT_SSL_CIPHER, "SSL cipher to use (implies --ssl).",
- (gptr*) &opt_ssl_cipher, (gptr*) &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG,
+ (uchar **) &opt_ssl_cipher, (uchar **) &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl).",
- (gptr*) &opt_ssl_key, (gptr*) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
+ (uchar **) &opt_ssl_key, (uchar **) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#ifdef MYSQL_CLIENT
{"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT,
"Verify server's \"Common Name\" in its cert against hostname used when connecting. This option is disabled by default.",
- (gptr*) &opt_ssl_verify_server_cert, (gptr*) &opt_ssl_verify_server_cert,
+ (uchar **) &opt_ssl_verify_server_cert, (uchar **) &opt_ssl_verify_server_cert,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
#endif /* HAVE_OPENSSL */
diff --git a/include/violite.h b/include/violite.h
index 04365213ec0..0e9c97bf215 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -51,8 +51,8 @@ Vio* vio_new_win32shared_memory(NET *net,HANDLE handle_file_map,
HANDLE event_client_wrote,
HANDLE event_client_read,
HANDLE event_conn_closed);
-int vio_read_pipe(Vio *vio, gptr buf, int size);
-int vio_write_pipe(Vio *vio, const gptr buf, int size);
+size_t vio_read_pipe(Vio *vio, uchar * buf, size_t size);
+size_t vio_write_pipe(Vio *vio, const uchar * buf, size_t size);
int vio_close_pipe(Vio * vio);
#else
#define HANDLE void *
@@ -62,9 +62,9 @@ void vio_delete(Vio* vio);
int vio_close(Vio* vio);
void vio_reset(Vio* vio, enum enum_vio_type type,
my_socket sd, HANDLE hPipe, uint flags);
-int vio_read(Vio *vio, gptr buf, int size);
-int vio_read_buff(Vio *vio, gptr buf, int size);
-int vio_write(Vio *vio, const gptr buf, int size);
+size_t vio_read(Vio *vio, uchar * buf, size_t size);
+size_t vio_read_buff(Vio *vio, uchar * buf, size_t size);
+size_t vio_write(Vio *vio, const uchar * buf, size_t size);
int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode);
my_bool vio_is_blocking(Vio *vio);
/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible */
@@ -128,8 +128,8 @@ void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd);
#endif /* HAVE_OPENSSL */
#ifdef HAVE_SMEM
-int vio_read_shared_memory(Vio *vio, gptr buf, int size);
-int vio_write_shared_memory(Vio *vio, const gptr buf, int size);
+size_t vio_read_shared_memory(Vio *vio, uchar * buf, size_t size);
+size_t vio_write_shared_memory(Vio *vio, const uchar * buf, size_t size);
int vio_close_shared_memory(Vio * vio);
#endif
@@ -187,8 +187,8 @@ struct st_vio
/* function pointers. They are similar for socket/SSL/whatever */
void (*viodelete)(Vio*);
int (*vioerrno)(Vio*);
- int (*read)(Vio*, gptr, int);
- int (*write)(Vio*, const gptr, int);
+ size_t (*read)(Vio*, uchar *, size_t);
+ size_t (*write)(Vio*, const uchar *, size_t);
int (*vioblocking)(Vio*, my_bool, my_bool *);
my_bool (*is_blocking)(Vio*);
int (*viokeepalive)(Vio*, my_bool);
@@ -210,7 +210,7 @@ struct st_vio
HANDLE event_client_wrote;
HANDLE event_client_read;
HANDLE event_conn_closed;
- long shared_memory_remain;
+ size_t shared_memory_remain;
char *shared_memory_pos;
NET *net;
#endif /* HAVE_SMEM */
diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h
index 4bc4bda5b63..1d415488037 100644
--- a/libmysql/client_settings.h
+++ b/libmysql/client_settings.h
@@ -14,7 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
extern uint mysql_port;
-extern my_string mysql_unix_port;
+extern char * mysql_unix_port;
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | \
CLIENT_TRANSACTIONS | \
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 374676ebe32..d33278819de 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -625,7 +625,7 @@ mysql_connect(MYSQL *mysql,const char *host,
if (!(res=mysql_real_connect(mysql,host,user,passwd,NullS,0,NullS,0)))
{
if (mysql->free_me)
- my_free((gptr) mysql,MYF(0));
+ my_free((uchar*) mysql,MYF(0));
}
mysql->reconnect= 1;
DBUG_RETURN(res);
@@ -946,7 +946,7 @@ static int default_local_infile_read(void *ptr, char *buf, uint buf_len)
int count;
default_local_infile_data*data = (default_local_infile_data *) ptr;
- if ((count= (int) my_read(data->fd, (byte *) buf, buf_len, MYF(0))) < 0)
+ if ((count= (int) my_read(data->fd, (uchar *) buf, buf_len, MYF(0))) < 0)
{
data->error_num= EE_READ; /* the errmsg for not entire file read */
my_snprintf(data->error_msg, sizeof(data->error_msg)-1,
@@ -4539,7 +4539,7 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
}
if (!((bit<<=1) & 255))
{
- bit= 1; /* To next byte */
+ bit= 1; /* To next uchar */
null_ptr++;
}
}
@@ -4732,7 +4732,7 @@ static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
DBUG_ASSERT(row <= row_end);
if (!((bit<<=1) & 255))
{
- bit= 1; /* To next byte */
+ bit= 1; /* To next uchar */
null_ptr++;
}
}
@@ -5043,7 +5043,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt)
}
}
- my_free((gptr) stmt, MYF(MY_WME));
+ my_free((uchar*) stmt, MYF(MY_WME));
DBUG_RETURN(test(rc));
}
diff --git a/libmysql/manager.c b/libmysql/manager.c
index a88c63123b0..2989c9dcccf 100644
--- a/libmysql/manager.c
+++ b/libmysql/manager.c
@@ -206,10 +206,10 @@ void STDCALL mysql_manager_close(MYSQL_MANAGER* con)
allocated in my_multimalloc() along with con->host, freeing
con->hosts frees the whole block
*/
- my_free((gptr)con->host,MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*)con->host,MYF(MY_ALLOW_ZERO_PTR));
net_end(&con->net);
if (con->free_me)
- my_free((gptr)con,MYF(0));
+ my_free((uchar*)con,MYF(0));
}
diff --git a/libmysqld/emb_qcache.cc b/libmysqld/emb_qcache.cc
index e6f35aa33a0..17549bfa96b 100644
--- a/libmysqld/emb_qcache.cc
+++ b/libmysqld/emb_qcache.cc
@@ -47,9 +47,9 @@ void Querycache_stream::store_short(ushort s)
cur_data+= 2;
return;
}
- *cur_data= ((byte *)(&s))[0];
+ *cur_data= ((uchar *)(&s))[0];
use_next_block(TRUE);
- *(cur_data++)= ((byte *)(&s))[1];
+ *(cur_data++)= ((uchar *)(&s))[1];
}
void Querycache_stream::store_int(uint i)
@@ -100,7 +100,7 @@ void Querycache_stream::store_ll(ulonglong ll)
}
memcpy(cur_data, &ll, rest_len);
use_next_block(TRUE);
- memcpy(cur_data, ((byte*)&ll)+rest_len, 8-rest_len);
+ memcpy(cur_data, ((uchar*)&ll)+rest_len, 8-rest_len);
cur_data+= 8-rest_len;
}
@@ -165,9 +165,9 @@ ushort Querycache_stream::load_short()
cur_data+= 2;
return result;
}
- ((byte*)&result)[0]= *cur_data;
+ ((uchar*)&result)[0]= *cur_data;
use_next_block(FALSE);
- ((byte*)&result)[1]= *(cur_data++);
+ ((uchar*)&result)[1]= *(cur_data++);
return result;
}
@@ -216,7 +216,7 @@ ulonglong Querycache_stream::load_ll()
}
memcpy(&result, cur_data, rest_len);
use_next_block(FALSE);
- memcpy(((byte*)&result)+rest_len, cur_data, 8-rest_len);
+ memcpy(((uchar*)&result)+rest_len, cur_data, 8-rest_len);
cur_data+= 8-rest_len;
return result;
}
@@ -245,7 +245,7 @@ char *Querycache_stream::load_str(MEM_ROOT *alloc, uint *str_len)
{
char *result;
*str_len= load_int();
- if (!(result= alloc_root(alloc, *str_len + 1)))
+ if (!(result= (char*) alloc_root(alloc, *str_len + 1)))
return 0;
load_str_only(result, *str_len);
return result;
@@ -259,7 +259,7 @@ int Querycache_stream::load_safe_str(MEM_ROOT *alloc, char **str, uint *str_len)
return 0;
}
(*str_len)--;
- if (!(*str= alloc_root(alloc, *str_len + 1)))
+ if (!(*str= (char*) alloc_root(alloc, *str_len + 1)))
return 1;
load_str_only(*str, *str_len);
return 0;
diff --git a/libmysqld/emb_qcache.h b/libmysqld/emb_qcache.h
index 5c5209902a1..6e320fbd967 100644
--- a/libmysqld/emb_qcache.h
+++ b/libmysqld/emb_qcache.h
@@ -15,8 +15,8 @@
class Querycache_stream
{
- byte *cur_data;
- byte *data_end;
+ uchar *cur_data;
+ uchar *data_end;
Query_cache_block *block;
uint headers_len;
public:
@@ -27,7 +27,7 @@ public:
Querycache_stream(Query_cache_block *ini_block, uint ini_headers_len) :
block(ini_block), headers_len(ini_headers_len)
{
- cur_data= ((byte*)block)+headers_len;
+ cur_data= ((uchar*)block)+headers_len;
data_end= cur_data + (block->used-headers_len);
#ifndef DBUG_OFF
first_block= ini_block;
@@ -54,7 +54,7 @@ public:
else
DBUG_ASSERT(block->type == Query_cache_block::RES_CONT);
- cur_data= ((byte*)block)+headers_len;
+ cur_data= ((uchar*)block)+headers_len;
data_end= cur_data + (block->used-headers_len);
}
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index dbec5bf6bbf..0ce9efca0cc 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -68,13 +68,13 @@ void embedded_get_error(MYSQL *mysql, MYSQL_DATA *data)
net->last_errno= ei->last_errno;
strmake(net->last_error, ei->info, sizeof(net->last_error));
memcpy(net->sqlstate, ei->sqlstate, sizeof(net->sqlstate));
- my_free((gptr) data, MYF(0));
+ my_free(data, MYF(0));
}
static my_bool
emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
- const char *header, ulong header_length,
- const char *arg, ulong arg_length, my_bool skip_check,
+ const uchar *header, ulong header_length,
+ const uchar *arg, ulong arg_length, my_bool skip_check,
MYSQL_STMT *stmt)
{
my_bool result= 1;
@@ -180,7 +180,7 @@ static MYSQL_FIELD *emb_list_fields(MYSQL *mysql)
res= ((THD*) mysql->thd)->cur_data;
((THD*) mysql->thd)->cur_data= 0;
mysql->field_alloc= res->alloc;
- my_free((gptr) res,MYF(0));
+ my_free(res,MYF(0));
mysql->status= MYSQL_STATUS_READY;
return mysql->fields;
}
@@ -209,7 +209,7 @@ static my_bool emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
stmt->fields= mysql->fields;
stmt->mem_root= res->alloc;
mysql->fields= NULL;
- my_free((gptr) res,MYF(0));
+ my_free(res,MYF(0));
}
return 0;
@@ -265,7 +265,7 @@ static my_bool emb_read_query_result(MYSQL *mysql)
thd->cur_data= res;
}
else
- my_free((gptr) res, MYF(0));
+ my_free(res, MYF(0));
return 0;
}
@@ -273,7 +273,7 @@ static my_bool emb_read_query_result(MYSQL *mysql)
static int emb_stmt_execute(MYSQL_STMT *stmt)
{
DBUG_ENTER("emb_stmt_execute");
- char header[5];
+ uchar header[5];
THD *thd;
my_bool res;
@@ -1063,22 +1063,22 @@ bool Protocol_text::store_null()
return false;
}
-bool Protocol::net_store_data(const char *from, uint length)
+bool Protocol::net_store_data(const uchar *from, size_t length)
{
char *field_buf;
if (!thd->mysql) // bootstrap file handling
- return false;
+ return FALSE;
- if (!(field_buf=alloc_root(alloc, length + sizeof(uint) + 1)))
- return true;
+ if (!(field_buf= (char*) alloc_root(alloc, length + sizeof(uint) + 1)))
+ return TRUE;
*(uint *)field_buf= length;
*next_field= field_buf + sizeof(uint);
- memcpy(*next_field, from, length);
+ memcpy((uchar*) *next_field, from, length);
(*next_field)[length]= 0;
if (next_mysql_field->max_length < length)
next_mysql_field->max_length=length;
++next_field;
++next_mysql_field;
- return false;
+ return FALSE;
}
diff --git a/mysys/array.c b/mysys/array.c
index 60f5b255e18..123121ba096 100644
--- a/mysys/array.c
+++ b/mysys/array.c
@@ -77,9 +77,9 @@ my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
FALSE Ok
*/
-my_bool insert_dynamic(DYNAMIC_ARRAY *array, gptr element)
+my_bool insert_dynamic(DYNAMIC_ARRAY *array, uchar* element)
{
- gptr buffer;
+ uchar* buffer;
if (array->elements == array->max_element)
{ /* Call only when nessesary */
if (!(buffer=alloc_dynamic(array)))
@@ -112,7 +112,7 @@ my_bool insert_dynamic(DYNAMIC_ARRAY *array, gptr element)
0 Error
*/
-byte *alloc_dynamic(DYNAMIC_ARRAY *array)
+uchar *alloc_dynamic(DYNAMIC_ARRAY *array)
{
if (array->elements == array->max_element)
{
@@ -141,7 +141,7 @@ byte *alloc_dynamic(DYNAMIC_ARRAY *array)
0 Array is empty
*/
-byte *pop_dynamic(DYNAMIC_ARRAY *array)
+uchar *pop_dynamic(DYNAMIC_ARRAY *array)
{
if (array->elements)
return array->buffer+(--array->elements * array->size_of_element);
@@ -166,7 +166,7 @@ byte *pop_dynamic(DYNAMIC_ARRAY *array)
FALSE Ok
*/
-my_bool set_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
+my_bool set_dynamic(DYNAMIC_ARRAY *array, uchar* element, uint idx)
{
if (idx >= array->elements)
{
@@ -183,7 +183,7 @@ my_bool set_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
array->buffer=new_ptr;
array->max_element=size;
}
- bzero((gptr) (array->buffer+array->elements*array->size_of_element),
+ bzero((uchar*) (array->buffer+array->elements*array->size_of_element),
(idx - array->elements)*array->size_of_element);
array->elements=idx+1;
}
@@ -198,11 +198,11 @@ my_bool set_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
SYNOPSIS
get_dynamic()
array
- gptr Element to be returned. If idx > elements contain zeroes.
+ uchar* Element to be returned. If idx > elements contain zeroes.
idx Index of element wanted.
*/
-void get_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
+void get_dynamic(DYNAMIC_ARRAY *array, uchar* element, uint idx)
{
if (idx >= array->elements)
{
@@ -285,7 +285,7 @@ void freeze_size(DYNAMIC_ARRAY *array)
*/
-int get_index_dynamic(DYNAMIC_ARRAY *array, gptr element)
+int get_index_dynamic(DYNAMIC_ARRAY *array, uchar* element)
{
uint ret;
if (array->buffer > element)
diff --git a/mysys/charset.c b/mysys/charset.c
index cce97677b14..c6065f87df3 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -376,7 +376,7 @@ void add_compiled_collation(CHARSET_INFO *cs)
cs->state|= MY_CS_AVAILABLE;
}
-static void *cs_alloc(uint size)
+static void *cs_alloc(size_t size)
{
return my_once_alloc(size, MYF(MY_WME));
}
@@ -594,13 +594,13 @@ CHARSET_INFO *get_charset_by_csname(const char *cs_name,
"big enough"
RETURN VALUES
- ~0 The escaped string did not fit in the to buffer
- >=0 The length of the escaped string
+ (size_t) -1 The escaped string did not fit in the to buffer
+ # The length of the escaped string
*/
-ulong escape_string_for_mysql(CHARSET_INFO *charset_info,
- char *to, ulong to_length,
- const char *from, ulong length)
+size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
+ char *to, size_t to_length,
+ const char *from, size_t length)
{
const char *to_start= to;
const char *end, *to_end=to_start + (to_length ? to_length-1 : 2*length);
@@ -684,7 +684,7 @@ ulong escape_string_for_mysql(CHARSET_INFO *charset_info,
}
}
*to= 0;
- return overflow ? (ulong)~0 : (ulong) (to - to_start);
+ return overflow ? (size_t) -1 : (size_t) (to - to_start);
}
@@ -738,9 +738,9 @@ CHARSET_INFO *fs_character_set()
>=0 The length of the escaped string
*/
-ulong escape_quotes_for_mysql(CHARSET_INFO *charset_info,
- char *to, ulong to_length,
- const char *from, ulong length)
+size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info,
+ char *to, size_t to_length,
+ const char *from, size_t length)
{
const char *to_start= to;
const char *end, *to_end=to_start + (to_length ? to_length-1 : 2*length);
diff --git a/mysys/checksum.c b/mysys/checksum.c
index 09e9c5b3730..4f86f6845f0 100644
--- a/mysys/checksum.c
+++ b/mysys/checksum.c
@@ -15,7 +15,8 @@
#include <my_global.h>
-#include "my_sys.h"
+#include <my_sys.h>
+#include <zlib.h>
/*
Calculate a long checksum for a memoryblock.
@@ -27,15 +28,15 @@
length length of the block
*/
-ha_checksum my_checksum(ha_checksum crc, const byte *pos, uint length)
+ha_checksum my_checksum(ha_checksum crc, const uchar *pos, size_t length)
{
#ifdef NOT_USED
- const byte *end=pos+length;
+ const uchar *end=pos+length;
for ( ; pos != end ; pos++)
crc=((crc << 8) + *((uchar*) pos)) + (crc >> (8*sizeof(ha_checksum)-8));
return crc;
#else
- return (ha_checksum)crc32((uint)crc, (const uchar *)pos, length);
+ return (ha_checksum)crc32((uint)crc, pos, length);
#endif
}
diff --git a/mysys/default.c b/mysys/default.c
index 926a8f530bf..3cc5b08e77c 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -268,9 +268,9 @@ static int handle_default_option(void *in_ctx, const char *group_name,
if (find_type((char *)group_name, ctx->group, 3))
{
- if (!(tmp= alloc_root(ctx->alloc, (uint) strlen(option) + 1)))
+ if (!(tmp= alloc_root(ctx->alloc, strlen(option) + 1)))
return 1;
- if (insert_dynamic(ctx->args, (gptr) &tmp))
+ if (insert_dynamic(ctx->args, (uchar*) &tmp))
return 1;
strmov(tmp, option);
}
@@ -426,7 +426,7 @@ int load_defaults(const char *conf_file, const char **groups,
/* copy name + found arguments + command line arguments to new array */
res[0]= argv[0][0]; /* Name MUST be set, even by embedded library */
- memcpy((gptr) (res+1), args.buffer, args.elements*sizeof(char*));
+ memcpy((uchar*) (res+1), args.buffer, args.elements*sizeof(char*));
/* Skip --defaults-xxx options */
(*argc)-= args_used;
(*argv)+= args_used;
@@ -442,7 +442,7 @@ int load_defaults(const char *conf_file, const char **groups,
}
if (*argc)
- memcpy((gptr) (res+1+args.elements), (char*) ((*argv)+1),
+ memcpy((uchar*) (res+1+args.elements), (char*) ((*argv)+1),
(*argc-1)*sizeof(char*));
res[args.elements+ *argc]=0; /* last null */
@@ -514,7 +514,7 @@ static int search_default_file(Process_option_func opt_handler,
# Returns pointer to the argument after the keyword.
*/
-static char *get_argument(const char *keyword, uint kwlen,
+static char *get_argument(const char *keyword, size_t kwlen,
char *ptr, char *name, uint line)
{
char *end;
@@ -718,10 +718,11 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
name,line);
goto err;
}
- for ( ; my_isspace(&my_charset_latin1,end[-1]) ; end--) ;/* Remove end space */
+ /* Remove end space */
+ for ( ; my_isspace(&my_charset_latin1,end[-1]) ; end--) ;
end[0]=0;
- strnmov(curr_gr, ptr, min((uint) (end-ptr)+1, 4096));
+ strmake(curr_gr, ptr, min((size_t) (end-ptr)+1, sizeof(curr_gr)-1));
/* signal that a new group is found */
opt_handler(handler_ctx, curr_gr, NULL);
@@ -743,7 +744,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
for ( ; my_isspace(&my_charset_latin1,end[-1]) ; end--) ;
if (!value)
{
- strmake(strmov(option,"--"),ptr,(uint) (end-ptr));
+ strmake(strmov(option,"--"),ptr, (size_t) (end-ptr));
if (opt_handler(handler_ctx, curr_gr, option))
goto err;
}
@@ -769,7 +770,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
value++;
value_end--;
}
- ptr=strnmov(strmov(option,"--"),ptr,(uint) (end-ptr));
+ ptr=strnmov(strmov(option,"--"),ptr,(size_t) (end-ptr));
*ptr++= '=';
for ( ; value != value_end; value++)
@@ -931,9 +932,9 @@ void print_defaults(const char *conf_file, const char **groups)
typedef UINT (WINAPI *GET_SYSTEM_WINDOWS_DIRECTORY)(LPSTR, UINT);
-static uint my_get_system_windows_directory(char *buffer, uint size)
+static size_t my_get_system_windows_directory(char *buffer, size_t size)
{
- uint count;
+ size_t count;
GET_SYSTEM_WINDOWS_DIRECTORY
func_ptr= (GET_SYSTEM_WINDOWS_DIRECTORY)
GetProcAddress(GetModuleHandle("kernel32.dll"),
diff --git a/mysys/default_modify.c b/mysys/default_modify.c
index f58d3e0da86..b2a43f511b9 100644
--- a/mysys/default_modify.c
+++ b/mysys/default_modify.c
@@ -68,9 +68,8 @@ int modify_defaults_file(const char *file_location, const char *option,
FILE *cnf_file;
MY_STAT file_stat;
char linebuff[BUFF_SIZE], *src_ptr, *dst_ptr, *file_buffer;
- uint opt_len= 0;
- uint optval_len= 0;
- uint sect_len, nr_newlines= 0, buffer_size;
+ size_t opt_len= 0, optval_len= 0, sect_len;
+ uint nr_newlines= 0, buffer_size;
my_bool in_section= FALSE, opt_applied= 0;
uint reserve_extended;
uint new_opt_len;
@@ -86,8 +85,8 @@ int modify_defaults_file(const char *file_location, const char *option,
if (option && option_value)
{
- opt_len= (uint) strlen(option);
- optval_len= (uint) strlen(option_value);
+ opt_len= strlen(option);
+ optval_len= strlen(option_value);
}
new_opt_len= opt_len + 1 + optval_len + NEWLINE_LEN;
@@ -110,7 +109,7 @@ int modify_defaults_file(const char *file_location, const char *option,
MYF(MY_WME))))
goto malloc_err;
- sect_len= (uint) strlen(section_name);
+ sect_len= strlen(section_name);
for (dst_ptr= file_buffer; fgets(linebuff, BUFF_SIZE, cnf_file); )
{
@@ -219,7 +218,7 @@ int modify_defaults_file(const char *file_location, const char *option,
if (my_chsize(fileno(cnf_file), (my_off_t) (dst_ptr - file_buffer), 0,
MYF(MY_WME)) ||
my_fseek(cnf_file, 0, MY_SEEK_SET, MYF(0)) ||
- my_fwrite(cnf_file, file_buffer, (uint) (dst_ptr - file_buffer),
+ my_fwrite(cnf_file, file_buffer, (size_t) (dst_ptr - file_buffer),
MYF(MY_NABP)))
goto err;
}
diff --git a/mysys/hash.c b/mysys/hash.c
index 60168e01e20..275e9d8d9c4 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -30,15 +30,15 @@
typedef struct st_hash_info {
uint next; /* index to next key */
- byte *data; /* data for current entry */
+ uchar *data; /* data for current entry */
} HASH_LINK;
static uint hash_mask(uint hashnr,uint buffmax,uint maxlength);
static void movelink(HASH_LINK *array,uint pos,uint next_link,uint newlink);
-static int hashcmp(const HASH *hash, HASH_LINK *pos, const byte *key,
- uint length);
+static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key,
+ size_t length);
-static uint calc_hash(const HASH *hash, const byte *key, uint length)
+static uint calc_hash(const HASH *hash, const uchar *key, size_t length)
{
ulong nr1=1, nr2=4;
hash->charset->coll->hash_sort(hash->charset,(uchar*) key,length,&nr1,&nr2);
@@ -47,12 +47,12 @@ static uint calc_hash(const HASH *hash, const byte *key, uint length)
my_bool
_hash_init(HASH *hash,CHARSET_INFO *charset,
- uint size,uint key_offset,uint key_length,
+ ulong size, size_t key_offset, size_t key_length,
hash_get_key get_key,
void (*free_element)(void*),uint flags CALLER_INFO_PROTO)
{
DBUG_ENTER("hash_init");
- DBUG_PRINT("enter",("hash: 0x%lx size: %d", (long) hash, size));
+ DBUG_PRINT("enter",("hash: 0x%lx size: %u", (long) hash, (uint) size));
hash->records=0;
if (my_init_dynamic_array_ci(&hash->array,sizeof(HASH_LINK),size,0))
@@ -140,18 +140,18 @@ void my_hash_reset(HASH *hash)
/* some helper functions */
/*
- This function is char* instead of byte* as HPUX11 compiler can't
+ This function is char* instead of uchar* as HPUX11 compiler can't
handle inline functions that are not defined as native types
*/
static inline char*
-hash_key(const HASH *hash, const byte *record, uint *length,
+hash_key(const HASH *hash, const uchar *record, size_t *length,
my_bool first)
{
if (hash->get_key)
return (*hash->get_key)(record,length,first);
*length=hash->key_length;
- return (byte*) record+hash->key_offset;
+ return (uchar*) record+hash->key_offset;
}
/* Calculate pos according to keys */
@@ -165,8 +165,8 @@ static uint hash_mask(uint hashnr,uint buffmax,uint maxlength)
static uint hash_rec_mask(const HASH *hash, HASH_LINK *pos,
uint buffmax, uint maxlength)
{
- uint length;
- byte *key= (byte*) hash_key(hash,pos->data,&length,0);
+ size_t length;
+ uchar *key= (uchar*) hash_key(hash,pos->data,&length,0);
return hash_mask(calc_hash(hash,key,length),buffmax,maxlength);
}
@@ -177,15 +177,15 @@ static
#if !defined(__USLC__) && !defined(__sgi)
inline
#endif
-unsigned int rec_hashnr(HASH *hash,const byte *record)
+unsigned int rec_hashnr(HASH *hash,const uchar *record)
{
- uint length;
- byte *key= (byte*) hash_key(hash,record,&length,0);
+ size_t length;
+ uchar *key= (uchar*) hash_key(hash,record,&length,0);
return calc_hash(hash,key,length);
}
-gptr hash_search(const HASH *hash, const byte *key, uint length)
+uchar* hash_search(const HASH *hash, const uchar *key, size_t length)
{
HASH_SEARCH_STATE state;
return hash_first(hash, key, length, &state);
@@ -198,7 +198,7 @@ gptr hash_search(const HASH *hash, const byte *key, uint length)
Assigns the number of the found record to HASH_SEARCH_STATE state
*/
-gptr hash_first(const HASH *hash, const byte *key, uint length,
+uchar* hash_first(const HASH *hash, const uchar *key, size_t length,
HASH_SEARCH_STATE *current_record)
{
HASH_LINK *pos;
@@ -235,7 +235,7 @@ gptr hash_first(const HASH *hash, const byte *key, uint length,
/* Get next record with identical key */
/* Can only be called if previous calls was hash_search */
-gptr hash_next(const HASH *hash, const byte *key, uint length,
+uchar* hash_next(const HASH *hash, const uchar *key, size_t length,
HASH_SEARCH_STATE *current_record)
{
HASH_LINK *pos;
@@ -292,11 +292,11 @@ static void movelink(HASH_LINK *array,uint find,uint next_link,uint newlink)
!= 0 key of record != key
*/
-static int hashcmp(const HASH *hash, HASH_LINK *pos, const byte *key,
- uint length)
+static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key,
+ size_t length)
{
- uint rec_keylength;
- byte *rec_key= (byte*) hash_key(hash,pos->data,&rec_keylength,1);
+ size_t rec_keylength;
+ uchar *rec_key= (uchar*) hash_key(hash,pos->data,&rec_keylength,1);
return ((length && length != rec_keylength) ||
my_strnncoll(hash->charset, (uchar*) rec_key, rec_keylength,
(uchar*) key, rec_keylength));
@@ -305,11 +305,11 @@ static int hashcmp(const HASH *hash, HASH_LINK *pos, const byte *key,
/* Write a hash-key to the hash-index */
-my_bool my_hash_insert(HASH *info,const byte *record)
+my_bool my_hash_insert(HASH *info,const uchar *record)
{
int flag;
uint halfbuff,hash_nr,first_index,idx;
- byte *ptr_to_rec,*ptr_to_rec2;
+ uchar *ptr_to_rec,*ptr_to_rec2;
HASH_LINK *data,*empty,*gpos,*gpos2,*pos;
LINT_INIT(gpos); LINT_INIT(gpos2);
@@ -357,7 +357,7 @@ my_bool my_hash_insert(HASH *info,const byte *record)
{
/* Change link of previous LOW-key */
gpos->data=ptr_to_rec;
- gpos->next=(uint) (pos-data);
+ gpos->next= (uint) (pos-data);
flag= (flag & HIGHFIND) | (LOWFIND | LOWUSED);
}
gpos=pos;
@@ -406,7 +406,7 @@ my_bool my_hash_insert(HASH *info,const byte *record)
pos=data+idx;
if (pos == empty)
{
- pos->data=(byte*) record;
+ pos->data=(uchar*) record;
pos->next=NO_RECORD;
}
else
@@ -416,12 +416,12 @@ my_bool my_hash_insert(HASH *info,const byte *record)
gpos=data+hash_rec_mask(info,pos,info->blength,info->records+1);
if (pos == gpos)
{
- pos->data=(byte*) record;
+ pos->data=(uchar*) record;
pos->next=(uint) (empty - data);
}
else
{
- pos->data=(byte*) record;
+ pos->data=(uchar*) record;
pos->next=NO_RECORD;
movelink(data,(uint) (pos-data),(uint) (gpos-data),(uint) (empty-data));
}
@@ -438,7 +438,7 @@ my_bool my_hash_insert(HASH *info,const byte *record)
** if there is a free-function it's called for record if found
******************************************************************************/
-my_bool hash_delete(HASH *hash,byte *record)
+my_bool hash_delete(HASH *hash,uchar *record)
{
uint blength,pos2,pos_hashnr,lastpos_hashnr,idx,empty_index;
HASH_LINK *data,*lastpos,*gpos,*pos,*pos3,*empty;
@@ -516,7 +516,7 @@ my_bool hash_delete(HASH *hash,byte *record)
exit:
VOID(pop_dynamic(&hash->array));
if (hash->free)
- (*hash->free)((byte*) record);
+ (*hash->free)((uchar*) record);
DBUG_RETURN(0);
}
@@ -525,7 +525,8 @@ exit:
This is much more efficent than using a delete & insert.
*/
-my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length)
+my_bool hash_update(HASH *hash, uchar *record, uchar *old_key,
+ size_t old_key_length)
{
uint idx,new_index,new_pos_index,blength,records,empty;
HASH_LINK org_link,*data,*previous,*pos;
@@ -589,7 +590,7 @@ my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length)
}
-byte *hash_element(HASH *hash,uint idx)
+uchar *hash_element(HASH *hash,ulong idx)
{
if (idx < hash->records)
return dynamic_element(&hash->array,idx,HASH_LINK*)->data;
@@ -602,7 +603,7 @@ byte *hash_element(HASH *hash,uint idx)
isn't changed
*/
-void hash_replace(HASH *hash, HASH_SEARCH_STATE *current_record, byte *new_row)
+void hash_replace(HASH *hash, HASH_SEARCH_STATE *current_record, uchar *new_row)
{
if (*current_record != NO_RECORD) /* Safety */
dynamic_element(&hash->array, *current_record, HASH_LINK*)->data= new_row;
diff --git a/mysys/list.c b/mysys/list.c
index ccc3f495093..aaadd686365 100644
--- a/mysys/list.c
+++ b/mysys/list.c
@@ -61,8 +61,8 @@ void list_free(LIST *root, uint free_data)
{
next=root->next;
if (free_data)
- my_free((gptr) root->data,MYF(0));
- my_free((gptr) root,MYF(0));
+ my_free((uchar*) root->data,MYF(0));
+ my_free((uchar*) root,MYF(0));
root=next;
}
}
@@ -101,7 +101,7 @@ uint list_length(LIST *list)
}
-int list_walk(LIST *list, list_walk_action action, gptr argument)
+int list_walk(LIST *list, list_walk_action action, uchar* argument)
{
int error=0;
while (list)
diff --git a/mysys/mf_cache.c b/mysys/mf_cache.c
index a3abb3bc974..f0df0f3fa77 100644
--- a/mysys/mf_cache.c
+++ b/mysys/mf_cache.c
@@ -58,7 +58,7 @@ static my_bool cache_remove_open_tmp(IO_CACHE *cache __attribute__((unused)),
*/
my_bool open_cached_file(IO_CACHE *cache, const char* dir, const char *prefix,
- uint cache_size, myf cache_myflags)
+ size_t cache_size, myf cache_myflags)
{
DBUG_ENTER("open_cached_file");
cache->dir= dir ? my_strdup(dir,MYF(cache_myflags & MY_WME)) : (char*) 0;
diff --git a/mysys/mf_dirname.c b/mysys/mf_dirname.c
index 87a4a453734..1b428ded751 100644
--- a/mysys/mf_dirname.c
+++ b/mysys/mf_dirname.c
@@ -18,9 +18,9 @@
/* Functions definied in this file */
-uint dirname_length(const char *name)
+size_t dirname_length(const char *name)
{
- register my_string pos,gpos;
+ register char *pos, *gpos;
#ifdef BASKSLASH_MBTAIL
CHARSET_INFO *fs= fs_character_set();
#endif
@@ -47,21 +47,31 @@ uint dirname_length(const char *name)
)
gpos=pos;
}
- return ((uint) (uint) (gpos+1-(char*) name));
+ return (size_t) (gpos+1-(char*) name);
}
- /* Gives directory part of filename. Directory ends with '/' */
- /* Returns length of directory part */
+/*
+ Gives directory part of filename. Directory ends with '/'
+
+ SYNOPSIS
+ dirname_part()
+ to Store directory name here
+ name Original name
+ to_length Store length of 'to' here
+
+ RETURN
+ # Length of directory part in 'name'
+*/
-uint dirname_part(my_string to, const char *name)
+size_t dirname_part(char *to, const char *name, size_t *to_res_length)
{
- uint length;
+ size_t length;
DBUG_ENTER("dirname_part");
DBUG_PRINT("enter",("'%s'",name));
length=dirname_length(name);
- convert_dirname(to, name, name+length);
+ *to_res_length= (size_t) (convert_dirname(to, name, name+length) - to);
DBUG_RETURN(length);
} /* dirname */
@@ -142,7 +152,7 @@ char *convert_dirname(char *to, const char *from, const char *from_end)
}
#else
/* This is ok even if to == from, becasue we need to cut the string */
- to= strmake(to, from, (uint) (from_end-from));
+ to= strmake(to, from, (size_t) (from_end-from));
#endif
/* Add FN_LIBCHAR to the end of directory path */
diff --git a/mysys/mf_fn_ext.c b/mysys/mf_fn_ext.c
index 20e835fe641..da7fac3de73 100644
--- a/mysys/mf_fn_ext.c
+++ b/mysys/mf_fn_ext.c
@@ -33,21 +33,22 @@
points at the end ASCII(0) of the filename.
*/
-my_string fn_ext(const char *name)
+char *fn_ext(const char *name)
{
- register my_string pos,gpos;
+ register const char *pos, *gpos;
DBUG_ENTER("fn_ext");
DBUG_PRINT("mfunkt",("name: '%s'",name));
#if defined(FN_DEVCHAR) || defined(FN_C_AFTER_DIR) || defined(BASKSLASH_MBTAIL)
{
char buff[FN_REFLEN];
- gpos=(my_string) name+dirname_part(buff,(char*) name);
+ size_t res_length;
+ gpos= name+ dirname_part(buff,(char*) name, &res_length);
}
#else
if (!(gpos= strrchr(name, FN_LIBCHAR)))
- gpos= (my_string) name;
+ gpos= name;
#endif
pos=strchr(gpos,FN_EXTCHAR);
- DBUG_RETURN (pos ? pos : strend(gpos));
+ DBUG_RETURN((char*) (pos ? pos : strend(gpos)));
} /* fn_ext */
diff --git a/mysys/mf_format.c b/mysys/mf_format.c
index 3e5eeef6420..f199132626b 100644
--- a/mysys/mf_format.c
+++ b/mysys/mf_format.c
@@ -23,18 +23,19 @@
The arguments should be in unix format.
*/
-my_string fn_format(my_string to, const char *name, const char *dir,
+char * fn_format(char * to, const char *name, const char *dir,
const char *extension, uint flag)
{
- reg1 uint length;
char dev[FN_REFLEN], buff[FN_REFLEN], *pos, *startpos;
const char *ext;
+ reg1 size_t length;
+ size_t dev_length;
DBUG_ENTER("fn_format");
DBUG_PRINT("enter",("name: %s dir: %s extension: %s flag: %d",
name,dir,extension,flag));
/* Copy and skip directory */
- name+=(length=dirname_part(dev,(startpos=(my_string) name)));
+ name+=(length=dirname_part(dev, (startpos=(char *) name), &dev_length));
if (length == 0 || (flag & MY_REPLACE_DIR))
{
/* Use given directory */
@@ -63,7 +64,7 @@ my_string fn_format(my_string to, const char *name, const char *dir,
}
else
{
- length=(uint) (pos-(char*) name); /* Change extension */
+ length= (size_t) (pos-(char*) name); /* Change extension */
ext= extension;
}
}
@@ -76,18 +77,19 @@ my_string fn_format(my_string to, const char *name, const char *dir,
if (strlen(dev)+length+strlen(ext) >= FN_REFLEN || length >= FN_LEN )
{
/* To long path, return original or NULL */
- uint tmp_length;
+ size_t tmp_length;
if (flag & MY_SAFE_PATH)
return NullS;
- tmp_length=strlength(startpos);
- DBUG_PRINT("error",("dev: '%s' ext: '%s' length: %d",dev,ext,length));
+ tmp_length= strlength(startpos);
+ DBUG_PRINT("error",("dev: '%s' ext: '%s' length: %u",dev,ext,
+ (uint) length));
(void) strmake(to,startpos,min(tmp_length,FN_REFLEN-1));
}
else
{
if (to == startpos)
{
- bmove(buff,(char*) name,length); /* Save name for last copy */
+ bmove(buff,(uchar*) name,length); /* Save name for last copy */
name=buff;
}
pos=strmake(strmov(to,dev),name,length);
@@ -109,18 +111,18 @@ my_string fn_format(my_string to, const char *name, const char *dir,
} /* fn_format */
- /*
- strlength(const string str)
- Return length of string with end-space:s not counted.
- */
+/*
+ strlength(const string str)
+ Return length of string with end-space:s not counted.
+*/
-size_s strlength(const char *str)
+size_t strlength(const char *str)
{
- reg1 my_string pos;
- reg2 my_string found;
+ reg1 const char * pos;
+ reg2 const char * found;
DBUG_ENTER("strlength");
- pos=found=(char*) str;
+ pos= found= str;
while (*pos)
{
@@ -136,5 +138,5 @@ size_s strlength(const char *str)
found=pos;
while (*++pos == ' ') {};
}
- DBUG_RETURN((size_s) (found-(char*) str));
+ DBUG_RETURN((size_t) (found - str));
} /* strlength */
diff --git a/mysys/mf_getdate.c b/mysys/mf_getdate.c
index 1ced312848e..2f08027a477 100644
--- a/mysys/mf_getdate.c
+++ b/mysys/mf_getdate.c
@@ -34,7 +34,7 @@
*/
-void get_date(register my_string to, int flag, time_t date)
+void get_date(register char * to, int flag, time_t date)
{
reg2 struct tm *start_time;
time_t skr;
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index d2ace12da4d..58650733490 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -152,11 +152,11 @@ init_functions(IO_CACHE* info)
# error
*/
-int init_io_cache(IO_CACHE *info, File file, uint cachesize,
+int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
enum cache_type type, my_off_t seek_offset,
pbool use_async_io, myf cache_myflags)
{
- uint min_cache;
+ size_t min_cache;
my_off_t pos;
my_off_t end_of_file= ~(my_off_t) 0;
DBUG_ENTER("init_io_cache");
@@ -214,7 +214,7 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
/* Trim cache size if the file is very small */
if ((my_off_t) cachesize > end_of_file-seek_offset+IO_SIZE*2-1)
{
- cachesize=(uint) (end_of_file-seek_offset)+IO_SIZE*2-1;
+ cachesize= (size_t) (end_of_file-seek_offset)+IO_SIZE*2-1;
use_async_io=0; /* No need to use async */
}
}
@@ -223,18 +223,17 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
if (type != READ_NET && type != WRITE_NET)
{
/* Retry allocating memory in smaller blocks until we get one */
- cachesize=(uint) ((ulong) (cachesize + min_cache-1) &
- (ulong) ~(min_cache-1));
+ cachesize= ((cachesize + min_cache-1) & ~(min_cache-1));
for (;;)
{
- uint buffer_block;
+ size_t buffer_block;
if (cachesize < min_cache)
cachesize = min_cache;
- buffer_block = cachesize;
+ buffer_block= cachesize;
if (type == SEQ_READ_APPEND)
buffer_block *= 2;
if ((info->buffer=
- (byte*) my_malloc(buffer_block,
+ (uchar*) my_malloc(buffer_block,
MYF((cache_myflags & ~ MY_WME) |
(cachesize == min_cache ? MY_WME : 0)))) != 0)
{
@@ -247,11 +246,11 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
if (cachesize == min_cache)
DBUG_RETURN(2); /* Can't alloc cache */
/* Try with less memory */
- cachesize= (uint) ((ulong) cachesize*3/4 & (ulong)~(min_cache-1));
+ cachesize= (cachesize*3/4 & ~(min_cache-1));
}
}
- DBUG_PRINT("info",("init_io_cache: cachesize = %u",cachesize));
+ DBUG_PRINT("info",("init_io_cache: cachesize = %lu", (ulong) cachesize));
info->read_length=info->buffer_length=cachesize;
info->myflags=cache_myflags & ~(MY_NABP | MY_FNABP);
info->request_pos= info->read_pos= info->write_pos = info->buffer;
@@ -350,7 +349,7 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
seek_offset <= my_b_tell(info))
{
/* Reuse current buffer without flushing it to disk */
- byte *pos;
+ uchar *pos;
if (info->type == WRITE_CACHE && type == READ_CACHE)
{
info->read_end=info->write_pos;
@@ -452,22 +451,22 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
1 Error: can't read requested characters
*/
-int _my_b_read(register IO_CACHE *info, byte *Buffer, uint Count)
+int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
{
- uint length,diff_length,left_length;
- my_off_t max_length, pos_in_file;
+ size_t length,diff_length,left_length, max_length;
+ my_off_t pos_in_file;
DBUG_ENTER("_my_b_read");
- if ((left_length=(uint) (info->read_end-info->read_pos)))
+ if ((left_length= (size_t) (info->read_end-info->read_pos)))
{
DBUG_ASSERT(Count >= left_length); /* User is not using my_b_read() */
- memcpy(Buffer,info->read_pos, (size_t) (left_length));
+ memcpy(Buffer,info->read_pos, left_length);
Buffer+=left_length;
Count-=left_length;
}
/* pos_in_file always point on where info->buffer was read */
- pos_in_file=info->pos_in_file+(uint) (info->read_end - info->buffer);
+ pos_in_file=info->pos_in_file+ (size_t) (info->read_end - info->buffer);
/*
Whenever a function which operates on IO_CACHE flushes/writes
@@ -496,20 +495,20 @@ int _my_b_read(register IO_CACHE *info, byte *Buffer, uint Count)
}
}
- diff_length=(uint) (pos_in_file & (IO_SIZE-1));
- if (Count >= (uint) (IO_SIZE+(IO_SIZE-diff_length)))
+ diff_length= (size_t) (pos_in_file & (IO_SIZE-1));
+ if (Count >= (size_t) (IO_SIZE+(IO_SIZE-diff_length)))
{ /* Fill first intern buffer */
- uint read_length;
+ size_t read_length;
if (info->end_of_file <= pos_in_file)
{ /* End of file */
- info->error=(int) left_length;
+ info->error= (int) left_length;
DBUG_RETURN(1);
}
- length=(Count & (uint) ~(IO_SIZE-1))-diff_length;
- if ((read_length=my_read(info->file,Buffer,(uint) length,info->myflags))
- != (uint) length)
+ length=(Count & (size_t) ~(IO_SIZE-1))-diff_length;
+ if ((read_length= my_read(info->file,Buffer, length, info->myflags))
+ != length)
{
- info->error= (read_length == (uint) -1 ? -1 :
+ info->error= (read_length == (size_t) -1 ? -1 :
(int) (read_length+left_length));
DBUG_RETURN(1);
}
@@ -520,10 +519,10 @@ int _my_b_read(register IO_CACHE *info, byte *Buffer, uint Count)
diff_length=0;
}
- max_length=info->read_length-diff_length;
+ max_length= info->read_length-diff_length;
if (info->type != READ_FIFO &&
max_length > (info->end_of_file - pos_in_file))
- max_length = info->end_of_file - pos_in_file;
+ max_length= (size_t) (info->end_of_file - pos_in_file);
if (!max_length)
{
if (Count)
@@ -533,21 +532,21 @@ int _my_b_read(register IO_CACHE *info, byte *Buffer, uint Count)
}
length=0; /* Didn't read any chars */
}
- else if ((length=my_read(info->file,info->buffer,(uint) max_length,
- info->myflags)) < Count ||
- length == (uint) -1)
+ else if ((length= my_read(info->file,info->buffer, max_length,
+ info->myflags)) < Count ||
+ length == (size_t) -1)
{
- if (length != (uint) -1)
- memcpy(Buffer,info->buffer,(size_t) length);
+ if (length != (size_t) -1)
+ memcpy(Buffer, info->buffer, length);
info->pos_in_file= pos_in_file;
- info->error= length == (uint) -1 ? -1 : (int) (length+left_length);
+ info->error= length == (size_t) -1 ? -1 : (int) (length+left_length);
info->read_pos=info->read_end=info->buffer;
DBUG_RETURN(1);
}
info->read_pos=info->buffer+Count;
info->read_end=info->buffer+length;
info->pos_in_file=pos_in_file;
- memcpy(Buffer,info->buffer,(size_t) Count);
+ memcpy(Buffer, info->buffer, Count);
DBUG_RETURN(0);
}
@@ -859,8 +858,9 @@ static int lock_io_cache(IO_CACHE *cache, my_off_t pos)
/* Another thread did read the block already. */
}
DBUG_PRINT("io_cache_share", ("reader awoke, going to process %u bytes",
- cshare->read_end ? (uint)
- (cshare->read_end - cshare->buffer) : 0));
+ (uint) (cshare->read_end ? (size_t)
+ (cshare->read_end - cshare->buffer) :
+ 0)));
/*
Leave the lock. Do not call unlock_io_cache() later. The thread that
@@ -952,33 +952,33 @@ static void unlock_io_cache(IO_CACHE *cache)
1 Error: can't read requested characters
*/
-int _my_b_read_r(register IO_CACHE *cache, byte *Buffer, uint Count)
+int _my_b_read_r(register IO_CACHE *cache, uchar *Buffer, size_t Count)
{
my_off_t pos_in_file;
- uint length, diff_length, left_length;
+ size_t length, diff_length, left_length;
IO_CACHE_SHARE *cshare= cache->share;
DBUG_ENTER("_my_b_read_r");
- if ((left_length= (uint) (cache->read_end - cache->read_pos)))
+ if ((left_length= (size_t) (cache->read_end - cache->read_pos)))
{
DBUG_ASSERT(Count >= left_length); /* User is not using my_b_read() */
- memcpy(Buffer, cache->read_pos, (size_t) (left_length));
+ memcpy(Buffer, cache->read_pos, left_length);
Buffer+= left_length;
Count-= left_length;
}
while (Count)
{
- int cnt, len;
+ size_t cnt, len;
pos_in_file= cache->pos_in_file + (cache->read_end - cache->buffer);
- diff_length= (uint) (pos_in_file & (IO_SIZE-1));
+ diff_length= (size_t) (pos_in_file & (IO_SIZE-1));
length=IO_ROUND_UP(Count+diff_length)-diff_length;
length= ((length <= cache->read_length) ?
length + IO_ROUND_DN(cache->read_length - length) :
length - IO_ROUND_UP(length - cache->read_length));
if (cache->type != READ_FIFO &&
(length > (cache->end_of_file - pos_in_file)))
- length= (uint) (cache->end_of_file - pos_in_file);
+ length= (size_t) (cache->end_of_file - pos_in_file);
if (length == 0)
{
cache->error= (int) left_length;
@@ -1013,12 +1013,12 @@ int _my_b_read_r(register IO_CACHE *cache, byte *Buffer, uint Count)
DBUG_RETURN(1);
}
}
- len= (int) my_read(cache->file, cache->buffer, length, cache->myflags);
+ len= my_read(cache->file, cache->buffer, length, cache->myflags);
}
- DBUG_PRINT("io_cache_share", ("read %d bytes", len));
+ DBUG_PRINT("io_cache_share", ("read %lu bytes", (ulong) len));
- cache->read_end= cache->buffer + (len == -1 ? 0 : len);
- cache->error= (len == (int)length ? 0 : len);
+ cache->read_end= cache->buffer + (len == (size_t) -1 ? 0 : len);
+ cache->error= (len == length ? 0 : (int) len);
cache->pos_in_file= pos_in_file;
/* Copy important values to the share. */
@@ -1039,19 +1039,20 @@ int _my_b_read_r(register IO_CACHE *cache, byte *Buffer, uint Count)
cache->read_end= cshare->read_end;
cache->pos_in_file= cshare->pos_in_file;
- len= (int) ((cache->error == -1) ? -1 : cache->read_end - cache->buffer);
+ len= ((cache->error == -1) ? (size_t) -1 :
+ (size_t) (cache->read_end - cache->buffer));
}
cache->read_pos= cache->buffer;
cache->seek_not_done= 0;
- if (len <= 0)
+ if (len == 0 || len == (size_t) -1)
{
- DBUG_PRINT("io_cache_share", ("reader error. len %d left %u",
- len, left_length));
+ DBUG_PRINT("io_cache_share", ("reader error. len %lu left %lu",
+ (ulong) len, (ulong) left_length));
cache->error= (int) left_length;
DBUG_RETURN(1);
}
- cnt= ((uint) len > Count) ? (int) Count : len;
- memcpy(Buffer, cache->read_pos, (size_t) cnt);
+ cnt= (len > Count) ? Count : len;
+ memcpy(Buffer, cache->read_pos, cnt);
Count -= cnt;
Buffer+= cnt;
left_length+= cnt;
@@ -1079,7 +1080,7 @@ int _my_b_read_r(register IO_CACHE *cache, byte *Buffer, uint Count)
*/
static void copy_to_read_buffer(IO_CACHE *write_cache,
- const byte *write_buffer, uint write_length)
+ const uchar *write_buffer, size_t write_length)
{
IO_CACHE_SHARE *cshare= write_cache->share;
@@ -1090,7 +1091,7 @@ static void copy_to_read_buffer(IO_CACHE *write_cache,
*/
while (write_length)
{
- uint copy_length= min(write_length, write_cache->buffer_length);
+ size_t copy_length= min(write_length, write_cache->buffer_length);
int __attribute__((unused)) rc;
rc= lock_io_cache(write_cache, write_cache->pos_in_file);
@@ -1126,33 +1127,32 @@ static void copy_to_read_buffer(IO_CACHE *write_cache,
1 Failed to read
*/
-int _my_b_seq_read(register IO_CACHE *info, byte *Buffer, uint Count)
+int _my_b_seq_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
{
- uint length,diff_length,left_length,save_count;
- my_off_t max_length, pos_in_file;
+ size_t length, diff_length, left_length, save_count, max_length;
+ my_off_t pos_in_file;
save_count=Count;
/* first, read the regular buffer */
- if ((left_length=(uint) (info->read_end-info->read_pos)))
+ if ((left_length=(size_t) (info->read_end-info->read_pos)))
{
DBUG_ASSERT(Count > left_length); /* User is not using my_b_read() */
- memcpy(Buffer,info->read_pos, (size_t) (left_length));
+ memcpy(Buffer,info->read_pos, left_length);
Buffer+=left_length;
Count-=left_length;
}
lock_append_buffer(info);
/* pos_in_file always point on where info->buffer was read */
- if ((pos_in_file=info->pos_in_file+(uint) (info->read_end - info->buffer)) >=
- info->end_of_file)
+ if ((pos_in_file=info->pos_in_file +
+ (size_t) (info->read_end - info->buffer)) >= info->end_of_file)
goto read_append_buffer;
/*
With read-append cache we must always do a seek before we read,
because the write could have moved the file pointer astray
*/
- if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0))
- == MY_FILEPOS_ERROR)
+ if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) == MY_FILEPOS_ERROR)
{
info->error= -1;
unlock_append_buffer(info);
@@ -1160,16 +1160,17 @@ int _my_b_seq_read(register IO_CACHE *info, byte *Buffer, uint Count)
}
info->seek_not_done=0;
- diff_length=(uint) (pos_in_file & (IO_SIZE-1));
+ diff_length= (size_t) (pos_in_file & (IO_SIZE-1));
/* now the second stage begins - read from file descriptor */
- if (Count >= (uint) (IO_SIZE+(IO_SIZE-diff_length)))
- { /* Fill first intern buffer */
- uint read_length;
+ if (Count >= (size_t) (IO_SIZE+(IO_SIZE-diff_length)))
+ {
+ /* Fill first intern buffer */
+ size_t read_length;
- length=(Count & (uint) ~(IO_SIZE-1))-diff_length;
- if ((read_length=my_read(info->file,Buffer,(uint) length,info->myflags)) ==
- (uint)-1)
+ length=(Count & (size_t) ~(IO_SIZE-1))-diff_length;
+ if ((read_length= my_read(info->file,Buffer, length,
+ info->myflags)) == (size_t) -1)
{
info->error= -1;
unlock_append_buffer(info);
@@ -1179,7 +1180,7 @@ int _my_b_seq_read(register IO_CACHE *info, byte *Buffer, uint Count)
Buffer+=read_length;
pos_in_file+=read_length;
- if (read_length != (uint) length)
+ if (read_length != length)
{
/*
We only got part of data; Read the rest of the data from the
@@ -1191,9 +1192,9 @@ int _my_b_seq_read(register IO_CACHE *info, byte *Buffer, uint Count)
diff_length=0;
}
- max_length=info->read_length-diff_length;
+ max_length= info->read_length-diff_length;
if (max_length > (info->end_of_file - pos_in_file))
- max_length = info->end_of_file - pos_in_file;
+ max_length= (size_t) (info->end_of_file - pos_in_file);
if (!max_length)
{
if (Count)
@@ -1202,9 +1203,8 @@ int _my_b_seq_read(register IO_CACHE *info, byte *Buffer, uint Count)
}
else
{
- length=my_read(info->file,info->buffer,(uint) max_length,
- info->myflags);
- if (length == (uint) -1)
+ length= my_read(info->file,info->buffer, max_length, info->myflags);
+ if (length == (size_t) -1)
{
info->error= -1;
unlock_append_buffer(info);
@@ -1212,7 +1212,7 @@ int _my_b_seq_read(register IO_CACHE *info, byte *Buffer, uint Count)
}
if (length < Count)
{
- memcpy(Buffer,info->buffer,(size_t) length);
+ memcpy(Buffer, info->buffer, length);
Count -= length;
Buffer += length;
@@ -1241,9 +1241,9 @@ read_append_buffer:
{
/* First copy the data to Count */
- uint len_in_buff = (uint) (info->write_pos - info->append_read_pos);
- uint copy_len;
- uint transfer_len;
+ size_t len_in_buff = (size_t) (info->write_pos - info->append_read_pos);
+ size_t copy_len;
+ size_t transfer_len;
DBUG_ASSERT(info->append_read_pos <= info->write_pos);
/*
@@ -1288,15 +1288,16 @@ read_append_buffer:
0 Success
1 An error has occurred; IO_CACHE to error state.
*/
-int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
+
+int _my_b_async_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
{
- uint length,read_length,diff_length,left_length,use_length,org_Count;
- my_off_t max_length;
+ size_t length,read_length,diff_length,left_length,use_length,org_Count;
+ size_t max_length;
my_off_t next_pos_in_file;
- byte *read_buffer;
+ uchar *read_buffer;
memcpy(Buffer,info->read_pos,
- (size_t) (left_length=(uint) (info->read_end-info->read_pos)));
+ (left_length= (size_t) (info->read_end-info->read_pos)));
Buffer+=left_length;
org_Count=Count;
Count-=left_length;
@@ -1315,15 +1316,15 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
info->error= -1;
return(1);
}
- if (! (read_length = (uint) info->aio_result.result.aio_return) ||
- read_length == (uint) -1)
+ if (! (read_length= (size_t) info->aio_result.result.aio_return) ||
+ read_length == (size_t) -1)
{
my_errno=0; /* For testing */
- info->error= (read_length == (uint) -1 ? -1 :
+ info->error= (read_length == (size_t) -1 ? -1 :
(int) (read_length+left_length));
return(1);
}
- info->pos_in_file+=(uint) (info->read_end - info->request_pos);
+ info->pos_in_file+= (size_t) (info->read_end - info->request_pos);
if (info->request_pos != info->buffer)
info->request_pos=info->buffer;
@@ -1354,7 +1355,7 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
if (info->aio_read_pos > info->pos_in_file)
{
my_errno=EINVAL;
- return(info->read_length= -1);
+ return(info->read_length= (size_t) -1);
}
#endif
/* Copy found bytes to buffer */
@@ -1367,7 +1368,7 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
info->read_pos+=length;
}
else
- next_pos_in_file=(info->pos_in_file+ (uint)
+ next_pos_in_file=(info->pos_in_file+ (size_t)
(info->read_end - info->request_pos));
/* If reading large blocks, or first read or read with skip */
@@ -1386,11 +1387,11 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
return (1);
}
- read_length=IO_SIZE*2- (uint) (next_pos_in_file & (IO_SIZE-1));
+ read_length=IO_SIZE*2- (size_t) (next_pos_in_file & (IO_SIZE-1));
if (Count < read_length)
{ /* Small block, read to cache */
if ((read_length=my_read(info->file,info->request_pos,
- read_length, info->myflags)) == (uint) -1)
+ read_length, info->myflags)) == (size_t) -1)
return info->error= -1;
use_length=min(Count,read_length);
memcpy(Buffer,info->request_pos,(size_t) use_length);
@@ -1410,10 +1411,10 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
}
else
{ /* Big block, don't cache it */
- if ((read_length=my_read(info->file,Buffer,(uint) Count,info->myflags))
+ if ((read_length= my_read(info->file,Buffer, Count,info->myflags))
!= Count)
{
- info->error= read_length == (uint) -1 ? -1 : read_length+left_length;
+ info->error= read_length == (size_t) -1 ? -1 : read_length+left_length;
return 1;
}
info->read_pos=info->read_end=info->request_pos;
@@ -1421,12 +1422,12 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
}
}
- /* Read next block with asyncronic io */
- max_length=info->end_of_file - next_pos_in_file;
+ /* Read next block with asyncronic io */
diff_length=(next_pos_in_file & (IO_SIZE-1));
+ max_length= info->read_length - diff_length;
+ if (max_length > info->end_of_file - next_pos_in_file)
+ max_length= (size_t) (info->end_of_file - next_pos_in_file);
- if (max_length > (my_off_t) info->read_length - diff_length)
- max_length= (my_off_t) info->read_length - diff_length;
if (info->request_pos != info->buffer)
read_buffer=info->buffer;
else
@@ -1435,9 +1436,9 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
if (max_length)
{
info->aio_result.result.aio_errno=AIO_INPROGRESS; /* Marker for test */
- DBUG_PRINT("aioread",("filepos: %ld length: %ld",
- (ulong) next_pos_in_file,(ulong) max_length));
- if (aioread(info->file,read_buffer,(int) max_length,
+ DBUG_PRINT("aioread",("filepos: %ld length: %lu",
+ (ulong) next_pos_in_file, (ulong) max_length));
+ if (aioread(info->file,read_buffer, max_length,
(my_off_t) next_pos_in_file,MY_SEEK_SET,
&info->aio_result.result))
{ /* Skip async io */
@@ -1447,7 +1448,7 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
if (info->request_pos != info->buffer)
{
bmove(info->buffer,info->request_pos,
- (uint) (info->read_end - info->read_pos));
+ (size_t) (info->read_end - info->read_pos));
info->request_pos=info->buffer;
info->read_pos-=info->read_length;
info->read_end-=info->read_length;
@@ -1467,7 +1468,7 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
int _my_b_get(IO_CACHE *info)
{
- byte buff;
+ uchar buff;
IO_CACHE_CALLBACK pre_read,post_read;
if ((pre_read = info->pre_read))
(*pre_read)(info);
@@ -1488,9 +1489,9 @@ int _my_b_get(IO_CACHE *info)
-1 On error; my_errno contains error code.
*/
-int _my_b_write(register IO_CACHE *info, const byte *Buffer, uint Count)
+int _my_b_write(register IO_CACHE *info, const uchar *Buffer, size_t Count)
{
- uint rest_length,length;
+ size_t rest_length,length;
if (info->pos_in_file+info->buffer_length > info->end_of_file)
{
@@ -1498,7 +1499,7 @@ int _my_b_write(register IO_CACHE *info, const byte *Buffer, uint Count)
return info->error = -1;
}
- rest_length=(uint) (info->write_end - info->write_pos);
+ rest_length= (size_t) (info->write_end - info->write_pos);
memcpy(info->write_pos,Buffer,(size_t) rest_length);
Buffer+=rest_length;
Count-=rest_length;
@@ -1508,7 +1509,7 @@ int _my_b_write(register IO_CACHE *info, const byte *Buffer, uint Count)
return 1;
if (Count >= IO_SIZE)
{ /* Fill first intern buffer */
- length=Count & (uint) ~(IO_SIZE-1);
+ length=Count & (size_t) ~(IO_SIZE-1);
if (info->seek_not_done)
{
/*
@@ -1524,7 +1525,7 @@ int _my_b_write(register IO_CACHE *info, const byte *Buffer, uint Count)
}
info->seek_not_done=0;
}
- if (my_write(info->file,Buffer,(uint) length,info->myflags | MY_NABP))
+ if (my_write(info->file, Buffer, length, info->myflags | MY_NABP))
return info->error= -1;
#ifdef THREAD
@@ -1559,9 +1560,9 @@ int _my_b_write(register IO_CACHE *info, const byte *Buffer, uint Count)
the write buffer before we are ready with it.
*/
-int my_b_append(register IO_CACHE *info, const byte *Buffer, uint Count)
+int my_b_append(register IO_CACHE *info, const uchar *Buffer, size_t Count)
{
- uint rest_length,length;
+ size_t rest_length,length;
#ifdef THREAD
/*
@@ -1572,10 +1573,10 @@ int my_b_append(register IO_CACHE *info, const byte *Buffer, uint Count)
#endif
lock_append_buffer(info);
- rest_length=(uint) (info->write_end - info->write_pos);
+ rest_length= (size_t) (info->write_end - info->write_pos);
if (Count <= rest_length)
goto end;
- memcpy(info->write_pos,Buffer,(size_t) rest_length);
+ memcpy(info->write_pos, Buffer, rest_length);
Buffer+=rest_length;
Count-=rest_length;
info->write_pos+=rest_length;
@@ -1586,8 +1587,8 @@ int my_b_append(register IO_CACHE *info, const byte *Buffer, uint Count)
}
if (Count >= IO_SIZE)
{ /* Fill first intern buffer */
- length=Count & (uint) ~(IO_SIZE-1);
- if (my_write(info->file,Buffer,(uint) length,info->myflags | MY_NABP))
+ length=Count & (size_t) ~(IO_SIZE-1);
+ if (my_write(info->file,Buffer, length, info->myflags | MY_NABP))
{
unlock_append_buffer(info);
return info->error= -1;
@@ -1605,7 +1606,7 @@ end:
}
-int my_b_safe_write(IO_CACHE *info, const byte *Buffer, uint Count)
+int my_b_safe_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
{
/*
Sasha: We are not writing this with the ? operator to avoid hitting
@@ -1625,10 +1626,10 @@ int my_b_safe_write(IO_CACHE *info, const byte *Buffer, uint Count)
we will never get a seek over the end of the buffer
*/
-int my_block_write(register IO_CACHE *info, const byte *Buffer, uint Count,
+int my_block_write(register IO_CACHE *info, const uchar *Buffer, size_t Count,
my_off_t pos)
{
- uint length;
+ size_t length;
int error=0;
#ifdef THREAD
@@ -1648,7 +1649,7 @@ int my_block_write(register IO_CACHE *info, const byte *Buffer, uint Count,
/* Write the part of the block that is before buffer */
length= (uint) (info->pos_in_file - pos);
if (my_pwrite(info->file, Buffer, length, pos, info->myflags | MY_NABP))
- info->error=error=-1;
+ info->error= error= -1;
Buffer+=length;
pos+= length;
Count-= length;
@@ -1658,10 +1659,10 @@ int my_block_write(register IO_CACHE *info, const byte *Buffer, uint Count,
}
/* Check if we want to write inside the used part of the buffer.*/
- length= (uint) (info->write_end - info->buffer);
+ length= (size_t) (info->write_end - info->buffer);
if (pos < info->pos_in_file + length)
{
- uint offset= (uint) (pos - info->pos_in_file);
+ size_t offset= (size_t) (pos - info->pos_in_file);
length-=offset;
if (length > Count)
length=Count;
@@ -1696,7 +1697,7 @@ int my_block_write(register IO_CACHE *info, const byte *Buffer, uint Count,
int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
{
- uint length;
+ size_t length;
my_bool append_cache;
my_off_t pos_in_file;
DBUG_ENTER("my_b_flush_io_cache");
@@ -1713,7 +1714,7 @@ int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
}
LOCK_APPEND_BUFFER;
- if ((length=(uint) (info->write_pos - info->write_buffer)))
+ if ((length=(size_t) (info->write_pos - info->write_buffer)))
{
#ifdef THREAD
/*
@@ -1821,8 +1822,8 @@ int end_io_cache(IO_CACHE *info)
info->alloced_buffer=0;
if (info->file != -1) /* File doesn't exist */
error= my_b_flush_io_cache(info,1);
- my_free((gptr) info->buffer,MYF(MY_WME));
- info->buffer=info->read_pos=(byte*) 0;
+ my_free((uchar*) info->buffer,MYF(MY_WME));
+ info->buffer=info->read_pos=(uchar*) 0;
}
if (info->type == SEQ_READ_APPEND)
{
diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c
index bdb5d057a16..8a5b91661c4 100644
--- a/mysys/mf_iocache2.c
+++ b/mysys/mf_iocache2.c
@@ -50,7 +50,7 @@
int
my_b_copy_to_file(IO_CACHE *cache, FILE *file)
{
- uint bytes_in_cache;
+ size_t bytes_in_cache;
DBUG_ENTER("my_b_copy_to_file");
/* Reinit the cache to read from the beginning of the cache */
@@ -60,7 +60,7 @@ my_b_copy_to_file(IO_CACHE *cache, FILE *file)
do
{
if (my_fwrite(file, cache->read_pos, bytes_in_cache,
- MYF(MY_WME | MY_NABP)) == (uint) -1)
+ MYF(MY_WME | MY_NABP)) == (size_t) -1)
DBUG_RETURN(1);
cache->read_pos= cache->read_end;
} while ((bytes_in_cache= my_b_fill(cache)));
@@ -175,18 +175,24 @@ void my_b_seek(IO_CACHE *info,my_off_t pos)
/*
- Fill buffer. Note that this assumes that you have already used
- all characters in the CACHE, independent of the read_pos value!
- return: 0 on error or EOF (info->error = -1 on error)
- number of characters
+ Fill buffer of the cache.
+
+ NOTES
+ This assumes that you have already used all characters in the CACHE,
+ independent of the read_pos value!
+
+ RETURN
+ 0 On error or EOF (info->error = -1 on error)
+ # Number of characters
*/
-uint my_b_fill(IO_CACHE *info)
+
+size_t my_b_fill(IO_CACHE *info)
{
my_off_t pos_in_file=(info->pos_in_file+
- (uint) (info->read_end - info->buffer));
- my_off_t max_length;
- uint diff_length,length;
+ (size_t) (info->read_end - info->buffer));
+ size_t diff_length, length, max_length;
+
if (info->seek_not_done)
{ /* File touched, do seek */
if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) ==
@@ -197,17 +203,18 @@ uint my_b_fill(IO_CACHE *info)
}
info->seek_not_done=0;
}
- diff_length=(uint) (pos_in_file & (IO_SIZE-1));
- max_length= (my_off_t) (info->end_of_file - pos_in_file);
- if (max_length > (my_off_t) (info->read_length-diff_length))
- max_length=(my_off_t) (info->read_length-diff_length);
+ diff_length=(size_t) (pos_in_file & (IO_SIZE-1));
+ max_length=(info->read_length-diff_length);
+ if (max_length >= (info->end_of_file - pos_in_file))
+ max_length= (size_t) (info->end_of_file - pos_in_file);
+
if (!max_length)
{
info->error= 0;
return 0; /* EOF */
}
- else if ((length=my_read(info->file,info->buffer,(uint) max_length,
- info->myflags)) == (uint) -1)
+ if ((length= my_read(info->file,info->buffer,max_length,
+ info->myflags)) == (size_t) -1)
{
info->error= -1;
return 0;
@@ -226,15 +233,17 @@ uint my_b_fill(IO_CACHE *info)
If buffer is full then to[max_length-1] will be set to \0.
*/
-uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
+size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length)
{
char *start = to;
- uint length;
+ size_t length;
max_length--; /* Save place for end \0 */
+
/* Calculate number of characters in buffer */
if (!(length= my_b_bytes_in_cache(info)) &&
!(length= my_b_fill(info)))
return 0;
+
for (;;)
{
char *pos,*end;
@@ -246,7 +255,7 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
{
info->read_pos=pos;
*to='\0';
- return (uint) (to-start);
+ return (size_t) (to-start);
}
}
if (!(max_length-=length))
@@ -254,7 +263,7 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
/* Found enough charcters; Return found string */
info->read_pos=pos;
*to='\0';
- return (uint) (to-start);
+ return (size_t) (to-start);
}
if (!(length=my_b_fill(info)))
return 0;
@@ -265,26 +274,22 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
my_off_t my_b_filelength(IO_CACHE *info)
{
if (info->type == WRITE_CACHE)
- {
return my_b_tell(info);
- }
- else
- {
- info->seek_not_done=1;
- return my_seek(info->file,0L,MY_SEEK_END,MYF(0));
- }
+
+ info->seek_not_done= 1;
+ return my_seek(info->file, 0L, MY_SEEK_END, MYF(0));
}
/*
Simple printf version. Supports '%s', '%d', '%u', "%ld" and "%lu"
Used for logging in MySQL
- returns number of written character, or (uint) -1 on error
+ returns number of written character, or (size_t) -1 on error
*/
-uint my_b_printf(IO_CACHE *info, const char* fmt, ...)
+size_t my_b_printf(IO_CACHE *info, const char* fmt, ...)
{
- int result;
+ size_t result;
va_list args;
va_start(args,fmt);
result=my_b_vprintf(info, fmt, args);
@@ -293,9 +298,9 @@ uint my_b_printf(IO_CACHE *info, const char* fmt, ...)
}
-uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
+size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
{
- uint out_length=0;
+ size_t out_length= 0;
uint minimum_width; /* as yet unimplemented */
uint minimum_width_sign;
uint precision; /* as yet unimplemented for anything but %b */
@@ -312,19 +317,17 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
{
/* Copy everything until '%' or end of string */
const char *start=fmt;
- uint length;
+ size_t length;
for (; (*fmt != '\0') && (*fmt != '%'); fmt++) ;
- length= (uint) (fmt - start);
+ length= (size_t) (fmt - start);
out_length+=length;
if (my_b_write(info, start, length))
goto err;
if (*fmt == '\0') /* End of format */
- {
return out_length;
- }
/*
By this point, *fmt must be a percent; Keep track of this location and
@@ -339,10 +342,13 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
minimum_width_sign= 1;
/* Skip if max size is used (to be compatible with printf) */
while (*fmt == '-') { fmt++; minimum_width_sign= -1; }
- if (*fmt == '*') {
+ if (*fmt == '*')
+ {
precision= (int) va_arg(args, int);
fmt++;
- } else {
+ }
+ else
+ {
while (my_isdigit(&my_charset_latin1, *fmt)) {
minimum_width=(minimum_width * 10) + (*fmt - '0');
fmt++;
@@ -350,12 +356,15 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
}
minimum_width*= minimum_width_sign;
- if (*fmt == '.') {
+ if (*fmt == '.')
+ {
fmt++;
if (*fmt == '*') {
precision= (int) va_arg(args, int);
fmt++;
- } else {
+ }
+ else
+ {
while (my_isdigit(&my_charset_latin1, *fmt)) {
precision=(precision * 10) + (*fmt - '0');
fmt++;
@@ -366,7 +375,7 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
if (*fmt == 's') /* String parameter */
{
reg2 char *par = va_arg(args, char *);
- uint length2 = (uint) strlen(par);
+ size_t length2 = strlen(par);
/* TODO: implement minimum width and precision */
out_length+= length2;
if (my_b_write(info, par, length2))
@@ -382,14 +391,14 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
else if (*fmt == 'd' || *fmt == 'u') /* Integer parameter */
{
register int iarg;
- uint length2;
+ size_t length2;
char buff[17];
iarg = va_arg(args, int);
if (*fmt == 'd')
- length2= (uint) (int10_to_str((long) iarg,buff, -10) - buff);
+ length2= (size_t) (int10_to_str((long) iarg,buff, -10) - buff);
else
- length2= (uint) (int10_to_str((long) (uint) iarg,buff,10)- buff);
+ length2= (size_t) (int10_to_str((long) (uint) iarg,buff,10)- buff);
out_length+= length2;
if (my_b_write(info, buff, length2))
goto err;
@@ -398,14 +407,14 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
/* long parameter */
{
register long iarg;
- uint length2;
+ size_t length2;
char buff[17];
iarg = va_arg(args, long);
if (*++fmt == 'd')
- length2= (uint) (int10_to_str(iarg,buff, -10) - buff);
+ length2= (size_t) (int10_to_str(iarg,buff, -10) - buff);
else
- length2= (uint) (int10_to_str(iarg,buff,10)- buff);
+ length2= (size_t) (int10_to_str(iarg,buff,10)- buff);
out_length+= length2;
if (my_b_write(info, buff, length2))
goto err;
@@ -421,5 +430,5 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
return out_length;
err:
- return (uint) -1;
+ return (size_t) -1;
}
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 86394fec239..a3d0a8f94fb 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -136,7 +136,7 @@ struct st_block_link
struct st_hash_link *hash_link; /* backward ptr to referring hash_link */
KEYCACHE_WQUEUE wqueue[2]; /* queues on waiting requests for new/old pages */
uint requests; /* number of requests for the block */
- byte *buffer; /* buffer for the block page */
+ uchar *buffer; /* buffer for the block page */
uint offset; /* beginning of modified data in the buffer */
uint length; /* end of data in the buffer */
uint status; /* state of the block */
@@ -370,11 +370,11 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
keycache->hash_link_root= (HASH_LINK*) ((char*) keycache->hash_root +
ALIGN_SIZE((sizeof(HASH_LINK*) *
keycache->hash_entries)));
- bzero((byte*) keycache->block_root,
+ bzero((uchar*) keycache->block_root,
keycache->disk_blocks * sizeof(BLOCK_LINK));
- bzero((byte*) keycache->hash_root,
+ bzero((uchar*) keycache->hash_root,
keycache->hash_entries * sizeof(HASH_LINK*));
- bzero((byte*) keycache->hash_link_root,
+ bzero((uchar*) keycache->hash_link_root,
keycache->hash_links * sizeof(HASH_LINK));
keycache->hash_links_used= 0;
keycache->free_hash_list= NULL;
@@ -408,9 +408,9 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
keycache->disk_blocks, (long) keycache->block_root,
keycache->hash_entries, (long) keycache->hash_root,
keycache->hash_links, (long) keycache->hash_link_root));
- bzero((gptr) keycache->changed_blocks,
+ bzero((uchar*) keycache->changed_blocks,
sizeof(keycache->changed_blocks[0]) * CHANGED_BLOCKS_HASH);
- bzero((gptr) keycache->file_blocks,
+ bzero((uchar*) keycache->file_blocks,
sizeof(keycache->file_blocks[0]) * CHANGED_BLOCKS_HASH);
}
@@ -423,12 +423,12 @@ err:
keycache->blocks= 0;
if (keycache->block_mem)
{
- my_large_free((gptr) keycache->block_mem, MYF(0));
+ my_large_free((uchar*) keycache->block_mem, MYF(0));
keycache->block_mem= NULL;
}
if (keycache->block_root)
{
- my_free((gptr) keycache->block_root, MYF(0));
+ my_free((uchar*) keycache->block_root, MYF(0));
keycache->block_root= NULL;
}
my_errno= error;
@@ -631,9 +631,9 @@ void end_key_cache(KEY_CACHE *keycache, my_bool cleanup)
{
if (keycache->block_mem)
{
- my_large_free((gptr) keycache->block_mem, MYF(0));
+ my_large_free((uchar*) keycache->block_mem, MYF(0));
keycache->block_mem= NULL;
- my_free((gptr) keycache->block_root, MYF(0));
+ my_free((uchar*) keycache->block_root, MYF(0));
keycache->block_root= NULL;
}
keycache->disk_blocks= -1;
@@ -1492,7 +1492,7 @@ restart:
block->buffer= ADD_TO_PTR(keycache->block_mem,
((ulong) keycache->blocks_used*
keycache->key_cache_block_size),
- byte*);
+ uchar*);
keycache->blocks_used++;
}
keycache->blocks_unused--;
@@ -1783,15 +1783,15 @@ static void read_block(KEY_CACHE *keycache __attribute__((unused)),
have to be a multiple of key_cache_block_size;
*/
-byte *key_cache_read(KEY_CACHE *keycache,
+uchar *key_cache_read(KEY_CACHE *keycache,
File file, my_off_t filepos, int level,
- byte *buff, uint length,
+ uchar *buff, uint length,
uint block_length __attribute__((unused)),
int return_buffer __attribute__((unused)))
{
int error=0;
uint offset= 0;
- byte *start= buff;
+ uchar *start= buff;
DBUG_ENTER("key_cache_read");
DBUG_PRINT("enter", ("fd: %u pos: %lu length: %u",
(uint) file, (ulong) filepos, length));
@@ -1880,7 +1880,7 @@ byte *key_cache_read(KEY_CACHE *keycache,
keycache_pthread_mutex_unlock(&keycache->cache_lock);
if (status & BLOCK_ERROR)
- DBUG_RETURN((byte *) 0);
+ DBUG_RETURN((uchar *) 0);
#ifndef THREAD
/* This is only true if we where able to read everything in one block */
@@ -1900,9 +1900,9 @@ no_key_cache: /* Key cache is not used */
/* We can't use mutex here as the key cache may not be initialized */
keycache->global_cache_r_requests++;
keycache->global_cache_read++;
- if (my_pread(file, (byte*) buff, length, filepos+offset, MYF(MY_NABP)))
+ if (my_pread(file, (uchar*) buff, length, filepos+offset, MYF(MY_NABP)))
error= 1;
- DBUG_RETURN(error ? (byte*) 0 : start);
+ DBUG_RETURN(error ? (uchar*) 0 : start);
}
@@ -1928,7 +1928,7 @@ no_key_cache: /* Key cache is not used */
int key_cache_insert(KEY_CACHE *keycache,
File file, my_off_t filepos, int level,
- byte *buff, uint length)
+ uchar *buff, uint length)
{
DBUG_ENTER("key_cache_insert");
DBUG_PRINT("enter", ("fd: %u pos: %lu length: %u",
@@ -2048,7 +2048,7 @@ int key_cache_insert(KEY_CACHE *keycache,
int key_cache_write(KEY_CACHE *keycache,
File file, my_off_t filepos, int level,
- byte *buff, uint length,
+ uchar *buff, uint length,
uint block_length __attribute__((unused)),
int dont_write)
{
@@ -2107,7 +2107,7 @@ int key_cache_write(KEY_CACHE *keycache,
{
keycache->global_cache_w_requests++;
keycache->global_cache_write++;
- if (my_pwrite(file, (byte*) buff, length, filepos,
+ if (my_pwrite(file, (uchar*) buff, length, filepos,
MYF(MY_NABP | MY_WAIT_IF_FULL)))
error=1;
}
@@ -2174,7 +2174,7 @@ no_key_cache:
{
keycache->global_cache_w_requests++;
keycache->global_cache_write++;
- if (my_pwrite(file, (byte*) buff, length, filepos,
+ if (my_pwrite(file, (uchar*) buff, length, filepos,
MYF(MY_NABP | MY_WAIT_IF_FULL)))
error=1;
}
@@ -2269,7 +2269,7 @@ static int flush_cached_blocks(KEY_CACHE *keycache,
As all blocks referred in 'cache' are marked by BLOCK_IN_FLUSH
we are guarunteed no thread will change them
*/
- qsort((byte*) cache, count, sizeof(*cache), (qsort_cmp) cmp_sec_link);
+ qsort((uchar*) cache, count, sizeof(*cache), (qsort_cmp) cmp_sec_link);
keycache_pthread_mutex_lock(&keycache->cache_lock);
for ( ; cache != end ; cache++)
@@ -2521,7 +2521,7 @@ restart:
test_key_cache(keycache, "end of flush_key_blocks", 0););
#endif
if (cache != cache_buff)
- my_free((gptr) cache, MYF(0));
+ my_free((uchar*) cache, MYF(0));
if (last_errno)
errno=last_errno; /* Return first error */
DBUG_RETURN(last_errno != 0);
diff --git a/mysys/mf_keycaches.c b/mysys/mf_keycaches.c
index 51ad54159e5..6227a05ce06 100644
--- a/mysys/mf_keycaches.c
+++ b/mysys/mf_keycaches.c
@@ -44,9 +44,9 @@
typedef struct st_safe_hash_entry
{
- byte *key;
+ uchar *key;
uint length;
- byte *data;
+ uchar *data;
struct st_safe_hash_entry *next, **prev;
} SAFE_HASH_ENTRY;
@@ -57,7 +57,7 @@ typedef struct st_safe_hash_with_default
rw_lock_t mutex;
#endif
HASH hash;
- byte *default_value;
+ uchar *default_value;
SAFE_HASH_ENTRY *root;
} SAFE_HASH;
@@ -71,18 +71,18 @@ typedef struct st_safe_hash_with_default
static void safe_hash_entry_free(SAFE_HASH_ENTRY *entry)
{
DBUG_ENTER("free_assign_entry");
- my_free((gptr) entry, MYF(0));
+ my_free((uchar*) entry, MYF(0));
DBUG_VOID_RETURN;
}
/* Get key and length for a SAFE_HASH_ENTRY */
-static byte *safe_hash_entry_get(SAFE_HASH_ENTRY *entry, uint *length,
- my_bool not_used __attribute__((unused)))
+static uchar *safe_hash_entry_get(SAFE_HASH_ENTRY *entry, size_t *length,
+ my_bool not_used __attribute__((unused)))
{
*length=entry->length;
- return (byte*) entry->key;
+ return (uchar*) entry->key;
}
@@ -105,7 +105,7 @@ static byte *safe_hash_entry_get(SAFE_HASH_ENTRY *entry, uint *length,
*/
static my_bool safe_hash_init(SAFE_HASH *hash, uint elements,
- byte *default_value)
+ uchar *default_value)
{
DBUG_ENTER("safe_hash");
if (hash_init(&hash->hash, &my_charset_bin, elements,
@@ -147,9 +147,9 @@ static void safe_hash_free(SAFE_HASH *hash)
Return the value stored for a key or default value if no key
*/
-static byte *safe_hash_search(SAFE_HASH *hash, const byte *key, uint length)
+static uchar *safe_hash_search(SAFE_HASH *hash, const uchar *key, uint length)
{
- byte *result;
+ uchar *result;
DBUG_ENTER("safe_hash_search");
rw_rdlock(&hash->mutex);
result= hash_search(&hash->hash, key, length);
@@ -183,8 +183,8 @@ static byte *safe_hash_search(SAFE_HASH *hash, const byte *key, uint length)
1 error (Can only be EOM). In this case my_message() is called.
*/
-static my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length,
- byte *data)
+static my_bool safe_hash_set(SAFE_HASH *hash, const uchar *key, uint length,
+ uchar *data)
{
SAFE_HASH_ENTRY *entry;
my_bool error= 0;
@@ -206,7 +206,7 @@ static my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length,
/* unlink entry from list */
if ((*entry->prev= entry->next))
entry->next->prev= entry->prev;
- hash_delete(&hash->hash, (byte*) entry);
+ hash_delete(&hash->hash, (uchar*) entry);
goto end;
}
if (entry)
@@ -222,7 +222,7 @@ static my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length,
error= 1;
goto end;
}
- entry->key= (byte*) (entry +1);
+ entry->key= (uchar*) (entry +1);
memcpy((char*) entry->key, (char*) key, length);
entry->length= length;
entry->data= data;
@@ -231,7 +231,7 @@ static my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length,
entry->next->prev= &entry->next;
entry->prev= &hash->root;
hash->root= entry;
- if (my_hash_insert(&hash->hash, (byte*) entry))
+ if (my_hash_insert(&hash->hash, (uchar*) entry))
{
/* This can only happen if hash got out of memory */
my_free((char*) entry, MYF(0));
@@ -261,7 +261,7 @@ end:
default value.
*/
-static void safe_hash_change(SAFE_HASH *hash, byte *old_data, byte *new_data)
+static void safe_hash_change(SAFE_HASH *hash, uchar *old_data, uchar *new_data)
{
SAFE_HASH_ENTRY *entry, *next;
DBUG_ENTER("safe_hash_set");
@@ -277,7 +277,7 @@ static void safe_hash_change(SAFE_HASH *hash, byte *old_data, byte *new_data)
{
if ((*entry->prev= entry->next))
entry->next->prev= entry->prev;
- hash_delete(&hash->hash, (byte*) entry);
+ hash_delete(&hash->hash, (uchar*) entry);
}
else
entry->data= new_data;
@@ -299,7 +299,7 @@ static SAFE_HASH key_cache_hash;
my_bool multi_keycache_init(void)
{
- return safe_hash_init(&key_cache_hash, 16, (byte*) dflt_key_cache);
+ return safe_hash_init(&key_cache_hash, 16, (uchar*) dflt_key_cache);
}
@@ -325,7 +325,7 @@ void multi_keycache_free(void)
key cache to use
*/
-KEY_CACHE *multi_key_cache_search(byte *key, uint length)
+KEY_CACHE *multi_key_cache_search(uchar *key, uint length)
{
if (!key_cache_hash.hash.records)
return dflt_key_cache;
@@ -349,15 +349,15 @@ KEY_CACHE *multi_key_cache_search(byte *key, uint length)
*/
-my_bool multi_key_cache_set(const byte *key, uint length,
+my_bool multi_key_cache_set(const uchar *key, uint length,
KEY_CACHE *key_cache)
{
- return safe_hash_set(&key_cache_hash, key, length, (byte*) key_cache);
+ return safe_hash_set(&key_cache_hash, key, length, (uchar*) key_cache);
}
void multi_key_cache_change(KEY_CACHE *old_data,
KEY_CACHE *new_data)
{
- safe_hash_change(&key_cache_hash, (byte*) old_data, (byte*) new_data);
+ safe_hash_change(&key_cache_hash, (uchar*) old_data, (uchar*) new_data);
}
diff --git a/mysys/mf_loadpath.c b/mysys/mf_loadpath.c
index ffa83cb20ec..48a69207839 100644
--- a/mysys/mf_loadpath.c
+++ b/mysys/mf_loadpath.c
@@ -23,7 +23,7 @@
/* if there is no path, prepend with own_path_prefix if given */
/* else unpack path according to current dir */
-my_string my_load_path(my_string to, const char *path,
+char * my_load_path(char * to, const char *path,
const char *own_path_prefix)
{
char buff[FN_REFLEN];
@@ -36,7 +36,7 @@ my_string my_load_path(my_string to, const char *path,
test_if_hard_path(path))
VOID(strmov(buff,path));
else if ((is_cur=(path[0] == FN_CURLIB && path[1] == FN_LIBCHAR)) ||
- (is_prefix((gptr) path,FN_PARENTDIR)) ||
+ (is_prefix(path,FN_PARENTDIR)) ||
! own_path_prefix)
{
if (is_cur)
diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c
index 1b83c6fda10..99c0c959d94 100644
--- a/mysys/mf_pack.c
+++ b/mysys/mf_pack.c
@@ -24,17 +24,17 @@
#include <descrip.h>
#endif /* VMS */
-static my_string NEAR_F expand_tilde(my_string *path);
+static char * NEAR_F expand_tilde(char * *path);
/* Pack a dirname ; Changes HOME to ~/ and current dev to ./ */
/* from is a dirname (from dirname() ?) ending with FN_LIBCHAR */
/* to may be == from */
-void pack_dirname(my_string to, const char *from)
+void pack_dirname(char * to, const char *from)
{
int cwd_err;
- uint d_length,length,buff_length;
- my_string start;
+ size_t d_length,length,buff_length;
+ char * start;
char buff[FN_REFLEN];
DBUG_ENTER("pack_dirname");
@@ -50,13 +50,13 @@ void pack_dirname(my_string to, const char *from)
if (!(cwd_err= my_getwd(buff,FN_REFLEN,MYF(0))))
{
- buff_length= (uint) strlen(buff);
- d_length=(uint) (start-to);
+ buff_length= strlen(buff);
+ d_length= (size_t) (start-to);
if ((start == to ||
(buff_length == d_length && !bcmp(buff,start,d_length))) &&
*start != FN_LIBCHAR && *start)
{ /* Put current dir before */
- bchange(to,d_length,buff,buff_length,(uint) strlen(to)+1);
+ bchange(to,d_length,buff,buff_length,strlen(to)+1);
}
}
@@ -65,7 +65,7 @@ void pack_dirname(my_string to, const char *from)
length=0;
if (home_dir)
{
- length= (uint) strlen(home_dir);
+ length= strlen(home_dir);
if (home_dir[length-1] == FN_LIBCHAR)
length--; /* Don't test last '/' */
}
@@ -89,7 +89,7 @@ void pack_dirname(my_string to, const char *from)
}
if (is_prefix(to,buff))
{
- length= (uint) strlen(buff);
+ length= strlen(buff);
if (to[length])
(void) strmov_overlapp(to,to+length); /* Remove everything before */
else
@@ -126,12 +126,12 @@ void pack_dirname(my_string to, const char *from)
# length of new name
*/
-uint cleanup_dirname(register my_string to, const char *from)
+size_t cleanup_dirname(register char *to, const char *from)
{
- reg5 uint length;
- reg2 my_string pos;
- reg3 my_string from_ptr;
- reg4 my_string start;
+ reg5 size_t length;
+ reg2 char * pos;
+ reg3 char * from_ptr;
+ reg4 char * start;
char parent[5], /* for "FN_PARENTDIR" */
buff[FN_REFLEN+1],*end_parentdir;
#ifdef BACKSLASH_MBTAIL
@@ -141,17 +141,17 @@ uint cleanup_dirname(register my_string to, const char *from)
DBUG_PRINT("enter",("from: '%s'",from));
start=buff;
- from_ptr=(my_string) from;
+ from_ptr=(char *) from;
#ifdef FN_DEVCHAR
if ((pos=strrchr(from_ptr,FN_DEVCHAR)) != 0)
{ /* Skip device part */
- length=(uint) (pos-from_ptr)+1;
+ length=(size_t) (pos-from_ptr)+1;
start=strnmov(buff,from_ptr,length); from_ptr+=length;
}
#endif
parent[0]=FN_LIBCHAR;
- length=(uint) (strmov(parent+1,FN_PARENTDIR)-parent);
+ length=(size_t) (strmov(parent+1,FN_PARENTDIR)-parent);
for (pos=start ; (*pos= *from_ptr++) != 0 ; pos++)
{
#ifdef BACKSLASH_MBTAIL
@@ -167,7 +167,7 @@ uint cleanup_dirname(register my_string to, const char *from)
*pos = FN_LIBCHAR;
if (*pos == FN_LIBCHAR)
{
- if ((uint) (pos-start) > length && bcmp(pos-length,parent,length) == 0)
+ if ((size_t) (pos-start) > length && bcmp(pos-length,parent,length) == 0)
{ /* If .../../; skip prev */
pos-=length;
if (pos != start)
@@ -206,7 +206,7 @@ uint cleanup_dirname(register my_string to, const char *from)
}
}
}
- else if ((uint) (pos-start) == length-1 &&
+ else if ((size_t) (pos-start) == length-1 &&
!bcmp(start,parent+1,length-1))
start=pos; /* Starts with "../" */
else if (pos-start > 0 && pos[-1] == FN_LIBCHAR)
@@ -228,7 +228,7 @@ uint cleanup_dirname(register my_string to, const char *from)
}
(void) strmov(to,buff);
DBUG_PRINT("exit",("to: '%s'",to));
- DBUG_RETURN((uint) (pos-buff));
+ DBUG_RETURN((size_t) (pos-buff));
} /* cleanup_dirname */
@@ -251,7 +251,7 @@ void symdirget(char *dir)
if (dir[0] && pos[-1] != FN_DEVCHAR && my_access(dir, F_OK))
{
File file;
- uint length;
+ size_t length;
char temp= *(--pos); /* May be "/" or "\" */
strmov(pos,".sym");
file= my_open(dir, O_RDONLY, MYF(0));
@@ -268,7 +268,7 @@ void symdirget(char *dir)
if (pos == buff || pos[-1] != FN_LIBCHAR)
*pos++=FN_LIBCHAR;
- strmake(dir,buff, (uint) (pos-buff));
+ strmake(dir,buff, (size_t) (pos-buff));
}
my_close(file, MYF(0));
}
@@ -296,14 +296,14 @@ void symdirget(char *dir)
Length of new directory name (= length of to)
*/
-uint unpack_dirname(my_string to, const char *from)
+size_t unpack_dirname(char * to, const char *from)
{
- uint length,h_length;
+ size_t length, h_length;
char buff[FN_REFLEN+1+4],*suffix,*tilde_expansion;
DBUG_ENTER("unpack_dirname");
- (void) intern_filename(buff,from); /* Change to intern name */
- length= (uint) strlen(buff); /* Fix that '/' is last */
+ (void) intern_filename(buff,from); /* Change to intern name */
+ length= strlen(buff); /* Fix that '/' is last */
if (length &&
#ifdef FN_DEVCHAR
buff[length-1] != FN_DEVCHAR &&
@@ -320,8 +320,8 @@ uint unpack_dirname(my_string to, const char *from)
suffix=buff+1; tilde_expansion=expand_tilde(&suffix);
if (tilde_expansion)
{
- length-=(uint) (suffix-buff)-1;
- if (length+(h_length= (uint) strlen(tilde_expansion)) <= FN_REFLEN)
+ length-= (size_t) (suffix-buff)-1;
+ if (length+(h_length= strlen(tilde_expansion)) <= FN_REFLEN)
{
if (tilde_expansion[h_length-1] == FN_LIBCHAR)
h_length--;
@@ -344,7 +344,7 @@ uint unpack_dirname(my_string to, const char *from)
/* Expand tilde to home or user-directory */
/* Path is reset to point at FN_LIBCHAR after ~xxx */
-static my_string NEAR_F expand_tilde(my_string *path)
+static char * NEAR_F expand_tilde(char * *path)
{
if (path[0][0] == FN_LIBCHAR)
return home_dir; /* ~/ expanded to home */
@@ -366,7 +366,7 @@ static my_string NEAR_F expand_tilde(my_string *path)
}
}
#endif
- return (my_string) 0;
+ return (char *) 0;
}
@@ -387,13 +387,13 @@ static my_string NEAR_F expand_tilde(my_string *path)
*/
-uint unpack_filename(my_string to, const char *from)
+size_t unpack_filename(char * to, const char *from)
{
- uint length,n_length;
+ size_t length, n_length, buff_length;
char buff[FN_REFLEN];
DBUG_ENTER("unpack_filename");
- length=dirname_part(buff,from); /* copy & convert dirname */
+ length=dirname_part(buff, from, &buff_length);/* copy & convert dirname */
n_length=unpack_dirname(buff,buff);
if (n_length+strlen(from+length) < FN_REFLEN)
{
@@ -410,10 +410,10 @@ uint unpack_filename(my_string to, const char *from)
/* Used before system command's like open(), create() .. */
/* Returns length of to */
-uint system_filename(my_string to, const char *from)
+size_t system_filename(char * to, const char *from)
{
#ifndef FN_C_BEFORE_DIR
- return (uint) (strmake(to,from,FN_REFLEN-1)-to);
+ return (size_t) (strmake(to,from,FN_REFLEN-1)-to);
#else /* VMS */
/* change 'dev:lib/xxx' to 'dev:[lib]xxx' */
@@ -423,8 +423,9 @@ uint system_filename(my_string to, const char *from)
/* change '/x/y/z to '[x.y]x' */
/* change 'dev:/x' to 'dev:[000000]x' */
- int libchar_found,length;
- my_string to_pos,from_pos,pos;
+ int libchar_found;
+ size_t length;
+ char * to_pos,from_pos,pos;
char buff[FN_REFLEN];
DBUG_ENTER("system_filename");
@@ -434,7 +435,7 @@ uint system_filename(my_string to, const char *from)
if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skip device part */
{
pos++;
- to_pos=strnmov(to,from_pos,(size_s) (pos-from_pos));
+ to_pos=strnmov(to,from_pos,(size_t) (pos-from_pos));
from_pos=pos;
}
else
@@ -465,115 +466,30 @@ uint system_filename(my_string to, const char *from)
from_pos+strlen(FN_PARENTDIR) == pos)
to_pos=strmov(to_pos,FN_C_PARENT_DIR); /* Found '../' */
else
- to_pos=strnmov(to_pos,from_pos,(size_s) (pos-from_pos));
+ to_pos=strnmov(to_pos,from_pos,(size_t) (pos-from_pos));
from_pos=pos+1;
}
*(to_pos++)=FN_C_AFTER_DIR;
}
- length=(int) (strmov(to_pos,from_pos)-to);
+ length= (size_t) (strmov(to_pos,from_pos)-to);
DBUG_PRINT("exit",("name: '%s'",to));
- DBUG_RETURN((uint) length);
+ DBUG_RETURN(length);
#endif
} /* system_filename */
/* Fix a filename to intern (UNIX format) */
-my_string intern_filename(my_string to, const char *from)
+char *intern_filename(char *to, const char *from)
{
-#ifndef VMS
- {
- uint length;
- char buff[FN_REFLEN];
- if (from == to)
- { /* Dirname may destroy from */
- strmov(buff,from);
- from=buff;
- }
- length=dirname_part(to,from); /* Copy dirname & fix chars */
- (void) strcat(to,from+length);
- return (to);
- }
-#else /* VMS */
-
- /* change 'dev:[lib]xxx' to 'dev:lib/xxx' */
- /* change 'dev:xxx' to 'dev:xxx' */
- /* change 'dev:x/y/[.lib]' to 'dev:x/y/lib/ */
- /* change '[.lib]' to './lib/' */
- /* change '[x.y]' or '[x.][y]' or '[x][.y]' to '/x/y/' */
- /* change '[000000.x] or [x.000000]' to '/x/' */
-
- int par_length,root_length;
- my_string pos,from_pos,to_pos,end_pos;
+ size_t length, to_length;
char buff[FN_REFLEN];
-
- convert_dirname(buff,from,NullS); /* change '<>' to '[]' */
- from_pos=buff;
- if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skip device part */
- {
- pos++;
- to_pos=strnmov(to,from_pos,(size_s) (pos-from_pos));
- from_pos=pos;
- }
- else
- to_pos=to;
-
- root_length=strlen(FN_C_ROOT_DIR);
- if ((pos = strchr(from_pos,FN_C_BEFORE_DIR)) &&
- (end_pos = strrchr(pos+1,FN_C_AFTER_DIR)))
- {
- to_pos=strnmov(to_pos,from_pos,(size_s) (pos-from_pos));
- /* Copy all between ':' and '[' */
- from_pos=pos+1;
- if (strinstr(from_pos,FN_C_ROOT_DIR) == 1 &&
- (from_pos[root_length] == FN_C_DIR_SEP ||
- from_pos[root_length] == FN_C_AFTER_DIR))
- {
- from_pos+=root_length+1;
- }
- else if (*from_pos == FN_C_DIR_SEP)
- *(to_pos++) = FN_CURLIB; /* Set ./ first */
- *(to_pos++) = FN_LIBCHAR;
-
- par_length=strlen(FN_C_PARENT_DIR);
- pos=to_pos;
- for (; from_pos <= end_pos ; from_pos++)
- {
- switch (*from_pos) {
- case FN_C_DIR_SEP:
- case FN_C_AFTER_DIR:
- if (pos != to_pos)
- {
- if ((int) (to_pos-pos) == root_length &&
- is_suffix(pos,FN_C_ROOT_DIR))
- to_pos=pos; /* remove root-pos */
- else
- {
- *(to_pos++)=FN_LIBCHAR; /* Find lib */
- pos=to_pos;
- }
- }
- break;
- case FN_C_BEFORE_DIR:
- break;
- case '-': /* *(FN_C_PARENT_DIR): */
- if (to_pos[-1] == FN_LIBCHAR &&
- strncmp(from_pos,FN_C_PARENT_DIR,par_length) == 0)
- { /* Change '-' to '..' */
- to_pos=strmov(to_pos,FN_PARENTDIR);
- *(to_pos++)=FN_LIBCHAR;
- pos=to_pos;
- from_pos+=par_length-1;
- break;
- }
- /* Fall through */
- default:
- *(to_pos++)= *from_pos;
- break;
- }
- }
+ if (from == to)
+ { /* Dirname may destroy from */
+ strmov(buff,from);
+ from=buff;
}
- (void) strmov(to_pos,from_pos);
+ length= dirname_part(to, from, &to_length); /* Copy dirname & fix chars */
+ (void) strmov(to + to_length,from+length);
return (to);
-#endif /* VMS */
} /* intern_filename */
diff --git a/mysys/mf_path.c b/mysys/mf_path.c
index 00e6b2046b9..7baded9d715 100644
--- a/mysys/mf_path.c
+++ b/mysys/mf_path.c
@@ -29,16 +29,18 @@ static char *find_file_in_path(char *to,const char *name);
own_path_name_part is concatinated to result.
my_path puts result in to and returns to */
-my_string my_path(my_string to, const char *progname,
- const char *own_pathname_part)
+char * my_path(char * to, const char *progname,
+ const char *own_pathname_part)
{
- my_string start,end,prog;
+ char *start, *end, *prog;
+ size_t to_length;
DBUG_ENTER("my_path");
start=to; /* Return this */
- if (progname && (dirname_part(to, progname) ||
+ if (progname && (dirname_part(to, progname, &to_length) ||
find_file_in_path(to,progname) ||
- ((prog=getenv("_")) != 0 && dirname_part(to,prog))))
+ ((prog=getenv("_")) != 0 &&
+ dirname_part(to, prog, &to_length))))
{
VOID(intern_filename(to,to));
if (!test_if_hard_path(to))
diff --git a/mysys/mf_radix.c b/mysys/mf_radix.c
index 6b750181558..582ca76b8f8 100644
--- a/mysys/mf_radix.c
+++ b/mysys/mf_radix.c
@@ -25,7 +25,7 @@
/* Radixsort */
-void radixsort_for_str_ptr(uchar **base, uint number_of_elements, size_s size_of_element, uchar **buffer)
+void radixsort_for_str_ptr(uchar **base, uint number_of_elements, size_t size_of_element, uchar **buffer)
{
uchar **end,**ptr,**buffer_ptr;
uint32 *count_ptr,*count_end,count[256];
@@ -34,7 +34,7 @@ void radixsort_for_str_ptr(uchar **base, uint number_of_elements, size_s size_of
end=base+number_of_elements; count_end=count+256;
for (pass=(int) size_of_element-1 ; pass >= 0 ; pass--)
{
- bzero((gptr) count,sizeof(uint32)*256);
+ bzero((uchar*) count,sizeof(uint32)*256);
for (ptr= base ; ptr < end ; ptr++)
count[ptr[0][pass]]++;
if (count[0] == number_of_elements)
diff --git a/mysys/mf_same.c b/mysys/mf_same.c
index e7cdb012c9f..6738dc8051e 100644
--- a/mysys/mf_same.c
+++ b/mysys/mf_same.c
@@ -25,14 +25,15 @@
Returns 'to'.
*/
-my_string fn_same(char *to, const char *name, int flag)
+char * fn_same(char *to, const char *name, int flag)
{
char dev[FN_REFLEN];
const char *ext;
+ size_t dev_length;
DBUG_ENTER("fn_same");
DBUG_PRINT("enter",("to: %s name: %s flag: %d",to,name,flag));
- if ((ext=strrchr(name+dirname_part(dev,name),FN_EXTCHAR)) == 0)
+ if ((ext=strrchr(name+dirname_part(dev, name, &dev_length),FN_EXTCHAR)) == 0)
ext="";
DBUG_RETURN(fn_format(to,to,dev,ext,flag));
diff --git a/mysys/mf_sort.c b/mysys/mf_sort.c
index e7fd6873eee..741c8f42327 100644
--- a/mysys/mf_sort.c
+++ b/mysys/mf_sort.c
@@ -18,7 +18,7 @@
#include "mysys_priv.h"
#include <m_string.h>
-void my_string_ptr_sort(void *base, uint items, size_s size)
+void my_string_ptr_sort(uchar *base, uint items, size_t size)
{
#if INT_MAX > 65536L
uchar **ptr=0;
@@ -27,15 +27,15 @@ void my_string_ptr_sort(void *base, uint items, size_s size)
(ptr= (uchar**) my_malloc(items*sizeof(char*),MYF(0))))
{
radixsort_for_str_ptr((uchar**) base,items,size,ptr);
- my_free((gptr) ptr,MYF(0));
+ my_free((uchar*) ptr,MYF(0));
}
else
#endif
{
if (size && items)
{
- uint size_arg=size;
- qsort2(base,items,sizeof(byte*),get_ptr_compare(size),(void*) &size_arg);
+ qsort2(base,items, sizeof(uchar*), get_ptr_compare(size),
+ (void*) &size);
}
}
}
diff --git a/mysys/mf_soundex.c b/mysys/mf_soundex.c
index fa393d1a94a..fe30d8c81af 100644
--- a/mysys/mf_soundex.c
+++ b/mysys/mf_soundex.c
@@ -42,11 +42,11 @@ static char get_scode(CHARSET_INFO * cs, char **ptr,pbool remove_garbage);
/* outputed string is 4 byte long */
/* out_pntr can be == in_pntr */
-void soundex(CHARSET_INFO * cs,register my_string out_pntr, my_string in_pntr,
+void soundex(CHARSET_INFO * cs,register char * out_pntr, char * in_pntr,
pbool remove_garbage)
{
char ch,last_ch;
- reg3 my_string end;
+ reg3 char * end;
register uchar *map=cs->to_upper;
if (remove_garbage)
diff --git a/mysys/mf_strip.c b/mysys/mf_strip.c
index 712b0e1d28a..b33620b1b2d 100644
--- a/mysys/mf_strip.c
+++ b/mysys/mf_strip.c
@@ -18,14 +18,14 @@
#include "mysys_priv.h"
/*
- strip_sp(my_string str)
+ strip_sp(char * str)
Strips end-space from string and returns new length.
*/
-size_s strip_sp(register my_string str)
+size_t strip_sp(register char * str)
{
- reg2 my_string found;
- reg3 my_string start;
+ reg2 char * found;
+ reg3 char * start;
start=found=str;
@@ -35,11 +35,11 @@ size_s strip_sp(register my_string str)
{
while (*++str && *str != ' ') {};
if (!*str)
- return (size_s) (str-start); /* Return stringlength */
+ return (size_t) (str-start); /* Return stringlength */
}
found=str;
while (*++str == ' ') {};
}
*found= '\0'; /* Stripp at first space */
- return (size_s) (found-start);
+ return (size_t) (found-start);
} /* strip_sp */
diff --git a/mysys/mf_tempdir.c b/mysys/mf_tempdir.c
index 36eecbeac09..b2c18c74347 100644
--- a/mysys/mf_tempdir.c
+++ b/mysys/mf_tempdir.c
@@ -52,7 +52,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
strmake(buff, pathlist, (uint) (end-pathlist));
length= cleanup_dirname(buff, buff);
if (!(copy= my_strndup(buff, length, MYF(MY_WME))) ||
- insert_dynamic(&tmpdir->full_list, (gptr) &copy))
+ insert_dynamic(&tmpdir->full_list, (uchar*) &copy))
DBUG_RETURN(TRUE);
pathlist=end+1;
}
diff --git a/mysys/mf_unixpath.c b/mysys/mf_unixpath.c
index 11292e231ba..75f8de14879 100644
--- a/mysys/mf_unixpath.c
+++ b/mysys/mf_unixpath.c
@@ -19,7 +19,7 @@
/* convert filename to unix style filename */
/* If MSDOS converts '\' to '/' */
-void to_unix_path(my_string to __attribute__((unused)))
+void to_unix_path(char * to __attribute__((unused)))
{
#if FN_LIBCHAR != '/'
{
diff --git a/mysys/mf_wfile.c b/mysys/mf_wfile.c
index b574d158b9e..f98d348994e 100644
--- a/mysys/mf_wfile.c
+++ b/mysys/mf_wfile.c
@@ -29,12 +29,12 @@
/* Store wildcard-string in a easyer format */
-WF_PACK *wf_comp(my_string str)
+WF_PACK *wf_comp(char * str)
{
uint ant;
int not_pos;
- register my_string pos;
- my_string buffer;
+ register char * pos;
+ char * buffer;
WF_PACK *ret;
DBUG_ENTER("wf_comp");
@@ -53,13 +53,13 @@ WF_PACK *wf_comp(my_string str)
for (pos=str ; *pos ; pos++)
ant+= test(*pos == ' ' || *pos == ',');
- if ((ret= (WF_PACK*) my_malloc((uint) ant*(sizeof(my_string*)+2)+
+ if ((ret= (WF_PACK*) my_malloc((uint) ant*(sizeof(char **)+2)+
sizeof(WF_PACK)+ (uint) strlen(str)+1,
MYF(MY_WME)))
== 0)
DBUG_RETURN((WF_PACK *) NULL);
- ret->wild= (my_string*) (ret+1);
- buffer= (my_string) (ret->wild+ant);
+ ret->wild= (char **) (ret+1);
+ buffer= (char *) (ret->wild+ant);
ant=0;
for (pos=str ; *pos ; str= pos)
@@ -119,6 +119,6 @@ void wf_end(WF_PACK *buffer)
{
DBUG_ENTER("wf_end");
if (buffer)
- my_free((gptr) buffer,MYF(0));
+ my_free((uchar*) buffer,MYF(0));
DBUG_VOID_RETURN;
} /* wf_end */
diff --git a/mysys/mulalloc.c b/mysys/mulalloc.c
index bada0a55a6a..f4ca3d9f9ab 100644
--- a/mysys/mulalloc.c
+++ b/mysys/mulalloc.c
@@ -31,11 +31,11 @@
NULL
*/
-gptr my_multi_malloc(myf myFlags, ...)
+void* my_multi_malloc(myf myFlags, ...)
{
va_list args;
char **ptr,*start,*res;
- uint tot_length,length;
+ size_t tot_length,length;
DBUG_ENTER("my_multi_malloc");
va_start(args,myFlags);
@@ -59,5 +59,5 @@ gptr my_multi_malloc(myf myFlags, ...)
res+=ALIGN_SIZE(length);
}
va_end(args);
- DBUG_RETURN((gptr) start);
+ DBUG_RETURN((void*) start);
}
diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c
index b4ebaeba647..9203ce9c34e 100644
--- a/mysys/my_alloc.c
+++ b/mysys/my_alloc.c
@@ -43,8 +43,8 @@
reported as error in first alloc_root() on this memory root.
*/
-void init_alloc_root(MEM_ROOT *mem_root, uint block_size,
- uint pre_alloc_size __attribute__((unused)))
+void init_alloc_root(MEM_ROOT *mem_root, size_t block_size,
+ size_t pre_alloc_size __attribute__((unused)))
{
DBUG_ENTER("init_alloc_root");
DBUG_PRINT("enter",("root: 0x%lx", (long) mem_root));
@@ -90,8 +90,8 @@ void init_alloc_root(MEM_ROOT *mem_root, uint block_size,
before allocation.
*/
-void reset_root_defaults(MEM_ROOT *mem_root, uint block_size,
- uint pre_alloc_size __attribute__((unused)))
+void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
+ size_t pre_alloc_size __attribute__((unused)))
{
DBUG_ASSERT(alloc_root_inited(mem_root));
@@ -99,7 +99,7 @@ void reset_root_defaults(MEM_ROOT *mem_root, uint block_size,
#if !(defined(HAVE_purify) && defined(EXTRA_DEBUG))
if (pre_alloc_size)
{
- uint size= pre_alloc_size + ALIGN_SIZE(sizeof(USED_MEM));
+ size_t size= pre_alloc_size + ALIGN_SIZE(sizeof(USED_MEM));
if (!mem_root->pre_alloc || mem_root->pre_alloc->size != size)
{
USED_MEM *mem, **prev= &mem_root->free;
@@ -120,7 +120,7 @@ void reset_root_defaults(MEM_ROOT *mem_root, uint block_size,
{
/* remove block from the list and free it */
*prev= mem->next;
- my_free((gptr) mem, MYF(0));
+ my_free(mem, MYF(0));
}
else
prev= &mem->next;
@@ -145,7 +145,7 @@ void reset_root_defaults(MEM_ROOT *mem_root, uint block_size,
}
-gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size)
+void *alloc_root(MEM_ROOT *mem_root, size_t length)
{
#if defined(HAVE_purify) && defined(EXTRA_DEBUG)
reg1 USED_MEM *next;
@@ -154,32 +154,32 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size)
DBUG_ASSERT(alloc_root_inited(mem_root));
- Size+=ALIGN_SIZE(sizeof(USED_MEM));
- if (!(next = (USED_MEM*) my_malloc(Size,MYF(MY_WME))))
+ length+=ALIGN_SIZE(sizeof(USED_MEM));
+ if (!(next = (USED_MEM*) my_malloc(length,MYF(MY_WME))))
{
if (mem_root->error_handler)
(*mem_root->error_handler)();
- DBUG_RETURN((gptr) 0); /* purecov: inspected */
+ DBUG_RETURN((uchar*) 0); /* purecov: inspected */
}
next->next= mem_root->used;
- next->size= Size;
+ next->size= length;
mem_root->used= next;
DBUG_PRINT("exit",("ptr: 0x%lx", (long) (((char*) next)+
ALIGN_SIZE(sizeof(USED_MEM)))));
- DBUG_RETURN((gptr) (((char*) next)+ALIGN_SIZE(sizeof(USED_MEM))));
+ DBUG_RETURN((uchar*) (((char*) next)+ALIGN_SIZE(sizeof(USED_MEM))));
#else
- uint get_size, block_size;
- gptr point;
+ size_t get_size, block_size;
+ uchar* point;
reg1 USED_MEM *next= 0;
reg2 USED_MEM **prev;
DBUG_ENTER("alloc_root");
DBUG_PRINT("enter",("root: 0x%lx", (long) mem_root));
DBUG_ASSERT(alloc_root_inited(mem_root));
- Size= ALIGN_SIZE(Size);
+ length= ALIGN_SIZE(length);
if ((*(prev= &mem_root->free)) != NULL)
{
- if ((*prev)->left < Size &&
+ if ((*prev)->left < length &&
mem_root->first_block_usage++ >= ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP &&
(*prev)->left < ALLOC_MAX_BLOCK_TO_DROP)
{
@@ -189,20 +189,20 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size)
mem_root->used= next;
mem_root->first_block_usage= 0;
}
- for (next= *prev ; next && next->left < Size ; next= next->next)
+ for (next= *prev ; next && next->left < length ; next= next->next)
prev= &next->next;
}
if (! next)
{ /* Time to alloc new block */
block_size= mem_root->block_size * (mem_root->block_num >> 2);
- get_size= Size+ALIGN_SIZE(sizeof(USED_MEM));
+ get_size= length+ALIGN_SIZE(sizeof(USED_MEM));
get_size= max(get_size, block_size);
if (!(next = (USED_MEM*) my_malloc(get_size,MYF(MY_WME))))
{
if (mem_root->error_handler)
(*mem_root->error_handler)();
- return((gptr) 0); /* purecov: inspected */
+ return((void*) 0); /* purecov: inspected */
}
mem_root->block_num++;
next->next= *prev;
@@ -211,9 +211,9 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size)
*prev=next;
}
- point= (gptr) ((char*) next+ (next->size-next->left));
+ point= (uchar*) ((char*) next+ (next->size-next->left));
/*TODO: next part may be unneded due to mem_root->first_block_usage counter*/
- if ((next->left-= Size) < mem_root->min_malloc)
+ if ((next->left-= length) < mem_root->min_malloc)
{ /* Full block */
*prev= next->next; /* Remove block from list */
next->next= mem_root->used;
@@ -221,7 +221,7 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size)
mem_root->first_block_usage= 0;
}
DBUG_PRINT("exit",("ptr: 0x%lx", (ulong) point));
- DBUG_RETURN(point);
+ DBUG_RETURN((void*) point);
#endif
}
@@ -245,11 +245,11 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size)
in case of success or NULL if out of memory.
*/
-gptr multi_alloc_root(MEM_ROOT *root, ...)
+void *multi_alloc_root(MEM_ROOT *root, ...)
{
va_list args;
char **ptr, *start, *res;
- uint tot_length, length;
+ size_t tot_length, length;
DBUG_ENTER("multi_alloc_root");
va_start(args, root);
@@ -273,7 +273,7 @@ gptr multi_alloc_root(MEM_ROOT *root, ...)
res+= ALIGN_SIZE(length);
}
va_end(args);
- DBUG_RETURN((gptr) start);
+ DBUG_RETURN((void*) start);
}
#define TRASH_MEM(X) TRASH(((char*)(X) + ((X)->size-(X)->left)), (X)->left)
@@ -346,13 +346,13 @@ void free_root(MEM_ROOT *root, myf MyFlags)
{
old=next; next= next->next ;
if (old != root->pre_alloc)
- my_free((gptr) old,MYF(0));
+ my_free(old,MYF(0));
}
for (next=root->free ; next ;)
{
old=next; next= next->next;
if (old != root->pre_alloc)
- my_free((gptr) old,MYF(0));
+ my_free(old,MYF(0));
}
root->used=root->free=0;
if (root->pre_alloc)
@@ -393,13 +393,13 @@ void set_prealloc_root(MEM_ROOT *root, char *ptr)
}
-char *strdup_root(MEM_ROOT *root,const char *str)
+char *strdup_root(MEM_ROOT *root, const char *str)
{
- return strmake_root(root, str, (uint) strlen(str));
+ return strmake_root(root, str, strlen(str));
}
-char *strmake_root(MEM_ROOT *root,const char *str, uint len)
+char *strmake_root(MEM_ROOT *root, const char *str, size_t len)
{
char *pos;
if ((pos=alloc_root(root,len+1)))
@@ -411,7 +411,7 @@ char *strmake_root(MEM_ROOT *root,const char *str, uint len)
}
-char *memdup_root(MEM_ROOT *root,const char *str,uint len)
+void *memdup_root(MEM_ROOT *root, const void *str, size_t len)
{
char *pos;
if ((pos=alloc_root(root,len)))
diff --git a/mysys/my_chsize.c b/mysys/my_chsize.c
index a5dd1564692..b1dbb22c687 100644
--- a/mysys/my_chsize.c
+++ b/mysys/my_chsize.c
@@ -40,12 +40,12 @@
int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags)
{
my_off_t oldsize;
- char buff[IO_SIZE];
+ uchar buff[IO_SIZE];
DBUG_ENTER("my_chsize");
DBUG_PRINT("my",("fd: %d length: %lu MyFlags: %d",fd,(ulong) newlength,
MyFlags));
- if ((oldsize = my_seek(fd, 0L, MY_SEEK_END, MYF(MY_WME+MY_FAE))) == newlength)
+ if ((oldsize= my_seek(fd, 0L, MY_SEEK_END, MYF(MY_WME+MY_FAE))) == newlength)
DBUG_RETURN(0);
DBUG_PRINT("info",("old_size: %ld", (ulong) oldsize));
@@ -98,11 +98,11 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags)
bfill(buff, IO_SIZE, filler);
while (newlength-oldsize > IO_SIZE)
{
- if (my_write(fd,(byte*) buff,IO_SIZE,MYF(MY_NABP)))
+ if (my_write(fd, buff, IO_SIZE, MYF(MY_NABP)))
goto err;
oldsize+= IO_SIZE;
}
- if (my_write(fd,(byte*) buff,(uint) (newlength-oldsize),MYF(MY_NABP)))
+ if (my_write(fd,buff,(size_t) (newlength-oldsize), MYF(MY_NABP)))
goto err;
DBUG_RETURN(0);
diff --git a/mysys/my_compress.c b/mysys/my_compress.c
index 45e60552592..3966be8b6bb 100644
--- a/mysys/my_compress.c
+++ b/mysys/my_compress.c
@@ -24,12 +24,20 @@
#include <zlib.h>
/*
-** This replaces the packet with a compressed packet
-** Returns 1 on error
-** *complen is 0 if the packet wasn't compressed
+ This replaces the packet with a compressed packet
+
+ SYNOPSIS
+ my_compress()
+ packet Data to compress. This is is replaced with the compressed data.
+ len Length of data to compress at 'packet'
+ complen out: 0 if packet was not compressed
+
+ RETURN
+ 1 error. 'len' is not changed'
+ 0 ok. In this case 'len' contains the size of the compressed packet
*/
-my_bool my_compress(byte *packet, ulong *len, ulong *complen)
+my_bool my_compress(uchar *packet, size_t *len, size_t *complen)
{
DBUG_ENTER("my_compress");
if (*len < MIN_COMPRESS_LENGTH)
@@ -39,27 +47,36 @@ my_bool my_compress(byte *packet, ulong *len, ulong *complen)
}
else
{
- byte *compbuf=my_compress_alloc(packet,len,complen);
+ uchar *compbuf=my_compress_alloc(packet,len,complen);
if (!compbuf)
DBUG_RETURN(*complen ? 0 : 1);
memcpy(packet,compbuf,*len);
- my_free(compbuf,MYF(MY_WME)); }
+ my_free(compbuf,MYF(MY_WME));
+ }
DBUG_RETURN(0);
}
-byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen)
+uchar *my_compress_alloc(const uchar *packet, size_t *len, size_t *complen)
{
- byte *compbuf;
+ uchar *compbuf;
+ uLongf tmp_complen;
+ int res;
*complen= *len * 120 / 100 + 12;
- if (!(compbuf= (byte *) my_malloc(*complen,MYF(MY_WME))))
+
+ if (!(compbuf= (uchar *) my_malloc(*complen, MYF(MY_WME))))
return 0; /* Not enough memory */
- if (compress((Bytef*) compbuf,(ulong *) complen, (Bytef*) packet,
- (uLong) *len ) != Z_OK)
+
+ tmp_complen= *complen;
+ res= compress((Bytef*) compbuf, &tmp_complen, (Bytef*) packet, *len);
+ *complen= tmp_complen;
+
+ if (res != Z_OK)
{
- my_free(compbuf,MYF(MY_WME));
+ my_free(compbuf, MYF(MY_WME));
return 0;
}
+
if (*complen >= *len)
{
*complen= 0;
@@ -67,50 +84,68 @@ byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen)
DBUG_PRINT("note",("Packet got longer on compression; Not compressed"));
return 0;
}
- swap_variables(ulong, *len, *complen); /* *len is now packet length */
+ /* Store length of compressed packet in *len */
+ swap_variables(size_t, *len, *complen);
return compbuf;
}
-my_bool my_uncompress (byte *packet, ulong *len, ulong *complen)
+/*
+ Uncompress packet
+
+ SYNOPSIS
+ my_uncompress()
+ packet Compressed data. This is is replaced with the orignal data.
+ len Length of compressed data
+ complen Length of the packet buffer (must be enough for the original
+ data)
+
+ RETURN
+ 1 error
+ 0 ok. In this case 'complen' contains the updated size of the
+ real data.
+*/
+
+my_bool my_uncompress(uchar *packet, size_t len, size_t *complen)
{
+ uLongf tmp_complen;
DBUG_ENTER("my_uncompress");
+
if (*complen) /* If compressed */
{
- byte *compbuf= (byte *) my_malloc(*complen,MYF(MY_WME));
+ uchar *compbuf= (uchar *) my_malloc(*complen,MYF(MY_WME));
int error;
if (!compbuf)
DBUG_RETURN(1); /* Not enough memory */
- if ((error=uncompress((Bytef*) compbuf, complen, (Bytef*) packet, *len))
- != Z_OK)
+
+ tmp_complen= *complen;
+ error= uncompress((Bytef*) compbuf, &tmp_complen, (Bytef*) packet,
+ len);
+ *complen= tmp_complen;
+ if (error != Z_OK)
{ /* Probably wrong packet */
DBUG_PRINT("error",("Can't uncompress packet, error: %d",error));
my_free(compbuf, MYF(MY_WME));
DBUG_RETURN(1);
}
- *len= *complen;
- memcpy(packet, compbuf, *len);
+ memcpy(packet, compbuf, *complen);
my_free(compbuf, MYF(MY_WME));
}
+ else
+ *complen= len;
DBUG_RETURN(0);
}
/*
- Internal representation of the frm blob
+ Internal representation of the frm blob is:
+
+ ver 4 bytes
+ orglen 4 bytes
+ complen 4 bytes
*/
-struct frm_blob_header
-{
- uint ver; /* Version of header */
- uint orglen; /* Original length of compressed data */
- uint complen; /* Compressed length of data, 0=uncompressed */
-};
+#define BLOB_HEADER 12
-struct frm_blob_struct
-{
- struct frm_blob_header head;
- char data[1];
-};
/*
packfrm is a method used to compress the frm file for storage in a
@@ -129,43 +164,42 @@ struct frm_blob_struct
>0 Failure
*/
-int packfrm(const void *data, uint len,
- const void **pack_data, uint *pack_len)
+int packfrm(const uchar *data, size_t len,
+ uchar **pack_data, size_t *pack_len)
{
int error;
- ulong org_len, comp_len;
- uint blob_len;
- struct frm_blob_struct *blob;
+ size_t org_len, comp_len, blob_len;
+ uchar *blob;
DBUG_ENTER("packfrm");
- DBUG_PRINT("enter", ("data: 0x%lx, len: %d", (long) data, len));
+ DBUG_PRINT("enter", ("data: 0x%lx len: %lu", (long) data, (ulong) len));
error= 1;
org_len= len;
- if (my_compress((byte*)data, &org_len, &comp_len))
+ if (my_compress((uchar*)data, &org_len, &comp_len))
goto err;
DBUG_PRINT("info", ("org_len: %lu comp_len: %lu", org_len, comp_len));
DBUG_DUMP("compressed", (char*)data, org_len);
error= 2;
- blob_len= sizeof(struct frm_blob_header)+org_len;
- if (!(blob= (struct frm_blob_struct*) my_malloc(blob_len,MYF(MY_WME))))
+ blob_len= BLOB_HEADER + org_len;
+ if (!(blob= (uchar*) my_malloc(blob_len,MYF(MY_WME))))
goto err;
/* Store compressed blob in machine independent format */
- int4store((char*)(&blob->head.ver), 1);
- int4store((char*)(&blob->head.orglen), comp_len);
- int4store((char*)(&blob->head.complen), org_len);
+ int4store(blob, 1);
+ int4store(blob+4, (uint32) len);
+ int4store(blob+8, (uint32) org_len); /* compressed length */
/* Copy frm data into blob, already in machine independent format */
- memcpy(blob->data, data, org_len);
+ memcpy(blob+BLOB_HEADER, data, org_len);
*pack_data= blob;
- *pack_len= blob_len;
+ *pack_len= blob_len;
error= 0;
- DBUG_PRINT("exit", ("pack_data: 0x%lx pack_len: %d",
- (long) *pack_data, *pack_len));
+ DBUG_PRINT("exit", ("pack_data: 0x%lx pack_len: %lu",
+ (long) *pack_data, (ulong) *pack_len));
err:
DBUG_RETURN(error);
@@ -187,40 +221,40 @@ err:
>0 Failure
*/
-int unpackfrm(const void **unpack_data, uint *unpack_len,
- const void *pack_data)
+int unpackfrm(uchar **unpack_data, size_t *unpack_len,
+ const uchar *pack_data)
{
- const struct frm_blob_struct *blob= (struct frm_blob_struct*)pack_data;
- byte *data;
- ulong complen, orglen, ver;
+ uchar *data;
+ size_t complen, orglen;
+ ulong ver;
DBUG_ENTER("unpackfrm");
DBUG_PRINT("enter", ("pack_data: 0x%lx", (long) pack_data));
- complen= uint4korr((char*)&blob->head.complen);
- orglen= uint4korr((char*)&blob->head.orglen);
- ver= uint4korr((char*)&blob->head.ver);
+ ver= uint4korr(pack_data);
+ orglen= uint4korr(pack_data+4);
+ complen= uint4korr(pack_data+8);
DBUG_PRINT("blob",("ver: %lu complen: %lu orglen: %lu",
- ver,complen,orglen));
- DBUG_DUMP("blob->data", (char*) blob->data, complen);
+ ver, complen, orglen));
+ DBUG_DUMP("blob->data", pack_data + BLOB_HEADER, complen);
if (ver != 1)
DBUG_RETURN(1);
if (!(data= my_malloc(max(orglen, complen), MYF(MY_WME))))
DBUG_RETURN(2);
- memcpy(data, blob->data, complen);
-
+ memcpy(data, pack_data + BLOB_HEADER, complen);
- if (my_uncompress(data, &complen, &orglen))
+ if (my_uncompress(data, complen, &orglen))
{
- my_free((char*)data, MYF(0));
+ my_free(data, MYF(0));
DBUG_RETURN(3);
}
*unpack_data= data;
- *unpack_len= complen;
+ *unpack_len= orglen;
- DBUG_PRINT("exit", ("frmdata: 0x%lx len: %d", (long) *unpack_data, *unpack_len));
+ DBUG_PRINT("exit", ("frmdata: 0x%lx len: %lu", (long) *unpack_data,
+ (ulong) *unpack_len));
DBUG_RETURN(0);
}
#endif /* HAVE_COMPRESS */
diff --git a/mysys/my_conio.c b/mysys/my_conio.c
index 23b0c55e7a9..d03f63a11a9 100644
--- a/mysys/my_conio.c
+++ b/mysys/my_conio.c
@@ -29,10 +29,10 @@ static HANDLE my_coninpfh= 0; /* console input */
if found useful they are to be exported in mysys
*/
+
/*
int my_pthread_auto_mutex_lock(HANDLE* ph, const char* name,
int id, int time)
-
NOTES
creates a mutex with given name and tries to lock it time msec.
mutex name is appended with id to allow system wide or process wide
@@ -41,8 +41,8 @@ static HANDLE my_coninpfh= 0; /* console input */
RETURN
0 thread owns mutex
<>0 error
-
*/
+
static
int my_pthread_auto_mutex_lock(HANDLE* ph, const char* name, int id, int time)
{
@@ -69,7 +69,6 @@ int my_pthread_auto_mutex_lock(HANDLE* ph, const char* name, int id, int time)
/*
int my_pthread_auto_mutex_free(HANDLE* ph)
-
NOTES
releases a mutex.
@@ -103,7 +102,7 @@ int my_pthread_auto_mutex_free(HANDLE* ph)
/*
- char* my_cgets(char *string, unsigned long clen, unsigned long* plen)
+ char* my_cgets()
NOTES
Replaces _cgets from libc to support input of more than 255 chars.
@@ -121,7 +120,8 @@ int my_pthread_auto_mutex_free(HANDLE* ph)
NULL Error
*/
-char* my_cgets(char *buffer, unsigned long clen, unsigned long* plen)
+
+char* my_cgets(char *buffer, size_t clen, size_t* plen)
{
ULONG state;
char *result;
@@ -170,7 +170,7 @@ char* my_cgets(char *buffer, unsigned long clen, unsigned long* plen)
clen= min(clen, 65535);
do
{
- clen= min(clen, (unsigned long)csbi.dwSize.X*csbi.dwSize.Y);
+ clen= min(clen, (size_t) csbi.dwSize.X*csbi.dwSize.Y);
if (!ReadConsole((HANDLE)my_coninpfh, (LPVOID)buffer, clen - 1, plen, NULL))
{
result= NULL;
diff --git a/mysys/my_create.c b/mysys/my_create.c
index 5639459f5a9..55878318ead 100644
--- a/mysys/my_create.c
+++ b/mysys/my_create.c
@@ -40,13 +40,13 @@ File my_create(const char *FileName, int CreateFlags, int access_flags,
FileName, CreateFlags, access_flags, MyFlags));
#if !defined(NO_OPEN_3)
- fd = open((my_string) FileName, access_flags | O_CREAT,
+ fd = open((char *) FileName, access_flags | O_CREAT,
CreateFlags ? CreateFlags : my_umask);
#elif defined(VMS)
- fd = open((my_string) FileName, access_flags | O_CREAT, 0,
+ fd = open((char *) FileName, access_flags | O_CREAT, 0,
"ctx=stm","ctx=bin");
#elif defined(__WIN__)
- fd= my_sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY,
+ fd= my_sopen((char *) FileName, access_flags | O_CREAT | O_BINARY,
SH_DENYNO, MY_S_IREAD | MY_S_IWRITE);
#else
fd = open(FileName, access_flags);
diff --git a/mysys/my_div.c b/mysys/my_div.c
index 656c6cfde91..d29d3668852 100644
--- a/mysys/my_div.c
+++ b/mysys/my_div.c
@@ -23,7 +23,7 @@
fd File descriptor
*/
-my_string my_filename(File fd)
+char * my_filename(File fd)
{
DBUG_ENTER("my_filename");
if ((uint) fd >= (uint) my_file_limit)
diff --git a/mysys/my_error.c b/mysys/my_error.c
index 48392fe84c3..e8fd8b938ee 100644
--- a/mysys/my_error.c
+++ b/mysys/my_error.c
@@ -191,7 +191,7 @@ int my_error_register(const char **errmsgs, int first, int last)
/* Error numbers must be unique. No overlapping is allowed. */
if (*search_meh_pp && ((*search_meh_pp)->meh_first <= last))
{
- my_free((gptr)meh_p, MYF(0));
+ my_free((uchar*)meh_p, MYF(0));
return 1;
}
@@ -247,7 +247,7 @@ const char **my_error_unregister(int first, int last)
/* Save the return value and free the header. */
errmsgs= meh_p->meh_errmsgs;
- my_free((gptr) meh_p, MYF(0));
+ my_free((uchar*) meh_p, MYF(0));
return errmsgs;
}
@@ -259,7 +259,7 @@ void my_error_unregister_all(void)
for (list= my_errmsgs_globerrs.meh_next; list; list= next)
{
next= list->meh_next;
- my_free((gptr) list, MYF(0));
+ my_free((uchar*) list, MYF(0));
}
my_errmsgs_list= &my_errmsgs_globerrs;
}
diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c
index b56be263ba4..09f710c1ef4 100644
--- a/mysys/my_fopen.c
+++ b/mysys/my_fopen.c
@@ -18,7 +18,7 @@
#include <errno.h>
#include "mysys_err.h"
-static void make_ftype(my_string to,int flag);
+static void make_ftype(char * to,int flag);
/*
Open a file as stream
@@ -192,7 +192,7 @@ FILE *my_fdopen(File Filedes, const char *name, int Flags, myf MyFlags)
a+ == O_RDWR|O_APPEND|O_CREAT
*/
-static void make_ftype(register my_string to, register int flag)
+static void make_ftype(register char * to, register int flag)
{
/* check some possible invalid combinations */
DBUG_ASSERT((flag & (O_TRUNC | O_APPEND)) != (O_TRUNC | O_APPEND));
diff --git a/mysys/my_fstream.c b/mysys/my_fstream.c
index ea30509ca8c..f5fe862937c 100644
--- a/mysys/my_fstream.c
+++ b/mysys/my_fstream.c
@@ -27,24 +27,31 @@
#define fseek(A,B,C) fseeko((A),(B),(C))
#endif
- /* Read a chunk of bytes from a file */
- /* Returns (uint) -1 if error as my_read() */
-
-uint my_fread(FILE *stream, byte *Buffer, uint Count, myf MyFlags)
- /* File descriptor */
- /* Buffer must be at least count bytes */
- /* Max number of bytes returnd */
- /* Flags on what to do on error */
+/*
+ Read a chunk of bytes from a FILE
+
+ SYNOPSIS
+ my_fread()
+ stream File descriptor
+ Buffer Buffer to read to
+ Count Number of bytes to read
+ MyFlags Flags on what to do on error
+
+ RETURN
+ (size_t) -1 Error
+ # Number of bytes read
+ */
+
+size_t my_fread(FILE *stream, uchar *Buffer, size_t Count, myf MyFlags)
{
- uint readbytes;
+ size_t readbytes;
DBUG_ENTER("my_fread");
DBUG_PRINT("my",("stream: 0x%lx Buffer: 0x%lx Count: %u MyFlags: %d",
- (long) stream, (long) Buffer, Count, MyFlags));
+ (long) stream, (long) Buffer, (uint) Count, MyFlags));
- if ((readbytes = (uint) fread(Buffer,sizeof(char),(size_t) Count,stream))
- != Count)
+ if ((readbytes= fread(Buffer, sizeof(char), Count, stream)) != Count)
{
- DBUG_PRINT("error",("Read only %d bytes",readbytes));
+ DBUG_PRINT("error",("Read only %d bytes", (int) readbytes));
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{
if (ferror(stream))
@@ -57,7 +64,7 @@ uint my_fread(FILE *stream, byte *Buffer, uint Count, myf MyFlags)
}
my_errno=errno ? errno : -1;
if (ferror(stream) || MyFlags & (MY_NABP | MY_FNABP))
- DBUG_RETURN((uint) -1); /* Return with error */
+ DBUG_RETURN((size_t) -1); /* Return with error */
}
if (MyFlags & (MY_NABP | MY_FNABP))
DBUG_RETURN(0); /* Read ok */
@@ -66,40 +73,48 @@ uint my_fread(FILE *stream, byte *Buffer, uint Count, myf MyFlags)
/*
-** Write a chunk of bytes to a stream
-** Returns (uint) -1 if error as my_write()
-** Does retries if interrupted
+ Write a chunk of bytes to a stream
+
+ my_fwrite()
+ stream File descriptor
+ Buffer Buffer to write from
+ Count Number of bytes to write
+ MyFlags Flags on what to do on error
+
+ RETURN
+ (size_t) -1 Error
+ # Number of bytes written
*/
-uint my_fwrite(FILE *stream, const byte *Buffer, uint Count, myf MyFlags)
+size_t my_fwrite(FILE *stream, const uchar *Buffer, size_t Count, myf MyFlags)
{
- uint writenbytes=0;
- off_t seekptr;
+ size_t writtenbytes =0;
+ my_off_t seekptr;
#if !defined(NO_BACKGROUND) && defined(USE_MY_STREAM)
uint errors;
#endif
DBUG_ENTER("my_fwrite");
DBUG_PRINT("my",("stream: 0x%lx Buffer: 0x%lx Count: %u MyFlags: %d",
- (long) stream, (long) Buffer, Count, MyFlags));
+ (long) stream, (long) Buffer, (uint) Count, MyFlags));
#if !defined(NO_BACKGROUND) && defined(USE_MY_STREAM)
errors=0;
#endif
- seekptr=ftell(stream);
+ seekptr= ftell(stream);
for (;;)
{
- uint writen;
- if ((writen = (uint) fwrite((char*) Buffer,sizeof(char),
- (size_t) Count, stream)) != Count)
+ size_t written;
+ if ((written = (size_t) fwrite((char*) Buffer,sizeof(char),
+ Count, stream)) != Count)
{
- DBUG_PRINT("error",("Write only %d bytes",writenbytes));
+ DBUG_PRINT("error",("Write only %d bytes", (int) writtenbytes));
my_errno=errno;
- if (writen != (uint) -1)
+ if (written != (size_t) -1)
{
- seekptr+=writen;
- Buffer+=writen;
- writenbytes+=writen;
- Count-=writen;
+ seekptr+=written;
+ Buffer+=written;
+ writtenbytes+=written;
+ Count-=written;
}
#ifdef EINTR
if (errno == EINTR)
@@ -131,21 +146,21 @@ uint my_fwrite(FILE *stream, const byte *Buffer, uint Count, myf MyFlags)
my_error(EE_WRITE, MYF(ME_BELL+ME_WAITTANG),
my_filename(fileno(stream)),errno);
}
- writenbytes=(uint) -1; /* Return that we got error */
+ writtenbytes= (size_t) -1; /* Return that we got error */
break;
}
}
if (MyFlags & (MY_NABP | MY_FNABP))
- writenbytes=0; /* Everything OK */
+ writtenbytes= 0; /* Everything OK */
else
- writenbytes+=writen;
+ writtenbytes+= written;
break;
}
- DBUG_RETURN(writenbytes);
+ DBUG_RETURN(writtenbytes);
} /* my_fwrite */
- /* Seek to position in file */
- /* ARGSUSED */
+
+/* Seek to position in file */
my_off_t my_fseek(FILE *stream, my_off_t pos, int whence,
myf MyFlags __attribute__((unused)))
@@ -158,8 +173,7 @@ my_off_t my_fseek(FILE *stream, my_off_t pos, int whence,
} /* my_seek */
- /* Tell current position of file */
- /* ARGSUSED */
+/* Tell current position of file */
my_off_t my_ftell(FILE *stream, myf MyFlags __attribute__((unused)))
{
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index aa470282aa4..ecb740a15c7 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -33,7 +33,7 @@ static longlong getopt_ll(char *arg, const struct my_option *optp, int *err);
static ulonglong getopt_ull(char *arg, const struct my_option *optp,
int *err);
static void init_variables(const struct my_option *options);
-static int setval(const struct my_option *opts, gptr *value, char *argument,
+static int setval(const struct my_option *opts, uchar* *value, char *argument,
my_bool set_maximum_value);
static char *check_struct_option(char *cur_arg, char *key_name);
@@ -82,9 +82,9 @@ static void default_reporter(enum loglevel level,
one. Call function 'get_one_option()' once for each option.
*/
-static gptr* (*getopt_get_addr)(const char *, uint, const struct my_option *);
+static uchar** (*getopt_get_addr)(const char *, uint, const struct my_option *);
-void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
+void my_getopt_register_get_addr(uchar** (*func_addr)(const char *, uint,
const struct my_option *))
{
getopt_get_addr= func_addr;
@@ -100,7 +100,7 @@ int handle_options(int *argc, char ***argv,
char **pos, **pos_end, *optend, *prev_found,
*opt_str, key_name[FN_REFLEN];
const struct my_option *optp;
- gptr *value;
+ uchar* *value;
int error;
LINT_INIT(opt_found);
@@ -556,14 +556,14 @@ static char *check_struct_option(char *cur_arg, char *key_name)
Will set the option value to given value
*/
-static int setval(const struct my_option *opts, gptr *value, char *argument,
+static int setval(const struct my_option *opts, uchar* *value, char *argument,
my_bool set_maximum_value)
{
int err= 0;
if (value && argument)
{
- gptr *result_pos= ((set_maximum_value) ?
+ uchar* *result_pos= ((set_maximum_value) ?
opts->u_max_value : value);
if (!result_pos)
@@ -777,7 +777,7 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp)
value Pointer to variable
*/
-static void init_one_value(const struct my_option *option, gptr *variable,
+static void init_one_value(const struct my_option *option, uchar* *variable,
longlong value)
{
switch ((option->var_type & GET_TYPE_MASK)) {
@@ -825,7 +825,7 @@ static void init_variables(const struct my_option *options)
{
for (; options->name; options++)
{
- gptr *variable;
+ uchar* *variable;
/*
We must set u_max_value first as for some variables
options->u_max_value == options->value and in this case we want to
@@ -937,7 +937,7 @@ void my_print_variables(const struct my_option *options)
printf("--------------------------------- -----------------------------\n");
for (optp= options; optp->id; optp++)
{
- gptr *value= (optp->var_type & GET_ASK_ADDR ?
+ uchar* *value= (optp->var_type & GET_ASK_ADDR ?
(*getopt_get_addr)("", 0, optp) : optp->value);
if (value)
{
diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c
index c258db8b126..cbfebcf2374 100644
--- a/mysys/my_getwd.c
+++ b/mysys/my_getwd.c
@@ -27,16 +27,28 @@
#include <direct.h>
#endif
- /* Gets current working directory in buff. Directory is allways ended
- with FN_LIBCHAR */
- /* One must pass a buffer to my_getwd. One can allways use
- curr_dir[] */
+/* Gets current working directory in buff.
-int my_getwd(my_string buf, uint size, myf MyFlags)
+ SYNPOSIS
+ my_getwd()
+ buf Buffer to store result. Can be curr_dir[].
+ size Size of buffer
+ MyFlags Flags
+
+ NOTES
+ Directory is allways ended with FN_LIBCHAR
+
+ RESULT
+ 0 ok
+ # error
+*/
+
+int my_getwd(char * buf, size_t size, myf MyFlags)
{
- my_string pos;
+ char * pos;
DBUG_ENTER("my_getwd");
- DBUG_PRINT("my",("buf: 0x%lx size: %d MyFlags %d", (long) buf,size,MyFlags));
+ DBUG_PRINT("my",("buf: 0x%lx size: %u MyFlags %d",
+ (long) buf, (uint) size, MyFlags));
if (curr_dir[0]) /* Current pos is saved here */
VOID(strmake(buf,&curr_dir[0],size-1));
@@ -71,26 +83,26 @@ int my_getwd(my_string buf, uint size, myf MyFlags)
pos[0]= FN_LIBCHAR;
pos[1]=0;
}
- (void) strmake(&curr_dir[0],buf,(size_s) (FN_REFLEN-1));
+ (void) strmake(&curr_dir[0],buf, (size_t) (FN_REFLEN-1));
}
DBUG_RETURN(0);
} /* my_getwd */
- /* Set new working directory */
+/* Set new working directory */
int my_setwd(const char *dir, myf MyFlags)
{
int res;
- size_s length;
- my_string start,pos;
+ size_t length;
+ char *start, *pos;
#if defined(VMS)
char buff[FN_REFLEN];
#endif
DBUG_ENTER("my_setwd");
DBUG_PRINT("my",("dir: '%s' MyFlags %d", dir, MyFlags));
- start=(my_string) dir;
+ start=(char *) dir;
if (! dir[0] || (dir[0] == FN_LIBCHAR && dir[1] == 0))
dir=FN_ROOTDIR;
#ifdef VMS
@@ -115,7 +127,7 @@ int my_setwd(const char *dir, myf MyFlags)
{
if (test_if_hard_path(start))
{ /* Hard pathname */
- pos=strmake(&curr_dir[0],start,(size_s) FN_REFLEN-1);
+ pos= strmake(&curr_dir[0],start,(size_t) FN_REFLEN-1);
if (pos[-1] != FN_LIBCHAR)
{
length=(uint) (pos-(char*) curr_dir);
diff --git a/mysys/my_init.c b/mysys/my_init.c
index 7784c09d9d6..dcc49c68c0f 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -69,7 +69,7 @@ static ulong atoi_octal(const char *str)
my_bool my_init(void)
{
- my_string str;
+ char * str;
if (my_init_done)
return 0;
my_init_done=1;
diff --git a/mysys/my_largepage.c b/mysys/my_largepage.c
index 9714c582acb..a20111396cb 100644
--- a/mysys/my_largepage.c
+++ b/mysys/my_largepage.c
@@ -26,8 +26,8 @@
#endif
static uint my_get_large_page_size_int(void);
-static gptr my_large_malloc_int(uint size, myf my_flags);
-static my_bool my_large_free_int(gptr ptr, myf my_flags);
+static uchar* my_large_malloc_int(size_t size, myf my_flags);
+static my_bool my_large_free_int(uchar* ptr, myf my_flags);
/* Gets the size of large pages from the OS */
@@ -48,9 +48,9 @@ uint my_get_large_page_size(void)
my_malloc_lock() in case of failure
*/
-gptr my_large_malloc(uint size, myf my_flags)
+uchar* my_large_malloc(size_t size, myf my_flags)
{
- gptr ptr;
+ uchar* ptr;
DBUG_ENTER("my_large_malloc");
if (my_use_large_pages && my_large_page_size)
@@ -70,7 +70,7 @@ gptr my_large_malloc(uint size, myf my_flags)
to my_free_lock() in case of failure
*/
-void my_large_free(gptr ptr, myf my_flags __attribute__((unused)))
+void my_large_free(uchar* ptr, myf my_flags __attribute__((unused)))
{
DBUG_ENTER("my_large_free");
@@ -113,29 +113,29 @@ finish:
#if HAVE_DECL_SHM_HUGETLB
/* Linux-specific large pages allocator */
-gptr my_large_malloc_int(uint size, myf my_flags)
+uchar* my_large_malloc_int(size_t size, myf my_flags)
{
int shmid;
- gptr ptr;
+ uchar* ptr;
struct shmid_ds buf;
DBUG_ENTER("my_large_malloc_int");
/* Align block size to my_large_page_size */
size = ((size - 1) & ~(my_large_page_size - 1)) + my_large_page_size;
- shmid = shmget(IPC_PRIVATE, (size_t)size, SHM_HUGETLB | SHM_R | SHM_W);
+ shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | SHM_R | SHM_W);
if (shmid < 0)
{
if (my_flags & MY_WME)
fprintf(stderr,
- "Warning: Failed to allocate %d bytes from HugeTLB memory."
- " errno %d\n", size, errno);
+ "Warning: Failed to allocate %lu bytesx from HugeTLB memory."
+ " errno %d\n", (ulong) size, errno);
DBUG_RETURN(NULL);
}
- ptr = shmat(shmid, NULL, 0);
- if (ptr == (void *)-1)
+ ptr = (uchar*) shmat(shmid, NULL, 0);
+ if (ptr == (uchar *) -1)
{
if (my_flags& MY_WME)
fprintf(stderr, "Warning: Failed to attach shared memory segment,"
@@ -156,7 +156,7 @@ gptr my_large_malloc_int(uint size, myf my_flags)
/* Linux-specific large pages deallocator */
-my_bool my_large_free_int(byte *ptr, myf my_flags __attribute__((unused)))
+my_bool my_large_free_int(uchar *ptr, myf my_flags __attribute__((unused)))
{
DBUG_ENTER("my_large_free_int");
DBUG_RETURN(shmdt(ptr) == 0);
diff --git a/mysys/my_lib.c b/mysys/my_lib.c
index 783a0683731..c10b2e391b4 100644
--- a/mysys/my_lib.c
+++ b/mysys/my_lib.c
@@ -78,7 +78,7 @@ void my_dirend(MY_DIR *buffer)
ALIGN_SIZE(sizeof(MY_DIR))));
free_root((MEM_ROOT*)((char*)buffer + ALIGN_SIZE(sizeof(MY_DIR)) +
ALIGN_SIZE(sizeof(DYNAMIC_ARRAY))), MYF(0));
- my_free((gptr) buffer,MYF(0));
+ my_free((uchar*) buffer,MYF(0));
}
DBUG_VOID_RETURN;
} /* my_dirend */
@@ -114,7 +114,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
pthread_mutex_lock(&THR_LOCK_open);
#endif
- dirp = opendir(directory_file_name(tmp_path,(my_string) path));
+ dirp = opendir(directory_file_name(tmp_path,(char *) path));
#if defined(__amiga__)
if ((dirp->dd_fd) < 0) /* Directory doesn't exists */
goto error;
@@ -132,7 +132,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
if (my_init_dynamic_array(dir_entries_storage, sizeof(FILEINFO),
ENTRIES_START_SIZE, ENTRIES_INCREMENT))
{
- my_free((gptr) buffer,MYF(0));
+ my_free((uchar*) buffer,MYF(0));
goto error;
}
init_alloc_root(names_storage, NAMES_START_SIZE, NAMES_START_SIZE);
@@ -168,7 +168,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
else
finfo.mystat= NULL;
- if (push_dynamic(dir_entries_storage, (gptr)&finfo))
+ if (push_dynamic(dir_entries_storage, (uchar*)&finfo))
goto error;
}
@@ -208,13 +208,13 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
* Returns pointer to dst;
*/
-my_string directory_file_name (my_string dst, const char *src)
+char * directory_file_name (char * dst, const char *src)
{
#ifndef VMS
/* Process as Unix format: just remove test the final slash. */
- my_string end;
+ char * end;
if (src[0] == 0)
src= (char*) "."; /* Use empty as current */
@@ -230,7 +230,7 @@ my_string directory_file_name (my_string dst, const char *src)
long slen;
long rlen;
- my_string ptr, rptr;
+ char * ptr, rptr;
char bracket;
struct FAB fab = cc$rms_fab;
struct NAM nam = cc$rms_nam;
@@ -401,7 +401,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
if (my_init_dynamic_array(dir_entries_storage, sizeof(FILEINFO),
ENTRIES_START_SIZE, ENTRIES_INCREMENT))
{
- my_free((gptr) buffer,MYF(0));
+ my_free((uchar*) buffer,MYF(0));
goto error;
}
init_alloc_root(names_storage, NAMES_START_SIZE, NAMES_START_SIZE);
@@ -475,7 +475,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
else
finfo.mystat= NULL;
- if (push_dynamic(dir_entries_storage, (gptr)&finfo))
+ if (push_dynamic(dir_entries_storage, (uchar*)&finfo))
goto error;
}
#ifdef __BORLANDC__
@@ -533,13 +533,13 @@ MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags)
if ((m_used= (stat_area == NULL)))
if (!(stat_area = (MY_STAT *) my_malloc(sizeof(MY_STAT), my_flags)))
goto error;
- if (! stat((my_string) path, (struct stat *) stat_area) )
+ if (! stat((char *) path, (struct stat *) stat_area) )
DBUG_RETURN(stat_area);
DBUG_PRINT("error",("Got errno: %d from stat", errno));
my_errno= errno;
if (m_used) /* Free if new area */
- my_free((gptr) stat_area,MYF(0));
+ my_free((uchar*) stat_area,MYF(0));
error:
if (my_flags & (MY_FAE+MY_WME))
diff --git a/mysys/my_lockmem.c b/mysys/my_lockmem.c
index a58a5a340b1..b96331cd3cf 100644
--- a/mysys/my_lockmem.c
+++ b/mysys/my_lockmem.c
@@ -25,17 +25,17 @@
struct st_mem_list
{
LIST list;
- byte *page;
+ uchar *page;
uint size;
};
LIST *mem_list;
-byte *my_malloc_lock(uint size,myf MyFlags)
+uchar *my_malloc_lock(uint size,myf MyFlags)
{
int success;
uint pagesize=sysconf(_SC_PAGESIZE);
- byte *ptr;
+ uchar *ptr;
struct st_mem_list *element;
DBUG_ENTER("my_malloc_lock");
@@ -46,7 +46,7 @@ byte *my_malloc_lock(uint size,myf MyFlags)
my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size);
DBUG_RETURN(0);
}
- success = mlock((byte*) ptr,size);
+ success = mlock((uchar*) ptr,size);
if (success != 0 && geteuid() == 0)
{
DBUG_PRINT("warning",("Failed to lock memory. errno %d\n",
@@ -59,11 +59,11 @@ byte *my_malloc_lock(uint size,myf MyFlags)
/* Add block in a list for munlock */
if (!(element=(struct st_mem_list*) my_malloc(sizeof(*element),MyFlags)))
{
- VOID(munlock((byte*) ptr,size));
+ VOID(munlock((uchar*) ptr,size));
free(ptr);
DBUG_RETURN(0);
}
- element->list.data=(byte*) element;
+ element->list.data=(uchar*) element;
element->page=ptr;
element->size=size;
pthread_mutex_lock(&THR_LOCK_malloc);
@@ -74,7 +74,7 @@ byte *my_malloc_lock(uint size,myf MyFlags)
}
-void my_free_lock(byte *ptr,myf Myflags __attribute__((unused)))
+void my_free_lock(uchar *ptr,myf Myflags __attribute__((unused)))
{
LIST *list;
struct st_mem_list *element=0;
@@ -85,14 +85,14 @@ void my_free_lock(byte *ptr,myf Myflags __attribute__((unused)))
element=(struct st_mem_list*) list->data;
if (ptr == element->page)
{ /* Found locked mem */
- VOID(munlock((byte*) ptr,element->size));
+ VOID(munlock((uchar*) ptr,element->size));
mem_list=list_delete(mem_list,list);
break;
}
}
pthread_mutex_unlock(&THR_LOCK_malloc);
if (element)
- my_free((gptr) element,MYF(0));
+ my_free((uchar*) element,MYF(0));
free(ptr); /* Free even if not locked */
}
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index b0e775177a6..12793ad451b 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -23,11 +23,11 @@
/* My memory allocator */
-gptr my_malloc(unsigned int size, myf my_flags)
+void *my_malloc(size_t size, myf my_flags)
{
- gptr point;
+ void* point;
DBUG_ENTER("my_malloc");
- DBUG_PRINT("my",("size: %u my_flags: %d",size, my_flags));
+ DBUG_PRINT("my",("size: %lu my_flags: %d", (ulong) size, my_flags));
if (!size)
size=1; /* Safety */
@@ -44,14 +44,14 @@ gptr my_malloc(unsigned int size, myf my_flags)
else if (my_flags & MY_ZEROFILL)
bzero(point,size);
DBUG_PRINT("exit",("ptr: 0x%lx", (long) point));
- DBUG_RETURN(point);
+ DBUG_RETURN((void*) point);
} /* my_malloc */
/* Free memory allocated with my_malloc */
/*ARGSUSED*/
-void my_no_flags_free(gptr ptr)
+void my_no_flags_free(void* ptr)
{
DBUG_ENTER("my_free");
DBUG_PRINT("my",("ptr: 0x%lx", (long) ptr));
@@ -63,32 +63,32 @@ void my_no_flags_free(gptr ptr)
/* malloc and copy */
-gptr my_memdup(const byte *from, uint length, myf my_flags)
+void* my_memdup(const void *from, size_t length, myf my_flags)
{
- gptr ptr;
- if ((ptr=my_malloc(length,my_flags)) != 0)
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
+ void *ptr;
+ if ((ptr= my_malloc(length,my_flags)) != 0)
+ memcpy(ptr, from, length);
return(ptr);
}
char *my_strdup(const char *from, myf my_flags)
{
- gptr ptr;
- uint length=(uint) strlen(from)+1;
- if ((ptr=my_malloc(length,my_flags)) != 0)
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
- return((my_string) ptr);
+ char *ptr;
+ size_t length= strlen(from)+1;
+ if ((ptr= (char*) my_malloc(length, my_flags)))
+ memcpy((uchar*) ptr, (uchar*) from,(size_t) length);
+ return(ptr);
}
-char *my_strndup(const char *from, uint length, myf my_flags)
+char *my_strndup(const char *from, size_t length, myf my_flags)
{
- gptr ptr;
- if ((ptr=my_malloc(length+1,my_flags)) != 0)
+ char *ptr;
+ if ((ptr= (char*) my_malloc(length+1,my_flags)) != 0)
{
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
- ((char*) ptr)[length]=0;
+ memcpy((uchar*) ptr, (uchar*) from, length);
+ ptr[length]=0;
}
return((char*) ptr);
}
diff --git a/mysys/my_memmem.c b/mysys/my_memmem.c
index 9230337409d..c000f14bc66 100644
--- a/mysys/my_memmem.c
+++ b/mysys/my_memmem.c
@@ -22,8 +22,9 @@
Returns a pointer to the beginning of the substring, needle, or NULL if the
substring is not found in haystack.
*/
+
void *my_memmem(const void *haystack, size_t haystacklen,
- const void *needle, size_t needlelen)
+ const void *needle, size_t needlelen)
{
const unsigned char *cursor;
const unsigned char *last_possible_needle_location =
diff --git a/mysys/my_once.c b/mysys/my_once.c
index fcb5af3ccbd..b6f6656fce2 100644
--- a/mysys/my_once.c
+++ b/mysys/my_once.c
@@ -36,10 +36,10 @@
No DBUG_ENTER... here to get smaller dbug-startup
*/
-gptr my_once_alloc(unsigned int Size, myf MyFlags)
+void* my_once_alloc(size_t Size, myf MyFlags)
{
- uint get_size,max_left;
- gptr point;
+ size_t get_size, max_left;
+ uchar* point;
reg1 USED_MEM *next;
reg2 USED_MEM **prev;
@@ -63,36 +63,36 @@ gptr my_once_alloc(unsigned int Size, myf MyFlags)
my_errno=errno;
if (MyFlags & (MY_FAE+MY_WME))
my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),get_size);
- return((gptr) 0);
+ return((uchar*) 0);
}
- DBUG_PRINT("test",("my_once_malloc %u byte malloced",get_size));
+ DBUG_PRINT("test",("my_once_malloc %lu byte malloced", (ulong) get_size));
next->next= 0;
next->size= get_size;
next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM));
*prev=next;
}
- point= (gptr) ((char*) next+ (next->size-next->left));
+ point= (uchar*) ((char*) next+ (next->size-next->left));
next->left-= Size;
if (MyFlags & MY_ZEROFILL)
bzero(point, Size);
- return(point);
+ return((void*) point);
} /* my_once_alloc */
char *my_once_strdup(const char *src,myf myflags)
{
- uint len= (uint) strlen(src)+1;
- char *dst=my_once_alloc(len, myflags);
+ size_t len= strlen(src)+1;
+ uchar *dst= my_once_alloc(len, myflags);
if (dst)
memcpy(dst, src, len);
- return dst;
+ return (char*) dst;
}
-char *my_once_memdup(const char *src, uint len, myf myflags)
+void *my_once_memdup(const void *src, size_t len, myf myflags)
{
- char *dst=my_once_alloc(len, myflags);
+ uchar *dst= my_once_alloc(len, myflags);
if (dst)
memcpy(dst, src, len);
return dst;
@@ -114,7 +114,7 @@ void my_once_free(void)
for (next=my_once_root_block ; next ; )
{
old=next; next= next->next ;
- free((gptr) old);
+ free((uchar*) old);
}
my_once_root_block=0;
diff --git a/mysys/my_open.c b/mysys/my_open.c
index 71e243c0173..5ad48e66b68 100644
--- a/mysys/my_open.c
+++ b/mysys/my_open.c
@@ -56,20 +56,20 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
}
#ifndef __WIN__
if (Flags & O_SHARE)
- fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO,
+ fd = sopen((char *) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO,
MY_S_IREAD | MY_S_IWRITE);
else
- fd = open((my_string) FileName, Flags | O_BINARY,
+ fd = open((char *) FileName, Flags | O_BINARY,
MY_S_IREAD | MY_S_IWRITE);
#else
- fd= my_sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO,
+ fd= my_sopen((char *) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO,
MY_S_IREAD | MY_S_IWRITE);
#endif
#elif !defined(NO_OPEN_3)
fd = open(FileName, Flags, my_umask); /* Normal unix */
#else
- fd = open((my_string) FileName, Flags);
+ fd = open((char *) FileName, Flags);
#endif
DBUG_RETURN(my_register_filename(fd, FileName, FILE_BY_OPEN,
EE_FILENOTFOUND, MyFlags));
diff --git a/mysys/my_pread.c b/mysys/my_pread.c
index f8f0fa49c10..070494e4f1d 100644
--- a/mysys/my_pread.c
+++ b/mysys/my_pread.c
@@ -20,61 +20,57 @@
#include <unistd.h>
#endif
- /* Read a chunk of bytes from a file */
-
-uint my_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset,
- myf MyFlags)
+/*
+ Read a chunk of bytes from a file from a given position
+
+ SYNOPSIOS
+ my_pread()
+ Filedes File decsriptor
+ Buffer Buffer to read data into
+ Count Number of bytes to read
+ offset Position to read from
+ MyFlags Flags
+
+ NOTES
+ This differs from the normal pread() call in that we don't care
+ to set the position in the file back to the original position
+ if the system doesn't support pread().
+
+ RETURN
+ (size_t) -1 Error
+ # Number of bytes read
+*/
+
+size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
+ myf MyFlags)
{
- uint readbytes;
+ size_t readbytes;
int error= 0;
DBUG_ENTER("my_pread");
DBUG_PRINT("my",("Fd: %d Seek: %lu Buffer: 0x%lx Count: %u MyFlags: %d",
- Filedes, (ulong) offset, (long) Buffer, Count, MyFlags));
-
+ Filedes, (ulong) offset, (long) Buffer, (uint) Count,
+ MyFlags));
for (;;)
{
#ifndef __WIN__
errno=0; /* Linux doesn't reset this */
#endif
#ifndef HAVE_PREAD
- os_off_t old_offset;
-
pthread_mutex_lock(&my_file_info[Filedes].mutex);
- /*
- As we cannot change the file pointer, we save the old position,
- before seeking to the given offset
- */
-
- error= (old_offset= lseek(Filedes, 0L, MY_SEEK_CUR)) == -1L ||
- lseek(Filedes, offset, MY_SEEK_SET) == -1L;
-
- if (!error) /* Seek was successful */
- {
- if ((readbytes = (uint) read(Filedes, Buffer, Count)) == -1L)
- my_errno= errno;
-
- /*
- We should seek back, even if read failed. If this fails,
- we will return an error. If read failed as well, we will
- save the errno from read, not from lseek().
- */
- if ((error= (lseek(Filedes, old_offset, MY_SEEK_SET) == -1L)) &&
- readbytes != -1L)
- my_errno= errno;
- }
-
+ readbytes= (uint) -1;
+ error= (lseek(Filedes, offset, MY_SEEK_SET) == (my_off_t) -1 ||
+ (readbytes= read(Filedes, Buffer, Count)) != Count);
pthread_mutex_unlock(&my_file_info[Filedes].mutex);
#else
- if ((error= ((readbytes =
- (uint) pread(Filedes, Buffer, Count, offset)) != Count)))
+ if ((error= ((readbytes= pread(Filedes, Buffer, Count, offset)) != Count)))
my_errno= errno;
#endif
if (error || readbytes != Count)
{
DBUG_PRINT("warning",("Read only %d bytes off %u from %d, errno: %d",
- (int) readbytes, Count,Filedes,my_errno));
+ (int) readbytes, (uint) Count,Filedes,my_errno));
#ifdef THREAD
- if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
+ if ((readbytes == 0 || readbytes == (size_t) -1) && errno == EINTR)
{
DBUG_PRINT("debug", ("my_pread() was interrupted and returned %d",
(int) readbytes));
@@ -83,14 +79,14 @@ uint my_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset,
#endif
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{
- if ((int) readbytes == -1)
+ if (readbytes == (size_t) -1)
my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
my_filename(Filedes),my_errno);
else if (MyFlags & (MY_NABP | MY_FNABP))
my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
my_filename(Filedes),my_errno);
}
- if ((int) readbytes == -1 || (MyFlags & (MY_FNABP | MY_NABP)))
+ if (readbytes == (size_t) -1 || (MyFlags & (MY_FNABP | MY_NABP)))
DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
}
if (MyFlags & (MY_NABP | MY_FNABP))
@@ -100,65 +96,63 @@ uint my_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset,
} /* my_pread */
- /* Write a chunk of bytes to a file */
+/*
+ Write a chunk of bytes to a file at a given position
+
+ SYNOPSIOS
+ my_pwrite()
+ Filedes File decsriptor
+ Buffer Buffer to write data from
+ Count Number of bytes to write
+ offset Position to write to
+ MyFlags Flags
+
+ NOTES
+ This differs from the normal pwrite() call in that we don't care
+ to set the position in the file back to the original position
+ if the system doesn't support pwrite()
-uint my_pwrite(int Filedes, const byte *Buffer, uint Count, my_off_t offset,
- myf MyFlags)
+ RETURN
+ (size_t) -1 Error
+ # Number of bytes read
+ */
+
+size_t my_pwrite(int Filedes, const uchar *Buffer, size_t Count,
+ my_off_t offset, myf MyFlags)
{
- uint writenbytes,errors;
- ulong written;
+ size_t writenbytes, written;
+ uint errors;
DBUG_ENTER("my_pwrite");
- DBUG_PRINT("my",("Fd: %d Seek: %lu Buffer: 0x%lx Count: %d MyFlags: %d",
- Filedes, (ulong) offset, (long) Buffer, Count, MyFlags));
- errors=0; written=0L;
+ DBUG_PRINT("my",("Fd: %d Seek: %lu Buffer: 0x%lx Count: %u MyFlags: %d",
+ Filedes, (ulong) offset, (long) Buffer, (uint) Count,
+ MyFlags));
+ errors= 0;
+ written= 0;
for (;;)
{
#ifndef HAVE_PREAD
- int error= 0;
- os_off_t old_offset;
- writenbytes= (uint) -1;
+ int error;
+ writenbytes= (size_t) -1;
pthread_mutex_lock(&my_file_info[Filedes].mutex);
-
- /*
- As we cannot change the file pointer, we save the old position,
- before seeking to the given offset
- */
- error= ((old_offset= lseek(Filedes, 0L, MY_SEEK_CUR)) == -1L ||
- lseek(Filedes, offset, MY_SEEK_SET) == -1L);
-
- if (!error) /* Seek was successful */
- {
- if ((writenbytes = (uint) write(Filedes, Buffer, Count)) == -1L)
- my_errno= errno;
-
- /*
- We should seek back, even if write failed. If this fails,
- we will return an error. If write failed as well, we will
- save the errno from write, not from lseek().
- */
- if ((error= (lseek(Filedes, old_offset, MY_SEEK_SET) == -1L)) &&
- writenbytes != -1L)
- my_errno= errno;
- }
+ error= (lseek(Filedes, offset, MY_SEEK_SET) != (my_off_t) -1 &&
+ (writenbytes = write(Filedes, Buffer, Count)) == Count);
pthread_mutex_unlock(&my_file_info[Filedes].mutex);
-
- if (!error && writenbytes == Count)
+ if (error)
break;
#else
- if ((writenbytes = (uint) pwrite(Filedes, Buffer, Count,offset)) == Count)
+ if ((writenbytes= pwrite(Filedes, Buffer, Count,offset)) == Count)
break;
- else
- my_errno= errno;
+ my_errno= errno;
#endif
- if ((int) writenbytes != -1)
+ if (writenbytes != (size_t) -1)
{ /* Safegueard */
written+=writenbytes;
Buffer+=writenbytes;
Count-=writenbytes;
offset+=writenbytes;
}
- DBUG_PRINT("error",("Write only %d bytes",writenbytes));
+ DBUG_PRINT("error",("Write only %u bytes", (uint) writenbytes));
#ifndef NO_BACKGROUND
#ifdef THREAD
if (my_thread_var->abort)
@@ -173,8 +167,7 @@ uint my_pwrite(int Filedes, const byte *Buffer, uint Count, my_off_t offset,
VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
continue;
}
- if ((writenbytes > 0 && (uint) writenbytes != (uint) -1) ||
- my_errno == EINTR)
+ if ((writenbytes && writenbytes != (size_t) -1) || my_errno == EINTR)
continue; /* Retry */
#endif
if (MyFlags & (MY_NABP | MY_FNABP))
diff --git a/mysys/my_quick.c b/mysys/my_quick.c
index 15549dfb751..af8ef05bd5f 100644
--- a/mysys/my_quick.c
+++ b/mysys/my_quick.c
@@ -19,14 +19,14 @@
#include "my_nosys.h"
-uint my_quick_read(File Filedes,byte *Buffer,uint Count,myf MyFlags)
+size_t my_quick_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags)
{
- uint readbytes;
+ size_t readbytes;
- if ((readbytes = (uint) read(Filedes, Buffer, Count)) != Count)
+ if ((readbytes = read(Filedes, Buffer, Count)) != Count)
{
#ifndef DBUG_OFF
- if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
+ if ((readbytes == 0 || readbytes == (size_t) -1) && errno == EINTR)
{
DBUG_PRINT("error", ("my_quick_read() was interrupted and returned %d"
". This function does not retry the read!",
@@ -40,20 +40,20 @@ uint my_quick_read(File Filedes,byte *Buffer,uint Count,myf MyFlags)
}
-uint my_quick_write(File Filedes,const byte *Buffer,uint Count)
+size_t my_quick_write(File Filedes,const uchar *Buffer,size_t Count)
{
#ifndef DBUG_OFF
- uint writtenbytes;
+ size_t writtenbytes;
#endif
if ((
#ifndef DBUG_OFF
writtenbytes =
#endif
- (uint) write(Filedes,Buffer,Count)) != Count)
+ write(Filedes,Buffer,Count)) != Count)
{
#ifndef DBUG_OFF
- if ((writtenbytes == 0 || (int) writtenbytes == -1) && errno == EINTR)
+ if ((writtenbytes == 0 || writtenbytes == (size_t) -1) && errno == EINTR)
{
DBUG_PRINT("error", ("my_quick_write() was interrupted and returned %d"
". This function does not retry the write!",
@@ -61,7 +61,7 @@ uint my_quick_write(File Filedes,const byte *Buffer,uint Count)
}
#endif
my_errno=errno;
- return (uint) -1;
+ return (size_t) -1;
}
return 0;
}
diff --git a/mysys/my_read.c b/mysys/my_read.c
index a6c45340b0c..f3e8a4b300e 100644
--- a/mysys/my_read.c
+++ b/mysys/my_read.c
@@ -33,43 +33,44 @@
N number of bytes read.
*/
-uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags)
+size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags)
{
- uint readbytes, save_count;
+ size_t readbytes, save_count;
DBUG_ENTER("my_read");
- DBUG_PRINT("my",("Fd: %d Buffer: 0x%lx Count: %u MyFlags: %d",
- Filedes, (long) Buffer, Count, MyFlags));
+ DBUG_PRINT("my",("Fd: %d Buffer: 0x%lx Count: %lu MyFlags: %d",
+ Filedes, (long) Buffer, (ulong) Count, MyFlags));
save_count= Count;
for (;;)
{
errno= 0; /* Linux doesn't reset this */
- if ((readbytes= (uint) read(Filedes, Buffer, Count)) != Count)
+ if ((readbytes= read(Filedes, Buffer, Count)) != Count)
{
my_errno= errno ? errno : -1;
- DBUG_PRINT("warning",("Read only %d bytes off %u from %d, errno: %d",
- (int) readbytes, Count, Filedes, my_errno));
+ DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d",
+ (int) readbytes, (ulong) Count, Filedes,
+ my_errno));
#ifdef THREAD
if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
{
- DBUG_PRINT("debug", ("my_read() was interrupted and returned %d",
- (int) readbytes));
+ DBUG_PRINT("debug", ("my_read() was interrupted and returned %ld",
+ (long) readbytes));
continue; /* Interrupted */
}
#endif
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{
- if ((int) readbytes == -1)
+ if (readbytes == (size_t) -1)
my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
my_filename(Filedes),my_errno);
else if (MyFlags & (MY_NABP | MY_FNABP))
my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
my_filename(Filedes),my_errno);
}
- if ((int) readbytes == -1 ||
+ if (readbytes == (size_t) -1 ||
((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO)))
DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
- if (readbytes > 0 && (MyFlags & MY_FULL_IO))
+ if (readbytes != (size_t) -1 && (MyFlags & MY_FULL_IO))
{
Buffer+= readbytes;
Count-= readbytes;
diff --git a/mysys/my_realloc.c b/mysys/my_realloc.c
index 43fbb0c1eee..c7cf1323cd4 100644
--- a/mysys/my_realloc.c
+++ b/mysys/my_realloc.c
@@ -22,12 +22,12 @@
/* My memory re allocator */
-gptr my_realloc(gptr oldpoint, uint size, myf my_flags)
+void* my_realloc(void* oldpoint, size_t size, myf my_flags)
{
- gptr point;
+ void *point;
DBUG_ENTER("my_realloc");
- DBUG_PRINT("my",("ptr: 0x%lx size: %u my_flags: %d", (long) oldpoint, size,
- my_flags));
+ DBUG_PRINT("my",("ptr: 0x%lx size: %lu my_flags: %d", (long) oldpoint,
+ (ulong) size, my_flags));
if (!oldpoint && (my_flags & MY_ALLOW_ZERO_PTR))
DBUG_RETURN(my_malloc(size,my_flags));
@@ -48,7 +48,7 @@ gptr my_realloc(gptr oldpoint, uint size, myf my_flags)
free(oldpoint);
}
#else
- if ((point = (char*)realloc(oldpoint,size)) == NULL)
+ if ((point= (uchar*) realloc(oldpoint,size)) == NULL)
{
if (my_flags & MY_FREE_ON_ERROR)
my_free(oldpoint, my_flags);
diff --git a/mysys/my_static.c b/mysys/my_static.c
index 42dd9d71490..f884838f40a 100644
--- a/mysys/my_static.c
+++ b/mysys/my_static.c
@@ -27,7 +27,7 @@
my_bool timed_mutexes= 0;
/* from my_init */
-my_string home_dir=0;
+char * home_dir=0;
const char *my_progname=0;
char NEAR curr_dir[FN_REFLEN]= {0},
NEAR home_dir_buff[FN_REFLEN]= {0};
@@ -77,8 +77,8 @@ uint sf_malloc_prehunc=0, /* If you have problem with core- */
ulong sf_malloc_cur_memory= 0L; /* Current memory usage */
ulong sf_malloc_max_memory= 0L; /* Maximum memory usage */
uint sf_malloc_count= 0; /* Number of times NEW() was called */
-byte *sf_min_adress= (byte*) ~(unsigned long) 0L,
- *sf_max_adress= (byte*) 0L;
+uchar *sf_min_adress= (uchar*) ~(unsigned long) 0L,
+ *sf_max_adress= (uchar*) 0L;
/* Root of the linked list of struct st_irem */
struct st_irem *sf_malloc_root = NULL;
diff --git a/mysys/my_static.h b/mysys/my_static.h
index b438c936225..66e6ea1c280 100644
--- a/mysys/my_static.h
+++ b/mysys/my_static.h
@@ -60,7 +60,7 @@ extern const char *soundex_map;
extern USED_MEM* my_once_root_block;
extern uint my_once_extra;
-extern byte *sf_min_adress,*sf_max_adress;
+extern uchar *sf_min_adress,*sf_max_adress;
extern uint sf_malloc_count;
extern struct st_irem *sf_malloc_root;
diff --git a/mysys/my_vle.c b/mysys/my_vle.c
index 18339c877df..09f297eb553 100644
--- a/mysys/my_vle.c
+++ b/mysys/my_vle.c
@@ -39,16 +39,16 @@
bytes. On failure, the 'out' pointer is returned.
*/
-byte*
-my_vle_encode(byte* out, my_size_t max, ulong n)
+uchar*
+my_vle_encode(uchar* out, size_t max, ulong n)
{
- byte buf[my_vle_sizeof(n)];
- byte *ptr= buf;
- my_size_t len;
+ uchar buf[my_vle_sizeof(n)];
+ uchar *ptr= buf;
+ size_t len;
do
{
- *ptr++= (byte) (n & 0x7F);
+ *ptr++= (uchar) (n & 0x7F);
n>>= 7;
}
while (n > 0);
@@ -64,7 +64,7 @@ my_vle_encode(byte* out, my_size_t max, ulong n)
*/
while (ptr-- > buf)
{
- byte v= *ptr;
+ uchar v= *ptr;
if (ptr > buf)
v|= 0x80;
*out++= v;
@@ -89,11 +89,11 @@ my_vle_encode(byte* out, my_size_t max, ulong n)
more than sizeof(*result_ptr) + 1 bytes.
*/
-byte const*
-my_vle_decode(ulong *result_ptr, byte const *vle)
+uchar const*
+my_vle_decode(ulong *result_ptr, uchar const *vle)
{
ulong result= 0;
- my_size_t cnt= 1;
+ size_t cnt= 1;
do
{
diff --git a/mysys/my_wincond.c b/mysys/my_wincond.c
index 353b2fced4e..d1b07b61408 100644
--- a/mysys/my_wincond.c
+++ b/mysys/my_wincond.c
@@ -201,7 +201,7 @@ int pthread_attr_setprio(pthread_attr_t *connect_att,int priority)
int pthread_attr_destroy(pthread_attr_t *connect_att)
{
- bzero((gptr) connect_att,sizeof(*connect_att));
+ bzero((uchar*) connect_att,sizeof(*connect_att));
return 0;
}
diff --git a/mysys/my_windac.c b/mysys/my_windac.c
index c711093b48f..f846853f7be 100644
--- a/mysys/my_windac.c
+++ b/mysys/my_windac.c
@@ -194,8 +194,8 @@ error:
FreeSid(everyone_sid);
if (htoken)
CloseHandle(htoken);
- my_free((gptr) sa, MYF(MY_ALLOW_ZERO_PTR));
- my_free((gptr) dacl, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) sa, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) dacl, MYF(MY_ALLOW_ZERO_PTR));
*psa= 0;
return 1;
}
@@ -215,8 +215,8 @@ void my_security_attr_free(SECURITY_ATTRIBUTES *sa)
My_security_attr *attr= (My_security_attr*)
(((char*)sa) + ALIGN_SIZE(sizeof(*sa)));
FreeSid(attr->everyone_sid);
- my_free((gptr) attr->dacl, MYF(0));
- my_free((gptr) sa, MYF(0));
+ my_free((uchar*) attr->dacl, MYF(0));
+ my_free((uchar*) sa, MYF(0));
}
}
diff --git a/mysys/my_write.c b/mysys/my_write.c
index 4c3d187e4e8..056a84f1794 100644
--- a/mysys/my_write.c
+++ b/mysys/my_write.c
@@ -20,28 +20,28 @@
/* Write a chunk of bytes to a file */
-uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags)
+size_t my_write(int Filedes, const uchar *Buffer, size_t Count, myf MyFlags)
{
- uint writenbytes,errors;
- ulong written;
+ size_t writenbytes, written;
+ uint errors;
DBUG_ENTER("my_write");
- DBUG_PRINT("my",("Fd: %d Buffer: 0x%lx Count: %d MyFlags: %d",
- Filedes, (long) Buffer, Count, MyFlags));
- errors=0; written=0L;
+ DBUG_PRINT("my",("Fd: %d Buffer: 0x%lx Count: %lu MyFlags: %d",
+ Filedes, (long) Buffer, (ulong) Count, MyFlags));
+ errors=0; written=0;
for (;;)
{
- if ((writenbytes = (uint) write(Filedes, Buffer, Count)) == Count)
+ if ((writenbytes= write(Filedes, Buffer, Count)) == Count)
break;
- if ((int) writenbytes != -1)
+ if (writenbytes != (size_t) -1)
{ /* Safeguard */
written+=writenbytes;
Buffer+=writenbytes;
Count-=writenbytes;
}
my_errno=errno;
- DBUG_PRINT("error",("Write only %d bytes, error: %d",
- writenbytes,my_errno));
+ DBUG_PRINT("error",("Write only %ld bytes, error: %d",
+ (long) writenbytes, my_errno));
#ifndef NO_BACKGROUND
#ifdef THREAD
if (my_thread_var->abort)
@@ -57,12 +57,12 @@ uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags)
continue;
}
- if ((writenbytes == 0 || (int) writenbytes == -1))
+ if ((writenbytes == 0 || writenbytes == (size_t) -1))
{
if (my_errno == EINTR)
{
- DBUG_PRINT("debug", ("my_write() was interrupted and returned %d",
- (int) writenbytes));
+ DBUG_PRINT("debug", ("my_write() was interrupted and returned %ld",
+ (long) writenbytes));
continue; /* Interrupted */
}
diff --git a/mysys/ptr_cmp.c b/mysys/ptr_cmp.c
index 4fdbad58aaf..24ab6a1ea9c 100644
--- a/mysys/ptr_cmp.c
+++ b/mysys/ptr_cmp.c
@@ -22,15 +22,15 @@
#include "mysys_priv.h"
#include <myisampack.h>
-static int ptr_compare(uint *compare_length, uchar **a, uchar **b);
-static int ptr_compare_0(uint *compare_length, uchar **a, uchar **b);
-static int ptr_compare_1(uint *compare_length, uchar **a, uchar **b);
-static int ptr_compare_2(uint *compare_length, uchar **a, uchar **b);
-static int ptr_compare_3(uint *compare_length, uchar **a, uchar **b);
+static int ptr_compare(size_t *compare_length, uchar **a, uchar **b);
+static int ptr_compare_0(size_t *compare_length, uchar **a, uchar **b);
+static int ptr_compare_1(size_t *compare_length, uchar **a, uchar **b);
+static int ptr_compare_2(size_t *compare_length, uchar **a, uchar **b);
+static int ptr_compare_3(size_t *compare_length, uchar **a, uchar **b);
/* Get a pointer to a optimal byte-compare function for a given size */
-qsort2_cmp get_ptr_compare (uint size)
+qsort2_cmp get_ptr_compare (size_t size)
{
if (size < 4)
return (qsort2_cmp) ptr_compare;
@@ -51,7 +51,7 @@ qsort2_cmp get_ptr_compare (uint size)
#define cmp(N) if (first[N] != last[N]) return (int) first[N] - (int) last[N]
-static int ptr_compare(uint *compare_length, uchar **a, uchar **b)
+static int ptr_compare(size_t *compare_length, uchar **a, uchar **b)
{
reg3 int length= *compare_length;
reg1 uchar *first,*last;
@@ -66,7 +66,7 @@ static int ptr_compare(uint *compare_length, uchar **a, uchar **b)
}
-static int ptr_compare_0(uint *compare_length,uchar **a, uchar **b)
+static int ptr_compare_0(size_t *compare_length,uchar **a, uchar **b)
{
reg3 int length= *compare_length;
reg1 uchar *first,*last;
@@ -87,7 +87,7 @@ static int ptr_compare_0(uint *compare_length,uchar **a, uchar **b)
}
-static int ptr_compare_1(uint *compare_length,uchar **a, uchar **b)
+static int ptr_compare_1(size_t *compare_length,uchar **a, uchar **b)
{
reg3 int length= *compare_length-1;
reg1 uchar *first,*last;
@@ -108,7 +108,7 @@ static int ptr_compare_1(uint *compare_length,uchar **a, uchar **b)
return (0);
}
-static int ptr_compare_2(uint *compare_length,uchar **a, uchar **b)
+static int ptr_compare_2(size_t *compare_length,uchar **a, uchar **b)
{
reg3 int length= *compare_length-2;
reg1 uchar *first,*last;
@@ -130,7 +130,7 @@ static int ptr_compare_2(uint *compare_length,uchar **a, uchar **b)
return (0);
}
-static int ptr_compare_3(uint *compare_length,uchar **a, uchar **b)
+static int ptr_compare_3(size_t *compare_length,uchar **a, uchar **b)
{
reg3 int length= *compare_length-3;
reg1 uchar *first,*last;
@@ -153,7 +153,7 @@ static int ptr_compare_3(uint *compare_length,uchar **a, uchar **b)
return (0);
}
-void my_store_ptr(byte *buff, uint pack_length, my_off_t pos)
+void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos)
{
switch (pack_length) {
#if SIZEOF_OFF_T > 4
@@ -171,7 +171,7 @@ void my_store_ptr(byte *buff, uint pack_length, my_off_t pos)
return;
}
-my_off_t my_get_ptr(byte *ptr, uint pack_length)
+my_off_t my_get_ptr(uchar *ptr, size_t pack_length)
{
my_off_t pos;
switch (pack_length) {
diff --git a/mysys/queues.c b/mysys/queues.c
index 5970922284f..d8a7ca19bee 100644
--- a/mysys/queues.c
+++ b/mysys/queues.c
@@ -49,11 +49,11 @@
*/
int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
- pbool max_at_top, int (*compare) (void *, byte *, byte *),
+ pbool max_at_top, int (*compare) (void *, uchar *, uchar *),
void *first_cmp_arg)
{
DBUG_ENTER("init_queue");
- if ((queue->root= (byte **) my_malloc((max_elements+1)*sizeof(void*),
+ if ((queue->root= (uchar **) my_malloc((max_elements+1)*sizeof(void*),
MYF(MY_WME))) == 0)
DBUG_RETURN(1);
queue->elements=0;
@@ -92,7 +92,7 @@ int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
*/
int init_queue_ex(QUEUE *queue, uint max_elements, uint offset_to_key,
- pbool max_at_top, int (*compare) (void *, byte *, byte *),
+ pbool max_at_top, int (*compare) (void *, uchar *, uchar *),
void *first_cmp_arg, uint auto_extent)
{
int ret;
@@ -129,7 +129,7 @@ int init_queue_ex(QUEUE *queue, uint max_elements, uint offset_to_key,
*/
int reinit_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
- pbool max_at_top, int (*compare) (void *, byte *, byte *),
+ pbool max_at_top, int (*compare) (void *, uchar *, uchar *),
void *first_cmp_arg)
{
DBUG_ENTER("reinit_queue");
@@ -162,11 +162,11 @@ int reinit_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
int resize_queue(QUEUE *queue, uint max_elements)
{
- byte **new_root;
+ uchar **new_root;
DBUG_ENTER("resize_queue");
if (queue->max_elements == max_elements)
DBUG_RETURN(0);
- if ((new_root= (byte **) my_realloc((void *)queue->root,
+ if ((new_root= (uchar **) my_realloc((void *)queue->root,
(max_elements+1)*sizeof(void*),
MYF(MY_WME))) == 0)
DBUG_RETURN(1);
@@ -196,7 +196,7 @@ void delete_queue(QUEUE *queue)
DBUG_ENTER("delete_queue");
if (queue->root)
{
- my_free((gptr) queue->root,MYF(0));
+ my_free((uchar*) queue->root,MYF(0));
queue->root=0;
}
DBUG_VOID_RETURN;
@@ -205,7 +205,7 @@ void delete_queue(QUEUE *queue)
/* Code for insert, search and delete of elements */
-void queue_insert(register QUEUE *queue, byte *element)
+void queue_insert(register QUEUE *queue, uchar *element)
{
reg2 uint idx, next;
int cmp;
@@ -234,7 +234,7 @@ void queue_insert(register QUEUE *queue, byte *element)
*/
-int queue_insert_safe(register QUEUE *queue, byte *element)
+int queue_insert_safe(register QUEUE *queue, uchar *element)
{
if (queue->elements == queue->max_elements)
@@ -253,9 +253,9 @@ int queue_insert_safe(register QUEUE *queue, byte *element)
/* Remove item from queue */
/* Returns pointer to removed element */
-byte *queue_remove(register QUEUE *queue, uint idx)
+uchar *queue_remove(register QUEUE *queue, uint idx)
{
- byte *element;
+ uchar *element;
DBUG_ASSERT(idx < queue->max_elements);
element= queue->root[++idx]; /* Intern index starts from 1 */
queue->root[idx]= queue->root[queue->elements--];
@@ -276,7 +276,7 @@ void queue_replaced(QUEUE *queue)
void _downheap(register QUEUE *queue, uint idx)
{
- byte *element;
+ uchar *element;
uint elements,half_queue,offset_to_key, next_index;
bool first= TRUE;
uint start_idx= idx;
@@ -332,7 +332,7 @@ void _downheap(register QUEUE *queue, uint idx)
/* Fix heap when index have changed */
void _downheap(register QUEUE *queue, uint idx)
{
- byte *element;
+ uchar *element;
uint elements,half_queue,next_index,offset_to_key;
int cmp;
@@ -483,7 +483,7 @@ void calculate_end_next(uint part)
}
return;
}
-static int test_compare(void *null_arg, byte *a, byte *b)
+static int test_compare(void *null_arg, uchar *a, uchar *b)
{
uint a_num= (*(uint*)a) & 0x3FFFFF;
uint b_num= (*(uint*)b) & 0x3FFFFF;
@@ -541,9 +541,9 @@ void perform_insert(QUEUE *queue)
}
num_array[i]= num + (i << 22);
if (fix_used)
- queue_element(queue, i-1)= (byte*)&num_array[i];
+ queue_element(queue, i-1)= (uchar*)&num_array[i];
else
- queue_insert(queue, (byte*)&num_array[i]);
+ queue_insert(queue, (uchar*)&num_array[i]);
} while (++i <= no_parts);
if (fix_used)
{
@@ -573,7 +573,7 @@ bool perform_ins_del(QUEUE *queue, bool max_ind)
num_array[part]-= part;
else
num_array[part]+= part;
- queue_top(queue)= (byte*)&num_array[part];
+ queue_top(queue)= (uchar*)&num_array[part];
queue_replaced(queue);
}
} while (++i < no_loops);
@@ -665,7 +665,7 @@ static void benchmark_test()
num+= 16;
part= num >> 22;
num_array[part]= num;
- queue_top(queue)= (byte*)&num_array[part];
+ queue_top(queue)= (uchar*)&num_array[part];
queue_replaced(queue);
}
for (i= 0; i < 16; i++)
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index f2a4c280610..30c501c54ee 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -82,7 +82,7 @@ static int sf_malloc_tampered= 0;
/* Static functions prototypes */
-static int check_ptr(const char *where, byte *ptr, const char *sFile,
+static int check_ptr(const char *where, uchar *ptr, const char *sFile,
uint uLine);
static int _checkchunk(struct st_irem *pRec, const char *sFile, uint uLine);
@@ -119,12 +119,12 @@ static int _checkchunk(struct st_irem *pRec, const char *sFile, uint uLine);
/* Allocate some memory. */
-gptr _mymalloc(uint size, const char *filename, uint lineno, myf MyFlags)
+void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
{
struct st_irem *irem;
- char *data;
+ uchar *data;
DBUG_ENTER("_mymalloc");
- DBUG_PRINT("enter",("Size: %u",size));
+ DBUG_PRINT("enter",("Size: %lu", (ulong) size));
if (!sf_malloc_quick)
(void) _sanity (filename, lineno);
@@ -151,8 +151,8 @@ gptr _mymalloc(uint size, const char *filename, uint lineno, myf MyFlags)
my_errno=errno;
sprintf(buff,"Out of memory at line %d, '%s'", lineno, filename);
my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH));
- sprintf(buff,"needed %d byte (%ldk), memory in use: %ld bytes (%ldk)",
- size, (size + 1023L) / 1024L,
+ sprintf(buff,"needed %u byte (%ldk), memory in use: %ld bytes (%ldk)",
+ (uint) size, (uint) (size + 1023L) / 1024L,
sf_malloc_max_memory, (sf_malloc_max_memory + 1023L) / 1024L);
my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH));
}
@@ -160,18 +160,18 @@ gptr _mymalloc(uint size, const char *filename, uint lineno, myf MyFlags)
sf_malloc_max_memory,lineno, filename));
if (MyFlags & MY_FAE)
exit(1);
- DBUG_RETURN ((gptr) 0);
+ DBUG_RETURN ((void*) 0);
}
/* Fill up the structure */
- data= (((char*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) +
+ data= (((uchar*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) +
sf_malloc_prehunc);
*((uint32*) (data-sizeof(uint32)))= MAGICKEY;
data[size + 0]= MAGICEND0;
data[size + 1]= MAGICEND1;
data[size + 2]= MAGICEND2;
data[size + 3]= MAGICEND3;
- irem->filename= (my_string) filename;
+ irem->filename= (char *) filename;
irem->linenum= lineno;
irem->datasize= size;
irem->prev= NULL;
@@ -198,7 +198,7 @@ gptr _mymalloc(uint size, const char *filename, uint lineno, myf MyFlags)
sf_min_adress= data;
if (sf_max_adress < data)
sf_max_adress= data;
- DBUG_RETURN ((gptr) data);
+ DBUG_RETURN((void*) data);
}
@@ -207,8 +207,8 @@ gptr _mymalloc(uint size, const char *filename, uint lineno, myf MyFlags)
Free then old memoryblock
*/
-gptr _myrealloc(register gptr ptr, register uint size,
- const char *filename, uint lineno, myf MyFlags)
+void *_myrealloc(register void *ptr, register size_t size,
+ const char *filename, uint lineno, myf MyFlags)
{
struct st_irem *irem;
char *data;
@@ -220,8 +220,8 @@ gptr _myrealloc(register gptr ptr, register uint size,
if (!sf_malloc_quick)
(void) _sanity (filename, lineno);
- if (check_ptr("Reallocating", (byte*) ptr, filename, lineno))
- DBUG_RETURN((gptr) NULL);
+ if (check_ptr("Reallocating", (uchar*) ptr, filename, lineno))
+ DBUG_RETURN((uchar*) NULL);
irem= (struct st_irem *) (((char*) ptr) - ALIGN_SIZE(sizeof(struct st_irem))-
sf_malloc_prehunc);
@@ -232,13 +232,13 @@ gptr _myrealloc(register gptr ptr, register uint size,
DBUG_PRINT("safe",("Reallocating unallocated data at line %d, '%s'",
lineno, filename));
(void) fflush(stderr);
- DBUG_RETURN((gptr) NULL);
+ DBUG_RETURN((uchar*) NULL);
}
if ((data= _mymalloc(size,filename,lineno,MyFlags))) /* Allocate new area */
{
size=min(size, irem->datasize); /* Move as much as possibly */
- memcpy((byte*) data, ptr, (size_t) size); /* Copy old data */
+ memcpy((uchar*) data, ptr, (size_t) size); /* Copy old data */
_myfree(ptr, filename, lineno, 0); /* Free not needed area */
}
else
@@ -254,7 +254,7 @@ gptr _myrealloc(register gptr ptr, register uint size,
/* Deallocate some memory. */
-void _myfree(gptr ptr, const char *filename, uint lineno, myf myflags)
+void _myfree(void *ptr, const char *filename, uint lineno, myf myflags)
{
struct st_irem *irem;
DBUG_ENTER("_myfree");
@@ -264,7 +264,7 @@ void _myfree(gptr ptr, const char *filename, uint lineno, myf myflags)
(void) _sanity (filename, lineno);
if ((!ptr && (myflags & MY_ALLOW_ZERO_PTR)) ||
- check_ptr("Freeing",(byte*) ptr,filename,lineno))
+ check_ptr("Freeing",(uchar*) ptr,filename,lineno))
DBUG_VOID_RETURN;
/* Calculate the address of the remember structure */
@@ -316,7 +316,7 @@ void _myfree(gptr ptr, const char *filename, uint lineno, myf myflags)
/* Check if we have a wrong pointer */
-static int check_ptr(const char *where, byte *ptr, const char *filename,
+static int check_ptr(const char *where, uchar *ptr, const char *filename,
uint lineno)
{
if (!ptr)
@@ -503,12 +503,12 @@ int _sanity(const char *filename, uint lineno)
/* malloc and copy */
-gptr _my_memdup(const byte *from, uint length, const char *filename,
- uint lineno, myf MyFlags)
+void *_my_memdup(const void *from, size_t length, const char *filename,
+ uint lineno, myf MyFlags)
{
- gptr ptr;
- if ((ptr=_mymalloc(length,filename,lineno,MyFlags)) != 0)
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
+ void *ptr;
+ if ((ptr= _mymalloc(length,filename,lineno,MyFlags)) != 0)
+ memcpy(ptr, from, length);
return(ptr);
} /*_my_memdup */
@@ -516,23 +516,23 @@ gptr _my_memdup(const byte *from, uint length, const char *filename,
char *_my_strdup(const char *from, const char *filename, uint lineno,
myf MyFlags)
{
- gptr ptr;
- uint length=(uint) strlen(from)+1;
- if ((ptr=_mymalloc(length,filename,lineno,MyFlags)) != 0)
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
- return((char*) ptr);
+ char *ptr;
+ size_t length= strlen(from)+1;
+ if ((ptr= (char*) _mymalloc(length,filename,lineno,MyFlags)) != 0)
+ memcpy((uchar*) ptr, (uchar*) from, (size_t) length);
+ return(ptr);
} /* _my_strdup */
-char *_my_strndup(const char *from, uint length,
- const char *filename, uint lineno,
- myf MyFlags)
+char *_my_strndup(const char *from, size_t length,
+ const char *filename, uint lineno,
+ myf MyFlags)
{
- gptr ptr;
- if ((ptr=_mymalloc(length+1,filename,lineno,MyFlags)) != 0)
+ char *ptr;
+ if ((ptr= (char*) _mymalloc(length+1,filename,lineno,MyFlags)) != 0)
{
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
+ memcpy((uchar*) ptr, (uchar*) from, (size_t) length);
ptr[length]=0;
}
- return((char *) ptr);
+ return(ptr);
}
diff --git a/mysys/string.c b/mysys/string.c
index e1ff9ec8c26..b234a589406 100644
--- a/mysys/string.c
+++ b/mysys/string.c
@@ -23,7 +23,7 @@
#include <m_string.h>
my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
- uint init_alloc, uint alloc_increment)
+ size_t init_alloc, size_t alloc_increment)
{
uint length;
DBUG_ENTER("init_dynamic_string");
@@ -31,7 +31,7 @@ my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
if (!alloc_increment)
alloc_increment=128;
length=1;
- if (init_str && (length= (uint) strlen(init_str)+1) < init_alloc)
+ if (init_str && (length= strlen(init_str)+1) < init_alloc)
init_alloc=((length+alloc_increment-1)/alloc_increment)*alloc_increment;
if (!init_alloc)
init_alloc=alloc_increment;
@@ -72,7 +72,7 @@ my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str)
}
-my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size)
+my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size)
{
DBUG_ENTER("dynstr_realloc");
@@ -95,7 +95,7 @@ my_bool dynstr_append(DYNAMIC_STRING *str, const char *append)
my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
- uint length)
+ size_t length)
{
char *new_ptr;
if (str->length+length >= str->max_length)
@@ -114,26 +114,30 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
return FALSE;
}
-my_bool dynstr_trunc(DYNAMIC_STRING *str, int n)
+
+my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n)
{
str->length-=n;
str->str[str->length]= '\0';
return FALSE;
}
-/** Concatenates any number of strings, escapes any OS quote in the result then
- * surround the whole affair in another set of quotes which is finally appended
- * to specified DYNAMIC_STRING. This function is especially useful when
- * building strings to be executed with the system() function.
- * @param str Dynamic String which will have addtional strings appended.
- * @param append String to be appended.
- * @param ... Optional. Additional string(s) to be appended.
- *
- * @note The final argument in the list must be NullS even if no additional
- * options are passed.
- *
- * @return True = Success.
- */
+/*
+ Concatenates any number of strings, escapes any OS quote in the result then
+ surround the whole affair in another set of quotes which is finally appended
+ to specified DYNAMIC_STRING. This function is especially useful when
+ building strings to be executed with the system() function.
+
+ @param str Dynamic String which will have addtional strings appended.
+ @param append String to be appended.
+ @param ... Optional. Additional string(s) to be appended.
+
+ @note The final argument in the list must be NullS even if no additional
+ options are passed.
+
+ @return True = Success.
+*/
+
my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...)
{
#ifdef __WIN__
diff --git a/mysys/testhash.c b/mysys/testhash.c
index 0961558afd3..2add2ebd2d7 100644
--- a/mysys/testhash.c
+++ b/mysys/testhash.c
@@ -38,11 +38,11 @@ my_bool hash_check(HASH *hash);
void free_record(void *record);
-static byte *hash2_key(const byte *rec,uint *length,
+static uchar *hash2_key(const uchar *rec,uint *length,
my_bool not_used __attribute__((unused)))
{
*length=(uint) (uchar) rec[reclength-1];
- return (byte*) rec;
+ return (uchar*) rec;
}
/* main program */
@@ -196,7 +196,7 @@ static int do_test()
pos=0;
while ((recpos=hash_element(&hash,0)))
{
- record=(byte*) my_malloc(reclength,MYF(MY_FAE));
+ record=(uchar*) my_malloc(reclength,MYF(MY_FAE));
memcpy(record,recpos,reclength);
record[reclength-1]=rnd(5)+1;
if (my_hash_insert(&hash2,record))
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index 471ec0ab10d..81093be3678 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -60,7 +60,7 @@ static void *alarm_handler(void *arg);
static sig_handler thread_alarm(int sig __attribute__((unused)));
static int compare_ulong(void *not_used __attribute__((unused)),
- byte *a_ptr,byte* b_ptr)
+ uchar *a_ptr,uchar* b_ptr)
{
ulong a=*((ulong*) a_ptr),b= *((ulong*) b_ptr);
return (a < b) ? -1 : (a == b) ? 0 : 1;
@@ -205,7 +205,7 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
alarm_data->alarmed=0;
alarm_data->thread= current_my_thread_var->pthread_self;
alarm_data->thread_id= current_my_thread_var->id;
- queue_insert(&alarm_queue,(byte*) alarm_data);
+ queue_insert(&alarm_queue,(uchar*) alarm_data);
/* Reschedule alarm if the current one has more than sec left */
if (reschedule)
@@ -237,14 +237,14 @@ void thr_end_alarm(thr_alarm_t *alarmed)
pthread_sigmask(SIG_BLOCK,&full_signal_set,&old_mask);
pthread_mutex_lock(&LOCK_alarm);
- alarm_data= (ALARM*) ((byte*) *alarmed - offsetof(ALARM,alarmed));
+ alarm_data= (ALARM*) ((uchar*) *alarmed - offsetof(ALARM,alarmed));
for (i=0 ; i < alarm_queue.elements ; i++)
{
if ((ALARM*) queue_element(&alarm_queue,i) == alarm_data)
{
queue_remove(&alarm_queue,i),MYF(0);
if (alarm_data->malloced)
- my_free((gptr) alarm_data,MYF(0));
+ my_free((uchar*) alarm_data,MYF(0));
found++;
#ifdef DBUG_OFF
break;
@@ -464,7 +464,7 @@ void thr_alarm_kill(my_thread_id thread_id)
{
ALARM *tmp=(ALARM*) queue_remove(&alarm_queue,i);
tmp->expire_time=0;
- queue_insert(&alarm_queue,(byte*) tmp);
+ queue_insert(&alarm_queue,(uchar*) tmp);
reschedule_alarms();
break;
}
@@ -755,7 +755,7 @@ static void *test_thread(void *arg)
thread_count--;
VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
pthread_mutex_unlock(&LOCK_thread_count);
- free((gptr) arg);
+ free((uchar*) arg);
return 0;
}
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index 94c34eef2fa..20edffb49c2 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -899,7 +899,7 @@ end:
*/
-#define LOCK_CMP(A,B) ((byte*) (A->lock) - (uint) ((A)->type) < (byte*) (B->lock)- (uint) ((B)->type))
+#define LOCK_CMP(A,B) ((uchar*) (A->lock) - (uint) ((A)->type) < (uchar*) (B->lock)- (uint) ((B)->type))
static void sort_locks(THR_LOCK_DATA **data,uint count)
{
@@ -1600,7 +1600,7 @@ static void *test_thread(void *arg)
thread_count--;
VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
pthread_mutex_unlock(&LOCK_thread_count);
- free((gptr) arg);
+ free((uchar*) arg);
return 0;
}
diff --git a/mysys/tree.c b/mysys/tree.c
index 2e6868e0777..ef33f75b7c6 100644
--- a/mysys/tree.c
+++ b/mysys/tree.c
@@ -93,7 +93,7 @@ void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit,
if (default_alloc_size < DEFAULT_ALLOC_SIZE)
default_alloc_size= DEFAULT_ALLOC_SIZE;
default_alloc_size= MY_ALIGN(default_alloc_size, DEFAULT_ALIGN_SIZE);
- bzero((gptr) &tree->null_element,sizeof(tree->null_element));
+ bzero((uchar*) &tree->null_element,sizeof(tree->null_element));
tree->root= &tree->null_element;
tree->compare=compare;
tree->size_of_element=size > 0 ? (uint) size : 0;
@@ -247,12 +247,12 @@ TREE_ELEMENT *tree_insert(TREE *tree, void *key, uint key_size,
else
{
*((void**) (element+1))= (void*) ((void **) (element+1)+1);
- memcpy((byte*) *((void **) (element+1)),key,
+ memcpy((uchar*) *((void **) (element+1)),key,
(size_t) (key_size-sizeof(void*)));
}
}
else
- memcpy((byte*) element+tree->offset_to_key,key,(size_t) key_size);
+ memcpy((uchar*) element+tree->offset_to_key,key,(size_t) key_size);
element->count=1; /* May give warning in purify */
tree->elements_in_tree++;
rb_insert(tree,parent,element); /* rebalance tree */
@@ -326,7 +326,7 @@ int tree_delete(TREE *tree, void *key, uint key_size, void *custom_arg)
if (tree->free)
(*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg);
tree->allocated-= sizeof(TREE_ELEMENT) + tree->size_of_element + key_size;
- my_free((gptr) element,MYF(0));
+ my_free((uchar*) element,MYF(0));
tree->elements_in_tree--;
return 0;
}
diff --git a/mysys/trie.c b/mysys/trie.c
index 8daa6f3e661..5738b9b866b 100644
--- a/mysys/trie.c
+++ b/mysys/trie.c
@@ -101,7 +101,7 @@ void trie_free (TRIE *trie)
/*
SYNOPSIS
- my_bool trie_insert (TRIE *trie, const byte *key, uint keylen);
+ my_bool trie_insert (TRIE *trie, const uchar *key, uint keylen);
trie - valid pointer to `TRIE'
key - valid pointer to key to insert
keylen - non-0 key length
@@ -118,11 +118,11 @@ void trie_free (TRIE *trie)
However it can be freed with trie_free().
*/
-my_bool trie_insert (TRIE *trie, const byte *key, uint keylen)
+my_bool trie_insert (TRIE *trie, const uchar *key, uint keylen)
{
TRIE_NODE *node;
TRIE_NODE *next;
- byte p;
+ uchar p;
uint k;
DBUG_ENTER("trie_insert");
DBUG_ASSERT(trie && key && keylen);
@@ -211,7 +211,7 @@ my_bool ac_trie_prepare (TRIE *trie)
fail= fail->fail;
}
}
- my_free((gptr)tmp_nodes, MYF(0));
+ my_free((uchar*)tmp_nodes, MYF(0));
DBUG_RETURN(FALSE);
}
diff --git a/mysys/typelib.c b/mysys/typelib.c
index a3b669d2e54..2590ca6a03f 100644
--- a/mysys/typelib.c
+++ b/mysys/typelib.c
@@ -25,7 +25,7 @@ int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option)
int res;
const char **ptr;
- if ((res= find_type((my_string) x, typelib, 2)) <= 0)
+ if ((res= find_type((char *) x, typelib, 2)) <= 0)
{
ptr= typelib->type_names;
if (!*x)
@@ -64,10 +64,11 @@ int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option)
>0 Offset+1 in typelib for matched string
*/
+
int find_type(char *x, const TYPELIB *typelib, uint full_name)
{
int find,pos,findpos;
- reg1 my_string i;
+ reg1 char * i;
reg2 const char *j;
DBUG_ENTER("find_type");
DBUG_PRINT("enter",("x: '%s' lib: 0x%lx", x, (long) typelib));
@@ -119,7 +120,7 @@ int find_type(char *x, const TYPELIB *typelib, uint full_name)
/* Get name of type nr 'nr' */
/* Warning first type is 1, 0 = empty field */
-void make_type(register my_string to, register uint nr,
+void make_type(register char * to, register uint nr,
register TYPELIB *typelib)
{
DBUG_ENTER("make_type");
diff --git a/plugin/daemon_example/daemon_example.cc b/plugin/daemon_example/daemon_example.cc
index 994c385796e..af585bb4302 100644
--- a/plugin/daemon_example/daemon_example.cc
+++ b/plugin/daemon_example/daemon_example.cc
@@ -60,7 +60,7 @@ pthread_handler_t mysql_heartbeat(void *p)
tm_tmp.tm_hour,
tm_tmp.tm_min,
tm_tmp.tm_sec);
- my_write(con->heartbeat_file, buffer, strlen(buffer), MYF(0));
+ my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0));
x++;
}
@@ -114,7 +114,7 @@ static int daemon_example_plugin_init(void *p)
tm_tmp.tm_hour,
tm_tmp.tm_min,
tm_tmp.tm_sec);
- my_write(con->heartbeat_file, buffer, strlen(buffer), MYF(0));
+ my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0));
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr,
@@ -168,7 +168,7 @@ static int daemon_example_plugin_deinit(void *p)
tm_tmp.tm_hour,
tm_tmp.tm_min,
tm_tmp.tm_sec);
- my_write(con->heartbeat_file, buffer, strlen(buffer), MYF(0));
+ my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0));
my_close(con->heartbeat_file, MYF(0));
my_free((char *)con, MYF(0));
diff --git a/regex/reginit.c b/regex/reginit.c
index f0b53e64be3..8347c4f6895 100644
--- a/regex/reginit.c
+++ b/regex/reginit.c
@@ -16,7 +16,7 @@ void my_regex_init(CHARSET_INFO *cs)
if (!regex_inited)
{
regex_inited=1;
- bzero((gptr) &count,sizeof(count));
+ bzero((uchar*) &count,sizeof(count));
for (i=1 ; i<= 255; i++)
{
diff --git a/server-tools/instance-manager/buffer.cc b/server-tools/instance-manager/buffer.cc
index 67be2382523..1c50b11609e 100644
--- a/server-tools/instance-manager/buffer.cc
+++ b/server-tools/instance-manager/buffer.cc
@@ -44,12 +44,12 @@ const uint Buffer::MAX_BUFFER_SIZE= 16777216;
1 - got an error in reserve()
*/
-int Buffer::append(uint position, const char *string, uint len_arg)
+int Buffer::append(size_t position, const char *string, size_t len_arg)
{
if (reserve(position, len_arg))
return 1;
- strnmov(buffer + position, string, len_arg);
+ strnmov((char*) buffer + position, string, len_arg);
return 0;
}
@@ -75,20 +75,20 @@ int Buffer::append(uint position, const char *string, uint len_arg)
1 - realloc error or we have come to the 16Mb barrier
*/
-int Buffer::reserve(uint position, uint len_arg)
+int Buffer::reserve(size_t position, size_t len_arg)
{
if (position + len_arg >= MAX_BUFFER_SIZE)
goto err;
if (position + len_arg >= buffer_size)
{
- buffer= (char*) my_realloc(buffer,
+ buffer= (uchar*) my_realloc(buffer,
min(MAX_BUFFER_SIZE,
max((uint) (buffer_size*1.5),
position + len_arg)), MYF(0));
if (!(buffer))
goto err;
- buffer_size= (uint) (buffer_size*1.5);
+ buffer_size= (size_t) (buffer_size*1.5);
}
return 0;
diff --git a/server-tools/instance-manager/buffer.h b/server-tools/instance-manager/buffer.h
index a551dd98a25..3bd7a714437 100644
--- a/server-tools/instance-manager/buffer.h
+++ b/server-tools/instance-manager/buffer.h
@@ -45,7 +45,7 @@ public:
/*
As append() will invokes realloc() anyway, it's ok if malloc returns 0
*/
- if (!(buffer= (char*) my_malloc(buffer_size, MYF(0))))
+ if (!(buffer= (uchar*) my_malloc(buffer_size, MYF(0))))
buffer_size= 0;
}
@@ -55,11 +55,11 @@ public:
}
public:
- char *buffer;
+ uchar *buffer;
int get_size();
int is_error();
- int append(uint position, const char *string, uint len_arg);
- int reserve(uint position, uint len_arg);
+ int append(size_t position, const char *string, size_t len_arg);
+ int reserve(size_t position, size_t len_arg);
};
#endif /* INCLUDES_MYSQL_INSTANCE_MANAGER_BUFFER_H */
diff --git a/server-tools/instance-manager/commands.cc b/server-tools/instance-manager/commands.cc
index 393aceadca9..56bd720b3e9 100644
--- a/server-tools/instance-manager/commands.cc
+++ b/server-tools/instance-manager/commands.cc
@@ -170,7 +170,7 @@ int Show_instances::write_data(st_net *net)
while ((instance= iterator.next()))
{
Buffer send_buf; /* buffer for packets */
- uint pos= 0;
+ size_t pos= 0;
instance->lock();
@@ -356,7 +356,7 @@ int Show_instance_status::write_data(st_net *net, Instance *instance)
{
Buffer send_buf; /* buffer for packets */
char version_num_buf[MAX_VERSION_LENGTH];
- uint pos= 0;
+ size_t pos= 0;
const char *state_name= instance->get_state_name();
const char *version_tag= "unknown";
@@ -379,7 +379,7 @@ int Show_instance_status::write_data(st_net *net, Instance *instance)
store_to_protocol_packet(&send_buf, version_num, &pos) ||
store_to_protocol_packet(&send_buf, version_tag, &pos) ||
store_to_protocol_packet(&send_buf, mysqld_compatible_status, &pos) ||
- my_net_write(net, send_buf.buffer, (uint) pos))
+ my_net_write(net, send_buf.buffer, pos))
{
return ER_OUT_OF_RESOURCES;
}
@@ -455,7 +455,7 @@ int Show_instance_options::write_header(st_net *net)
int Show_instance_options::write_data(st_net *net, Instance *instance)
{
Buffer send_buff; /* buffer for packets */
- uint pos= 0;
+ size_t pos= 0;
if (store_to_protocol_packet(&send_buff, "instance_name", &pos) ||
store_to_protocol_packet(&send_buff, get_instance_name()->str, &pos) ||
@@ -618,7 +618,7 @@ bool Create_instance::init(const char **text)
bool Create_instance::parse_args(const char **text)
{
- uint len;
+ size_t len;
/* Check if we have something (and trim leading spaces). */
@@ -991,13 +991,13 @@ int Show_instance_log::write_header(st_net *net)
int Show_instance_log::write_data(st_net *net, Instance *instance)
{
Buffer send_buff; /* buffer for packets */
- uint pos= 0;
+ size_t pos= 0;
const char *logpath= instance->options.logs[log_type];
File fd;
size_t buff_size;
- int read_len;
+ size_t read_len;
MY_STAT file_stat;
Buffer read_buff;
@@ -1020,8 +1020,8 @@ int Show_instance_log::write_data(st_net *net, Instance *instance)
/* read in one chunk */
read_len= (int)my_seek(fd, file_stat.st_size - size, MY_SEEK_SET, MYF(0));
- if ((read_len= my_read(fd, (byte*) read_buff.buffer,
- buff_size, MYF(0))) < 0)
+ if ((read_len= my_read(fd, read_buff.buffer, buff_size, MYF(0))) ==
+ MY_FILE_ERROR)
{
close(fd);
return ER_READ_FILE;
@@ -1029,7 +1029,8 @@ int Show_instance_log::write_data(st_net *net, Instance *instance)
close(fd);
- if (store_to_protocol_packet(&send_buff, read_buff.buffer, &pos, read_len) ||
+ if (store_to_protocol_packet(&send_buff, (char*) read_buff.buffer, &pos,
+ read_len) ||
my_net_write(net, send_buff.buffer, pos))
{
return ER_OUT_OF_RESOURCES;
@@ -1142,7 +1143,7 @@ int Show_instance_log_files::write_data(st_net *net, Instance *instance)
enum { LOG_NAME_BUFFER_SIZE= 20 };
char buff[LOG_NAME_BUFFER_SIZE];
- uint pos= 0;
+ size_t pos= 0;
const char *log_path= "";
const char *log_size= "0";
@@ -1227,12 +1228,12 @@ bool Instance_options_list::init()
C_MODE_START
-static byte* get_item_key(const byte* item, uint* len,
- my_bool __attribute__((unused)) t)
+static uchar* get_item_key(const uchar* item, size_t* len,
+ my_bool __attribute__((unused)) t)
{
const Instance_options_list *lst= (const Instance_options_list *) item;
*len= lst->get_instance_name()->length;
- return (byte *) lst->get_instance_name()->str;
+ return (uchar *) lst->get_instance_name()->str;
}
static void delete_item(void *item)
@@ -1358,7 +1359,7 @@ Abstract_option_cmd::get_instance_options_list(const LEX_STRING *instance_name)
{
Instance_options_list *lst=
(Instance_options_list *) hash_search(&instance_options_map,
- (byte *) instance_name->str,
+ (uchar *) instance_name->str,
instance_name->length);
if (!lst)
@@ -1368,7 +1369,7 @@ Abstract_option_cmd::get_instance_options_list(const LEX_STRING *instance_name)
if (!lst)
return NULL;
- if (lst->init() || my_hash_insert(&instance_options_map, (byte *) lst))
+ if (lst->init() || my_hash_insert(&instance_options_map, (uchar *) lst))
{
delete lst;
return NULL;
@@ -1458,7 +1459,7 @@ int Abstract_option_cmd::execute_impl(st_net *net, ulong connection_id)
bool Set_option::parse_args(const char **text)
{
- uint len;
+ size_t len;
/* Check if we have something (and trim leading spaces). */
@@ -1632,7 +1633,7 @@ int Set_option::process_option(Instance *instance, Named_value *option)
bool Unset_option::parse_args(const char **text)
{
- uint len;
+ size_t len;
/* Check if we have something (and trim leading spaces). */
diff --git a/server-tools/instance-manager/instance_map.cc b/server-tools/instance-manager/instance_map.cc
index 5d492fe5c11..d7328d51cfe 100644
--- a/server-tools/instance-manager/instance_map.cc
+++ b/server-tools/instance-manager/instance_map.cc
@@ -37,12 +37,12 @@ C_MODE_START
HASH-routines: get key of instance for storing in hash.
*/
-static byte* get_instance_key(const byte* u, uint* len,
- my_bool __attribute__((unused)) t)
+static uchar* get_instance_key(const uchar* u, size_t* len,
+ my_bool __attribute__((unused)) t)
{
const Instance *instance= (const Instance *) u;
*len= instance->options.instance_name.length;
- return (byte *) instance->options.instance_name.str;
+ return (uchar *) instance->options.instance_name.str;
}
/**
@@ -165,7 +165,7 @@ int Instance_map::process_one_option(const LEX_STRING *group,
return 0;
}
- if (!(instance= (Instance *) hash_search(&hash, (byte *) group->str,
+ if (!(instance= (Instance *) hash_search(&hash, (uchar *) group->str,
group->length)))
{
if (!(instance= new Instance()))
@@ -332,7 +332,7 @@ bool Instance_map::is_there_active_instance()
int Instance_map::add_instance(Instance *instance)
{
- return my_hash_insert(&hash, (byte *) instance);
+ return my_hash_insert(&hash, (uchar *) instance);
}
@@ -344,7 +344,7 @@ int Instance_map::add_instance(Instance *instance)
int Instance_map::remove_instance(Instance *instance)
{
- return hash_delete(&hash, (byte *) instance);
+ return hash_delete(&hash, (uchar *) instance);
}
@@ -425,7 +425,7 @@ int Instance_map::create_instance(const LEX_STRING *instance_name,
Instance * Instance_map::find(const LEX_STRING *name)
{
- return (Instance *) hash_search(&hash, (byte *) name->str, name->length);
+ return (Instance *) hash_search(&hash, (uchar *) name->str, name->length);
}
@@ -603,12 +603,12 @@ int create_instance_in_file(const LEX_STRING *instance_name,
return ER_ACCESS_OPTION_FILE;
}
- if (my_write(cnf_file, (byte*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP)) ||
- my_write(cnf_file, (byte*)"[", 1, MYF(MY_NABP)) ||
- my_write(cnf_file, (byte*)instance_name->str, instance_name->length,
+ if (my_write(cnf_file, (uchar*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP)) ||
+ my_write(cnf_file, (uchar*)"[", 1, MYF(MY_NABP)) ||
+ my_write(cnf_file, (uchar*)instance_name->str, instance_name->length,
MYF(MY_NABP)) ||
- my_write(cnf_file, (byte*)"]", 1, MYF(MY_NABP)) ||
- my_write(cnf_file, (byte*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP)))
+ my_write(cnf_file, (uchar*)"]", 1, MYF(MY_NABP)) ||
+ my_write(cnf_file, (uchar*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP)))
{
log_error("Can not write to configuration file (%s): %s.",
(const char *) Options::Main::config_file,
@@ -631,8 +631,8 @@ int create_instance_in_file(const LEX_STRING *instance_name,
option_str_len= ptr - option_str;
- if (my_write(cnf_file, (byte*)option_str, option_str_len, MYF(MY_NABP)) ||
- my_write(cnf_file, (byte*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP)))
+ if (my_write(cnf_file, (uchar*)option_str, option_str_len, MYF(MY_NABP)) ||
+ my_write(cnf_file, (uchar*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP)))
{
log_error("Can not write to configuration file (%s): %s.",
(const char *) Options::Main::config_file,
diff --git a/server-tools/instance-manager/instance_options.cc b/server-tools/instance-manager/instance_options.cc
index 6b23df97f7f..5665c6f8670 100644
--- a/server-tools/instance-manager/instance_options.cc
+++ b/server-tools/instance-manager/instance_options.cc
@@ -156,7 +156,7 @@ int Instance_options::get_default_option(char *result, size_t result_len,
goto err;
/* +2 eats first "--" from the option string (E.g. "--datadir") */
- rc= parse_output_and_get_value(cmd.buffer, option_name + 2,
+ rc= parse_output_and_get_value((char*) cmd.buffer, option_name + 2,
result, result_len, GET_VALUE);
err:
return rc;
@@ -194,7 +194,7 @@ bool Instance_options::fill_instance_version()
bzero(result, MAX_VERSION_LENGTH);
- if (parse_output_and_get_value(cmd.buffer, "Ver", result,
+ if (parse_output_and_get_value((char*) cmd.buffer, "Ver", result,
MAX_VERSION_LENGTH, GET_LINE))
{
log_error("Failed to get version of '%s': unexpected output.",
@@ -255,7 +255,7 @@ bool Instance_options::fill_mysqld_real_path()
bzero(result, FN_REFLEN);
- if (parse_output_and_get_value(cmd.buffer, "Usage: ",
+ if (parse_output_and_get_value((char*) cmd.buffer, "Usage: ",
result, FN_REFLEN,
GET_LINE))
{
@@ -466,13 +466,9 @@ bool Instance_options::complete_initialization()
Need to copy the path to allocated memory, as convert_dirname() might
need to change it
*/
- mysqld_path.str=
- alloc_root(&alloc, strlen(Options::Main::default_mysqld_path) + 1);
-
+ mysqld_path.str= strdup_root(&alloc, Options::Main::default_mysqld_path);
if (!mysqld_path.str)
return TRUE;
-
- strcpy(mysqld_path.str, Options::Main::default_mysqld_path);
}
mysqld_path.length= strlen(mysqld_path.str);
diff --git a/server-tools/instance-manager/mysql_connection.cc b/server-tools/instance-manager/mysql_connection.cc
index 293d90420b1..c228a680f7a 100644
--- a/server-tools/instance-manager/mysql_connection.cc
+++ b/server-tools/instance-manager/mysql_connection.cc
@@ -147,12 +147,12 @@ int Mysql_connection::check_connection()
ulong pkt_len=0; // to hold client reply length
/* buffer for the first packet */ /* packet contains: */
- char buff[MAX_VERSION_LENGTH + 1 + // server version, 0-ended
- 4 + // connection id
- SCRAMBLE_LENGTH + 2 + // scramble (in 2 pieces)
- 18]; // server variables: flags,
+ uchar buff[MAX_VERSION_LENGTH + 1 + // server version, 0-ended
+ 4 + // connection id
+ SCRAMBLE_LENGTH + 2 + // scramble (in 2 pieces)
+ 18]; // server variables: flags,
// charset number, status,
- char *pos= buff;
+ uchar *pos= buff;
ulong server_flags;
memcpy(pos, mysqlmanager_version.str, mysqlmanager_version.length + 1);
@@ -195,7 +195,8 @@ int Mysql_connection::check_connection()
/* write connection message and read reply */
enum { MIN_HANDSHAKE_SIZE= 2 };
- if (net_write_command(&net, protocol_version, "", 0, buff, pos - buff) ||
+ if (net_write_command(&net, protocol_version, (uchar*) "", 0,
+ buff, pos - buff) ||
(pkt_len= my_net_read(&net)) == packet_error ||
pkt_len < MIN_HANDSHAKE_SIZE)
{
@@ -211,17 +212,17 @@ int Mysql_connection::check_connection()
}
client_capabilities|= ((ulong) uint2korr(net.read_pos + 2)) << 16;
- pos= (char*) net.read_pos + 32;
+ pos= net.read_pos + 32;
/* At least one byte for username and one byte for password */
- if (pos >= (char*) net.read_pos + pkt_len + 2)
+ if (pos >= net.read_pos + pkt_len + 2)
{
/*TODO add user and password handling in error messages*/
net_send_error(&net, ER_HANDSHAKE_ERROR);
return 1;
}
- const char *user= pos;
+ const char *user= (char*) pos;
const char *password= strend(user)+1;
ulong password_len= *password++;
LEX_STRING user_name= { (char *) user, password - user - 2 };
diff --git a/server-tools/instance-manager/options.cc b/server-tools/instance-manager/options.cc
index 74e7812ea72..7eba3187dd9 100644
--- a/server-tools/instance-manager/options.cc
+++ b/server-tools/instance-manager/options.cc
@@ -152,14 +152,14 @@ static struct my_option my_long_options[] =
#ifndef __WIN__
{ "angel-pid-file", OPT_ANGEL_PID_FILE, "Pid file for angel process.",
- (gptr *) &Options::Daemon::angel_pid_file_name,
- (gptr *) &Options::Daemon::angel_pid_file_name,
+ (uchar* *) &Options::Daemon::angel_pid_file_name,
+ (uchar* *) &Options::Daemon::angel_pid_file_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
#endif
{ "bind-address", OPT_BIND_ADDRESS, "Bind address to use for connection.",
- (gptr *) &Options::Main::bind_address,
- (gptr *) &Options::Main::bind_address,
+ (uchar* *) &Options::Main::bind_address,
+ (uchar* *) &Options::Main::bind_address,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "check-password-file", OPT_CHECK_PASSWORD_FILE,
@@ -172,15 +172,15 @@ static struct my_option my_long_options[] =
#ifndef DBUG_OFF
{"debug", '#', "Debug log.",
- (gptr *) &Options::Debug::config_str,
- (gptr *) &Options::Debug::config_str,
+ (uchar* *) &Options::Debug::config_str,
+ (uchar* *) &Options::Debug::config_str,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{ "default-mysqld-path", OPT_MYSQLD_PATH, "Where to look for MySQL"
" Server binary.",
- (gptr *) &Options::Main::default_mysqld_path,
- (gptr *) &Options::Main::default_mysqld_path,
+ (uchar* *) &Options::Main::default_mysqld_path,
+ (uchar* *) &Options::Main::default_mysqld_path,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 },
{ "drop-user", OPT_DROP_USER,
@@ -193,8 +193,8 @@ static struct my_option my_long_options[] =
#ifdef __WIN__
{ "install", OPT_INSTALL_SERVICE, "Install as system service.",
- (gptr *) &Options::Service::install_as_service,
- (gptr *) &Options::Service::install_as_service,
+ (uchar* *) &Options::Service::install_as_service,
+ (uchar* *) &Options::Service::install_as_service,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 },
#endif
@@ -204,22 +204,22 @@ static struct my_option my_long_options[] =
#ifndef __WIN__
{ "log", OPT_LOG, "Path to log file. Used only with --run-as-service.",
- (gptr *) &Options::Daemon::log_file_name,
- (gptr *) &Options::Daemon::log_file_name,
+ (uchar* *) &Options::Daemon::log_file_name,
+ (uchar* *) &Options::Daemon::log_file_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
#endif
{ "monitoring-interval", OPT_MONITORING_INTERVAL, "Interval to monitor"
" instances in seconds.",
- (gptr *) &Options::Main::monitoring_interval,
- (gptr *) &Options::Main::monitoring_interval,
+ (uchar* *) &Options::Main::monitoring_interval,
+ (uchar* *) &Options::Main::monitoring_interval,
0, GET_UINT, REQUIRED_ARG, DEFAULT_MONITORING_INTERVAL,
0, 0, 0, 0, 0 },
{ "mysqld-safe-compatible", OPT_MYSQLD_SAFE_COMPATIBLE,
"Start Instance Manager in mysqld_safe compatible manner",
- (gptr *) &Options::Main::mysqld_safe_compatible,
- (gptr *) &Options::Main::mysqld_safe_compatible,
+ (uchar* *) &Options::Main::mysqld_safe_compatible,
+ (uchar* *) &Options::Main::mysqld_safe_compatible,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 },
{ "print-password-line", OPT_PRINT_PASSWORD_LINE,
@@ -227,61 +227,61 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "password", OPT_PASSWORD, "Password to update the password file",
- (gptr *) &Options::User_management::password,
- (gptr *) &Options::User_management::password,
+ (uchar* *) &Options::User_management::password,
+ (uchar* *) &Options::User_management::password,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "password-file", OPT_PASSWORD_FILE,
"Look for Instance Manager users and passwords here.",
- (gptr *) &Options::Main::password_file_name,
- (gptr *) &Options::Main::password_file_name,
+ (uchar* *) &Options::Main::password_file_name,
+ (uchar* *) &Options::Main::password_file_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "pid-file", OPT_PID_FILE, "Pid file to use.",
- (gptr *) &Options::Main::pid_file_name,
- (gptr *) &Options::Main::pid_file_name,
+ (uchar* *) &Options::Main::pid_file_name,
+ (uchar* *) &Options::Main::pid_file_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "port", OPT_PORT, "Port number to use for connections",
- (gptr *) &Options::Main::port_number,
- (gptr *) &Options::Main::port_number,
+ (uchar* *) &Options::Main::port_number,
+ (uchar* *) &Options::Main::port_number,
0, GET_UINT, REQUIRED_ARG, DEFAULT_PORT, 0, 0, 0, 0, 0 },
#ifdef __WIN__
{ "remove", OPT_REMOVE_SERVICE, "Remove system service.",
- (gptr *) &Options::Service::remove_service,
- (gptr *) &Options::Service::remove_service,
+ (uchar* *) &Options::Service::remove_service,
+ (uchar* *) &Options::Service::remove_service,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0},
#else
{ "run-as-service", OPT_RUN_AS_SERVICE,
"Daemonize and start angel process.",
- (gptr *) &Options::Daemon::run_as_service,
+ (uchar* *) &Options::Daemon::run_as_service,
0, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 },
#endif
#ifndef __WIN__
{ "socket", OPT_SOCKET, "Socket file to use for connection.",
- (gptr *) &Options::Main::socket_file_name,
- (gptr *) &Options::Main::socket_file_name,
+ (uchar* *) &Options::Main::socket_file_name,
+ (uchar* *) &Options::Main::socket_file_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
#endif
#ifdef __WIN__
{ "standalone", OPT_STAND_ALONE, "Run the application in stand alone mode.",
- (gptr *) &Options::Service::stand_alone,
- (gptr *) &Options::Service::stand_alone,
+ (uchar* *) &Options::Service::stand_alone,
+ (uchar* *) &Options::Service::stand_alone,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0},
#else
{ "user", OPT_USER, "Username to start mysqlmanager",
- (gptr *) &Options::Daemon::user,
- (gptr *) &Options::Daemon::user,
+ (uchar* *) &Options::Daemon::user,
+ (uchar* *) &Options::Daemon::user,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
#endif
{ "username", OPT_USERNAME,
"Username to update the password file",
- (gptr *) &Options::User_management::user_name,
- (gptr *) &Options::User_management::user_name,
+ (uchar* *) &Options::User_management::user_name,
+ (uchar* *) &Options::User_management::user_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "version", 'V', "Output version information and exit.", 0, 0, 0,
@@ -289,8 +289,8 @@ static struct my_option my_long_options[] =
{ "wait-timeout", OPT_WAIT_TIMEOUT, "The number of seconds IM waits "
"for activity on a connection before closing it.",
- (gptr *) &net_read_timeout,
- (gptr *) &net_read_timeout,
+ (uchar* *) &net_read_timeout,
+ (uchar* *) &net_read_timeout,
0, GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }
diff --git a/server-tools/instance-manager/parse.cc b/server-tools/instance-manager/parse.cc
index 3995a265e96..cd20e3bc7ab 100644
--- a/server-tools/instance-manager/parse.cc
+++ b/server-tools/instance-manager/parse.cc
@@ -105,7 +105,7 @@ Named_value_arr::~Named_value_arr()
TOK_NOT_FOUND
*/
-inline Token find_token(const char *word, uint word_len)
+inline Token find_token(const char *word, size_t word_len)
{
int i= 0;
do
@@ -119,7 +119,7 @@ inline Token find_token(const char *word, uint word_len)
}
-Token get_token(const char **text, uint *word_len)
+Token get_token(const char **text, size_t *word_len)
{
get_word(text, word_len);
if (*word_len)
@@ -128,7 +128,7 @@ Token get_token(const char **text, uint *word_len)
}
-Token shift_token(const char **text, uint *word_len)
+Token shift_token(const char **text, size_t *word_len)
{
Token save= get_token(text, word_len);
(*text)+= *word_len;
@@ -157,7 +157,7 @@ static bool parse_long(const LEX_STRING *token, long *value)
}
-bool parse_option_value(const char *text, uint *text_len, char **value)
+bool parse_option_value(const char *text, size_t *text_len, char **value)
{
char beginning_quote;
const char *text_start_ptr;
@@ -270,7 +270,7 @@ void skip_spaces(const char **text)
Command *parse_command(const char *text)
{
- uint word_len;
+ size_t word_len;
LEX_STRING instance_name;
Command *command= 0;
diff --git a/server-tools/instance-manager/parse.h b/server-tools/instance-manager/parse.h
index 02bb81749f0..00f7aa237b8 100644
--- a/server-tools/instance-manager/parse.h
+++ b/server-tools/instance-manager/parse.h
@@ -30,7 +30,7 @@ enum Log_type
Command *parse_command(const char *text);
-bool parse_option_value(const char *text, uint *text_len, char **value);
+bool parse_option_value(const char *text, size_t *text_len, char **value);
void skip_spaces(const char **text);
@@ -138,7 +138,7 @@ inline Named_value Named_value_arr::get_element(int idx) const
DBUG_ASSERT(0 <= idx && (uint) idx < arr.elements);
Named_value option;
- get_dynamic((DYNAMIC_ARRAY *) &arr, (gptr) &option, idx);
+ get_dynamic((DYNAMIC_ARRAY *) &arr, (uchar*) &option, idx);
return option;
}
@@ -156,7 +156,7 @@ inline void Named_value_arr::remove_element(int idx)
inline bool Named_value_arr::add_element(Named_value *option)
{
- return insert_dynamic(&arr, (gptr) option);
+ return insert_dynamic(&arr, (uchar*) option);
}
@@ -166,7 +166,7 @@ inline bool Named_value_arr::replace_element(int idx, Named_value *option)
get_element(idx).free();
- return set_dynamic(&arr, (gptr) option, idx);
+ return set_dynamic(&arr, (uchar*) option, idx);
}
/************************************************************************/
@@ -177,7 +177,7 @@ inline bool Named_value_arr::replace_element(int idx, Named_value *option)
if not found returns pointer to first non-space or to '\0', word_len == 0
*/
-inline void get_word(const char **text, uint *word_len,
+inline void get_word(const char **text, size_t *word_len,
enum_seek_method seek_method= ALPHANUM)
{
const char *word_end;
diff --git a/server-tools/instance-manager/protocol.cc b/server-tools/instance-manager/protocol.cc
index 05099b59064..8d71fcb8026 100644
--- a/server-tools/instance-manager/protocol.cc
+++ b/server-tools/instance-manager/protocol.cc
@@ -21,7 +21,7 @@
#include <m_string.h>
-static char eof_buff[1]= { (char) 254 }; /* Marker for end of fields */
+static uchar eof_buff[1]= { (char) 254 }; /* Marker for end of fields */
static const char ERROR_PACKET_CODE= (char) 255;
@@ -38,7 +38,7 @@ int net_send_ok(struct st_net *net, unsigned long connection_id,
1-9 + message length message to send (isn't stored if no message)
*/
Buffer buff;
- char *pos= buff.buffer;
+ uchar *pos= buff.buffer;
/* check that we have space to hold mandatory fields */
buff.reserve(0, 23);
@@ -53,7 +53,7 @@ int net_send_ok(struct st_net *net, unsigned long connection_id,
int2store(pos, 0);
pos+= 2;
- uint position= pos - buff.buffer; /* we might need it for message */
+ size_t position= pos - buff.buffer; /* we might need it for message */
if (message != NULL)
{
@@ -82,7 +82,8 @@ int net_send_error(struct st_net *net, uint sql_errno)
memcpy(pos, errno_to_sqlstate(sql_errno), SQLSTATE_LENGTH);
pos+= SQLSTATE_LENGTH;
pos= strmake(pos, err, MYSQL_ERRMSG_SIZE - 1) + 1;
- return my_net_write(net, buff, pos - buff) || net_flush(net);
+ return (my_net_write(net, (uchar*) buff, (size_t) (pos - buff)) ||
+ net_flush(net));
}
@@ -98,7 +99,8 @@ int net_send_error_323(struct st_net *net, uint sql_errno)
int2store(pos, sql_errno);
pos+= 2;
pos= strmake(pos, err, MYSQL_ERRMSG_SIZE - 1) + 1;
- return my_net_write(net, buff, pos - buff) || net_flush(net);
+ return (my_net_write(net, (uchar*) buff, (size_t) (pos - buff)) ||
+ net_flush(net));
}
char *net_store_length(char *pkg, uint length)
@@ -115,8 +117,8 @@ char *net_store_length(char *pkg, uint length)
}
-int store_to_protocol_packet(Buffer *buf, const char *string, uint *position,
- uint string_len)
+int store_to_protocol_packet(Buffer *buf, const char *string, size_t *position,
+ size_t string_len)
{
uint currpos;
@@ -135,9 +137,10 @@ err:
}
-int store_to_protocol_packet(Buffer *buf, const char *string, uint *position)
+int store_to_protocol_packet(Buffer *buf, const char *string,
+ size_t *position)
{
- uint string_len;
+ size_t string_len;
string_len= strlen(string);
return store_to_protocol_packet(buf, string, position, string_len);
@@ -153,15 +156,16 @@ int send_eof(struct st_net *net)
buff[0]=254;
int2store(buff+1, 0);
int2store(buff+3, 0);
- return my_net_write(net, (char*) buff, sizeof buff);
+ return my_net_write(net, buff, sizeof(buff));
}
+
int send_fields(struct st_net *net, LIST *fields)
{
LIST *tmp= fields;
Buffer send_buff;
- char small_buff[4];
- uint position= 0;
+ uchar small_buff[4];
+ size_t position= 0;
LEX_STRING *field;
/* send the number of fileds */
diff --git a/server-tools/instance-manager/protocol.h b/server-tools/instance-manager/protocol.h
index 520b6d4c92c..b06ae4dfdb2 100644
--- a/server-tools/instance-manager/protocol.h
+++ b/server-tools/instance-manager/protocol.h
@@ -36,10 +36,11 @@ int send_fields(struct st_net *net, LIST *fields);
char *net_store_length(char *pkg, uint length);
-int store_to_protocol_packet(Buffer *buf, const char *string, uint *position);
+int store_to_protocol_packet(Buffer *buf, const char *string,
+ size_t *position);
-int store_to_protocol_packet(Buffer *buf, const char *string, uint *position,
- uint string_len);
+int store_to_protocol_packet(Buffer *buf, const char *string, size_t *position,
+ size_t string_len);
int send_eof(struct st_net *net);
diff --git a/server-tools/instance-manager/user_map.cc b/server-tools/instance-manager/user_map.cc
index 832a8cee6b9..49c35c16ca9 100644
--- a/server-tools/instance-manager/user_map.cc
+++ b/server-tools/instance-manager/user_map.cc
@@ -97,12 +97,12 @@ int User::init(const char *line)
C_MODE_START
-static byte* get_user_key(const byte* u, uint* len,
- my_bool __attribute__((unused)) t)
+static uchar* get_user_key(const uchar* u, size_t* len,
+ my_bool __attribute__((unused)) t)
{
const User *user= (const User *) u;
*len= user->user_length;
- return (byte *) user->user;
+ return (uchar *) user->user;
}
static void delete_user(void *u)
@@ -133,7 +133,7 @@ int User_map::init()
{
enum { START_HASH_SIZE= 16 };
if (hash_init(&hash, default_charset_info, START_HASH_SIZE, 0, 0,
- get_user_key, delete_user, 0))
+ get_user_key, delete_user, 0))
return 1;
initialized= TRUE;
@@ -274,7 +274,7 @@ int User_map::load(const char *password_file_name, const char **err_msg)
return ERR_PASSWORD_FILE_CORRUPTED;
}
- if (my_hash_insert(&hash, (byte *) user))
+ if (my_hash_insert(&hash, (uchar *) user))
{
delete user;
my_fclose(file, MYF(0));
@@ -374,7 +374,7 @@ int User_map::authenticate(const LEX_STRING *user_name,
User *User_map::find_user(const LEX_STRING *user_name)
{
- return (User*) hash_search(&hash, (byte*) user_name->str, user_name->length);
+ return (User*) hash_search(&hash, (uchar*) user_name->str, user_name->length);
}
const User *User_map::find_user(const LEX_STRING *user_name) const
@@ -385,11 +385,11 @@ const User *User_map::find_user(const LEX_STRING *user_name) const
bool User_map::add_user(User *user)
{
- return my_hash_insert(&hash, (byte*) user) == 0 ? FALSE : TRUE;
+ return my_hash_insert(&hash, (uchar*) user) == 0 ? FALSE : TRUE;
}
bool User_map::remove_user(User *user)
{
- return hash_delete(&hash, (byte*) user) == 0 ? FALSE : TRUE;
+ return hash_delete(&hash, (uchar*) user) == 0 ? FALSE : TRUE;
}
diff --git a/sql-common/client.c b/sql-common/client.c
index 2c09498d8f4..2753317b053 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -644,14 +644,14 @@ void free_rows(MYSQL_DATA *cur)
if (cur)
{
free_root(&cur->alloc,MYF(0));
- my_free((gptr) cur,MYF(0));
+ my_free((uchar*) cur,MYF(0));
}
}
my_bool
cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
- const char *header, ulong header_length,
- const char *arg, ulong arg_length, my_bool skip_check,
+ const uchar *header, ulong header_length,
+ const uchar *arg, ulong arg_length, my_bool skip_check,
MYSQL_STMT *stmt __attribute__((unused)))
{
NET *net= &mysql->net;
@@ -914,8 +914,8 @@ mysql_free_result(MYSQL_RES *result)
if (result->fields)
free_root(&result->field_alloc,MYF(0));
if (result->row)
- my_free((gptr) result->row,MYF(0));
- my_free((gptr) result,MYF(0));
+ my_free((uchar*) result->row,MYF(0));
+ my_free((uchar*) result,MYF(0));
}
DBUG_VOID_RETURN;
}
@@ -958,7 +958,7 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd)
}
if (!(tmp= my_strdup(cmd,MYF(MY_WME))) ||
- insert_dynamic(options->init_commands, (gptr)&tmp))
+ insert_dynamic(options->init_commands, (uchar*)&tmp))
{
my_free(tmp, MYF(MY_ALLOW_ZERO_PTR));
return 1;
@@ -1170,7 +1170,7 @@ static void cli_fetch_lengths(ulong *to, MYSQL_ROW column,
unsigned int field_count)
{
ulong *prev_length;
- byte *start=0;
+ char *start=0;
MYSQL_ROW end;
prev_length=0; /* Keep gcc happy */
@@ -1589,7 +1589,7 @@ mysql_ssl_free(MYSQL *mysql __attribute__((unused)))
*/
const char * STDCALL
-mysql_get_ssl_cipher(MYSQL *mysql)
+mysql_get_ssl_cipher(MYSQL *mysql __attribute__((unused)))
{
DBUG_ENTER("mysql_get_ssl_cipher");
#ifdef HAVE_OPENSSL
@@ -2575,7 +2575,7 @@ static void mysql_close_free_options(MYSQL *mysql)
static void mysql_close_free(MYSQL *mysql)
{
- my_free((gptr) mysql->host_info,MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) mysql->host_info,MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
@@ -2665,7 +2665,7 @@ void STDCALL mysql_close(MYSQL *mysql)
(*mysql->methods->free_embedded_thd)(mysql);
#endif
if (mysql->free_me)
- my_free((gptr) mysql,MYF(0));
+ my_free((uchar*) mysql,MYF(0));
}
DBUG_VOID_RETURN;
}
@@ -2818,7 +2818,7 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql)
if (!(result->data=
(*mysql->methods->read_rows)(mysql,mysql->fields,mysql->field_count)))
{
- my_free((gptr) result,MYF(0));
+ my_free((uchar*) result,MYF(0));
DBUG_RETURN(0);
}
mysql->affected_rows= result->row_count= result->data->rows;
@@ -2868,7 +2868,7 @@ static MYSQL_RES * cli_use_result(MYSQL *mysql)
if (!(result->row=(MYSQL_ROW)
my_malloc(sizeof(result->row[0])*(mysql->field_count+1), MYF(MY_WME))))
{ /* Ptrs: to one row */
- my_free((gptr) result,MYF(0));
+ my_free((uchar*) result,MYF(0));
DBUG_RETURN(0);
}
result->fields= mysql->fields;
diff --git a/sql-common/my_user.c b/sql-common/my_user.c
index fa5b80413bf..16a544387ee 100644
--- a/sql-common/my_user.c
+++ b/sql-common/my_user.c
@@ -31,9 +31,9 @@
host_name_len [OUT] A place to store length of the host name part.
*/
-void parse_user(const char *user_id_str, uint user_id_len,
- char *user_name_str, uint *user_name_len,
- char *host_name_str, uint *host_name_len)
+void parse_user(const char *user_id_str, size_t user_id_len,
+ char *user_name_str, size_t *user_name_len,
+ char *host_name_str, size_t *host_name_len)
{
char *p= strrchr(user_id_str, '@');
diff --git a/sql-common/pack.c b/sql-common/pack.c
index 33c1103fb04..f6cda4e5b86 100644
--- a/sql-common/pack.c
+++ b/sql-common/pack.c
@@ -94,10 +94,8 @@ my_ulonglong net_field_length_ll(uchar **packet)
Position in 'pkg' after the packed length
*/
-char *
-net_store_length(char *pkg, ulonglong length)
+uchar *net_store_length(uchar *packet, ulonglong length)
{
- uchar *packet=(uchar*) pkg;
if (length < (ulonglong) LL(251))
{
*packet=(uchar) length;
diff --git a/sql/derror.cc b/sql/derror.cc
index 0e74d411b1f..aa7edd639da 100644
--- a/sql/derror.cc
+++ b/sql/derror.cc
@@ -55,7 +55,7 @@ bool init_errmessage(void)
/* Register messages for use with my_error(). */
if (my_error_register(errmsgs, ER_ERROR_FIRST, ER_ERROR_LAST))
{
- x_free((gptr) errmsgs);
+ x_free((uchar*) errmsgs);
DBUG_RETURN(TRUE);
}
@@ -72,11 +72,13 @@ static bool read_texts(const char *file_name,const char ***point,
uint error_messages)
{
register uint i;
- uint count,funktpos,length,textcount;
+ uint count,funktpos,textcount;
+ size_t length;
File file;
char name[FN_REFLEN];
- const char *buff;
+ uchar *buff;
uchar head[32],*pos;
+ const char *errmsg;
DBUG_ENTER("read_texts");
*point=0; // If something goes wrong
@@ -88,7 +90,7 @@ static bool read_texts(const char *file_name,const char ***point,
goto err; /* purecov: inspected */
funktpos=1;
- if (my_read(file,(byte*) head,32,MYF(MY_NABP))) goto err;
+ if (my_read(file,(uchar*) head,32,MYF(MY_NABP))) goto err;
if (head[0] != (uchar) 254 || head[1] != (uchar) 254 ||
head[2] != 2 || head[3] != 1)
goto err; /* purecov: inspected */
@@ -122,22 +124,24 @@ Check that the above file is the right version for this program!",
unireg_abort(1);
}
- x_free((gptr) *point); /* Free old language */
+ x_free((uchar*) *point); /* Free old language */
if (!(*point= (const char**)
- my_malloc((uint) (length+count*sizeof(char*)),MYF(0))))
+ my_malloc((size_t) (length+count*sizeof(char*)),MYF(0))))
{
funktpos=2; /* purecov: inspected */
goto err; /* purecov: inspected */
}
- buff= (char*) (*point + count);
+ buff= (uchar*) (*point + count);
- if (my_read(file,(byte*) buff,(uint) count*2,MYF(MY_NABP))) goto err;
- for (i=0, pos= (uchar*) buff ; i< count ; i++)
+ if (my_read(file, buff, (size_t) count*2,MYF(MY_NABP)))
+ goto err;
+ for (i=0, pos= buff ; i< count ; i++)
{
- (*point)[i]=buff+uint2korr(pos);
+ (*point)[i]= (char*) buff+uint2korr(pos);
pos+=2;
}
- if (my_read(file,(byte*) buff,(uint) length,MYF(MY_NABP))) goto err;
+ if (my_read(file, buff, length, MYF(MY_NABP)))
+ goto err;
for (i=1 ; i < textcount ; i++)
{
@@ -149,16 +153,16 @@ Check that the above file is the right version for this program!",
err:
switch (funktpos) {
case 2:
- buff="Not enough memory for messagefile '%s'";
+ errmsg= "Not enough memory for messagefile '%s'";
break;
case 1:
- buff="Can't read from messagefile '%s'";
+ errmsg= "Can't read from messagefile '%s'";
break;
default:
- buff="Can't find messagefile '%s'";
+ errmsg= "Can't find messagefile '%s'";
break;
}
- sql_print_error(buff,name);
+ sql_print_error(errmsg, name);
err1:
if (file != FERR)
VOID(my_close(file,MYF(MY_WME)));
diff --git a/sql/discover.cc b/sql/discover.cc
index 395bfbfff45..a7af90c440f 100644
--- a/sql/discover.cc
+++ b/sql/discover.cc
@@ -39,14 +39,13 @@
frmdata and len are set to 0 on error
*/
-int readfrm(const char *name,
- const void **frmdata, uint *len)
+int readfrm(const char *name, uchar **frmdata, size_t *len)
{
int error;
char index_file[FN_REFLEN];
File file;
- ulong read_len;
- char *read_data;
+ size_t read_len;
+ uchar *read_data;
MY_STAT state;
DBUG_ENTER("readfrm");
DBUG_PRINT("enter",("name: '%s'",name));
@@ -68,12 +67,12 @@ int readfrm(const char *name,
// Read whole frm file
error= 3;
- read_data= 0;
+ read_data= 0; // Nothing to free
if (read_string(file, &read_data, read_len))
goto err;
// Setup return data
- *frmdata= (void*) read_data;
+ *frmdata= (uchar*) read_data;
*len= read_len;
error= 0;
@@ -102,21 +101,20 @@ int readfrm(const char *name,
2 Could not write file
*/
-int writefrm(const char *name, const void *frmdata, uint len)
+int writefrm(const char *name, const uchar *frmdata, size_t len)
{
File file;
char index_file[FN_REFLEN];
int error;
DBUG_ENTER("writefrm");
- DBUG_PRINT("enter",("name: '%s' len: %d ",name,len));
- //DBUG_DUMP("frmdata", (char*)frmdata, len);
+ DBUG_PRINT("enter",("name: '%s' len: %lu ",name, (ulong) len));
error= 0;
if ((file=my_create(fn_format(index_file,name,"",reg_ext,
MY_UNPACK_FILENAME|MY_APPEND_EXT),
CREATE_MODE,O_RDWR | O_TRUNC,MYF(MY_WME))) >= 0)
{
- if (my_write(file,(byte*)frmdata,len,MYF(MY_WME | MY_NABP)))
+ if (my_write(file, frmdata, len,MYF(MY_WME | MY_NABP)))
error= 2;
VOID(my_close(file,MYF(0)));
}
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index f5847e603e8..71a87c12169 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -42,7 +42,7 @@ Event_queue_element_for_exec::init(LEX_STRING db, LEX_STRING n)
return TRUE;
if (!(name.str= my_strndup(n.str, name.length= n.length, MYF(MY_WME))))
{
- my_free((gptr) dbname.str, MYF(0));
+ my_free((uchar*) dbname.str, MYF(0));
return TRUE;
}
return FALSE;
@@ -58,8 +58,8 @@ Event_queue_element_for_exec::init(LEX_STRING db, LEX_STRING n)
Event_queue_element_for_exec::~Event_queue_element_for_exec()
{
- my_free((gptr) dbname.str, MYF(0));
- my_free((gptr) name.str, MYF(0));
+ my_free((uchar*) dbname.str, MYF(0));
+ my_free((uchar*) name.str, MYF(0));
}
@@ -615,7 +615,7 @@ Event_parse_data::init_definer(THD *thd)
/* + 1 for @ */
DBUG_PRINT("info",("init definer as whole"));
definer.length= definer_user_len + definer_host_len + 1;
- definer.str= thd->alloc(definer.length + 1);
+ definer.str= (char*) thd->alloc(definer.length + 1);
DBUG_PRINT("info",("copy the user"));
memcpy(definer.str, definer_user, definer_user_len);
@@ -1631,7 +1631,7 @@ Event_queue_element::update_timing_fields(THD *thd)
DBUG_ENTER("Event_queue_element::update_timing_fields");
- DBUG_PRINT("enter", ("name: %*s", name.length, name.str));
+ DBUG_PRINT("enter", ("name: %*s", (int) name.length, name.str));
/* No need to update if nothing has changed */
if (!(status_changed || last_executed_changed))
@@ -1691,7 +1691,8 @@ Event_timed::get_create_event(THD *thd, String *buf)
expr_buf.length(0);
DBUG_ENTER("get_create_event");
- DBUG_PRINT("ret_info",("body_len=[%d]body=[%s]", body.length, body.str));
+ DBUG_PRINT("ret_info",("body_len=[%d]body=[%s]",
+ (int) body.length, body.str));
if (expression && Events::reconstruct_interval_expression(&expr_buf, interval,
expression))
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc
index e49fd6791a0..fa17ee8a380 100644
--- a/sql/event_db_repository.cc
+++ b/sql/event_db_repository.cc
@@ -303,7 +303,7 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table,
CHARSET_INFO *scs= system_charset_info;
KEY *key_info;
uint key_len;
- byte *key_buf= NULL;
+ uchar *key_buf= NULL;
LINT_INIT(key_buf);
DBUG_ENTER("Event_db_repository::index_read_for_db_for_i_s");
@@ -324,7 +324,7 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table,
event_table->field[ET_FIELD_DB]->store(db, strlen(db), scs);
key_len= key_info->key_part[0].store_length;
- if (!(key_buf= (byte *)alloc_root(thd->mem_root, key_len)))
+ if (!(key_buf= (uchar *)alloc_root(thd->mem_root, key_len)))
{
/* Don't send error, it would be done by sql_alloc_error_handler() */
ret= 1;
@@ -521,7 +521,7 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
if (open_event_table(thd, TL_WRITE, &table))
goto end;
- DBUG_PRINT("info", ("name: %.*s", parse_data->name.length,
+ DBUG_PRINT("info", ("name: %.*s", (int) parse_data->name.length,
parse_data->name.str));
DBUG_PRINT("info", ("check existance of an event with the same name"));
@@ -757,9 +757,9 @@ bool
Event_db_repository::find_named_event(LEX_STRING db, LEX_STRING name,
TABLE *table)
{
- byte key[MAX_KEY_LENGTH];
+ uchar key[MAX_KEY_LENGTH];
DBUG_ENTER("Event_db_repository::find_named_event");
- DBUG_PRINT("enter", ("name: %.*s", name.length, name.str));
+ DBUG_PRINT("enter", ("name: %.*s", (int) name.length, name.str));
/*
Create key to find row. We have to use field->store() to be able to
@@ -879,7 +879,8 @@ Event_db_repository::load_named_event(THD *thd, LEX_STRING dbname,
bool ret;
DBUG_ENTER("Event_db_repository::load_named_event");
- DBUG_PRINT("enter",("thd: 0x%lx name: %*s", (long) thd, name.length, name.str));
+ DBUG_PRINT("enter",("thd: 0x%lx name: %*s", (long) thd,
+ (int) name.length, name.str));
if (!(ret= open_event_table(thd, TL_READ, &table)))
{
diff --git a/sql/event_queue.cc b/sql/event_queue.cc
index a7c31429cb3..e1bf3a85a7a 100644
--- a/sql/event_queue.cc
+++ b/sql/event_queue.cc
@@ -53,7 +53,7 @@
*/
static int
-event_queue_element_compare_q(void *vptr, byte* a, byte *b)
+event_queue_element_compare_q(void *vptr, uchar* a, uchar *b)
{
my_time_t lhs = ((Event_queue_element *)a)->execute_at;
my_time_t rhs = ((Event_queue_element *)b)->execute_at;
@@ -193,7 +193,7 @@ Event_queue::create_event(THD *thd, Event_queue_element *new_element,
DBUG_PRINT("info", ("new event in the queue: 0x%lx", (long) new_element));
LOCK_QUEUE_DATA();
- *created= (queue_insert_safe(&queue, (byte *) new_element) == FALSE);
+ *created= (queue_insert_safe(&queue, (uchar *) new_element) == FALSE);
dbug_dump_queue(thd->query_start());
pthread_cond_broadcast(&COND_queue_state);
UNLOCK_QUEUE_DATA();
@@ -242,7 +242,7 @@ Event_queue::update_event(THD *thd, LEX_STRING dbname, LEX_STRING name,
if (new_element)
{
DBUG_PRINT("info", ("new event in the queue: 0x%lx", (long) new_element));
- queue_insert_safe(&queue, (byte *) new_element);
+ queue_insert_safe(&queue, (uchar *) new_element);
pthread_cond_broadcast(&COND_queue_state);
}
diff --git a/sql/field.cc b/sql/field.cc
index 5624294d012..e883831a828 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1051,7 +1051,7 @@ bool Field::type_can_have_key_part(enum enum_field_types type)
/*
Numeric fields base class constructor
*/
-Field_num::Field_num(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
+Field_num::Field_num(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
const char *field_name_arg,
uint8 dec_arg, bool zero_arg, bool unsigned_arg)
@@ -1071,9 +1071,10 @@ void Field_num::prepend_zeros(String *value)
int diff;
if ((diff= (int) (field_length - value->length())) > 0)
{
- bmove_upp((char*) value->ptr()+field_length,value->ptr()+value->length(),
+ bmove_upp((uchar*) value->ptr()+field_length,
+ (uchar*) value->ptr()+value->length(),
value->length());
- bfill((char*) value->ptr(),diff,'0');
+ bfill((uchar*) value->ptr(),diff,'0');
value->length(field_length);
(void) value->c_ptr_quick(); // Avoid warnings in purify
}
@@ -1155,7 +1156,8 @@ bool Field_num::get_int(CHARSET_INFO *cs, const char *from, uint len,
char *end;
int error;
- *rnd= (longlong) cs->cset->strntoull10rnd(cs, from, len, unsigned_flag, &end,
+ *rnd= (longlong) cs->cset->strntoull10rnd(cs, from, len,
+ unsigned_flag, &end,
&error);
if (unsigned_flag)
{
@@ -1179,7 +1181,8 @@ bool Field_num::get_int(CHARSET_INFO *cs, const char *from, uint len,
goto out_of_range;
}
}
- if (table->in_use->count_cuted_fields && check_int(cs, from, len, end, error))
+ if (table->in_use->count_cuted_fields &&
+ check_int(cs, from, len, end, error))
return 1;
return 0;
@@ -1296,7 +1299,7 @@ String *Field::val_int_as_str(String *val_buffer, my_bool unsigned_val)
}
-Field::Field(char *ptr_arg,uint32 length_arg,uchar *null_ptr_arg,
+Field::Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg,
uchar null_bit_arg,
utype unireg_check_arg, const char *field_name_arg)
:ptr(ptr_arg), null_ptr(null_ptr_arg),
@@ -1323,18 +1326,17 @@ void Field::hash(ulong *nr, ulong *nr2)
{
uint len= pack_length();
CHARSET_INFO *cs= charset();
- cs->coll->hash_sort(cs, (uchar*) ptr, len, nr, nr2);
+ cs->coll->hash_sort(cs, ptr, len, nr, nr2);
}
}
-my_size_t
+size_t
Field::do_last_null_byte() const
{
- DBUG_ASSERT(null_ptr == NULL || (byte*) null_ptr >= table->record[0]);
+ DBUG_ASSERT(null_ptr == NULL || null_ptr >= table->record[0]);
if (null_ptr)
- return (byte*) null_ptr - table->record[0] + 1;
- else
- return LAST_NULL_BYTE_UNDEF;
+ return (size_t) (null_ptr - table->record[0]) + 1;
+ return LAST_NULL_BYTE_UNDEF;
}
@@ -1488,7 +1490,7 @@ my_decimal* Field_num::val_decimal(my_decimal *decimal_value)
}
-Field_str::Field_str(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
+Field_str::Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
const char *field_name_arg, CHARSET_INFO *charset_arg)
:Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
@@ -1639,7 +1641,7 @@ Field *Field::new_field(MEM_ROOT *root, struct st_table *new_table,
Field *Field::new_key_field(MEM_ROOT *root, struct st_table *new_table,
- char *new_ptr, uchar *new_null_ptr,
+ uchar *new_ptr, uchar *new_null_ptr,
uint new_null_bit)
{
Field *tmp;
@@ -1693,7 +1695,7 @@ Field_decimal::reset(void)
void Field_decimal::overflow(bool negative)
{
uint len=field_length;
- char *to=ptr, filler= '9';
+ uchar *to=ptr, filler= '9';
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
if (negative)
@@ -1729,36 +1731,37 @@ void Field_decimal::overflow(bool negative)
}
-int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
+int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs)
{
ASSERT_COLUMN_MARKED_FOR_WRITE;
char buff[STRING_BUFFER_USUAL_SIZE];
String tmp(buff,sizeof(buff), &my_charset_bin);
+ const uchar *from= (uchar*) from_arg;
- /* Convert character set if the old one is multi byte */
+ /* Convert character set if the old one is multi uchar */
if (cs->mbmaxlen > 1)
{
uint dummy_errors;
- tmp.copy(from, len, cs, &my_charset_bin, &dummy_errors);
- from= tmp.ptr();
+ tmp.copy((char*) from, len, cs, &my_charset_bin, &dummy_errors);
+ from= (uchar*) tmp.ptr();
len= tmp.length();
}
- const char *end= from+len;
+ const uchar *end= from+len;
/* The pointer where the field value starts (i.e., "where to write") */
- char *to=ptr;
+ uchar *to= ptr;
uint tmp_dec, tmp_uint;
/*
The sign of the number : will be 0 (means positive but sign not
specified), '+' or '-'
*/
- char sign_char=0;
+ uchar sign_char=0;
/* The pointers where prezeros start and stop */
- const char *pre_zeros_from, *pre_zeros_end;
+ const uchar *pre_zeros_from, *pre_zeros_end;
/* The pointers where digits at the left of '.' start and stop */
- const char *int_digits_from, *int_digits_end;
+ const uchar *int_digits_from, *int_digits_end;
/* The pointers where digits at the right of '.' start and stop */
- const char *frac_digits_from, *frac_digits_end;
+ const uchar *frac_digits_from, *frac_digits_end;
/* The sign of the exponent : will be 0 (means no exponent), '+' or '-' */
char expo_sign_char=0;
uint exponent=0; // value of the exponent
@@ -1766,20 +1769,20 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
Pointers used when digits move from the left of the '.' to the
right of the '.' (explained below)
*/
- const char *int_digits_tail_from;
+ const uchar *int_digits_tail_from;
/* Number of 0 that need to be added at the left of the '.' (1E3: 3 zeros) */
uint int_digits_added_zeros;
/*
Pointer used when digits move from the right of the '.' to the left
of the '.'
*/
- const char *frac_digits_head_end;
+ const uchar *frac_digits_head_end;
/* Number of 0 that need to be added at the right of the '.' (for 1E-3) */
uint frac_digits_added_zeros;
- char *pos,*tmp_left_pos,*tmp_right_pos;
+ uchar *pos,*tmp_left_pos,*tmp_right_pos;
/* Pointers that are used as limits (begin and end of the field buffer) */
- char *left_wall,*right_wall;
- char tmp_char;
+ uchar *left_wall,*right_wall;
+ uchar tmp_char;
/*
To remember if table->in_use->cuted_fields has already been incremented,
to do that only once
@@ -2116,17 +2119,18 @@ int Field_decimal::store(double nr)
}
#endif
- reg4 uint i,length;
- char fyllchar,*to;
+ reg4 uint i;
+ size_t length;
+ uchar fyllchar,*to;
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
fyllchar = zerofill ? (char) '0' : (char) ' ';
#ifdef HAVE_SNPRINTF
buff[sizeof(buff)-1]=0; // Safety
snprintf(buff,sizeof(buff)-1, "%.*f",(int) dec,nr);
- length=(uint) strlen(buff);
+ length= strlen(buff);
#else
- length=(uint) my_sprintf(buff,(buff,"%.*f",dec,nr));
+ length= my_sprintf(buff,(buff,"%.*f",dec,nr));
#endif
if (length > field_length)
@@ -2150,7 +2154,8 @@ int Field_decimal::store(longlong nr, bool unsigned_val)
ASSERT_COLUMN_MARKED_FOR_WRITE;
char buff[22];
uint length, int_part;
- char fyllchar, *to;
+ char fyllchar;
+ uchar *to;
if (nr < 0 && unsigned_flag && !unsigned_val)
{
@@ -2185,7 +2190,7 @@ double Field_decimal::val_real(void)
ASSERT_COLUMN_MARKED_FOR_READ;
int not_used;
char *end_not_used;
- return my_strntod(&my_charset_bin, ptr, field_length, &end_not_used,
+ return my_strntod(&my_charset_bin, (char*) ptr, field_length, &end_not_used,
&not_used);
}
@@ -2194,11 +2199,10 @@ longlong Field_decimal::val_int(void)
ASSERT_COLUMN_MARKED_FOR_READ;
int not_used;
if (unsigned_flag)
- return my_strntoull(&my_charset_bin, ptr, field_length, 10, NULL,
- &not_used);
- else
- return my_strntoll(&my_charset_bin, ptr, field_length, 10, NULL,
+ return my_strntoull(&my_charset_bin, (char*) ptr, field_length, 10, NULL,
&not_used);
+ return my_strntoll(&my_charset_bin, (char*) ptr, field_length, 10, NULL,
+ &not_used);
}
@@ -2206,10 +2210,12 @@ String *Field_decimal::val_str(String *val_buffer __attribute__((unused)),
String *val_ptr)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- char *str;
+ uchar *str;
+ size_t tmp_length;
+
for (str=ptr ; *str == ' ' ; str++) ;
- uint tmp_length=(uint) (str-ptr);
val_ptr->set_charset(&my_charset_bin);
+ tmp_length= (size_t) (str-ptr);
if (field_length < tmp_length) // Error in data
val_ptr->length(0);
else
@@ -2222,9 +2228,9 @@ String *Field_decimal::val_str(String *val_buffer __attribute__((unused)),
** 5.00 , -1.0, 05, -05, +5 with optional pre/end space
*/
-int Field_decimal::cmp(const char *a_ptr,const char *b_ptr)
+int Field_decimal::cmp(const uchar *a_ptr,const uchar *b_ptr)
{
- const char *end;
+ const uchar *end;
int swap=0;
/* First remove prefixes '0', ' ', and '-' */
for (end=a_ptr+field_length;
@@ -2255,9 +2261,9 @@ int Field_decimal::cmp(const char *a_ptr,const char *b_ptr)
}
-void Field_decimal::sort_string(char *to,uint length)
+void Field_decimal::sort_string(uchar *to,uint length)
{
- char *str,*end;
+ uchar *str,*end;
for (str=ptr,end=ptr+length;
str != end &&
((my_isspace(&my_charset_bin,*str) || *str == '+' ||
@@ -2299,7 +2305,7 @@ void Field_decimal::sql_type(String &res) const
** Field_new_decimal
****************************************************************************/
-Field_new_decimal::Field_new_decimal(char *ptr_arg,
+Field_new_decimal::Field_new_decimal(uchar *ptr_arg,
uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg,
@@ -2321,7 +2327,7 @@ Field_new_decimal::Field_new_decimal(uint32 len_arg,
const char *name,
uint8 dec_arg,
bool unsigned_arg)
- :Field_num((char*) 0, len_arg,
+ :Field_num((uchar*) 0, len_arg,
maybe_null_arg ? (uchar*) "": 0, 0,
NONE, name, dec_arg, 0, unsigned_arg)
{
@@ -2419,7 +2425,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value)
my_decimal2binary(E_DEC_FATAL_ERROR, &buff, ptr, precision, dec);
error= 1;
}
- DBUG_EXECUTE("info", print_decimal_buff(decimal_value, (byte *) ptr,
+ DBUG_EXECUTE("info", print_decimal_buff(decimal_value, (uchar *) ptr,
bin_size););
DBUG_RETURN(error);
}
@@ -2434,8 +2440,9 @@ int Field_new_decimal::store(const char *from, uint length,
DBUG_ENTER("Field_new_decimal::store(char*)");
if ((err= str2my_decimal(E_DEC_FATAL_ERROR &
- ~(E_DEC_OVERFLOW | E_DEC_BAD_NUM),
- from, length, charset_arg, &decimal_value)) &&
+ ~(E_DEC_OVERFLOW | E_DEC_BAD_NUM),
+ from, length, charset_arg,
+ &decimal_value)) &&
table->in_use->abort_on_warning)
{
/* Because "from" is not NUL-terminated and we use %s in the ER() */
@@ -2584,7 +2591,7 @@ my_decimal* Field_new_decimal::val_decimal(my_decimal *decimal_value)
DBUG_ENTER("Field_new_decimal::val_decimal");
binary2my_decimal(E_DEC_FATAL_ERROR, ptr, decimal_value,
precision, dec);
- DBUG_EXECUTE("info", print_decimal_buff(decimal_value, (byte *) ptr,
+ DBUG_EXECUTE("info", print_decimal_buff(decimal_value, (uchar *) ptr,
bin_size););
DBUG_RETURN(decimal_value);
}
@@ -2602,13 +2609,13 @@ String *Field_new_decimal::val_str(String *val_buffer,
}
-int Field_new_decimal::cmp(const char *a,const char*b)
+int Field_new_decimal::cmp(const uchar *a,const uchar*b)
{
return memcmp(a, b, bin_size);
}
-void Field_new_decimal::sort_string(char *buff,
+void Field_new_decimal::sort_string(uchar *buff,
uint length __attribute__((unused)))
{
memcpy(buff, ptr, bin_size);
@@ -2743,7 +2750,7 @@ int Field_tiny::store(longlong nr, bool unsigned_val)
double Field_tiny::val_real(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int tmp= unsigned_flag ? (int) ((uchar*) ptr)[0] :
+ int tmp= unsigned_flag ? (int) ptr[0] :
(int) ((signed char*) ptr)[0];
return (double) tmp;
}
@@ -2752,7 +2759,7 @@ double Field_tiny::val_real(void)
longlong Field_tiny::val_int(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int tmp= unsigned_flag ? (int) ((uchar*) ptr)[0] :
+ int tmp= unsigned_flag ? (int) ptr[0] :
(int) ((signed char*) ptr)[0];
return (longlong) tmp;
}
@@ -2770,7 +2777,7 @@ String *Field_tiny::val_str(String *val_buffer,
if (unsigned_flag)
length= (uint) cs->cset->long10_to_str(cs,to,mlength, 10,
- (long) *((uchar*) ptr));
+ (long) *ptr);
else
length= (uint) cs->cset->long10_to_str(cs,to,mlength,-10,
(long) *((signed char*) ptr));
@@ -2786,7 +2793,7 @@ bool Field_tiny::send_binary(Protocol *protocol)
return protocol->store_tiny((longlong) (int8) ptr[0]);
}
-int Field_tiny::cmp(const char *a_ptr, const char *b_ptr)
+int Field_tiny::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
signed char a,b;
a=(signed char) a_ptr[0]; b= (signed char) b_ptr[0];
@@ -2795,12 +2802,12 @@ int Field_tiny::cmp(const char *a_ptr, const char *b_ptr)
return (a < b) ? -1 : (a > b) ? 1 : 0;
}
-void Field_tiny::sort_string(char *to,uint length __attribute__((unused)))
+void Field_tiny::sort_string(uchar *to,uint length __attribute__((unused)))
{
if (unsigned_flag)
*to= *ptr;
else
- to[0] = (char) ((uchar) ptr[0] ^ (uchar) 128); /* Revers signbit */
+ to[0] = (char) (ptr[0] ^ (uchar) 128); /* Revers signbit */
}
void Field_tiny::sql_type(String &res) const
@@ -3005,7 +3012,7 @@ bool Field_short::send_binary(Protocol *protocol)
}
-int Field_short::cmp(const char *a_ptr, const char *b_ptr)
+int Field_short::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
short a,b;
#ifdef WORDS_BIGENDIAN
@@ -3027,7 +3034,7 @@ int Field_short::cmp(const char *a_ptr, const char *b_ptr)
return (a < b) ? -1 : (a > b) ? 1 : 0;
}
-void Field_short::sort_string(char *to,uint length __attribute__((unused)))
+void Field_short::sort_string(uchar *to,uint length __attribute__((unused)))
{
#ifdef WORDS_BIGENDIAN
if (!table->s->db_low_byte_first)
@@ -3213,7 +3220,7 @@ bool Field_medium::send_binary(Protocol *protocol)
}
-int Field_medium::cmp(const char *a_ptr, const char *b_ptr)
+int Field_medium::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
long a,b;
if (unsigned_flag)
@@ -3229,7 +3236,7 @@ int Field_medium::cmp(const char *a_ptr, const char *b_ptr)
return (a < b) ? -1 : (a > b) ? 1 : 0;
}
-void Field_medium::sort_string(char *to,uint length __attribute__((unused)))
+void Field_medium::sort_string(uchar *to,uint length __attribute__((unused)))
{
if (unsigned_flag)
to[0] = ptr[2];
@@ -3440,7 +3447,7 @@ bool Field_long::send_binary(Protocol *protocol)
return protocol->store_long(Field_long::val_int());
}
-int Field_long::cmp(const char *a_ptr, const char *b_ptr)
+int Field_long::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
int32 a,b;
#ifdef WORDS_BIGENDIAN
@@ -3460,7 +3467,7 @@ int Field_long::cmp(const char *a_ptr, const char *b_ptr)
return (a < b) ? -1 : (a > b) ? 1 : 0;
}
-void Field_long::sort_string(char *to,uint length __attribute__((unused)))
+void Field_long::sort_string(uchar *to,uint length __attribute__((unused)))
{
#ifdef WORDS_BIGENDIAN
if (!table->s->db_low_byte_first)
@@ -3680,7 +3687,7 @@ bool Field_longlong::send_binary(Protocol *protocol)
}
-int Field_longlong::cmp(const char *a_ptr, const char *b_ptr)
+int Field_longlong::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
longlong a,b;
#ifdef WORDS_BIGENDIAN
@@ -3701,7 +3708,7 @@ int Field_longlong::cmp(const char *a_ptr, const char *b_ptr)
return (a < b) ? -1 : (a > b) ? 1 : 0;
}
-void Field_longlong::sort_string(char *to,uint length __attribute__((unused)))
+void Field_longlong::sort_string(uchar *to,uint length __attribute__((unused)))
{
#ifdef WORDS_BIGENDIAN
if (!table->s->db_low_byte_first)
@@ -3826,7 +3833,7 @@ int Field_float::store(double nr)
}
else
#endif
- memcpy_fixed(ptr,(byte*) &j,sizeof(j));
+ memcpy_fixed(ptr,(uchar*) &j,sizeof(j));
return error;
}
@@ -3849,7 +3856,7 @@ double Field_float::val_real(void)
}
else
#endif
- memcpy_fixed((byte*) &j,ptr,sizeof(j));
+ memcpy_fixed((uchar*) &j,ptr,sizeof(j));
return ((double) j);
}
@@ -3863,7 +3870,7 @@ longlong Field_float::val_int(void)
}
else
#endif
- memcpy_fixed((byte*) &j,ptr,sizeof(j));
+ memcpy_fixed((uchar*) &j,ptr,sizeof(j));
return (longlong) rint(j);
}
@@ -3880,7 +3887,7 @@ String *Field_float::val_str(String *val_buffer,
}
else
#endif
- memcpy_fixed((byte*) &nr,ptr,sizeof(nr));
+ memcpy_fixed((uchar*) &nr,ptr,sizeof(nr));
uint to_length=max(field_length,70);
val_buffer->alloc(to_length);
@@ -3952,7 +3959,7 @@ String *Field_float::val_str(String *val_buffer,
}
-int Field_float::cmp(const char *a_ptr, const char *b_ptr)
+int Field_float::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
float a,b;
#ifdef WORDS_BIGENDIAN
@@ -3972,7 +3979,7 @@ int Field_float::cmp(const char *a_ptr, const char *b_ptr)
#define FLT_EXP_DIG (sizeof(float)*8-FLT_MANT_DIG)
-void Field_float::sort_string(char *to,uint length __attribute__((unused)))
+void Field_float::sort_string(uchar *to,uint length __attribute__((unused)))
{
float nr;
#ifdef WORDS_BIGENDIAN
@@ -3984,7 +3991,7 @@ void Field_float::sort_string(char *to,uint length __attribute__((unused)))
#endif
memcpy_fixed(&nr,ptr,sizeof(float));
- uchar *tmp= (uchar*) to;
+ uchar *tmp= to;
if (nr == (float) 0.0)
{ /* Change to zero string */
tmp[0]=(uchar) 128;
@@ -4284,7 +4291,7 @@ bool Field_double::send_binary(Protocol *protocol)
}
-int Field_double::cmp(const char *a_ptr, const char *b_ptr)
+int Field_double::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
ASSERT_COLUMN_MARKED_FOR_READ;
double a,b;
@@ -4308,7 +4315,7 @@ int Field_double::cmp(const char *a_ptr, const char *b_ptr)
/* The following should work for IEEE */
-void Field_double::sort_string(char *to,uint length __attribute__((unused)))
+void Field_double::sort_string(uchar *to,uint length __attribute__((unused)))
{
double nr;
#ifdef WORDS_BIGENDIAN
@@ -4319,7 +4326,7 @@ void Field_double::sort_string(char *to,uint length __attribute__((unused)))
else
#endif
doubleget(nr,ptr);
- change_double_for_sort(nr, (byte*) to);
+ change_double_for_sort(nr, to);
}
@@ -4384,7 +4391,7 @@ void Field_double::sql_type(String &res) const
exception is different behavior of old/new timestamps during ALTER TABLE.
*/
-Field_timestamp::Field_timestamp(char *ptr_arg, uint32 len_arg,
+Field_timestamp::Field_timestamp(uchar *ptr_arg, uint32 len_arg,
uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg,
const char *field_name_arg,
@@ -4407,7 +4414,7 @@ Field_timestamp::Field_timestamp(char *ptr_arg, uint32 len_arg,
Field_timestamp::Field_timestamp(bool maybe_null_arg,
const char *field_name_arg,
CHARSET_INFO *cs)
- :Field_str((char*) 0, 19, maybe_null_arg ? (uchar*) "": 0, 0,
+ :Field_str((uchar*) 0, 19, maybe_null_arg ? (uchar*) "": 0, 0,
NONE, field_name_arg, cs)
{
/* For 4.0 MYD and 4.0 InnoDB compatibility */
@@ -4720,7 +4727,7 @@ bool Field_timestamp::send_binary(Protocol *protocol)
}
-int Field_timestamp::cmp(const char *a_ptr, const char *b_ptr)
+int Field_timestamp::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
int32 a,b;
#ifdef WORDS_BIGENDIAN
@@ -4739,7 +4746,7 @@ int Field_timestamp::cmp(const char *a_ptr, const char *b_ptr)
}
-void Field_timestamp::sort_string(char *to,uint length __attribute__((unused)))
+void Field_timestamp::sort_string(uchar *to,uint length __attribute__((unused)))
{
#ifdef WORDS_BIGENDIAN
if (!table || !table->s->db_low_byte_first)
@@ -5021,7 +5028,7 @@ bool Field_time::send_binary(Protocol *protocol)
}
-int Field_time::cmp(const char *a_ptr, const char *b_ptr)
+int Field_time::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
int32 a,b;
a=(int32) sint3korr(a_ptr);
@@ -5029,7 +5036,7 @@ int Field_time::cmp(const char *a_ptr, const char *b_ptr)
return (a < b) ? -1 : (a > b) ? 1 : 0;
}
-void Field_time::sort_string(char *to,uint length __attribute__((unused)))
+void Field_time::sort_string(uchar *to,uint length __attribute__((unused)))
{
to[0] = (uchar) (ptr[2] ^ 128);
to[1] = ptr[1];
@@ -5133,7 +5140,7 @@ double Field_year::val_real(void)
longlong Field_year::val_int(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int tmp= (int) ((uchar*) ptr)[0];
+ int tmp= (int) ptr[0];
if (field_length != 4)
tmp%=100; // Return last 2 char
else if (tmp)
@@ -5327,7 +5334,7 @@ String *Field_date::val_str(String *val_buffer,
}
-int Field_date::cmp(const char *a_ptr, const char *b_ptr)
+int Field_date::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
int32 a,b;
#ifdef WORDS_BIGENDIAN
@@ -5346,7 +5353,7 @@ int Field_date::cmp(const char *a_ptr, const char *b_ptr)
}
-void Field_date::sort_string(char *to,uint length __attribute__((unused)))
+void Field_date::sort_string(uchar *to,uint length __attribute__((unused)))
{
#ifdef WORDS_BIGENDIAN
if (!table || !table->s->db_low_byte_first)
@@ -5578,7 +5585,7 @@ bool Field_newdate::get_time(MYSQL_TIME *ltime)
}
-int Field_newdate::cmp(const char *a_ptr, const char *b_ptr)
+int Field_newdate::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
uint32 a,b;
a=(uint32) uint3korr(a_ptr);
@@ -5587,7 +5594,7 @@ int Field_newdate::cmp(const char *a_ptr, const char *b_ptr)
}
-void Field_newdate::sort_string(char *to,uint length __attribute__((unused)))
+void Field_newdate::sort_string(uchar *to,uint length __attribute__((unused)))
{
to[0] = ptr[2];
to[1] = ptr[1];
@@ -5843,7 +5850,7 @@ bool Field_datetime::get_time(MYSQL_TIME *ltime)
return Field_datetime::get_date(ltime,0);
}
-int Field_datetime::cmp(const char *a_ptr, const char *b_ptr)
+int Field_datetime::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
longlong a,b;
#ifdef WORDS_BIGENDIAN
@@ -5862,7 +5869,7 @@ int Field_datetime::cmp(const char *a_ptr, const char *b_ptr)
((ulonglong) a > (ulonglong) b) ? 1 : 0;
}
-void Field_datetime::sort_string(char *to,uint length __attribute__((unused)))
+void Field_datetime::sort_string(uchar *to,uint length __attribute__((unused)))
{
#ifdef WORDS_BIGENDIAN
if (!table || !table->s->db_low_byte_first)
@@ -6013,7 +6020,7 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
DBUG_ASSERT(table->in_use == current_thd);
copy_length= well_formed_copy_nchars(field_charset,
- ptr, field_length,
+ (char*) ptr, field_length,
cs, from, length,
field_length / field_charset->mbmaxlen,
&well_formed_error_pos,
@@ -6022,7 +6029,7 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
/* Append spaces if the string was shorter than the field. */
if (copy_length < field_length)
- field_charset->cset->fill(field_charset,ptr+copy_length,
+ field_charset->cset->fill(field_charset,(char*) ptr+copy_length,
field_length-copy_length,
field_charset->pad_char);
@@ -6089,7 +6096,7 @@ int Field_str::store(double nr)
like inserting 500.0 in char(1)
*/
DBUG_ASSERT(local_char_length < 5 || length <= local_char_length+1);
- return store((const char *) buff, length, charset());
+ return store(buff, length, charset());
}
@@ -6149,14 +6156,15 @@ double Field_string::val_real(void)
CHARSET_INFO *cs= charset();
double result;
- result= my_strntod(cs,ptr,field_length,&end,&error);
+ result= my_strntod(cs,(char*) ptr,field_length,&end,&error);
if (!table->in_use->no_errors &&
- (error || (field_length != (uint32)(end - ptr) &&
- !check_if_only_end_space(cs, end, ptr + field_length))))
+ (error || (field_length != (uint32)(end - (char*) ptr) &&
+ !check_if_only_end_space(cs, end,
+ (char*) ptr + field_length))))
{
char buf[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
String tmp(buf, sizeof(buf), cs);
- tmp.copy(ptr, field_length, cs);
+ tmp.copy((char*) ptr, field_length, cs);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE),
@@ -6174,14 +6182,15 @@ longlong Field_string::val_int(void)
CHARSET_INFO *cs= charset();
longlong result;
- result= my_strntoll(cs,ptr,field_length,10,&end,&error);
+ result= my_strntoll(cs, (char*) ptr,field_length,10,&end,&error);
if (!table->in_use->no_errors &&
- (error || (field_length != (uint32)(end - ptr) &&
- !check_if_only_end_space(cs, end, ptr + field_length))))
+ (error || (field_length != (uint32)(end - (char*) ptr) &&
+ !check_if_only_end_space(cs, end,
+ (char*) ptr + field_length))))
{
char buf[LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE];
String tmp(buf, sizeof(buf), cs);
- tmp.copy(ptr, field_length, cs);
+ tmp.copy((char*) ptr, field_length, cs);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE),
@@ -6202,7 +6211,8 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)),
MODE_PAD_CHAR_TO_FULL_LENGTH)
length= my_charpos(field_charset, ptr, ptr + field_length, field_length);
else
- length= field_charset->cset->lengthsp(field_charset, ptr, field_length);
+ length= field_charset->cset->lengthsp(field_charset, (const char*) ptr,
+ field_length);
val_ptr->set((const char*) ptr, length, field_charset);
return val_ptr;
}
@@ -6211,14 +6221,14 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)),
my_decimal *Field_string::val_decimal(my_decimal *decimal_value)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int err= str2my_decimal(E_DEC_FATAL_ERROR, ptr, field_length, charset(),
- decimal_value);
+ int err= str2my_decimal(E_DEC_FATAL_ERROR, (char*) ptr, field_length,
+ charset(), decimal_value);
if (!table->in_use->no_errors && err)
{
char buf[DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE];
CHARSET_INFO *cs= charset();
String tmp(buf, sizeof(buf), cs);
- tmp.copy(ptr, field_length, cs);
+ tmp.copy((char*) ptr, field_length, cs);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE),
@@ -6229,7 +6239,7 @@ my_decimal *Field_string::val_decimal(my_decimal *decimal_value)
}
-int Field_string::cmp(const char *a_ptr, const char *b_ptr)
+int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
uint a_len, b_len;
@@ -6246,17 +6256,17 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
like in latin_de 'ae' and 0xe4
*/
return field_charset->coll->strnncollsp(field_charset,
- (const uchar*) a_ptr, a_len,
- (const uchar*) b_ptr, b_len,
+ a_ptr, a_len,
+ b_ptr, b_len,
0);
}
-void Field_string::sort_string(char *to,uint length)
+void Field_string::sort_string(uchar *to,uint length)
{
IF_DBUG(uint tmp=) my_strnxfrm(field_charset,
- (uchar*) to, length,
- (uchar*) ptr, field_length);
+ to, length,
+ ptr, field_length);
DBUG_ASSERT(tmp == length);
}
@@ -6281,7 +6291,7 @@ void Field_string::sql_type(String &res) const
}
-char *Field_string::pack(char *to, const char *from, uint max_length)
+uchar *Field_string::pack(uchar *to, const uchar *from, uint max_length)
{
uint length= min(field_length,max_length);
uint local_char_length= max_length/field_charset->mbmaxlen;
@@ -6291,15 +6301,15 @@ char *Field_string::pack(char *to, const char *from, uint max_length)
set_if_smaller(length, local_char_length);
while (length && from[length-1] == ' ')
length--;
- *to++= (char) (uchar) length;
+ *to++= (uchar) length;
if (field_length > 255)
- *to++= (char) (uchar) (length >> 8);
+ *to++= (uchar) (length >> 8);
memcpy(to, from, length);
return to+length;
}
-const char *Field_string::unpack(char *to, const char *from)
+const uchar *Field_string::unpack(uchar *to, const uchar *from)
{
uint length;
if (field_length > 255)
@@ -6308,7 +6318,7 @@ const char *Field_string::unpack(char *to, const char *from)
from+= 2;
}
else
- length= (uint) (uchar) *from++;
+ length= (uint) *from++;
memcpy(to, from, (int) length);
bfill(to+length, field_length - length, ' ');
return from+length;
@@ -6331,7 +6341,7 @@ const char *Field_string::unpack(char *to, const char *from)
> 0 a > b
*/
-int Field_string::pack_cmp(const char *a, const char *b, uint length,
+int Field_string::pack_cmp(const uchar *a, const uchar *b, uint length,
my_bool insert_or_update)
{
uint a_length, b_length;
@@ -6344,12 +6354,12 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length,
}
else
{
- a_length= (uint) (uchar) *a++;
- b_length= (uint) (uchar) *b++;
+ a_length= (uint) *a++;
+ b_length= (uint) *b++;
}
return field_charset->coll->strnncollsp(field_charset,
- (const uchar*) a, a_length,
- (const uchar*) b, b_length,
+ a, a_length,
+ b, b_length,
insert_or_update);
}
@@ -6369,18 +6379,18 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length,
> 0 row > key
*/
-int Field_string::pack_cmp(const char *key, uint length,
+int Field_string::pack_cmp(const uchar *key, uint length,
my_bool insert_or_update)
{
uint row_length, local_key_length;
- char *end;
+ uchar *end;
if (length > 255)
{
local_key_length= uint2korr(key);
key+= 2;
}
else
- local_key_length= (uint) (uchar) *key++;
+ local_key_length= (uint) *key++;
/* Only use 'length' of key, not field_length */
end= ptr + length;
@@ -6389,17 +6399,17 @@ int Field_string::pack_cmp(const char *key, uint length,
row_length= (uint) (end - ptr);
return field_charset->coll->strnncollsp(field_charset,
- (const uchar*) ptr, row_length,
- (const uchar*) key, local_key_length,
+ ptr, row_length,
+ key, local_key_length,
insert_or_update);
}
-uint Field_string::packed_col_length(const char *data_ptr, uint length)
+uint Field_string::packed_col_length(const uchar *data_ptr, uint length)
{
if (length > 255)
return uint2korr(data_ptr)+2;
- return (uint) ((uchar) *data_ptr)+1;
+ return (uint) *data_ptr + 1;
}
@@ -6408,9 +6418,11 @@ uint Field_string::max_packed_col_length(uint max_length)
return (max_length > 255 ? 2 : 1)+max_length;
}
-uint Field_string::get_key_image(char *buff, uint length, imagetype type_arg)
+
+uint Field_string::get_key_image(uchar *buff, uint length, imagetype type_arg)
{
- uint bytes = my_charpos(field_charset, ptr, ptr + field_length,
+ uint bytes = my_charpos(field_charset, (char*) ptr,
+ (char*) ptr + field_length,
length / field_charset->mbmaxlen);
memcpy(buff, ptr, bytes);
if (bytes < length)
@@ -6418,6 +6430,7 @@ uint Field_string::get_key_image(char *buff, uint length, imagetype type_arg)
return bytes;
}
+
Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table,
bool keep_type)
{
@@ -6471,7 +6484,8 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
const char *from_end_pos;
copy_length= well_formed_copy_nchars(field_charset,
- ptr + length_bytes, field_length,
+ (char*) ptr + length_bytes,
+ field_length,
cs, from, length,
field_length / field_charset->mbmaxlen,
&well_formed_error_pos,
@@ -6519,9 +6533,9 @@ double Field_varstring::val_real(void)
ASSERT_COLUMN_MARKED_FOR_READ;
int not_used;
char *end_not_used;
- uint length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
- return my_strntod(field_charset, ptr+length_bytes, length, &end_not_used,
- &not_used);
+ uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
+ return my_strntod(field_charset, (char*) ptr+length_bytes, length,
+ &end_not_used, &not_used);
}
@@ -6530,8 +6544,8 @@ longlong Field_varstring::val_int(void)
ASSERT_COLUMN_MARKED_FOR_READ;
int not_used;
char *end_not_used;
- uint length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
- return my_strntoll(field_charset, ptr+length_bytes, length, 10,
+ uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
+ return my_strntoll(field_charset, (char*) ptr+length_bytes, length, 10,
&end_not_used, &not_used);
}
@@ -6539,7 +6553,7 @@ String *Field_varstring::val_str(String *val_buffer __attribute__((unused)),
String *val_ptr)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- uint length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
+ uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
val_ptr->set((const char*) ptr+length_bytes, length, field_charset);
return val_ptr;
}
@@ -6548,14 +6562,14 @@ String *Field_varstring::val_str(String *val_buffer __attribute__((unused)),
my_decimal *Field_varstring::val_decimal(my_decimal *decimal_value)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- uint length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
- str2my_decimal(E_DEC_FATAL_ERROR, ptr+length_bytes, length, charset(),
- decimal_value);
+ uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
+ str2my_decimal(E_DEC_FATAL_ERROR, (char*) ptr+length_bytes, length,
+ charset(), decimal_value);
return decimal_value;
}
-int Field_varstring::cmp_max(const char *a_ptr, const char *b_ptr,
+int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
uint max_len)
{
uint a_length, b_length;
@@ -6563,8 +6577,8 @@ int Field_varstring::cmp_max(const char *a_ptr, const char *b_ptr,
if (length_bytes == 1)
{
- a_length= (uint) (uchar) *a_ptr;
- b_length= (uint) (uchar) *b_ptr;
+ a_length= (uint) *a_ptr;
+ b_length= (uint) *b_ptr;
}
else
{
@@ -6574,10 +6588,10 @@ int Field_varstring::cmp_max(const char *a_ptr, const char *b_ptr,
set_if_smaller(a_length, max_len);
set_if_smaller(b_length, max_len);
diff= field_charset->coll->strnncollsp(field_charset,
- (const uchar*) a_ptr+
+ a_ptr+
length_bytes,
a_length,
- (const uchar*) b_ptr+
+ b_ptr+
length_bytes,
b_length,0);
return diff;
@@ -6588,18 +6602,18 @@ int Field_varstring::cmp_max(const char *a_ptr, const char *b_ptr,
NOTE: varstring and blob keys are ALWAYS stored with a 2 byte length prefix
*/
-int Field_varstring::key_cmp(const byte *key_ptr, uint max_key_length)
+int Field_varstring::key_cmp(const uchar *key_ptr, uint max_key_length)
{
- uint length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
+ uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
uint local_char_length= max_key_length / field_charset->mbmaxlen;
local_char_length= my_charpos(field_charset, ptr + length_bytes,
ptr + length_bytes + length, local_char_length);
set_if_smaller(length, local_char_length);
return field_charset->coll->strnncollsp(field_charset,
- (const uchar*) ptr + length_bytes,
+ ptr + length_bytes,
length,
- (const uchar*) key_ptr+
+ key_ptr+
HA_KEY_BLOB_LENGTH,
uint2korr(key_ptr), 0);
}
@@ -6613,22 +6627,20 @@ int Field_varstring::key_cmp(const byte *key_ptr, uint max_key_length)
(keys are created and compared in key.cc)
*/
-int Field_varstring::key_cmp(const byte *a,const byte *b)
+int Field_varstring::key_cmp(const uchar *a,const uchar *b)
{
return field_charset->coll->strnncollsp(field_charset,
- (const uchar*) a +
- HA_KEY_BLOB_LENGTH,
+ a + HA_KEY_BLOB_LENGTH,
uint2korr(a),
- (const uchar*) b +
- HA_KEY_BLOB_LENGTH,
+ b + HA_KEY_BLOB_LENGTH,
uint2korr(b),
0);
}
-void Field_varstring::sort_string(char *to,uint length)
+void Field_varstring::sort_string(uchar *to,uint length)
{
- uint tot_length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
+ uint tot_length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
if (field_charset == &my_charset_bin)
{
@@ -6641,8 +6653,7 @@ void Field_varstring::sort_string(char *to,uint length)
}
tot_length= my_strnxfrm(field_charset,
- (uchar*) to, length,
- (uchar*) ptr + length_bytes,
+ to, length, ptr + length_bytes,
tot_length);
DBUG_ASSERT(tot_length == length);
}
@@ -6679,7 +6690,7 @@ void Field_varstring::sql_type(String &res) const
uint32 Field_varstring::data_length()
{
- return length_bytes == 1 ? (uint32) (uchar) *ptr : uint2korr(ptr);
+ return length_bytes == 1 ? (uint32) *ptr : uint2korr(ptr);
}
/*
@@ -6687,9 +6698,9 @@ uint32 Field_varstring::data_length()
Here the number of length bytes are depending on the given max_length
*/
-char *Field_varstring::pack(char *to, const char *from, uint max_length)
+uchar *Field_varstring::pack(uchar *to, const uchar *from, uint max_length)
{
- uint length= length_bytes == 1 ? (uint) (uchar) *from : uint2korr(from);
+ uint length= length_bytes == 1 ? (uint) *from : uint2korr(from);
set_if_smaller(max_length, field_length);
if (length > max_length)
length=max_length;
@@ -6702,9 +6713,9 @@ char *Field_varstring::pack(char *to, const char *from, uint max_length)
}
-char *Field_varstring::pack_key(char *to, const char *key, uint max_length)
+uchar *Field_varstring::pack_key(uchar *to, const uchar *key, uint max_length)
{
- uint length= length_bytes == 1 ? (uint) (uchar) *key : uint2korr(key);
+ uint length= length_bytes == 1 ? (uint) *key : uint2korr(key);
uint local_char_length= ((field_charset->mbmaxlen > 1) ?
max_length/field_charset->mbmaxlen : max_length);
key+= length_bytes;
@@ -6741,13 +6752,13 @@ char *Field_varstring::pack_key(char *to, const char *key, uint max_length)
Pointer to end of 'key' (To the next key part if multi-segment key)
*/
-const char *Field_varstring::unpack_key(char *to, const char *key,
- uint max_length)
+const uchar *Field_varstring::unpack_key(uchar *to, const uchar *key,
+ uint max_length)
{
/* get length of the blob key */
- uint32 length= *((uchar*) key++);
+ uint32 length= *key++;
if (max_length > 255)
- length+= (*((uchar*) key++)) << 8;
+ length+= (*key++) << 8;
/* put the length into the record buffer */
if (length_bytes == 1)
@@ -6771,8 +6782,8 @@ const char *Field_varstring::unpack_key(char *to, const char *key,
end of key storage
*/
-char *Field_varstring::pack_key_from_key_image(char *to, const char *from,
- uint max_length)
+uchar *Field_varstring::pack_key_from_key_image(uchar *to, const uchar *from,
+ uint max_length)
{
/* Key length is always stored as 2 bytes */
uint length= uint2korr(from);
@@ -6791,11 +6802,11 @@ char *Field_varstring::pack_key_from_key_image(char *to, const char *from,
unpack field packed with Field_varstring::pack()
*/
-const char *Field_varstring::unpack(char *to, const char *from)
+const uchar *Field_varstring::unpack(uchar *to, const uchar *from)
{
uint length;
if (length_bytes == 1)
- length= (uint) (uchar) (*to= *from++);
+ length= (uint) (*to= *from++);
else
{
length= uint2korr(from);
@@ -6808,7 +6819,7 @@ const char *Field_varstring::unpack(char *to, const char *from)
}
-int Field_varstring::pack_cmp(const char *a, const char *b,
+int Field_varstring::pack_cmp(const uchar *a, const uchar *b,
uint key_length_arg,
my_bool insert_or_update)
{
@@ -6820,21 +6831,21 @@ int Field_varstring::pack_cmp(const char *a, const char *b,
}
else
{
- a_length= (uint) (uchar) *a++;
- b_length= (uint) (uchar) *b++;
+ a_length= (uint) *a++;
+ b_length= (uint) *b++;
}
return field_charset->coll->strnncollsp(field_charset,
- (const uchar*) a, a_length,
- (const uchar*) b, b_length,
+ a, a_length,
+ b, b_length,
insert_or_update);
}
-int Field_varstring::pack_cmp(const char *b, uint key_length_arg,
+int Field_varstring::pack_cmp(const uchar *b, uint key_length_arg,
my_bool insert_or_update)
{
- char *a= ptr+ length_bytes;
- uint a_length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
+ uchar *a= ptr+ length_bytes;
+ uint a_length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
uint b_length;
uint local_char_length= ((field_charset->mbmaxlen > 1) ?
key_length_arg / field_charset->mbmaxlen :
@@ -6845,7 +6856,7 @@ int Field_varstring::pack_cmp(const char *b, uint key_length_arg,
b_length=uint2korr(b); b+= HA_KEY_BLOB_LENGTH;
}
else
- b_length= (uint) (uchar) *b++;
+ b_length= (uint) *b++;
if (a_length > local_char_length)
{
@@ -6855,18 +6866,17 @@ int Field_varstring::pack_cmp(const char *b, uint key_length_arg,
}
return field_charset->coll->strnncollsp(field_charset,
- (const uchar*) a,
- a_length,
- (const uchar*) b, b_length,
+ a, a_length,
+ b, b_length,
insert_or_update);
}
-uint Field_varstring::packed_col_length(const char *data_ptr, uint length)
+uint Field_varstring::packed_col_length(const uchar *data_ptr, uint length)
{
if (length > 255)
return uint2korr(data_ptr)+2;
- return (uint) ((uchar) *data_ptr)+1;
+ return (uint) *data_ptr + 1;
}
@@ -6875,11 +6885,11 @@ uint Field_varstring::max_packed_col_length(uint max_length)
return (max_length > 255 ? 2 : 1)+max_length;
}
-uint Field_varstring::get_key_image(char *buff, uint length, imagetype type)
+uint Field_varstring::get_key_image(uchar *buff, uint length, imagetype type)
{
- uint f_length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
+ uint f_length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
uint local_char_length= length / field_charset->mbmaxlen;
- char *pos= ptr+length_bytes;
+ uchar *pos= ptr+length_bytes;
local_char_length= my_charpos(field_charset, pos, pos + f_length,
local_char_length);
set_if_smaller(f_length, local_char_length);
@@ -6898,23 +6908,23 @@ uint Field_varstring::get_key_image(char *buff, uint length, imagetype type)
}
-void Field_varstring::set_key_image(char *buff,uint length)
+void Field_varstring::set_key_image(const uchar *buff,uint length)
{
length= uint2korr(buff); // Real length is here
- (void) Field_varstring::store(buff+HA_KEY_BLOB_LENGTH, length,
+ (void) Field_varstring::store((const char*) buff+HA_KEY_BLOB_LENGTH, length,
field_charset);
}
-int Field_varstring::cmp_binary(const char *a_ptr, const char *b_ptr,
+int Field_varstring::cmp_binary(const uchar *a_ptr, const uchar *b_ptr,
uint32 max_length)
{
uint32 a_length,b_length;
if (length_bytes == 1)
{
- a_length= (uint) (uchar) *a_ptr;
- b_length= (uint) (uchar) *b_ptr;
+ a_length= (uint) *a_ptr;
+ b_length= (uint) *b_ptr;
}
else
{
@@ -6942,7 +6952,7 @@ Field *Field_varstring::new_field(MEM_ROOT *root, struct st_table *new_table,
Field *Field_varstring::new_key_field(MEM_ROOT *root,
struct st_table *new_table,
- char *new_ptr, uchar *new_null_ptr,
+ uchar *new_ptr, uchar *new_null_ptr,
uint new_null_bit)
{
Field_varstring *res;
@@ -6983,9 +6993,9 @@ void Field_varstring::hash(ulong *nr, ulong *nr2)
}
else
{
- uint len= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
+ uint len= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
CHARSET_INFO *cs= charset();
- cs->coll->hash_sort(cs, (uchar*) ptr + length_bytes, len, nr, nr2);
+ cs->coll->hash_sort(cs, ptr + length_bytes, len, nr, nr2);
}
}
@@ -6996,7 +7006,7 @@ void Field_varstring::hash(ulong *nr, ulong *nr2)
** packlength slot and may be from 1-4.
****************************************************************************/
-Field_blob::Field_blob(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
+Field_blob::Field_blob(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
TABLE_SHARE *share, uint blob_pack_length,
CHARSET_INFO *cs)
@@ -7043,11 +7053,11 @@ void Field_blob::store_length(uint32 number)
}
-uint32 Field_blob::get_length(const char *pos)
+uint32 Field_blob::get_length(const uchar *pos)
{
switch (packlength) {
case 1:
- return (uint32) (uchar) pos[0];
+ return (uint32) pos[0];
case 2:
{
uint16 tmp;
@@ -7094,7 +7104,7 @@ uint32 Field_blob::get_length(const char *pos)
nothing
*/
-void Field_blob::put_length(char *pos, uint32 length)
+void Field_blob::put_length(uchar *pos, uint32 length)
{
switch (packlength) {
case 1:
@@ -7162,7 +7172,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
Field_blob::store_length(copy_length);
tmp= value.ptr();
- bmove(ptr+packlength,(char*) &tmp,sizeof(char*));
+ bmove(ptr+packlength,(uchar*) &tmp,sizeof(char*));
if (check_string_copy_error(this, well_formed_error_pos,
cannot_convert_error_pos, from + length))
@@ -7246,29 +7256,35 @@ my_decimal *Field_blob::val_decimal(my_decimal *decimal_value)
{
ASSERT_COLUMN_MARKED_FOR_READ;
const char *blob;
- memcpy_fixed(&blob, ptr+packlength, sizeof(const char*));
+ size_t length;
+ memcpy_fixed(&blob, ptr+packlength, sizeof(const uchar*));
if (!blob)
+ {
blob= "";
- str2my_decimal(E_DEC_FATAL_ERROR, blob, get_length(ptr), charset(),
+ length= 0;
+ }
+ else
+ length= get_length(ptr);
+
+ str2my_decimal(E_DEC_FATAL_ERROR, blob, length, charset(),
decimal_value);
return decimal_value;
}
-int Field_blob::cmp(const char *a,uint32 a_length, const char *b,
+int Field_blob::cmp(const uchar *a,uint32 a_length, const uchar *b,
uint32 b_length)
{
return field_charset->coll->strnncollsp(field_charset,
- (const uchar*)a, a_length,
- (const uchar*)b, b_length,
+ a, a_length, b, b_length,
0);
}
-int Field_blob::cmp_max(const char *a_ptr, const char *b_ptr,
+int Field_blob::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
uint max_length)
{
- char *blob1,*blob2;
+ uchar *blob1,*blob2;
memcpy_fixed(&blob1,a_ptr+packlength,sizeof(char*));
memcpy_fixed(&blob2,b_ptr+packlength,sizeof(char*));
uint a_len= get_length(a_ptr), b_len= get_length(b_ptr);
@@ -7278,7 +7294,7 @@ int Field_blob::cmp_max(const char *a_ptr, const char *b_ptr,
}
-int Field_blob::cmp_binary(const char *a_ptr, const char *b_ptr,
+int Field_blob::cmp_binary(const uchar *a_ptr, const uchar *b_ptr,
uint32 max_length)
{
char *a,*b;
@@ -7299,10 +7315,10 @@ int Field_blob::cmp_binary(const char *a_ptr, const char *b_ptr,
/* The following is used only when comparing a key */
-uint Field_blob::get_key_image(char *buff,uint length, imagetype type_arg)
+uint Field_blob::get_key_image(uchar *buff,uint length, imagetype type_arg)
{
uint32 blob_length= get_length(ptr);
- char *blob;
+ uchar *blob;
#ifdef HAVE_SPATIAL
if (type_arg == itMBR)
@@ -7319,7 +7335,7 @@ uint Field_blob::get_key_image(char *buff,uint length, imagetype type_arg)
return image_length;
}
get_ptr(&blob);
- gobj= Geometry::construct(&buffer, blob, blob_length);
+ gobj= Geometry::construct(&buffer, (char*) blob, blob_length);
if (!gobj || gobj->get_mbr(&mbr, &dummy))
bzero(buff, image_length);
else
@@ -7354,16 +7370,17 @@ uint Field_blob::get_key_image(char *buff,uint length, imagetype type_arg)
}
-void Field_blob::set_key_image(char *buff,uint length)
+void Field_blob::set_key_image(const uchar *buff,uint length)
{
length= uint2korr(buff);
- (void) Field_blob::store(buff+HA_KEY_BLOB_LENGTH, length, field_charset);
+ (void) Field_blob::store((const char*) buff+HA_KEY_BLOB_LENGTH, length,
+ field_charset);
}
-int Field_blob::key_cmp(const byte *key_ptr, uint max_key_length)
+int Field_blob::key_cmp(const uchar *key_ptr, uint max_key_length)
{
- char *blob1;
+ uchar *blob1;
uint blob_length=get_length(ptr);
memcpy_fixed(&blob1,ptr+packlength,sizeof(char*));
CHARSET_INFO *cs= charset();
@@ -7372,14 +7389,14 @@ int Field_blob::key_cmp(const byte *key_ptr, uint max_key_length)
local_char_length);
set_if_smaller(blob_length, local_char_length);
return Field_blob::cmp(blob1, blob_length,
- (char*) key_ptr+HA_KEY_BLOB_LENGTH,
+ key_ptr+HA_KEY_BLOB_LENGTH,
uint2korr(key_ptr));
}
-int Field_blob::key_cmp(const byte *a,const byte *b)
+int Field_blob::key_cmp(const uchar *a,const uchar *b)
{
- return Field_blob::cmp((char*) a+HA_KEY_BLOB_LENGTH, uint2korr(a),
- (char*) b+HA_KEY_BLOB_LENGTH, uint2korr(b));
+ return Field_blob::cmp(a+HA_KEY_BLOB_LENGTH, uint2korr(a),
+ b+HA_KEY_BLOB_LENGTH, uint2korr(b));
}
@@ -7390,9 +7407,9 @@ uint32 Field_blob::sort_length() const
}
-void Field_blob::sort_string(char *to,uint length)
+void Field_blob::sort_string(uchar *to,uint length)
{
- char *blob;
+ uchar *blob;
uint blob_length=get_length();
if (!blob_length)
@@ -7401,7 +7418,7 @@ void Field_blob::sort_string(char *to,uint length)
{
if (field_charset == &my_charset_bin)
{
- char *pos;
+ uchar *pos;
/*
Store length of blob last in blob to shorter blobs before longer blobs
@@ -7427,8 +7444,7 @@ void Field_blob::sort_string(char *to,uint length)
memcpy_fixed(&blob,ptr+packlength,sizeof(char*));
blob_length=my_strnxfrm(field_charset,
- (uchar*) to, length,
- (uchar*) blob, blob_length);
+ to, length, blob, blob_length);
DBUG_ASSERT(blob_length == length);
}
}
@@ -7454,23 +7470,23 @@ void Field_blob::sql_type(String &res) const
}
-char *Field_blob::pack(char *to, const char *from, uint max_length)
+uchar *Field_blob::pack(uchar *to, const uchar *from, uint max_length)
{
- char *save=ptr;
- ptr=(char*) from;
+ uchar *save= ptr;
+ ptr= (uchar*) from;
uint32 length=get_length(); // Length of from string
if (length > max_length)
{
ptr=to;
length=max_length;
store_length(length); // Store max length
- ptr=(char*) from;
+ ptr= (uchar*) from;
}
else
memcpy(to,from,packlength); // Copy length
if (length)
{
- get_ptr((char**) &from);
+ get_ptr((uchar**) &from);
memcpy(to+packlength, from,length);
}
ptr=save; // Restore org row pointer
@@ -7478,7 +7494,7 @@ char *Field_blob::pack(char *to, const char *from, uint max_length)
}
-const char *Field_blob::unpack(char *to, const char *from)
+const uchar *Field_blob::unpack(uchar *to, const uchar *from)
{
memcpy(to,from,packlength);
uint32 length=get_length(from);
@@ -7492,7 +7508,7 @@ const char *Field_blob::unpack(char *to, const char *from)
/* Keys for blobs are like keys on varchars */
-int Field_blob::pack_cmp(const char *a, const char *b, uint key_length_arg,
+int Field_blob::pack_cmp(const uchar *a, const uchar *b, uint key_length_arg,
my_bool insert_or_update)
{
uint a_length, b_length;
@@ -7503,20 +7519,20 @@ int Field_blob::pack_cmp(const char *a, const char *b, uint key_length_arg,
}
else
{
- a_length= (uint) (uchar) *a++;
- b_length= (uint) (uchar) *b++;
+ a_length= (uint) *a++;
+ b_length= (uint) *b++;
}
return field_charset->coll->strnncollsp(field_charset,
- (const uchar*) a, a_length,
- (const uchar*) b, b_length,
+ a, a_length,
+ b, b_length,
insert_or_update);
}
-int Field_blob::pack_cmp(const char *b, uint key_length_arg,
+int Field_blob::pack_cmp(const uchar *b, uint key_length_arg,
my_bool insert_or_update)
{
- char *a;
+ uchar *a;
uint a_length, b_length;
memcpy_fixed(&a,ptr+packlength,sizeof(char*));
if (!a)
@@ -7528,24 +7544,24 @@ int Field_blob::pack_cmp(const char *b, uint key_length_arg,
b_length= uint2korr(b); b+=2;
}
else
- b_length= (uint) (uchar) *b++;
+ b_length= (uint) *b++;
return field_charset->coll->strnncollsp(field_charset,
- (const uchar*) a, a_length,
- (const uchar*) b, b_length,
+ a, a_length,
+ b, b_length,
insert_or_update);
}
/* Create a packed key that will be used for storage from a MySQL row */
-char *Field_blob::pack_key(char *to, const char *from, uint max_length)
+uchar *Field_blob::pack_key(uchar *to, const uchar *from, uint max_length)
{
- char *save=ptr;
- ptr=(char*) from;
+ uchar *save= ptr;
+ ptr= (uchar*) from;
uint32 length=get_length(); // Length of from string
uint local_char_length= ((field_charset->mbmaxlen > 1) ?
- max_length/field_charset->mbmaxlen : max_length);
+ max_length/field_charset->mbmaxlen : max_length);
if (length)
- get_ptr((char**) &from);
+ get_ptr((uchar**) &from);
if (length > local_char_length)
local_char_length= my_charpos(field_charset, from, from+length,
local_char_length);
@@ -7582,12 +7598,13 @@ char *Field_blob::pack_key(char *to, const char *from, uint max_length)
Pointer into 'from' past the last byte copied from packed key.
*/
-const char *Field_blob::unpack_key(char *to, const char *from, uint max_length)
+const uchar *Field_blob::unpack_key(uchar *to, const uchar *from,
+ uint max_length)
{
/* get length of the blob key */
- uint32 length= *((uchar*) from++);
+ uint32 length= *from++;
if (max_length > 255)
- length+= (*((uchar*) from++)) << 8;
+ length+= *from++ << 8;
/* put the length into the record buffer */
put_length(to, length);
@@ -7605,8 +7622,8 @@ const char *Field_blob::unpack_key(char *to, const char *from, uint max_length)
/* Create a packed key that will be used for storage from a MySQL key */
-char *Field_blob::pack_key_from_key_image(char *to, const char *from,
- uint max_length)
+uchar *Field_blob::pack_key_from_key_image(uchar *to, const uchar *from,
+ uint max_length)
{
uint length=uint2korr(from);
if (length > max_length)
@@ -7620,11 +7637,11 @@ char *Field_blob::pack_key_from_key_image(char *to, const char *from,
}
-uint Field_blob::packed_col_length(const char *data_ptr, uint length)
+uint Field_blob::packed_col_length(const uchar *data_ptr, uint length)
{
if (length > 255)
return uint2korr(data_ptr)+2;
- return (uint) ((uchar) *data_ptr)+1;
+ return (uint) *data_ptr + 1;
}
@@ -7648,9 +7665,9 @@ uint Field_blob::is_equal(create_field *new_field)
#ifdef HAVE_SPATIAL
-uint Field_geom::get_key_image(char *buff, uint length, imagetype type)
+uint Field_geom::get_key_image(uchar *buff, uint length, imagetype type)
{
- char *blob;
+ uchar *blob;
const char *dummy;
MBR mbr;
ulong blob_length= get_length(ptr);
@@ -7664,7 +7681,7 @@ uint Field_geom::get_key_image(char *buff, uint length, imagetype type)
return image_length;
}
get_ptr(&blob);
- gobj= Geometry::construct(&buffer, blob, blob_length);
+ gobj= Geometry::construct(&buffer, (char*) blob, blob_length);
if (!gobj || gobj->get_mbr(&mbr, &dummy))
bzero(buff, image_length);
else
@@ -7902,7 +7919,7 @@ longlong Field_enum::val_int(void)
ASSERT_COLUMN_MARKED_FOR_READ;
switch (packlength) {
case 1:
- return (longlong) (uchar) ptr[0];
+ return (longlong) ptr[0];
case 2:
{
uint16 tmp;
@@ -7956,18 +7973,18 @@ String *Field_enum::val_str(String *val_buffer __attribute__((unused)),
return val_ptr;
}
-int Field_enum::cmp(const char *a_ptr, const char *b_ptr)
+int Field_enum::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
- char *old=ptr;
- ptr=(char*) a_ptr;
+ uchar *old= ptr;
+ ptr= (uchar*) a_ptr;
ulonglong a=Field_enum::val_int();
- ptr=(char*) b_ptr;
+ ptr= (uchar*) b_ptr;
ulonglong b=Field_enum::val_int();
- ptr=old;
+ ptr= old;
return (a < b) ? -1 : (a > b) ? 1 : 0;
}
-void Field_enum::sort_string(char *to,uint length __attribute__((unused)))
+void Field_enum::sort_string(uchar *to,uint length __attribute__((unused)))
{
ulonglong value=Field_enum::val_int();
to+=packlength-1;
@@ -8149,9 +8166,9 @@ bool Field_enum::eq_def(Field *field)
for (uint i=0 ; i < from_lib->count ; i++)
if (my_strnncoll(field_charset,
(const uchar*)typelib->type_names[i],
- (uint) strlen(typelib->type_names[i]),
+ strlen(typelib->type_names[i]),
(const uchar*)from_lib->type_names[i],
- (uint) strlen(from_lib->type_names[i])))
+ strlen(from_lib->type_names[i])))
return 0;
return 1;
}
@@ -8210,7 +8227,7 @@ uint Field_num::is_equal(create_field *new_field)
11 one byte for 'd'
*/
-Field_bit::Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+Field_bit::Field_bit(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg,
enum utype unireg_check_arg, const char *field_name_arg)
: Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
@@ -8228,7 +8245,7 @@ Field_bit::Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
}
-my_size_t
+size_t
Field_bit::do_last_null_byte() const
{
/*
@@ -8250,14 +8267,14 @@ Field_bit::do_last_null_byte() const
result= bit_ptr;
if (result)
- return (byte*) result - table->record[0] + 1;
- else
- return LAST_NULL_BYTE_UNDEF;
+ return (size_t) (result - table->record[0]) + 1;
+ return LAST_NULL_BYTE_UNDEF;
}
+
Field *Field_bit::new_key_field(MEM_ROOT *root,
struct st_table *new_table,
- char *new_ptr, uchar *new_null_ptr,
+ uchar *new_ptr, uchar *new_null_ptr,
uint new_null_bit)
{
Field_bit *res;
@@ -8266,7 +8283,7 @@ Field *Field_bit::new_key_field(MEM_ROOT *root,
new_null_bit)))
{
/* Move bits normally stored in null_pointer to new_ptr */
- res->bit_ptr= (uchar*) new_ptr;
+ res->bit_ptr= new_ptr;
res->bit_ofs= 0;
if (bit_len)
res->ptr++; // Store rest of data here
@@ -8363,7 +8380,7 @@ longlong Field_bit::val_int(void)
switch (bytes_in_rec) {
case 0: return bits;
- case 1: return bits | (ulonglong) (uchar) ptr[0];
+ case 1: return bits | (ulonglong) ptr[0];
case 2: return bits | mi_uint2korr(ptr);
case 3: return bits | mi_uint3korr(ptr);
case 4: return bits | mi_uint4korr(ptr);
@@ -8413,7 +8430,7 @@ my_decimal *Field_bit::val_decimal(my_decimal *deciaml_value)
The a and b pointer must be pointers to the field in a record
(not the table->record[0] necessarily)
*/
-int Field_bit::cmp_max(const char *a, const char *b, uint max_len)
+int Field_bit::cmp_max(const uchar *a, const uchar *b, uint max_len)
{
my_ptrdiff_t a_diff= a - ptr;
my_ptrdiff_t b_diff= b - ptr;
@@ -8429,13 +8446,13 @@ int Field_bit::cmp_max(const char *a, const char *b, uint max_len)
}
-int Field_bit::key_cmp(const byte *str, uint length)
+int Field_bit::key_cmp(const uchar *str, uint length)
{
if (bit_len)
{
int flag;
uchar bits= get_rec_bits(bit_ptr, bit_ofs, bit_len);
- if ((flag= (int) (bits - *(uchar*) str)))
+ if ((flag= (int) (bits - *str)))
return flag;
str++;
length--;
@@ -8458,7 +8475,7 @@ int Field_bit::cmp_offset(uint row_offset)
}
-uint Field_bit::get_key_image(char *buff, uint length, imagetype type_arg)
+uint Field_bit::get_key_image(uchar *buff, uint length, imagetype type_arg)
{
if (bit_len)
{
@@ -8481,7 +8498,7 @@ void Field_bit::sql_type(String &res) const
}
-char *Field_bit::pack(char *to, const char *from, uint max_length)
+uchar *Field_bit::pack(uchar *to, const uchar *from, uint max_length)
{
DBUG_ASSERT(max_length);
uint length;
@@ -8515,7 +8532,7 @@ char *Field_bit::pack(char *to, const char *from, uint max_length)
}
-const char *Field_bit::unpack(char *to, const char *from)
+const uchar *Field_bit::unpack(uchar *to, const uchar *from)
{
if (bit_len > 0)
{
@@ -8549,7 +8566,7 @@ void Field_bit::set_default()
Bit field support for non-MyISAM tables.
*/
-Field_bit_as_char::Field_bit_as_char(char *ptr_arg, uint32 len_arg,
+Field_bit_as_char::Field_bit_as_char(uchar *ptr_arg, uint32 len_arg,
uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg,
const char *field_name_arg)
@@ -8576,7 +8593,7 @@ int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
{
memset(ptr, 0xff, bytes_in_rec);
if (bits)
- *ptr&= ((1 << bits) - 1); /* set first byte */
+ *ptr&= ((1 << bits) - 1); /* set first uchar */
if (table->in_use->really_abort_on_warning())
set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
else
@@ -9104,7 +9121,7 @@ uint pack_length_to_packflag(uint type)
}
-Field *make_field(TABLE_SHARE *share, char *ptr, uint32 field_length,
+Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
uchar *null_pos, uchar null_bit,
uint pack_flag,
enum_field_types field_type,
diff --git a/sql/field.h b/sql/field.h
index f9d77fe17ab..2bb9864e904 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -48,10 +48,10 @@ class Field
Field(const Item &); /* Prevent use of these */
void operator=(Field &);
public:
- static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); }
+ static void *operator new(size_t size) {return sql_alloc(size); }
static void operator delete(void *ptr_arg, size_t size) { TRASH(ptr_arg, size); }
- char *ptr; // Position to field in record
+ uchar *ptr; // Position to field in record
uchar *null_ptr; // Byte where null_bit is
/*
Note that you can use table->in_use as replacement for current_thd member
@@ -90,11 +90,12 @@ public:
uint16 field_index; // field number in fields array
uchar null_bit; // Bit used to test null bit
- Field(char *ptr_arg,uint32 length_arg,uchar *null_ptr_arg,uchar null_bit_arg,
- utype unireg_check_arg, const char *field_name_arg);
+ Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg,
+ uchar null_bit_arg, utype unireg_check_arg,
+ const char *field_name_arg);
virtual ~Field() {}
/* Store functions returns 1 on overflow and -1 on fatal error */
- virtual int store(const char *to,uint length,CHARSET_INFO *cs)=0;
+ virtual int store(const char *to, uint length,CHARSET_INFO *cs)=0;
virtual int store(double nr)=0;
virtual int store(longlong nr, bool unsigned_val)=0;
virtual int store_decimal(const my_decimal *d)=0;
@@ -171,20 +172,20 @@ public:
virtual uint32 key_length() const { return pack_length(); }
virtual enum_field_types type() const =0;
virtual enum_field_types real_type() const { return type(); }
- inline int cmp(const char *str) { return cmp(ptr,str); }
- virtual int cmp_max(const char *a, const char *b, uint max_len)
+ inline int cmp(const uchar *str) { return cmp(ptr,str); }
+ virtual int cmp_max(const uchar *a, const uchar *b, uint max_len)
{ return cmp(a, b); }
- virtual int cmp(const char *,const char *)=0;
- virtual int cmp_binary(const char *a,const char *b, uint32 max_length=~0L)
+ virtual int cmp(const uchar *,const uchar *)=0;
+ virtual int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0L)
{ return memcmp(a,b,pack_length()); }
virtual int cmp_offset(uint row_offset)
{ return cmp(ptr,ptr+row_offset); }
virtual int cmp_binary_offset(uint row_offset)
{ return cmp_binary(ptr, ptr+row_offset); };
- virtual int key_cmp(const byte *a,const byte *b)
- { return cmp((char*) a,(char*) b); }
- virtual int key_cmp(const byte *str, uint length)
- { return cmp(ptr,(char*) str); }
+ virtual int key_cmp(const uchar *a,const uchar *b)
+ { return cmp(a, b); }
+ virtual int key_cmp(const uchar *str, uint length)
+ { return cmp(ptr,str); }
virtual uint decimals() const { return 0; }
/*
Caller beware: sql_type can change str.Ptr, so check
@@ -201,7 +202,7 @@ public:
{
if (!null_ptr)
return 0;
- return test(record[(uint) (null_ptr - (uchar*) table->record[0])] &
+ return test(record[(uint) (null_ptr -table->record[0])] &
null_bit);
}
inline bool is_null_in_record_with_offset(my_ptrdiff_t offset)
@@ -236,15 +237,15 @@ public:
the record. If the field does not use any bits of the null
bytes, the value 0 (LAST_NULL_BYTE_UNDEF) is returned.
*/
- my_size_t last_null_byte() const {
- my_size_t bytes= do_last_null_byte();
+ size_t last_null_byte() const {
+ size_t bytes= do_last_null_byte();
DBUG_PRINT("debug", ("last_null_byte() ==> %ld", (long) bytes));
DBUG_ASSERT(bytes <= table->s->null_bytes);
return bytes;
}
virtual void make_field(Send_field *);
- virtual void sort_string(char *buff,uint length)=0;
+ virtual void sort_string(uchar *buff,uint length)=0;
virtual bool optimize_range(uint idx, uint part);
/*
This should be true for fields which, when compared with constant
@@ -258,23 +259,23 @@ public:
virtual Field *new_field(MEM_ROOT *root, struct st_table *new_table,
bool keep_type);
virtual Field *new_key_field(MEM_ROOT *root, struct st_table *new_table,
- char *new_ptr, uchar *new_null_ptr,
+ uchar *new_ptr, uchar *new_null_ptr,
uint new_null_bit);
Field *clone(MEM_ROOT *mem_root, struct st_table *new_table);
- inline void move_field(char *ptr_arg,uchar *null_ptr_arg,uchar null_bit_arg)
+ inline void move_field(uchar *ptr_arg,uchar *null_ptr_arg,uchar null_bit_arg)
{
ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg;
}
- inline void move_field(char *ptr_arg) { ptr=ptr_arg; }
+ inline void move_field(uchar *ptr_arg) { ptr=ptr_arg; }
virtual void move_field_offset(my_ptrdiff_t ptr_diff)
{
- ptr=ADD_TO_PTR(ptr,ptr_diff,char*);
+ ptr=ADD_TO_PTR(ptr,ptr_diff, uchar*);
if (null_ptr)
null_ptr=ADD_TO_PTR(null_ptr,ptr_diff,uchar*);
}
- inline void get_image(char *buff,uint length, CHARSET_INFO *cs)
+ inline void get_image(uchar *buff,uint length, CHARSET_INFO *cs)
{ memcpy(buff,ptr,length); }
- inline void set_image(char *buff,uint length, CHARSET_INFO *cs)
+ inline void set_image(const uchar *buff,uint length, CHARSET_INFO *cs)
{ memcpy(ptr,buff,length); }
@@ -304,12 +305,12 @@ public:
Number of copied bytes (excluding padded zero bytes -- see above).
*/
- virtual uint get_key_image(char *buff, uint length, imagetype type)
+ virtual uint get_key_image(uchar *buff, uint length, imagetype type)
{
get_image(buff, length, &my_charset_bin);
return length;
}
- virtual void set_key_image(char *buff,uint length)
+ virtual void set_key_image(const uchar *buff,uint length)
{ set_image(buff,length, &my_charset_bin); }
inline longlong val_int_offset(uint row_offset)
{
@@ -318,63 +319,64 @@ public:
ptr-=row_offset;
return tmp;
}
- inline longlong val_int(char *new_ptr)
+ inline longlong val_int(const uchar *new_ptr)
{
- char *old_ptr= ptr;
+ uchar *old_ptr= ptr;
longlong return_value;
- ptr= new_ptr;
+ ptr= (uchar*) new_ptr;
return_value= val_int();
ptr= old_ptr;
return return_value;
}
- inline String *val_str(String *str, char *new_ptr)
+ inline String *val_str(String *str, const uchar *new_ptr)
{
- char *old_ptr= ptr;
- ptr= new_ptr;
+ uchar *old_ptr= ptr;
+ ptr= (uchar*) new_ptr;
val_str(str);
ptr= old_ptr;
return str;
}
virtual bool send_binary(Protocol *protocol);
- virtual char *pack(char* to, const char *from, uint max_length=~(uint) 0)
+ virtual uchar *pack(uchar *to, const uchar *from, uint max_length=~(uint) 0)
{
uint32 length=pack_length();
memcpy(to,from,length);
return to+length;
}
- virtual const char *unpack(char* to, const char *from)
+ virtual const uchar *unpack(uchar* to, const uchar *from)
{
uint length=pack_length();
memcpy(to,from,length);
return from+length;
}
- virtual char *pack_key(char* to, const char *from, uint max_length)
+ virtual uchar *pack_key(uchar* to, const uchar *from, uint max_length)
{
return pack(to,from,max_length);
}
- virtual char *pack_key_from_key_image(char* to, const char *from,
+ virtual uchar *pack_key_from_key_image(uchar* to, const uchar *from,
uint max_length)
{
return pack(to,from,max_length);
}
- virtual const char *unpack_key(char* to, const char *from, uint max_length)
+ virtual const uchar *unpack_key(uchar* to, const uchar *from,
+ uint max_length)
{
return unpack(to,from);
}
- virtual uint packed_col_length(const char *to, uint length)
+ virtual uint packed_col_length(const uchar *to, uint length)
{ return length;}
virtual uint max_packed_col_length(uint max_length)
{ return max_length;}
- virtual int pack_cmp(const char *a,const char *b, uint key_length_arg,
+ virtual int pack_cmp(const uchar *a,const uchar *b, uint key_length_arg,
my_bool insert_or_update)
{ return cmp(a,b); }
- virtual int pack_cmp(const char *b, uint key_length_arg,
+ virtual int pack_cmp(const uchar *b, uint key_length_arg,
my_bool insert_or_update)
{ return cmp(ptr,b); }
- uint offset(byte *record)
+ uint offset(uchar *record)
{
- return (uint) (ptr - (char*) record);
+ return (uint) (ptr - record);
}
void copy_from_tmp(int offset);
uint fill_cache_field(struct st_cache_field *copy);
@@ -424,7 +426,7 @@ public:
/* Hash value */
virtual void hash(ulong *nr, ulong *nr2);
friend bool reopen_table(THD *,struct st_table *,bool);
- friend int cre_myisam(my_string name, register TABLE *form, uint options,
+ friend int cre_myisam(char * name, register TABLE *form, uint options,
ulonglong auto_increment_value);
friend class Copy_field;
friend class Item_avg_field;
@@ -451,7 +453,7 @@ private:
function. This represents the inheritance interface and can be
overridden by subclasses.
*/
- virtual my_size_t do_last_null_byte() const;
+ virtual size_t do_last_null_byte() const;
};
@@ -459,7 +461,7 @@ class Field_num :public Field {
public:
const uint8 dec;
bool zerofill,unsigned_flag; // Purify cannot handle bit fields
- Field_num(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
+ Field_num(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
const char *field_name_arg,
uint8 dec_arg, bool zero_arg, bool unsigned_arg);
@@ -487,7 +489,7 @@ protected:
CHARSET_INFO *field_charset;
enum Derivation field_derivation;
public:
- Field_str(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
+ Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
const char *field_name_arg, CHARSET_INFO *charset);
Item_result result_type () const { return STRING_RESULT; }
@@ -517,7 +519,7 @@ public:
class Field_longstr :public Field_str
{
public:
- Field_longstr(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_longstr(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
const char *field_name_arg, CHARSET_INFO *charset_arg)
:Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
@@ -530,7 +532,7 @@ public:
/* base class for float and double and decimal (old one) */
class Field_real :public Field_num {
public:
- Field_real(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_real(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
const char *field_name_arg,
uint8 dec_arg, bool zero_arg, bool unsigned_arg)
@@ -545,7 +547,7 @@ public:
class Field_decimal :public Field_real {
public:
- Field_decimal(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_decimal(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
uint8 dec_arg,bool zero_arg,bool unsigned_arg)
@@ -563,8 +565,8 @@ public:
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
- int cmp(const char *,const char*);
- void sort_string(char *buff,uint length);
+ int cmp(const uchar *,const uchar *);
+ void sort_string(uchar *buff,uint length);
void overflow(bool negative);
bool zero_pack() const { return 0; }
void sql_type(String &str) const;
@@ -583,7 +585,7 @@ public:
So for example we need to count length from precision handling
CREATE TABLE ( DECIMAL(x,y))
*/
- Field_new_decimal(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_new_decimal(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
uint8 dec_arg, bool zero_arg, bool unsigned_arg);
@@ -605,8 +607,8 @@ public:
longlong val_int(void);
my_decimal *val_decimal(my_decimal *);
String *val_str(String*, String *);
- int cmp(const char *, const char*);
- void sort_string(char *buff, uint length);
+ int cmp(const uchar *, const uchar *);
+ void sort_string(uchar *buff, uint length);
bool zero_pack() const { return 0; }
void sql_type(String &str) const;
uint32 max_display_length() { return field_length; }
@@ -618,7 +620,7 @@ public:
class Field_tiny :public Field_num {
public:
- Field_tiny(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_tiny(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
@@ -638,8 +640,8 @@ public:
longlong val_int(void);
String *val_str(String*,String *);
bool send_binary(Protocol *protocol);
- int cmp(const char *,const char*);
- void sort_string(char *buff,uint length);
+ int cmp(const uchar *,const uchar *);
+ void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return 1; }
void sql_type(String &str) const;
uint32 max_display_length() { return 4; }
@@ -648,7 +650,7 @@ public:
class Field_short :public Field_num {
public:
- Field_short(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_short(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
@@ -658,7 +660,7 @@ public:
{}
Field_short(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
bool unsigned_arg)
- :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
+ :Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, 0, 0, unsigned_arg)
{}
enum Item_result result_type () const { return INT_RESULT; }
@@ -673,8 +675,8 @@ public:
longlong val_int(void);
String *val_str(String*,String *);
bool send_binary(Protocol *protocol);
- int cmp(const char *,const char*);
- void sort_string(char *buff,uint length);
+ int cmp(const uchar *,const uchar *);
+ void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return 2; }
void sql_type(String &str) const;
uint32 max_display_length() { return 6; }
@@ -683,7 +685,7 @@ public:
class Field_medium :public Field_num {
public:
- Field_medium(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_medium(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
@@ -703,8 +705,8 @@ public:
longlong val_int(void);
String *val_str(String*,String *);
bool send_binary(Protocol *protocol);
- int cmp(const char *,const char*);
- void sort_string(char *buff,uint length);
+ int cmp(const uchar *,const uchar *);
+ void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return 3; }
void sql_type(String &str) const;
uint32 max_display_length() { return 8; }
@@ -713,7 +715,7 @@ public:
class Field_long :public Field_num {
public:
- Field_long(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_long(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
@@ -723,7 +725,7 @@ public:
{}
Field_long(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
bool unsigned_arg)
- :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
+ :Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg,0,0,unsigned_arg)
{}
enum Item_result result_type () const { return INT_RESULT; }
@@ -738,8 +740,8 @@ public:
longlong val_int(void);
bool send_binary(Protocol *protocol);
String *val_str(String*,String *);
- int cmp(const char *,const char*);
- void sort_string(char *buff,uint length);
+ int cmp(const uchar *,const uchar *);
+ void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return 4; }
void sql_type(String &str) const;
uint32 max_display_length() { return 11; }
@@ -749,7 +751,7 @@ public:
#ifdef HAVE_LONG_LONG
class Field_longlong :public Field_num {
public:
- Field_longlong(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_longlong(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
@@ -760,7 +762,7 @@ public:
Field_longlong(uint32 len_arg,bool maybe_null_arg,
const char *field_name_arg,
bool unsigned_arg)
- :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
+ :Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg,0,0,unsigned_arg)
{}
enum Item_result result_type () const { return INT_RESULT; }
@@ -779,8 +781,8 @@ public:
longlong val_int(void);
String *val_str(String*,String *);
bool send_binary(Protocol *protocol);
- int cmp(const char *,const char*);
- void sort_string(char *buff,uint length);
+ int cmp(const uchar *,const uchar *);
+ void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return 8; }
void sql_type(String &str) const;
bool can_be_compared_as_longlong() const { return TRUE; }
@@ -791,7 +793,7 @@ public:
class Field_float :public Field_real {
public:
- Field_float(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_float(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
uint8 dec_arg,bool zero_arg,bool unsigned_arg)
@@ -801,7 +803,7 @@ public:
{}
Field_float(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg,
uint8 dec_arg)
- :Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0,
+ :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0,
NONE, field_name_arg, dec_arg, 0, 0)
{}
enum_field_types type() const { return MYSQL_TYPE_FLOAT;}
@@ -814,8 +816,8 @@ public:
longlong val_int(void);
String *val_str(String*,String *);
bool send_binary(Protocol *protocol);
- int cmp(const char *,const char*);
- void sort_string(char *buff,uint length);
+ int cmp(const uchar *,const uchar *);
+ void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return sizeof(float); }
void sql_type(String &str) const;
};
@@ -824,7 +826,7 @@ public:
class Field_double :public Field_real {
public:
my_bool not_fixed;
- Field_double(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_double(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
uint8 dec_arg,bool zero_arg,bool unsigned_arg)
@@ -835,13 +837,13 @@ public:
{}
Field_double(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg,
uint8 dec_arg)
- :Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0,
+ :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0,
NONE, field_name_arg, dec_arg, 0, 0),
not_fixed(dec_arg >= NOT_FIXED_DEC)
{}
Field_double(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg,
uint8 dec_arg, my_bool not_fixed_srg)
- :Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0,
+ :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0,
NONE, field_name_arg, dec_arg, 0, 0),
not_fixed(not_fixed_srg)
{}
@@ -855,8 +857,8 @@ public:
longlong val_int(void);
String *val_str(String*,String *);
bool send_binary(Protocol *protocol);
- int cmp(const char *,const char*);
- void sort_string(char *buff,uint length);
+ int cmp(const uchar *,const uchar *);
+ void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return sizeof(double); }
void sql_type(String &str) const;
uint size_of() const { return sizeof(*this); }
@@ -868,7 +870,7 @@ public:
class Field_null :public Field_str {
static uchar null[1];
public:
- Field_null(char *ptr_arg, uint32 len_arg,
+ Field_null(uchar *ptr_arg, uint32 len_arg,
enum utype unireg_check_arg, const char *field_name_arg,
CHARSET_INFO *cs)
:Field_str(ptr_arg, len_arg, null, 1,
@@ -886,8 +888,8 @@ public:
my_decimal *val_decimal(my_decimal *) { return 0; }
String *val_str(String *value,String *value2)
{ value2->length(0); return value2;}
- int cmp(const char *a, const char *b) { return 0;}
- void sort_string(char *buff, uint length) {}
+ int cmp(const uchar *a, const uchar *b) { return 0;}
+ void sort_string(uchar *buff, uint length) {}
uint32 pack_length() const { return 0; }
void sql_type(String &str) const;
uint size_of() const { return sizeof(*this); }
@@ -897,7 +899,7 @@ public:
class Field_timestamp :public Field_str {
public:
- Field_timestamp(char *ptr_arg, uint32 len_arg,
+ Field_timestamp(uchar *ptr_arg, uint32 len_arg,
uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
TABLE_SHARE *share, CHARSET_INFO *cs);
@@ -914,8 +916,8 @@ public:
longlong val_int(void);
String *val_str(String*,String *);
bool send_binary(Protocol *protocol);
- int cmp(const char *,const char*);
- void sort_string(char *buff,uint length);
+ int cmp(const uchar *,const uchar *);
+ void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return 4; }
void sql_type(String &str) const;
bool can_be_compared_as_longlong() const { return TRUE; }
@@ -950,7 +952,7 @@ public:
class Field_year :public Field_tiny {
public:
- Field_year(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_year(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg)
:Field_tiny(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
@@ -971,7 +973,7 @@ public:
class Field_date :public Field_str {
public:
- Field_date(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
+ Field_date(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
CHARSET_INFO *cs)
:Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg,
@@ -979,7 +981,7 @@ public:
{}
Field_date(bool maybe_null_arg, const char *field_name_arg,
CHARSET_INFO *cs)
- :Field_str((char*) 0,10, maybe_null_arg ? (uchar*) "": 0,0,
+ :Field_str((uchar*) 0,10, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, cs) {}
enum_field_types type() const { return MYSQL_TYPE_DATE;}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
@@ -992,8 +994,8 @@ public:
longlong val_int(void);
String *val_str(String*,String *);
bool send_binary(Protocol *protocol);
- int cmp(const char *,const char*);
- void sort_string(char *buff,uint length);
+ int cmp(const uchar *,const uchar *);
+ void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return 4; }
void sql_type(String &str) const;
bool can_be_compared_as_longlong() const { return TRUE; }
@@ -1003,7 +1005,7 @@ public:
class Field_newdate :public Field_str {
public:
- Field_newdate(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
+ Field_newdate(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
CHARSET_INFO *cs)
:Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg,
@@ -1022,8 +1024,8 @@ public:
longlong val_int(void);
String *val_str(String*,String *);
bool send_binary(Protocol *protocol);
- int cmp(const char *,const char*);
- void sort_string(char *buff,uint length);
+ int cmp(const uchar *,const uchar *);
+ void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return 3; }
void sql_type(String &str) const;
bool can_be_compared_as_longlong() const { return TRUE; }
@@ -1035,7 +1037,7 @@ public:
class Field_time :public Field_str {
public:
- Field_time(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
+ Field_time(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
CHARSET_INFO *cs)
:Field_str(ptr_arg, 8, null_ptr_arg, null_bit_arg,
@@ -1043,7 +1045,7 @@ public:
{}
Field_time(bool maybe_null_arg, const char *field_name_arg,
CHARSET_INFO *cs)
- :Field_str((char*) 0,8, maybe_null_arg ? (uchar*) "": 0,0,
+ :Field_str((uchar*) 0,8, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, cs) {}
enum_field_types type() const { return MYSQL_TYPE_TIME;}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
@@ -1059,8 +1061,8 @@ public:
bool get_date(MYSQL_TIME *ltime, uint fuzzydate);
bool send_binary(Protocol *protocol);
bool get_time(MYSQL_TIME *ltime);
- int cmp(const char *,const char*);
- void sort_string(char *buff,uint length);
+ int cmp(const uchar *,const uchar *);
+ void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return 3; }
void sql_type(String &str) const;
bool can_be_compared_as_longlong() const { return TRUE; }
@@ -1070,7 +1072,7 @@ public:
class Field_datetime :public Field_str {
public:
- Field_datetime(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
+ Field_datetime(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
CHARSET_INFO *cs)
:Field_str(ptr_arg, 19, null_ptr_arg, null_bit_arg,
@@ -1078,7 +1080,7 @@ public:
{}
Field_datetime(bool maybe_null_arg, const char *field_name_arg,
CHARSET_INFO *cs)
- :Field_str((char*) 0,19, maybe_null_arg ? (uchar*) "": 0,0,
+ :Field_str((uchar*) 0,19, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, cs) {}
enum_field_types type() const { return MYSQL_TYPE_DATETIME;}
#ifdef HAVE_LONG_LONG
@@ -1099,8 +1101,8 @@ public:
longlong val_int(void);
String *val_str(String*,String *);
bool send_binary(Protocol *protocol);
- int cmp(const char *,const char*);
- void sort_string(char *buff,uint length);
+ int cmp(const uchar *,const uchar *);
+ void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return 8; }
void sql_type(String &str) const;
bool can_be_compared_as_longlong() const { return TRUE; }
@@ -1113,7 +1115,7 @@ public:
class Field_string :public Field_longstr {
public:
bool can_alter_field_type;
- Field_string(char *ptr_arg, uint32 len_arg,uchar *null_ptr_arg,
+ Field_string(uchar *ptr_arg, uint32 len_arg,uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
CHARSET_INFO *cs)
@@ -1122,7 +1124,7 @@ public:
can_alter_field_type(1) {};
Field_string(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
CHARSET_INFO *cs)
- :Field_longstr((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
+ :Field_longstr((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
NONE, field_name_arg, cs),
can_alter_field_type(1) {};
@@ -1139,7 +1141,7 @@ public:
bool zero_pack() const { return 0; }
int reset(void)
{
- charset()->cset->fill(charset(),ptr,field_length,
+ charset()->cset->fill(charset(),(char*) ptr, field_length,
(has_charset() ? ' ' : 0));
return 0;
}
@@ -1150,22 +1152,22 @@ public:
longlong val_int(void);
String *val_str(String*,String *);
my_decimal *val_decimal(my_decimal *);
- int cmp(const char *,const char*);
- void sort_string(char *buff,uint length);
+ int cmp(const uchar *,const uchar *);
+ void sort_string(uchar *buff,uint length);
void sql_type(String &str) const;
- char *pack(char *to, const char *from, uint max_length=~(uint) 0);
- const char *unpack(char* to, const char *from);
- int pack_cmp(const char *a,const char *b,uint key_length,
+ uchar *pack(uchar *to, const uchar *from, uint max_length=~(uint) 0);
+ const uchar *unpack(uchar* to, const uchar *from);
+ int pack_cmp(const uchar *a,const uchar *b,uint key_length,
my_bool insert_or_update);
- int pack_cmp(const char *b,uint key_length,my_bool insert_or_update);
- uint packed_col_length(const char *to, uint length);
+ int pack_cmp(const uchar *b,uint key_length,my_bool insert_or_update);
+ uint packed_col_length(const uchar *to, uint length);
uint max_packed_col_length(uint max_length);
uint size_of() const { return sizeof(*this); }
enum_field_types real_type() const { return MYSQL_TYPE_STRING; }
bool has_charset(void) const
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type);
- virtual uint get_key_image(char *buff,uint length, imagetype type);
+ virtual uint get_key_image(uchar *buff,uint length, imagetype type);
};
@@ -1173,7 +1175,7 @@ class Field_varstring :public Field_longstr {
public:
/* Store number of bytes used to store length (1 or 2) */
uint32 length_bytes;
- Field_varstring(char *ptr_arg,
+ Field_varstring(uchar *ptr_arg,
uint32 len_arg, uint length_bytes_arg,
uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
@@ -1187,7 +1189,7 @@ public:
Field_varstring(uint32 len_arg,bool maybe_null_arg,
const char *field_name_arg,
TABLE_SHARE *share, CHARSET_INFO *cs)
- :Field_longstr((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
+ :Field_longstr((uchar*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
NONE, field_name_arg, cs),
length_bytes(len_arg < 256 ? 1 :2)
{
@@ -1212,27 +1214,28 @@ public:
longlong val_int(void);
String *val_str(String*,String *);
my_decimal *val_decimal(my_decimal *);
- int cmp_max(const char *, const char *, uint max_length);
- int cmp(const char *a,const char*b)
+ int cmp_max(const uchar *, const uchar *, uint max_length);
+ int cmp(const uchar *a,const uchar *b)
{
return cmp_max(a, b, ~0L);
}
- void sort_string(char *buff,uint length);
- uint get_key_image(char *buff,uint length, imagetype type);
- void set_key_image(char *buff,uint length);
+ void sort_string(uchar *buff,uint length);
+ uint get_key_image(uchar *buff,uint length, imagetype type);
+ void set_key_image(const uchar *buff,uint length);
void sql_type(String &str) const;
- char *pack(char *to, const char *from, uint max_length=~(uint) 0);
- char *pack_key(char *to, const char *from, uint max_length);
- char *pack_key_from_key_image(char* to, const char *from, uint max_length);
- const char *unpack(char* to, const char *from);
- const char *unpack_key(char* to, const char *from, uint max_length);
- int pack_cmp(const char *a, const char *b, uint key_length,
+ uchar *pack(uchar *to, const uchar *from, uint max_length=~(uint) 0);
+ uchar *pack_key(uchar *to, const uchar *from, uint max_length);
+ uchar *pack_key_from_key_image(uchar* to, const uchar *from,
+ uint max_length);
+ const uchar *unpack(uchar* to, const uchar *from);
+ const uchar *unpack_key(uchar* to, const uchar *from, uint max_length);
+ int pack_cmp(const uchar *a, const uchar *b, uint key_length,
my_bool insert_or_update);
- int pack_cmp(const char *b, uint key_length,my_bool insert_or_update);
- int cmp_binary(const char *a,const char *b, uint32 max_length=~0L);
- int key_cmp(const byte *,const byte*);
- int key_cmp(const byte *str, uint length);
- uint packed_col_length(const char *to, uint length);
+ int pack_cmp(const uchar *b, uint key_length,my_bool insert_or_update);
+ int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0L);
+ int key_cmp(const uchar *,const uchar*);
+ int key_cmp(const uchar *str, uint length);
+ uint packed_col_length(const uchar *to, uint length);
uint max_packed_col_length(uint max_length);
uint32 data_length();
uint size_of() const { return sizeof(*this); }
@@ -1241,7 +1244,7 @@ public:
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type);
Field *new_key_field(MEM_ROOT *root, struct st_table *new_table,
- char *new_ptr, uchar *new_null_ptr,
+ uchar *new_ptr, uchar *new_null_ptr,
uint new_null_bit);
uint is_equal(create_field *new_field);
void hash(ulong *nr, ulong *nr2);
@@ -1253,12 +1256,12 @@ protected:
uint packlength;
String value; // For temporaries
public:
- Field_blob(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
+ Field_blob(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
TABLE_SHARE *share, uint blob_pack_length, CHARSET_INFO *cs);
Field_blob(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
CHARSET_INFO *cs)
- :Field_longstr((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
+ :Field_longstr((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
NONE, field_name_arg, cs),
packlength(4)
{
@@ -1266,7 +1269,7 @@ public:
}
Field_blob(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
CHARSET_INFO *cs, bool set_packlength)
- :Field_longstr((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
+ :Field_longstr((uchar*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
NONE, field_name_arg, cs)
{
flags|= BLOB_FLAG;
@@ -1289,15 +1292,15 @@ public:
longlong val_int(void);
String *val_str(String*,String *);
my_decimal *val_decimal(my_decimal *);
- int cmp_max(const char *, const char *, uint max_length);
- int cmp(const char *a,const char*b)
+ int cmp_max(const uchar *, const uchar *, uint max_length);
+ int cmp(const uchar *a,const uchar *b)
{ return cmp_max(a, b, ~0L); }
- int cmp(const char *a, uint32 a_length, const char *b, uint32 b_length);
- int cmp_binary(const char *a,const char *b, uint32 max_length=~0L);
- int key_cmp(const byte *,const byte*);
- int key_cmp(const byte *str, uint length);
+ int cmp(const uchar *a, uint32 a_length, const uchar *b, uint32 b_length);
+ int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0L);
+ int key_cmp(const uchar *,const uchar*);
+ int key_cmp(const uchar *str, uint length);
uint32 key_length() const { return 0; }
- void sort_string(char *buff,uint length);
+ void sort_string(uchar *buff,uint length);
uint32 pack_length() const
{ return (uint32) (packlength+table->s->blob_ptr_size); }
uint32 sort_length() const;
@@ -1305,57 +1308,60 @@ public:
{
return (uint32) (((ulonglong) 1 << (packlength*8)) -1);
}
- int reset(void) { bzero(ptr, packlength+sizeof(char*)); return 0; }
- void reset_fields() { bzero((char*) &value,sizeof(value)); }
+ int reset(void) { bzero(ptr, packlength+sizeof(uchar*)); return 0; }
+ void reset_fields() { bzero((uchar*) &value,sizeof(value)); }
void store_length(uint32 number);
inline uint32 get_length(uint row_offset=0)
{ return get_length(ptr+row_offset); }
- uint32 get_length(const char *ptr);
- void put_length(char *pos, uint32 length);
- inline void get_ptr(char **str)
+ uint32 get_length(const uchar *ptr);
+ void put_length(uchar *pos, uint32 length);
+ inline void get_ptr(uchar **str)
{
- memcpy_fixed(str,ptr+packlength,sizeof(char*));
+ memcpy_fixed((uchar*) str,ptr+packlength,sizeof(uchar*));
}
- inline void get_ptr(char **str, uint row_offset)
+ inline void get_ptr(uchar **str, uint row_offset)
{
- memcpy_fixed(str,ptr+packlength+row_offset,sizeof(char*));
+ memcpy_fixed((uchar*) str,ptr+packlength+row_offset,sizeof(char*));
}
- inline void set_ptr(char *length,char *data)
+ inline void set_ptr(uchar *length, uchar *data)
{
memcpy(ptr,length,packlength);
memcpy_fixed(ptr+packlength,&data,sizeof(char*));
}
- inline void set_ptr(uint32 length,char *data)
+ inline void set_ptr(uint32 length, uchar *data)
{
store_length(length);
memcpy_fixed(ptr+packlength,&data,sizeof(char*));
}
- uint get_key_image(char *buff,uint length, imagetype type);
- void set_key_image(char *buff,uint length);
+ uint get_key_image(uchar *buff,uint length, imagetype type);
+ void set_key_image(const uchar *buff,uint length);
void sql_type(String &str) const;
inline bool copy()
- { char *tmp;
+ {
+ uchar *tmp;
get_ptr(&tmp);
- if (value.copy(tmp,get_length(),charset()))
+ if (value.copy((char*) tmp, get_length(),charset()))
{
Field_blob::reset();
return 1;
}
- tmp=(char*) value.ptr(); memcpy_fixed(ptr+packlength,&tmp,sizeof(char*));
+ tmp=(uchar*) value.ptr();
+ memcpy_fixed(ptr+packlength,&tmp,sizeof(char*));
return 0;
}
- char *pack(char *to, const char *from, uint max_length= ~(uint) 0);
- char *pack_key(char *to, const char *from, uint max_length);
- char *pack_key_from_key_image(char* to, const char *from, uint max_length);
- const char *unpack(char *to, const char *from);
- const char *unpack_key(char* to, const char *from, uint max_length);
- int pack_cmp(const char *a, const char *b, uint key_length,
+ uchar *pack(uchar *to, const uchar *from, uint max_length= ~(uint) 0);
+ uchar *pack_key(uchar *to, const uchar *from, uint max_length);
+ uchar *pack_key_from_key_image(uchar* to, const uchar *from,
+ uint max_length);
+ const uchar *unpack(uchar *to, const uchar *from);
+ const uchar *unpack_key(uchar* to, const uchar *from, uint max_length);
+ int pack_cmp(const uchar *a, const uchar *b, uint key_length,
my_bool insert_or_update);
- int pack_cmp(const char *b, uint key_length,my_bool insert_or_update);
- uint packed_col_length(const char *col_ptr, uint length);
+ int pack_cmp(const uchar *b, uint key_length,my_bool insert_or_update);
+ uint packed_col_length(const uchar *col_ptr, uint length);
uint max_packed_col_length(uint max_length);
void free() { value.free(); }
- inline void clear_temporary() { bzero((char*) &value,sizeof(value)); }
+ inline void clear_temporary() { bzero((uchar*) &value,sizeof(value)); }
friend int field_conv(Field *to,Field *from);
uint size_of() const { return sizeof(*this); }
bool has_charset(void) const
@@ -1370,7 +1376,7 @@ class Field_geom :public Field_blob {
public:
enum geometry_type geom_type;
- Field_geom(char *ptr_arg, uchar *null_ptr_arg, uint null_bit_arg,
+ Field_geom(uchar *ptr_arg, uchar *null_ptr_arg, uint null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
TABLE_SHARE *share, uint blob_pack_length,
enum geometry_type geom_type_arg)
@@ -1388,7 +1394,7 @@ public:
int store(double nr);
int store(longlong nr, bool unsigned_val);
int store_decimal(const my_decimal *);
- uint get_key_image(char *buff,uint length,imagetype type);
+ uint get_key_image(uchar *buff,uint length,imagetype type);
uint size_of() const { return sizeof(*this); }
int reset(void) { return !maybe_null() || Field_blob::reset(); }
};
@@ -1400,7 +1406,7 @@ protected:
uint packlength;
public:
TYPELIB *typelib;
- Field_enum(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_enum(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
uint packlength_arg,
@@ -1423,8 +1429,8 @@ public:
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
- int cmp(const char *,const char*);
- void sort_string(char *buff,uint length);
+ int cmp(const uchar *,const uchar *);
+ void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return (uint32) packlength; }
void store_type(ulonglong value);
void sql_type(String &str) const;
@@ -1441,7 +1447,7 @@ public:
class Field_set :public Field_enum {
public:
- Field_set(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_set(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
uint32 packlength_arg,
@@ -1484,7 +1490,7 @@ public:
uchar bit_ofs; // offset to 'uneven' high bits
uint bit_len; // number of 'uneven' high bits
uint bytes_in_rec;
- Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_bit(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg,
enum utype unireg_check_arg, const char *field_name_arg);
enum_field_types type() const { return MYSQL_TYPE_BIT; }
@@ -1503,29 +1509,29 @@ public:
String *val_str(String*, String *);
virtual bool str_needs_quotes() { return TRUE; }
my_decimal *val_decimal(my_decimal *);
- int cmp(const char *a, const char *b)
+ int cmp(const uchar *a, const uchar *b)
{ return cmp_binary(a, b); }
int cmp_binary_offset(uint row_offset)
{ return cmp_offset(row_offset); }
- int cmp_max(const char *a, const char *b, uint max_length);
- int key_cmp(const byte *a, const byte *b)
- { return cmp_binary((char *) a, (char *) b); }
- int key_cmp(const byte *str, uint length);
+ int cmp_max(const uchar *a, const uchar *b, uint max_length);
+ int key_cmp(const uchar *a, const uchar *b)
+ { return cmp_binary((uchar *) a, (uchar *) b); }
+ int key_cmp(const uchar *str, uint length);
int cmp_offset(uint row_offset);
- uint get_key_image(char *buff, uint length, imagetype type);
- void set_key_image(char *buff, uint length)
- { Field_bit::store(buff, length, &my_charset_bin); }
- void sort_string(char *buff, uint length)
+ uint get_key_image(uchar *buff, uint length, imagetype type);
+ void set_key_image(const uchar *buff, uint length)
+ { Field_bit::store((char*) buff, length, &my_charset_bin); }
+ void sort_string(uchar *buff, uint length)
{ get_key_image(buff, length, itRAW); }
uint32 pack_length() const { return (uint32) (field_length + 7) / 8; }
uint32 pack_length_in_rec() const { return bytes_in_rec; }
void sql_type(String &str) const;
- char *pack(char *to, const char *from, uint max_length=~(uint) 0);
- const char *unpack(char* to, const char *from);
+ uchar *pack(uchar *to, const uchar *from, uint max_length=~(uint) 0);
+ const uchar *unpack(uchar* to, const uchar *from);
virtual void set_default();
Field *new_key_field(MEM_ROOT *root, struct st_table *new_table,
- char *new_ptr, uchar *new_null_ptr,
+ uchar *new_ptr, uchar *new_null_ptr,
uint new_null_bit);
void set_bit_ptr(uchar *bit_ptr_arg, uchar bit_ofs_arg)
{
@@ -1546,7 +1552,7 @@ public:
}
private:
- virtual my_size_t do_last_null_byte() const;
+ virtual size_t do_last_null_byte() const;
};
@@ -1559,7 +1565,7 @@ private:
*/
class Field_bit_as_char: public Field_bit {
public:
- Field_bit_as_char(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
+ Field_bit_as_char(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg);
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
@@ -1647,7 +1653,7 @@ class Send_field {
class Copy_field :public Sql_alloc {
void (*get_copy_func(Field *to,Field *from))(Copy_field *);
public:
- char *from_ptr,*to_ptr;
+ uchar *from_ptr,*to_ptr;
uchar *from_null_ptr,*to_null_ptr;
my_bool *null_row;
uint from_bit,to_bit;
@@ -1658,13 +1664,13 @@ public:
Copy_field() {}
~Copy_field() {}
void set(Field *to,Field *from,bool save); // Field to field
- void set(char *to,Field *from); // Field to string
+ void set(uchar *to,Field *from); // Field to string
void (*do_copy)(Copy_field *);
void (*do_copy2)(Copy_field *); // Used to handle null values
};
-Field *make_field(TABLE_SHARE *share, char *ptr, uint32 field_length,
+Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
uchar *null_pos, uchar null_bit,
uint pack_flag, enum_field_types field_type,
CHARSET_INFO *cs,
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 9771cbc12b1..e920fe70f26 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -355,8 +355,8 @@ static void do_cut_string(Copy_field *copy)
/* Check if we loosed any important characters */
if (cs->cset->scan(cs,
- copy->from_ptr + copy->to_length,
- copy->from_ptr + copy->from_length,
+ (char*) copy->from_ptr + copy->to_length,
+ (char*) copy->from_ptr + copy->from_length,
MY_SEQ_SPACES) < copy->from_length - copy->to_length)
{
copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
@@ -374,8 +374,10 @@ static void do_cut_string_complex(Copy_field *copy)
{ // Shorter string field
int well_formed_error;
CHARSET_INFO *cs= copy->from_field->charset();
- const char *from_end= copy->from_ptr + copy->from_length;
- uint copy_length= cs->cset->well_formed_len(cs, copy->from_ptr, from_end,
+ const uchar *from_end= copy->from_ptr + copy->from_length;
+ uint copy_length= cs->cset->well_formed_len(cs,
+ (char*) copy->from_ptr,
+ (char*) from_end,
copy->to_length / cs->mbmaxlen,
&well_formed_error);
if (copy->to_length < copy_length)
@@ -384,7 +386,8 @@ static void do_cut_string_complex(Copy_field *copy)
/* Check if we lost any important characters */
if (well_formed_error ||
- cs->cset->scan(cs, copy->from_ptr + copy_length, from_end,
+ cs->cset->scan(cs, (char*) copy->from_ptr + copy_length,
+ (char*) from_end,
MY_SEQ_SPACES) < (copy->from_length - copy_length))
{
copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
@@ -392,7 +395,7 @@ static void do_cut_string_complex(Copy_field *copy)
}
if (copy_length < copy->to_length)
- cs->cset->fill(cs, copy->to_ptr + copy_length,
+ cs->cset->fill(cs, (char*) copy->to_ptr + copy_length,
copy->to_length - copy_length, ' ');
}
@@ -403,7 +406,7 @@ static void do_expand_binary(Copy_field *copy)
{
CHARSET_INFO *cs= copy->from_field->charset();
memcpy(copy->to_ptr,copy->from_ptr,copy->from_length);
- cs->cset->fill(cs, copy->to_ptr+copy->from_length,
+ cs->cset->fill(cs, (char*) copy->to_ptr+copy->from_length,
copy->to_length-copy->from_length, '\0');
}
@@ -413,7 +416,7 @@ static void do_expand_string(Copy_field *copy)
{
CHARSET_INFO *cs= copy->from_field->charset();
memcpy(copy->to_ptr,copy->from_ptr,copy->from_length);
- cs->cset->fill(cs, copy->to_ptr+copy->from_length,
+ cs->cset->fill(cs, (char*) copy->to_ptr+copy->from_length,
copy->to_length-copy->from_length, ' ');
}
@@ -438,9 +441,10 @@ static void do_varstring1_mb(Copy_field *copy)
int well_formed_error;
CHARSET_INFO *cs= copy->from_field->charset();
uint from_length= (uint) *(uchar*) copy->from_ptr;
- const char *from_ptr= copy->from_ptr + 1;
+ const uchar *from_ptr= copy->from_ptr + 1;
uint to_char_length= (copy->to_length - 1) / cs->mbmaxlen;
- uint length= cs->cset->well_formed_len(cs, from_ptr, from_ptr + from_length,
+ uint length= cs->cset->well_formed_len(cs, (char*) from_ptr,
+ (char*) from_ptr + from_length,
to_char_length, &well_formed_error);
if (length < from_length)
{
@@ -448,7 +452,7 @@ static void do_varstring1_mb(Copy_field *copy)
copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
WARN_DATA_TRUNCATED, 1);
}
- *(uchar*) copy->to_ptr= (uchar) length;
+ *copy->to_ptr= (uchar) length;
memcpy(copy->to_ptr + 1, from_ptr, length);
}
@@ -475,8 +479,9 @@ static void do_varstring2_mb(Copy_field *copy)
CHARSET_INFO *cs= copy->from_field->charset();
uint char_length= (copy->to_length - HA_KEY_BLOB_LENGTH) / cs->mbmaxlen;
uint from_length= uint2korr(copy->from_ptr);
- const char *from_beg= copy->from_ptr + HA_KEY_BLOB_LENGTH;
- uint length= cs->cset->well_formed_len(cs, from_beg, from_beg + from_length,
+ const uchar *from_beg= copy->from_ptr + HA_KEY_BLOB_LENGTH;
+ uint length= cs->cset->well_formed_len(cs, (char*) from_beg,
+ (char*) from_beg + from_length,
char_length, &well_formed_error);
if (length < from_length)
{
@@ -501,7 +506,7 @@ static void do_varstring2_mb(Copy_field *copy)
The 'to' buffer should have a size of field->pack_length()+1
*/
-void Copy_field::set(char *to,Field *from)
+void Copy_field::set(uchar *to,Field *from)
{
from_ptr=from->ptr;
to_ptr=to;
diff --git a/sql/filesort.cc b/sql/filesort.cc
index a80e4a0fa54..1091282aea1 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -30,7 +30,7 @@
/* How to write record_ref. */
#define WRITE_REF(file,from) \
-if (my_b_write((file),(byte*) (from),param->ref_length)) \
+if (my_b_write((file),(uchar*) (from),param->ref_length)) \
DBUG_RETURN(1);
/* functions defined in this file */
@@ -42,7 +42,7 @@ static ha_rows find_all_keys(SORTPARAM *param,SQL_SELECT *select,
IO_CACHE *tempfile,IO_CACHE *indexfile);
static int write_keys(SORTPARAM *param,uchar * *sort_keys,
uint count, IO_CACHE *buffer_file, IO_CACHE *tempfile);
-static void make_sortkey(SORTPARAM *param,uchar *to, byte *ref_pos);
+static void make_sortkey(SORTPARAM *param,uchar *to, uchar *ref_pos);
static void register_used_fields(SORTPARAM *param);
static int merge_index(SORTPARAM *param,uchar *sort_buffer,
BUFFPEK *buffpek,
@@ -56,7 +56,7 @@ static uint sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
static SORT_ADDON_FIELD *get_addon_fields(THD *thd, Field **ptabfield,
uint sortlength, uint *plength);
static void unpack_addon_fields(struct st_sort_addon_field *addon_field,
- byte *buff);
+ uchar *buff);
/*
Sort a table
@@ -153,7 +153,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
if (param.addon_field)
{
param.res_length= param.addon_length;
- if (!(table_sort.addon_buf= (byte *) my_malloc(param.addon_length,
+ if (!(table_sort.addon_buf= (uchar *) my_malloc(param.addon_length,
MYF(MY_WME))))
goto err;
}
@@ -198,7 +198,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
}
if (multi_byte_charset &&
- !(param.tmp_buffer=my_malloc(param.sort_length,MYF(MY_WME))))
+ !(param.tmp_buffer= (char*) my_malloc(param.sort_length,MYF(MY_WME))))
goto err;
memavl= thd->variables.sortbuff_size;
@@ -245,7 +245,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
{
if (!table_sort.buffpek && table_sort.buffpek_len < maxbuffer &&
!(table_sort.buffpek=
- (byte *) read_buffpek_from_file(&buffpek_pointers, maxbuffer)))
+ (uchar *) read_buffpek_from_file(&buffpek_pointers, maxbuffer)))
goto err;
buffpek= (BUFFPEK *) table_sort.buffpek;
table_sort.buffpek_len= maxbuffer;
@@ -283,9 +283,9 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
x_free(param.tmp_buffer);
if (!subselect || !subselect->is_uncacheable())
{
- x_free((gptr) sort_keys);
+ x_free((uchar*) sort_keys);
table_sort.sort_keys= 0;
- x_free((gptr) buffpek);
+ x_free((uchar*) buffpek);
table_sort.buffpek= 0;
table_sort.buffpek_len= 0;
}
@@ -323,19 +323,19 @@ void filesort_free_buffers(TABLE *table, bool full)
{
if (table->sort.record_pointers)
{
- my_free((gptr) table->sort.record_pointers,MYF(0));
+ my_free((uchar*) table->sort.record_pointers,MYF(0));
table->sort.record_pointers=0;
}
if (full)
{
if (table->sort.sort_keys )
{
- x_free((gptr) table->sort.sort_keys);
+ x_free((uchar*) table->sort.sort_keys);
table->sort.sort_keys= 0;
}
if (table->sort.buffpek)
{
- x_free((gptr) table->sort.buffpek);
+ x_free((uchar*) table->sort.buffpek);
table->sort.buffpek= 0;
table->sort.buffpek_len= 0;
}
@@ -379,7 +379,7 @@ static BUFFPEK *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count)
if (tmp)
{
if (reinit_io_cache(buffpek_pointers,READ_CACHE,0L,0,0) ||
- my_b_read(buffpek_pointers, (byte*) tmp, length))
+ my_b_read(buffpek_pointers, (uchar*) tmp, length))
{
my_free((char*) tmp, MYF(0));
tmp=0;
@@ -431,7 +431,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
{
int error,flag,quick_select;
uint idx,indexpos,ref_length;
- byte *ref_pos,*next_pos,ref_buff[MAX_REFLENGTH];
+ uchar *ref_pos,*next_pos,ref_buff[MAX_REFLENGTH];
my_off_t record;
TABLE *sort_form;
THD *thd= current_thd;
@@ -458,7 +458,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
next_pos=ref_pos;
if (! indexfile && ! quick_select)
{
- next_pos=(byte*) 0; /* Find records in sequence */
+ next_pos=(uchar*) 0; /* Find records in sequence */
file->ha_rnd_init(1);
file->extra_opt(HA_EXTRA_CACHE,
current_thd->variables.read_buff_size);
@@ -483,7 +483,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
register_used_fields(param);
if (select && select->cond)
select->cond->walk(&Item::register_field_in_read_map, 1,
- (byte*) sort_form);
+ (uchar*) sort_form);
sort_form->column_bitmaps_set(&sort_form->tmp_set, &sort_form->tmp_set);
for (;;)
@@ -501,7 +501,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
{
if (indexfile)
{
- if (my_b_read(indexfile,(byte*) ref_pos,ref_length)) /* purecov: deadcode */
+ if (my_b_read(indexfile,(uchar*) ref_pos,ref_length)) /* purecov: deadcode */
{
error= my_errno ? my_errno : -1; /* Abort */
break;
@@ -609,7 +609,7 @@ static int
write_keys(SORTPARAM *param, register uchar **sort_keys, uint count,
IO_CACHE *buffpek_pointers, IO_CACHE *tempfile)
{
- uint sort_length, rec_length;
+ size_t sort_length, rec_length;
uchar **end;
BUFFPEK buffpek;
DBUG_ENTER("write_keys");
@@ -619,7 +619,7 @@ write_keys(SORTPARAM *param, register uchar **sort_keys, uint count,
#ifdef MC68000
quicksort(sort_keys,count,sort_length);
#else
- my_string_ptr_sort((gptr) sort_keys, (uint) count, sort_length);
+ my_string_ptr_sort((uchar*) sort_keys, (uint) count, sort_length);
#endif
if (!my_b_inited(tempfile) &&
open_cached_file(tempfile, mysql_tmpdir, TEMP_PREFIX, DISK_BUFFER_SIZE,
@@ -630,9 +630,9 @@ write_keys(SORTPARAM *param, register uchar **sort_keys, uint count,
count=(uint) param->max_rows; /* purecov: inspected */
buffpek.count=(ha_rows) count;
for (end=sort_keys+count ; sort_keys != end ; sort_keys++)
- if (my_b_write(tempfile, (byte*) *sort_keys, (uint) rec_length))
+ if (my_b_write(tempfile, (uchar*) *sort_keys, (uint) rec_length))
goto err;
- if (my_b_write(buffpek_pointers, (byte*) &buffpek, sizeof(buffpek)))
+ if (my_b_write(buffpek_pointers, (uchar*) &buffpek, sizeof(buffpek)))
goto err;
DBUG_RETURN(0);
@@ -667,7 +667,7 @@ static inline void store_length(uchar *to, uint length, uint pack_length)
/* makes a sort-key from record */
static void make_sortkey(register SORTPARAM *param,
- register uchar *to, byte *ref_pos)
+ register uchar *to, uchar *ref_pos)
{
reg3 Field *field;
reg1 SORT_FIELD *sort_field;
@@ -694,7 +694,7 @@ static void make_sortkey(register SORTPARAM *param,
else
*to++=1;
}
- field->sort_string((char*) to,sort_field->length);
+ field->sort_string(to, sort_field->length);
}
else
{ // Item
@@ -823,7 +823,7 @@ static void make_sortkey(register SORTPARAM *param,
}
*to++=1;
}
- my_decimal2binary(E_DEC_FATAL_ERROR, dec_val, (char*)to,
+ my_decimal2binary(E_DEC_FATAL_ERROR, dec_val, to,
item->max_length - (item->decimals ? 1:0),
item->decimals);
break;
@@ -841,7 +841,7 @@ static void make_sortkey(register SORTPARAM *param,
}
*to++=1;
}
- change_double_for_sort(value,(byte*) to);
+ change_double_for_sort(value,(uchar*) to);
break;
}
case ROW_RESULT:
@@ -891,13 +891,13 @@ static void make_sortkey(register SORTPARAM *param,
else
{
#ifdef HAVE_purify
- uchar *end= (uchar*) field->pack((char *) to, field->ptr);
+ uchar *end= field->pack(to, field->ptr);
uint length= (uint) ((to + addonf->length) - end);
DBUG_ASSERT((int) length >= 0);
if (length)
bzero(end, length);
#else
- (void) field->pack((char *) to, field->ptr);
+ (void) field->pack(to, field->ptr);
#endif
}
to+= addonf->length;
@@ -906,7 +906,7 @@ static void make_sortkey(register SORTPARAM *param,
else
{
/* Save filepos last */
- memcpy((byte*) to, ref_pos, (size_s) param->ref_length);
+ memcpy((uchar*) to, ref_pos, (size_t) param->ref_length);
}
return;
}
@@ -935,7 +935,7 @@ static void register_used_fields(SORTPARAM *param)
else
{ // Item
sort_field->item->walk(&Item::register_field_in_read_map, 1,
- (byte *) table);
+ (uchar *) table);
}
}
@@ -958,16 +958,16 @@ static bool save_index(SORTPARAM *param, uchar **sort_keys, uint count,
FILESORT_INFO *table_sort)
{
uint offset,res_length;
- byte *to;
+ uchar *to;
DBUG_ENTER("save_index");
- my_string_ptr_sort((gptr) sort_keys, (uint) count, param->sort_length);
+ my_string_ptr_sort((uchar*) sort_keys, (uint) count, param->sort_length);
res_length= param->res_length;
offset= param->rec_length-res_length;
if ((ha_rows) count > param->max_rows)
count=(uint) param->max_rows;
if (!(to= table_sort->record_pointers=
- (byte*) my_malloc(res_length*count, MYF(MY_WME))))
+ (uchar*) my_malloc(res_length*count, MYF(MY_WME))))
DBUG_RETURN(1); /* purecov: inspected */
for (uchar **end= sort_keys+count ; sort_keys != end ; sort_keys++)
{
@@ -1039,7 +1039,7 @@ uint read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek,
if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count)))
{
- if (my_pread(fromfile->file,(byte*) buffpek->base,
+ if (my_pread(fromfile->file,(uchar*) buffpek->base,
(length= rec_length*count),buffpek->file_pos,MYF_RW))
return((uint) -1); /* purecov: inspected */
buffpek->key=buffpek->base;
@@ -1154,7 +1154,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
if (error == -1)
goto err; /* purecov: inspected */
buffpek->max_keys= buffpek->mem_count; // If less data in buffers than expected
- queue_insert(&queue, (byte*) buffpek);
+ queue_insert(&queue, (uchar*) buffpek);
}
if (param->unique_buff)
@@ -1169,7 +1169,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
*/
buffpek= (BUFFPEK*) queue_top(&queue);
memcpy(param->unique_buff, buffpek->key, rec_length);
- if (my_b_write(to_file, (byte*) buffpek->key, rec_length))
+ if (my_b_write(to_file, (uchar*) buffpek->key, rec_length))
{
error=1; goto err; /* purecov: inspected */
}
@@ -1203,14 +1203,14 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
}
if (flag == 0)
{
- if (my_b_write(to_file,(byte*) buffpek->key, rec_length))
+ if (my_b_write(to_file,(uchar*) buffpek->key, rec_length))
{
error=1; goto err; /* purecov: inspected */
}
}
else
{
- if (my_b_write(to_file, (byte*) buffpek->key+offset, res_length))
+ if (my_b_write(to_file, (uchar*) buffpek->key+offset, res_length))
{
error=1; goto err; /* purecov: inspected */
}
@@ -1265,7 +1265,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
max_rows-= buffpek->mem_count;
if (flag == 0)
{
- if (my_b_write(to_file,(byte*) buffpek->key,
+ if (my_b_write(to_file,(uchar*) buffpek->key,
(rec_length*buffpek->mem_count)))
{
error= 1; goto err; /* purecov: inspected */
@@ -1279,7 +1279,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
strpos != end ;
strpos+= rec_length)
{
- if (my_b_write(to_file, (byte *) strpos, res_length))
+ if (my_b_write(to_file, (uchar *) strpos, res_length))
{
error=1; goto err;
}
@@ -1548,7 +1548,7 @@ get_addon_fields(THD *thd, Field **ptabfield, uint sortlength, uint *plength)
*/
static void
-unpack_addon_fields(struct st_sort_addon_field *addon_field, byte *buff)
+unpack_addon_fields(struct st_sort_addon_field *addon_field, uchar *buff)
{
Field *field;
SORT_ADDON_FIELD *addonf= addon_field;
@@ -1561,7 +1561,7 @@ unpack_addon_fields(struct st_sort_addon_field *addon_field, byte *buff)
continue;
}
field->set_notnull();
- field->unpack(field->ptr, (char *) buff+addonf->offset);
+ field->unpack(field->ptr, buff + addonf->offset);
}
}
@@ -1572,7 +1572,7 @@ unpack_addon_fields(struct st_sort_addon_field *addon_field, byte *buff)
#define DBL_EXP_DIG (sizeof(double)*8-DBL_MANT_DIG)
-void change_double_for_sort(double nr,byte *to)
+void change_double_for_sort(double nr,uchar *to)
{
uchar *tmp=(uchar*) to;
if (nr == 0.0)
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index 2d78999017a..36b7f30dc64 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -90,8 +90,8 @@ struct my_option my_long_options[] =
{"debug", '#', "This is a non-debug version. Catch this and exit",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
- {"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
- (gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
+ (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"help", '?', "Display help and exit",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/sql/gstream.h b/sql/gstream.h
index 10274635413..1ef90ad5bf0 100644
--- a/sql/gstream.h
+++ b/sql/gstream.h
@@ -35,7 +35,7 @@ public:
{}
~Gis_read_stream()
{
- my_free(m_err_msg, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) m_err_msg, MYF(MY_ALLOW_ZERO_PTR));
}
enum enum_tok_types get_next_toc_type();
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 5bbaa793939..ad6572d7a6b 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -146,7 +146,7 @@ pthread_mutex_t ndbcluster_mutex;
// Table lock handling
HASH ndbcluster_open_tables;
-static byte *ndbcluster_get_key(NDB_SHARE *share,uint *length,
+static uchar *ndbcluster_get_key(NDB_SHARE *share, size_t *length,
my_bool not_used __attribute__((unused)));
#ifdef HAVE_NDB_BINLOG
static int rename_share(NDB_SHARE *share, const char *new_key);
@@ -336,11 +336,11 @@ int execute_no_commit_ie(ha_ndbcluster *h, NdbTransaction *trans,
Place holder for ha_ndbcluster thread specific data
*/
static
-byte *thd_ndb_share_get_key(THD_NDB_SHARE *thd_ndb_share, uint *length,
+uchar *thd_ndb_share_get_key(THD_NDB_SHARE *thd_ndb_share, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length= sizeof(thd_ndb_share->key);
- return (byte*) &thd_ndb_share->key;
+ return (uchar*) &thd_ndb_share->key;
}
Thd_ndb::Thd_ndb()
@@ -395,9 +395,9 @@ Thd_ndb::get_open_table(THD *thd, const void *key)
DBUG_ENTER("Thd_ndb::get_open_table");
HASH_SEARCH_STATE state;
THD_NDB_SHARE *thd_ndb_share=
- (THD_NDB_SHARE*)hash_first(&open_tables, (byte *)&key, sizeof(key), &state);
+ (THD_NDB_SHARE*)hash_first(&open_tables, (uchar *)&key, sizeof(key), &state);
while (thd_ndb_share && thd_ndb_share->key != key)
- thd_ndb_share= (THD_NDB_SHARE*)hash_next(&open_tables, (byte *)&key, sizeof(key), &state);
+ thd_ndb_share= (THD_NDB_SHARE*)hash_next(&open_tables, (uchar *)&key, sizeof(key), &state);
if (thd_ndb_share == 0)
{
thd_ndb_share= (THD_NDB_SHARE *) alloc_root(&thd->transaction.mem_root,
@@ -406,7 +406,7 @@ Thd_ndb::get_open_table(THD *thd, const void *key)
thd_ndb_share->stat.last_count= count;
thd_ndb_share->stat.no_uncommitted_rows_count= 0;
thd_ndb_share->stat.records= ~(ha_rows)0;
- my_hash_insert(&open_tables, (byte *)thd_ndb_share);
+ my_hash_insert(&open_tables, (uchar *)thd_ndb_share);
}
else if (thd_ndb_share->stat.last_count != count)
{
@@ -674,7 +674,7 @@ static bool field_type_forces_var_part(enum_field_types type)
*/
bool ha_ndbcluster::set_hidden_key(NdbOperation *ndb_op,
- uint fieldnr, const byte *field_ptr)
+ uint fieldnr, const uchar *field_ptr)
{
DBUG_ENTER("set_hidden_key");
DBUG_RETURN(ndb_op->equal(fieldnr, (char*)field_ptr) != 0);
@@ -686,14 +686,14 @@ bool ha_ndbcluster::set_hidden_key(NdbOperation *ndb_op,
*/
int ha_ndbcluster::set_ndb_key(NdbOperation *ndb_op, Field *field,
- uint fieldnr, const byte *field_ptr)
+ uint fieldnr, const uchar *field_ptr)
{
uint32 pack_len= field->pack_length();
DBUG_ENTER("set_ndb_key");
DBUG_PRINT("enter", ("%d: %s, ndb_type: %u, len=%d",
fieldnr, field->field_name, field->type(),
pack_len));
- DBUG_DUMP("key", (char*)field_ptr, pack_len);
+ DBUG_DUMP("key", field_ptr, pack_len);
DBUG_ASSERT(ndb_supported_type(field->type()));
DBUG_ASSERT(! (field->flags & BLOB_FLAG));
@@ -710,13 +710,13 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field,
uint fieldnr, int row_offset,
bool *set_blob_value)
{
- const byte* field_ptr= field->ptr + row_offset;
+ const uchar* field_ptr= field->ptr + row_offset;
uint32 pack_len= field->pack_length();
DBUG_ENTER("set_ndb_value");
DBUG_PRINT("enter", ("%d: %s type: %u len=%d is_null=%s",
fieldnr, field->field_name, field->type(),
pack_len, field->is_null(row_offset) ? "Y" : "N"));
- DBUG_DUMP("value", (char*) field_ptr, pack_len);
+ DBUG_DUMP("value", field_ptr, pack_len);
DBUG_ASSERT(ndb_supported_type(field->type()));
{
@@ -725,7 +725,7 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field,
if (pack_len == 0)
{
pack_len= sizeof(empty_field);
- field_ptr= (byte *)&empty_field;
+ field_ptr= (uchar *)&empty_field;
if (field->is_null(row_offset))
empty_field= 0;
else
@@ -755,7 +755,7 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field,
// Set value to NULL
DBUG_RETURN((ndb_op->setValue(fieldnr, (char*)NULL) != 0));
DBUG_PRINT("info", ("bit field"));
- DBUG_DUMP("value", (char*)&bits, pack_len);
+ DBUG_DUMP("value", (uchar*)&bits, pack_len);
#ifdef WORDS_BIGENDIAN
/* store lsw first */
bits = ((bits >> 32) & 0x00000000FFFFFFFFLL)
@@ -775,18 +775,18 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field,
// Get length and pointer to data
uint32 blob_len= field_blob->get_length(field_ptr);
- char* blob_ptr= NULL;
+ uchar* blob_ptr= NULL;
field_blob->get_ptr(&blob_ptr);
// Looks like NULL ptr signals length 0 blob
if (blob_ptr == NULL) {
DBUG_ASSERT(blob_len == 0);
- blob_ptr= (char*)"";
+ blob_ptr= (uchar*)"";
}
DBUG_PRINT("value", ("set blob ptr: 0x%lx len: %u",
(long) blob_ptr, blob_len));
- DBUG_DUMP("value", (char*)blob_ptr, min(blob_len, 26));
+ DBUG_DUMP("value", blob_ptr, min(blob_len, 26));
if (set_blob_value)
*set_blob_value= TRUE;
@@ -830,7 +830,7 @@ int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg)
passes a record pointer diff.
*/
int get_ndb_blobs_value(TABLE* table, NdbValue* value_array,
- byte*& buffer, uint& buffer_size,
+ uchar*& buffer, uint& buffer_size,
my_ptrdiff_t ptrdiff)
{
DBUG_ENTER("get_ndb_blobs_value");
@@ -866,7 +866,7 @@ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array,
size+= 8 - size % 8;
if (loop == 1)
{
- char *buf= buffer + offset;
+ uchar *buf= buffer + offset;
uint32 len= 0xffffffff; // Max uint32
if (ndb_blob->readData(buf, len) != 0)
ERR_RETURN(ndb_blob->getNdbError());
@@ -883,7 +883,7 @@ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array,
else if (loop == 1) // undefined or null
{
// have to set length even in this case
- char *buf= buffer + offset; // or maybe NULL
+ uchar *buf= buffer + offset; // or maybe NULL
uint32 len= 0;
field_blob->ptr+= ptrdiff;
field_blob->set_ptr(len, buf);
@@ -896,7 +896,7 @@ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array,
my_free(buffer, MYF(MY_ALLOW_ZERO_PTR));
buffer_size= 0;
DBUG_PRINT("info", ("allocate blobs buffer size %u", offset));
- buffer= my_malloc(offset, MYF(MY_WME));
+ buffer= (uchar*) my_malloc(offset, MYF(MY_WME));
if (buffer == NULL)
{
sql_print_error("ha_ndbcluster::get_ndb_blobs_value: "
@@ -917,7 +917,7 @@ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array,
*/
int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field,
- uint fieldnr, byte* buf)
+ uint fieldnr, uchar* buf)
{
DBUG_ENTER("get_ndb_value");
DBUG_PRINT("enter", ("fieldnr: %d flags: %o", fieldnr,
@@ -932,13 +932,13 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field,
{
if (field->type() != MYSQL_TYPE_BIT)
{
- byte *field_buf;
+ uchar *field_buf;
if (field->pack_length() != 0)
field_buf= buf + (field->ptr - table->record[0]);
else
- field_buf= (byte *)&dummy_buf;
+ field_buf= (uchar *)&dummy_buf;
m_value[fieldnr].rec= ndb_op->getValue(fieldnr,
- field_buf);
+ (char*) field_buf);
}
else // if (field->type() == MYSQL_TYPE_BIT)
{
@@ -953,7 +953,7 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field,
if (ndb_blob != NULL)
{
// Set callback
- m_blobs_offset= buf - (byte*) table->record[0];
+ m_blobs_offset= buf - (uchar*) table->record[0];
void *arg= (void *)this;
DBUG_RETURN(ndb_blob->setActiveHook(g_get_ndb_blobs_value, arg) != 0);
}
@@ -961,7 +961,7 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field,
}
// Used for hidden key only
- m_value[fieldnr].rec= ndb_op->getValue(fieldnr, m_ref);
+ m_value[fieldnr].rec= ndb_op->getValue(fieldnr, (char*) m_ref);
DBUG_RETURN(m_value[fieldnr].rec == NULL);
}
@@ -1035,8 +1035,8 @@ int ha_ndbcluster::get_metadata(const char *path)
DBUG_ASSERT(m_table == NULL);
DBUG_ASSERT(m_table_info == NULL);
- const void *data= NULL, *pack_data= NULL;
- uint length, pack_length;
+ uchar *data= NULL, *pack_data= NULL;
+ size_t length, pack_length;
/*
Compare FrmData in NDB with frm file from disk.
@@ -1045,8 +1045,8 @@ int ha_ndbcluster::get_metadata(const char *path)
if (readfrm(path, &data, &length) ||
packfrm(data, length, &pack_data, &pack_length))
{
- my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
- my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(data, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(pack_data, MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN(1);
}
@@ -1058,11 +1058,11 @@ int ha_ndbcluster::get_metadata(const char *path)
&& cmp_frm(tab, pack_data, pack_length))
{
DBUG_PRINT("error",
- ("metadata, pack_length: %d getFrmLength: %d memcmp: %d",
- pack_length, tab->getFrmLength(),
+ ("metadata, pack_length: %lu getFrmLength: %d memcmp: %d",
+ (ulong) pack_length, tab->getFrmLength(),
memcmp(pack_data, tab->getFrmData(), pack_length)));
- DBUG_DUMP("pack_data", (char*)pack_data, pack_length);
- DBUG_DUMP("frm", (char*)tab->getFrmData(), tab->getFrmLength());
+ DBUG_DUMP("pack_data", (uchar*) pack_data, pack_length);
+ DBUG_DUMP("frm", (uchar*) tab->getFrmData(), tab->getFrmLength());
error= HA_ERR_TABLE_DEF_CHANGED;
}
my_free((char*)data, MYF(0));
@@ -1565,7 +1565,7 @@ inline ulong ha_ndbcluster::index_flags(uint idx_no, uint part,
HA_KEY_SCAN_NOT_ROR);
}
-static void shrink_varchar(Field* field, const byte* & ptr, char* buf)
+static void shrink_varchar(Field* field, const uchar* & ptr, uchar* buf)
{
if (field->type() == MYSQL_TYPE_VARCHAR && ptr != NULL) {
Field_varstring* f= (Field_varstring*)field;
@@ -1584,7 +1584,7 @@ static void shrink_varchar(Field* field, const byte* & ptr, char* buf)
}
}
-int ha_ndbcluster::set_primary_key(NdbOperation *op, const byte *key)
+int ha_ndbcluster::set_primary_key(NdbOperation *op, const uchar *key)
{
KEY* key_info= table->key_info + table_share->primary_key;
KEY_PART_INFO* key_part= key_info->key_part;
@@ -1594,8 +1594,8 @@ int ha_ndbcluster::set_primary_key(NdbOperation *op, const byte *key)
for (; key_part != end; key_part++)
{
Field* field= key_part->field;
- const byte* ptr= key;
- char buf[256];
+ const uchar* ptr= key;
+ uchar buf[256];
shrink_varchar(field, ptr, buf);
if (set_ndb_key(op, field,
key_part->fieldnr-1, ptr))
@@ -1606,7 +1606,7 @@ int ha_ndbcluster::set_primary_key(NdbOperation *op, const byte *key)
}
-int ha_ndbcluster::set_primary_key_from_record(NdbOperation *op, const byte *record)
+int ha_ndbcluster::set_primary_key_from_record(NdbOperation *op, const uchar *record)
{
KEY* key_info= table->key_info + table_share->primary_key;
KEY_PART_INFO* key_part= key_info->key_part;
@@ -1624,7 +1624,7 @@ int ha_ndbcluster::set_primary_key_from_record(NdbOperation *op, const byte *rec
}
int ha_ndbcluster::set_index_key_from_record(NdbOperation *op,
- const byte *record, uint keyno)
+ const uchar *record, uint keyno)
{
KEY* key_info= table->key_info + keyno;
KEY_PART_INFO* key_part= key_info->key_part;
@@ -1645,7 +1645,7 @@ int ha_ndbcluster::set_index_key_from_record(NdbOperation *op,
int
ha_ndbcluster::set_index_key(NdbOperation *op,
const KEY *key_info,
- const byte * key_ptr)
+ const uchar * key_ptr)
{
DBUG_ENTER("ha_ndbcluster::set_index_key");
uint i;
@@ -1655,8 +1655,8 @@ ha_ndbcluster::set_index_key(NdbOperation *op,
for (i= 0; key_part != end; key_part++, i++)
{
Field* field= key_part->field;
- const byte* ptr= key_part->null_bit ? key_ptr + 1 : key_ptr;
- char buf[256];
+ const uchar* ptr= key_part->null_bit ? key_ptr + 1 : key_ptr;
+ uchar buf[256];
shrink_varchar(field, ptr, buf);
if (set_ndb_key(op, field, m_index[active_index].unique_index_attrid_map[i], ptr))
ERR_RETURN(m_active_trans->getNdbError());
@@ -1666,7 +1666,7 @@ ha_ndbcluster::set_index_key(NdbOperation *op,
}
inline
-int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op)
+int ha_ndbcluster::define_read_attrs(uchar* buf, NdbOperation* op)
{
uint i;
DBUG_ENTER("define_read_attrs");
@@ -1708,7 +1708,7 @@ int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op)
Read one record from NDB using primary key
*/
-int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf,
+int ha_ndbcluster::pk_read(const uchar *key, uint key_len, uchar *buf,
uint32 part_id)
{
uint no_fields= table_share->fields;
@@ -1718,7 +1718,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf,
int res;
DBUG_ENTER("pk_read");
DBUG_PRINT("enter", ("key_len: %u", key_len));
- DBUG_DUMP("key", (char*)key, key_len);
+ DBUG_DUMP("key", key, key_len);
m_write_op= FALSE;
NdbOperation::LockMode lm=
@@ -1731,7 +1731,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf,
{
// This table has no primary key, use "hidden" primary key
DBUG_PRINT("info", ("Using hidden key"));
- DBUG_DUMP("key", (char*)key, 8);
+ DBUG_DUMP("key", key, 8);
if (set_hidden_key(op, no_fields, key))
ERR_RETURN(trans->getNdbError());
@@ -1777,7 +1777,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf,
or hidden key
*/
-int ha_ndbcluster::complemented_read(const byte *old_data, byte *new_data,
+int ha_ndbcluster::complemented_read(const uchar *old_data, uchar *new_data,
uint32 old_part_id)
{
uint no_fields= table_share->fields, i;
@@ -1914,7 +1914,7 @@ bool ha_ndbcluster::check_all_operations_for_error(NdbTransaction *trans,
* primary key or unique index values
*/
-int ha_ndbcluster::peek_indexed_rows(const byte *record,
+int ha_ndbcluster::peek_indexed_rows(const uchar *record,
bool check_pk)
{
NdbTransaction *trans= m_active_trans;
@@ -2008,15 +2008,15 @@ int ha_ndbcluster::peek_indexed_rows(const byte *record,
Read one record from NDB using unique secondary index
*/
-int ha_ndbcluster::unique_index_read(const byte *key,
- uint key_len, byte *buf)
+int ha_ndbcluster::unique_index_read(const uchar *key,
+ uint key_len, uchar *buf)
{
int res;
NdbTransaction *trans= m_active_trans;
NdbIndexOperation *op;
DBUG_ENTER("ha_ndbcluster::unique_index_read");
DBUG_PRINT("enter", ("key_len: %u, index: %u", key_len, active_index));
- DBUG_DUMP("key", (char*)key, key_len);
+ DBUG_DUMP("key", key, key_len);
NdbOperation::LockMode lm=
(NdbOperation::LockMode)get_ndb_lock_type(m_lock.type);
@@ -2152,7 +2152,7 @@ inline int ha_ndbcluster::fetch_next(NdbScanOperation* cursor)
*/
-inline int ha_ndbcluster::next_result(byte *buf)
+inline int ha_ndbcluster::next_result(uchar *buf)
{
int res;
DBUG_ENTER("next_result");
@@ -2231,10 +2231,10 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
struct part_st {
bool part_last;
const key_range *key;
- const byte *part_ptr;
+ const uchar *part_ptr;
bool part_null;
int bound_type;
- const char* bound_ptr;
+ const uchar* bound_ptr;
};
struct part_st part[2];
@@ -2344,13 +2344,13 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
{
DBUG_PRINT("info", ("key %d:%d offset: %d length: %d last: %d bound: %d",
j, i, tot_len, part_len, p.part_last, p.bound_type));
- DBUG_DUMP("info", (const char*)p.part_ptr, part_store_len);
+ DBUG_DUMP("info", p.part_ptr, part_store_len);
// Set bound if not cancelled via type -1
if (p.bound_type != -1)
{
- const char* ptr= p.bound_ptr;
- char buf[256];
+ const uchar* ptr= p.bound_ptr;
+ uchar buf[256];
shrink_varchar(field, ptr, buf);
if (op->setBound(i, p.bound_type, ptr))
ERR_RETURN(op->getNdbError());
@@ -2370,7 +2370,7 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
const key_range *end_key,
bool sorted, bool descending,
- byte* buf, part_id_range *part_spec)
+ uchar* buf, part_id_range *part_spec)
{
int res;
bool restart;
@@ -2476,9 +2476,9 @@ guess_scan_flags(NdbOperation::LockMode lm,
*/
int ha_ndbcluster::unique_index_scan(const KEY* key_info,
- const byte *key,
+ const uchar *key,
uint key_len,
- byte *buf)
+ uchar *buf)
{
int res;
NdbScanOperation *op;
@@ -2552,7 +2552,7 @@ int ha_ndbcluster::unique_index_scan(const KEY* key_info,
Start full table scan in NDB
*/
-int ha_ndbcluster::full_table_scan(byte *buf)
+int ha_ndbcluster::full_table_scan(uchar *buf)
{
int res;
NdbScanOperation *op;
@@ -2619,7 +2619,7 @@ int ha_ndbcluster::full_table_scan(byte *buf)
/*
Insert one record into NDB
*/
-int ha_ndbcluster::write_row(byte *record)
+int ha_ndbcluster::write_row(uchar *record)
{
bool has_auto_increment;
uint i;
@@ -2709,7 +2709,7 @@ int ha_ndbcluster::write_row(byte *record)
ndb->getNdbError().status == NdbError::TemporaryError);
if (ret == -1)
ERR_RETURN(ndb->getNdbError());
- if (set_hidden_key(op, table_share->fields, (const byte*)&auto_value))
+ if (set_hidden_key(op, table_share->fields, (const uchar*)&auto_value))
ERR_RETURN(op->getNdbError());
}
else
@@ -2830,8 +2830,8 @@ int ha_ndbcluster::write_row(byte *record)
/* Compare if a key in a row has changed */
-int ha_ndbcluster::key_cmp(uint keynr, const byte * old_row,
- const byte * new_row)
+int ha_ndbcluster::key_cmp(uint keynr, const uchar * old_row,
+ const uchar * new_row)
{
KEY_PART_INFO *key_part=table->key_info[keynr].key_part;
KEY_PART_INFO *end=key_part+table->key_info[keynr].key_parts;
@@ -2847,8 +2847,8 @@ int ha_ndbcluster::key_cmp(uint keynr, const byte * old_row,
if (key_part->key_part_flag & (HA_BLOB_PART | HA_VAR_LENGTH_PART))
{
- if (key_part->field->cmp_binary((char*) (old_row + key_part->offset),
- (char*) (new_row + key_part->offset),
+ if (key_part->field->cmp_binary((old_row + key_part->offset),
+ (new_row + key_part->offset),
(ulong) key_part->length))
return 1;
}
@@ -2866,7 +2866,7 @@ int ha_ndbcluster::key_cmp(uint keynr, const byte * old_row,
Update one record in NDB using primary key
*/
-int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
+int ha_ndbcluster::update_row(const uchar *old_data, uchar *new_data)
{
THD *thd= table->in_use;
NdbTransaction *trans= m_active_trans;
@@ -2951,7 +2951,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
{
// Undo delete_row(old_data)
m_primary_key_update= TRUE;
- undo_res= write_row((byte *)old_data);
+ undo_res= write_row((uchar *)old_data);
if (undo_res)
push_warning(current_thd,
MYSQL_ERROR::WARN_LEVEL_WARN,
@@ -3066,7 +3066,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
Delete one record from NDB, using primary key
*/
-int ha_ndbcluster::delete_row(const byte *record)
+int ha_ndbcluster::delete_row(const uchar *record)
{
THD *thd= table->in_use;
NdbTransaction *trans= m_active_trans;
@@ -3178,7 +3178,7 @@ int ha_ndbcluster::delete_row(const byte *record)
*/
void ndb_unpack_record(TABLE *table, NdbValue *value,
- MY_BITMAP *defined, byte *buf)
+ MY_BITMAP *defined, uchar *buf)
{
Field **p_field= table->field, *field= *p_field;
my_ptrdiff_t row_offset= (my_ptrdiff_t) (buf - table->record[0]);
@@ -3265,13 +3265,13 @@ void ndb_unpack_record(TABLE *table, NdbValue *value,
field_bit->Field_bit::move_field_offset(-row_offset);
DBUG_PRINT("info",("[%u] SET",
(*value).rec->getColumn()->getColumnNo()));
- DBUG_DUMP("info", (const char*) field->ptr, field->pack_length());
+ DBUG_DUMP("info", field->ptr, field->pack_length());
}
else
{
DBUG_PRINT("info",("[%u] SET",
(*value).rec->getColumn()->getColumnNo()));
- DBUG_DUMP("info", (const char*) field->ptr, field->pack_length());
+ DBUG_DUMP("info", field->ptr, field->pack_length());
}
}
else
@@ -3295,7 +3295,7 @@ void ndb_unpack_record(TABLE *table, NdbValue *value,
#ifndef DBUG_OFF
// pointer vas set in get_ndb_blobs_value
Field_blob *field_blob= (Field_blob*)field;
- char* ptr;
+ uchar *ptr;
field_blob->get_ptr(&ptr, row_offset);
uint32 len= field_blob->get_length(row_offset);
DBUG_PRINT("info",("[%u] SET ptr: 0x%lx len: %u",
@@ -3309,7 +3309,7 @@ void ndb_unpack_record(TABLE *table, NdbValue *value,
DBUG_VOID_RETURN;
}
-void ha_ndbcluster::unpack_record(byte *buf)
+void ha_ndbcluster::unpack_record(uchar *buf)
{
ndb_unpack_record(table, m_value, 0, buf);
#ifndef DBUG_OFF
@@ -3422,10 +3422,10 @@ int ha_ndbcluster::index_end()
*/
static
int
-check_null_in_key(const KEY* key_info, const byte *key, uint key_len)
+check_null_in_key(const KEY* key_info, const uchar *key, uint key_len)
{
KEY_PART_INFO *curr_part, *end_part;
- const byte* end_ptr= key + key_len;
+ const uchar* end_ptr= key + key_len;
curr_part= key_info->key_part;
end_part= curr_part + key_info->key_parts;
@@ -3439,8 +3439,8 @@ check_null_in_key(const KEY* key_info, const byte *key, uint key_len)
return 0;
}
-int ha_ndbcluster::index_read(byte *buf,
- const byte *key, uint key_len,
+int ha_ndbcluster::index_read(uchar *buf,
+ const uchar *key, uint key_len,
enum ha_rkey_function find_flag)
{
key_range start_key;
@@ -3468,7 +3468,7 @@ int ha_ndbcluster::index_read(byte *buf,
}
-int ha_ndbcluster::index_next(byte *buf)
+int ha_ndbcluster::index_next(uchar *buf)
{
DBUG_ENTER("ha_ndbcluster::index_next");
statistic_increment(current_thd->status_var.ha_read_next_count,
@@ -3477,7 +3477,7 @@ int ha_ndbcluster::index_next(byte *buf)
}
-int ha_ndbcluster::index_prev(byte *buf)
+int ha_ndbcluster::index_prev(uchar *buf)
{
DBUG_ENTER("ha_ndbcluster::index_prev");
statistic_increment(current_thd->status_var.ha_read_prev_count,
@@ -3486,7 +3486,7 @@ int ha_ndbcluster::index_prev(byte *buf)
}
-int ha_ndbcluster::index_first(byte *buf)
+int ha_ndbcluster::index_first(uchar *buf)
{
DBUG_ENTER("ha_ndbcluster::index_first");
statistic_increment(current_thd->status_var.ha_read_first_count,
@@ -3498,14 +3498,14 @@ int ha_ndbcluster::index_first(byte *buf)
}
-int ha_ndbcluster::index_last(byte *buf)
+int ha_ndbcluster::index_last(uchar *buf)
{
DBUG_ENTER("ha_ndbcluster::index_last");
statistic_increment(current_thd->status_var.ha_read_last_count,&LOCK_status);
DBUG_RETURN(ordered_index_scan(0, 0, TRUE, TRUE, buf, NULL));
}
-int ha_ndbcluster::index_read_last(byte * buf, const byte * key, uint key_len)
+int ha_ndbcluster::index_read_last(uchar * buf, const uchar * key, uint key_len)
{
DBUG_ENTER("ha_ndbcluster::index_read_last");
DBUG_RETURN(index_read(buf, key, key_len, HA_READ_PREFIX_LAST));
@@ -3514,7 +3514,7 @@ int ha_ndbcluster::index_read_last(byte * buf, const byte * key, uint key_len)
int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key,
const key_range *end_key,
bool desc, bool sorted,
- byte* buf)
+ uchar* buf)
{
part_id_range part_spec;
ndb_index_type type= get_index_type(active_index);
@@ -3594,7 +3594,7 @@ int ha_ndbcluster::read_range_first(const key_range *start_key,
const key_range *end_key,
bool eq_r, bool sorted)
{
- byte* buf= table->record[0];
+ uchar* buf= table->record[0];
DBUG_ENTER("ha_ndbcluster::read_range_first");
DBUG_RETURN(read_range_first_to_buf(start_key, end_key, FALSE,
sorted, buf));
@@ -3684,7 +3684,7 @@ int ha_ndbcluster::rnd_end()
}
-int ha_ndbcluster::rnd_next(byte *buf)
+int ha_ndbcluster::rnd_next(uchar *buf)
{
DBUG_ENTER("rnd_next");
statistic_increment(current_thd->status_var.ha_read_rnd_next_count,
@@ -3703,7 +3703,7 @@ int ha_ndbcluster::rnd_next(byte *buf)
again
*/
-int ha_ndbcluster::rnd_pos(byte *buf, byte *pos)
+int ha_ndbcluster::rnd_pos(uchar *buf, uchar *pos)
{
DBUG_ENTER("rnd_pos");
statistic_increment(current_thd->status_var.ha_read_rnd_count,
@@ -3721,7 +3721,7 @@ int ha_ndbcluster::rnd_pos(byte *buf, byte *pos)
The partition id has been fetched from ndb
and has been stored directly after the hidden key
*/
- DBUG_DUMP("key+part", (char *)pos, key_length);
+ DBUG_DUMP("key+part", pos, key_length);
key_length= ref_length - sizeof(m_part_id);
part_spec.start_part= part_spec.end_part= *(uint32 *)(pos + key_length);
}
@@ -3738,7 +3738,7 @@ int ha_ndbcluster::rnd_pos(byte *buf, byte *pos)
}
DBUG_PRINT("info", ("partition id %u", part_spec.start_part));
}
- DBUG_DUMP("key", (char *)pos, key_length);
+ DBUG_DUMP("key", pos, key_length);
DBUG_RETURN(pk_read(pos, key_length, buf, part_spec.start_part));
}
}
@@ -3750,12 +3750,12 @@ int ha_ndbcluster::rnd_pos(byte *buf, byte *pos)
using "reference" in rnd_pos
*/
-void ha_ndbcluster::position(const byte *record)
+void ha_ndbcluster::position(const uchar *record)
{
KEY *key_info;
KEY_PART_INFO *key_part;
KEY_PART_INFO *end;
- byte *buff;
+ uchar *buff;
uint key_length;
DBUG_ENTER("position");
@@ -3781,7 +3781,7 @@ void ha_ndbcluster::position(const byte *record)
}
size_t len = key_part->length;
- const byte * ptr = record + key_part->offset;
+ const uchar * ptr = record + key_part->offset;
Field *field = key_part->field;
if (field->type() == MYSQL_TYPE_VARCHAR)
{
@@ -3832,9 +3832,9 @@ void ha_ndbcluster::position(const byte *record)
}
#ifndef DBUG_OFF
if (table_share->primary_key == MAX_KEY && m_use_partition_function)
- DBUG_DUMP("key+part", (char*)ref, key_length+sizeof(m_part_id));
+ DBUG_DUMP("key+part", ref, key_length+sizeof(m_part_id));
#endif
- DBUG_DUMP("ref", (char*)ref, key_length);
+ DBUG_DUMP("ref", ref, key_length);
DBUG_VOID_RETURN;
}
@@ -4937,8 +4937,9 @@ int ha_ndbcluster::create(const char *name,
THD *thd= current_thd;
NDBTAB tab;
NDBCOL col;
- uint pack_length, length, i, pk_length= 0;
- const void *data= NULL, *pack_data= NULL;
+ size_t pack_length, length;
+ uint i, pk_length= 0;
+ uchar *data= NULL, *pack_data= NULL;
bool create_from_engine= (create_info->table_options & HA_OPTION_CREATE_FROM_ENGINE);
bool is_truncate= (thd->lex->sql_command == SQLCOM_TRUNCATE);
char tablespace[FN_LEN];
@@ -5022,7 +5023,9 @@ int ha_ndbcluster::create(const char *name,
my_free((char*)data, MYF(0));
DBUG_RETURN(2);
}
- DBUG_PRINT("info", ("setFrm data: 0x%lx len: %d", (long) pack_data, pack_length));
+ DBUG_PRINT("info",
+ ("setFrm data: 0x%lx len: %lu", (long) pack_data,
+ (ulong) pack_length));
tab.setFrm(pack_data, pack_length);
my_free((char*)data, MYF(0));
my_free((char*)pack_data, MYF(0));
@@ -5257,7 +5260,7 @@ int ha_ndbcluster::create(const char *name,
{
uint length= (uint) strlen(name);
if ((share= (NDB_SHARE*) hash_search(&ndbcluster_open_tables,
- (byte*) name, length)))
+ (uchar*) name, length)))
handle_trailing_share(share);
}
/*
@@ -5336,8 +5339,8 @@ int ha_ndbcluster::create_handler_files(const char *file,
{
Ndb* ndb;
const NDBTAB *tab;
- const void *data= NULL, *pack_data= NULL;
- uint length, pack_length;
+ uchar *data= NULL, *pack_data= NULL;
+ size_t length, pack_length;
int error= 0;
DBUG_ENTER("create_handler_files");
@@ -6403,13 +6406,13 @@ static int ndbcluster_close_connection(handlerton *hton, THD *thd)
int ndbcluster_discover(handlerton *hton, THD* thd, const char *db,
const char *name,
- const void** frmblob,
- uint* frmlen)
+ uchar **frmblob,
+ size_t *frmlen)
{
int error= 0;
NdbError ndb_error;
- uint len;
- const void* data= NULL;
+ size_t len;
+ uchar* data= NULL;
Ndb* ndb;
char key[FN_REFLEN];
DBUG_ENTER("ndbcluster_discover");
@@ -6470,7 +6473,7 @@ int ndbcluster_discover(handlerton *hton, THD* thd, const char *db,
goto err;
}
- if (unpackfrm(&data, &len, tab->getFrmData()))
+ if (unpackfrm(&data, &len, (uchar*) tab->getFrmData()))
{
DBUG_PRINT("error", ("Could not unpack table"));
error= 1;
@@ -6540,11 +6543,11 @@ int ndbcluster_table_exists_in_engine(handlerton *hton, THD* thd,
-extern "C" byte* tables_get_key(const char *entry, uint *length,
+extern "C" uchar* tables_get_key(const char *entry, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length= strlen(entry);
- return (byte*) entry;
+ return (uchar*) entry;
}
@@ -6725,8 +6728,8 @@ int ndbcluster_find_all_files(THD *thd)
/* finalize construction of path */
end+= tablename_to_filename(elmt.name, end,
sizeof(key)-(end-key));
- const void *data= 0, *pack_data= 0;
- uint length, pack_length;
+ uchar *data= 0, *pack_data= 0;
+ size_t length, pack_length;
int discover= 0;
if (readfrm(key, &data, &length) ||
packfrm(data, length, &pack_data, &pack_length))
@@ -6854,7 +6857,7 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
continue;
}
DBUG_PRINT("info", ("Inserting %s into ndb_tables hash", elmt.name));
- my_hash_insert(&ndb_tables, (byte*)thd->strdup(elmt.name));
+ my_hash_insert(&ndb_tables, (uchar*)thd->strdup(elmt.name));
}
char *file_name;
@@ -6864,7 +6867,7 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
{
bool file_on_disk= FALSE;
DBUG_PRINT("info", ("%s", file_name));
- if (hash_search(&ndb_tables, file_name, strlen(file_name)))
+ if (hash_search(&ndb_tables, (uchar*) file_name, strlen(file_name)))
{
DBUG_PRINT("info", ("%s existed in NDB _and_ on disk ", file_name));
file_on_disk= TRUE;
@@ -6880,7 +6883,8 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
if (file_on_disk)
{
// Ignore this ndb table
- gptr record= hash_search(&ndb_tables, file_name, strlen(file_name));
+ uchar *record= hash_search(&ndb_tables, (uchar*) file_name,
+ strlen(file_name));
DBUG_ASSERT(record);
hash_delete(&ndb_tables, record);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
@@ -6893,7 +6897,7 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
if (file_on_disk)
{
// File existed in NDB and as frm file, put in ok_tables list
- my_hash_insert(&ok_tables, (byte*)file_name);
+ my_hash_insert(&ok_tables, (uchar*)file_name);
continue;
}
DBUG_PRINT("info", ("%s existed on disk", name));
@@ -6931,8 +6935,8 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
List<char> create_list;
for (i= 0 ; i < ndb_tables.records ; i++)
{
- file_name= hash_element(&ndb_tables, i);
- if (!hash_search(&ok_tables, file_name, strlen(file_name)))
+ file_name= (char*) hash_element(&ndb_tables, i);
+ if (!hash_search(&ok_tables, (uchar*) file_name, strlen(file_name)))
{
build_table_filename(name, sizeof(name), db, file_name, reg_ext, 0);
if (my_access(name, F_OK))
@@ -7556,7 +7560,7 @@ uint ndb_get_commitcount(THD *thd, char *dbname, char *tabname,
DBUG_PRINT("enter", ("name: %s", name));
pthread_mutex_lock(&ndbcluster_mutex);
if (!(share=(NDB_SHARE*) hash_search(&ndbcluster_open_tables,
- (byte*) name,
+ (uchar*) name,
strlen(name))))
{
pthread_mutex_unlock(&ndbcluster_mutex);
@@ -7781,11 +7785,11 @@ ha_ndbcluster::register_query_cache_table(THD *thd,
data we want to or can share.
*/
-static byte *ndbcluster_get_key(NDB_SHARE *share,uint *length,
+static uchar *ndbcluster_get_key(NDB_SHARE *share, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length= share->key_length;
- return (byte*) share->key;
+ return (uchar*) share->key;
}
@@ -7928,7 +7932,7 @@ int handle_trailing_share(NDB_SHARE *share)
at the cost of a possible mem leak, by "renaming" the share
- First remove from hash
*/
- hash_delete(&ndbcluster_open_tables, (byte*) share);
+ hash_delete(&ndbcluster_open_tables, (uchar*) share);
/*
now give it a new name, just a running number
@@ -7938,7 +7942,7 @@ int handle_trailing_share(NDB_SHARE *share)
const uint min_key_length= 10;
if (share->key_length < min_key_length)
{
- share->key= alloc_root(&share->mem_root, min_key_length + 1);
+ share->key= (char*) alloc_root(&share->mem_root, min_key_length + 1);
share->key_length= min_key_length;
}
share->key_length=
@@ -7946,7 +7950,7 @@ int handle_trailing_share(NDB_SHARE *share)
trailing_share_id++);
}
/* Keep it for possible the future trailing free */
- my_hash_insert(&ndbcluster_open_tables, (byte*) share);
+ my_hash_insert(&ndbcluster_open_tables, (uchar*) share);
DBUG_RETURN(0);
}
@@ -7962,11 +7966,11 @@ static int rename_share(NDB_SHARE *share, const char *new_key)
DBUG_PRINT("rename_share", ("old_key: %s old__length: %d",
share->key, share->key_length));
if ((tmp= (NDB_SHARE*) hash_search(&ndbcluster_open_tables,
- (byte*) new_key, new_length)))
+ (uchar*) new_key, new_length)))
handle_trailing_share(tmp);
/* remove the share from hash */
- hash_delete(&ndbcluster_open_tables, (byte*) share);
+ hash_delete(&ndbcluster_open_tables, (uchar*) share);
dbug_print_open_tables();
/* save old stuff if insert should fail */
@@ -7977,18 +7981,18 @@ static int rename_share(NDB_SHARE *share, const char *new_key)
now allocate and set the new key, db etc
enough space for key, db, and table_name
*/
- share->key= alloc_root(&share->mem_root, 2 * (new_length + 1));
+ share->key= (char*) alloc_root(&share->mem_root, 2 * (new_length + 1));
strmov(share->key, new_key);
share->key_length= new_length;
- if (my_hash_insert(&ndbcluster_open_tables, (byte*) share))
+ if (my_hash_insert(&ndbcluster_open_tables, (uchar*) share))
{
// ToDo free the allocated stuff above?
DBUG_PRINT("error", ("rename_share: my_hash_insert %s failed",
share->key));
share->key= old_key;
share->key_length= old_length;
- if (my_hash_insert(&ndbcluster_open_tables, (byte*) share))
+ if (my_hash_insert(&ndbcluster_open_tables, (uchar*) share))
{
sql_print_error("rename_share: failed to recover %s", share->key);
DBUG_PRINT("error", ("rename_share: my_hash_insert %s failed",
@@ -8068,7 +8072,7 @@ NDB_SHARE *ndbcluster_get_share(const char *key, TABLE *table,
if (!have_lock)
pthread_mutex_lock(&ndbcluster_mutex);
if (!(share= (NDB_SHARE*) hash_search(&ndbcluster_open_tables,
- (byte*) key,
+ (uchar*) key,
length)))
{
if (!create_if_not_exists)
@@ -8088,13 +8092,13 @@ NDB_SHARE *ndbcluster_get_share(const char *key, TABLE *table,
*root_ptr= &share->mem_root; // remember to reset before return
share->state= NSS_INITIAL;
/* enough space for key, db, and table_name */
- share->key= alloc_root(*root_ptr, 2 * (length + 1));
+ share->key= (char*) alloc_root(*root_ptr, 2 * (length + 1));
share->key_length= length;
strmov(share->key, key);
- if (my_hash_insert(&ndbcluster_open_tables, (byte*) share))
+ if (my_hash_insert(&ndbcluster_open_tables, (uchar*) share))
{
free_root(&share->mem_root, MYF(0));
- my_free((gptr) share, 0);
+ my_free((uchar*) share, 0);
*root_ptr= old_root;
if (!have_lock)
pthread_mutex_unlock(&ndbcluster_mutex);
@@ -8137,7 +8141,7 @@ void ndbcluster_real_free_share(NDB_SHARE **share)
DBUG_ENTER("ndbcluster_real_free_share");
dbug_print_share("ndbcluster_real_free_share:", *share);
- hash_delete(&ndbcluster_open_tables, (byte*) *share);
+ hash_delete(&ndbcluster_open_tables, (uchar*) *share);
thr_lock_delete(&(*share)->lock);
pthread_mutex_destroy(&(*share)->mutex);
@@ -8149,15 +8153,15 @@ void ndbcluster_real_free_share(NDB_SHARE **share)
// (*share)->table_share->mem_root is freed by free_table_share
free_table_share((*share)->table_share);
#ifndef DBUG_OFF
- bzero((gptr)(*share)->table_share, sizeof(*(*share)->table_share));
- bzero((gptr)(*share)->table, sizeof(*(*share)->table));
+ bzero((uchar*)(*share)->table_share, sizeof(*(*share)->table_share));
+ bzero((uchar*)(*share)->table, sizeof(*(*share)->table));
(*share)->table_share= 0;
(*share)->table= 0;
#endif
}
#endif
free_root(&(*share)->mem_root, MYF(0));
- my_free((gptr) *share, MYF(0));
+ my_free((uchar*) *share, MYF(0));
*share= 0;
dbug_print_open_tables();
@@ -8382,13 +8386,13 @@ ha_ndbcluster::null_value_index_search(KEY_MULTI_RANGE *ranges,
KEY* key_info= table->key_info + active_index;
KEY_MULTI_RANGE *range= ranges;
ulong reclength= table->s->reclength;
- byte *curr= (byte*)buffer->buffer;
- byte *end_of_buffer= (byte*)buffer->buffer_end;
+ uchar *curr= (uchar*)buffer->buffer;
+ uchar *end_of_buffer= (uchar*)buffer->buffer_end;
for (; range<end_range && curr+reclength <= end_of_buffer;
range++)
{
- const byte *key= range->start_key.key;
+ const uchar *key= range->start_key.key;
uint key_len= range->start_key.length;
if (check_null_in_key(key_info, key, key_len))
DBUG_RETURN(TRUE);
@@ -8456,8 +8460,8 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
/**
* Variables for loop
*/
- byte *curr= (byte*)buffer->buffer;
- byte *end_of_buffer= (byte*)buffer->buffer_end;
+ uchar *curr= (uchar*)buffer->buffer;
+ uchar *end_of_buffer= (uchar*)buffer->buffer_end;
NdbOperation::LockMode lm=
(NdbOperation::LockMode)get_ndb_lock_type(m_lock.type);
bool need_pk = (lm == NdbOperation::LM_Read);
@@ -8586,7 +8590,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
* This as we don't want mysqld to reuse the buffer when we read
* the remaining ranges
*/
- buffer->end_of_used_area= (byte*)buffer->buffer_end;
+ buffer->end_of_used_area= (uchar*)buffer->buffer_end;
}
else
{
@@ -8602,7 +8606,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
{
m_multi_range_defined= multi_range_curr;
multi_range_curr= ranges;
- m_multi_range_result_ptr= (byte*)buffer->buffer;
+ m_multi_range_result_ptr= (uchar*)buffer->buffer;
DBUG_RETURN(read_multi_range_next(found_range_p));
}
ERR_RETURN(m_active_trans->getNdbError());
@@ -8821,7 +8825,7 @@ ha_ndbcluster::update_table_comment(
char *str;
const char *fmt="%s%snumber_of_replicas: %d";
const unsigned fmt_len_plus_extra= length + strlen(fmt);
- if ((str= my_malloc(fmt_len_plus_extra, MYF(0))) == NULL)
+ if ((str= (char*) my_malloc(fmt_len_plus_extra, MYF(0))) == NULL)
{
sql_print_error("ha_ndbcluster::update_table_comment: "
"my_malloc(%u) failed", (unsigned int)fmt_len_plus_extra);
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index df621ff1938..a84ec66f399 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -84,7 +84,7 @@ typedef struct ndb_index_data {
typedef union { const NdbRecAttr *rec; NdbBlob *blob; void *ptr; } NdbValue;
int get_ndb_blobs_value(TABLE* table, NdbValue* value_array,
- byte*& buffer, uint& buffer_size,
+ uchar*& buffer, uint& buffer_size,
my_ptrdiff_t ptrdiff);
typedef enum {
@@ -115,7 +115,7 @@ typedef struct st_ndbcluster_share {
char *old_names; // for rename table
TABLE_SHARE *table_share;
TABLE *table;
- byte *record[2]; // pointer to allocated records for receiving data
+ uchar *record[2]; // pointer to allocated records for receiving data
NdbValue *ndb_value[2];
MY_BITMAP *subscriber_bitmap;
#endif
@@ -224,30 +224,30 @@ class ha_ndbcluster: public handler
int open(const char *name, int mode, uint test_if_locked);
int close(void);
- int write_row(byte *buf);
- int update_row(const byte *old_data, byte *new_data);
- int delete_row(const byte *buf);
+ int write_row(uchar *buf);
+ int update_row(const uchar *old_data, uchar *new_data);
+ int delete_row(const uchar *buf);
int index_init(uint index, bool sorted);
int index_end();
- int index_read(byte *buf, const byte *key, uint key_len,
+ int index_read(uchar *buf, const uchar *key, uint key_len,
enum ha_rkey_function find_flag);
- int index_next(byte *buf);
- int index_prev(byte *buf);
- int index_first(byte *buf);
- int index_last(byte *buf);
- int index_read_last(byte * buf, const byte * key, uint key_len);
+ int index_next(uchar *buf);
+ int index_prev(uchar *buf);
+ int index_first(uchar *buf);
+ int index_last(uchar *buf);
+ int index_read_last(uchar * buf, const uchar * key, uint key_len);
int rnd_init(bool scan);
int rnd_end();
- int rnd_next(byte *buf);
- int rnd_pos(byte *buf, byte *pos);
- void position(const byte *record);
+ int rnd_next(uchar *buf);
+ int rnd_pos(uchar *buf, uchar *pos);
+ void position(const uchar *record);
int read_range_first(const key_range *start_key,
const key_range *end_key,
bool eq_range, bool sorted);
int read_range_first_to_buf(const key_range *start_key,
const key_range *end_key,
bool eq_range, bool sorted,
- byte* buf);
+ uchar* buf);
int read_range_next();
int alter_tablespace(st_alter_tablespace *info);
@@ -416,56 +416,56 @@ private:
char* get_tablespace_name(THD *thd, char *name, uint name_len);
int set_range_data(void *tab, partition_info* part_info);
int set_list_data(void *tab, partition_info* part_info);
- int complemented_read(const byte *old_data, byte *new_data,
+ int complemented_read(const uchar *old_data, uchar *new_data,
uint32 old_part_id);
- int pk_read(const byte *key, uint key_len, byte *buf, uint32 part_id);
+ int pk_read(const uchar *key, uint key_len, uchar *buf, uint32 part_id);
int ordered_index_scan(const key_range *start_key,
const key_range *end_key,
- bool sorted, bool descending, byte* buf,
+ bool sorted, bool descending, uchar* buf,
part_id_range *part_spec);
- int unique_index_read(const byte *key, uint key_len,
- byte *buf);
+ int unique_index_read(const uchar *key, uint key_len,
+ uchar *buf);
int unique_index_scan(const KEY* key_info,
- const byte *key,
+ const uchar *key,
uint key_len,
- byte *buf);
- int full_table_scan(byte * buf);
+ uchar *buf);
+ int full_table_scan(uchar * buf);
bool check_all_operations_for_error(NdbTransaction *trans,
const NdbOperation *first,
const NdbOperation *last,
uint errcode);
- int peek_indexed_rows(const byte *record, bool check_pk);
+ int peek_indexed_rows(const uchar *record, bool check_pk);
int fetch_next(NdbScanOperation* op);
- int next_result(byte *buf);
- int define_read_attrs(byte* buf, NdbOperation* op);
- int filtered_scan(const byte *key, uint key_len,
- byte *buf,
+ int next_result(uchar *buf);
+ int define_read_attrs(uchar* buf, NdbOperation* op);
+ int filtered_scan(const uchar *key, uint key_len,
+ uchar *buf,
enum ha_rkey_function find_flag);
int close_scan();
- void unpack_record(byte *buf);
+ void unpack_record(uchar *buf);
int get_ndb_lock_type(enum thr_lock_type type);
void set_dbname(const char *pathname);
void set_tabname(const char *pathname);
bool set_hidden_key(NdbOperation*,
- uint fieldnr, const byte* field_ptr);
+ uint fieldnr, const uchar* field_ptr);
int set_ndb_key(NdbOperation*, Field *field,
- uint fieldnr, const byte* field_ptr);
+ uint fieldnr, const uchar* field_ptr);
int set_ndb_value(NdbOperation*, Field *field, uint fieldnr,
int row_offset= 0, bool *set_blob_value= 0);
- int get_ndb_value(NdbOperation*, Field *field, uint fieldnr, byte*);
+ int get_ndb_value(NdbOperation*, Field *field, uint fieldnr, uchar*);
int get_ndb_partition_id(NdbOperation *);
friend int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg);
- int set_primary_key(NdbOperation *op, const byte *key);
- int set_primary_key_from_record(NdbOperation *op, const byte *record);
- int set_index_key_from_record(NdbOperation *op, const byte *record,
+ int set_primary_key(NdbOperation *op, const uchar *key);
+ int set_primary_key_from_record(NdbOperation *op, const uchar *record);
+ int set_index_key_from_record(NdbOperation *op, const uchar *record,
uint keyno);
int set_bounds(NdbIndexScanOperation*, uint inx, bool rir,
const key_range *keys[2], uint= 0);
- int key_cmp(uint keynr, const byte * old_row, const byte * new_row);
- int set_index_key(NdbOperation *, const KEY *key_info, const byte *key_ptr);
+ int key_cmp(uint keynr, const uchar * old_row, const uchar * new_row);
+ int set_index_key(NdbOperation *, const KEY *key_info, const uchar *key_ptr);
void print_results();
virtual void get_auto_increment(ulonglong offset, ulonglong increment,
@@ -508,10 +508,10 @@ private:
THD_NDB_SHARE *m_thd_ndb_share;
// NdbRecAttr has no reference to blob
NdbValue m_value[NDB_MAX_ATTRIBUTES_IN_TABLE];
- byte m_ref[NDB_HIDDEN_PRIMARY_KEY_LENGTH];
+ uchar m_ref[NDB_HIDDEN_PRIMARY_KEY_LENGTH];
partition_info *m_part_info;
uint32 m_part_id;
- byte *m_rec0;
+ uchar *m_rec0;
Field **m_part_field_array;
bool m_use_partition_function;
bool m_sorted;
@@ -534,7 +534,7 @@ private:
bool m_slow_path;
my_ptrdiff_t m_blobs_offset;
// memory for blobs in one tuple
- char *m_blobs_buffer;
+ uchar *m_blobs_buffer;
uint32 m_blobs_buffer_size;
uint m_dupkey;
// set from thread variables at external lock
@@ -545,12 +545,12 @@ private:
ha_ndbcluster_cond *m_cond;
bool m_disable_multi_read;
- byte *m_multi_range_result_ptr;
+ uchar *m_multi_range_result_ptr;
KEY_MULTI_RANGE *m_multi_ranges;
KEY_MULTI_RANGE *m_multi_range_defined;
const NdbOperation *m_current_multi_operation;
NdbIndexScanOperation *m_multi_cursor;
- byte *m_multi_range_cursor_result_ptr;
+ uchar *m_multi_range_cursor_result_ptr;
int setup_recattr(const NdbRecAttr*);
Ndb *get_ndb();
};
diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
index 25a9ccdcb87..bfaaaadab43 100644
--- a/sql/ha_ndbcluster_binlog.cc
+++ b/sql/ha_ndbcluster_binlog.cc
@@ -130,14 +130,14 @@ static TABLE_LIST binlog_tables;
#ifndef DBUG_OFF
/* purecov: begin deadcode */
-static void print_records(TABLE *table, const char *record)
+static void print_records(TABLE *table, const uchar *record)
{
for (uint j= 0; j < table->s->fields; j++)
{
char buf[40];
int pos= 0;
Field *field= table->field[j];
- const byte* field_ptr= field->ptr - table->record[0] + record;
+ const uchar* field_ptr= field->ptr - table->record[0] + record;
int pack_len= field->pack_length();
int n= pack_len < 10 ? pack_len : 10;
@@ -196,14 +196,14 @@ static void dbug_print_table(const char *info, TABLE *table)
(long) f->ptr, (int) (f->ptr - table->record[0]),
f->null_bit,
(long) f->null_ptr,
- (int) ((byte*) f->null_ptr - table->record[0])));
+ (int) ((uchar*) f->null_ptr - table->record[0])));
if (f->type() == MYSQL_TYPE_BIT)
{
Field_bit *g= (Field_bit*) f;
DBUG_PRINT("MYSQL_TYPE_BIT",("field_length: %d bit_ptr: 0x%lx[+%d] "
"bit_ofs: %d bit_len: %u",
g->field_length, (long) g->bit_ptr,
- (int) ((byte*) g->bit_ptr -
+ (int) ((uchar*) g->bit_ptr -
table->record[0]),
g->bit_ofs, g->bit_len));
}
@@ -682,7 +682,7 @@ static NDB_SHARE *ndbcluster_check_ndb_apply_status_share()
pthread_mutex_lock(&ndbcluster_mutex);
void *share= hash_search(&ndbcluster_open_tables,
- NDB_APPLY_TABLE_FILE,
+ (uchar*) NDB_APPLY_TABLE_FILE,
sizeof(NDB_APPLY_TABLE_FILE) - 1);
DBUG_PRINT("info",("ndbcluster_check_ndb_apply_status_share %s 0x%lx",
NDB_APPLY_TABLE_FILE, (long) share));
@@ -700,7 +700,7 @@ static NDB_SHARE *ndbcluster_check_ndb_schema_share()
pthread_mutex_lock(&ndbcluster_mutex);
void *share= hash_search(&ndbcluster_open_tables,
- NDB_SCHEMA_TABLE_FILE,
+ (uchar*) NDB_SCHEMA_TABLE_FILE,
sizeof(NDB_SCHEMA_TABLE_FILE) - 1);
DBUG_PRINT("info",("ndbcluster_check_ndb_schema_share %s 0x%lx",
NDB_SCHEMA_TABLE_FILE, (long) share));
@@ -904,7 +904,7 @@ static void ndbcluster_get_schema(NDB_SHARE *share,
TABLE *table= share->table;
Field **field;
/* unpack blob values */
- byte* blobs_buffer= 0;
+ uchar* blobs_buffer= 0;
uint blobs_buffer_size= 0;
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
{
@@ -919,14 +919,14 @@ static void ndbcluster_get_schema(NDB_SHARE *share,
DBUG_ASSERT(FALSE);
}
}
- /* db varchar 1 length byte */
+ /* db varchar 1 length uchar */
field= table->field;
s->db_length= *(uint8*)(*field)->ptr;
DBUG_ASSERT(s->db_length <= (*field)->field_length);
DBUG_ASSERT((*field)->field_length + 1 == sizeof(s->db));
memcpy(s->db, (*field)->ptr + 1, s->db_length);
s->db[s->db_length]= 0;
- /* name varchar 1 length byte */
+ /* name varchar 1 length uchar */
field++;
s->name_length= *(uint8*)(*field)->ptr;
DBUG_ASSERT(s->name_length <= (*field)->field_length);
@@ -943,13 +943,11 @@ static void ndbcluster_get_schema(NDB_SHARE *share,
{
Field_blob *field_blob= (Field_blob*)(*field);
uint blob_len= field_blob->get_length((*field)->ptr);
- char *blob_ptr= 0;
+ uchar *blob_ptr= 0;
field_blob->get_ptr(&blob_ptr);
assert(blob_len == 0 || blob_ptr != 0);
s->query_length= blob_len;
- s->query= sql_alloc(blob_len+1);
- memcpy(s->query, blob_ptr, blob_len);
- s->query[blob_len]= 0;
+ s->query= sql_strmake((char*) blob_ptr, blob_len);
}
/* node_id */
field++;
@@ -1318,7 +1316,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
(void) pthread_mutex_unlock(&ndb_schema_object->mutex);
}
- DBUG_DUMP("schema_subscribers", (char*)schema_subscribers.bitmap,
+ DBUG_DUMP("schema_subscribers", (uchar*)schema_subscribers.bitmap,
no_bytes_in_map(&schema_subscribers));
DBUG_PRINT("info", ("bitmap_is_clear_all(&schema_subscribers): %d",
bitmap_is_clear_all(&schema_subscribers)));
@@ -1522,7 +1520,7 @@ end:
bitmap_intersect(&ndb_schema_object->slock_bitmap, &schema_subscribers);
DBUG_DUMP("ndb_schema_object->slock_bitmap.bitmap",
- (char*)ndb_schema_object->slock_bitmap.bitmap,
+ (uchar*)ndb_schema_object->slock_bitmap.bitmap,
no_bytes_in_map(&ndb_schema_object->slock_bitmap));
if (bitmap_is_clear_all(&ndb_schema_object->slock_bitmap))
@@ -1607,8 +1605,8 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp,
{
const char *tabname= table_share->table_name.str;
char key[FN_REFLEN];
- const void *data= 0, *pack_data= 0;
- uint length, pack_length;
+ uchar *data= 0, *pack_data= 0;
+ size_t length, pack_length;
int error;
NDBDICT *dict= ndb->getDictionary();
const NDBTAB *altered_table= pOp->getTable();
@@ -1626,7 +1624,7 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp,
packfrm(data, length, &pack_data, &pack_length) == 0 &&
cmp_frm(altered_table, pack_data, pack_length))
{
- DBUG_DUMP("frm", (char*)altered_table->getFrmData(),
+ DBUG_DUMP("frm", (uchar*) altered_table->getFrmData(),
altered_table->getFrmLength());
pthread_mutex_lock(&LOCK_open);
Ndb_table_guard ndbtab_g(dict, tabname);
@@ -1637,7 +1635,8 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp,
my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
data= NULL;
- if ((error= unpackfrm(&data, &length, altered_table->getFrmData())) ||
+ if ((error= unpackfrm(&data, &length,
+ (const uchar*) altered_table->getFrmData())) ||
(error= writefrm(key, data, length)))
{
sql_print_information("NDB: Failed write frm for %s.%s, error %d",
@@ -1957,7 +1956,7 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb,
if (log_query && ndb_binlog_running)
ndb_binlog_query(thd, schema);
/* signal that schema operation has been handled */
- DBUG_DUMP("slock", (char*)schema->slock, schema->slock_length);
+ DBUG_DUMP("slock", (uchar*) schema->slock, schema->slock_length);
if (bitmap_is_set(&slock, node_id))
{
if (post_epoch_unlock)
@@ -2104,14 +2103,14 @@ ndb_binlog_thread_handle_schema_event_post_epoch(THD *thd,
pthread_mutex_lock(&ndbcluster_mutex);
NDB_SCHEMA_OBJECT *ndb_schema_object=
(NDB_SCHEMA_OBJECT*) hash_search(&ndb_schema_objects,
- (byte*) key, strlen(key));
+ (uchar*) key, strlen(key));
if (ndb_schema_object)
{
pthread_mutex_lock(&ndb_schema_object->mutex);
memcpy(ndb_schema_object->slock, schema->slock,
sizeof(ndb_schema_object->slock));
DBUG_DUMP("ndb_schema_object->slock_bitmap.bitmap",
- (char*)ndb_schema_object->slock_bitmap.bitmap,
+ (uchar*)ndb_schema_object->slock_bitmap.bitmap,
no_bytes_in_map(&ndb_schema_object->slock_bitmap));
pthread_mutex_unlock(&ndb_schema_object->mutex);
pthread_cond_signal(&injector_cond);
@@ -2495,7 +2494,7 @@ int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key,
/* Handle any trailing share */
NDB_SHARE *share= (NDB_SHARE*) hash_search(&ndbcluster_open_tables,
- (byte*) key, key_len);
+ (uchar*) key, key_len);
if (share && share_may_exist)
{
@@ -2906,10 +2905,10 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab,
if (is_ndb_compatible_type(f))
{
DBUG_PRINT("info", ("%s compatible", col_name));
- attr0.rec= op->getValue(col_name, f->ptr);
+ attr0.rec= op->getValue(col_name, (char*) f->ptr);
attr1.rec= op->getPreValue(col_name,
- (f->ptr - share->table->record[0]) +
- share->table->record[1]);
+ (f->ptr - share->table->record[0]) +
+ (char*) share->table->record[1]);
}
else if (! (f->flags & BLOB_FLAG))
{
@@ -3295,7 +3294,7 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp,
for now malloc/free blobs buffer each time
TODO if possible share single permanent buffer with handlers
*/
- byte* blobs_buffer[2] = { 0, 0 };
+ uchar* blobs_buffer[2] = { 0, 0 };
uint blobs_buffer_size[2] = { 0, 0 };
switch(pOp->getEventType())
@@ -3455,11 +3454,13 @@ private:
Injector thread main loop
****************************************************************/
-static byte *ndb_schema_objects_get_key(NDB_SCHEMA_OBJECT *schema_object, uint *length,
- my_bool not_used __attribute__((unused)))
+static uchar *
+ndb_schema_objects_get_key(NDB_SCHEMA_OBJECT *schema_object,
+ size_t *length,
+ my_bool not_used __attribute__((unused)))
{
*length= schema_object->key_length;
- return (byte*) schema_object->key;
+ return (uchar*) schema_object->key;
}
static NDB_SCHEMA_OBJECT *ndb_get_schema_object(const char *key,
@@ -3475,7 +3476,7 @@ static NDB_SCHEMA_OBJECT *ndb_get_schema_object(const char *key,
pthread_mutex_lock(&ndbcluster_mutex);
while (!(ndb_schema_object=
(NDB_SCHEMA_OBJECT*) hash_search(&ndb_schema_objects,
- (byte*) key,
+ (uchar*) key,
length)))
{
if (!create_if_not_exists)
@@ -3493,9 +3494,9 @@ static NDB_SCHEMA_OBJECT *ndb_get_schema_object(const char *key,
ndb_schema_object->key= (char *)(ndb_schema_object+1);
memcpy(ndb_schema_object->key, key, length + 1);
ndb_schema_object->key_length= length;
- if (my_hash_insert(&ndb_schema_objects, (byte*) ndb_schema_object))
+ if (my_hash_insert(&ndb_schema_objects, (uchar*) ndb_schema_object))
{
- my_free((gptr) ndb_schema_object, 0);
+ my_free((uchar*) ndb_schema_object, 0);
break;
}
pthread_mutex_init(&ndb_schema_object->mutex, MY_MUTEX_INIT_FAST);
@@ -3525,9 +3526,9 @@ static void ndb_free_schema_object(NDB_SCHEMA_OBJECT **ndb_schema_object,
if (!--(*ndb_schema_object)->use_count)
{
DBUG_PRINT("info", ("use_count: %d", (*ndb_schema_object)->use_count));
- hash_delete(&ndb_schema_objects, (byte*) *ndb_schema_object);
+ hash_delete(&ndb_schema_objects, (uchar*) *ndb_schema_object);
pthread_mutex_destroy(&(*ndb_schema_object)->mutex);
- my_free((gptr) *ndb_schema_object, MYF(0));
+ my_free((uchar*) *ndb_schema_object, MYF(0));
*ndb_schema_object= 0;
}
else
@@ -3956,7 +3957,7 @@ restart:
NdbDictionary::Event::TE_DELETE)) == 0)
{
DBUG_PRINT("info", ("skipping non data event table: %.*s",
- name.length, name.str));
+ (int) name.length, name.str));
continue;
}
if (!trans.good())
@@ -3965,7 +3966,8 @@ restart:
("Found new data event, initializing transaction"));
inj->new_trans(thd, &trans);
}
- DBUG_PRINT("info", ("use_table: %.*s", name.length, name.str));
+ DBUG_PRINT("info", ("use_table: %.*s",
+ (int) name.length, name.str));
injector::transaction::table tbl(table, TRUE);
IF_DBUG(int ret=) trans.use_table(::server_id, tbl);
DBUG_ASSERT(ret == 0);
@@ -3979,7 +3981,8 @@ restart:
#ifndef DBUG_OFF
const LEX_STRING& name= table->s->table_name;
- DBUG_PRINT("info", ("use_table: %.*s", name.length, name.str));
+ DBUG_PRINT("info", ("use_table: %.*s",
+ (int) name.length, name.str));
#endif
injector::transaction::table tbl(table, TRUE);
IF_DBUG(int ret=) trans.use_table(::server_id, tbl);
diff --git a/sql/ha_ndbcluster_binlog.h b/sql/ha_ndbcluster_binlog.h
index ac0d769433e..b5b8d0d9745 100644
--- a/sql/ha_ndbcluster_binlog.h
+++ b/sql/ha_ndbcluster_binlog.h
@@ -184,7 +184,7 @@ int ndbcluster_find_all_files(THD *thd);
#endif /* HAVE_NDB_BINLOG */
void ndb_unpack_record(TABLE *table, NdbValue *value,
- MY_BITMAP *defined, byte *buf);
+ MY_BITMAP *defined, uchar *buf);
char *ndb_pack_varchar(const NDBCOL *col, char *buf,
const char *str, int sz);
diff --git a/sql/ha_ndbcluster_cond.cc b/sql/ha_ndbcluster_cond.cc
index 267be17c330..c686e83504c 100644
--- a/sql/ha_ndbcluster_cond.cc
+++ b/sql/ha_ndbcluster_cond.cc
@@ -1377,9 +1377,9 @@ ha_ndbcluster_cond::generate_scan_filter_from_cond(NdbScanFilter& filter)
int ha_ndbcluster_cond::generate_scan_filter_from_key(NdbScanOperation *op,
const KEY* key_info,
- const byte *key,
+ const uchar *key,
uint key_len,
- byte *buf)
+ uchar *buf)
{
KEY_PART_INFO* key_part= key_info->key_part;
KEY_PART_INFO* end= key_part+key_info->key_parts;
@@ -1392,9 +1392,9 @@ int ha_ndbcluster_cond::generate_scan_filter_from_key(NdbScanOperation *op,
{
Field* field= key_part->field;
uint32 pack_len= field->pack_length();
- const byte* ptr= key;
+ const uchar* ptr= key;
DBUG_PRINT("info", ("Filtering value for %s", field->field_name));
- DBUG_DUMP("key", (char*)ptr, pack_len);
+ DBUG_DUMP("key", ptr, pack_len);
if (key_part->null_bit)
{
DBUG_PRINT("info", ("Generating ISNULL filter"));
diff --git a/sql/ha_ndbcluster_cond.h b/sql/ha_ndbcluster_cond.h
index 617302107d8..d5b3b913f22 100644
--- a/sql/ha_ndbcluster_cond.h
+++ b/sql/ha_ndbcluster_cond.h
@@ -198,7 +198,7 @@ public:
return value.item->str_value.ptr();
break;
case(NDB_FIELD):
- return value.field_value->field->ptr;
+ return (char*) value.field_value->field->ptr;
default:
break;
}
@@ -458,9 +458,9 @@ public:
int generate_scan_filter_from_cond(NdbScanFilter& filter);
int generate_scan_filter_from_key(NdbScanOperation* op,
const KEY* key_info,
- const byte *key,
+ const uchar *key,
uint key_len,
- byte *buf);
+ uchar *buf);
private:
bool serialize_cond(const COND *cond, Ndb_cond_stack *ndb_cond,
TABLE *table, const NdbDictionary::Table *ndb_table);
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index d3979fa0718..5393e8499b0 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -1224,9 +1224,9 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
const char *path,
ulonglong *copied,
ulonglong *deleted,
- const void *pack_frm_data
+ const uchar *pack_frm_data
__attribute__((unused)),
- uint pack_frm_len
+ size_t pack_frm_len
__attribute__((unused)))
{
List_iterator<partition_element> part_it(m_part_info->partitions);
@@ -1964,7 +1964,7 @@ bool ha_partition::create_handler_file(const char *name)
if ((file= my_create(file_name, CREATE_MODE, O_RDWR | O_TRUNC,
MYF(MY_WME))) >= 0)
{
- result= my_write(file, (byte *) file_buffer, tot_len_byte,
+ result= my_write(file, (uchar *) file_buffer, tot_len_byte,
MYF(MY_WME | MY_NABP));
VOID(my_close(file, MYF(0)));
}
@@ -2141,14 +2141,14 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root)
/* Following could be done with my_stat to read in whole file */
if ((file= my_open(buff, O_RDONLY | O_SHARE, MYF(0))) < 0)
DBUG_RETURN(TRUE);
- if (my_read(file, (byte *) & buff[0], 8, MYF(MY_NABP)))
+ if (my_read(file, (uchar *) & buff[0], 8, MYF(MY_NABP)))
goto err1;
len_words= uint4korr(buff);
len_bytes= 4 * len_words;
- if (!(file_buffer= my_malloc(len_bytes, MYF(0))))
+ if (!(file_buffer= (char*) my_malloc(len_bytes, MYF(0))))
goto err1;
VOID(my_seek(file, 0, MY_SEEK_SET, MYF(0)));
- if (my_read(file, (byte *) file_buffer, len_bytes, MYF(MY_NABP)))
+ if (my_read(file, (uchar *) file_buffer, len_bytes, MYF(MY_NABP)))
goto err2;
chksum= 0;
@@ -2237,7 +2237,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
alloc_len+= table->s->max_key_length;
if (!m_ordered_rec_buffer)
{
- if (!(m_ordered_rec_buffer= (byte*)my_malloc(alloc_len, MYF(MY_WME))))
+ if (!(m_ordered_rec_buffer= (uchar*)my_malloc(alloc_len, MYF(MY_WME))))
{
DBUG_RETURN(1);
}
@@ -2256,7 +2256,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
int2store(ptr, i);
ptr+= m_rec_length + PARTITION_BYTES_IN_POS;
} while (++i < m_tot_parts);
- m_start_key.key= (const byte*)ptr;
+ m_start_key.key= (const uchar*)ptr;
}
}
@@ -2641,13 +2641,13 @@ void ha_partition::unlock_row()
may be used in determining which partition the row should be written to.
*/
-int ha_partition::write_row(byte * buf)
+int ha_partition::write_row(uchar * buf)
{
uint32 part_id;
int error;
longlong func_value;
#ifdef NOT_NEEDED
- byte *rec0= m_rec0;
+ uchar *rec0= m_rec0;
#endif
DBUG_ENTER("ha_partition::write_row");
DBUG_ASSERT(buf == m_rec0);
@@ -2721,7 +2721,7 @@ int ha_partition::write_row(byte * buf)
old_data is normally record[1] but may be anything
*/
-int ha_partition::update_row(const byte *old_data, byte *new_data)
+int ha_partition::update_row(const uchar *old_data, uchar *new_data)
{
uint32 new_part_id, old_part_id;
int error;
@@ -2793,7 +2793,7 @@ int ha_partition::update_row(const byte *old_data, byte *new_data)
buf is either record[0] or record[1]
*/
-int ha_partition::delete_row(const byte *buf)
+int ha_partition::delete_row(const uchar *buf)
{
uint32 part_id;
int error;
@@ -3064,7 +3064,7 @@ int ha_partition::rnd_end()
sql_table.cc, and sql_update.cc.
*/
-int ha_partition::rnd_next(byte *buf)
+int ha_partition::rnd_next(uchar *buf)
{
handler *file;
int result= HA_ERR_END_OF_FILE;
@@ -3157,7 +3157,7 @@ end:
Called from filesort.cc, sql_select.cc, sql_delete.cc and sql_update.cc.
*/
-void ha_partition::position(const byte *record)
+void ha_partition::position(const uchar *record)
{
handler *file= m_file[m_last_part];
DBUG_ENTER("ha_partition::position");
@@ -3197,13 +3197,13 @@ void ha_partition::position(const byte *record)
sql_update.cc.
*/
-int ha_partition::rnd_pos(byte * buf, byte *pos)
+int ha_partition::rnd_pos(uchar * buf, uchar *pos)
{
uint part_id;
handler *file;
DBUG_ENTER("ha_partition::rnd_pos");
- part_id= uint2korr((const byte *) pos);
+ part_id= uint2korr((const uchar *) pos);
DBUG_ASSERT(part_id < m_tot_parts);
file= m_file[part_id];
m_last_part= part_id;
@@ -3335,7 +3335,7 @@ int ha_partition::index_end()
used in conjuntion with multi read ranges.
*/
-int ha_partition::index_read(byte * buf, const byte * key,
+int ha_partition::index_read(uchar * buf, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -3356,7 +3356,7 @@ int ha_partition::index_read(byte * buf, const byte * key,
see index_read for rest
*/
-int ha_partition::common_index_read(byte *buf, const byte *key,
+int ha_partition::common_index_read(uchar *buf, const uchar *key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -3433,7 +3433,7 @@ int ha_partition::common_index_read(byte *buf, const byte *key,
and sql_select.cc.
*/
-int ha_partition::index_first(byte * buf)
+int ha_partition::index_first(uchar * buf)
{
DBUG_ENTER("ha_partition::index_first");
@@ -3464,7 +3464,7 @@ int ha_partition::index_first(byte * buf)
and sql_select.cc.
*/
-int ha_partition::index_last(byte * buf)
+int ha_partition::index_last(uchar * buf)
{
DBUG_ENTER("ha_partition::index_last");
@@ -3481,7 +3481,7 @@ int ha_partition::index_last(byte * buf)
see index_first for rest
*/
-int ha_partition::common_first_last(byte *buf)
+int ha_partition::common_first_last(uchar *buf)
{
int error;
@@ -3512,7 +3512,7 @@ int ha_partition::common_first_last(byte *buf)
Can only be used on indexes supporting HA_READ_ORDER
*/
-int ha_partition::index_read_last(byte *buf, const byte *key,
+int ha_partition::index_read_last(uchar *buf, const uchar *key,
key_part_map keypart_map)
{
DBUG_ENTER("ha_partition::index_read_last");
@@ -3539,7 +3539,7 @@ int ha_partition::index_read_last(byte *buf, const byte *key,
Used to read forward through the index.
*/
-int ha_partition::index_next(byte * buf)
+int ha_partition::index_next(uchar * buf)
{
DBUG_ENTER("ha_partition::index_next");
@@ -3575,7 +3575,7 @@ int ha_partition::index_next(byte * buf)
as supplied in the call.
*/
-int ha_partition::index_next_same(byte *buf, const byte *key, uint keylen)
+int ha_partition::index_next_same(uchar *buf, const uchar *key, uint keylen)
{
DBUG_ENTER("ha_partition::index_next_same");
@@ -3602,7 +3602,7 @@ int ha_partition::index_next_same(byte *buf, const byte *key, uint keylen)
Used to read backwards through the index.
*/
-int ha_partition::index_prev(byte * buf)
+int ha_partition::index_prev(uchar * buf)
{
DBUG_ENTER("ha_partition::index_prev");
@@ -3711,7 +3711,7 @@ int ha_partition::read_range_next()
of them
*/
-int ha_partition::partition_scan_set_up(byte * buf, bool idx_read_flag)
+int ha_partition::partition_scan_set_up(uchar * buf, bool idx_read_flag)
{
DBUG_ENTER("ha_partition::partition_scan_set_up");
@@ -3792,7 +3792,7 @@ int ha_partition::partition_scan_set_up(byte * buf, bool idx_read_flag)
perform any sort.
*/
-int ha_partition::handle_unordered_next(byte *buf, bool is_next_same)
+int ha_partition::handle_unordered_next(uchar *buf, bool is_next_same)
{
handler *file= file= m_file[m_part_spec.start_part];
int error;
@@ -3847,7 +3847,7 @@ int ha_partition::handle_unordered_next(byte *buf, bool is_next_same)
Both initial start and after completing scan on one partition.
*/
-int ha_partition::handle_unordered_scan_next_partition(byte * buf)
+int ha_partition::handle_unordered_scan_next_partition(uchar * buf)
{
uint i;
DBUG_ENTER("ha_partition::handle_unordered_scan_next_partition");
@@ -3934,7 +3934,7 @@ int ha_partition::handle_unordered_scan_next_partition(byte * buf)
entries.
*/
-int ha_partition::handle_ordered_index_scan(byte *buf, bool reverse_order)
+int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order)
{
uint i;
uint j= 0;
@@ -3949,7 +3949,7 @@ int ha_partition::handle_ordered_index_scan(byte *buf, bool reverse_order)
{
if (!(bitmap_is_set(&(m_part_info->used_partitions), i)))
continue;
- byte *rec_buf_ptr= rec_buf(i);
+ uchar *rec_buf_ptr= rec_buf(i);
int error;
handler *file= m_file[i];
@@ -3984,7 +3984,7 @@ int ha_partition::handle_ordered_index_scan(byte *buf, bool reverse_order)
/*
Initialise queue without order first, simply insert
*/
- queue_element(&m_queue, j++)= (byte*)queue_buf(i);
+ queue_element(&m_queue, j++)= (uchar*)queue_buf(i);
}
else if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
{
@@ -4021,11 +4021,11 @@ int ha_partition::handle_ordered_index_scan(byte *buf, bool reverse_order)
NONE
*/
-void ha_partition::return_top_record(byte *buf)
+void ha_partition::return_top_record(uchar *buf)
{
uint part_id;
- byte *key_buffer= queue_top(&m_queue);
- byte *rec_buffer= key_buffer + PARTITION_BYTES_IN_POS;
+ uchar *key_buffer= queue_top(&m_queue);
+ uchar *rec_buffer= key_buffer + PARTITION_BYTES_IN_POS;
part_id= uint2korr(key_buffer);
memcpy(buf, rec_buffer, m_rec_length);
@@ -4048,7 +4048,7 @@ void ha_partition::return_top_record(byte *buf)
other Error code
*/
-int ha_partition::handle_ordered_next(byte *buf, bool is_next_same)
+int ha_partition::handle_ordered_next(uchar *buf, bool is_next_same)
{
int error;
uint part_id= m_top_entry;
@@ -4097,7 +4097,7 @@ int ha_partition::handle_ordered_next(byte *buf, bool is_next_same)
other Error code
*/
-int ha_partition::handle_ordered_prev(byte *buf)
+int ha_partition::handle_ordered_prev(uchar *buf)
{
int error;
uint part_id= m_top_entry;
@@ -5342,7 +5342,7 @@ uint ha_partition::min_record_length(uint options) const
they are the same. Sort in partition id order if not equal.
*/
-int ha_partition::cmp_ref(const byte *ref1, const byte *ref2)
+int ha_partition::cmp_ref(const uchar *ref1, const uchar *ref2)
{
uint part_id;
my_ptrdiff_t diff1, diff2;
@@ -5551,11 +5551,11 @@ static int partition_init= 0;
Function we use in the creation of our hash to get key.
*/
-static byte *partition_get_key(PARTITION_SHARE *share, uint *length,
+static uchar *partition_get_key(PARTITION_SHARE *share, size_t *length,
my_bool not_used __attribute__ ((unused)))
{
*length= share->table_name_length;
- return (byte *) share->table_name;
+ return (uchar *) share->table_name;
}
/*
@@ -5595,12 +5595,12 @@ static PARTITION_SHARE *get_share(const char *table_name, TABLE *table)
length= (uint) strlen(table_name);
if (!(share= (PARTITION_SHARE *) hash_search(&partition_open_tables,
- (byte *) table_name, length)))
+ (uchar *) table_name, length)))
{
if (!(share= (PARTITION_SHARE *)
my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
- &share, sizeof(*share),
- &tmp_name, length + 1, NullS)))
+ &share, (uint) sizeof(*share),
+ &tmp_name, (uint) length + 1, NullS)))
{
pthread_mutex_unlock(&partition_mutex);
return NULL;
@@ -5610,7 +5610,7 @@ static PARTITION_SHARE *get_share(const char *table_name, TABLE *table)
share->table_name_length= length;
share->table_name= tmp_name;
strmov(share->table_name, table_name);
- if (my_hash_insert(&partition_open_tables, (byte *) share))
+ if (my_hash_insert(&partition_open_tables, (uchar *) share))
goto error;
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST);
@@ -5622,7 +5622,7 @@ static PARTITION_SHARE *get_share(const char *table_name, TABLE *table)
error:
pthread_mutex_unlock(&partition_mutex);
- my_free((gptr) share, MYF(0));
+ my_free((uchar*) share, MYF(0));
return NULL;
}
@@ -5639,10 +5639,10 @@ static int free_share(PARTITION_SHARE *share)
pthread_mutex_lock(&partition_mutex);
if (!--share->use_count)
{
- hash_delete(&partition_open_tables, (byte *) share);
+ hash_delete(&partition_open_tables, (uchar *) share);
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
- my_free((gptr) share, MYF(0));
+ my_free((uchar*) share, MYF(0));
}
pthread_mutex_unlock(&partition_mutex);
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index a081e4bb472..0878c75ec42 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -61,12 +61,12 @@ private:
handler **m_reorged_file; // Reorganised partitions
handler **m_added_file; // Added parts kept for errors
partition_info *m_part_info; // local reference to partition
- byte *m_start_key_ref; // Reference of start key in current
+ uchar *m_start_key_ref; // Reference of start key in current
// index scan info
Field **m_part_field_array; // Part field array locally to save acc
- byte *m_ordered_rec_buffer; // Row and key buffer for ord. idx scan
+ uchar *m_ordered_rec_buffer; // Row and key buffer for ord. idx scan
KEY *m_curr_key_info; // Current index
- byte *m_rec0; // table->record[0]
+ uchar *m_rec0; // table->record[0]
QUEUE m_queue; // Prio queue used by sorted read
/*
Since the partition handler is a handler on top of other handlers, it
@@ -195,8 +195,8 @@ public:
const char *path,
ulonglong *copied,
ulonglong *deleted,
- const void *pack_frm_data,
- uint pack_frm_len);
+ const uchar *pack_frm_data,
+ size_t pack_frm_len);
virtual int drop_partitions(const char *path);
virtual int rename_partitions(const char *path);
bool get_no_parts(const char *name, uint *no_parts)
@@ -306,9 +306,9 @@ public:
number of calls to write_row.
Not yet though.
*/
- virtual int write_row(byte * buf);
- virtual int update_row(const byte * old_data, byte * new_data);
- virtual int delete_row(const byte * buf);
+ virtual int write_row(uchar * buf);
+ virtual int update_row(const uchar * old_data, uchar * new_data);
+ virtual int delete_row(const uchar * buf);
virtual int delete_all_rows(void);
virtual void start_bulk_insert(ha_rows rows);
virtual int end_bulk_insert();
@@ -347,9 +347,9 @@ public:
*/
virtual int rnd_init(bool scan);
virtual int rnd_end();
- virtual int rnd_next(byte * buf);
- virtual int rnd_pos(byte * buf, byte * pos);
- virtual void position(const byte * record);
+ virtual int rnd_next(uchar * buf);
+ virtual int rnd_pos(uchar * buf, uchar * pos);
+ virtual void position(const uchar * record);
/*
-------------------------------------------------------------------------
@@ -383,7 +383,7 @@ public:
index_init initializes an index before using it and index_end does
any end processing needed.
*/
- virtual int index_read(byte * buf, const byte * key,
+ virtual int index_read(uchar * buf, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag);
virtual int index_init(uint idx, bool sorted);
@@ -393,12 +393,12 @@ public:
These methods are used to jump to next or previous entry in the index
scan. There are also methods to jump to first and last entry.
*/
- virtual int index_next(byte * buf);
- virtual int index_prev(byte * buf);
- virtual int index_first(byte * buf);
- virtual int index_last(byte * buf);
- virtual int index_next_same(byte * buf, const byte * key, uint keylen);
- virtual int index_read_last(byte * buf, const byte * key,
+ virtual int index_next(uchar * buf);
+ virtual int index_prev(uchar * buf);
+ virtual int index_first(uchar * buf);
+ virtual int index_last(uchar * buf);
+ virtual int index_next_same(uchar * buf, const uchar * key, uint keylen);
+ virtual int index_read_last(uchar * buf, const uchar * key,
key_part_map keypart_map);
/*
@@ -406,7 +406,7 @@ public:
handler.cc, no storage engine has implemented it so neither
will the partition handler.
- virtual int read_first_row(byte *buf, uint primary_key);
+ virtual int read_first_row(uchar *buf, uint primary_key);
*/
/*
@@ -424,27 +424,27 @@ public:
virtual int read_range_next();
private:
- int common_index_read(byte * buf, const byte * key,
+ int common_index_read(uchar * buf, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag);
- int common_first_last(byte * buf);
- int partition_scan_set_up(byte * buf, bool idx_read_flag);
- int handle_unordered_next(byte * buf, bool next_same);
- int handle_unordered_scan_next_partition(byte * buf);
- byte *queue_buf(uint part_id)
+ int common_first_last(uchar * buf);
+ int partition_scan_set_up(uchar * buf, bool idx_read_flag);
+ int handle_unordered_next(uchar * buf, bool next_same);
+ int handle_unordered_scan_next_partition(uchar * buf);
+ uchar *queue_buf(uint part_id)
{
return (m_ordered_rec_buffer +
(part_id * (m_rec_length + PARTITION_BYTES_IN_POS)));
}
- byte *rec_buf(uint part_id)
+ uchar *rec_buf(uint part_id)
{
return (queue_buf(part_id) +
PARTITION_BYTES_IN_POS);
}
- int handle_ordered_index_scan(byte * buf, bool reverse_order);
- int handle_ordered_next(byte * buf, bool next_same);
- int handle_ordered_prev(byte * buf);
- void return_top_record(byte * buf);
+ int handle_ordered_index_scan(uchar * buf, bool reverse_order);
+ int handle_ordered_next(uchar * buf, bool next_same);
+ int handle_ordered_prev(uchar * buf);
+ void return_top_record(uchar * buf);
void include_partition_fields_in_used_fields();
public:
/*
@@ -809,7 +809,7 @@ public:
to check whether the rest of the reference part is also the same.
-------------------------------------------------------------------------
*/
- virtual int cmp_ref(const byte * ref1, const byte * ref2);
+ virtual int cmp_ref(const uchar * ref1, const uchar * ref2);
/*
-------------------------------------------------------------------------
MODULE auto increment
@@ -873,10 +873,10 @@ public:
Fulltext stuff not yet.
-------------------------------------------------------------------------
virtual int ft_init() { return HA_ERR_WRONG_COMMAND; }
- virtual FT_INFO *ft_init_ext(uint flags,uint inx,const byte *key,
+ virtual FT_INFO *ft_init_ext(uint flags,uint inx,const uchar *key,
uint keylen)
{ return NULL; }
- virtual int ft_read(byte *buf) { return HA_ERR_WRONG_COMMAND; }
+ virtual int ft_read(uchar *buf) { return HA_ERR_WRONG_COMMAND; }
*/
/*
@@ -885,7 +885,7 @@ public:
-------------------------------------------------------------------------
The following method is only used by MyISAM when used as
temporary tables in a join.
- virtual int restart_rnd_next(byte *buf, byte *pos);
+ virtual int restart_rnd_next(uchar *buf, uchar *pos);
*/
/*
diff --git a/sql/handler.cc b/sql/handler.cc
index e0018a66400..f28e0d0bc20 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -353,7 +353,7 @@ static int ha_finish_errors(void)
/* Allocate a pointer array for the error message strings. */
if (! (errmsgs= my_error_unregister(HA_ERR_FIRST, HA_ERR_LAST)))
return 1;
- my_free((gptr) errmsgs, MYF(0));
+ my_free((uchar*) errmsgs, MYF(0));
return 0;
}
@@ -391,7 +391,7 @@ int ha_finalize_handlerton(st_plugin_int *plugin)
}
}
- my_free((gptr)hton, MYF(0));
+ my_free((uchar*)hton, MYF(0));
DBUG_RETURN(0);
}
@@ -1037,7 +1037,7 @@ static my_bool xarecover_handlerton(THD *unused, st_plugin_int *plugin,
}
// recovery mode
if (info->commit_list ?
- hash_search(info->commit_list, (byte *)&x, sizeof(x)) != 0 :
+ hash_search(info->commit_list, (uchar *)&x, sizeof(x)) != 0 :
tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT)
{
#ifndef DBUG_OFF
@@ -1107,7 +1107,7 @@ int ha_recover(HASH *commit_list)
plugin_foreach(NULL, xarecover_handlerton,
MYSQL_STORAGE_ENGINE_PLUGIN, &info);
- my_free((gptr)info.list, MYF(0));
+ my_free((uchar*)info.list, MYF(0));
if (info.found_foreign_xids)
sql_print_warning("Found %d prepared XA transactions",
info.found_foreign_xids);
@@ -1231,7 +1231,7 @@ int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv)
{
int err;
DBUG_ASSERT((*ht)->savepoint_set != 0);
- if ((err= (*(*ht)->savepoint_rollback)(*ht, thd, (byte *)(sv+1)+(*ht)->savepoint_offset)))
+ if ((err= (*(*ht)->savepoint_rollback)(*ht, thd, (uchar *)(sv+1)+(*ht)->savepoint_offset)))
{ // cannot happen
my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err);
error=1;
@@ -1280,7 +1280,7 @@ int ha_savepoint(THD *thd, SAVEPOINT *sv)
error=1;
break;
}
- if ((err= (*(*ht)->savepoint_set)(*ht, thd, (byte *)(sv+1)+(*ht)->savepoint_offset)))
+ if ((err= (*(*ht)->savepoint_set)(*ht, thd, (uchar *)(sv+1)+(*ht)->savepoint_offset)))
{ // cannot happen
my_error(ER_GET_ERRNO, MYF(0), err);
error=1;
@@ -1307,7 +1307,7 @@ int ha_release_savepoint(THD *thd, SAVEPOINT *sv)
if (!(*ht)->savepoint_release)
continue;
if ((err= (*(*ht)->savepoint_release)(*ht, thd,
- (byte *)(sv+1)+
+ (uchar *)(sv+1)+
(*ht)->savepoint_offset)))
{ // cannot happen
my_error(ER_GET_ERRNO, MYF(0), err);
@@ -1544,7 +1544,7 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode,
table->db_stat|=HA_READ_ONLY;
(void) extra(HA_EXTRA_NO_READCHECK); // Not needed in SQL
- if (!(ref= (byte*) alloc_root(&table->mem_root, ALIGN_SIZE(ref_length)*2)))
+ if (!(ref= (uchar*) alloc_root(&table->mem_root, ALIGN_SIZE(ref_length)*2)))
{
close();
error=HA_ERR_OUT_OF_MEM;
@@ -1562,7 +1562,7 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode,
This is never called for InnoDB tables, as these table types
has the HA_STATS_RECORDS_IS_EXACT set.
*/
-int handler::read_first_row(byte * buf, uint primary_key)
+int handler::read_first_row(uchar * buf, uint primary_key)
{
register int error;
DBUG_ENTER("handler::read_first_row");
@@ -1972,7 +1972,7 @@ void handler::get_auto_increment(ulonglong offset, ulonglong increment,
}
else
{
- byte key[MAX_KEY_LENGTH];
+ uchar key[MAX_KEY_LENGTH];
key_copy(key, table->record[0],
table->key_info + table->s->next_number_index,
table->s->next_number_key_offset);
@@ -2331,12 +2331,12 @@ static bool update_frm_version(TABLE *table)
int4store(version, MYSQL_VERSION_ID);
- if ((result= my_pwrite(file,(byte*) version,4,51L,MYF_RW)))
+ if ((result= my_pwrite(file,(uchar*) version,4,51L,MYF_RW)))
goto err;
- for (entry=(TABLE*) hash_first(&open_cache,(byte*) key,key_length, &state);
+ for (entry=(TABLE*) hash_first(&open_cache,(uchar*) key,key_length, &state);
entry;
- entry= (TABLE*) hash_next(&open_cache,(byte*) key,key_length, &state))
+ entry= (TABLE*) hash_next(&open_cache,(uchar*) key,key_length, &state))
entry->s->mysql_version= MYSQL_VERSION_ID;
}
err:
@@ -2499,7 +2499,7 @@ int ha_enable_transaction(THD *thd, bool on)
DBUG_RETURN(error);
}
-int handler::index_next_same(byte *buf, const byte *key, uint keylen)
+int handler::index_next_same(uchar *buf, const uchar *key, uint keylen)
{
int error;
if (!(error=index_next(buf)))
@@ -2608,8 +2608,8 @@ err:
int ha_create_table_from_engine(THD* thd, const char *db, const char *name)
{
int error;
- const void *frmblob;
- uint frmlen;
+ uchar *frmblob;
+ size_t frmlen;
char path[FN_REFLEN];
HA_CREATE_INFO create_info;
TABLE table;
@@ -2617,7 +2617,7 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name)
DBUG_ENTER("ha_create_table_from_engine");
DBUG_PRINT("enter", ("name '%s'.'%s'", db, name));
- bzero((char*) &create_info,sizeof(create_info));
+ bzero((uchar*) &create_info,sizeof(create_info));
if ((error= ha_discover(thd, db, name, &frmblob, &frmlen)))
{
/* Table could not be discovered and thus not created */
@@ -2632,7 +2632,7 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name)
(void)strxnmov(path,FN_REFLEN-1,mysql_data_home,"/",db,"/",name,NullS);
// Save the frm file
error= writefrm(path, frmblob, frmlen);
- my_free((char*) frmblob, MYF(0));
+ my_free(frmblob, MYF(0));
if (error)
DBUG_RETURN(2);
@@ -2774,8 +2774,8 @@ struct st_discover_args
{
const char *db;
const char *name;
- const void** frmblob;
- uint* frmlen;
+ uchar **frmblob;
+ size_t *frmlen;
};
static my_bool discover_handlerton(THD *thd, st_plugin_int *plugin,
@@ -2793,7 +2793,7 @@ static my_bool discover_handlerton(THD *thd, st_plugin_int *plugin,
}
int ha_discover(THD *thd, const char *db, const char *name,
- const void **frmblob, uint *frmlen)
+ uchar **frmblob, size_t *frmlen)
{
int error= -1; // Table does not exist in any handler
DBUG_ENTER("ha_discover");
@@ -3278,7 +3278,7 @@ int handler::compare_key(key_range *range)
}
-int handler::index_read_idx(byte * buf, uint index, const byte * key,
+int handler::index_read_idx(uchar * buf, uint index, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -3538,8 +3538,8 @@ namespace
template<class RowsEventT> int
binlog_log_row(TABLE* table,
- const byte *before_record,
- const byte *after_record)
+ const uchar *before_record,
+ const uchar *after_record)
{
if (table->file->ha_table_flags() & HA_HAS_OWN_BINLOGGING)
return 0;
@@ -3588,13 +3588,13 @@ namespace
*/
template int
- binlog_log_row<Write_rows_log_event>(TABLE *, const byte *, const byte *);
+ binlog_log_row<Write_rows_log_event>(TABLE *, const uchar *, const uchar *);
template int
- binlog_log_row<Delete_rows_log_event>(TABLE *, const byte *, const byte *);
+ binlog_log_row<Delete_rows_log_event>(TABLE *, const uchar *, const uchar *);
template int
- binlog_log_row<Update_rows_log_event>(TABLE *, const byte *, const byte *);
+ binlog_log_row<Update_rows_log_event>(TABLE *, const uchar *, const uchar *);
}
@@ -3618,9 +3618,9 @@ int handler::ha_reset()
{
DBUG_ENTER("ha_reset");
/* Check that we have called all proper deallocation functions */
- DBUG_ASSERT((byte*) table->def_read_set.bitmap +
+ DBUG_ASSERT((uchar*) table->def_read_set.bitmap +
table->s->column_bitmap_size ==
- (byte*) table->def_write_set.bitmap);
+ (uchar*) table->def_write_set.bitmap);
DBUG_ASSERT(bitmap_is_set_all(&table->s->all_set));
DBUG_ASSERT(table->key_read == 0);
/* ensure that ha_index_end / ha_rnd_end has been called */
@@ -3631,7 +3631,7 @@ int handler::ha_reset()
}
-int handler::ha_write_row(byte *buf)
+int handler::ha_write_row(uchar *buf)
{
int error;
if (unlikely(error= write_row(buf)))
@@ -3641,7 +3641,7 @@ int handler::ha_write_row(byte *buf)
return 0;
}
-int handler::ha_update_row(const byte *old_data, byte *new_data)
+int handler::ha_update_row(const uchar *old_data, uchar *new_data)
{
int error;
@@ -3658,7 +3658,7 @@ int handler::ha_update_row(const byte *old_data, byte *new_data)
return 0;
}
-int handler::ha_delete_row(const byte *buf)
+int handler::ha_delete_row(const uchar *buf)
{
int error;
if (unlikely(error= delete_row(buf)))
@@ -3781,7 +3781,7 @@ int fl_log_iterator_next(struct handler_iterator *iterator,
void fl_log_iterator_destroy(struct handler_iterator *iterator)
{
- my_free((gptr)iterator->buffer, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*)iterator->buffer, MYF(MY_ALLOW_ZERO_PTR));
}
@@ -3794,7 +3794,7 @@ fl_log_iterator_buffer_init(struct handler_iterator *iterator)
MY_DIR *dirp;
struct fl_buff *buff;
char *name_ptr;
- byte *ptr;
+ uchar *ptr;
FILEINFO *file;
uint32 i;
@@ -3805,7 +3805,7 @@ fl_log_iterator_buffer_init(struct handler_iterator *iterator)
{
return HA_ITERATOR_ERROR;
}
- if ((ptr= (byte*)my_malloc(ALIGN_SIZE(sizeof(fl_buff)) +
+ if ((ptr= (uchar*)my_malloc(ALIGN_SIZE(sizeof(fl_buff)) +
((ALIGN_SIZE(sizeof(LEX_STRING)) +
sizeof(enum log_status) +
+ FN_REFLEN) *
diff --git a/sql/handler.h b/sql/handler.h
index cfa86358fa1..ff0d5a362a5 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -378,9 +378,9 @@ struct xid_t {
return sizeof(formatID)+sizeof(gtrid_length)+sizeof(bqual_length)+
gtrid_length+bqual_length;
}
- byte *key()
+ uchar *key()
{
- return (byte *)&gtrid_length;
+ return (uchar *)&gtrid_length;
}
uint key_length()
{
@@ -674,8 +674,8 @@ struct handlerton
struct handler_iterator *fill_this_in);
int (*discover)(handlerton *hton, THD* thd, const char *db,
const char *name,
- const void** frmblob,
- uint* frmlen);
+ uchar **frmblob,
+ size_t *frmlen);
int (*find_files)(handlerton *hton, THD *thd,
const char *db,
const char *path,
@@ -835,9 +835,9 @@ typedef struct st_ha_check_opt
typedef struct st_handler_buffer
{
- const byte *buffer; /* Buffer one can start using */
- const byte *buffer_end; /* End of buffer */
- byte *end_of_used_area; /* End of area that was used by handler */
+ const uchar *buffer; /* Buffer one can start using */
+ const uchar *buffer_end; /* End of buffer */
+ uchar *end_of_used_area; /* End of area that was used by handler */
} HANDLER_BUFFER;
typedef struct system_status_var SSV;
@@ -867,7 +867,7 @@ public:
{}
};
-uint calculate_key_len(TABLE *, uint, const byte *, key_part_map);
+uint calculate_key_len(TABLE *, uint, const uchar *, key_part_map);
/*
bitmap with first N+1 bits set
(keypart_map for a key prefix of [0..N] keyparts)
@@ -913,8 +913,8 @@ class handler :public Sql_alloc
virtual int end_bulk_insert() {return 0; }
public:
handlerton *ht; /* storage engine of this handler */
- byte *ref; /* Pointer to current row */
- byte *dup_ref; /* Pointer to duplicate row */
+ uchar *ref; /* Pointer to current row */
+ uchar *dup_ref; /* Pointer to duplicate row */
ha_statistics stats;
@@ -1136,9 +1136,9 @@ public:
and delete_row() below.
*/
int ha_external_lock(THD *thd, int lock_type);
- int ha_write_row(byte * buf);
- int ha_update_row(const byte * old_data, byte * new_data);
- int ha_delete_row(const byte * buf);
+ int ha_write_row(uchar * buf);
+ int ha_update_row(const uchar * old_data, uchar * new_data);
+ int ha_delete_row(const uchar * buf);
/*
SYNOPSIS
@@ -1171,7 +1171,7 @@ public:
0 Bulk delete used by handler
1 Bulk delete not used, normal operation used
*/
- virtual int bulk_update_row(const byte *old_data, byte *new_data,
+ virtual int bulk_update_row(const uchar *old_data, uchar *new_data,
uint *dup_key_found)
{
DBUG_ASSERT(FALSE);
@@ -1220,7 +1220,7 @@ public:
return HA_ERR_WRONG_COMMAND;
}
private:
- virtual int index_read(byte * buf, const byte * key, uint key_len,
+ virtual int index_read(uchar * buf, const uchar * key, uint key_len,
enum ha_rkey_function find_flag)
{ return HA_ERR_WRONG_COMMAND; }
public:
@@ -1230,7 +1230,7 @@ public:
row if available. If the key value is null, begin at the first key of the
index.
*/
- virtual int index_read(byte * buf, const byte * key, key_part_map keypart_map,
+ virtual int index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
uint key_len= calculate_key_len(table, active_index, key, keypart_map);
@@ -1242,20 +1242,20 @@ public:
row if available. If the key value is null, begin at the first key of the
index.
*/
- virtual int index_read_idx(byte * buf, uint index, const byte * key,
+ virtual int index_read_idx(uchar * buf, uint index, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag);
- virtual int index_next(byte * buf)
+ virtual int index_next(uchar * buf)
{ return HA_ERR_WRONG_COMMAND; }
- virtual int index_prev(byte * buf)
+ virtual int index_prev(uchar * buf)
{ return HA_ERR_WRONG_COMMAND; }
- virtual int index_first(byte * buf)
+ virtual int index_first(uchar * buf)
{ return HA_ERR_WRONG_COMMAND; }
- virtual int index_last(byte * buf)
+ virtual int index_last(uchar * buf)
{ return HA_ERR_WRONG_COMMAND; }
- virtual int index_next_same(byte *buf, const byte *key, uint keylen);
+ virtual int index_next_same(uchar *buf, const uchar *key, uint keylen);
private:
- virtual int index_read_last(byte * buf, const byte * key, uint key_len)
+ virtual int index_read_last(uchar * buf, const uchar * key, uint key_len)
{ return (my_errno=HA_ERR_WRONG_COMMAND); }
public:
/**
@@ -1263,7 +1263,7 @@ public:
The following functions works like index_read, but it find the last
row with the current key value or prefix.
*/
- virtual int index_read_last(byte * buf, const byte * key,
+ virtual int index_read_last(uchar * buf, const uchar * key,
key_part_map keypart_map)
{
uint key_len= calculate_key_len(table, active_index, key, keypart_map);
@@ -1282,21 +1282,21 @@ public:
void ft_end() { ft_handler=NULL; }
virtual FT_INFO *ft_init_ext(uint flags, uint inx,String *key)
{ return NULL; }
- virtual int ft_read(byte *buf) { return HA_ERR_WRONG_COMMAND; }
- virtual int rnd_next(byte *buf)=0;
- virtual int rnd_pos(byte * buf, byte *pos)=0;
- virtual int read_first_row(byte *buf, uint primary_key);
+ virtual int ft_read(uchar *buf) { return HA_ERR_WRONG_COMMAND; }
+ virtual int rnd_next(uchar *buf)=0;
+ virtual int rnd_pos(uchar * buf, uchar *pos)=0;
+ virtual int read_first_row(uchar *buf, uint primary_key);
/*
The following function is only needed for tables that may be temporary
tables during joins
*/
- virtual int restart_rnd_next(byte *buf, byte *pos)
+ virtual int restart_rnd_next(uchar *buf, uchar *pos)
{ return HA_ERR_WRONG_COMMAND; }
- virtual int rnd_same(byte *buf, uint inx)
+ virtual int rnd_same(uchar *buf, uint inx)
{ return HA_ERR_WRONG_COMMAND; }
virtual ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key)
{ return (ha_rows) 10; }
- virtual void position(const byte *record)=0;
+ virtual void position(const uchar *record)=0;
virtual int info(uint)=0; // see my_base.h for full description
virtual void get_dynamic_partition_info(PARTITION_INFO *stat_info,
uint part_id);
@@ -1552,8 +1552,8 @@ public:
const char *path,
ulonglong *copied,
ulonglong *deleted,
- const void *pack_frm_data,
- uint pack_frm_len)
+ const uchar *pack_frm_data,
+ size_t pack_frm_len)
{ return HA_ERR_WRONG_COMMAND; }
virtual int drop_partitions(const char *path)
{ return HA_ERR_WRONG_COMMAND; }
@@ -1592,7 +1592,7 @@ public:
false otherwise
*/
virtual bool primary_key_is_clustered() { return FALSE; }
- virtual int cmp_ref(const byte *ref1, const byte *ref2)
+ virtual int cmp_ref(const uchar *ref1, const uchar *ref2)
{
return memcmp(ref1, ref2, ref_length);
}
@@ -1637,18 +1637,18 @@ public:
{ return COMPATIBLE_DATA_NO; }
/* These are only called from sql_select for internal temporary tables */
- virtual int write_row(byte *buf __attribute__((unused)))
+ virtual int write_row(uchar *buf __attribute__((unused)))
{
return HA_ERR_WRONG_COMMAND;
}
- virtual int update_row(const byte *old_data __attribute__((unused)),
- byte *new_data __attribute__((unused)))
+ virtual int update_row(const uchar *old_data __attribute__((unused)),
+ uchar *new_data __attribute__((unused)))
{
return HA_ERR_WRONG_COMMAND;
}
- virtual int delete_row(const byte *buf __attribute__((unused)))
+ virtual int delete_row(const uchar *buf __attribute__((unused)))
{
return HA_ERR_WRONG_COMMAND;
}
@@ -1741,7 +1741,7 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat);
/* discovery */
int ha_create_table_from_engine(THD* thd, const char *db, const char *name);
int ha_discover(THD* thd, const char* dbname, const char* name,
- const void** frmblob, uint* frmlen);
+ uchar** frmblob, size_t* frmlen);
int ha_find_files(THD *thd,const char *db,const char *path,
const char *wild, bool dir,List<char>* files);
int ha_table_exists_in_engine(THD* thd, const char* db, const char* name);
diff --git a/sql/hash_filo.h b/sql/hash_filo.h
index c25af67b572..ab13d338695 100644
--- a/sql/hash_filo.h
+++ b/sql/hash_filo.h
@@ -84,10 +84,10 @@ public:
first_link=last_link=0;
}
- hash_filo_element *search(gptr key,uint length)
+ hash_filo_element *search(uchar* key, size_t length)
{
hash_filo_element *entry=(hash_filo_element*)
- hash_search(&cache,(byte*) key,length);
+ hash_search(&cache,(uchar*) key,length);
if (entry)
{ // Found; link it first
if (entry != first_link)
@@ -113,9 +113,9 @@ public:
{
hash_filo_element *tmp=last_link;
last_link=last_link->prev_used;
- hash_delete(&cache,(byte*) tmp);
+ hash_delete(&cache,(uchar*) tmp);
}
- if (my_hash_insert(&cache,(byte*) entry))
+ if (my_hash_insert(&cache,(uchar*) entry))
{
if (free_element)
(*free_element)(entry); // This should never happen
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 049220c6b6f..34384a9c8c0 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -84,7 +84,7 @@ static void add_hostname(struct in_addr *in,const char *name)
{
VOID(pthread_mutex_lock(&hostname_cache->lock));
host_entry *entry;
- if (!(entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr,0)))
+ if (!(entry=(host_entry*) hostname_cache->search((uchar*) &in->s_addr,0)))
{
uint length=name ? (uint) strlen(name) : 0;
@@ -115,7 +115,7 @@ void inc_host_errors(struct in_addr *in)
{
VOID(pthread_mutex_lock(&hostname_cache->lock));
host_entry *entry;
- if ((entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr,0)))
+ if ((entry=(host_entry*) hostname_cache->search((uchar*) &in->s_addr,0)))
entry->errors++;
VOID(pthread_mutex_unlock(&hostname_cache->lock));
}
@@ -124,7 +124,7 @@ void reset_host_errors(struct in_addr *in)
{
VOID(pthread_mutex_lock(&hostname_cache->lock));
host_entry *entry;
- if ((entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr,0)))
+ if ((entry=(host_entry*) hostname_cache->search((uchar*) &in->s_addr,0)))
entry->errors=0;
VOID(pthread_mutex_unlock(&hostname_cache->lock));
}
@@ -134,7 +134,7 @@ void reset_host_errors(struct in_addr *in)
#define INADDR_LOOPBACK 0x7f000001UL
#endif
-my_string ip_to_hostname(struct in_addr *in, uint *errors)
+char * ip_to_hostname(struct in_addr *in, uint *errors)
{
uint i;
host_entry *entry;
@@ -149,7 +149,7 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
if (!(specialflag & SPECIAL_NO_HOST_CACHE))
{
VOID(pthread_mutex_lock(&hostname_cache->lock));
- if ((entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr,0)))
+ if ((entry=(host_entry*) hostname_cache->search((uchar*) &in->s_addr,0)))
{
char *name;
if (!entry->hostname)
diff --git a/sql/item.cc b/sql/item.cc
index 3f4751a4753..0371f5e891f 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -432,7 +432,7 @@ void Item::cleanup()
arg - a dummy parameter, is not used here
*/
-bool Item::cleanup_processor(byte *arg)
+bool Item::cleanup_processor(uchar *arg)
{
if (fixed)
cleanup();
@@ -495,7 +495,7 @@ void Item::rename(char *new_name)
pointer to newly allocated item is returned.
*/
-Item* Item::transform(Item_transformer transformer, byte *arg)
+Item* Item::transform(Item_transformer transformer, uchar *arg)
{
DBUG_ASSERT(!current_thd->is_stmt_prepare());
@@ -553,7 +553,7 @@ void Item_ident::cleanup()
DBUG_VOID_RETURN;
}
-bool Item_ident::remove_dependence_processor(byte * arg)
+bool Item_ident::remove_dependence_processor(uchar * arg)
{
DBUG_ENTER("Item_ident::remove_dependence_processor");
if (depended_from == (st_select_lex *) arg)
@@ -584,7 +584,7 @@ bool Item_ident::remove_dependence_processor(byte * arg)
for the subsequent items.
*/
-bool Item_field::collect_item_field_processor(byte *arg)
+bool Item_field::collect_item_field_processor(uchar *arg)
{
DBUG_ENTER("Item_field::collect_item_field_processor");
DBUG_PRINT("info", ("%s", field->field_name ? field->field_name : "noname"));
@@ -619,7 +619,7 @@ bool Item_field::collect_item_field_processor(byte *arg)
FALSE otherwise
*/
-bool Item_field::find_item_in_field_list_processor(byte *arg)
+bool Item_field::find_item_in_field_list_processor(uchar *arg)
{
KEY_PART_INFO *first_non_group_part= *((KEY_PART_INFO **) arg);
KEY_PART_INFO *last_part= *(((KEY_PART_INFO **) arg) + 1);
@@ -642,7 +642,7 @@ bool Item_field::find_item_in_field_list_processor(byte *arg)
column read set or to register used fields in a view
*/
-bool Item_field::register_field_in_read_map(byte *arg)
+bool Item_field::register_field_in_read_map(uchar *arg)
{
TABLE *table= (TABLE *) arg;
if (field->table == table || !table)
@@ -691,7 +691,7 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs)
}
if (!my_charset_same(cs, system_charset_info))
{
- uint32 res_length;
+ size_t res_length;
name= sql_strmake_with_convert(str, name_length= length, cs,
MAX_ALIAS_NAME, system_charset_info,
&res_length);
@@ -786,7 +786,7 @@ Item *Item_string::safe_charset_converter(CHARSET_INFO *tocs)
*/
return NULL;
}
- if (!(ptr= current_thd->memdup(cstr.ptr(), cstr.length() + 1 )))
+ if (!(ptr= current_thd->strmake(cstr.ptr(), cstr.length())))
return NULL;
conv->str_value.set(ptr, cstr.length(), cstr.charset());
/* Ensure that no one is going to change the result string */
@@ -2139,7 +2139,7 @@ Item_decimal::Item_decimal(my_decimal *value_par)
}
-Item_decimal::Item_decimal(const char *bin, int precision, int scale)
+Item_decimal::Item_decimal(const uchar *bin, int precision, int scale)
{
binary2my_decimal(E_DEC_FATAL_ERROR, bin,
&decimal_value, precision, scale);
@@ -4066,7 +4066,7 @@ Item_equal *Item_field::find_item_equal(COND_EQUAL *cond_equal)
FALSE otherwise
*/
-bool Item_field::subst_argument_checker(byte **arg)
+bool Item_field::subst_argument_checker(uchar **arg)
{
return (result_type() != STRING_RESULT) || (*arg);
}
@@ -4098,7 +4098,7 @@ bool Item_field::subst_argument_checker(byte **arg)
pointer to the field item, otherwise.
*/
-Item *Item_field::equal_fields_propagator(byte *arg)
+Item *Item_field::equal_fields_propagator(uchar *arg)
{
if (no_const_subst)
return this;
@@ -4129,7 +4129,7 @@ Item *Item_field::equal_fields_propagator(byte *arg)
See comments in Arg_comparator::set_compare_func() for details
*/
-bool Item_field::set_no_const_sub(byte *arg)
+bool Item_field::set_no_const_sub(uchar *arg)
{
if (field->charset() != &my_charset_bin)
no_const_subst=1;
@@ -4164,7 +4164,7 @@ bool Item_field::set_no_const_sub(byte *arg)
this - otherwise.
*/
-Item *Item_field::replace_equal_field(byte *arg)
+Item *Item_field::replace_equal_field(uchar *arg)
{
if (item_equal)
{
@@ -4314,42 +4314,42 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
switch (field_type()) {
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
- field= new Field_new_decimal((char*) 0, max_length, null_ptr, 0,
+ field= new Field_new_decimal((uchar*) 0, max_length, null_ptr, 0,
Field::NONE, name, decimals, 0,
unsigned_flag);
break;
case MYSQL_TYPE_TINY:
- field= new Field_tiny((char*) 0, max_length, null_ptr, 0, Field::NONE,
+ field= new Field_tiny((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
name, 0, unsigned_flag);
break;
case MYSQL_TYPE_SHORT:
- field= new Field_short((char*) 0, max_length, null_ptr, 0, Field::NONE,
+ field= new Field_short((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
name, 0, unsigned_flag);
break;
case MYSQL_TYPE_LONG:
- field= new Field_long((char*) 0, max_length, null_ptr, 0, Field::NONE,
+ field= new Field_long((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
name, 0, unsigned_flag);
break;
#ifdef HAVE_LONG_LONG
case MYSQL_TYPE_LONGLONG:
- field= new Field_longlong((char*) 0, max_length, null_ptr, 0, Field::NONE,
+ field= new Field_longlong((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
name, 0, unsigned_flag);
break;
#endif
case MYSQL_TYPE_FLOAT:
- field= new Field_float((char*) 0, max_length, null_ptr, 0, Field::NONE,
+ field= new Field_float((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
name, decimals, 0, unsigned_flag);
break;
case MYSQL_TYPE_DOUBLE:
- field= new Field_double((char*) 0, max_length, null_ptr, 0, Field::NONE,
+ field= new Field_double((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
name, decimals, 0, unsigned_flag);
break;
case MYSQL_TYPE_NULL:
- field= new Field_null((char*) 0, max_length, Field::NONE,
+ field= new Field_null((uchar*) 0, max_length, Field::NONE,
name, &my_charset_bin);
break;
case MYSQL_TYPE_INT24:
- field= new Field_medium((char*) 0, max_length, null_ptr, 0, Field::NONE,
+ field= new Field_medium((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
name, 0, unsigned_flag);
break;
case MYSQL_TYPE_NEWDATE:
@@ -4366,7 +4366,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
field= new Field_datetime(maybe_null, name, &my_charset_bin);
break;
case MYSQL_TYPE_YEAR:
- field= new Field_year((char*) 0, max_length, null_ptr, 0, Field::NONE,
+ field= new Field_year((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
name);
break;
case MYSQL_TYPE_BIT:
@@ -5032,7 +5032,7 @@ void Item_field::update_null_value()
this field otherwise
*/
-Item *Item_field::update_value_transformer(byte *select_arg)
+Item *Item_field::update_value_transformer(uchar *select_arg)
{
SELECT_LEX *select= (SELECT_LEX*)select_arg;
DBUG_ASSERT(fixed);
@@ -5849,7 +5849,7 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions)
same time it can replace some nodes in the tree
*/
-Item *Item_default_value::transform(Item_transformer transformer, byte *args)
+Item *Item_default_value::transform(Item_transformer transformer, uchar *args)
{
DBUG_ASSERT(!current_thd->is_stmt_prepare());
@@ -6791,7 +6791,7 @@ Field *Item_type_holder::make_field_by_type(TABLE *table)
switch (fld_type) {
case MYSQL_TYPE_ENUM:
DBUG_ASSERT(enum_set_typelib);
- field= new Field_enum((char *) 0, max_length, null_ptr, 0,
+ field= new Field_enum((uchar *) 0, max_length, null_ptr, 0,
Field::NONE, name,
get_enum_pack_length(enum_set_typelib->count),
enum_set_typelib, collation.collation);
@@ -6800,7 +6800,7 @@ Field *Item_type_holder::make_field_by_type(TABLE *table)
return field;
case MYSQL_TYPE_SET:
DBUG_ASSERT(enum_set_typelib);
- field= new Field_set((char *) 0, max_length, null_ptr, 0,
+ field= new Field_set((uchar *) 0, max_length, null_ptr, 0,
Field::NONE, name,
get_set_pack_length(enum_set_typelib->count),
enum_set_typelib, collation.collation);
diff --git a/sql/item.h b/sql/item.h
index 8b57f831cbd..24b7bbfa5bc 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -426,7 +426,7 @@ public:
};
-typedef bool (Item::*Item_processor) (byte *arg);
+typedef bool (Item::*Item_processor) (uchar *arg);
/*
Analyzer function
SYNOPSIS
@@ -438,8 +438,8 @@ typedef bool (Item::*Item_processor) (byte *arg);
FALSE Don't do it
*/
-typedef bool (Item::*Item_analyzer) (byte **argp);
-typedef Item* (Item::*Item_transformer) (byte *arg);
+typedef bool (Item::*Item_analyzer) (uchar **argp);
+typedef Item* (Item::*Item_transformer) (uchar *arg);
typedef void (*Cond_traverser) (const Item *item, void *arg);
@@ -448,9 +448,9 @@ class Item {
void operator=(Item &);
public:
static void *operator new(size_t size)
- { return (void*) sql_alloc((uint) size); }
+ { return sql_alloc(size); }
static void *operator new(size_t size, MEM_ROOT *mem_root)
- { return (void*) alloc_root(mem_root, (uint) size); }
+ { return alloc_root(mem_root, size); }
static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
@@ -476,9 +476,9 @@ public:
save_in_field
*/
String str_value;
- my_string name; /* Name from select */
+ char * name; /* Name from select */
/* Original item name (if it was renamed)*/
- my_string orig_name;
+ char * orig_name;
Item *next;
uint32 max_length;
uint name_length; /* Length of name */
@@ -779,12 +779,12 @@ public:
static CHARSET_INFO *default_charset();
virtual CHARSET_INFO *compare_collation() { return NULL; }
- virtual bool walk(Item_processor processor, bool walk_subquery, byte *arg)
+ virtual bool walk(Item_processor processor, bool walk_subquery, uchar *arg)
{
return (this->*processor)(arg);
}
- virtual Item* transform(Item_transformer transformer, byte *arg);
+ virtual Item* transform(Item_transformer transformer, uchar *arg);
/*
This function performs a generic "compilation" of the Item tree.
@@ -802,8 +802,8 @@ public:
i.e. analysis is performed top-down while transformation is done
bottom-up.
*/
- virtual Item* compile(Item_analyzer analyzer, byte **arg_p,
- Item_transformer transformer, byte *arg_t)
+ virtual Item* compile(Item_analyzer analyzer, uchar **arg_p,
+ Item_transformer transformer, uchar *arg_t)
{
if ((this->*analyzer) (arg_p))
return ((this->*transformer) (arg_t));
@@ -816,15 +816,15 @@ public:
(*traverser)(this, arg);
}
- virtual bool remove_dependence_processor(byte * arg) { return 0; }
- virtual bool remove_fixed(byte * arg) { fixed= 0; return 0; }
- virtual bool cleanup_processor(byte *arg);
- virtual bool collect_item_field_processor(byte * arg) { return 0; }
- virtual bool find_item_in_field_list_processor(byte *arg) { return 0; }
- virtual bool change_context_processor(byte *context) { return 0; }
- virtual bool reset_query_id_processor(byte *query_id_arg) { return 0; }
- virtual bool is_expensive_processor(byte *arg) { return 0; }
- virtual bool register_field_in_read_map(byte *arg) { return 0; }
+ virtual bool remove_dependence_processor(uchar * arg) { return 0; }
+ virtual bool remove_fixed(uchar * arg) { fixed= 0; return 0; }
+ virtual bool cleanup_processor(uchar *arg);
+ virtual bool collect_item_field_processor(uchar * arg) { return 0; }
+ virtual bool find_item_in_field_list_processor(uchar *arg) { return 0; }
+ virtual bool change_context_processor(uchar *context) { return 0; }
+ virtual bool reset_query_id_processor(uchar *query_id_arg) { return 0; }
+ virtual bool is_expensive_processor(uchar *arg) { return 0; }
+ virtual bool register_field_in_read_map(uchar *arg) { return 0; }
/*
Check if a partition function is allowed
SYNOPSIS
@@ -877,17 +877,17 @@ public:
assumes that there are no multi-byte collations amongst the partition
fields.
*/
- virtual bool check_partition_func_processor(byte *bool_arg) { return TRUE;}
- virtual bool subst_argument_checker(byte **arg)
+ virtual bool check_partition_func_processor(uchar *bool_arg) { return TRUE;}
+ virtual bool subst_argument_checker(uchar **arg)
{
if (*arg)
*arg= NULL;
return TRUE;
}
- virtual Item *equal_fields_propagator(byte * arg) { return this; }
- virtual bool set_no_const_sub(byte *arg) { return FALSE; }
- virtual Item *replace_equal_field(byte * arg) { return this; }
+ virtual Item *equal_fields_propagator(uchar * arg) { return this; }
+ virtual bool set_no_const_sub(uchar *arg) { return FALSE; }
+ virtual Item *replace_equal_field(uchar * arg) { return this; }
/*
For SP local variable returns pointer to Item representing its
@@ -916,7 +916,7 @@ public:
virtual Item_field *filed_for_view_update() { return 0; }
virtual Item *neg_transformer(THD *thd) { return NULL; }
- virtual Item *update_value_transformer(byte *select_arg) { return this; }
+ virtual Item *update_value_transformer(uchar *select_arg) { return this; }
virtual Item *safe_charset_converter(CHARSET_INFO *tocs);
void delete_self()
{
@@ -1223,7 +1223,7 @@ public:
Item_num() {} /* Remove gcc warning */
virtual Item_num *neg()= 0;
Item *safe_charset_converter(CHARSET_INFO *tocs);
- bool check_partition_func_processor(byte *int_arg) { return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) { return FALSE;}
};
#define NO_CACHED_FIELD_INDEX ((uint)(-1))
@@ -1267,9 +1267,9 @@ public:
Item_ident(THD *thd, Item_ident *item);
const char *full_name() const;
void cleanup();
- bool remove_dependence_processor(byte * arg);
+ bool remove_dependence_processor(uchar * arg);
void print(String *str);
- virtual bool change_context_processor(byte *cntx)
+ virtual bool change_context_processor(uchar *cntx)
{ context= (Name_resolution_context *)cntx; return FALSE; }
friend bool insert_fields(THD *thd, Name_resolution_context *context,
const char *db_name,
@@ -1378,25 +1378,25 @@ public:
bool is_null() { return field->is_null(); }
void update_null_value();
Item *get_tmp_table_item(THD *thd);
- bool collect_item_field_processor(byte * arg);
- bool find_item_in_field_list_processor(byte *arg);
- bool register_field_in_read_map(byte *arg);
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool collect_item_field_processor(uchar * arg);
+ bool find_item_in_field_list_processor(uchar *arg);
+ bool register_field_in_read_map(uchar *arg);
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
void cleanup();
bool result_as_longlong()
{
return field->can_be_compared_as_longlong();
}
Item_equal *find_item_equal(COND_EQUAL *cond_equal);
- bool subst_argument_checker(byte **arg);
- Item *equal_fields_propagator(byte *arg);
- bool set_no_const_sub(byte *arg);
- Item *replace_equal_field(byte *arg);
+ bool subst_argument_checker(uchar **arg);
+ Item *equal_fields_propagator(uchar *arg);
+ bool set_no_const_sub(uchar *arg);
+ Item *replace_equal_field(uchar *arg);
inline uint32 max_disp_length() { return field->max_display_length(); }
Item_field *filed_for_view_update() { return this; }
Item *safe_charset_converter(CHARSET_INFO *tocs);
int fix_outer_field(THD *thd, Field **field, Item **reference);
- virtual Item *update_value_transformer(byte *select_arg);
+ virtual Item *update_value_transformer(uchar *select_arg);
void print(String *str);
friend class Item_default_value;
friend class Item_insert_value;
@@ -1432,7 +1432,7 @@ public:
bool is_null() { return 1; }
void print(String *str) { str->append(STRING_WITH_LEN("NULL")); }
Item *safe_charset_converter(CHARSET_INFO *tocs);
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_null_result :public Item_null
@@ -1445,7 +1445,7 @@ public:
{
save_in_field(result_field, no_conversions);
}
- bool check_partition_func_processor(byte *int_arg) {return TRUE;}
+ bool check_partition_func_processor(uchar *int_arg) {return TRUE;}
};
/* Item represents one placeholder ('?') of prepared statement */
@@ -1652,7 +1652,7 @@ public:
Item_decimal(my_decimal *value_par);
Item_decimal(longlong val, bool unsig);
Item_decimal(double val, int precision, int scale);
- Item_decimal(const char *bin, int precision, int scale);
+ Item_decimal(const uchar *bin, int precision, int scale);
enum Type type() const { return DECIMAL_ITEM; }
enum Item_result result_type () const { return DECIMAL_RESULT; }
@@ -1739,7 +1739,7 @@ public:
{}
void print(String *str) { str->append(func_name); }
Item *safe_charset_converter(CHARSET_INFO *tocs);
- bool check_partition_func_processor(byte *int_arg) {return TRUE;}
+ bool check_partition_func_processor(uchar *int_arg) {return TRUE;}
};
@@ -1821,7 +1821,7 @@ public:
void print(String *str);
// to prevent drop fixed flag (no need parent cleanup call)
void cleanup() {}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -1836,7 +1836,7 @@ public:
{}
Item *safe_charset_converter(CHARSET_INFO *tocs);
void print(String *str) { str->append(func_name); }
- bool check_partition_func_processor(byte *int_arg) {return TRUE;}
+ bool check_partition_func_processor(uchar *int_arg) {return TRUE;}
};
@@ -1848,7 +1848,7 @@ public:
CHARSET_INFO *cs= NULL):
Item_string(name, length, cs)
{}
- bool check_partition_func_processor(byte *int_arg) {return TRUE;}
+ bool check_partition_func_processor(uchar *int_arg) {return TRUE;}
};
@@ -1896,7 +1896,7 @@ public:
unsigned_flag=1;
}
enum_field_types field_type() const { return int_field_type; }
- bool check_partition_func_processor(byte *int_arg) {return TRUE;}
+ bool check_partition_func_processor(uchar *int_arg) {return TRUE;}
};
@@ -1923,7 +1923,7 @@ public:
void cleanup() {}
bool eq(const Item *item, bool binary_cmp) const;
virtual Item *safe_charset_converter(CHARSET_INFO *tocs);
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -2043,7 +2043,7 @@ public:
{
return ref ? (*ref)->real_item() : this;
}
- bool walk(Item_processor processor, bool walk_subquery, byte *arg)
+ bool walk(Item_processor processor, bool walk_subquery, uchar *arg)
{ return (*ref)->walk(processor, walk_subquery, arg); }
void print(String *str);
bool result_as_longlong()
@@ -2222,7 +2222,7 @@ public:
}
Item *clone_item();
virtual Item *real_item() { return ref; }
- bool check_partition_func_processor(byte *int_arg) {return TRUE;}
+ bool check_partition_func_processor(uchar *int_arg) {return TRUE;}
};
#ifdef MYSQL_SERVER
@@ -2331,7 +2331,7 @@ public:
class Cached_item_field :public Cached_item
{
- char *buff;
+ uchar *buff;
Field *field;
uint length;
@@ -2339,7 +2339,7 @@ public:
Cached_item_field(Item_field *item)
{
field= item->field;
- buff= (char*) sql_calloc(length=field->pack_length());
+ buff= (uchar*) sql_calloc(length=field->pack_length());
}
bool cmp(void);
};
@@ -2363,13 +2363,13 @@ public:
int save_in_field(Field *field_arg, bool no_conversions);
table_map used_tables() const { return (table_map)0L; }
- bool walk(Item_processor processor, bool walk_subquery, byte *args)
+ bool walk(Item_processor processor, bool walk_subquery, uchar *args)
{
return arg->walk(processor, walk_subquery, args) ||
(this->*processor)(args);
}
- Item *transform(Item_transformer transformer, byte *args);
+ Item *transform(Item_transformer transformer, uchar *args);
};
/*
@@ -2403,7 +2403,7 @@ public:
*/
table_map used_tables() const { return RAND_TABLE_BIT; }
- bool walk(Item_processor processor, bool walk_subquery, byte *args)
+ bool walk(Item_processor processor, bool walk_subquery, uchar *args)
{
return arg->walk(processor, walk_subquery, args) ||
(this->*processor)(args);
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index ff7b991448c..2d61b6f1f9f 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -531,8 +531,8 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
which would be transformed to:
WHERE col= 'j'
*/
- (*a)->walk(&Item::set_no_const_sub, FALSE, (byte*) 0);
- (*b)->walk(&Item::set_no_const_sub, FALSE, (byte*) 0);
+ (*a)->walk(&Item::set_no_const_sub, FALSE, (uchar*) 0);
+ (*b)->walk(&Item::set_no_const_sub, FALSE, (uchar*) 0);
}
break;
}
@@ -2425,7 +2425,7 @@ bool Item_func_case::fix_fields(THD *thd, Item **ref)
Item_func_case::val_int() -> Item_func_case::find_item()
*/
#ifndef EMBEDDED_LIBRARY
- char buff[MAX_FIELD_WIDTH*2+sizeof(String)*2+sizeof(String*)*2+sizeof(double)*2+sizeof(longlong)*2];
+ uchar buff[MAX_FIELD_WIDTH*2+sizeof(String)*2+sizeof(String*)*2+sizeof(double)*2+sizeof(longlong)*2];
#endif
bool res= Item_func::fix_fields(thd, ref);
/*
@@ -2765,7 +2765,7 @@ static int cmp_decimal(void *cmp_arg, my_decimal *a, my_decimal *b)
int in_vector::find(Item *item)
{
- byte *result=get_value(item);
+ uchar *result=get_value(item);
if (!result || !used_count)
return 0; // Null value
@@ -2820,9 +2820,9 @@ void in_string::set(uint pos,Item *item)
}
-byte *in_string::get_value(Item *item)
+uchar *in_string::get_value(Item *item)
{
- return (byte*) item->val_str(&tmp);
+ return (uchar*) item->val_str(&tmp);
}
in_row::in_row(uint elements, Item * item)
@@ -2845,12 +2845,12 @@ in_row::~in_row()
delete [] (cmp_item_row*) base;
}
-byte *in_row::get_value(Item *item)
+uchar *in_row::get_value(Item *item)
{
tmp.store_value(item);
if (item->is_null())
return 0;
- return (byte *)&tmp;
+ return (uchar *)&tmp;
}
void in_row::set(uint pos, Item *item)
@@ -2873,13 +2873,13 @@ void in_longlong::set(uint pos,Item *item)
buff->unsigned_flag= item->unsigned_flag;
}
-byte *in_longlong::get_value(Item *item)
+uchar *in_longlong::get_value(Item *item)
{
tmp.val= item->val_int();
if (item->null_value)
return 0;
tmp.unsigned_flag= item->unsigned_flag;
- return (byte*) &tmp;
+ return (uchar*) &tmp;
}
in_double::in_double(uint elements)
@@ -2891,12 +2891,12 @@ void in_double::set(uint pos,Item *item)
((double*) base)[pos]= item->val_real();
}
-byte *in_double::get_value(Item *item)
+uchar *in_double::get_value(Item *item)
{
tmp= item->val_real();
if (item->null_value)
return 0; /* purecov: inspected */
- return (byte*) &tmp;
+ return (uchar*) &tmp;
}
@@ -2918,12 +2918,12 @@ void in_decimal::set(uint pos, Item *item)
}
-byte *in_decimal::get_value(Item *item)
+uchar *in_decimal::get_value(Item *item)
{
my_decimal *result= item->val_decimal(&val);
if (item->null_value)
return 0;
- return (byte *)result;
+ return (uchar *)result;
}
@@ -3434,7 +3434,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
List_iterator<Item> li(list);
Item *item;
#ifndef EMBEDDED_LIBRARY
- char buff[sizeof(char*)]; // Max local vars in function
+ uchar buff[sizeof(char*)]; // Max local vars in function
#endif
not_null_tables_cache= used_tables_cache= 0;
const_item_cache= 1;
@@ -3501,7 +3501,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
return FALSE;
}
-bool Item_cond::walk(Item_processor processor, bool walk_subquery, byte *arg)
+bool Item_cond::walk(Item_processor processor, bool walk_subquery, uchar *arg)
{
List_iterator_fast<Item> li(list);
Item *item;
@@ -3533,7 +3533,7 @@ bool Item_cond::walk(Item_processor processor, bool walk_subquery, byte *arg)
Item returned as the result of transformation of the root node
*/
-Item *Item_cond::transform(Item_transformer transformer, byte *arg)
+Item *Item_cond::transform(Item_transformer transformer, uchar *arg)
{
DBUG_ASSERT(!current_thd->is_stmt_prepare());
@@ -3584,8 +3584,8 @@ Item *Item_cond::transform(Item_transformer transformer, byte *arg)
Item returned as the result of transformation of the root node
*/
-Item *Item_cond::compile(Item_analyzer analyzer, byte **arg_p,
- Item_transformer transformer, byte *arg_t)
+Item *Item_cond::compile(Item_analyzer analyzer, uchar **arg_p,
+ Item_transformer transformer, uchar *arg_t)
{
if (!(this->*analyzer)(arg_p))
return 0;
@@ -3598,7 +3598,7 @@ Item *Item_cond::compile(Item_analyzer analyzer, byte **arg_p,
The same parameter value of arg_p must be passed
to analyze any argument of the condition formula.
*/
- byte *arg_v= *arg_p;
+ uchar *arg_v= *arg_p;
Item *new_item= item->compile(analyzer, &arg_v, transformer, arg_t);
if (new_item && new_item != item)
li.replace(new_item);
@@ -4832,7 +4832,7 @@ void Item_equal::fix_length_and_dec()
item->collation.collation);
}
-bool Item_equal::walk(Item_processor processor, bool walk_subquery, byte *arg)
+bool Item_equal::walk(Item_processor processor, bool walk_subquery, uchar *arg)
{
List_iterator_fast<Item_field> it(fields);
Item *item;
@@ -4844,7 +4844,7 @@ bool Item_equal::walk(Item_processor processor, bool walk_subquery, byte *arg)
return Item_func::walk(processor, walk_subquery, arg);
}
-Item *Item_equal::transform(Item_transformer transformer, byte *arg)
+Item *Item_equal::transform(Item_transformer transformer, uchar *arg)
{
DBUG_ASSERT(!current_thd->is_stmt_prepare());
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 7aede7d2954..15ddab8b32e 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -355,8 +355,8 @@ public:
}
Item *neg_transformer(THD *thd);
virtual Item *negated_item();
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
- bool subst_argument_checker(byte **arg) { return TRUE; }
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
+ bool subst_argument_checker(uchar **arg) { return TRUE; }
};
class Item_func_not :public Item_bool_func
@@ -367,7 +367,7 @@ public:
enum Functype functype() const { return NOT_FUNC; }
const char *func_name() const { return "not"; }
Item *neg_transformer(THD *thd);
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
void print(String *str);
};
@@ -572,7 +572,7 @@ public:
return this;
}
bool eq(const Item *item, bool binary_cmp) const;
- bool subst_argument_checker(byte **arg) { return TRUE; }
+ bool subst_argument_checker(uchar **arg) { return TRUE; }
};
@@ -598,7 +598,7 @@ public:
bool is_bool_func() { return 1; }
CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
uint decimal_precision() const { return 1; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -610,7 +610,7 @@ public:
optimize_type select_optimize() const { return OPTIMIZE_NONE; }
const char *func_name() const { return "strcmp"; }
void print(String *str) { Item_func::print(str); }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -673,7 +673,7 @@ public:
const char *func_name() const { return "ifnull"; }
Field *tmp_table_field(TABLE *table);
uint decimal_precision() const;
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -714,7 +714,7 @@ public:
void print(String *str) { Item_func::print(str); }
table_map not_null_tables() const { return 0; }
bool is_null();
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
/* Functions to handle the optimized IN */
@@ -739,7 +739,7 @@ public:
count(elements), used_count(elements) {}
virtual ~in_vector() {}
virtual void set(uint pos,Item *item)=0;
- virtual byte *get_value(Item *item)=0;
+ virtual uchar *get_value(Item *item)=0;
void sort()
{
qsort2(base,used_count,size,compare,collation);
@@ -782,7 +782,7 @@ public:
in_string(uint elements,qsort2_cmp cmp_func, CHARSET_INFO *cs);
~in_string();
void set(uint pos,Item *item);
- byte *get_value(Item *item);
+ uchar *get_value(Item *item);
Item* create_item()
{
return new Item_string(collation);
@@ -811,7 +811,7 @@ class in_longlong :public in_vector
public:
in_longlong(uint elements);
void set(uint pos,Item *item);
- byte *get_value(Item *item);
+ uchar *get_value(Item *item);
Item* create_item()
{
@@ -838,7 +838,7 @@ class in_double :public in_vector
public:
in_double(uint elements);
void set(uint pos,Item *item);
- byte *get_value(Item *item);
+ uchar *get_value(Item *item);
Item *create_item()
{
return new Item_float(0.0);
@@ -857,7 +857,7 @@ class in_decimal :public in_vector
public:
in_decimal(uint elements);
void set(uint pos, Item *item);
- byte *get_value(Item *item);
+ uchar *get_value(Item *item);
Item *create_item()
{
return new Item_decimal(0, FALSE);
@@ -1020,7 +1020,7 @@ public:
in_row(uint elements, Item *);
~in_row();
void set(uint pos,Item *item);
- byte *get_value(Item *item);
+ uchar *get_value(Item *item);
Item_result result_type() { return ROW_RESULT; }
};
@@ -1118,7 +1118,7 @@ public:
void print(String *str);
Item *find_item(String *str);
CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
- bool check_partition_func_processor(byte *bool_arg) { return FALSE;}
+ bool check_partition_func_processor(uchar *bool_arg) { return FALSE;}
void cleanup()
{
uint i;
@@ -1199,7 +1199,7 @@ public:
bool nulls_in_row();
bool is_bool_func() { return 1; }
CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
/* Functions used by where clause */
@@ -1242,7 +1242,7 @@ public:
optimize_type select_optimize() const { return OPTIMIZE_NULL; }
Item *neg_transformer(THD *thd);
CHARSET_INFO *compare_collation() { return args[0]->collation.collation; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
/* Functions used by HAVING for rewriting IN subquery */
@@ -1269,7 +1269,7 @@ public:
*/
table_map used_tables() const
{ return used_tables_cache | RAND_TABLE_BIT; }
- bool check_partition_func_processor(byte *int_arg) {return TRUE;}
+ bool check_partition_func_processor(uchar *int_arg) {return TRUE;}
};
@@ -1292,7 +1292,7 @@ public:
void print(String *str);
CHARSET_INFO *compare_collation() { return args[0]->collation.collation; }
void top_level_item() { abort_on_null=1; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -1331,7 +1331,7 @@ public:
const char *func_name() const { return "like"; }
bool fix_fields(THD *thd, Item **ref);
void cleanup();
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
#ifdef USE_REGEX
@@ -1354,7 +1354,7 @@ public:
const char *func_name() const { return "regexp"; }
void print(String *str) { print_op(str); }
CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
#else
@@ -1407,14 +1407,14 @@ public:
COND **conds);
void top_level_item() { abort_on_null=1; }
void copy_andor_arguments(THD *thd, Item_cond *item);
- bool walk(Item_processor processor, bool walk_subquery, byte *arg);
- Item *transform(Item_transformer transformer, byte *arg);
+ bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
+ Item *transform(Item_transformer transformer, uchar *arg);
void traverse_cond(Cond_traverser, void *arg, traverse_order order);
void neg_arguments(THD *thd);
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
- bool subst_argument_checker(byte **arg) { return TRUE; }
- Item *compile(Item_analyzer analyzer, byte **arg_p,
- Item_transformer transformer, byte *arg_t);
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
+ bool subst_argument_checker(uchar **arg) { return TRUE; }
+ Item *compile(Item_analyzer analyzer, uchar **arg_p,
+ Item_transformer transformer, uchar *arg_t);
};
@@ -1523,8 +1523,8 @@ public:
void fix_length_and_dec();
bool fix_fields(THD *thd, Item **ref);
void update_used_tables();
- bool walk(Item_processor processor, bool walk_subquery, byte *arg);
- Item *transform(Item_transformer transformer, byte *arg);
+ bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
+ Item *transform(Item_transformer transformer, uchar *arg);
void print(String *str);
CHARSET_INFO *compare_collation()
{ return fields.head()->collation.collation; }
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 8c97b596336..4687a3c647b 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -4908,12 +4908,13 @@ static Native_func_registry func_array[] =
static HASH native_functions_hash;
-extern "C" byte*
-get_native_fct_hash_key(const byte *buff, uint *length, my_bool /* unused */)
+extern "C" uchar*
+get_native_fct_hash_key(const uchar *buff, size_t *length,
+ my_bool /* unused */)
{
Native_func_registry *func= (Native_func_registry*) buff;
*length= func->name.length;
- return (byte*) func->name.str;
+ return (uchar*) func->name.str;
}
/*
@@ -4940,7 +4941,7 @@ int item_create_init()
for (func= func_array; func->builder != NULL; func++)
{
- if (my_hash_insert(& native_functions_hash, (byte*) func))
+ if (my_hash_insert(& native_functions_hash, (uchar*) func))
DBUG_RETURN(1);
}
@@ -4948,8 +4949,8 @@ int item_create_init()
for (uint i=0 ; i < native_functions_hash.records ; i++)
{
func= (Native_func_registry*) hash_element(& native_functions_hash, i);
- DBUG_PRINT("info", ("native function %s, length %d",
- func->name.str, func->name.length));
+ DBUG_PRINT("info", ("native function: %s length: %u",
+ func->name.str, (uint) func->name.length));
}
#endif
@@ -4977,7 +4978,7 @@ find_native_function_builder(THD *thd, LEX_STRING name)
/* Thread safe */
func= (Native_func_registry*) hash_search(& native_functions_hash,
- (byte*) name.str,
+ (uchar*) name.str,
name.length);
if (func)
diff --git a/sql/item_func.cc b/sql/item_func.cc
index ab57b047201..64c181fde71 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -143,7 +143,7 @@ Item_func::fix_fields(THD *thd, Item **ref)
DBUG_ASSERT(fixed == 0);
Item **arg,**arg_end;
#ifndef EMBEDDED_LIBRARY // Avoid compiler warning
- char buff[STACK_BUFF_ALLOC]; // Max argument in function
+ uchar buff[STACK_BUFF_ALLOC]; // Max argument in function
#endif
used_tables_cache= not_null_tables_cache= 0;
@@ -196,7 +196,7 @@ Item_func::fix_fields(THD *thd, Item **ref)
bool Item_func::walk(Item_processor processor, bool walk_subquery,
- byte *argument)
+ uchar *argument)
{
if (arg_count)
{
@@ -259,7 +259,7 @@ void Item_func::traverse_cond(Cond_traverser traverser,
Item returned as the result of transformation of the root node
*/
-Item *Item_func::transform(Item_transformer transformer, byte *argument)
+Item *Item_func::transform(Item_transformer transformer, uchar *argument)
{
DBUG_ASSERT(!current_thd->is_stmt_prepare());
@@ -312,8 +312,8 @@ Item *Item_func::transform(Item_transformer transformer, byte *argument)
Item returned as the result of transformation of the root node
*/
-Item *Item_func::compile(Item_analyzer analyzer, byte **arg_p,
- Item_transformer transformer, byte *arg_t)
+Item *Item_func::compile(Item_analyzer analyzer, uchar **arg_p,
+ Item_transformer transformer, uchar *arg_t)
{
if (!(this->*analyzer)(arg_p))
return 0;
@@ -326,7 +326,7 @@ Item *Item_func::compile(Item_analyzer analyzer, byte **arg_p,
The same parameter value of arg_p must be passed
to analyze any argument of the condition formula.
*/
- byte *arg_v= *arg_p;
+ uchar *arg_v= *arg_p;
Item *new_item= (*arg)->compile(analyzer, &arg_v, transformer, arg_t);
if (new_item && *arg != new_item)
current_thd->change_item_tree(arg, new_item);
@@ -466,7 +466,7 @@ Field *Item_func::tmp_table_field(TABLE *table)
}
-bool Item_func::is_expensive_processor(byte *arg)
+bool Item_func::is_expensive_processor(uchar *arg)
{
return is_expensive();
}
@@ -2690,7 +2690,7 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func,
uint arg_count, Item **arguments)
{
#ifndef EMBEDDED_LIBRARY // Avoid compiler warning
- char buff[STACK_BUFF_ALLOC]; // Max argument in function
+ uchar buff[STACK_BUFF_ALLOC]; // Max argument in function
#endif
DBUG_ENTER("Item_udf_func::fix_fields");
@@ -3128,8 +3128,8 @@ static HASH hash_user_locks;
class User_level_lock
{
- char *key;
- uint key_length;
+ uchar *key;
+ size_t key_length;
public:
int count;
@@ -3138,16 +3138,16 @@ public:
my_thread_id thread_id;
void set_thread(THD *thd) { thread_id= thd->thread_id; }
- User_level_lock(const char *key_arg,uint length, ulong id)
+ User_level_lock(const uchar *key_arg,uint length, ulong id)
:key_length(length),count(1),locked(1), thread_id(id)
{
- key=(char*) my_memdup((byte*) key_arg,length,MYF(0));
+ key= (uchar*) my_memdup(key_arg,length,MYF(0));
pthread_cond_init(&cond,NULL);
if (key)
{
- if (my_hash_insert(&hash_user_locks,(byte*) this))
+ if (my_hash_insert(&hash_user_locks,(uchar*) this))
{
- my_free((gptr) key,MYF(0));
+ my_free(key,MYF(0));
key=0;
}
}
@@ -3156,22 +3156,22 @@ public:
{
if (key)
{
- hash_delete(&hash_user_locks,(byte*) this);
- my_free((gptr) key,MYF(0));
+ hash_delete(&hash_user_locks,(uchar*) this);
+ my_free(key, MYF(0));
}
pthread_cond_destroy(&cond);
}
inline bool initialized() { return key != 0; }
friend void item_user_lock_release(User_level_lock *ull);
- friend char *ull_get_key(const User_level_lock *ull, uint *length,
- my_bool not_used);
+ friend uchar *ull_get_key(const User_level_lock *ull, size_t *length,
+ my_bool not_used);
};
-char *ull_get_key(const User_level_lock *ull, uint *length,
- my_bool not_used __attribute__((unused)))
+uchar *ull_get_key(const User_level_lock *ull, size_t *length,
+ my_bool not_used __attribute__((unused)))
{
- *length=(uint) ull->key_length;
- return (char*) ull->key;
+ *length= ull->key_length;
+ return ull->key;
}
@@ -3241,8 +3241,8 @@ void debug_sync_point(const char* lock_name, uint lock_timeout)
THD* thd=current_thd;
User_level_lock* ull;
struct timespec abstime;
- int lock_name_len;
- lock_name_len=strlen(lock_name);
+ size_t lock_name_len;
+ lock_name_len= strlen(lock_name);
pthread_mutex_lock(&LOCK_user_locks);
if (thd->ull)
@@ -3257,8 +3257,9 @@ void debug_sync_point(const char* lock_name, uint lock_timeout)
this case, we will not be waiting, but rather, just waste CPU and
memory on the whole deal
*/
- if (!(ull= ((User_level_lock*) hash_search(&hash_user_locks, lock_name,
- lock_name_len))))
+ if (!(ull= ((User_level_lock*) hash_search(&hash_user_locks,
+ (uchar*) lock_name,
+ lock_name_len))))
{
pthread_mutex_unlock(&LOCK_user_locks);
return;
@@ -3353,10 +3354,11 @@ longlong Item_func_get_lock::val_int()
}
if (!(ull= ((User_level_lock *) hash_search(&hash_user_locks,
- (byte*) res->ptr(),
- res->length()))))
+ (uchar*) res->ptr(),
+ (size_t) res->length()))))
{
- ull=new User_level_lock(res->ptr(),res->length(), thd->thread_id);
+ ull= new User_level_lock((uchar*) res->ptr(), (size_t) res->length(),
+ thd->thread_id);
if (!ull || !ull->initialized())
{
delete ull;
@@ -3446,8 +3448,8 @@ longlong Item_func_release_lock::val_int()
result=0;
pthread_mutex_lock(&LOCK_user_locks);
if (!(ull= ((User_level_lock*) hash_search(&hash_user_locks,
- (const byte*) res->ptr(),
- res->length()))))
+ (const uchar*) res->ptr(),
+ (size_t) res->length()))))
{
null_value=1;
}
@@ -3592,7 +3594,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
{
user_var_entry *entry;
- if (!(entry = (user_var_entry*) hash_search(hash, (byte*) name.str,
+ if (!(entry = (user_var_entry*) hash_search(hash, (uchar*) name.str,
name.length)) &&
create_if_not_exists)
{
@@ -3622,7 +3624,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
entry->used_query_id=current_thd->query_id;
entry->type=STRING_RESULT;
memcpy(entry->name.str, name.str, name.length+1);
- if (my_hash_insert(hash,(byte*) entry))
+ if (my_hash_insert(hash,(uchar*) entry))
{
my_free((char*) entry,MYF(0));
return 0;
@@ -4369,7 +4371,7 @@ int get_var_with_binlog(THD *thd, enum_sql_command sql_command,
}
/* Mark that this variable has been used by this query */
var_entry->used_query_id= thd->query_id;
- if (insert_dynamic(&thd->user_var_events, (gptr) &user_var_event))
+ if (insert_dynamic(&thd->user_var_events, (uchar*) &user_var_event))
goto err;
*out_entry= var_entry;
@@ -4438,7 +4440,7 @@ enum Item_result Item_func_get_user_var::result_type() const
{
user_var_entry *entry;
if (!(entry = (user_var_entry*) hash_search(&current_thd->user_vars,
- (byte*) name.str,
+ (uchar*) name.str,
name.length)))
return STRING_RESULT;
return entry->type;
@@ -4876,7 +4878,7 @@ double Item_func_match::val_real()
if ((null_value= (a == 0)) || !a->length())
DBUG_RETURN(0);
DBUG_RETURN(ft_handler->please->find_relevance(ft_handler,
- (byte *)a->ptr(), a->length()));
+ (uchar *)a->ptr(), a->length()));
}
DBUG_RETURN(ft_handler->please->find_relevance(ft_handler,
table->record[0], 0));
@@ -4991,8 +4993,8 @@ longlong Item_func_is_free_lock::val_int()
}
pthread_mutex_lock(&LOCK_user_locks);
- ull= (User_level_lock *) hash_search(&hash_user_locks, (byte*) res->ptr(),
- res->length());
+ ull= (User_level_lock *) hash_search(&hash_user_locks, (uchar*) res->ptr(),
+ (size_t) res->length());
pthread_mutex_unlock(&LOCK_user_locks);
if (!ull || !ull->locked)
return 1;
@@ -5010,8 +5012,8 @@ longlong Item_func_is_used_lock::val_int()
return 0;
pthread_mutex_lock(&LOCK_user_locks);
- ull= (User_level_lock *) hash_search(&hash_user_locks, (byte*) res->ptr(),
- res->length());
+ ull= (User_level_lock *) hash_search(&hash_user_locks, (uchar*) res->ptr(),
+ (size_t) res->length());
pthread_mutex_unlock(&LOCK_user_locks);
if (!ull || !ull->locked)
return 0;
@@ -5109,14 +5111,13 @@ Item_func_sp::func_name() const
@retval TRUE is returned on an error
@retval FALSE is returned on success.
*/
+
bool
Item_func_sp::init_result_field(THD *thd)
{
- DBUG_ENTER("Item_func_sp::init_result_field");
-
LEX_STRING empty_name= { C_STRING_WITH_LEN("") };
-
TABLE_SHARE *share;
+ DBUG_ENTER("Item_func_sp::init_result_field");
DBUG_ASSERT(m_sp == NULL);
DBUG_ASSERT(sp_result_field == NULL);
@@ -5143,30 +5144,34 @@ Item_func_sp::init_result_field(THD *thd)
share->table_cache_key = empty_name;
share->table_name = empty_name;
- if (!(sp_result_field= m_sp->create_result_field(max_length, name, dummy_table)))
+ if (!(sp_result_field= m_sp->create_result_field(max_length, name,
+ dummy_table)))
{
DBUG_RETURN(TRUE);
}
if (sp_result_field->pack_length() > sizeof(result_buf))
{
- sp_result_field->move_field(sql_alloc(sp_result_field->pack_length()));
- } else {
- sp_result_field->move_field(result_buf);
+ void *tmp;
+ if (!(tmp= sql_alloc(sp_result_field->pack_length())))
+ DBUG_RETURN(TRUE);
+ sp_result_field->move_field((uchar*) tmp);
}
+ else
+ sp_result_field->move_field(result_buf);
sp_result_field->null_ptr= (uchar *) &null_value;
sp_result_field->null_bit= 1;
-
-
DBUG_RETURN(FALSE);
}
+
/**
@brief Initialize local members with values from the Field interface.
@note called from Item::fix_fields.
*/
+
void Item_func_sp::fix_length_and_dec()
{
DBUG_ENTER("Item_func_sp::fix_length_and_dec");
@@ -5181,6 +5186,7 @@ void Item_func_sp::fix_length_and_dec()
DBUG_VOID_RETURN;
}
+
/**
@brief Execute function & store value in field.
@@ -5194,12 +5200,6 @@ Item_func_sp::execute()
{
THD *thd= current_thd;
- /*
- Get field in virtual tmp table to store result. Create the field if
- invoked first time.
- */
-
-
/* Execute function and store the return value in the field. */
if (execute_impl(thd))
@@ -5423,8 +5423,8 @@ ulonglong uuid_value;
void uuid_short_init()
{
- uuid_value= (((ulonglong) server_id << 56) +
- (ulonglong) server_start_time << 24);
+ uuid_value= ((((ulonglong) server_id) << 56) +
+ (((ulonglong) server_start_time) << 24));
}
diff --git a/sql/item_func.h b/sql/item_func.h
index 21dce696d61..8077f03d7ae 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -184,13 +184,13 @@ public:
{
return agg_item_charsets(c, func_name(), items, nitems, flags, item_sep);
}
- bool walk(Item_processor processor, bool walk_subquery, byte *arg);
- Item *transform(Item_transformer transformer, byte *arg);
- Item* compile(Item_analyzer analyzer, byte **arg_p,
- Item_transformer transformer, byte *arg_t);
+ bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
+ Item *transform(Item_transformer transformer, uchar *arg);
+ Item* compile(Item_analyzer analyzer, uchar **arg_p,
+ Item_transformer transformer, uchar *arg_t);
void traverse_cond(Cond_traverser traverser,
void * arg, traverse_order order);
- bool is_expensive_processor(byte *arg);
+ bool is_expensive_processor(uchar *arg);
virtual bool is_expensive() { return 0; }
};
@@ -253,7 +253,7 @@ public:
void fix_num_length_and_dec();
void find_num_type();
String *str_op(String *str) { DBUG_ASSERT(0); return 0; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -266,7 +266,7 @@ class Item_num_op :public Item_func_numhybrid
void print(String *str) { print_op(str); }
void find_num_type();
String *str_op(String *str) { DBUG_ASSERT(0); return 0; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -311,7 +311,7 @@ public:
{ max_length=args[0]->max_length; unsigned_flag=0; }
void print(String *str);
uint decimal_precision() const { return args[0]->decimal_precision(); }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -345,7 +345,7 @@ public:
void fix_length_and_dec() {};
const char *func_name() const { return "decimal_typecast"; }
void print(String *);
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -414,7 +414,7 @@ public:
const char *func_name() const { return "DIV"; }
void fix_length_and_dec();
void print(String *str) { print_op(str); }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -488,7 +488,7 @@ public:
Item_func_exp(Item *a) :Item_dec_func(a) {}
double val_real();
const char *func_name() const { return "exp"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -498,7 +498,7 @@ public:
Item_func_ln(Item *a) :Item_dec_func(a) {}
double val_real();
const char *func_name() const { return "ln"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -509,7 +509,7 @@ public:
Item_func_log(Item *a,Item *b) :Item_dec_func(a,b) {}
double val_real();
const char *func_name() const { return "log"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -519,7 +519,7 @@ public:
Item_func_log2(Item *a) :Item_dec_func(a) {}
double val_real();
const char *func_name() const { return "log2"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -529,7 +529,7 @@ public:
Item_func_log10(Item *a) :Item_dec_func(a) {}
double val_real();
const char *func_name() const { return "log10"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -539,7 +539,7 @@ public:
Item_func_sqrt(Item *a) :Item_dec_func(a) {}
double val_real();
const char *func_name() const { return "sqrt"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -549,7 +549,7 @@ public:
Item_func_pow(Item *a,Item *b) :Item_dec_func(a,b) {}
double val_real();
const char *func_name() const { return "pow"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -559,7 +559,7 @@ public:
Item_func_acos(Item *a) :Item_dec_func(a) {}
double val_real();
const char *func_name() const { return "acos"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_asin :public Item_dec_func
@@ -568,7 +568,7 @@ public:
Item_func_asin(Item *a) :Item_dec_func(a) {}
double val_real();
const char *func_name() const { return "asin"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_atan :public Item_dec_func
@@ -578,7 +578,7 @@ public:
Item_func_atan(Item *a,Item *b) :Item_dec_func(a,b) {}
double val_real();
const char *func_name() const { return "atan"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_cos :public Item_dec_func
@@ -587,7 +587,7 @@ public:
Item_func_cos(Item *a) :Item_dec_func(a) {}
double val_real();
const char *func_name() const { return "cos"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_sin :public Item_dec_func
@@ -596,7 +596,7 @@ public:
Item_func_sin(Item *a) :Item_dec_func(a) {}
double val_real();
const char *func_name() const { return "sin"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_tan :public Item_dec_func
@@ -605,7 +605,7 @@ public:
Item_func_tan(Item *a) :Item_dec_func(a) {}
double val_real();
const char *func_name() const { return "tan"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_integer :public Item_int_func
@@ -684,7 +684,7 @@ public:
Item_func_sign(Item *a) :Item_int_func(a) {}
const char *func_name() const { return "sign"; }
longlong val_int();
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -699,7 +699,7 @@ public:
const char *func_name() const { return name; }
void fix_length_and_dec()
{ decimals= NOT_FIXED_DEC; max_length= float_length(decimals); }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -717,7 +717,7 @@ public:
my_decimal *val_decimal(my_decimal *);
void fix_length_and_dec();
enum Item_result result_type () const { return cmp_type; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_min :public Item_func_min_max
@@ -772,7 +772,7 @@ public:
longlong val_int();
const char *func_name() const { return "length"; }
void fix_length_and_dec() { max_length=10; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_bit_length :public Item_func_length
@@ -792,7 +792,7 @@ public:
longlong val_int();
const char *func_name() const { return "char_length"; }
void fix_length_and_dec() { max_length=10; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_coercibility :public Item_int_func
@@ -816,7 +816,7 @@ public:
longlong val_int();
void fix_length_and_dec();
void print(String *str);
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -841,7 +841,7 @@ public:
longlong val_int();
const char *func_name() const { return "ascii"; }
void fix_length_and_dec() { max_length=3; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_ord :public Item_int_func
@@ -851,7 +851,7 @@ public:
Item_func_ord(Item *a) :Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "ord"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_find_in_set :public Item_int_func
@@ -865,7 +865,7 @@ public:
longlong val_int();
const char *func_name() const { return "find_in_set"; }
void fix_length_and_dec();
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
/* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */
@@ -877,7 +877,7 @@ public:
Item_func_bit(Item *a) :Item_int_func(a) {}
void fix_length_and_dec() { unsigned_flag= 1; }
void print(String *str) { print_op(str); }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_bit_or :public Item_func_bit
@@ -903,7 +903,7 @@ public:
longlong val_int();
const char *func_name() const { return "bit_count"; }
void fix_length_and_dec() { max_length=2; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_shift_left :public Item_func_bit
@@ -1344,7 +1344,7 @@ public:
longlong val_int();
const char *func_name() const { return "inet_aton"; }
void fix_length_and_dec() { decimals= 0; max_length= 21; maybe_null= 1; unsigned_flag= 1;}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -1457,7 +1457,7 @@ private:
sp_name *m_name;
mutable sp_head *m_sp;
TABLE *dummy_table;
- char result_buf[64];
+ uchar result_buf[64];
/*
The result field of the concrete stored function.
*/
@@ -1531,7 +1531,7 @@ public:
return str;
}
- virtual bool change_context_processor(byte *cntx)
+ virtual bool change_context_processor(uchar *cntx)
{ context= (Name_resolution_context *)cntx; return FALSE; }
bool sp_check_access(THD * thd);
@@ -1563,6 +1563,6 @@ public:
longlong val_int();
void fix_length_and_dec()
{ max_length= 21; unsigned_flag=1; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
diff --git a/sql/item_row.cc b/sql/item_row.cc
index 956556ca783..d1d1011ab2b 100644
--- a/sql/item_row.cc
+++ b/sql/item_row.cc
@@ -142,7 +142,7 @@ void Item_row::print(String *str)
}
-bool Item_row::walk(Item_processor processor, bool walk_subquery, byte *arg)
+bool Item_row::walk(Item_processor processor, bool walk_subquery, uchar *arg)
{
for (uint i= 0; i < arg_count; i++)
{
@@ -153,7 +153,7 @@ bool Item_row::walk(Item_processor processor, bool walk_subquery, byte *arg)
}
-Item *Item_row::transform(Item_transformer transformer, byte *arg)
+Item *Item_row::transform(Item_transformer transformer, uchar *arg)
{
DBUG_ASSERT(!current_thd->is_stmt_prepare());
diff --git a/sql/item_row.h b/sql/item_row.h
index d55d3ae223f..dd7436888f0 100644
--- a/sql/item_row.h
+++ b/sql/item_row.h
@@ -67,8 +67,8 @@ public:
void update_used_tables();
void print(String *str);
- bool walk(Item_processor processor, bool walk_subquery, byte *arg);
- Item *transform(Item_transformer transformer, byte *arg);
+ bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
+ Item *transform(Item_transformer transformer, uchar *arg);
uint cols() { return arg_count; }
Item* element_index(uint i) { return items[i]; }
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index a1fd79cbfb0..f9ca53a8355 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -28,6 +28,7 @@
#include "md5.h"
#include "sha1.h"
#include "my_aes.h"
+#include <zlib.h>
C_MODE_START
#include "../mysys/my_static.h" // For soundex_map
C_MODE_END
@@ -2220,7 +2221,7 @@ String *Item_func_make_set::val_str(String *str)
}
-Item *Item_func_make_set::transform(Item_transformer transformer, byte *arg)
+Item *Item_func_make_set::transform(Item_transformer transformer, uchar *arg)
{
DBUG_ASSERT(!current_thd->is_stmt_prepare());
@@ -2903,7 +2904,7 @@ String *Item_load_file::val_str(String *str)
goto err;
if ((file = my_open(file_name->c_ptr(), O_RDONLY, MYF(0))) < 0)
goto err;
- if (my_read(file, (byte*) tmp_value.ptr(), stat_info.st_size, MYF(MY_NABP)))
+ if (my_read(file, (uchar*) tmp_value.ptr(), stat_info.st_size, MYF(MY_NABP)))
{
my_close(file, MYF(0));
goto err;
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 60e7de42a9d..c036ec490db 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -50,7 +50,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "md5"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -94,7 +94,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "concat"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_concat_ws :public Item_str_func
@@ -116,7 +116,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "reverse"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -148,13 +148,13 @@ class Item_str_conv :public Item_str_func
{
protected:
uint multiply;
- uint (*converter)(CHARSET_INFO *cs, char *src, uint srclen,
- char *dst, uint dstlen);
+ size_t (*converter)(CHARSET_INFO *cs, char *src, size_t srclen,
+ char *dst, size_t dstlen);
String tmp_value;
public:
Item_str_conv(Item *item) :Item_str_func(item) {}
String *val_str(String *);
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -455,7 +455,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "soundex"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -491,12 +491,12 @@ public:
void update_used_tables();
const char *func_name() const { return "make_set"; }
- bool walk(Item_processor processor, bool walk_subquery, byte *arg)
+ bool walk(Item_processor processor, bool walk_subquery, uchar *arg)
{
return item->walk(processor, walk_subquery, arg) ||
Item_str_func::walk(processor, walk_subquery, arg);
}
- Item *transform(Item_transformer transformer, byte *arg);
+ Item *transform(Item_transformer transformer, uchar *arg);
void print(String *str);
};
@@ -549,7 +549,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "rpad"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -562,7 +562,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "lpad"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -577,7 +577,7 @@ public:
collation.set(default_charset());
max_length= 64;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -594,7 +594,7 @@ public:
decimals=0;
max_length=args[0]->max_length*2*collation.collation->mbmaxlen;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_unhex :public Item_str_func
@@ -614,7 +614,7 @@ public:
decimals=0;
max_length=(1+args[0]->max_length)/2;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -638,7 +638,7 @@ public:
}
void print(String *str);
const char *func_name() const { return "cast_as_binary"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -678,7 +678,7 @@ public:
String* val_str(String* str);
const char *func_name() const { return "inet_ntoa"; }
void fix_length_and_dec() { decimals = 0; max_length=3*8+7; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_quote :public Item_str_func
@@ -693,7 +693,7 @@ public:
collation.set(args[0]->collation);
max_length= args[0]->max_length * 2 + 2;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_conv_charset :public Item_str_func
@@ -794,7 +794,7 @@ public:
const char *func_name() const { return "crc32"; }
void fix_length_and_dec() { max_length=10; }
longlong val_int();
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_uncompressed_length : public Item_int_func
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 812d3c222c0..e15fba78009 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -149,7 +149,7 @@ bool Item_subselect::fix_fields(THD *thd_param, Item **ref)
DBUG_ASSERT(fixed == 0);
engine->set_thd((thd= thd_param));
- if (check_stack_overrun(thd, STACK_MIN_SIZE, (gptr)&res))
+ if (check_stack_overrun(thd, STACK_MIN_SIZE, (uchar*)&res))
return TRUE;
res= engine->prepare();
@@ -206,7 +206,7 @@ err:
bool Item_subselect::walk(Item_processor processor, bool walk_subquery,
- byte *argument)
+ uchar *argument)
{
if (walk_subquery)
@@ -449,7 +449,7 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
'upper' select is not really dependent => we remove this dependence
*/
substitution->walk(&Item::remove_dependence_processor, 0,
- (byte *) select_lex->outer_select());
+ (uchar *) select_lex->outer_select());
return RES_REDUCE;
}
return RES_OK;
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 7c21eac6ec3..51ab7b8ad42 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -125,7 +125,7 @@ public:
*/
virtual void reset_value_registration() {}
enum_parsing_place place() { return parsing_place; }
- bool walk(Item_processor processor, bool walk_subquery, byte *arg);
+ bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
/**
Get the SELECT_LEX structure associated with this Item.
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 2eced347650..f8d2c1e1122 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -403,7 +403,7 @@ Item *Item_sum::get_tmp_table_item(THD *thd)
bool Item_sum::walk (Item_processor processor, bool walk_subquery,
- byte *argument)
+ uchar *argument)
{
if (arg_count)
{
@@ -1434,7 +1434,7 @@ my_decimal *Item_sum_variance::val_decimal(my_decimal *dec_buf)
void Item_sum_variance::reset_field()
{
double nr;
- char *res= result_field->ptr;
+ uchar *res= result_field->ptr;
nr= args[0]->val_real(); /* sets null_value as side-effect */
@@ -1457,7 +1457,7 @@ void Item_sum_variance::reset_field()
void Item_sum_variance::update_field()
{
ulonglong field_count;
- char *res=result_field->ptr;
+ uchar *res=result_field->ptr;
double nr= args[0]->val_real(); /* sets null_value as side-effect */
@@ -1821,7 +1821,7 @@ bool Item_sum_and::add()
void Item_sum_num::reset_field()
{
double nr= args[0]->val_real();
- char *res=result_field->ptr;
+ uchar *res=result_field->ptr;
if (maybe_null)
{
@@ -1943,7 +1943,7 @@ void Item_sum_sum::reset_field()
void Item_sum_count::reset_field()
{
- char *res=result_field->ptr;
+ uchar *res=result_field->ptr;
longlong nr=0;
if (!args[0]->maybe_null || !args[0]->is_null())
@@ -1954,7 +1954,7 @@ void Item_sum_count::reset_field()
void Item_sum_avg::reset_field()
{
- char *res=result_field->ptr;
+ uchar *res=result_field->ptr;
if (hybrid_type == DECIMAL_RESULT)
{
longlong tmp;
@@ -1995,7 +1995,7 @@ void Item_sum_bit::reset_field()
void Item_sum_bit::update_field()
{
- char *res=result_field->ptr;
+ uchar *res=result_field->ptr;
bits= uint8korr(res);
add();
int8store(res, bits);
@@ -2030,7 +2030,7 @@ void Item_sum_sum::update_field()
else
{
double old_nr,nr;
- char *res=result_field->ptr;
+ uchar *res=result_field->ptr;
float8get(old_nr,res);
nr= args[0]->val_real();
@@ -2047,7 +2047,7 @@ void Item_sum_sum::update_field()
void Item_sum_count::update_field()
{
longlong nr;
- char *res=result_field->ptr;
+ uchar *res=result_field->ptr;
nr=sint8korr(res);
if (!args[0]->maybe_null || !args[0]->is_null())
@@ -2059,7 +2059,7 @@ void Item_sum_count::update_field()
void Item_sum_avg::update_field()
{
longlong field_count;
- char *res=result_field->ptr;
+ uchar *res=result_field->ptr;
if (hybrid_type == DECIMAL_RESULT)
{
my_decimal value, *arg_val= args[0]->val_decimal(&value);
@@ -2228,7 +2228,7 @@ double Item_avg_field::val_real()
// fix_fields() never calls for this Item
double nr;
longlong count;
- char *res;
+ uchar *res;
if (hybrid_type == DECIMAL_RESULT)
return val_real_from_decimal();
@@ -2361,10 +2361,10 @@ double Item_variance_field::val_real()
** COUNT(DISTINCT ...)
****************************************************************************/
-int simple_str_key_cmp(void* arg, byte* key1, byte* key2)
+int simple_str_key_cmp(void* arg, uchar* key1, uchar* key2)
{
Field *f= (Field*) arg;
- return f->cmp((const char*)key1, (const char*)key2);
+ return f->cmp(key1, key2);
}
/*
@@ -2374,7 +2374,7 @@ int simple_str_key_cmp(void* arg, byte* key1, byte* key2)
static
*/
-int composite_key_cmp(void* arg, byte* key1, byte* key2)
+int composite_key_cmp(void* arg, uchar* key1, uchar* key2)
{
Item_sum_count_distinct* item = (Item_sum_count_distinct*)arg;
Field **field = item->table->field;
@@ -2384,7 +2384,7 @@ int composite_key_cmp(void* arg, byte* key1, byte* key2)
{
Field* f = *field;
int len = *lengths++;
- int res = f->cmp((char *) key1, (char *) key2);
+ int res = f->cmp(key1, key2);
if (res)
return res;
key1 += len;
@@ -2839,8 +2839,8 @@ String *Item_sum_udf_str::val_str(String *str)
GROUP_CONCAT(DISTINCT expr,...)
*/
-int group_concat_key_cmp_with_distinct(void* arg, byte* key1,
- byte* key2)
+int group_concat_key_cmp_with_distinct(void* arg, uchar* key1,
+ uchar* key2)
{
Item_func_group_concat* grp_item= (Item_func_group_concat*)arg;
TABLE *table= grp_item->table;
@@ -2865,7 +2865,7 @@ int group_concat_key_cmp_with_distinct(void* arg, byte* key1,
int res;
uint offset= (field->offset(field->table->record[0]) -
table->s->null_bytes);
- if ((res= field->cmp((char *) key1 + offset, (char *) key2 + offset)))
+ if ((res= field->cmp(key1 + offset, key2 + offset)))
return res;
}
}
@@ -2878,7 +2878,7 @@ int group_concat_key_cmp_with_distinct(void* arg, byte* key1,
GROUP_CONCAT(expr,... ORDER BY col,... )
*/
-int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2)
+int group_concat_key_cmp_with_order(void* arg, uchar* key1, uchar* key2)
{
Item_func_group_concat* grp_item= (Item_func_group_concat*) arg;
ORDER **order_item, **end;
@@ -2904,7 +2904,7 @@ int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2)
int res;
uint offset= (field->offset(field->table->record[0]) -
table->s->null_bytes);
- if ((res= field->cmp((char *) key1 + offset, (char *) key2 + offset)))
+ if ((res= field->cmp(key1 + offset, key2 + offset)))
return (*order_item)->asc ? res : -res;
}
}
@@ -2927,8 +2927,8 @@ int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2)
the duplicated values when inserting things sorted by ORDER BY
*/
-int group_concat_key_cmp_with_distinct_and_order(void* arg,byte* key1,
- byte* key2)
+int group_concat_key_cmp_with_distinct_and_order(void* arg,uchar* key1,
+ uchar* key2)
{
if (!group_concat_key_cmp_with_distinct(arg,key1,key2))
return 0;
@@ -2940,7 +2940,7 @@ int group_concat_key_cmp_with_distinct_and_order(void* arg,byte* key1,
Append data from current leaf to item->result
*/
-int dump_leaf_key(byte* key, element_count count __attribute__((unused)),
+int dump_leaf_key(uchar* key, element_count count __attribute__((unused)),
Item_func_group_concat *item)
{
TABLE *table= item->table;
@@ -2974,7 +2974,7 @@ int dump_leaf_key(byte* key, element_count count __attribute__((unused)),
uint offset= (field->offset(field->table->record[0]) -
table->s->null_bytes);
DBUG_ASSERT(offset < table->s->reclength);
- res= field->val_str(&tmp, (char *) key + offset);
+ res= field->val_str(&tmp, key + offset);
}
else
res= (*arg)->val_str(&tmp);
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 5cf4f93af0e..84b425755d1 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -361,7 +361,7 @@ public:
Item *get_tmp_table_item(THD *thd);
virtual Field *create_tmp_field(bool group, TABLE *table,
uint convert_blob_length);
- bool walk(Item_processor processor, bool walk_subquery, byte *argument);
+ bool walk(Item_processor processor, bool walk_subquery, uchar *argument);
bool init_sum_func_check(THD *thd);
bool check_sum_func(THD *thd, Item **ref);
bool register_sum_func(THD *thd, Item **ref);
@@ -587,8 +587,8 @@ class Item_sum_count_distinct :public Item_sum_int
bool always_null; // Set to 1 if the result is always NULL
- friend int composite_key_cmp(void* arg, byte* key1, byte* key2);
- friend int simple_str_key_cmp(void* arg, byte* key1, byte* key2);
+ friend int composite_key_cmp(void* arg, uchar* key1, uchar* key2);
+ friend int simple_str_key_cmp(void* arg, uchar* key1, uchar* key2);
public:
Item_sum_count_distinct(List<Item> &list)
@@ -1183,14 +1183,14 @@ class Item_func_group_concat : public Item_sum
*/
Item_func_group_concat *original;
- friend int group_concat_key_cmp_with_distinct(void* arg, byte* key1,
- byte* key2);
- friend int group_concat_key_cmp_with_order(void* arg, byte* key1,
- byte* key2);
+ friend int group_concat_key_cmp_with_distinct(void* arg, uchar* key1,
+ uchar* key2);
+ friend int group_concat_key_cmp_with_order(void* arg, uchar* key1,
+ uchar* key2);
friend int group_concat_key_cmp_with_distinct_and_order(void* arg,
- byte* key1,
- byte* key2);
- friend int dump_leaf_key(byte* key,
+ uchar* key1,
+ uchar* key2);
+ friend int dump_leaf_key(uchar* key,
element_count count __attribute__((unused)),
Item_func_group_concat *group_concat_item);
@@ -1243,6 +1243,6 @@ public:
Item *copy_or_same(THD* thd);
void no_rows_in_result() {}
void print(String *str);
- virtual bool change_context_processor(byte *cntx)
+ virtual bool change_context_processor(uchar *cntx)
{ context= (Name_resolution_context *)cntx; return FALSE; }
};
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 0fd57264784..3bc63eaf5f9 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -886,9 +886,9 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
{
i++;
/* Change values[0...i-1] -> values[0...count-1] */
- bmove_upp((char*) (values+count), (char*) (values+i),
+ bmove_upp((uchar*) (values+count), (uchar*) (values+i),
sizeof(*values)*i);
- bzero((char*) values, sizeof(*values)*(count-i));
+ bzero((uchar*) values, sizeof(*values)*(count-i));
break;
}
}
@@ -1223,7 +1223,7 @@ bool get_interval_value(Item *args,interval_type int_type,
ulonglong array[5];
longlong value;
const char *str;
- uint32 length;
+ size_t length;
CHARSET_INFO *cs=str_value->charset();
LINT_INIT(value);
@@ -1258,7 +1258,7 @@ bool get_interval_value(Item *args,interval_type int_type,
interval->neg=1;
str++;
}
- length=(uint32) (end-str); // Set up pointers to new str
+ length= (size_t) (end-str); // Set up pointers to new str
}
switch (int_type) {
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 992b79753ca..bd0954e6bdb 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -38,7 +38,7 @@ public:
{
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -53,7 +53,7 @@ public:
decimals=0;
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -70,7 +70,7 @@ public:
maybe_null=1;
}
enum_monotonicity_info get_monotonicity_info() const;
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -86,7 +86,7 @@ public:
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -111,7 +111,7 @@ public:
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -144,7 +144,7 @@ public:
max_length=3*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -160,7 +160,7 @@ public:
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -176,7 +176,7 @@ public:
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -192,7 +192,7 @@ public:
max_length=1*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -208,7 +208,7 @@ public:
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -224,7 +224,7 @@ public:
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_yearweek :public Item_int_func
@@ -239,7 +239,7 @@ public:
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -256,7 +256,7 @@ public:
max_length=4*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -286,7 +286,7 @@ public:
max_length=1*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_dayname :public Item_func_weekday
@@ -319,7 +319,7 @@ public:
decimals=0;
max_length=10*MY_CHARSET_BIN_MB_MAXLEN;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -334,7 +334,7 @@ public:
decimals=0;
max_length=10*MY_CHARSET_BIN_MB_MAXLEN;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -585,7 +585,7 @@ public:
Item_func_from_days(Item *a) :Item_date(a) {}
const char *func_name() const { return "from_days"; }
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -603,7 +603,7 @@ public:
void fix_length_and_dec();
uint format_length(const String *format);
bool eq(const Item *item, bool binary_cmp) const;
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -617,7 +617,7 @@ class Item_func_from_unixtime :public Item_date_func
const char *func_name() const { return "from_unixtime"; }
void fix_length_and_dec();
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -676,7 +676,7 @@ public:
}
const char *func_name() const { return "sec_to_time"; }
bool result_as_longlong() { return TRUE; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -698,7 +698,7 @@ public:
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
bool eq(const Item *item, bool binary_cmp) const;
void print(String *str);
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -716,7 +716,7 @@ class Item_extract :public Item_int_func
void fix_length_and_dec();
bool eq(const Item *item, bool binary_cmp) const;
void print(String *str);
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -753,7 +753,7 @@ public:
max_length=args[0]->max_length;
maybe_null= 1;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -773,7 +773,7 @@ public:
String *val_str(String *a);
void fix_length_and_dec();
void print(String *str);
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -884,7 +884,7 @@ public:
max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
}
longlong val_int();
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -907,7 +907,7 @@ public:
}
void print(String *str);
const char *func_name() const { return "add_time"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
double val_real() { return val_real_from_decimal(); }
my_decimal *val_decimal(my_decimal *decimal_value)
{
@@ -949,7 +949,7 @@ public:
:Item_str_timefunc(a, b ,c) {}
String *val_str(String *str);
const char *func_name() const { return "maketime"; }
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
class Item_func_microsecond :public Item_int_func
@@ -963,7 +963,7 @@ public:
decimals=0;
maybe_null=1;
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -981,7 +981,7 @@ public:
maybe_null=1;
}
void print(String *str);
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
@@ -1028,7 +1028,7 @@ public:
{
return tmp_table_field_from_field_type(table, 1);
}
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index 26474990644..fb340e07cd5 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -2601,7 +2601,7 @@ static uint xml_parent_tag(MY_XML_NODE *items, uint nitems, uint level)
RETURN
Currently only MY_XML_OK
*/
-static int xml_enter(MY_XML_PARSER *st,const char *attr, uint len)
+static int xml_enter(MY_XML_PARSER *st,const char *attr, size_t len)
{
MY_XML_USER_DATA *data= (MY_XML_USER_DATA*)st->user_data;
MY_XML_NODE *nodes= (MY_XML_NODE*) data->pxml->ptr();
@@ -2632,7 +2632,7 @@ static int xml_enter(MY_XML_PARSER *st,const char *attr, uint len)
RETURN
Currently only MY_XML_OK
*/
-static int xml_value(MY_XML_PARSER *st,const char *attr, uint len)
+static int xml_value(MY_XML_PARSER *st,const char *attr, size_t len)
{
MY_XML_USER_DATA *data= (MY_XML_USER_DATA*)st->user_data;
MY_XML_NODE *nodes= (MY_XML_NODE*) data->pxml->ptr();
@@ -2662,7 +2662,7 @@ static int xml_value(MY_XML_PARSER *st,const char *attr, uint len)
RETURN
Currently only MY_XML_OK
*/
-static int xml_leave(MY_XML_PARSER *st,const char *attr, uint len)
+static int xml_leave(MY_XML_PARSER *st,const char *attr, size_t len)
{
MY_XML_USER_DATA *data= (MY_XML_USER_DATA*)st->user_data;
DBUG_ASSERT(data->level > 0);
@@ -2712,7 +2712,7 @@ String *Item_xml_str_func::parse_xml(String *raw_xml, String *parsed_xml_buf)
if ((rc= my_xml_parse(&p, raw_xml->ptr(), raw_xml->length())) != MY_XML_OK)
{
char buf[128];
- my_snprintf(buf, sizeof(buf)-1, "parse error at line %d pos %d: %s",
+ my_snprintf(buf, sizeof(buf)-1, "parse error at line %d pos %lu: %s",
my_xml_error_lineno(&p) + 1,
my_xml_error_pos(&p) + 1,
my_xml_error_string(&p));
diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h
index 9f2860ef403..650893fa7bd 100644
--- a/sql/item_xmlfunc.h
+++ b/sql/item_xmlfunc.h
@@ -41,7 +41,7 @@ public:
Item_func_xml_extractvalue(Item *a,Item *b) :Item_xml_str_func(a,b) {}
const char *func_name() const { return "extractvalue"; }
String *val_str(String *);
- bool check_partition_func_processor(byte *int_arg) {return FALSE;}
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
diff --git a/sql/key.cc b/sql/key.cc
index 19861cee134..851b5251b50 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -45,7 +45,7 @@
key_length is set to length of key before (not including) field
*/
-int find_ref_key(KEY *key, uint key_count, byte *record, Field *field,
+int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field,
uint *key_length, uint *keypart)
{
reg2 int i;
@@ -111,7 +111,8 @@ int find_ref_key(KEY *key, uint key_count, byte *record, Field *field,
None
*/
-void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length)
+void key_copy(uchar *to_key, uchar *from_record, KEY *key_info,
+ uint key_length)
{
uint length;
KEY_PART_INFO *key_part;
@@ -131,7 +132,7 @@ void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length)
Field_bit *field= (Field_bit *) (key_part->field);
if (field->bit_len)
{
- uchar bits= get_rec_bits((uchar*) from_record +
+ uchar bits= get_rec_bits(from_record +
key_part->null_offset +
(key_part->null_bit == 128),
field->bit_ofs, field->bit_len);
@@ -144,7 +145,7 @@ void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length)
{
key_length-= HA_KEY_BLOB_LENGTH;
length= min(key_length, key_part->length);
- key_part->field->get_key_image((char*) to_key, length, Field::itRAW);
+ key_part->field->get_key_image(to_key, length, Field::itRAW);
to_key+= HA_KEY_BLOB_LENGTH;
}
else
@@ -152,7 +153,7 @@ void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length)
length= min(key_length, key_part->length);
Field *field= key_part->field;
CHARSET_INFO *cs= field->charset();
- uint bytes= field->get_key_image((char*) to_key, length, Field::itRAW);
+ uint bytes= field->get_key_image(to_key, length, Field::itRAW);
if (bytes < length)
cs->cset->fill(cs, (char*) to_key + bytes, length - bytes, ' ');
}
@@ -180,7 +181,7 @@ void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length)
None
*/
-void key_restore(byte *to_record, byte *from_key, KEY *key_info,
+void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
uint key_length)
{
uint length;
@@ -218,7 +219,7 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info,
from_key+= HA_KEY_BLOB_LENGTH;
key_length-= HA_KEY_BLOB_LENGTH;
((Field_blob*) key_part->field)->set_ptr((ulong) blob_length,
- (char*) from_key);
+ from_key);
length= key_part->length;
}
else if (key_part->key_part_flag & HA_VAR_LENGTH_PART)
@@ -228,7 +229,7 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info,
length= min(key_length, key_part->length);
old_map= dbug_tmp_use_all_columns(key_part->field->table,
key_part->field->table->write_set);
- key_part->field->set_key_image((char *) from_key, length);
+ key_part->field->set_key_image(from_key, length);
dbug_tmp_restore_column_map(key_part->field->table->write_set, old_map);
from_key+= HA_KEY_BLOB_LENGTH;
}
@@ -264,11 +265,11 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info,
1 Key has changed
*/
-bool key_cmp_if_same(TABLE *table,const byte *key,uint idx,uint key_length)
+bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length)
{
uint store_length;
KEY_PART_INFO *key_part;
- const byte *key_end= key + key_length;;
+ const uchar *key_end= key + key_length;;
for (key_part=table->key_info[idx].key_part;
key < key_end ;
@@ -300,7 +301,7 @@ bool key_cmp_if_same(TABLE *table,const byte *key,uint idx,uint key_length)
{
CHARSET_INFO *cs= key_part->field->charset();
uint char_length= key_part->length / cs->mbmaxlen;
- const byte *pos= table->record[0] + key_part->offset;
+ const uchar *pos= table->record[0] + key_part->offset;
if (length > char_length)
{
char_length= my_charpos(cs, pos, pos + length, char_length);
@@ -424,11 +425,11 @@ bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields)
1 Key is larger than range
*/
-int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length)
+int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length)
{
uint store_length;
- for (const byte *end=key + key_length;
+ for (const uchar *end=key + key_length;
key < end;
key+= store_length, key_part++)
{
@@ -451,7 +452,7 @@ int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length)
key++; // Skip null byte
store_length--;
}
- if ((cmp=key_part->field->key_cmp((byte*) key, key_part->length)) < 0)
+ if ((cmp=key_part->field->key_cmp(key, key_part->length)) < 0)
return -1;
if (cmp > 0)
return 1;
@@ -484,13 +485,13 @@ int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length)
and return the result of the comparison.
*/
-int key_rec_cmp(void *key, byte *first_rec, byte *second_rec)
+int key_rec_cmp(void *key, uchar *first_rec, uchar *second_rec)
{
KEY *key_info= (KEY*)key;
uint key_parts= key_info->key_parts, i= 0;
KEY_PART_INFO *key_part= key_info->key_part;
- char *rec0= key_part->field->ptr - key_part->offset;
- my_ptrdiff_t first_diff= first_rec - (byte*)rec0, sec_diff= second_rec - (byte*)rec0;
+ uchar *rec0= key_part->field->ptr - key_part->offset;
+ my_ptrdiff_t first_diff= first_rec - rec0, sec_diff= second_rec - rec0;
int result= 0;
DBUG_ENTER("key_rec_cmp");
diff --git a/sql/lock.cc b/sql/lock.cc
index 4427e57a938..eeb895a3c8e 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -137,7 +137,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
{
/* Clear the lock type of all lock data to avoid reusage. */
reset_lock_data(sql_lock);
- my_free((gptr) sql_lock,MYF(0));
+ my_free((uchar*) sql_lock,MYF(0));
sql_lock=0;
break;
}
@@ -145,7 +145,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
{
/* Clear the lock type of all lock data to avoid reusage. */
reset_lock_data(sql_lock);
- my_free((gptr) sql_lock,MYF(0));
+ my_free((uchar*) sql_lock,MYF(0));
goto retry;
}
}
@@ -161,7 +161,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
We do not wait for READ_ONLY=0, and fail.
*/
reset_lock_data(sql_lock);
- my_free((gptr) sql_lock, MYF(0));
+ my_free((uchar*) sql_lock, MYF(0));
sql_lock=0;
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only");
break;
@@ -173,7 +173,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
{
/* Clear the lock type of all lock data to avoid reusage. */
reset_lock_data(sql_lock);
- my_free((gptr) sql_lock,MYF(0));
+ my_free((uchar*) sql_lock,MYF(0));
sql_lock=0;
break;
}
@@ -191,7 +191,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
if (rc > 1) /* a timeout or a deadlock */
{
my_error(rc, MYF(0));
- my_free((gptr) sql_lock,MYF(0));
+ my_free((uchar*) sql_lock,MYF(0));
sql_lock= 0;
break;
}
@@ -285,7 +285,7 @@ void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock)
thr_multi_unlock(sql_lock->locks,sql_lock->lock_count);
if (sql_lock->table_count)
VOID(unlock_external(thd,sql_lock->table,sql_lock->table_count));
- my_free((gptr) sql_lock,MYF(0));
+ my_free((uchar*) sql_lock,MYF(0));
DBUG_VOID_RETURN;
}
@@ -435,7 +435,7 @@ void mysql_lock_downgrade_write(THD *thd, TABLE *table,
{
for (uint i=0; i < locked->lock_count; i++)
thr_downgrade_write_lock(locked->locks[i], new_lock_type);
- my_free((gptr) locked,MYF(0));
+ my_free((uchar*) locked,MYF(0));
}
}
@@ -453,7 +453,7 @@ void mysql_lock_abort(THD *thd, TABLE *table, bool upgrade_lock)
{
for (uint i=0; i < locked->lock_count; i++)
thr_abort_locks(locked->locks[i]->lock, upgrade_lock);
- my_free((gptr) locked,MYF(0));
+ my_free((uchar*) locked,MYF(0));
}
DBUG_VOID_RETURN;
}
@@ -488,7 +488,7 @@ bool mysql_lock_abort_for_thread(THD *thd, TABLE *table)
table->in_use->thread_id))
result= TRUE;
}
- my_free((gptr) locked,MYF(0));
+ my_free((uchar*) locked,MYF(0));
}
DBUG_RETURN(result);
}
@@ -530,8 +530,8 @@ MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b)
}
/* Delete old, not needed locks */
- my_free((gptr) a,MYF(0));
- my_free((gptr) b,MYF(0));
+ my_free((uchar*) a,MYF(0));
+ my_free((uchar*) b,MYF(0));
DBUG_RETURN(sql_lock);
}
@@ -749,7 +749,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
/* Clear the lock type of the lock data that are stored already. */
sql_lock->lock_count= locks - sql_lock->locks;
reset_lock_data(sql_lock);
- my_free((gptr) sql_lock,MYF(0));
+ my_free((uchar*) sql_lock,MYF(0));
DBUG_RETURN(0);
}
}
@@ -906,10 +906,10 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use)
if (check_in_use)
{
/* Only insert the table if we haven't insert it already */
- for (table=(TABLE*) hash_first(&open_cache, (byte*)key,
+ for (table=(TABLE*) hash_first(&open_cache, (uchar*)key,
key_length, &state);
table ;
- table = (TABLE*) hash_next(&open_cache,(byte*) key,
+ table = (TABLE*) hash_next(&open_cache,(uchar*) key,
key_length, &state))
{
if (table->in_use == thd)
@@ -927,10 +927,10 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use)
table cache
*/
if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
- &table, sizeof(*table),
- &share, sizeof(*share),
- &key_buff, key_length,
- NULL))
+ &table, (uint) sizeof(*table),
+ &share, (uint) sizeof(*share),
+ &key_buff, (uint) key_length,
+ NullS))
DBUG_RETURN(-1);
table->s= share;
share->set_table_cache_key(key_buff, key, key_length);
@@ -939,9 +939,9 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use)
table->locked_by_name=1;
table_list->table=table;
- if (my_hash_insert(&open_cache, (byte*) table))
+ if (my_hash_insert(&open_cache, (uchar*) table))
{
- my_free((gptr) table,MYF(0));
+ my_free((uchar*) table,MYF(0));
DBUG_RETURN(-1);
}
@@ -955,7 +955,7 @@ void unlock_table_name(THD *thd, TABLE_LIST *table_list)
{
if (table_list->table)
{
- hash_delete(&open_cache, (byte*) table_list->table);
+ hash_delete(&open_cache, (uchar*) table_list->table);
broadcast_refresh();
}
}
diff --git a/sql/log.cc b/sql/log.cc
index 94c744f3f93..d7252b56d22 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1435,7 +1435,7 @@ static int binlog_close_connection(handlerton *hton, THD *thd)
DBUG_ASSERT(mysql_bin_log.is_open() && trx_data->empty());
thd->ha_data[binlog_hton->slot]= 0;
trx_data->~binlog_trx_data();
- my_free((gptr)trx_data, MYF(0));
+ my_free((uchar*)trx_data, MYF(0));
return 0;
}
@@ -1670,7 +1670,7 @@ int check_binlog_magic(IO_CACHE* log, const char** errmsg)
char magic[4];
DBUG_ASSERT(my_b_tell(log) == 0);
- if (my_b_read(log, (byte*) magic, sizeof(magic)))
+ if (my_b_read(log, (uchar*) magic, sizeof(magic)))
{
*errmsg = "I/O error reading the header from the binary log";
sql_print_error("%s, errno=%d, io cache code=%d", *errmsg, my_errno,
@@ -1772,15 +1772,16 @@ static int find_uniq_filename(char *name)
struct st_my_dir *dir_info;
reg1 struct fileinfo *file_info;
ulong max_found=0;
-
+ size_t buf_length, length;
+ char *start, *end;
DBUG_ENTER("find_uniq_filename");
- uint length = dirname_part(buff,name);
- char *start = name + length;
- char *end = strend(start);
+ length= dirname_part(buff, name, &buf_length);
+ start= name + length;
+ end= strend(start);
*end='.';
- length= (uint) (end-start+1);
+ length= (size_t) (end-start+1);
if (!(dir_info = my_dir(buff,MYF(MY_DONT_SORT))))
{ // This shouldn't happen
@@ -1790,7 +1791,7 @@ static int find_uniq_filename(char *name)
file_info= dir_info->dir_entry;
for (i=dir_info->number_off_files ; i-- ; file_info++)
{
- if (bcmp(file_info->name,start,length) == 0 &&
+ if (bcmp((uchar*) file_info->name, (uchar*) start, length) == 0 &&
test_if_number(file_info->name+length, &number,0))
{
set_if_bigger(max_found,(ulong) number);
@@ -1894,7 +1895,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
);
end= strnmov(buff + len, "Time Id Command Argument\n",
sizeof(buff) - len);
- if (my_b_write(&log_file, (byte*) buff, (uint) (end-buff)) ||
+ if (my_b_write(&log_file, (uchar*) buff, (uint) (end-buff)) ||
flush_io_cache(&log_file))
goto err;
}
@@ -2102,30 +2103,30 @@ bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host,
start.tm_mday, start.tm_hour,
start.tm_min, start.tm_sec);
- if (my_b_write(&log_file, (byte*) &time_buff, time_buff_len))
+ if (my_b_write(&log_file, (uchar*) &time_buff, time_buff_len))
goto err;
}
else
- if (my_b_write(&log_file, (byte*) "\t\t" ,2) < 0)
+ if (my_b_write(&log_file, (uchar*) "\t\t" ,2) < 0)
goto err;
/* command_type, thread_id */
length= my_snprintf(buff, 32, "%5ld ", (long) thread_id);
- if (my_b_write(&log_file, (byte*) buff, length))
+ if (my_b_write(&log_file, (uchar*) buff, length))
goto err;
- if (my_b_write(&log_file, (byte*) command_type, command_type_len))
+ if (my_b_write(&log_file, (uchar*) command_type, command_type_len))
goto err;
- if (my_b_write(&log_file, (byte*) "\t", 1))
+ if (my_b_write(&log_file, (uchar*) "\t", 1))
goto err;
/* sql_text */
- if (my_b_write(&log_file, (byte*) sql_text, sql_text_len))
+ if (my_b_write(&log_file, (uchar*) sql_text, sql_text_len))
goto err;
- if (my_b_write(&log_file, (byte*) "\n", 1) ||
+ if (my_b_write(&log_file, (uchar*) "\n", 1) ||
flush_io_cache(&log_file))
goto err;
}
@@ -2205,7 +2206,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time,
start.tm_min, start.tm_sec);
/* Note that my_b_write() assumes it knows the length for this */
- if (my_b_write(&log_file, (byte*) buff, buff_len))
+ if (my_b_write(&log_file, (uchar*) buff, buff_len))
tmp_errno= errno;
}
if (my_b_printf(&log_file, "# User@Host: ", sizeof("# User@Host: ") - 1)
@@ -2213,7 +2214,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time,
tmp_errno= errno;
if (my_b_printf(&log_file, user_host, user_host_len) != user_host_len)
tmp_errno= errno;
- if (my_b_write(&log_file, (byte*) "\n", 1))
+ if (my_b_write(&log_file, (uchar*) "\n", 1))
tmp_errno= errno;
}
/* For slow query log */
@@ -2261,18 +2262,18 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time,
{
*end++=';';
*end='\n';
- if (my_b_write(&log_file, (byte*) "SET ", 4) ||
- my_b_write(&log_file, (byte*) buff + 1, (uint) (end-buff)))
+ if (my_b_write(&log_file, (uchar*) "SET ", 4) ||
+ my_b_write(&log_file, (uchar*) buff + 1, (uint) (end-buff)))
tmp_errno= errno;
}
if (is_command)
{
end= strxmov(buff, "# administrator command: ", NullS);
buff_len= (ulong) (end - buff);
- my_b_write(&log_file, (byte*) buff, buff_len);
+ my_b_write(&log_file, (uchar*) buff, buff_len);
}
- if (my_b_write(&log_file, (byte*) sql_text, sql_text_len) ||
- my_b_write(&log_file, (byte*) ";\n",2) ||
+ if (my_b_write(&log_file, (uchar*) sql_text, sql_text_len) ||
+ my_b_write(&log_file, (uchar*) ";\n",2) ||
flush_io_cache(&log_file))
tmp_errno= errno;
if (tmp_errno)
@@ -2456,7 +2457,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
an extension for the binary log files.
In this case we write a standard header to it.
*/
- if (my_b_safe_write(&log_file, (byte*) BINLOG_MAGIC,
+ if (my_b_safe_write(&log_file, (uchar*) BINLOG_MAGIC,
BIN_LOG_HEADER_SIZE))
goto err;
bytes_written+= BIN_LOG_HEADER_SIZE;
@@ -2528,9 +2529,9 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
As this is a new log file, we write the file name to the index
file. As every time we write to the index file, we sync it.
*/
- if (my_b_write(&index_file, (byte*) log_file_name,
+ if (my_b_write(&index_file, (uchar*) log_file_name,
strlen(log_file_name)) ||
- my_b_write(&index_file, (byte*) "\n", 1) ||
+ my_b_write(&index_file, (uchar*) "\n", 1) ||
flush_io_cache(&index_file) ||
my_sync(index_file.file, MYF(MY_WME)))
goto err;
@@ -2598,7 +2599,7 @@ static bool copy_up_file_and_fill(IO_CACHE *index_file, my_off_t offset)
int bytes_read;
my_off_t init_offset= offset;
File file= index_file->file;
- byte io_buf[IO_SIZE*2];
+ uchar io_buf[IO_SIZE*2];
DBUG_ENTER("copy_up_file_and_fill");
for (;; offset+= bytes_read)
@@ -2610,7 +2611,7 @@ static bool copy_up_file_and_fill(IO_CACHE *index_file, my_off_t offset)
if (!bytes_read)
break; // end of file
(void) my_seek(file, offset-init_offset, MY_SEEK_SET, MYF(0));
- if (my_write(file, (byte*) io_buf, bytes_read, MYF(MY_WME | MY_NABP)))
+ if (my_write(file, io_buf, bytes_read, MYF(MY_WME | MY_NABP)))
goto err;
}
/* The following will either truncate the file or fill the end with \n' */
@@ -2822,7 +2823,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
need_start_event=1;
if (!open_index_file(index_file_name, 0))
open(save_name, log_type, 0, io_cache_type, no_auto_events, max_size, 0);
- my_free((gptr) save_name, MYF(0));
+ my_free((uchar*) save_name, MYF(0));
err:
VOID(pthread_mutex_unlock(&LOCK_thread_count));
@@ -3324,7 +3325,7 @@ bool MYSQL_BIN_LOG::appendv(const char* buf, uint len,...)
safe_mutex_assert_owner(&LOCK_log);
do
{
- if (my_b_append(&log_file,(byte*) buf,len))
+ if (my_b_append(&log_file,(uchar*) buf,len))
{
error= 1;
goto err;
@@ -3398,7 +3399,7 @@ int THD::binlog_setup_trx_data()
open_cached_file(&trx_data->trans_log, mysql_tmpdir,
LOG_PREFIX, binlog_cache_size, MYF(MY_WME)))
{
- my_free((gptr)trx_data, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*)trx_data, MYF(MY_ALLOW_ZERO_PTR));
ha_data[binlog_hton->slot]= 0;
DBUG_RETURN(1); // Didn't manage to set it up
}
@@ -3804,7 +3805,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
for (uint i= 0; i < thd->user_var_events.elements; i++)
{
BINLOG_USER_VAR_EVENT *user_var_event;
- get_dynamic(&thd->user_var_events,(gptr) &user_var_event, i);
+ get_dynamic(&thd->user_var_events,(uchar*) &user_var_event, i);
User_var_log_event e(thd, user_var_event->user_var_event->name.str,
user_var_event->user_var_event->name.length,
user_var_event->value,
@@ -4131,8 +4132,16 @@ void MYSQL_BIN_LOG::close(uint exiting)
if (log_file.type == WRITE_CACHE && log_type == LOG_BIN)
{
my_off_t offset= BIN_LOG_HEADER_SIZE + FLAGS_OFFSET;
- byte flags=0; // clearing LOG_EVENT_BINLOG_IN_USE_F
+ my_off_t org_position= my_tell(log_file.file, MYF(0));
+ uchar flags= 0; // clearing LOG_EVENT_BINLOG_IN_USE_F
my_pwrite(log_file.file, &flags, 1, offset, MYF(0));
+ /*
+ Restore position so that anything we have in the IO_cache is written
+ to the correct position.
+ We need the seek here, as my_pwrite() is not guaranteed to keep the
+ original position on system that doesn't support pwrite().
+ */
+ my_seek(log_file.file, org_position, MY_SEEK_SET, MYF(0));
}
/* this will cleanup IO_CACHE, sync and close the file */
@@ -4256,17 +4265,21 @@ bool flush_error_log()
(void) my_delete(err_temp, MYF(0));
if (freopen(err_temp,"a+",stdout))
{
+ int fd;
+ size_t bytes;
+ uchar buf[IO_SIZE];
+
freopen(err_temp,"a+",stderr);
(void) my_delete(err_renamed, MYF(0));
my_rename(log_error_file,err_renamed,MYF(0));
if (freopen(log_error_file,"a+",stdout))
freopen(log_error_file,"a+",stderr);
- int fd, bytes;
- char buf[IO_SIZE];
+
if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0)
{
- while ((bytes = (int) my_read(fd, (byte*) buf, IO_SIZE, MYF(0))) > 0)
- my_fwrite(stderr, (byte*) buf, bytes, MYF(0));
+ while ((bytes= my_read(fd, buf, IO_SIZE, MYF(0))) &&
+ bytes != MY_FILE_ERROR)
+ my_fwrite(stderr, buf, bytes, MYF(0));
my_close(fd, MYF(0));
}
(void) my_delete(err_temp, MYF(0));
@@ -4840,9 +4853,9 @@ void TC_LOG_MMAP::close()
pthread_cond_destroy(&pages[i].cond);
}
case 3:
- my_free((gptr)pages, MYF(0));
+ my_free((uchar*)pages, MYF(0));
case 2:
- my_munmap((byte*)data, (size_t)file_length);
+ my_munmap((uchar*)data, (size_t)file_length);
case 1:
my_close(fd, MYF(0));
}
@@ -4876,13 +4889,13 @@ int TC_LOG_MMAP::recover()
}
if (hash_init(&xids, &my_charset_bin, tc_log_page_size/3, 0,
- sizeof(my_xid), 0, 0, MYF(0)))
+ sizeof(my_xid), 0, 0, MYF(0)))
goto err1;
for ( ; p < end_p ; p++)
{
for (my_xid *x=p->start; x < p->end; x++)
- if (*x && my_hash_insert(&xids, (byte *)x))
+ if (*x && my_hash_insert(&xids, (uchar *)x))
goto err2; // OOM
}
@@ -5075,7 +5088,7 @@ int TC_LOG_BINLOG::recover(IO_CACHE *log, Format_description_log_event *fdle)
if (! fdle->is_valid() ||
hash_init(&xids, &my_charset_bin, TC_LOG_PAGE_SIZE/3, 0,
- sizeof(my_xid), 0, 0, MYF(0)))
+ sizeof(my_xid), 0, 0, MYF(0)))
goto err1;
init_alloc_root(&mem_root, TC_LOG_PAGE_SIZE, TC_LOG_PAGE_SIZE);
@@ -5087,8 +5100,8 @@ int TC_LOG_BINLOG::recover(IO_CACHE *log, Format_description_log_event *fdle)
if (ev->get_type_code() == XID_EVENT)
{
Xid_log_event *xev=(Xid_log_event *)ev;
- byte *x=(byte *)memdup_root(&mem_root, (char *)& xev->xid,
- sizeof(xev->xid));
+ uchar *x= (uchar *) memdup_root(&mem_root, (uchar*) &xev->xid,
+ sizeof(xev->xid));
if (! x)
goto err2;
my_hash_insert(&xids, x);
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 4087893060a..bde19f38df1 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -299,10 +299,10 @@ static void cleanup_load_tmpdir()
static bool write_str(IO_CACHE *file, char *str, uint length)
{
- byte tmp[1];
- tmp[0]= (byte) length;
+ uchar tmp[1];
+ tmp[0]= (uchar) length;
return (my_b_safe_write(file, tmp, sizeof(tmp)) ||
- my_b_safe_write(file, (byte*) str, length));
+ my_b_safe_write(file, (uchar*) str, length));
}
@@ -310,8 +310,8 @@ static bool write_str(IO_CACHE *file, char *str, uint length)
read_str()
*/
-static inline int read_str(const char **buf, const char *buf_end, const char **str,
- uint8 *len)
+static inline int read_str(const char **buf, const char *buf_end,
+ const char **str, uint8 *len)
{
if (*buf + ((uint) (uchar) **buf) >= buf_end)
return 1;
@@ -637,7 +637,7 @@ void Log_event::init_show_field_list(List<Item>* field_list)
bool Log_event::write_header(IO_CACHE* file, ulong event_data_length)
{
- byte header[LOG_EVENT_HEADER_LEN];
+ uchar header[LOG_EVENT_HEADER_LEN];
DBUG_ENTER("Log_event::write_header");
/* Store number of bytes that will be written by this event */
@@ -724,7 +724,7 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
if (log_lock)
pthread_mutex_lock(log_lock);
- if (my_b_read(file, (byte*) buf, sizeof(buf)))
+ if (my_b_read(file, (uchar*) buf, sizeof(buf)))
{
/*
If the read hits eof, we must report it as eof so the caller
@@ -825,7 +825,7 @@ Log_event* Log_event::read_log_event(IO_CACHE* file,
LOCK_MUTEX;
DBUG_PRINT("info", ("my_b_tell: %lu", (ulong) my_b_tell(file)));
- if (my_b_read(file, (byte *) head, header_size))
+ if (my_b_read(file, (uchar *) head, header_size))
{
DBUG_PRINT("info", ("Log_event::read_log_event(IO_CACHE*,Format_desc*) \
failed my_b_read"));
@@ -859,14 +859,14 @@ failed my_b_read"));
}
// some events use the extra byte to null-terminate strings
- if (!(buf = my_malloc(data_len+1, MYF(MY_WME))))
+ if (!(buf = (char*) my_malloc(data_len+1, MYF(MY_WME))))
{
error = "Out of memory";
goto err;
}
buf[data_len] = 0;
memcpy(buf, head, header_size);
- if (my_b_read(file, (byte*) buf + header_size, data_len - header_size))
+ if (my_b_read(file, (uchar*) buf + header_size, data_len - header_size))
{
error = "read error";
goto err;
@@ -1092,8 +1092,8 @@ void Log_event::print_header(IO_CACHE* file,
ptr[7], ptr[8], ptr[9], ptr[10], ptr[11], ptr[12], ptr[13],
ptr[14], ptr[15], ptr[16], ptr[17], ptr[18]);
DBUG_ASSERT(bytes_written >= 0);
- DBUG_ASSERT(static_cast<my_size_t>(bytes_written) < sizeof(emit_buf));
- my_b_write(file, (byte*) emit_buf, bytes_written);
+ DBUG_ASSERT(static_cast<size_t>(bytes_written) < sizeof(emit_buf));
+ my_b_write(file, (uchar*) emit_buf, bytes_written);
ptr += LOG_EVENT_MINIMAL_HEADER_LEN;
hexdump_from += LOG_EVENT_MINIMAL_HEADER_LEN;
}
@@ -1123,8 +1123,8 @@ void Log_event::print_header(IO_CACHE* file,
(unsigned long) (hexdump_from + (i & 0xfffffff0)),
hex_string, char_string);
DBUG_ASSERT(bytes_written >= 0);
- DBUG_ASSERT(static_cast<my_size_t>(bytes_written) < sizeof(emit_buf));
- my_b_write(file, (byte*) emit_buf, bytes_written);
+ DBUG_ASSERT(static_cast<size_t>(bytes_written) < sizeof(emit_buf));
+ my_b_write(file, (uchar*) emit_buf, bytes_written);
hex_string[0]= 0;
char_string[0]= 0;
c= char_string;
@@ -1144,14 +1144,14 @@ void Log_event::print_header(IO_CACHE* file,
(unsigned long) (hexdump_from + (i & 0xfffffff0)),
hex_string, char_string);
DBUG_ASSERT(bytes_written >= 0);
- DBUG_ASSERT(static_cast<my_size_t>(bytes_written) < sizeof(emit_buf));
- my_b_write(file, (byte*) emit_buf, bytes_written);
+ DBUG_ASSERT(static_cast<size_t>(bytes_written) < sizeof(emit_buf));
+ my_b_write(file, (uchar*) emit_buf, bytes_written);
}
/*
need a # to prefix the rest of printouts for example those of
Rows_log_event::print_helper().
*/
- my_b_write(file, reinterpret_cast<const byte*>("# "), 2);
+ my_b_write(file, reinterpret_cast<const uchar*>("# "), 2);
}
DBUG_VOID_RETURN;
}
@@ -1239,7 +1239,7 @@ void Query_log_event::pack_info(Protocol *protocol)
{
// TODO: show the catalog ??
char *buf, *pos;
- if (!(buf= my_malloc(9 + db_len + q_len, MYF(MY_WME))))
+ if (!(buf= (char*) my_malloc(9 + db_len + q_len, MYF(MY_WME))))
return;
pos= buf;
if (!(flags & LOG_EVENT_SUPPRESS_USE_F)
@@ -1440,12 +1440,12 @@ bool Query_log_event::write(IO_CACHE* file)
event_length= (uint) (start-buf) + get_post_header_size_for_derived() + db_len + 1 + q_len;
return (write_header(file, event_length) ||
- my_b_safe_write(file, (byte*) buf, QUERY_HEADER_LEN) ||
+ my_b_safe_write(file, (uchar*) buf, QUERY_HEADER_LEN) ||
write_post_header_for_derived(file) ||
- my_b_safe_write(file, (byte*) start_of_status,
+ my_b_safe_write(file, (uchar*) start_of_status,
(uint) (start-start_of_status)) ||
- my_b_safe_write(file, (db) ? (byte*) db : (byte*)"", db_len + 1) ||
- my_b_safe_write(file, (byte*) query, q_len)) ? 1 : 0;
+ my_b_safe_write(file, (db) ? (uchar*) db : (uchar*)"", db_len + 1) ||
+ my_b_safe_write(file, (uchar*) query, q_len)) ? 1 : 0;
}
/*
@@ -1559,7 +1559,8 @@ static void copy_str_and_move(const char **src,
*/
Query_log_event::Query_log_event(const char* buf, uint event_len,
- const Format_description_log_event *description_event,
+ const Format_description_log_event
+ *description_event,
Log_event_type event_type)
:Log_event(buf, description_event), data_buf(0), query(NullS),
db(NullS), catalog_len(0), status_vars_len(0),
@@ -1752,7 +1753,7 @@ void Query_log_event::print_query_header(IO_CACHE* file,
end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10);
end= strmov(end, print_event_info->delimiter);
*end++='\n';
- my_b_write(file, (byte*) buff, (uint) (end-buff));
+ my_b_write(file, (uchar*) buff, (uint) (end-buff));
if (flags & LOG_EVENT_THREAD_SPECIFIC_F)
my_b_printf(file,"SET @@session.pseudo_thread_id=%lu%s\n",
(ulong)thread_id, print_event_info->delimiter);
@@ -1836,7 +1837,7 @@ void Query_log_event::print_query_header(IO_CACHE* file,
print_event_info->charset_inited= 1;
print_event_info->charset[0]= ~charset[0]; // force a difference to force write
}
- if (unlikely(bcmp(print_event_info->charset, charset, 6)))
+ if (unlikely(bcmp((uchar*) print_event_info->charset, (uchar*) charset, 6)))
{
CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME));
if (cs_info)
@@ -1859,7 +1860,8 @@ void Query_log_event::print_query_header(IO_CACHE* file,
}
if (time_zone_len)
{
- if (bcmp(print_event_info->time_zone_str, time_zone_str, time_zone_len+1))
+ if (bcmp((uchar*) print_event_info->time_zone_str,
+ (uchar*) time_zone_str, time_zone_len+1))
{
my_b_printf(file,"SET @@session.time_zone='%s'%s\n",
time_zone_str, print_event_info->delimiter);
@@ -1890,7 +1892,7 @@ void Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
Write_on_release_cache cache(&print_event_info->head_cache, file);
print_query_header(&cache, print_event_info);
- my_b_write(&cache, (byte*) query, q_len);
+ my_b_write(&cache, (uchar*) query, q_len);
my_b_printf(&cache, "%s\n", print_event_info->delimiter);
}
#endif /* MYSQL_CLIENT */
@@ -2326,7 +2328,7 @@ bool Start_log_event_v3::write(IO_CACHE* file)
memcpy(buff + ST_SERVER_VER_OFFSET,server_version,ST_SERVER_VER_LEN);
int4store(buff + ST_CREATED_OFFSET,created);
return (write_header(file, sizeof(buff)) ||
- my_b_safe_write(file, (byte*) buff, sizeof(buff)));
+ my_b_safe_write(file, (uchar*) buff, sizeof(buff)));
}
#endif
@@ -2561,7 +2563,7 @@ Format_description_log_event(const char* buf,
DBUG_PRINT("info", ("common_header_len=%d number_of_event_types=%d",
common_header_len, number_of_event_types));
/* If alloc fails, we'll detect it in is_valid() */
- post_header_len= (uint8*) my_memdup((byte*)buf+ST_COMMON_HEADER_LEN_OFFSET+1,
+ post_header_len= (uint8*) my_memdup((uchar*)buf+ST_COMMON_HEADER_LEN_OFFSET+1,
number_of_event_types*
sizeof(*post_header_len), MYF(0));
calc_server_version_split();
@@ -2575,12 +2577,12 @@ bool Format_description_log_event::write(IO_CACHE* file)
We don't call Start_log_event_v3::write() because this would make 2
my_b_safe_write().
*/
- byte buff[FORMAT_DESCRIPTION_HEADER_LEN];
+ uchar buff[FORMAT_DESCRIPTION_HEADER_LEN];
int2store(buff + ST_BINLOG_VER_OFFSET,binlog_version);
memcpy((char*) buff + ST_SERVER_VER_OFFSET,server_version,ST_SERVER_VER_LEN);
int4store(buff + ST_CREATED_OFFSET,created);
buff[ST_COMMON_HEADER_LEN_OFFSET]= LOG_EVENT_HEADER_LEN;
- memcpy((char*) buff+ST_COMMON_HEADER_LEN_OFFSET+1, (byte*) post_header_len,
+ memcpy((char*) buff+ST_COMMON_HEADER_LEN_OFFSET+1, (uchar*) post_header_len,
LOG_EVENT_TYPES);
return (write_header(file, sizeof(buff)) ||
my_b_safe_write(file, buff, sizeof(buff)));
@@ -2835,7 +2837,7 @@ void Load_log_event::pack_info(Protocol *protocol)
{
char *buf, *end;
- if (!(buf= my_malloc(get_query_buffer_length(), MYF(MY_WME))))
+ if (!(buf= (char*) my_malloc(get_query_buffer_length(), MYF(MY_WME))))
return;
print_query(TRUE, buf, &end, 0, 0);
protocol->store(buf, end-buf, &my_charset_bin);
@@ -2859,7 +2861,7 @@ bool Load_log_event::write_data_header(IO_CACHE* file)
buf[L_TBL_LEN_OFFSET] = (char)table_name_len;
buf[L_DB_LEN_OFFSET] = (char)db_len;
int4store(buf + L_NUM_FIELDS_OFFSET, num_fields);
- return my_b_safe_write(file, (byte*)buf, LOAD_HEADER_LEN) != 0;
+ return my_b_safe_write(file, (uchar*)buf, LOAD_HEADER_LEN) != 0;
}
@@ -2873,13 +2875,13 @@ bool Load_log_event::write_data_body(IO_CACHE* file)
return 1;
if (num_fields && fields && field_lens)
{
- if (my_b_safe_write(file, (byte*)field_lens, num_fields) ||
- my_b_safe_write(file, (byte*)fields, field_block_len))
+ if (my_b_safe_write(file, (uchar*)field_lens, num_fields) ||
+ my_b_safe_write(file, (uchar*)fields, field_block_len))
return 1;
}
- return (my_b_safe_write(file, (byte*)table_name, table_name_len + 1) ||
- my_b_safe_write(file, (byte*)db, db_len + 1) ||
- my_b_safe_write(file, (byte*)fname, fname_len));
+ return (my_b_safe_write(file, (uchar*)table_name, table_name_len + 1) ||
+ my_b_safe_write(file, (uchar*)db, db_len + 1) ||
+ my_b_safe_write(file, (uchar*)fname, fname_len));
}
@@ -3498,7 +3500,7 @@ void Rotate_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
print_header(&cache, print_event_info, FALSE);
my_b_printf(&cache, "\tRotate to ");
if (new_log_ident)
- my_b_write(&cache, (byte*) new_log_ident, (uint)ident_len);
+ my_b_write(&cache, (uchar*) new_log_ident, (uint)ident_len);
my_b_printf(&cache, " pos: %s\n", llstr(pos, buf));
}
#endif /* MYSQL_CLIENT */
@@ -3564,8 +3566,8 @@ bool Rotate_log_event::write(IO_CACHE* file)
char buf[ROTATE_HEADER_LEN];
int8store(buf + R_POS_OFFSET, pos);
return (write_header(file, ROTATE_HEADER_LEN + ident_len) ||
- my_b_safe_write(file, (byte*)buf, ROTATE_HEADER_LEN) ||
- my_b_safe_write(file, (byte*)new_log_ident, (uint) ident_len));
+ my_b_safe_write(file, (uchar*)buf, ROTATE_HEADER_LEN) ||
+ my_b_safe_write(file, (uchar*)new_log_ident, (uint) ident_len));
}
#endif
@@ -3732,8 +3734,8 @@ const char* Intvar_log_event::get_var_type_name()
#ifndef MYSQL_CLIENT
bool Intvar_log_event::write(IO_CACHE* file)
{
- byte buf[9];
- buf[I_TYPE_OFFSET]= (byte) type;
+ uchar buf[9];
+ buf[I_TYPE_OFFSET]= (uchar) type;
int8store(buf + I_VAL_OFFSET, val);
return (write_header(file, sizeof(buf)) ||
my_b_safe_write(file, buf, sizeof(buf)));
@@ -3861,7 +3863,7 @@ Rand_log_event::Rand_log_event(const char* buf,
#ifndef MYSQL_CLIENT
bool Rand_log_event::write(IO_CACHE* file)
{
- byte buf[16];
+ uchar buf[16];
int8store(buf + RAND_SEED1_OFFSET, seed1);
int8store(buf + RAND_SEED2_OFFSET, seed2);
return (write_header(file, sizeof(buf)) ||
@@ -3968,7 +3970,7 @@ Xid_log_event(const char* buf,
bool Xid_log_event::write(IO_CACHE* file)
{
return write_header(file, sizeof(xid)) ||
- my_b_safe_write(file, (byte*) &xid, sizeof(xid));
+ my_b_safe_write(file, (uchar*) &xid, sizeof(xid));
}
#endif
@@ -4016,7 +4018,8 @@ void User_var_log_event::pack_info(Protocol* protocol)
if (is_null)
{
- buf= my_malloc(val_offset + 5, MYF(MY_WME));
+ if (!(buf= (char*) my_malloc(val_offset + 5, MYF(MY_WME))))
+ return;
strmov(buf + val_offset, "NULL");
event_len= val_offset + 4;
}
@@ -4026,28 +4029,37 @@ void User_var_log_event::pack_info(Protocol* protocol)
case REAL_RESULT:
double real_val;
float8get(real_val, val);
- buf= my_malloc(val_offset + FLOATING_POINT_BUFFER, MYF(MY_WME));
+ if (!(buf= (char*) my_malloc(val_offset + FLOATING_POINT_BUFFER,
+ MYF(MY_WME))))
+ return;
event_len+= my_sprintf(buf + val_offset,
(buf + val_offset, "%.14g", real_val));
break;
case INT_RESULT:
- buf= my_malloc(val_offset + 22, MYF(MY_WME));
+ if (!(buf= (char*) my_malloc(val_offset + 22, MYF(MY_WME))))
+ return;
event_len= longlong10_to_str(uint8korr(val), buf + val_offset,-10)-buf;
break;
case DECIMAL_RESULT:
{
- buf= my_malloc(val_offset + DECIMAL_MAX_STR_LENGTH, MYF(MY_WME));
+ if (!(buf= (char*) my_malloc(val_offset + DECIMAL_MAX_STR_LENGTH,
+ MYF(MY_WME))))
+ return;
String str(buf+val_offset, DECIMAL_MAX_STR_LENGTH, &my_charset_bin);
my_decimal dec;
- binary2my_decimal(E_DEC_FATAL_ERROR, val+2, &dec, val[0], val[1]);
+ binary2my_decimal(E_DEC_FATAL_ERROR, (uchar*) (val+2), &dec, val[0],
+ val[1]);
my_decimal2string(E_DEC_FATAL_ERROR, &dec, 0, 0, 0, &str);
event_len= str.length() + val_offset;
break;
}
case STRING_RESULT:
/* 15 is for 'COLLATE' and other chars */
- buf= my_malloc(event_len+val_len*2+1+2*MY_CS_NAME_SIZE+15, MYF(MY_WME));
+ buf= (char*) my_malloc(event_len+val_len*2+1+2*MY_CS_NAME_SIZE+15,
+ MYF(MY_WME));
CHARSET_INFO *cs;
+ if (!buf)
+ return;
if (!(cs= get_charset(charset_number, MYF(0))))
{
strmov(buf+val_offset, "???");
@@ -4069,11 +4081,11 @@ void User_var_log_event::pack_info(Protocol* protocol)
}
buf[0]= '@';
buf[1]= '`';
+ memcpy(buf+2, name, name_len);
buf[2+name_len]= '`';
buf[3+name_len]= '=';
- memcpy(buf+2, name, name_len);
protocol->store(buf, event_len, &my_charset_bin);
- my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(buf, MYF(0));
}
#endif /* !MYSQL_CLIENT */
@@ -4113,7 +4125,7 @@ bool User_var_log_event::write(IO_CACHE* file)
char buf[UV_NAME_LEN_SIZE];
char buf1[UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE];
- char buf2[max(8, DECIMAL_MAX_FIELD_SIZE + 2)], *pos= buf2;
+ uchar buf2[max(8, DECIMAL_MAX_FIELD_SIZE + 2)], *pos= buf2;
uint buf1_length;
ulong event_length;
@@ -4122,7 +4134,7 @@ bool User_var_log_event::write(IO_CACHE* file)
if ((buf1[0]= is_null))
{
buf1_length= 1;
- val_len= 0;
+ val_len= 0; // Length of 'pos'
}
else
{
@@ -4147,7 +4159,7 @@ bool User_var_log_event::write(IO_CACHE* file)
break;
}
case STRING_RESULT:
- pos= val;
+ pos= (uchar*) val;
break;
case ROW_RESULT:
default:
@@ -4162,10 +4174,10 @@ bool User_var_log_event::write(IO_CACHE* file)
event_length= sizeof(buf)+ name_len + buf1_length + val_len;
return (write_header(file, event_length) ||
- my_b_safe_write(file, (byte*) buf, sizeof(buf)) ||
- my_b_safe_write(file, (byte*) name, name_len) ||
- my_b_safe_write(file, (byte*) buf1, buf1_length) ||
- my_b_safe_write(file, (byte*) pos, val_len));
+ my_b_safe_write(file, (uchar*) buf, sizeof(buf)) ||
+ my_b_safe_write(file, (uchar*) name, name_len) ||
+ my_b_safe_write(file, (uchar*) buf1, buf1_length) ||
+ my_b_safe_write(file, pos, val_len));
}
#endif
@@ -4187,7 +4199,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
}
my_b_printf(&cache, "SET @`");
- my_b_write(&cache, (byte*) name, (uint) (name_len));
+ my_b_write(&cache, (uchar*) name, (uint) (name_len));
my_b_printf(&cache, "`");
if (is_null)
@@ -4218,7 +4230,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
dec.len= 10;
dec.buf= dec_buf;
- bin2decimal(val+2, &dec, precision, scale);
+ bin2decimal((uchar*) val+2, &dec, precision, scale);
decimal2string(&dec, str_buf, &str_len, 0, 0, 0);
str_buf[str_len]= 0;
my_b_printf(&cache, ":=%s%s\n", str_buf, print_event_info->delimiter);
@@ -4319,7 +4331,7 @@ int User_var_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
break;
case DECIMAL_RESULT:
{
- Item_decimal *dec= new Item_decimal(val+2, val[0], val[1]);
+ Item_decimal *dec= new Item_decimal((uchar*) val+2, val[0], val[1]);
it= dec;
val= (char *)dec->val_decimal(NULL);
val_len= sizeof(my_decimal);
@@ -4484,7 +4496,7 @@ bool Slave_log_event::write(IO_CACHE* file)
// log and host are already there
return (write_header(file, event_length) ||
- my_b_safe_write(file, (byte*) mem_pool, event_length));
+ my_b_safe_write(file, (uchar*) mem_pool, event_length));
}
#endif
@@ -4627,8 +4639,8 @@ bool Create_file_log_event::write_data_body(IO_CACHE* file)
bool res;
if ((res= Load_log_event::write_data_body(file)) || fake_base)
return res;
- return (my_b_safe_write(file, (byte*) "", 1) ||
- my_b_safe_write(file, (byte*) block, block_len));
+ return (my_b_safe_write(file, (uchar*) "", 1) ||
+ my_b_safe_write(file, (uchar*) block, block_len));
}
@@ -4639,7 +4651,7 @@ bool Create_file_log_event::write_data_body(IO_CACHE* file)
bool Create_file_log_event::write_data_header(IO_CACHE* file)
{
bool res;
- byte buf[CREATE_FILE_HEADER_LEN];
+ uchar buf[CREATE_FILE_HEADER_LEN];
if ((res= Load_log_event::write_data_header(file)) || fake_base)
return res;
int4store(buf + CF_FILE_ID_OFFSET, file_id);
@@ -4675,7 +4687,7 @@ Create_file_log_event::Create_file_log_event(const char* buf, uint len,
uint header_len= description_event->common_header_len;
uint8 load_header_len= description_event->post_header_len[LOAD_EVENT-1];
uint8 create_file_header_len= description_event->post_header_len[CREATE_FILE_EVENT-1];
- if (!(event_buf= my_memdup((byte*) buf, len, MYF(MY_WME))) ||
+ if (!(event_buf= (char*) my_memdup(buf, len, MYF(MY_WME))) ||
copy_log_event(event_buf,len,
((buf[EVENT_TYPE_OFFSET] == LOAD_EVENT) ?
load_header_len + header_len :
@@ -4830,7 +4842,7 @@ int Create_file_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
"could not open file '%s'", fname_buf);
goto err;
}
- if (my_write(fd, (byte*) block, block_len, MYF(MY_WME+MY_NABP)))
+ if (my_write(fd, (uchar*) block, block_len, MYF(MY_WME+MY_NABP)))
{
slave_print_msg(ERROR_LEVEL, rli, my_errno, "Error in Create_file event: "
"write to '%s' failed", fname_buf);
@@ -4898,11 +4910,11 @@ Append_block_log_event::Append_block_log_event(const char* buf, uint len,
#ifndef MYSQL_CLIENT
bool Append_block_log_event::write(IO_CACHE* file)
{
- byte buf[APPEND_BLOCK_HEADER_LEN];
+ uchar buf[APPEND_BLOCK_HEADER_LEN];
int4store(buf + AB_FILE_ID_OFFSET, file_id);
return (write_header(file, APPEND_BLOCK_HEADER_LEN + block_len) ||
my_b_safe_write(file, buf, APPEND_BLOCK_HEADER_LEN) ||
- my_b_safe_write(file, (byte*) block, block_len));
+ my_b_safe_write(file, (uchar*) block, block_len));
}
#endif
@@ -4986,7 +4998,7 @@ int Append_block_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
get_type_str(), fname);
goto err;
}
- if (my_write(fd, (byte*) block, block_len, MYF(MY_WME+MY_NABP)))
+ if (my_write(fd, (uchar*) block, block_len, MYF(MY_WME+MY_NABP)))
{
slave_print_msg(ERROR_LEVEL, rli, my_errno,
"Error in %s event: write to '%s' failed",
@@ -5043,7 +5055,7 @@ Delete_file_log_event::Delete_file_log_event(const char* buf, uint len,
#ifndef MYSQL_CLIENT
bool Delete_file_log_event::write(IO_CACHE* file)
{
- byte buf[DELETE_FILE_HEADER_LEN];
+ uchar buf[DELETE_FILE_HEADER_LEN];
int4store(buf + DF_FILE_ID_OFFSET, file_id);
return (write_header(file, sizeof(buf)) ||
my_b_safe_write(file, buf, sizeof(buf)));
@@ -5139,7 +5151,7 @@ Execute_load_log_event::Execute_load_log_event(const char* buf, uint len,
#ifndef MYSQL_CLIENT
bool Execute_load_log_event::write(IO_CACHE* file)
{
- byte buf[EXEC_LOAD_HEADER_LEN];
+ uchar buf[EXEC_LOAD_HEADER_LEN];
int4store(buf + EL_FILE_ID_OFFSET, file_id);
return (write_header(file, sizeof(buf)) ||
my_b_safe_write(file, buf, sizeof(buf)));
@@ -5357,12 +5369,12 @@ ulong Execute_load_query_log_event::get_post_header_size_for_derived()
bool
Execute_load_query_log_event::write_post_header_for_derived(IO_CACHE* file)
{
- char buf[EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN];
+ uchar buf[EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN];
int4store(buf, file_id);
int4store(buf + 4, fn_pos_start);
int4store(buf + 4 + 4, fn_pos_end);
- *(buf + 4 + 4 + 4)= (char)dup_handling;
- return my_b_safe_write(file, (byte*) buf, EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN);
+ *(buf + 4 + 4 + 4)= (uchar) dup_handling;
+ return my_b_safe_write(file, buf, EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN);
}
#endif
@@ -5385,19 +5397,19 @@ void Execute_load_query_log_event::print(FILE* file,
if (local_fname)
{
- my_b_write(&cache, (byte*) query, fn_pos_start);
+ my_b_write(&cache, (uchar*) query, fn_pos_start);
my_b_printf(&cache, " LOCAL INFILE \'");
my_b_printf(&cache, local_fname);
my_b_printf(&cache, "\'");
if (dup_handling == LOAD_DUP_REPLACE)
my_b_printf(&cache, " REPLACE");
my_b_printf(&cache, " INTO");
- my_b_write(&cache, (byte*) query + fn_pos_end, q_len-fn_pos_end);
+ my_b_write(&cache, (uchar*) query + fn_pos_end, q_len-fn_pos_end);
my_b_printf(&cache, "%s\n", print_event_info->delimiter);
}
else
{
- my_b_write(&cache, (byte*) query, q_len);
+ my_b_write(&cache, (uchar*) query, q_len);
my_b_printf(&cache, "%s\n", print_event_info->delimiter);
}
@@ -5411,7 +5423,7 @@ void Execute_load_query_log_event::print(FILE* file,
void Execute_load_query_log_event::pack_info(Protocol *protocol)
{
char *buf, *pos;
- if (!(buf= my_malloc(9 + db_len + q_len + 10 + 21, MYF(MY_WME))))
+ if (!(buf= (char*) my_malloc(9 + db_len + q_len + 10 + 21, MYF(MY_WME))))
return;
pos= buf;
if (db && db_len)
@@ -5442,8 +5454,8 @@ Execute_load_query_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
int error;
/* Replace filename and LOCAL keyword in query before executing it */
- if (!(buf = my_malloc(q_len + 1 - (fn_pos_end - fn_pos_start) +
- (FN_REFLEN + 10) + 10 + 8 + 5, MYF(MY_WME))))
+ if (!(buf = (char*) my_malloc(q_len + 1 - (fn_pos_end - fn_pos_start) +
+ (FN_REFLEN + 10) + 10 + 8 + 5, MYF(MY_WME))))
{
slave_print_msg(ERROR_LEVEL, rli, my_errno, "Not enough memory");
return 1;
@@ -5505,7 +5517,7 @@ bool sql_ex_info::write_data(IO_CACHE* file)
write_str(file, line_term, (uint) line_term_len) ||
write_str(file, line_start, (uint) line_start_len) ||
write_str(file, escaped, (uint) escaped_len) ||
- my_b_safe_write(file,(byte*) &opt_flags,1));
+ my_b_safe_write(file,(uchar*) &opt_flags,1));
}
else
{
@@ -5517,7 +5529,7 @@ bool sql_ex_info::write_data(IO_CACHE* file)
old_ex.escaped= *escaped;
old_ex.opt_flags= opt_flags;
old_ex.empty_flags=empty_flags;
- return my_b_safe_write(file, (byte*) &old_ex, sizeof(old_ex)) != 0;
+ return my_b_safe_write(file, (uchar*) &old_ex, sizeof(old_ex)) != 0;
}
}
@@ -5652,9 +5664,9 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
m_flags= uint2korr(post_start);
- byte const *const var_start=
- (const byte *)buf + common_header_len + post_header_len;
- byte const *const ptr_width= var_start;
+ uchar const *const var_start=
+ (const uchar *)buf + common_header_len + post_header_len;
+ uchar const *const ptr_width= var_start;
uchar *ptr_after_width= (uchar*) ptr_width;
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
m_width = net_field_length(&ptr_after_width);
@@ -5668,7 +5680,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
memcpy(m_cols.bitmap, ptr_after_width, (m_width + 7) / 8);
ptr_after_width+= (m_width + 7) / 8;
- DBUG_DUMP("m_cols", (char*) m_cols.bitmap, no_bytes_in_map(&m_cols));
+ DBUG_DUMP("m_cols", (uchar*) m_cols.bitmap, no_bytes_in_map(&m_cols));
}
else
{
@@ -5692,7 +5704,8 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
memcpy(m_cols_ai.bitmap, ptr_after_width, (m_width + 7) / 8);
ptr_after_width+= (m_width + 7) / 8;
- DBUG_DUMP("m_cols_ai", (char*) m_cols_ai.bitmap, no_bytes_in_map(&m_cols_ai));
+ DBUG_DUMP("m_cols_ai", (uchar*) m_cols_ai.bitmap,
+ no_bytes_in_map(&m_cols_ai));
}
else
{
@@ -5702,13 +5715,13 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
}
}
- const byte* const ptr_rows_data= (const byte*) ptr_after_width;
+ const uchar* const ptr_rows_data= (const uchar*) ptr_after_width;
- my_size_t const data_size= event_len - (ptr_rows_data - (const byte *) buf);
+ size_t const data_size= event_len - (ptr_rows_data - (const uchar *) buf);
DBUG_PRINT("info",("m_table_id: %lu m_flags: %d m_width: %lu data_size: %lu",
m_table_id, m_flags, m_width, data_size));
- m_rows_buf= (byte*)my_malloc(data_size, MYF(MY_WME));
+ m_rows_buf= (uchar*) my_malloc(data_size, MYF(MY_WME));
if (likely((bool)m_rows_buf))
{
m_rows_end= m_rows_buf + data_size;
@@ -5726,15 +5739,15 @@ Rows_log_event::~Rows_log_event()
if (m_cols.bitmap == m_bitbuf) // no my_malloc happened
m_cols.bitmap= 0; // so no my_free in bitmap_free
bitmap_free(&m_cols); // To pair with bitmap_init().
- my_free((gptr)m_rows_buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*)m_rows_buf, MYF(MY_ALLOW_ZERO_PTR));
}
int Rows_log_event::get_data_size()
{
int const type_code= get_type_code();
- char buf[sizeof(m_width)+1];
- char *end= net_store_length(buf, (m_width + 7) / 8);
+ uchar buf[sizeof(m_width)+1];
+ uchar *end= net_store_length(buf, (m_width + 7) / 8);
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
return 6 + no_bytes_in_map(&m_cols) + (end - buf) +
@@ -5753,7 +5766,7 @@ int Rows_log_event::get_data_size()
#ifndef MYSQL_CLIENT
-int Rows_log_event::do_add_row_data(byte *row_data, my_size_t length)
+int Rows_log_event::do_add_row_data(uchar *row_data, size_t length)
{
/*
When the table has a primary key, we would probably want, by default, to
@@ -5768,7 +5781,7 @@ int Rows_log_event::do_add_row_data(byte *row_data, my_size_t length)
trigger false warnings.
*/
#ifndef HAVE_purify
- DBUG_DUMP("row_data", (const char*)row_data, min(length, 32));
+ DBUG_DUMP("row_data", row_data, min(length, 32));
#endif
DBUG_ASSERT(m_rows_buf <= m_rows_cur);
@@ -5776,14 +5789,14 @@ int Rows_log_event::do_add_row_data(byte *row_data, my_size_t length)
DBUG_ASSERT(m_rows_cur <= m_rows_end);
/* The cast will always work since m_rows_cur <= m_rows_end */
- if (static_cast<my_size_t>(m_rows_end - m_rows_cur) <= length)
+ if (static_cast<size_t>(m_rows_end - m_rows_cur) <= length)
{
- my_size_t const block_size= 1024;
+ size_t const block_size= 1024;
my_ptrdiff_t const cur_size= m_rows_cur - m_rows_buf;
my_ptrdiff_t const new_alloc=
block_size * ((cur_size + length + block_size - 1) / block_size);
- byte* const new_buf= (byte*)my_realloc((gptr)m_rows_buf, (uint) new_alloc,
+ uchar* const new_buf= (uchar*)my_realloc((uchar*)m_rows_buf, (uint) new_alloc,
MYF(MY_ALLOW_ZERO_PTR|MY_WME));
if (unlikely(!new_buf))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -5815,7 +5828,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
{
DBUG_ENTER("Rows_log_event::do_apply_event(st_relay_log_info*)");
int error= 0;
- char const *row_start= (char const *)m_rows_buf;
+ uchar const *row_start= m_rows_buf;
/*
If m_table_id == ~0UL, then we have a dummy event that does not
@@ -6026,15 +6039,15 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
const_cast<RELAY_LOG_INFO*>(rli)->set_flag(RELAY_LOG_INFO::IN_STMT);
error= do_before_row_operations(table);
- while (error == 0 && row_start < (const char*) m_rows_end)
+ while (error == 0 && row_start < m_rows_end)
{
- char const *row_end= NULL;
+ uchar const *row_end= NULL;
if ((error= do_prepare_row(thd, rli, table, row_start, &row_end)))
break; // We should perform the after-row operation even in
// the case of error
DBUG_ASSERT(row_end != NULL); // cannot happen
- DBUG_ASSERT(row_end <= (const char*)m_rows_end);
+ DBUG_ASSERT(row_end <= m_rows_end);
/* in_use can have been set to NULL in close_tables_for_reopen */
THD* old_thd= table->in_use;
@@ -6215,7 +6228,7 @@ Rows_log_event::do_update_pos(RELAY_LOG_INFO *rli)
#ifndef MYSQL_CLIENT
bool Rows_log_event::write_data_header(IO_CACHE *file)
{
- byte buf[ROWS_HEADER_LEN]; // No need to init the buffer
+ uchar buf[ROWS_HEADER_LEN]; // No need to init the buffer
DBUG_ASSERT(m_table_id != ~0UL);
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
{
@@ -6234,34 +6247,30 @@ bool Rows_log_event::write_data_body(IO_CACHE*file)
Note that this should be the number of *bits*, not the number of
bytes.
*/
- char sbuf[sizeof(m_width)];
+ uchar sbuf[sizeof(m_width)];
my_ptrdiff_t const data_size= m_rows_cur - m_rows_buf;
bool res= false;
+ uchar *const sbuf_end= net_store_length(sbuf, (size_t) m_width);
+ DBUG_ASSERT(static_cast<size_t>(sbuf_end - sbuf) <= sizeof(sbuf));
- char *const sbuf_end= net_store_length((char*) sbuf, (uint) m_width);
- DBUG_ASSERT(static_cast<my_size_t>(sbuf_end - sbuf) <= sizeof(sbuf));
-
- DBUG_DUMP("m_width", sbuf, sbuf_end - sbuf);
- res= res || my_b_safe_write(file,
- reinterpret_cast<byte*>(sbuf),
- sbuf_end - sbuf);
+ DBUG_DUMP("m_width", sbuf, (size_t) (sbuf_end - sbuf));
+ res= res || my_b_safe_write(file, sbuf, (size_t) (sbuf_end - sbuf));
- DBUG_DUMP("m_cols", (char*) m_cols.bitmap, no_bytes_in_map(&m_cols));
- res= res || my_b_safe_write(file,
- reinterpret_cast<byte*>(m_cols.bitmap),
+ DBUG_DUMP("m_cols", (uchar*) m_cols.bitmap, no_bytes_in_map(&m_cols));
+ res= res || my_b_safe_write(file, (uchar*) m_cols.bitmap,
no_bytes_in_map(&m_cols));
/*
TODO[refactor write]: Remove the "down cast" here (and elsewhere).
*/
if (get_type_code() == UPDATE_ROWS_EVENT)
{
- DBUG_DUMP("m_cols_ai", (char*) m_cols_ai.bitmap, no_bytes_in_map(&m_cols_ai));
- res= res || my_b_safe_write(file,
- reinterpret_cast<byte*>(m_cols_ai.bitmap),
+ DBUG_DUMP("m_cols_ai", (uchar*) m_cols_ai.bitmap,
+ no_bytes_in_map(&m_cols_ai));
+ res= res || my_b_safe_write(file, (uchar*) m_cols_ai.bitmap,
no_bytes_in_map(&m_cols_ai));
}
- DBUG_DUMP("rows",(const char *) m_rows_buf, data_size);
- res= res || my_b_safe_write(file, m_rows_buf, (uint) data_size);
+ DBUG_DUMP("rows", m_rows_buf, data_size);
+ res= res || my_b_safe_write(file, m_rows_buf, (size_t) data_size);
return res;
@@ -6274,7 +6283,7 @@ void Rows_log_event::pack_info(Protocol *protocol)
char buf[256];
char const *const flagstr=
get_flags(STMT_END_F) ? " flags: STMT_END_F" : "";
- my_size_t bytes= my_snprintf(buf, sizeof(buf),
+ size_t bytes= my_snprintf(buf, sizeof(buf),
"table_id: %lu%s", m_table_id, flagstr);
protocol->store(buf, bytes, &my_charset_bin);
}
@@ -6346,7 +6355,7 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
m_data_size+= 1 + m_colcnt; // COLCNT and column types
/* If malloc fails, catched in is_valid() */
- if ((m_memory= my_malloc(m_colcnt, MYF(MY_WME))))
+ if ((m_memory= (uchar*) my_malloc(m_colcnt, MYF(MY_WME))))
{
m_coltype= reinterpret_cast<uchar*>(m_memory);
for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
@@ -6381,7 +6390,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
trigger false warnings.
*/
#ifndef HAVE_purify
- DBUG_DUMP("event buffer", buf, event_len);
+ DBUG_DUMP("event buffer", (uchar*) buf, event_len);
#endif
/* Read the post-header */
@@ -6409,29 +6418,29 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
const char *const vpart= buf + common_header_len + post_header_len;
/* Extract the length of the various parts from the buffer */
- byte const *const ptr_dblen= (byte const*)vpart + 0;
+ uchar const *const ptr_dblen= (uchar const*)vpart + 0;
m_dblen= *(uchar*) ptr_dblen;
/* Length of database name + counter + terminating null */
- byte const *const ptr_tbllen= ptr_dblen + m_dblen + 2;
+ uchar const *const ptr_tbllen= ptr_dblen + m_dblen + 2;
m_tbllen= *(uchar*) ptr_tbllen;
/* Length of table name + counter + terminating null */
- byte const *const ptr_colcnt= ptr_tbllen + m_tbllen + 2;
+ uchar const *const ptr_colcnt= ptr_tbllen + m_tbllen + 2;
uchar *ptr_after_colcnt= (uchar*) ptr_colcnt;
m_colcnt= net_field_length(&ptr_after_colcnt);
DBUG_PRINT("info",("m_dblen: %lu off: %ld m_tbllen: %lu off: %ld m_colcnt: %lu off: %ld",
- m_dblen, (long) (ptr_dblen-(const byte*)vpart),
- m_tbllen, (long) (ptr_tbllen-(const byte*)vpart),
- m_colcnt, (long) (ptr_colcnt-(const byte*)vpart)));
+ m_dblen, (long) (ptr_dblen-(const uchar*)vpart),
+ m_tbllen, (long) (ptr_tbllen-(const uchar*)vpart),
+ m_colcnt, (long) (ptr_colcnt-(const uchar*)vpart)));
/* Allocate mem for all fields in one go. If fails, catched in is_valid() */
- m_memory= my_multi_malloc(MYF(MY_WME),
- &m_dbnam, m_dblen + 1,
- &m_tblnam, m_tbllen + 1,
- &m_coltype, m_colcnt,
- NULL);
+ m_memory= (uchar*) my_multi_malloc(MYF(MY_WME),
+ &m_dbnam, (uint) m_dblen + 1,
+ &m_tblnam, (uint) m_tbllen + 1,
+ &m_coltype, (uint) m_colcnt,
+ NullS);
if (m_memory)
{
@@ -6464,8 +6473,11 @@ Table_map_log_event::~Table_map_log_event()
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
{
+ RPL_TABLE_LIST *table_list;
+ char *db_mem, *tname_mem;
+ size_t dummy_len;
+ void *memory;
DBUG_ENTER("Table_map_log_event::do_apply_event(st_relay_log_info*)");
-
DBUG_ASSERT(rli->sql_thd == thd);
/* Step the query id to mark what columns that are actually used. */
@@ -6473,19 +6485,13 @@ int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
thd->query_id= next_query_id();
pthread_mutex_unlock(&LOCK_thread_count);
- RPL_TABLE_LIST *table_list;
- char *db_mem, *tname_mem;
- void *const memory=
- my_multi_malloc(MYF(MY_WME),
- &table_list, sizeof(RPL_TABLE_LIST),
- &db_mem, NAME_LEN + 1,
- &tname_mem, NAME_LEN + 1,
- NULL);
-
- if (memory == NULL)
+ if (!(memory= my_multi_malloc(MYF(MY_WME),
+ &table_list, (uint) sizeof(RPL_TABLE_LIST),
+ &db_mem, (uint) NAME_LEN + 1,
+ &tname_mem, (uint) NAME_LEN + 1,
+ NullS)))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- uint dummy_len;
bzero(table_list, sizeof(*table_list));
table_list->db = db_mem;
table_list->alias= table_list->table_name = tname_mem;
@@ -6501,7 +6507,7 @@ int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
if (!rpl_filter->db_ok(table_list->db) ||
(rpl_filter->is_on() && !rpl_filter->tables_ok("", table_list)))
{
- my_free((gptr) memory, MYF(MY_WME));
+ my_free(memory, MYF(MY_WME));
}
else
{
@@ -6595,7 +6601,7 @@ int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
DBUG_RETURN(error);
err:
- my_free((gptr) memory, MYF(MY_WME));
+ my_free(memory, MYF(MY_WME));
DBUG_RETURN(error);
}
@@ -6611,7 +6617,7 @@ int Table_map_log_event::do_update_pos(RELAY_LOG_INFO *rli)
bool Table_map_log_event::write_data_header(IO_CACHE *file)
{
DBUG_ASSERT(m_table_id != ~0UL);
- byte buf[TABLE_MAP_HEADER_LEN];
+ uchar buf[TABLE_MAP_HEADER_LEN];
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
{
int4store(buf + 0, m_table_id);
@@ -6631,20 +6637,19 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file)
DBUG_ASSERT(m_dblen < 128);
DBUG_ASSERT(m_tbllen < 128);
- byte const dbuf[]= { (byte) m_dblen };
- byte const tbuf[]= { (byte) m_tbllen };
+ uchar const dbuf[]= { (uchar) m_dblen };
+ uchar const tbuf[]= { (uchar) m_tbllen };
- char cbuf[sizeof(m_colcnt)];
- char *const cbuf_end= net_store_length((char*) cbuf, (uint) m_colcnt);
- DBUG_ASSERT(static_cast<my_size_t>(cbuf_end - cbuf) <= sizeof(cbuf));
+ uchar cbuf[sizeof(m_colcnt)];
+ uchar *const cbuf_end= net_store_length(cbuf, (size_t) m_colcnt);
+ DBUG_ASSERT(static_cast<size_t>(cbuf_end - cbuf) <= sizeof(cbuf));
return (my_b_safe_write(file, dbuf, sizeof(dbuf)) ||
- my_b_safe_write(file, (const byte*)m_dbnam, m_dblen+1) ||
+ my_b_safe_write(file, (const uchar*)m_dbnam, m_dblen+1) ||
my_b_safe_write(file, tbuf, sizeof(tbuf)) ||
- my_b_safe_write(file, (const byte*)m_tblnam, m_tbllen+1) ||
- my_b_safe_write(file, reinterpret_cast<byte*>(cbuf),
- cbuf_end - (char*) cbuf) ||
- my_b_safe_write(file, reinterpret_cast<byte*>(m_coltype), m_colcnt));
+ my_b_safe_write(file, (const uchar*)m_tblnam, m_tbllen+1) ||
+ my_b_safe_write(file, cbuf, (size_t) (cbuf_end - cbuf)) ||
+ my_b_safe_write(file, m_coltype, m_colcnt));
}
#endif
@@ -6659,7 +6664,7 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file)
void Table_map_log_event::pack_info(Protocol *protocol)
{
char buf[256];
- my_size_t bytes= my_snprintf(buf, sizeof(buf),
+ size_t bytes= my_snprintf(buf, sizeof(buf),
"table_id: %lu (%s.%s)",
m_table_id, m_dbnam, m_tblnam);
protocol->store(buf, bytes, &my_charset_bin);
@@ -6771,8 +6776,8 @@ int Write_rows_log_event::do_after_row_operations(TABLE *table, int error)
int Write_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli,
TABLE *table,
- char const *const row_start,
- char const **const row_end)
+ uchar const *const row_start,
+ uchar const **const row_end)
{
DBUG_ASSERT(table != NULL);
DBUG_ASSERT(row_start && row_end);
@@ -6837,7 +6842,7 @@ namespace {
*/
static int
copy_extra_record_fields(TABLE *table,
- my_size_t master_reclength,
+ size_t master_reclength,
my_ptrdiff_t master_fields)
{
DBUG_PRINT("info", ("Copying to 0x%lx "
@@ -6979,7 +6984,7 @@ replace_record(THD *thd, TABLE *table,
auto_afree_ptr<char> key(NULL);
#ifndef DBUG_OFF
- DBUG_DUMP("record[0]",(const char *) table->record[0], table->s->reclength);
+ DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
DBUG_PRINT_BITSET("debug", "write_set = %s", table->write_set);
DBUG_PRINT_BITSET("debug", "read_set = %s", table->read_set);
#endif
@@ -7030,9 +7035,9 @@ replace_record(THD *thd, TABLE *table,
DBUG_RETURN(ENOMEM);
}
- key_copy((byte*)key.get(), table->record[0], table->key_info + keynum, 0);
+ key_copy((uchar*)key.get(), table->record[0], table->key_info + keynum, 0);
error= table->file->index_read_idx(table->record[1], keynum,
- (const byte*)key.get(),
+ (const uchar*)key.get(),
HA_WHOLE_KEY,
HA_READ_KEY_EXACT);
if (error)
@@ -7130,7 +7135,7 @@ static bool record_compare(TABLE *table)
*/
bool result= FALSE;
- byte saved_x[2], saved_filler[2];
+ uchar saved_x[2], saved_filler[2];
if (table->s->null_bytes > 0)
{
@@ -7213,15 +7218,15 @@ record_compare_exit:
<code>table->record[1]</code>, error code otherwise.
*/
-static int find_and_fetch_row(TABLE *table, byte *key)
+static int find_and_fetch_row(TABLE *table, uchar *key)
{
- DBUG_ENTER("find_and_fetch_row(TABLE *table, byte *key, byte *record)");
+ DBUG_ENTER("find_and_fetch_row(TABLE *table, uchar *key, uchar *record)");
DBUG_PRINT("enter", ("table: 0x%lx, key: 0x%lx record: 0x%lx",
(long) table, (long) key, (long) table->record[1]));
DBUG_ASSERT(table->in_use != NULL);
- DBUG_DUMP("record[0]",(const char *) table->record[0], table->s->reclength);
+ DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
if ((table->file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION) &&
table->s->primary_key < MAX_KEY)
@@ -7270,8 +7275,8 @@ static int find_and_fetch_row(TABLE *table, byte *key)
trigger false warnings.
*/
#ifndef HAVE_purify
- DBUG_DUMP("table->record[0]", (const char *)table->record[0], table->s->reclength);
- DBUG_DUMP("table->record[1]", (const char *)table->record[1], table->s->reclength);
+ DBUG_DUMP("table->record[0]", table->record[0], table->s->reclength);
+ DBUG_DUMP("table->record[1]", table->record[1], table->s->reclength);
#endif
/*
@@ -7296,8 +7301,8 @@ static int find_and_fetch_row(TABLE *table, byte *key)
trigger false warnings.
*/
#ifndef HAVE_purify
- DBUG_DUMP("table->record[0]", (const char *)table->record[0], table->s->reclength);
- DBUG_DUMP("table->record[1]", (const char *)table->record[1], table->s->reclength);
+ DBUG_DUMP("table->record[0]", table->record[0], table->s->reclength);
+ DBUG_DUMP("table->record[1]", table->record[1], table->s->reclength);
#endif
/*
Below is a minor "optimization". If the key (i.e., key number
@@ -7365,11 +7370,10 @@ static int find_and_fetch_row(TABLE *table, byte *key)
{
error= table->file->rnd_next(table->record[1]);
- DBUG_DUMP("record[0]",(const char *) table->record[0], table->s->reclength);
- DBUG_DUMP("record[1]",(const char *) table->record[1], table->s->reclength);
+ DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
+ DBUG_DUMP("record[1]", table->record[1], table->s->reclength);
- switch (error)
- {
+ switch (error) {
case 0:
case HA_ERR_RECORD_DELETED:
break;
@@ -7454,16 +7458,17 @@ int Delete_rows_log_event::do_before_row_operations(TABLE *table)
if (table->s->keys > 0)
{
- m_memory=
- my_multi_malloc(MYF(MY_WME),
- &m_after_image, table->s->reclength,
- &m_key, table->key_info->key_length,
- NULL);
+ m_memory= (uchar*) my_multi_malloc(MYF(MY_WME),
+ &m_after_image,
+ (uint) table->s->reclength,
+ &m_key,
+ (uint) table->key_info->key_length,
+ NullS);
}
else
{
- m_after_image= (byte*)my_malloc(table->s->reclength, MYF(MY_WME));
- m_memory= (gptr)m_after_image;
+ m_after_image= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME));
+ m_memory= (uchar*)m_after_image;
m_key= NULL;
}
if (!m_memory)
@@ -7486,8 +7491,8 @@ int Delete_rows_log_event::do_after_row_operations(TABLE *table, int error)
int Delete_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli,
TABLE *table,
- char const *const row_start,
- char const **const row_end)
+ uchar const *const row_start,
+ uchar const **const row_end)
{
int error;
DBUG_ASSERT(row_start && row_end);
@@ -7626,16 +7631,17 @@ int Update_rows_log_event::do_before_row_operations(TABLE *table)
if (table->s->keys > 0)
{
- m_memory=
- my_multi_malloc(MYF(MY_WME),
- &m_after_image, table->s->reclength,
- &m_key, table->key_info->key_length,
- NULL);
+ m_memory= (uchar*) my_multi_malloc(MYF(MY_WME),
+ &m_after_image,
+ (uint) table->s->reclength,
+ &m_key,
+ (uint) table->key_info->key_length,
+ NullS);
}
else
{
- m_after_image= (byte*)my_malloc(table->s->reclength, MYF(MY_WME));
- m_memory= (gptr)m_after_image;
+ m_after_image= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME));
+ m_memory= m_after_image;
m_key= NULL;
}
if (!m_memory)
@@ -7660,8 +7666,8 @@ int Update_rows_log_event::do_after_row_operations(TABLE *table, int error)
int Update_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli,
TABLE *table,
- char const *const row_start,
- char const **const row_end)
+ uchar const *const row_start,
+ uchar const **const row_end)
{
int error;
DBUG_ASSERT(row_start && row_end);
@@ -7681,7 +7687,7 @@ int Update_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli,
error= unpack_row(rli, table, m_width, row_start, &m_cols, row_end,
&m_master_reclength, table->read_set, UPDATE_ROWS_EVENT);
store_record(table, record[1]);
- char const *next_start = *row_end;
+ uchar const *next_start = *row_end;
/* m_after_image is the after image for the update */
error= unpack_row(rli, table, m_width, next_start, &m_cols_ai, row_end,
&m_master_reclength, table->write_set, UPDATE_ROWS_EVENT);
@@ -7693,8 +7699,8 @@ int Update_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli,
trigger false warnings.
*/
#ifndef HAVE_purify
- DBUG_DUMP("record[0]", (const char *)table->record[0], table->s->reclength);
- DBUG_DUMP("m_after_image", (const char *)m_after_image, table->s->reclength);
+ DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
+ DBUG_DUMP("m_after_image", m_after_image, table->s->reclength);
#endif
/*
@@ -7798,7 +7804,7 @@ Incident_log_event::description() const
DBUG_PRINT("info", ("m_incident: %d", m_incident));
DBUG_ASSERT(0 <= m_incident);
- DBUG_ASSERT((my_size_t) m_incident <= sizeof(description)/sizeof(*description));
+ DBUG_ASSERT((size_t) m_incident <= sizeof(description)/sizeof(*description));
return description[m_incident];
}
@@ -7808,7 +7814,7 @@ Incident_log_event::description() const
void Incident_log_event::pack_info(Protocol *protocol)
{
char buf[256];
- my_size_t bytes;
+ size_t bytes;
if (m_message.length > 0)
bytes= my_snprintf(buf, sizeof(buf), "#%d (%s)",
m_incident, description());
@@ -7852,7 +7858,7 @@ Incident_log_event::write_data_header(IO_CACHE *file)
{
DBUG_ENTER("Incident_log_event::write_data_header");
DBUG_PRINT("enter", ("m_incident: %d", m_incident));
- byte buf[sizeof(int16)];
+ uchar buf[sizeof(int16)];
int2store(buf, (int16) m_incident);
DBUG_RETURN(my_b_safe_write(file, buf, sizeof(buf)));
}
diff --git a/sql/log_event.h b/sql/log_event.h
index 4e43822cb38..398bb9ca90f 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -753,7 +753,7 @@ public:
static void operator delete(void *ptr, size_t size)
{
- my_free((gptr) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
}
/* Placement version of the above operators */
@@ -1040,7 +1040,7 @@ public:
~Query_log_event()
{
if (data_buf)
- my_free((gptr) data_buf, MYF(0));
+ my_free((uchar*) data_buf, MYF(0));
}
Log_event_type get_type_code() { return QUERY_EVENT; }
#ifndef MYSQL_CLIENT
@@ -1362,7 +1362,7 @@ public:
Format_description_log_event(uint8 binlog_ver, const char* server_ver=0);
Format_description_log_event(const char* buf, uint event_len,
const Format_description_log_event* description_event);
- ~Format_description_log_event() { my_free((gptr)post_header_len, MYF(0)); }
+ ~Format_description_log_event() { my_free((uchar*)post_header_len, MYF(0)); }
Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;}
#ifndef MYSQL_CLIENT
bool write(IO_CACHE* file);
@@ -1645,7 +1645,7 @@ public:
~Rotate_log_event()
{
if (flags & DUP_NAME)
- my_free((gptr) new_log_ident, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) new_log_ident, MYF(MY_ALLOW_ZERO_PTR));
}
Log_event_type get_type_code() { return ROTATE_EVENT;}
int get_data_size() { return ident_len + ROTATE_HEADER_LEN;}
@@ -2069,20 +2069,20 @@ private:
#endif
#ifndef MYSQL_CLIENT
- TABLE *m_table;
+ TABLE *m_table;
#endif
char const *m_dbnam;
- my_size_t m_dblen;
+ size_t m_dblen;
char const *m_tblnam;
- my_size_t m_tbllen;
+ size_t m_tbllen;
ulong m_colcnt;
- unsigned char *m_coltype;
+ uchar *m_coltype;
- gptr m_memory;
+ uchar *m_memory;
ulong m_table_id;
flag_set m_flags;
- my_size_t m_data_size;
+ size_t m_data_size;
};
@@ -2160,7 +2160,7 @@ public:
#endif
#ifndef MYSQL_CLIENT
- int add_row_data(byte *data, my_size_t length)
+ int add_row_data(uchar *data, size_t length)
{
return do_add_row_data(data,length);
}
@@ -2170,7 +2170,7 @@ public:
virtual int get_data_size();
MY_BITMAP const *get_cols() const { return &m_cols; }
- my_size_t get_width() const { return m_width; }
+ size_t get_width() const { return m_width; }
ulong get_table_id() const { return m_table_id; }
#ifndef MYSQL_CLIENT
@@ -2209,7 +2209,7 @@ protected:
#endif
#ifndef MYSQL_CLIENT
- virtual int do_add_row_data(byte *data, my_size_t length);
+ virtual int do_add_row_data(uchar *data, size_t length);
#endif
#ifndef MYSQL_CLIENT
@@ -2233,9 +2233,9 @@ protected:
uint32 m_bitbuf[128/(sizeof(uint32)*8)];
uint32 m_bitbuf_ai[128/(sizeof(uint32)*8)];
- byte *m_rows_buf; /* The rows in packed format */
- byte *m_rows_cur; /* One-after the end of the data */
- byte *m_rows_end; /* One-after the end of the allocated space */
+ uchar *m_rows_buf; /* The rows in packed format */
+ uchar *m_rows_cur; /* One-after the end of the data */
+ uchar *m_rows_end; /* One-after the end of the allocated space */
flag_set m_flags; /* Flags for row-level events */
@@ -2293,7 +2293,8 @@ private:
Error code, if something went wrong, 0 otherwise.
*/
virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*,
- char const *row_start, char const **row_end) = 0;
+ uchar const *row_start,
+ uchar const **row_end) = 0;
/*
Primitive to do the actual execution necessary for a row.
@@ -2341,9 +2342,9 @@ public:
bool is_transactional,
MY_BITMAP *cols,
uint fields,
- const byte *before_record
+ const uchar *before_record
__attribute__((unused)),
- const byte *after_record)
+ const uchar *after_record)
{
return thd->binlog_write_row(table, is_transactional,
cols, fields, after_record);
@@ -2358,13 +2359,13 @@ private:
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- gptr m_memory;
- byte *m_after_image;
+ uchar *m_memory;
+ uchar *m_after_image;
virtual int do_before_row_operations(TABLE *table);
virtual int do_after_row_operations(TABLE *table, int error);
virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*,
- char const *row_start, char const **row_end);
+ uchar const *row_start, uchar const **row_end);
virtual int do_exec_row(TABLE *table);
#endif
};
@@ -2416,8 +2417,8 @@ public:
bool is_transactional,
MY_BITMAP *cols,
uint fields,
- const byte *before_record,
- const byte *after_record)
+ const uchar *before_record,
+ const uchar *after_record)
{
return thd->binlog_update_row(table, is_transactional,
cols, fields, before_record, after_record);
@@ -2437,14 +2438,14 @@ protected:
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- gptr m_memory;
- byte *m_key;
- byte *m_after_image;
+ uchar *m_memory;
+ uchar *m_key;
+ uchar *m_after_image;
virtual int do_before_row_operations(TABLE *table);
virtual int do_after_row_operations(TABLE *table, int error);
virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*,
- char const *row_start, char const **row_end);
+ uchar const *row_start, uchar const **row_end);
virtual int do_exec_row(TABLE *table);
#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
};
@@ -2491,8 +2492,8 @@ public:
bool is_transactional,
MY_BITMAP *cols,
uint fields,
- const byte *before_record,
- const byte *after_record
+ const uchar *before_record,
+ const uchar *after_record
__attribute__((unused)))
{
return thd->binlog_delete_row(table, is_transactional,
@@ -2508,14 +2509,14 @@ protected:
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- gptr m_memory;
- byte *m_key;
- byte *m_after_image;
+ uchar *m_memory;
+ uchar *m_key;
+ uchar *m_after_image;
virtual int do_before_row_operations(TABLE *table);
virtual int do_after_row_operations(TABLE *table, int error);
virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*,
- char const *row_start, char const **row_end);
+ uchar const *row_start, uchar const **row_end);
virtual int do_exec_row(TABLE *table);
#endif
};
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 5153dff0e55..e6a9dd50c08 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -8,8 +8,8 @@ int
Write_rows_log_event_old::do_prepare_row(THD *thd,
RELAY_LOG_INFO const *rli,
TABLE *table,
- char const *row_start,
- char const **row_end)
+ uchar const *row_start,
+ uchar const **row_end)
{
DBUG_ASSERT(table != NULL);
DBUG_ASSERT(row_start && row_end);
@@ -28,8 +28,8 @@ int
Delete_rows_log_event_old::do_prepare_row(THD *thd,
RELAY_LOG_INFO const *rli,
TABLE *table,
- char const *row_start,
- char const **row_end)
+ uchar const *row_start,
+ uchar const **row_end)
{
int error;
DBUG_ASSERT(row_start && row_end);
@@ -61,8 +61,8 @@ Delete_rows_log_event_old::do_prepare_row(THD *thd,
int Update_rows_log_event_old::do_prepare_row(THD *thd,
RELAY_LOG_INFO const *rli,
TABLE *table,
- char const *row_start,
- char const **row_end)
+ uchar const *row_start,
+ uchar const **row_end)
{
int error;
DBUG_ASSERT(row_start && row_end);
@@ -84,9 +84,8 @@ int Update_rows_log_event_old::do_prepare_row(THD *thd,
row_start, &m_cols, row_end, &m_master_reclength,
table->write_set, PRE_GA_UPDATE_ROWS_EVENT);
- DBUG_DUMP("record[0]", (const char*) table->record[0], table->s->reclength);
- DBUG_DUMP("m_after_image", (const char *) m_after_image, table->s->reclength);
-
+ DBUG_DUMP("record[0]", table->record[0], table->s->reclength);
+ DBUG_DUMP("m_after_image", m_after_image, table->s->reclength);
/*
If we will access rows using the random access method, m_key will
diff --git a/sql/log_event_old.h b/sql/log_event_old.h
index 87b11aea3a3..7c2932360f5 100644
--- a/sql/log_event_old.h
+++ b/sql/log_event_old.h
@@ -50,7 +50,7 @@ private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*,
- char const *row_start, char const **row_end);
+ uchar const *row_start, uchar const **row_end);
#endif
};
@@ -84,7 +84,7 @@ private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*,
- char const *row_start, char const **row_end);
+ uchar const *row_start, uchar const **row_end);
#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
};
@@ -118,7 +118,7 @@ private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*,
- char const *row_start, char const **row_end);
+ uchar const *row_start, uchar const **row_end);
#endif
};
diff --git a/sql/mf_iocache.cc b/sql/mf_iocache.cc
index f237f15dbc9..5d9d6d834b4 100644
--- a/sql/mf_iocache.cc
+++ b/sql/mf_iocache.cc
@@ -40,8 +40,8 @@ extern "C" {
** Returns 0 if record read
*/
-int _my_b_net_read(register IO_CACHE *info, byte *Buffer,
- uint Count __attribute__((unused)))
+int _my_b_net_read(register IO_CACHE *info, uchar *Buffer,
+ size_t Count __attribute__((unused)))
{
ulong read_length;
NET *net= &(current_thd)->net;
@@ -61,7 +61,7 @@ int _my_b_net_read(register IO_CACHE *info, byte *Buffer,
DBUG_RETURN(1);
}
/* to set up stuff for my_b_get (no _) */
- info->read_end = (info->read_pos = (byte*) net->read_pos) + read_length;
+ info->read_end = (info->read_pos = (uchar*) net->read_pos) + read_length;
Buffer[0] = info->read_pos[0]; /* length is always 1 */
/*
diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc
index 7b2d271639f..66c8d87e2e0 100644
--- a/sql/my_decimal.cc
+++ b/sql/my_decimal.cc
@@ -118,7 +118,7 @@ int my_decimal2string(uint mask, const my_decimal *d,
E_DEC_OVERFLOW
*/
-int my_decimal2binary(uint mask, const my_decimal *d, char *bin, int prec,
+int my_decimal2binary(uint mask, const my_decimal *d, uchar *bin, int prec,
int scale)
{
int err1= E_DEC_OK, err2;
@@ -233,7 +233,7 @@ print_decimal(const my_decimal *dec)
/* print decimal with its binary representation */
void
-print_decimal_buff(const my_decimal *dec, const byte* ptr, int length)
+print_decimal_buff(const my_decimal *dec, const uchar* ptr, int length)
{
print_decimal(dec);
fprintf(DBUG_FILE, "Record: ");
diff --git a/sql/my_decimal.h b/sql/my_decimal.h
index eade029677f..284f6642b74 100644
--- a/sql/my_decimal.h
+++ b/sql/my_decimal.h
@@ -110,7 +110,7 @@ public:
#ifndef DBUG_OFF
void print_decimal(const my_decimal *dec);
-void print_decimal_buff(const my_decimal *dec, const byte* ptr, int length);
+void print_decimal_buff(const my_decimal *dec, const uchar* ptr, int length);
const char *dbug_decimal_as_string(char *buff, const my_decimal *val);
#else
#define dbug_decimal_as_string(A) NULL
@@ -200,16 +200,15 @@ void my_decimal2decimal(const my_decimal *from, my_decimal *to)
}
-int my_decimal2binary(uint mask, const my_decimal *d, char *bin, int prec,
+int my_decimal2binary(uint mask, const my_decimal *d, uchar *bin, int prec,
int scale);
inline
-int binary2my_decimal(uint mask, const char *bin, my_decimal *d, int prec,
+int binary2my_decimal(uint mask, const uchar *bin, my_decimal *d, int prec,
int scale)
{
- return check_result(mask, bin2decimal((char *)bin, (decimal_t*) d, prec,
- scale));
+ return check_result(mask, bin2decimal(bin, (decimal_t*) d, prec, scale));
}
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index ffe180fd474..a47da122bcc 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -72,16 +72,16 @@ extern const char *primary_key_name;
#include "unireg.h"
void init_sql_alloc(MEM_ROOT *root, uint block_size, uint pre_alloc_size);
-gptr sql_alloc(unsigned size);
-gptr sql_calloc(unsigned size);
+void *sql_alloc(size_t);
+void *sql_calloc(size_t);
char *sql_strdup(const char *str);
-char *sql_strmake(const char *str,uint len);
-gptr sql_memdup(const void * ptr,unsigned size);
+char *sql_strmake(const char *str, size_t len);
+void *sql_memdup(const void * ptr, size_t size);
void sql_element_free(void *ptr);
-char *sql_strmake_with_convert(const char *str, uint32 arg_length,
+char *sql_strmake_with_convert(const char *str, size_t arg_length,
CHARSET_INFO *from_cs,
- uint32 max_res_length,
- CHARSET_INFO *to_cs, uint32 *result_length);
+ size_t max_res_length,
+ CHARSET_INFO *to_cs, size_t *result_length);
uint kill_one_thread(THD *thd, ulong id, bool only_kill_query);
void sql_kill(THD *thd, ulong id, bool only_kill_query);
bool net_request_file(NET* net, const char* fname);
@@ -90,15 +90,15 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
void net_set_write_timeout(NET *net, uint timeout);
void net_set_read_timeout(NET *net, uint timeout);
-#define x_free(A) { my_free((gptr) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); }
-#define safeFree(x) { if(x) { my_free((gptr) x,MYF(0)); x = NULL; } }
+#define x_free(A) { my_free((uchar*) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); }
+#define safeFree(x) { if(x) { my_free((uchar*) x,MYF(0)); x = NULL; } }
#define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1))
#define all_bits_set(A,B) ((A) & (B) != (B))
#define WARN_DEPRECATED(Thd,Ver,Old,New) \
do { \
DBUG_ASSERT(strncmp(Ver, MYSQL_SERVER_VERSION, sizeof(Ver)-1) > 0); \
- if (((gptr)Thd) != NULL) \
+ if (((uchar*)Thd) != NULL) \
push_warning_printf(((THD *)Thd), MYSQL_ERROR::WARN_LEVEL_WARN, \
ER_WARN_DEPRECATED_SYNTAX, ER(ER_WARN_DEPRECATED_SYNTAX), \
(Old), (Ver), (New)); \
@@ -384,7 +384,7 @@ MY_LOCALE *my_locale_by_number(uint number);
#define MODE_NO_KEY_OPTIONS 8192
#define MODE_NO_TABLE_OPTIONS 16384
#define MODE_NO_FIELD_OPTIONS 32768
-#define MODE_MYSQL323 65536
+#define MODE_MYSQL323 65536L
#define MODE_MYSQL40 (MODE_MYSQL323*2)
#define MODE_ANSI (MODE_MYSQL40*2)
#define MODE_NO_AUTO_VALUE_ON_ZERO (MODE_ANSI*2)
@@ -399,7 +399,7 @@ MY_LOCALE *my_locale_by_number(uint number);
#define MODE_NO_AUTO_CREATE_USER (MODE_TRADITIONAL*2)
#define MODE_HIGH_NOT_PRECEDENCE (MODE_NO_AUTO_CREATE_USER*2)
#define MODE_NO_ENGINE_SUBSTITUTION (MODE_HIGH_NOT_PRECEDENCE*2)
-#define MODE_PAD_CHAR_TO_FULL_LENGTH (MODE_NO_ENGINE_SUBSTITUTION*2)
+#define MODE_PAD_CHAR_TO_FULL_LENGTH (ULL(1) << 31)
/*
Replication uses 8 bytes to store SQL_MODE in the binary log. The day you
@@ -500,8 +500,8 @@ class THD;
typedef struct st_sql_list {
uint elements;
- byte *first;
- byte **next;
+ uchar *first;
+ uchar **next;
st_sql_list() {} /* Remove gcc warning */
inline void empty()
@@ -510,7 +510,7 @@ typedef struct st_sql_list {
first=0;
next= &first;
}
- inline void link_in_list(byte *element,byte **next_ptr)
+ inline void link_in_list(uchar *element,uchar **next_ptr)
{
elements++;
(*next)=element;
@@ -892,9 +892,9 @@ my_bool is_partition_management(LEX *lex);
All methods presume that there is at least one field to change.
*/
-void set_field_ptr(Field **ptr, const byte *new_buf, const byte *old_buf);
-void set_key_field_ptr(KEY *key_info, const byte *new_buf,
- const byte *old_buf);
+void set_field_ptr(Field **ptr, const uchar *new_buf, const uchar *old_buf);
+void set_key_field_ptr(KEY *key_info, const uchar *new_buf,
+ const uchar *old_buf);
bool mysql_backup_table(THD* thd, TABLE_LIST* table_list);
bool mysql_restore_table(THD* thd, TABLE_LIST* table_list);
@@ -1347,11 +1347,11 @@ typedef struct st_lock_param_type
KEY *key_info_buffer;
const char *db;
const char *table_name;
- const void *pack_frm_data;
+ uchar *pack_frm_data;
enum thr_lock_type old_lock_type;
uint key_count;
uint db_options;
- uint pack_frm_len;
+ size_t pack_frm_len;
partition_info *part_info;
} ALTER_PARTITION_PARAM_TYPE;
@@ -1514,16 +1514,16 @@ void print_plan(JOIN* join,uint idx, double record_count, double read_time,
#endif
void mysql_print_status();
/* key.cc */
-int find_ref_key(KEY *key, uint key_count, byte *record, Field *field,
+int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field,
uint *key_length, uint *keypart);
-void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length);
-void key_restore(byte *to_record, byte *from_key, KEY *key_info,
+void key_copy(uchar *to_key, uchar *from_record, KEY *key_info, uint key_length);
+void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
uint key_length);
-bool key_cmp_if_same(TABLE *form,const byte *key,uint index,uint key_length);
+bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length);
void key_unpack(String *to,TABLE *form,uint index);
bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields);
-int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length);
-int key_rec_cmp(void *key_info, byte *a, byte *b);
+int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length);
+int key_rec_cmp(void *key_info, uchar *a, uchar *b);
bool init_errmessage(void);
#endif /* MYSQL_SERVER */
@@ -1548,7 +1548,7 @@ bool slow_log_print(THD *thd, const char *query, uint query_length,
bool general_log_print(THD *thd, enum enum_server_command command,
const char *format,...);
-bool fn_format_relative_to_data_home(my_string to, const char *name,
+bool fn_format_relative_to_data_home(char * to, const char *name,
const char *dir, const char *extension);
#ifdef MYSQL_SERVER
File open_binlog(IO_CACHE *log, const char *log_file_name,
@@ -1819,8 +1819,8 @@ int rea_create_table(THD *thd, const char *path,
List<create_field> &create_field,
uint key_count,KEY *key_info,
handler *file);
-int format_number(uint inputflag,uint max_length,my_string pos,uint length,
- my_string *errpos);
+int format_number(uint inputflag,uint max_length,char * pos,uint length,
+ char * *errpos);
/* table.cc */
TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
@@ -1833,10 +1833,10 @@ void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg);
int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
uint db_stat, uint prgflag, uint ha_open_flags,
TABLE *outparam, bool is_create_table);
-int readfrm(const char *name, const void** data, uint* length);
-int writefrm(const char* name, const void* data, uint len);
+int readfrm(const char *name, uchar **data, size_t *length);
+int writefrm(const char* name, const uchar* data, size_t len);
int closefrm(TABLE *table, bool free_share);
-int read_string(File file, gptr *to, uint length);
+int read_string(File file, uchar* *to, size_t length);
void free_blobs(TABLE *table);
int set_zone(int nr,int min_zone,int max_zone);
ulong convert_period_to_month(ulong period);
@@ -1879,7 +1879,7 @@ void make_time(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
int my_time_compare(MYSQL_TIME *a, MYSQL_TIME *b);
int test_if_number(char *str,int *res,bool allow_wildcards);
-void change_byte(byte *,uint,char,char);
+void change_byte(uchar *,uint,char,char);
void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form,
SQL_SELECT *select,
int use_record_cache, bool print_errors);
@@ -1891,7 +1891,7 @@ ha_rows filesort(THD *thd, TABLE *form,struct st_sort_field *sortorder,
ha_rows max_rows, bool sort_positions,
ha_rows *examined_rows);
void filesort_free_buffers(TABLE *table, bool full);
-void change_double_for_sort(double nr,byte *to);
+void change_double_for_sort(double nr,uchar *to);
double my_double_round(double value, longlong dec, bool dec_unsigned,
bool truncate);
int get_quick_record(SQL_SELECT *select);
@@ -1899,7 +1899,7 @@ int get_quick_record(SQL_SELECT *select);
int calc_weekday(long daynr,bool sunday_first_day_of_week);
uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year);
void find_date(char *pos,uint *vek,uint flag);
-TYPELIB *convert_strings_to_array_type(my_string *typelibs, my_string *end);
+TYPELIB *convert_strings_to_array_type(char * *typelibs, char * *end);
TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings);
ulong get_form_pos(File file, uchar *head, TYPELIB *save_names);
ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames,
@@ -1934,7 +1934,7 @@ uint build_table_filename(char *buff, size_t bufflen, const char *db,
/* from hostname.cc */
struct in_addr;
-my_string ip_to_hostname(struct in_addr *in,uint *errors);
+char * ip_to_hostname(struct in_addr *in,uint *errors);
void inc_host_errors(struct in_addr *in);
void reset_host_errors(struct in_addr *in);
bool hostname_cache_init();
@@ -2098,7 +2098,7 @@ inline bool is_user_table(TABLE * table)
#ifndef EMBEDDED_LIBRARY
extern "C" void unireg_abort(int exit_code) __attribute__((noreturn));
void kill_delayed_threads(void);
-bool check_stack_overrun(THD *thd, long margin, char *dummy);
+bool check_stack_overrun(THD *thd, long margin, uchar *dummy);
#else
#define unireg_abort(exit_code) DBUG_RETURN(exit_code)
inline void kill_delayed_threads(void) {}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 796dc72a98d..7a4601c34fd 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1232,7 +1232,7 @@ void clean_up(bool print_message)
if (tc_log)
tc_log->close();
xid_cache_free();
- delete_elements(&key_caches, (void (*)(const char*, gptr)) free_key_cache);
+ delete_elements(&key_caches, (void (*)(const char*, uchar*)) free_key_cache);
multi_keycache_free();
free_status_vars();
end_thr_alarm(1); /* Free allocated memory */
@@ -1279,7 +1279,7 @@ void clean_up(bool print_message)
#endif
thread_scheduler.end();
finish_client_errs();
- my_free((gptr) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST),
+ my_free((uchar*) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST),
MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
DBUG_PRINT("quit", ("Error messages freed"));
/* Tell main we are ready */
@@ -2239,7 +2239,7 @@ the thread stack. Please read http://www.mysql.com/doc/en/Linux.html\n\n",
if (!(test_flags & TEST_NO_STACKTRACE))
{
fprintf(stderr,"thd: 0x%lx\n",(long) thd);
- print_stacktrace(thd ? (gptr) thd->thread_stack : (gptr) 0,
+ print_stacktrace(thd ? (uchar*) thd->thread_stack : (uchar*) 0,
thread_stack);
}
if (thd)
@@ -2627,7 +2627,7 @@ static void *my_str_malloc_mysqld(size_t size)
static void my_str_free_mysqld(void *ptr)
{
- my_free((gptr)ptr, MYF(MY_FAE));
+ my_free((uchar*)ptr, MYF(MY_FAE));
}
#endif /* EMBEDDED_LIBRARY */
@@ -5067,12 +5067,12 @@ enum options_mysqld
struct my_option my_long_options[] =
{
{"help", '?', "Display this help and exit.",
- (gptr*) &opt_help, (gptr*) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &opt_help, (uchar**) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
#ifdef HAVE_REPLICATION
{"abort-slave-event-count", OPT_ABORT_SLAVE_EVENT_COUNT,
"Option used by mysql-test for debugging and testing of replication.",
- (gptr*) &abort_slave_event_count, (gptr*) &abort_slave_event_count,
+ (uchar**) &abort_slave_event_count, (uchar**) &abort_slave_event_count,
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif /* HAVE_REPLICATION */
{"allow-suspicious-udfs", OPT_ALLOW_SUSPICIOUS_UDFS,
@@ -5080,33 +5080,33 @@ struct my_option my_long_options[] =
"without corresponding xxx_init() or xxx_deinit(). That also means "
"that one can load any function from any library, for example exit() "
"from libc.so",
- (gptr*) &opt_allow_suspicious_udfs, (gptr*) &opt_allow_suspicious_udfs,
+ (uchar**) &opt_allow_suspicious_udfs, (uchar**) &opt_allow_suspicious_udfs,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax. This mode will also set transaction isolation level 'serializable'.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-increment-increment", OPT_AUTO_INCREMENT,
"Auto-increment columns are incremented by this",
- (gptr*) &global_system_variables.auto_increment_increment,
- (gptr*) &max_system_variables.auto_increment_increment, 0, GET_ULONG,
+ (uchar**) &global_system_variables.auto_increment_increment,
+ (uchar**) &max_system_variables.auto_increment_increment, 0, GET_ULONG,
OPT_ARG, 1, 1, 65535, 0, 1, 0 },
{"auto-increment-offset", OPT_AUTO_INCREMENT_OFFSET,
"Offset added to Auto-increment columns. Used when auto-increment-increment != 1",
- (gptr*) &global_system_variables.auto_increment_offset,
- (gptr*) &max_system_variables.auto_increment_offset, 0, GET_ULONG, OPT_ARG,
+ (uchar**) &global_system_variables.auto_increment_offset,
+ (uchar**) &max_system_variables.auto_increment_offset, 0, GET_ULONG, OPT_ARG,
1, 1, 65535, 0, 1, 0 },
{"automatic-sp-privileges", OPT_SP_AUTOMATIC_PRIVILEGES,
"Creating and dropping stored procedures alters ACLs. Disable with --skip-automatic-sp-privileges.",
- (gptr*) &sp_automatic_privileges, (gptr*) &sp_automatic_privileges,
+ (uchar**) &sp_automatic_privileges, (uchar**) &sp_automatic_privileges,
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"basedir", 'b',
"Path to installation directory. All paths are usually resolved relative to this.",
- (gptr*) &mysql_home_ptr, (gptr*) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG,
+ (uchar**) &mysql_home_ptr, (uchar**) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"big-tables", OPT_BIG_TABLES,
"Allow big result sets by saving all temporary sets on file (Solves most 'table full' errors).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.",
- (gptr*) &my_bind_addr_str, (gptr*) &my_bind_addr_str, 0, GET_STR,
+ (uchar**) &my_bind_addr_str, (uchar**) &my_bind_addr_str, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"binlog_format", OPT_BINLOG_FORMAT,
"Does not have any effect without '--log-bin'. "
@@ -5120,7 +5120,7 @@ struct my_option my_long_options[] =
"If ndbcluster is enabled and binlog_format is `mixed', the format switches"
" to 'row' and back implicitly per each query accessing a NDB table."
#endif
- ,(gptr*) &opt_binlog_format, (gptr*) &opt_binlog_format,
+ ,(uchar**) &opt_binlog_format, (uchar**) &opt_binlog_format,
0, GET_STR, REQUIRED_ARG, BINLOG_FORMAT_MIXED, BINLOG_FORMAT_STMT,
BINLOG_FORMAT_MIXED, 0, 0, 0},
{"binlog-do-db", OPT_BINLOG_DO_DB,
@@ -5133,8 +5133,8 @@ struct my_option my_long_options[] =
"The maximum size of a row-based binary log event in bytes. Rows will be "
"grouped into events smaller than this size if possible. "
"The value has to be a multiple of 256.",
- (gptr*) &opt_binlog_rows_event_max_size,
- (gptr*) &opt_binlog_rows_event_max_size, 0,
+ (uchar**) &opt_binlog_rows_event_max_size,
+ (uchar**) &opt_binlog_rows_event_max_size, 0,
GET_ULONG, REQUIRED_ARG,
/* def_value */ 1024, /* min_value */ 256, /* max_value */ ULONG_MAX,
/* sub_size */ 0, /* block_size */ 256,
@@ -5146,61 +5146,61 @@ struct my_option my_long_options[] =
#endif
{"character-set-client-handshake", OPT_CHARACTER_SET_CLIENT_HANDSHAKE,
"Don't ignore client side character set value sent during handshake.",
- (gptr*) &opt_character_set_client_handshake,
- (gptr*) &opt_character_set_client_handshake,
+ (uchar**) &opt_character_set_client_handshake,
+ (uchar**) &opt_character_set_client_handshake,
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"character-set-filesystem", OPT_CHARACTER_SET_FILESYSTEM,
"Set the filesystem character set.",
- (gptr*) &character_set_filesystem_name,
- (gptr*) &character_set_filesystem_name,
+ (uchar**) &character_set_filesystem_name,
+ (uchar**) &character_set_filesystem_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"character-set-server", 'C', "Set the default character set.",
- (gptr*) &default_character_set_name, (gptr*) &default_character_set_name,
+ (uchar**) &default_character_set_name, (uchar**) &default_character_set_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory where character sets are.", (gptr*) &charsets_dir,
- (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory where character sets are.", (uchar**) &charsets_dir,
+ (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"chroot", 'r', "Chroot mysqld daemon during startup.",
- (gptr*) &mysqld_chroot, (gptr*) &mysqld_chroot, 0, GET_STR, REQUIRED_ARG,
+ (uchar**) &mysqld_chroot, (uchar**) &mysqld_chroot, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"collation-server", OPT_DEFAULT_COLLATION, "Set the default collation.",
- (gptr*) &default_collation_name, (gptr*) &default_collation_name,
+ (uchar**) &default_collation_name, (uchar**) &default_collation_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"completion-type", OPT_COMPLETION_TYPE, "Default completion type.",
- (gptr*) &global_system_variables.completion_type,
- (gptr*) &max_system_variables.completion_type, 0, GET_ULONG,
+ (uchar**) &global_system_variables.completion_type,
+ (uchar**) &max_system_variables.completion_type, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 2, 0, 1, 0},
{"concurrent-insert", OPT_CONCURRENT_INSERT,
"Use concurrent insert with MyISAM. Disable with --concurrent-insert=0",
- (gptr*) &myisam_concurrent_insert, (gptr*) &myisam_concurrent_insert,
+ (uchar**) &myisam_concurrent_insert, (uchar**) &myisam_concurrent_insert,
0, GET_LONG, OPT_ARG, 1, 0, 2, 0, 0, 0},
{"console", OPT_CONSOLE, "Write error output on screen; Don't remove the console window on windows.",
- (gptr*) &opt_console, (gptr*) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_console, (uchar**) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"core-file", OPT_WANT_CORE, "Write core on errors.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"datadir", 'h', "Path to the database root.", (gptr*) &mysql_data_home,
- (gptr*) &mysql_data_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"datadir", 'h', "Path to the database root.", (uchar**) &mysql_data_home,
+ (uchar**) &mysql_data_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DBUG_OFF
- {"debug", '#', "Debug log.", (gptr*) &default_dbug_option,
- (gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Debug log.", (uchar**) &default_dbug_option,
+ (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"default-character-set", 'C', "Set the default character set (deprecated option, use --character-set-server instead).",
- (gptr*) &default_character_set_name, (gptr*) &default_character_set_name,
+ (uchar**) &default_character_set_name, (uchar**) &default_character_set_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"default-collation", OPT_DEFAULT_COLLATION, "Set the default collation (deprecated option, use --collation-server instead).",
- (gptr*) &default_collation_name, (gptr*) &default_collation_name,
+ (uchar**) &default_collation_name, (uchar**) &default_collation_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"default-storage-engine", OPT_STORAGE_ENGINE,
"Set the default storage engine (table type) for tables.",
- (gptr*)&default_storage_engine_str, (gptr*)&default_storage_engine_str,
+ (uchar**)&default_storage_engine_str, (uchar**)&default_storage_engine_str,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-table-type", OPT_STORAGE_ENGINE,
"(deprecated) Use --default-storage-engine.",
- (gptr*)&default_storage_engine_str, (gptr*)&default_storage_engine_str,
+ (uchar**)&default_storage_engine_str, (uchar**)&default_storage_engine_str,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-time-zone", OPT_DEFAULT_TIME_ZONE, "Set the default time zone.",
- (gptr*) &default_tz_name, (gptr*) &default_tz_name,
+ (uchar**) &default_tz_name, (uchar**) &default_tz_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE.",
0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -5210,33 +5210,33 @@ struct my_option my_long_options[] =
#ifdef HAVE_OPENSSL
{"des-key-file", OPT_DES_KEY_FILE,
"Load keys for des_encrypt() and des_encrypt from given file.",
- (gptr*) &des_key_file, (gptr*) &des_key_file, 0, GET_STR, REQUIRED_ARG,
+ (uchar**) &des_key_file, (uchar**) &des_key_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#endif /* HAVE_OPENSSL */
#ifdef HAVE_REPLICATION
{"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
"Option used by mysql-test for debugging and testing of replication.",
- (gptr*) &disconnect_slave_event_count,
- (gptr*) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
+ (uchar**) &disconnect_slave_event_count,
+ (uchar**) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
#endif /* HAVE_REPLICATION */
{"enable-locking", OPT_ENABLE_LOCK,
"Deprecated option, use --external-locking instead.",
- (gptr*) &opt_external_locking, (gptr*) &opt_external_locking,
+ (uchar**) &opt_external_locking, (uchar**) &opt_external_locking,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NT__
{"enable-named-pipe", OPT_HAVE_NAMED_PIPE, "Enable the named pipe (NT).",
- (gptr*) &opt_enable_named_pipe, (gptr*) &opt_enable_named_pipe, 0, GET_BOOL,
+ (uchar**) &opt_enable_named_pipe, (uchar**) &opt_enable_named_pipe, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"enable-pstack", OPT_DO_PSTACK, "Print a symbolic stack trace on failure.",
- (gptr*) &opt_do_pstack, (gptr*) &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0,
+ (uchar**) &opt_do_pstack, (uchar**) &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"engine-condition-pushdown",
OPT_ENGINE_CONDITION_PUSHDOWN,
"Push supported query conditions to the storage engine.",
- (gptr*) &global_system_variables.engine_condition_pushdown,
- (gptr*) &global_system_variables.engine_condition_pushdown,
+ (uchar**) &global_system_variables.engine_condition_pushdown,
+ (uchar**) &global_system_variables.engine_condition_pushdown,
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
/* See how it's handled in get_one_option() */
{"event-scheduler", OPT_EVENT_SCHEDULER, "Enable/disable the event scheduler.",
@@ -5244,7 +5244,7 @@ struct my_option my_long_options[] =
{"exit-info", 'T', "Used for debugging; Use at your own risk!", 0, 0, 0,
GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"external-locking", OPT_USE_LOCKING, "Use system (external) locking (disabled by default). With this option enabled you can run myisamchk to test (not repair) tables while the MySQL server is running. Disable with --skip-external-locking.",
- (gptr*) &opt_external_locking, (gptr*) &opt_external_locking,
+ (uchar**) &opt_external_locking, (uchar**) &opt_external_locking,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"flush", OPT_FLUSH, "Flush tables to disk between SQL commands.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -5252,50 +5252,50 @@ struct my_option my_long_options[] =
easier to do */
{"gdb", OPT_DEBUGGING,
"Set up signals usable for debugging",
- (gptr*) &opt_debugging, (gptr*) &opt_debugging,
+ (uchar**) &opt_debugging, (uchar**) &opt_debugging,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"general-log", OPT_GENERAL_LOG,
- "Enable|disable general log", (gptr*) &opt_log,
- (gptr*) &opt_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ "Enable|disable general log", (uchar**) &opt_log,
+ (uchar**) &opt_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_LARGE_PAGES
{"large-pages", OPT_ENABLE_LARGE_PAGES, "Enable support for large pages. \
Disable with --skip-large-pages.",
- (gptr*) &opt_large_pages, (gptr*) &opt_large_pages, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (uchar**) &opt_large_pages, (uchar**) &opt_large_pages, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
#endif
{"init-connect", OPT_INIT_CONNECT, "Command(s) that are executed for each new connection",
- (gptr*) &opt_init_connect, (gptr*) &opt_init_connect, 0, GET_STR_ALLOC,
+ (uchar**) &opt_init_connect, (uchar**) &opt_init_connect, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DISABLE_GRANT_OPTIONS
{"init-file", OPT_INIT_FILE, "Read SQL commands from this file at startup.",
- (gptr*) &opt_init_file, (gptr*) &opt_init_file, 0, GET_STR, REQUIRED_ARG,
+ (uchar**) &opt_init_file, (uchar**) &opt_init_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"init-rpl-role", OPT_INIT_RPL_ROLE, "Set the replication role.", 0, 0, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"init-slave", OPT_INIT_SLAVE, "Command(s) that are executed when a slave connects to this master",
- (gptr*) &opt_init_slave, (gptr*) &opt_init_slave, 0, GET_STR_ALLOC,
+ (uchar**) &opt_init_slave, (uchar**) &opt_init_slave, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"innodb", OPT_INNODB, "Enable InnoDB (if this version of MySQL supports it). \
Disable with --skip-innodb (will save memory).",
- (gptr*) &opt_innodb, (gptr*) &opt_innodb, 0, GET_BOOL, NO_ARG, OPT_INNODB_DEFAULT, 0, 0,
+ (uchar**) &opt_innodb, (uchar**) &opt_innodb, 0, GET_BOOL, NO_ARG, OPT_INNODB_DEFAULT, 0, 0,
0, 0, 0},
#ifdef WITH_INNOBASE_STORAGE_ENGINE
{"innodb_checksums", OPT_INNODB_CHECKSUMS, "Enable InnoDB checksums validation (enabled by default). \
-Disable with --skip-innodb-checksums.", (gptr*) &innobase_use_checksums,
- (gptr*) &innobase_use_checksums, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+Disable with --skip-innodb-checksums.", (uchar**) &innobase_use_checksums,
+ (uchar**) &innobase_use_checksums, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
#endif
{"innodb_data_file_path", OPT_INNODB_DATA_FILE_PATH,
"Path to individual files and their sizes.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef WITH_INNOBASE_STORAGE_ENGINE
{"innodb_data_home_dir", OPT_INNODB_DATA_HOME_DIR,
- "The common part for InnoDB table spaces.", (gptr*) &innobase_data_home_dir,
- (gptr*) &innobase_data_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0,
+ "The common part for InnoDB table spaces.", (uchar**) &innobase_data_home_dir,
+ (uchar**) &innobase_data_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
{"innodb_doublewrite", OPT_INNODB_DOUBLEWRITE, "Enable InnoDB doublewrite buffer (enabled by default). \
-Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
- (gptr*) &innobase_use_doublewrite, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+Disable with --skip-innodb-doublewrite.", (uchar**) &innobase_use_doublewrite,
+ (uchar**) &innobase_use_doublewrite, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"innodb_fast_shutdown", OPT_INNODB_FAST_SHUTDOWN,
"Speeds up the shutdown process of the InnoDB storage engine. Possible "
"values are 0, 1 (faster)"
@@ -5307,92 +5307,92 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
" or 2 (fastest - crash-like)"
#endif
".",
- (gptr*) &innobase_fast_shutdown,
- (gptr*) &innobase_fast_shutdown, 0, GET_ULONG, OPT_ARG, 1, 0,
+ (uchar**) &innobase_fast_shutdown,
+ (uchar**) &innobase_fast_shutdown, 0, GET_ULONG, OPT_ARG, 1, 0,
IF_NETWARE(1,2), 0, 0, 0},
{"innodb_file_per_table", OPT_INNODB_FILE_PER_TABLE,
"Stores each InnoDB table to an .ibd file in the database dir.",
- (gptr*) &innobase_file_per_table,
- (gptr*) &innobase_file_per_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &innobase_file_per_table,
+ (uchar**) &innobase_file_per_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"innodb_flush_log_at_trx_commit", OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT,
"Set to 0 (write and flush once per second), 1 (write and flush at each commit) or 2 (write at commit, flush once per second).",
- (gptr*) &srv_flush_log_at_trx_commit,
- (gptr*) &srv_flush_log_at_trx_commit,
+ (uchar**) &srv_flush_log_at_trx_commit,
+ (uchar**) &srv_flush_log_at_trx_commit,
0, GET_ULONG, OPT_ARG, 1, 0, 2, 0, 0, 0},
{"innodb_flush_method", OPT_INNODB_FLUSH_METHOD,
- "With which method to flush data.", (gptr*) &innobase_unix_file_flush_method,
- (gptr*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ "With which method to flush data.", (uchar**) &innobase_unix_file_flush_method,
+ (uchar**) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"innodb_locks_unsafe_for_binlog", OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG,
"Force InnoDB to not use next-key locking, to use only row-level locking.",
- (gptr*) &innobase_locks_unsafe_for_binlog,
- (gptr*) &innobase_locks_unsafe_for_binlog, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &innobase_locks_unsafe_for_binlog,
+ (uchar**) &innobase_locks_unsafe_for_binlog, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"innodb_log_arch_dir", OPT_INNODB_LOG_ARCH_DIR,
- "Where full logs should be archived.", (gptr*) &innobase_log_arch_dir,
- (gptr*) &innobase_log_arch_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Where full logs should be archived.", (uchar**) &innobase_log_arch_dir,
+ (uchar**) &innobase_log_arch_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"innodb_log_archive", OPT_INNODB_LOG_ARCHIVE,
"Set to 1 if you want to have logs archived.", 0, 0, 0, GET_LONG, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"innodb_log_group_home_dir", OPT_INNODB_LOG_GROUP_HOME_DIR,
- "Path to InnoDB log files.", (gptr*) &innobase_log_group_home_dir,
- (gptr*) &innobase_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
+ "Path to InnoDB log files.", (uchar**) &innobase_log_group_home_dir,
+ (uchar**) &innobase_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT,
- "Percentage of dirty pages allowed in bufferpool.", (gptr*) &srv_max_buf_pool_modified_pct,
- (gptr*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0},
+ "Percentage of dirty pages allowed in bufferpool.", (uchar**) &srv_max_buf_pool_modified_pct,
+ (uchar**) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0},
{"innodb_max_purge_lag", OPT_INNODB_MAX_PURGE_LAG,
"Desired maximum length of the purge queue (0 = no limit)",
- (gptr*) &srv_max_purge_lag,
- (gptr*) &srv_max_purge_lag, 0, GET_LONG, REQUIRED_ARG, 0, 0, ~0L,
+ (uchar**) &srv_max_purge_lag,
+ (uchar**) &srv_max_purge_lag, 0, GET_LONG, REQUIRED_ARG, 0, 0, ~0L,
0, 1L, 0},
{"innodb_rollback_on_timeout", OPT_INNODB_ROLLBACK_ON_TIMEOUT,
"Roll back the complete transaction on lock wait timeout, for 4.x compatibility (disabled by default)",
- (gptr*) &innobase_rollback_on_timeout, (gptr*) &innobase_rollback_on_timeout,
+ (uchar**) &innobase_rollback_on_timeout, (uchar**) &innobase_rollback_on_timeout,
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"innodb_status_file", OPT_INNODB_STATUS_FILE,
"Enable SHOW INNODB STATUS output in the innodb_status.<pid> file",
- (gptr*) &innobase_create_status_file, (gptr*) &innobase_create_status_file,
+ (uchar**) &innobase_create_status_file, (uchar**) &innobase_create_status_file,
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"innodb_stats_on_metadata", OPT_INNODB_STATS_ON_METADATA,
"Enable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)",
- (gptr*) &innobase_stats_on_metadata, (gptr*) &innobase_stats_on_metadata,
+ (uchar**) &innobase_stats_on_metadata, (uchar**) &innobase_stats_on_metadata,
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"innodb_support_xa", OPT_INNODB_SUPPORT_XA,
"Enable InnoDB support for the XA two-phase commit",
- (gptr*) &global_system_variables.innodb_support_xa,
- (gptr*) &global_system_variables.innodb_support_xa,
+ (uchar**) &global_system_variables.innodb_support_xa,
+ (uchar**) &global_system_variables.innodb_support_xa,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"innodb_table_locks", OPT_INNODB_TABLE_LOCKS,
"Enable InnoDB locking in LOCK TABLES",
- (gptr*) &global_system_variables.innodb_table_locks,
- (gptr*) &global_system_variables.innodb_table_locks,
+ (uchar**) &global_system_variables.innodb_table_locks,
+ (uchar**) &global_system_variables.innodb_table_locks,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
#endif /* End WITH_INNOBASE_STORAGE_ENGINE */
{"language", 'L',
"Client error messages in given language. May be given as a full path.",
- (gptr*) &language_ptr, (gptr*) &language_ptr, 0, GET_STR, REQUIRED_ARG,
+ (uchar**) &language_ptr, (uchar**) &language_ptr, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"lc-time-names", OPT_LC_TIME_NAMES,
"Set the language used for the month names and the days of the week.",
- (gptr*) &lc_time_names_name,
- (gptr*) &lc_time_names_name,
+ (uchar**) &lc_time_names_name,
+ (uchar**) &lc_time_names_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"local-infile", OPT_LOCAL_INFILE,
"Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0).",
- (gptr*) &opt_local_infile,
- (gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG,
+ (uchar**) &opt_local_infile,
+ (uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG,
1, 0, 0, 0, 0, 0},
- {"log", 'l', "Log connections and queries to file.", (gptr*) &opt_logname,
- (gptr*) &opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"log", 'l', "Log connections and queries to file.", (uchar**) &opt_logname,
+ (uchar**) &opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-bin", OPT_BIN_LOG,
"Log update queries in binary format. Optional (but strongly recommended "
"to avoid replication problems if server's hostname changes) argument "
"should be the chosen location for the binary log files.",
- (gptr*) &opt_bin_logname, (gptr*) &opt_bin_logname, 0, GET_STR_ALLOC,
+ (uchar**) &opt_bin_logname, (uchar**) &opt_bin_logname, 0, GET_STR_ALLOC,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-bin-index", OPT_BIN_LOG_INDEX,
"File that holds the names for last binary log files.",
- (gptr*) &opt_binlog_index_name, (gptr*) &opt_binlog_index_name, 0, GET_STR,
+ (uchar**) &opt_binlog_index_name, (uchar**) &opt_binlog_index_name, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifndef TO_BE_REMOVED_IN_5_1_OR_6_0
/*
@@ -5403,7 +5403,7 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
*/
{"log-bin-trust-routine-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS,
"(deprecated) Use log-bin-trust-function-creators.",
- (gptr*) &trust_function_creators, (gptr*) &trust_function_creators, 0,
+ (uchar**) &trust_function_creators, (uchar**) &trust_function_creators, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
/*
@@ -5417,13 +5417,13 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
"Note that if ALL connections to this server ALWAYS use row-based binary "
"logging, the security issues do not exist and the binary logging cannot "
"break, so you can safely set this to 1."
- ,(gptr*) &trust_function_creators, (gptr*) &trust_function_creators, 0,
+ ,(uchar**) &trust_function_creators, (uchar**) &trust_function_creators, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-error", OPT_ERROR_LOG_FILE, "Error log file.",
- (gptr*) &log_error_file_ptr, (gptr*) &log_error_file_ptr, 0, GET_STR,
+ (uchar**) &log_error_file_ptr, (uchar**) &log_error_file_ptr, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file.",
- (gptr*) &myisam_log_filename, (gptr*) &myisam_log_filename, 0, GET_STR,
+ (uchar**) &myisam_log_filename, (uchar**) &myisam_log_filename, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-long-format", '0',
"Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.",
@@ -5432,165 +5432,165 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
{"log-output", OPT_LOG_OUTPUT,
"Syntax: log-output[=value[,value...]], where \"value\" could be TABLE, "
"FILE or NONE.",
- (gptr*) &log_output_str, (gptr*) &log_output_str, 0,
+ (uchar**) &log_output_str, (uchar**) &log_output_str, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES,
"Log queries that are executed without benefit of any index to the slow log if it is open.",
- (gptr*) &opt_log_queries_not_using_indexes, (gptr*) &opt_log_queries_not_using_indexes,
+ (uchar**) &opt_log_queries_not_using_indexes, (uchar**) &opt_log_queries_not_using_indexes,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-short-format", OPT_SHORT_LOG_FORMAT,
"Don't log extra information to update and slow-query logs.",
- (gptr*) &opt_short_log_format, (gptr*) &opt_short_log_format,
+ (uchar**) &opt_short_log_format, (uchar**) &opt_short_log_format,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-slave-updates", OPT_LOG_SLAVE_UPDATES,
"Tells the slave to log the updates from the slave thread to the binary log. You will need to turn it on if you plan to daisy-chain the slaves.",
- (gptr*) &opt_log_slave_updates, (gptr*) &opt_log_slave_updates, 0, GET_BOOL,
+ (uchar**) &opt_log_slave_updates, (uchar**) &opt_log_slave_updates, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-slow-admin-statements", OPT_LOG_SLOW_ADMIN_STATEMENTS,
"Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log if it is open.",
- (gptr*) &opt_log_slow_admin_statements,
- (gptr*) &opt_log_slow_admin_statements,
+ (uchar**) &opt_log_slow_admin_statements,
+ (uchar**) &opt_log_slow_admin_statements,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-slow-queries", OPT_SLOW_QUERY_LOG,
"Log slow queries to this log file. Defaults logging to hostname-slow.log file. Must be enabled to activate other slow log options.",
- (gptr*) &opt_slow_logname, (gptr*) &opt_slow_logname, 0, GET_STR, OPT_ARG,
+ (uchar**) &opt_slow_logname, (uchar**) &opt_slow_logname, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"log-tc", OPT_LOG_TC,
"Path to transaction coordinator log (used for transactions that affect "
"more than one storage engine, when binary log is disabled)",
- (gptr*) &opt_tc_log_file, (gptr*) &opt_tc_log_file, 0, GET_STR,
+ (uchar**) &opt_tc_log_file, (uchar**) &opt_tc_log_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_MMAP
{"log-tc-size", OPT_LOG_TC_SIZE, "Size of transaction coordinator log.",
- (gptr*) &opt_tc_log_size, (gptr*) &opt_tc_log_size, 0, GET_ULONG,
+ (uchar**) &opt_tc_log_size, (uchar**) &opt_tc_log_size, 0, GET_ULONG,
REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, ~0L, 0, TC_LOG_PAGE_SIZE, 0},
#endif
{"log-update", OPT_UPDATE_LOG,
"The update log is deprecated since version 5.0, is replaced by the binary \
log and this option justs turns on --log-bin instead.",
- (gptr*) &opt_update_logname, (gptr*) &opt_update_logname, 0, GET_STR,
+ (uchar**) &opt_update_logname, (uchar**) &opt_update_logname, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-warnings", 'W', "Log some not critical warnings to the log file.",
- (gptr*) &global_system_variables.log_warnings,
- (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0,
+ (uchar**) &global_system_variables.log_warnings,
+ (uchar**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0,
0, 0, 0},
{"low-priority-updates", OPT_LOW_PRIORITY_UPDATES,
"INSERT/DELETE/UPDATE has lower priority than selects.",
- (gptr*) &global_system_variables.low_priority_updates,
- (gptr*) &max_system_variables.low_priority_updates,
+ (uchar**) &global_system_variables.low_priority_updates,
+ (uchar**) &max_system_variables.low_priority_updates,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"master-connect-retry", OPT_MASTER_CONNECT_RETRY,
"The number of seconds the slave thread will sleep before retrying to connect to the master in case the master goes down or the connection is lost.",
- (gptr*) &master_connect_retry, (gptr*) &master_connect_retry, 0, GET_UINT,
+ (uchar**) &master_connect_retry, (uchar**) &master_connect_retry, 0, GET_UINT,
REQUIRED_ARG, 60, 0, 0, 0, 0, 0},
{"master-host", OPT_MASTER_HOST,
"Master hostname or IP address for replication. If not set, the slave thread will not be started. Note that the setting of master-host will be ignored if there exists a valid master.info file.",
- (gptr*) &master_host, (gptr*) &master_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
+ (uchar**) &master_host, (uchar**) &master_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
0, 0, 0, 0},
{"master-info-file", OPT_MASTER_INFO_FILE,
"The location and name of the file that remembers the master and where the I/O replication \
thread is in the master's binlogs.",
- (gptr*) &master_info_file, (gptr*) &master_info_file, 0, GET_STR,
+ (uchar**) &master_info_file, (uchar**) &master_info_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"master-password", OPT_MASTER_PASSWORD,
"The password the slave thread will authenticate with when connecting to the master. If not set, an empty password is assumed.The value in master.info will take precedence if it can be read.",
- (gptr*)&master_password, (gptr*)&master_password, 0,
+ (uchar**)&master_password, (uchar**)&master_password, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"master-port", OPT_MASTER_PORT,
"The port the master is listening on. If not set, the compiled setting of MYSQL_PORT is assumed. If you have not tinkered with configure options, this should be 3306. The value in master.info will take precedence if it can be read.",
- (gptr*) &master_port, (gptr*) &master_port, 0, GET_UINT, REQUIRED_ARG,
+ (uchar**) &master_port, (uchar**) &master_port, 0, GET_UINT, REQUIRED_ARG,
MYSQL_PORT, 0, 0, 0, 0, 0},
{"master-retry-count", OPT_MASTER_RETRY_COUNT,
"The number of tries the slave will make to connect to the master before giving up.",
- (gptr*) &master_retry_count, (gptr*) &master_retry_count, 0, GET_ULONG,
+ (uchar**) &master_retry_count, (uchar**) &master_retry_count, 0, GET_ULONG,
REQUIRED_ARG, 3600*24, 0, 0, 0, 0, 0},
{"master-ssl", OPT_MASTER_SSL,
"Enable the slave to connect to the master using SSL.",
- (gptr*) &master_ssl, (gptr*) &master_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &master_ssl, (uchar**) &master_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"master-ssl-ca", OPT_MASTER_SSL_CA,
"Master SSL CA file. Only applies if you have enabled master-ssl.",
- (gptr*) &master_ssl_ca, (gptr*) &master_ssl_ca, 0, GET_STR, OPT_ARG,
+ (uchar**) &master_ssl_ca, (uchar**) &master_ssl_ca, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"master-ssl-capath", OPT_MASTER_SSL_CAPATH,
"Master SSL CA path. Only applies if you have enabled master-ssl.",
- (gptr*) &master_ssl_capath, (gptr*) &master_ssl_capath, 0, GET_STR, OPT_ARG,
+ (uchar**) &master_ssl_capath, (uchar**) &master_ssl_capath, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"master-ssl-cert", OPT_MASTER_SSL_CERT,
"Master SSL certificate file name. Only applies if you have enabled \
master-ssl",
- (gptr*) &master_ssl_cert, (gptr*) &master_ssl_cert, 0, GET_STR, OPT_ARG,
+ (uchar**) &master_ssl_cert, (uchar**) &master_ssl_cert, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"master-ssl-cipher", OPT_MASTER_SSL_CIPHER,
"Master SSL cipher. Only applies if you have enabled master-ssl.",
- (gptr*) &master_ssl_cipher, (gptr*) &master_ssl_capath, 0, GET_STR, OPT_ARG,
+ (uchar**) &master_ssl_cipher, (uchar**) &master_ssl_capath, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"master-ssl-key", OPT_MASTER_SSL_KEY,
"Master SSL keyfile name. Only applies if you have enabled master-ssl.",
- (gptr*) &master_ssl_key, (gptr*) &master_ssl_key, 0, GET_STR, OPT_ARG,
+ (uchar**) &master_ssl_key, (uchar**) &master_ssl_key, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"master-user", OPT_MASTER_USER,
"The username the slave thread will use for authentication when connecting to the master. The user must have FILE privilege. If the master user is not set, user test is assumed. The value in master.info will take precedence if it can be read.",
- (gptr*) &master_user, (gptr*) &master_user, 0, GET_STR, REQUIRED_ARG, 0, 0,
+ (uchar**) &master_user, (uchar**) &master_user, 0, GET_STR, REQUIRED_ARG, 0, 0,
0, 0, 0, 0},
#ifdef HAVE_REPLICATION
{"max-binlog-dump-events", OPT_MAX_BINLOG_DUMP_EVENTS,
"Option used by mysql-test for debugging and testing of replication.",
- (gptr*) &max_binlog_dump_events, (gptr*) &max_binlog_dump_events, 0,
+ (uchar**) &max_binlog_dump_events, (uchar**) &max_binlog_dump_events, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif /* HAVE_REPLICATION */
- {"memlock", OPT_MEMLOCK, "Lock mysqld in memory.", (gptr*) &locked_in_memory,
- (gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"memlock", OPT_MEMLOCK, "Lock mysqld in memory.", (uchar**) &locked_in_memory,
+ (uchar**) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"myisam-recover", OPT_MYISAM_RECOVER,
"Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.",
- (gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0,
+ (uchar**) &myisam_recover_options_str, (uchar**) &myisam_recover_options_str, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"ndbcluster", OPT_NDBCLUSTER, "Enable NDB Cluster (if this version of MySQL supports it). \
Disable with --skip-ndbcluster (will save memory).",
- (gptr*) &opt_ndbcluster, (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG,
+ (uchar**) &opt_ndbcluster, (uchar**) &opt_ndbcluster, 0, GET_BOOL, NO_ARG,
OPT_NDBCLUSTER_DEFAULT, 0, 0, 0, 0, 0},
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
{"ndb-connectstring", OPT_NDB_CONNECTSTRING,
"Connect string for ndbcluster.",
- (gptr*) &opt_ndb_connectstring,
- (gptr*) &opt_ndb_connectstring,
+ (uchar**) &opt_ndb_connectstring,
+ (uchar**) &opt_ndb_connectstring,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ndb-mgmd-host", OPT_NDB_MGMD,
"Set host and port for ndb_mgmd. Syntax: hostname[:port]",
- (gptr*) &opt_ndb_mgmd,
- (gptr*) &opt_ndb_mgmd,
+ (uchar**) &opt_ndb_mgmd,
+ (uchar**) &opt_ndb_mgmd,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ndb-nodeid", OPT_NDB_NODEID,
"Nodeid for this mysqlserver in the cluster.",
- (gptr*) &opt_ndb_nodeid,
- (gptr*) &opt_ndb_nodeid,
+ (uchar**) &opt_ndb_nodeid,
+ (uchar**) &opt_ndb_nodeid,
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ndb-autoincrement-prefetch-sz", OPT_NDB_AUTOINCREMENT_PREFETCH_SZ,
"Specify number of autoincrement values that are prefetched.",
- (gptr*) &global_system_variables.ndb_autoincrement_prefetch_sz,
- (gptr*) &global_system_variables.ndb_autoincrement_prefetch_sz,
+ (uchar**) &global_system_variables.ndb_autoincrement_prefetch_sz,
+ (uchar**) &global_system_variables.ndb_autoincrement_prefetch_sz,
0, GET_ULONG, REQUIRED_ARG, 32, 1, 256, 0, 0, 0},
{"ndb-distribution", OPT_NDB_DISTRIBUTION,
"Default distribution for new tables in ndb",
- (gptr*) &opt_ndb_distribution,
- (gptr*) &opt_ndb_distribution,
+ (uchar**) &opt_ndb_distribution,
+ (uchar**) &opt_ndb_distribution,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ndb-force-send", OPT_NDB_FORCE_SEND,
"Force send of buffers to ndb immediately without waiting for "
"other threads.",
- (gptr*) &global_system_variables.ndb_force_send,
- (gptr*) &global_system_variables.ndb_force_send,
+ (uchar**) &global_system_variables.ndb_force_send,
+ (uchar**) &global_system_variables.ndb_force_send,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"ndb_force_send", OPT_NDB_FORCE_SEND,
"same as --ndb-force-send.",
- (gptr*) &global_system_variables.ndb_force_send,
- (gptr*) &global_system_variables.ndb_force_send,
+ (uchar**) &global_system_variables.ndb_force_send,
+ (uchar**) &global_system_variables.ndb_force_send,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"ndb-extra-logging", OPT_NDB_EXTRA_LOGGING,
"Turn on more logging in the error log.",
- (gptr*) &ndb_extra_logging,
- (gptr*) &ndb_extra_logging,
+ (uchar**) &ndb_extra_logging,
+ (uchar**) &ndb_extra_logging,
0, GET_INT, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_NDB_BINLOG
{"ndb-report-thresh-binlog-epoch-slip", OPT_NDB_REPORT_THRESH_BINLOG_EPOCH_SLIP,
@@ -5598,113 +5598,113 @@ Disable with --skip-ndbcluster (will save memory).",
"E.g. 3 means that if the difference between what epoch has been received "
"from the storage nodes and what has been applied to the binlog is 3 or more, "
"a status message will be sent to the cluster log.",
- (gptr*) &ndb_report_thresh_binlog_epoch_slip,
- (gptr*) &ndb_report_thresh_binlog_epoch_slip,
+ (uchar**) &ndb_report_thresh_binlog_epoch_slip,
+ (uchar**) &ndb_report_thresh_binlog_epoch_slip,
0, GET_ULONG, REQUIRED_ARG, 3, 0, 256, 0, 0, 0},
{"ndb-report-thresh-binlog-mem-usage", OPT_NDB_REPORT_THRESH_BINLOG_MEM_USAGE,
"Threshold on percentage of free memory before reporting binlog status. E.g. "
"10 means that if amount of available memory for receiving binlog data from "
"the storage nodes goes below 10%, "
"a status message will be sent to the cluster log.",
- (gptr*) &ndb_report_thresh_binlog_mem_usage,
- (gptr*) &ndb_report_thresh_binlog_mem_usage,
+ (uchar**) &ndb_report_thresh_binlog_mem_usage,
+ (uchar**) &ndb_report_thresh_binlog_mem_usage,
0, GET_ULONG, REQUIRED_ARG, 10, 0, 100, 0, 0, 0},
#endif
{"ndb-use-exact-count", OPT_NDB_USE_EXACT_COUNT,
"Use exact records count during query planning and for fast "
"select count(*), disable for faster queries.",
- (gptr*) &global_system_variables.ndb_use_exact_count,
- (gptr*) &global_system_variables.ndb_use_exact_count,
+ (uchar**) &global_system_variables.ndb_use_exact_count,
+ (uchar**) &global_system_variables.ndb_use_exact_count,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"ndb_use_exact_count", OPT_NDB_USE_EXACT_COUNT,
"same as --ndb-use-exact-count.",
- (gptr*) &global_system_variables.ndb_use_exact_count,
- (gptr*) &global_system_variables.ndb_use_exact_count,
+ (uchar**) &global_system_variables.ndb_use_exact_count,
+ (uchar**) &global_system_variables.ndb_use_exact_count,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"ndb-use-transactions", OPT_NDB_USE_TRANSACTIONS,
"Use transactions for large inserts, if enabled then large "
"inserts will be split into several smaller transactions",
- (gptr*) &global_system_variables.ndb_use_transactions,
- (gptr*) &global_system_variables.ndb_use_transactions,
+ (uchar**) &global_system_variables.ndb_use_transactions,
+ (uchar**) &global_system_variables.ndb_use_transactions,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"ndb_use_transactions", OPT_NDB_USE_TRANSACTIONS,
"same as --ndb-use-transactions.",
- (gptr*) &global_system_variables.ndb_use_transactions,
- (gptr*) &global_system_variables.ndb_use_transactions,
+ (uchar**) &global_system_variables.ndb_use_transactions,
+ (uchar**) &global_system_variables.ndb_use_transactions,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"ndb-shm", OPT_NDB_SHM,
"Use shared memory connections when available.",
- (gptr*) &opt_ndb_shm,
- (gptr*) &opt_ndb_shm,
+ (uchar**) &opt_ndb_shm,
+ (uchar**) &opt_ndb_shm,
0, GET_BOOL, OPT_ARG, OPT_NDB_SHM_DEFAULT, 0, 0, 0, 0, 0},
{"ndb-optimized-node-selection", OPT_NDB_OPTIMIZED_NODE_SELECTION,
"Select nodes for transactions in a more optimal way.",
- (gptr*) &opt_ndb_optimized_node_selection,
- (gptr*) &opt_ndb_optimized_node_selection,
+ (uchar**) &opt_ndb_optimized_node_selection,
+ (uchar**) &opt_ndb_optimized_node_selection,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{ "ndb-cache-check-time", OPT_NDB_CACHE_CHECK_TIME,
"A dedicated thread is created to, at the given millisecons interval, invalidate the query cache if another MySQL server in the cluster has changed the data in the database.",
- (gptr*) &opt_ndb_cache_check_time, (gptr*) &opt_ndb_cache_check_time, 0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &opt_ndb_cache_check_time, (uchar**) &opt_ndb_cache_check_time, 0, GET_ULONG, REQUIRED_ARG,
0, 0, LONG_TIMEOUT, 0, 1, 0},
{"ndb-index-stat-enable", OPT_NDB_INDEX_STAT_ENABLE,
"Use ndb index statistics in query optimization.",
- (gptr*) &global_system_variables.ndb_index_stat_enable,
- (gptr*) &max_system_variables.ndb_index_stat_enable,
+ (uchar**) &global_system_variables.ndb_index_stat_enable,
+ (uchar**) &max_system_variables.ndb_index_stat_enable,
0, GET_BOOL, OPT_ARG, 0, 0, 1, 0, 0, 0},
#endif
{"ndb-use-copying-alter-table",
OPT_NDB_USE_COPYING_ALTER_TABLE,
"Force ndbcluster to always copy tables at alter table (should only be used if on-line alter table fails).",
- (gptr*) &global_system_variables.ndb_use_copying_alter_table,
- (gptr*) &global_system_variables.ndb_use_copying_alter_table,
+ (uchar**) &global_system_variables.ndb_use_copying_alter_table,
+ (uchar**) &global_system_variables.ndb_use_copying_alter_table,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"new", 'n', "Use very new possible 'unsafe' functions.",
- (gptr*) &global_system_variables.new_mode,
- (gptr*) &max_system_variables.new_mode,
+ (uchar**) &global_system_variables.new_mode,
+ (uchar**) &max_system_variables.new_mode,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef NOT_YET
{"no-mix-table-types", OPT_NO_MIX_TYPE, "Don't allow commands with uses two different table types.",
- (gptr*) &opt_no_mix_types, (gptr*) &opt_no_mix_types, 0, GET_BOOL, NO_ARG,
+ (uchar**) &opt_no_mix_types, (uchar**) &opt_no_mix_types, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"old-alter-table", OPT_OLD_ALTER_TABLE,
"Use old, non-optimized alter table.",
- (gptr*) &global_system_variables.old_alter_table,
- (gptr*) &max_system_variables.old_alter_table, 0, GET_BOOL, NO_ARG,
+ (uchar**) &global_system_variables.old_alter_table,
+ (uchar**) &max_system_variables.old_alter_table, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"old-passwords", OPT_OLD_PASSWORDS, "Use old password encryption method (needed for 4.0 and older clients).",
- (gptr*) &global_system_variables.old_passwords,
- (gptr*) &max_system_variables.old_passwords, 0, GET_BOOL, NO_ARG,
+ (uchar**) &global_system_variables.old_passwords,
+ (uchar**) &max_system_variables.old_passwords, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"one-thread", OPT_ONE_THREAD,
"(deprecated): Only use one thread (for debugging under Linux). Use thread-handling=no-threads instead",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"old-style-user-limits", OPT_OLD_STYLE_USER_LIMITS,
"Enable old-style user limits (before 5.0.3 user resources were counted per each user+host vs. per account)",
- (gptr*) &opt_old_style_user_limits, (gptr*) &opt_old_style_user_limits,
+ (uchar**) &opt_old_style_user_limits, (uchar**) &opt_old_style_user_limits,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"pid-file", OPT_PID_FILE, "Pid file used by safe_mysqld.",
- (gptr*) &pidfile_name_ptr, (gptr*) &pidfile_name_ptr, 0, GET_STR,
+ (uchar**) &pidfile_name_ptr, (uchar**) &pidfile_name_ptr, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"port", 'P', "Port number to use for connection.", (gptr*) &mysqld_port,
- (gptr*) &mysqld_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"port", 'P', "Port number to use for connection.", (uchar**) &mysqld_port,
+ (uchar**) &mysqld_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port-open-timeout", OPT_PORT_OPEN_TIMEOUT,
"Maximum time in seconds to wait for the port to become free. "
- "(Default: no wait)", (gptr*) &mysqld_port_timeout,
- (gptr*) &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "(Default: no wait)", (uchar**) &mysqld_port_timeout,
+ (uchar**) &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"relay-log", OPT_RELAY_LOG,
"The location and name to use for relay logs.",
- (gptr*) &opt_relay_logname, (gptr*) &opt_relay_logname, 0,
+ (uchar**) &opt_relay_logname, (uchar**) &opt_relay_logname, 0,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"relay-log-index", OPT_RELAY_LOG_INDEX,
"The location and name to use for the file that keeps a list of the last \
relay logs.",
- (gptr*) &opt_relaylog_index_name, (gptr*) &opt_relaylog_index_name, 0,
+ (uchar**) &opt_relaylog_index_name, (uchar**) &opt_relaylog_index_name, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE,
"The location and name of the file that remembers where the SQL replication \
thread is in the relay logs.",
- (gptr*) &relay_log_info_file, (gptr*) &relay_log_info_file, 0, GET_STR,
+ (uchar**) &relay_log_info_file, (uchar**) &relay_log_info_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replicate-do-db", OPT_REPLICATE_DO_DB,
"Tells the slave thread to restrict replication to the specified database. To specify more than one database, use the directive multiple times, once for each database. Note that this will only work if you do not use cross-database queries such as UPDATE some_db.some_table SET foo='bar' while having selected a different or no database. If you need cross database updates to work, make sure you have 3.23.28 or later, and use replicate-wild-do-table=db_name.%.",
@@ -5726,8 +5726,8 @@ thread is in the relay logs.",
"In replication, if set to 1, do not skip events having our server id. \
Default value is 0 (to break infinite loops in circular replication). \
Can't be set to 1 if --log-slave-updates is used.",
- (gptr*) &replicate_same_server_id,
- (gptr*) &replicate_same_server_id,
+ (uchar**) &replicate_same_server_id,
+ (uchar**) &replicate_same_server_id,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"replicate-wild-do-table", OPT_REPLICATE_WILD_DO_TABLE,
@@ -5739,19 +5739,19 @@ Can't be set to 1 if --log-slave-updates is used.",
// In replication, we may need to tell the other servers how to connect
{"report-host", OPT_REPORT_HOST,
"Hostname or IP of the slave to be reported to to the master during slave registration. Will appear in the output of SHOW SLAVE HOSTS. Leave unset if you do not want the slave to register itself with the master. Note that it is not sufficient for the master to simply read the IP of the slave off the socket once the slave connects. Due to NAT and other routing issues, that IP may not be valid for connecting to the slave from the master or other hosts.",
- (gptr*) &report_host, (gptr*) &report_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
+ (uchar**) &report_host, (uchar**) &report_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
0, 0, 0, 0},
{"report-password", OPT_REPORT_PASSWORD, "Undocumented.",
- (gptr*) &report_password, (gptr*) &report_password, 0, GET_STR,
+ (uchar**) &report_password, (uchar**) &report_password, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"report-port", OPT_REPORT_PORT,
"Port for connecting to slave reported to the master during slave registration. Set it only if the slave is listening on a non-default port or if you have a special tunnel from the master or other clients to the slave. If not sure, leave this option unset.",
- (gptr*) &report_port, (gptr*) &report_port, 0, GET_UINT, REQUIRED_ARG,
+ (uchar**) &report_port, (uchar**) &report_port, 0, GET_UINT, REQUIRED_ARG,
MYSQL_PORT, 0, 0, 0, 0, 0},
- {"report-user", OPT_REPORT_USER, "Undocumented.", (gptr*) &report_user,
- (gptr*) &report_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"report-user", OPT_REPORT_USER, "Undocumented.", (uchar**) &report_user,
+ (uchar**) &report_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"rpl-recovery-rank", OPT_RPL_RECOVERY_RANK, "Undocumented.",
- (gptr*) &rpl_recovery_rank, (gptr*) &rpl_recovery_rank, 0, GET_ULONG,
+ (uchar**) &rpl_recovery_rank, (uchar**) &rpl_recovery_rank, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -5762,43 +5762,43 @@ Can't be set to 1 if --log-slave-updates is used.",
#endif
{"safe-user-create", OPT_SAFE_USER_CREATE,
"Don't allow new user creation by the user who has no write privileges to the mysql.user table.",
- (gptr*) &opt_safe_user_create, (gptr*) &opt_safe_user_create, 0, GET_BOOL,
+ (uchar**) &opt_safe_user_create, (uchar**) &opt_safe_user_create, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT,
"Simulate memory shortage when compiled with the --with-debug=full option.",
0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"secure-auth", OPT_SECURE_AUTH, "Disallow authentication for accounts that have old (pre-4.1) passwords.",
- (gptr*) &opt_secure_auth, (gptr*) &opt_secure_auth, 0, GET_BOOL, NO_ARG,
+ (uchar**) &opt_secure_auth, (uchar**) &opt_secure_auth, 0, GET_BOOL, NO_ARG,
my_bool(0), 0, 0, 0, 0, 0},
{"secure-file-priv", OPT_SECURE_FILE_PRIV,
"Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files within specified directory",
- (gptr*) &opt_secure_file_priv, (gptr*) &opt_secure_file_priv, 0,
+ (uchar**) &opt_secure_file_priv, (uchar**) &opt_secure_file_priv, 0,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-id", OPT_SERVER_ID,
"Uniquely identifies the server instance in the community of replication partners.",
- (gptr*) &server_id, (gptr*) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0,
+ (uchar**) &server_id, (uchar**) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated;you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory", OPT_ENABLE_SHARED_MEMORY,
- "Enable the shared memory.",(gptr*) &opt_enable_shared_memory, (gptr*) &opt_enable_shared_memory,
+ "Enable the shared memory.",(uchar**) &opt_enable_shared_memory, (uchar**) &opt_enable_shared_memory,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
#ifdef HAVE_SMEM
{"shared-memory-base-name",OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
+ "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"show-slave-auth-info", OPT_SHOW_SLAVE_AUTH_INFO,
"Show user and password in SHOW SLAVE HOSTS on this master",
- (gptr*) &opt_show_slave_auth_info, (gptr*) &opt_show_slave_auth_info, 0,
+ (uchar**) &opt_show_slave_auth_info, (uchar**) &opt_show_slave_auth_info, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DISABLE_GRANT_OPTIONS
{"skip-grant-tables", OPT_SKIP_GRANT,
"Start without grant tables. This gives all users FULL ACCESS to all tables!",
- (gptr*) &opt_noacl, (gptr*) &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+ (uchar**) &opt_noacl, (uchar**) &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
#endif
{"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names.", 0, 0, 0,
@@ -5825,8 +5825,8 @@ Can't be set to 1 if --log-slave-updates is used.",
"Don't allow 'SHOW DATABASE' commands.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
{"skip-slave-start", OPT_SKIP_SLAVE_START,
- "If set, slave is not autostarted.", (gptr*) &opt_skip_slave_start,
- (gptr*) &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ "If set, slave is not autostarted.", (uchar**) &opt_skip_slave_start,
+ (uchar**) &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-stack-trace", OPT_SKIP_STACK_TRACE,
"Don't print a stack trace on failure.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
@@ -5839,23 +5839,23 @@ Can't be set to 1 if --log-slave-updates is used.",
{"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR,
"The location where the slave should put its temporary files when \
replicating a LOAD DATA INFILE command.",
- (gptr*) &slave_load_tmpdir, (gptr*) &slave_load_tmpdir, 0, GET_STR_ALLOC,
+ (uchar**) &slave_load_tmpdir, (uchar**) &slave_load_tmpdir, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS,
"Tells the slave thread to continue replication when a query returns an error from the provided list.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"slow-query-log", OPT_SLOW_LOG,
- "Enable|disable slow query log", (gptr*) &opt_slow_log,
- (gptr*) &opt_slow_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ "Enable|disable slow query log", (uchar**) &opt_slow_log,
+ (uchar**) &opt_slow_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"socket", OPT_SOCKET, "Socket file to use for connection.",
- (gptr*) &mysqld_unix_port, (gptr*) &mysqld_unix_port, 0, GET_STR,
+ (uchar**) &mysqld_unix_port, (uchar**) &mysqld_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_REPLICATION
{"sporadic-binlog-dump-fail", OPT_SPORADIC_BINLOG_DUMP_FAIL,
"Option used by mysql-test for debugging and testing of replication.",
- (gptr*) &opt_sporadic_binlog_dump_fail,
- (gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+ (uchar**) &opt_sporadic_binlog_dump_fail,
+ (uchar**) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
#endif /* HAVE_REPLICATION */
{"sql-bin-update-same", OPT_SQL_BIN_UPDATE_SAME,
@@ -5864,7 +5864,7 @@ log and this option does nothing anymore.",
0, 0, 0, GET_DISABLED, NO_ARG, 0, 0, 0, 0, 0, 0},
{"sql-mode", OPT_SQL_MODE,
"Syntax: sql-mode=option[,option[,option...]] where option can be one of: REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, ONLY_FULL_GROUP_BY, NO_UNSIGNED_SUBTRACTION.",
- (gptr*) &sql_mode_str, (gptr*) &sql_mode_str, 0, GET_STR, REQUIRED_ARG, 0,
+ (uchar**) &sql_mode_str, (uchar**) &sql_mode_str, 0, GET_STR, REQUIRED_ARG, 0,
0, 0, 0, 0, 0},
#ifdef HAVE_OPENSSL
#include "sslopt-longopts.h"
@@ -5875,7 +5875,7 @@ log and this option does nothing anymore.",
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"symbolic-links", 's', "Enable symbolic link support.",
- (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG,
+ (uchar**) &my_use_symdir, (uchar**) &my_use_symdir, 0, GET_BOOL, NO_ARG,
/*
The system call realpath() produces warnings under valgrind and
purify. These are not suppressed: instead we disable symlinks
@@ -5884,19 +5884,19 @@ log and this option does nothing anymore.",
IF_PURIFY(0,1), 0, 0, 0, 0, 0},
{"sysdate-is-now", OPT_SYSDATE_IS_NOW,
"Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. Since 5.0, SYSDATE() returns a `dynamic' value different for different invocations, even within the same statement.",
- (gptr*) &global_system_variables.sysdate_is_now,
+ (uchar**) &global_system_variables.sysdate_is_now,
0, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
{"tc-heuristic-recover", OPT_TC_HEURISTIC_RECOVER,
"Decision to use in heuristic recover process. Possible values are COMMIT or ROLLBACK.",
- (gptr*) &opt_tc_heuristic_recover, (gptr*) &opt_tc_heuristic_recover,
+ (uchar**) &opt_tc_heuristic_recover, (uchar**) &opt_tc_heuristic_recover,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"temp-pool", OPT_TEMP_POOL,
"Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file.",
- (gptr*) &use_temp_pool, (gptr*) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1,
+ (uchar**) &use_temp_pool, (uchar**) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"timed_mutexes", OPT_TIMED_MUTEXES,
"Specify whether to time mutexes (only InnoDB mutexes are currently supported)",
- (gptr*) &timed_mutexes, (gptr*) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0,
+ (uchar**) &timed_mutexes, (uchar**) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0,
0, 0, 0, 0, 0},
{"tmpdir", 't',
"Path for temporary files. Several paths may be specified, separated by a "
@@ -5906,83 +5906,83 @@ log and this option does nothing anymore.",
"colon (:)"
#endif
", in this case they are used in a round-robin fashion.",
- (gptr*) &opt_mysql_tmpdir,
- (gptr*) &opt_mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &opt_mysql_tmpdir,
+ (uchar**) &opt_mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"transaction-isolation", OPT_TX_ISOLATION,
"Default transaction isolation level.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0,
0, 0, 0, 0, 0},
{"use-symbolic-links", 's', "Enable symbolic link support. Deprecated option; use --symbolic-links instead.",
- (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG,
+ (uchar**) &my_use_symdir, (uchar**) &my_use_symdir, 0, GET_BOOL, NO_ARG,
IF_PURIFY(0,1), 0, 0, 0, 0, 0},
{"user", 'u', "Run mysqld daemon as user.", 0, 0, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Used with --help option for detailed help",
- (gptr*) &opt_verbose, (gptr*) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ (uchar**) &opt_verbose, (uchar**) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"warnings", 'W', "Deprecated; use --log-warnings instead.",
- (gptr*) &global_system_variables.log_warnings,
- (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, ~0L,
+ (uchar**) &global_system_variables.log_warnings,
+ (uchar**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, ~0L,
0, 0, 0},
{ "back_log", OPT_BACK_LOG,
"The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.",
- (gptr*) &back_log, (gptr*) &back_log, 0, GET_ULONG,
+ (uchar**) &back_log, (uchar**) &back_log, 0, GET_ULONG,
REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 },
{"binlog_cache_size", OPT_BINLOG_CACHE_SIZE,
"The size of the cache to hold the SQL statements for the binary log during a transaction. If you often use big, multi-statement transactions you can increase this to get more performance.",
- (gptr*) &binlog_cache_size, (gptr*) &binlog_cache_size, 0, GET_ULONG,
+ (uchar**) &binlog_cache_size, (uchar**) &binlog_cache_size, 0, GET_ULONG,
REQUIRED_ARG, 32*1024L, IO_SIZE, ~0L, 0, IO_SIZE, 0},
{"bulk_insert_buffer_size", OPT_BULK_INSERT_BUFFER_SIZE,
"Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread!",
- (gptr*) &global_system_variables.bulk_insert_buff_size,
- (gptr*) &max_system_variables.bulk_insert_buff_size,
+ (uchar**) &global_system_variables.bulk_insert_buff_size,
+ (uchar**) &max_system_variables.bulk_insert_buff_size,
0, GET_ULONG, REQUIRED_ARG, 8192*1024, 0, ~0L, 0, 1, 0},
{"connect_timeout", OPT_CONNECT_TIMEOUT,
"The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake'.",
- (gptr*) &connect_timeout, (gptr*) &connect_timeout,
+ (uchar**) &connect_timeout, (uchar**) &connect_timeout,
0, GET_ULONG, REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 },
{ "date_format", OPT_DATE_FORMAT,
"The DATE format (For future).",
- (gptr*) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE],
- (gptr*) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE],
+ (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE],
+ (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE],
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "datetime_format", OPT_DATETIME_FORMAT,
"The DATETIME/TIMESTAMP format (for future).",
- (gptr*) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME],
- (gptr*) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME],
+ (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME],
+ (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME],
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "default_week_format", OPT_DEFAULT_WEEK_FORMAT,
"The default week format used by WEEK() functions.",
- (gptr*) &global_system_variables.default_week_format,
- (gptr*) &max_system_variables.default_week_format,
+ (uchar**) &global_system_variables.default_week_format,
+ (uchar**) &max_system_variables.default_week_format,
0, GET_ULONG, REQUIRED_ARG, 0, 0, 7L, 0, 1, 0},
{"delayed_insert_limit", OPT_DELAYED_INSERT_LIMIT,
"After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT statements pending. If so, it allows these to execute before continuing.",
- (gptr*) &delayed_insert_limit, (gptr*) &delayed_insert_limit, 0, GET_ULONG,
+ (uchar**) &delayed_insert_limit, (uchar**) &delayed_insert_limit, 0, GET_ULONG,
REQUIRED_ARG, DELAYED_LIMIT, 1, ~0L, 0, 1, 0},
{"delayed_insert_timeout", OPT_DELAYED_INSERT_TIMEOUT,
"How long a INSERT DELAYED thread should wait for INSERT statements before terminating.",
- (gptr*) &delayed_insert_timeout, (gptr*) &delayed_insert_timeout, 0,
+ (uchar**) &delayed_insert_timeout, (uchar**) &delayed_insert_timeout, 0,
GET_ULONG, REQUIRED_ARG, DELAYED_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{ "delayed_queue_size", OPT_DELAYED_QUEUE_SIZE,
"What size queue (in rows) should be allocated for handling INSERT DELAYED. If the queue becomes full, any client that does INSERT DELAYED will wait until there is room in the queue again.",
- (gptr*) &delayed_queue_size, (gptr*) &delayed_queue_size, 0, GET_ULONG,
+ (uchar**) &delayed_queue_size, (uchar**) &delayed_queue_size, 0, GET_ULONG,
REQUIRED_ARG, DELAYED_QUEUE_SIZE, 1, ~0L, 0, 1, 0},
{"div_precision_increment", OPT_DIV_PRECINCREMENT,
"Precision of the result of '/' operator will be increased on that value.",
- (gptr*) &global_system_variables.div_precincrement,
- (gptr*) &max_system_variables.div_precincrement, 0, GET_ULONG,
+ (uchar**) &global_system_variables.div_precincrement,
+ (uchar**) &max_system_variables.div_precincrement, 0, GET_ULONG,
REQUIRED_ARG, 4, 0, DECIMAL_MAX_SCALE, 0, 0, 0},
{"expire_logs_days", OPT_EXPIRE_LOGS_DAYS,
"If non-zero, binary logs will be purged after expire_logs_days "
"days; possible purges happen at startup and at binary log rotation.",
- (gptr*) &expire_logs_days,
- (gptr*) &expire_logs_days, 0, GET_ULONG,
+ (uchar**) &expire_logs_days,
+ (uchar**) &expire_logs_days, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 99, 0, 1, 0},
{ "flush_time", OPT_FLUSH_TIME,
"A dedicated thread is created to flush all tables at the given interval.",
- (gptr*) &flush_time, (gptr*) &flush_time, 0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &flush_time, (uchar**) &flush_time, 0, GET_ULONG, REQUIRED_ARG,
FLUSH_TIME, 0, LONG_TIMEOUT, 0, 1, 0},
{ "ft_boolean_syntax", OPT_FT_BOOLEAN_SYNTAX,
"List of operators for MATCH ... AGAINST ( ... IN BOOLEAN MODE)",
@@ -5990,148 +5990,148 @@ log and this option does nothing anymore.",
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "ft_max_word_len", OPT_FT_MAX_WORD_LEN,
"The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
- (gptr*) &ft_max_word_len, (gptr*) &ft_max_word_len, 0, GET_ULONG,
+ (uchar**) &ft_max_word_len, (uchar**) &ft_max_word_len, 0, GET_ULONG,
REQUIRED_ARG, HA_FT_MAXCHARLEN, 10, HA_FT_MAXCHARLEN, 0, 1, 0},
{ "ft_min_word_len", OPT_FT_MIN_WORD_LEN,
"The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
- (gptr*) &ft_min_word_len, (gptr*) &ft_min_word_len, 0, GET_ULONG,
+ (uchar**) &ft_min_word_len, (uchar**) &ft_min_word_len, 0, GET_ULONG,
REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN, 0, 1, 0},
{ "ft_query_expansion_limit", OPT_FT_QUERY_EXPANSION_LIMIT,
"Number of best matches to use for query expansion",
- (gptr*) &ft_query_expansion_limit, (gptr*) &ft_query_expansion_limit, 0, GET_ULONG,
+ (uchar**) &ft_query_expansion_limit, (uchar**) &ft_query_expansion_limit, 0, GET_ULONG,
REQUIRED_ARG, 20, 0, 1000, 0, 1, 0},
{ "ft_stopword_file", OPT_FT_STOPWORD_FILE,
"Use stopwords from this file instead of built-in list.",
- (gptr*) &ft_stopword_file, (gptr*) &ft_stopword_file, 0, GET_STR,
+ (uchar**) &ft_stopword_file, (uchar**) &ft_stopword_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "group_concat_max_len", OPT_GROUP_CONCAT_MAX_LEN,
"The maximum length of the result of function group_concat.",
- (gptr*) &global_system_variables.group_concat_max_len,
- (gptr*) &max_system_variables.group_concat_max_len, 0, GET_ULONG,
+ (uchar**) &global_system_variables.group_concat_max_len,
+ (uchar**) &max_system_variables.group_concat_max_len, 0, GET_ULONG,
REQUIRED_ARG, 1024, 4, (long) ~0, 0, 1, 0},
#ifdef WITH_INNOBASE_STORAGE_ENGINE
{"innodb_additional_mem_pool_size", OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE,
"Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.",
- (gptr*) &innobase_additional_mem_pool_size,
- (gptr*) &innobase_additional_mem_pool_size, 0, GET_LONG, REQUIRED_ARG,
+ (uchar**) &innobase_additional_mem_pool_size,
+ (uchar**) &innobase_additional_mem_pool_size, 0, GET_LONG, REQUIRED_ARG,
1*1024*1024L, 512*1024L, ~0L, 0, 1024, 0},
{"innodb_autoextend_increment", OPT_INNODB_AUTOEXTEND_INCREMENT,
"Data file autoextend increment in megabytes",
- (gptr*) &srv_auto_extend_increment,
- (gptr*) &srv_auto_extend_increment,
+ (uchar**) &srv_auto_extend_increment,
+ (uchar**) &srv_auto_extend_increment,
0, GET_LONG, REQUIRED_ARG, 8L, 1L, 1000L, 0, 1L, 0},
{"innodb_buffer_pool_size", OPT_INNODB_BUFFER_POOL_SIZE,
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
- (gptr*) &innobase_buffer_pool_size, (gptr*) &innobase_buffer_pool_size, 0,
+ (uchar**) &innobase_buffer_pool_size, (uchar**) &innobase_buffer_pool_size, 0,
GET_LL, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, LONGLONG_MAX, 0,
1024*1024L, 0},
{"innodb_commit_concurrency", OPT_INNODB_COMMIT_CONCURRENCY,
"Helps in performance tuning in heavily concurrent environments.",
- (gptr*) &srv_commit_concurrency, (gptr*) &srv_commit_concurrency,
+ (uchar**) &srv_commit_concurrency, (uchar**) &srv_commit_concurrency,
0, GET_LONG, REQUIRED_ARG, 0, 0, 1000, 0, 1, 0},
{"innodb_concurrency_tickets", OPT_INNODB_CONCURRENCY_TICKETS,
"Number of times a thread is allowed to enter InnoDB within the same \
SQL query after it has once got the ticket",
- (gptr*) &srv_n_free_tickets_to_enter,
- (gptr*) &srv_n_free_tickets_to_enter,
+ (uchar**) &srv_n_free_tickets_to_enter,
+ (uchar**) &srv_n_free_tickets_to_enter,
0, GET_LONG, REQUIRED_ARG, 500L, 1L, ~0L, 0, 1L, 0},
{"innodb_file_io_threads", OPT_INNODB_FILE_IO_THREADS,
- "Number of file I/O threads in InnoDB.", (gptr*) &innobase_file_io_threads,
- (gptr*) &innobase_file_io_threads, 0, GET_LONG, REQUIRED_ARG, 4, 4, 64, 0,
+ "Number of file I/O threads in InnoDB.", (uchar**) &innobase_file_io_threads,
+ (uchar**) &innobase_file_io_threads, 0, GET_LONG, REQUIRED_ARG, 4, 4, 64, 0,
1, 0},
{"innodb_force_recovery", OPT_INNODB_FORCE_RECOVERY,
"Helps to save your data in case the disk image of the database becomes corrupt.",
- (gptr*) &innobase_force_recovery, (gptr*) &innobase_force_recovery, 0,
+ (uchar**) &innobase_force_recovery, (uchar**) &innobase_force_recovery, 0,
GET_LONG, REQUIRED_ARG, 0, 0, 6, 0, 1, 0},
{"innodb_lock_wait_timeout", OPT_INNODB_LOCK_WAIT_TIMEOUT,
"Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back.",
- (gptr*) &innobase_lock_wait_timeout, (gptr*) &innobase_lock_wait_timeout,
+ (uchar**) &innobase_lock_wait_timeout, (uchar**) &innobase_lock_wait_timeout,
0, GET_LONG, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0},
{"innodb_log_buffer_size", OPT_INNODB_LOG_BUFFER_SIZE,
"The size of the buffer which InnoDB uses to write log to the log files on disk.",
- (gptr*) &innobase_log_buffer_size, (gptr*) &innobase_log_buffer_size, 0,
+ (uchar**) &innobase_log_buffer_size, (uchar**) &innobase_log_buffer_size, 0,
GET_LONG, REQUIRED_ARG, 1024*1024L, 256*1024L, ~0L, 0, 1024, 0},
{"innodb_log_file_size", OPT_INNODB_LOG_FILE_SIZE,
"Size of each log file in a log group.",
- (gptr*) &innobase_log_file_size, (gptr*) &innobase_log_file_size, 0,
+ (uchar**) &innobase_log_file_size, (uchar**) &innobase_log_file_size, 0,
GET_LL, REQUIRED_ARG, 5*1024*1024L, 1*1024*1024L, LONGLONG_MAX, 0,
1024*1024L, 0},
{"innodb_log_files_in_group", OPT_INNODB_LOG_FILES_IN_GROUP,
"Number of log files in the log group. InnoDB writes to the files in a circular fashion. Value 3 is recommended here.",
- (gptr*) &innobase_log_files_in_group, (gptr*) &innobase_log_files_in_group,
+ (uchar**) &innobase_log_files_in_group, (uchar**) &innobase_log_files_in_group,
0, GET_LONG, REQUIRED_ARG, 2, 2, 100, 0, 1, 0},
{"innodb_mirrored_log_groups", OPT_INNODB_MIRRORED_LOG_GROUPS,
"Number of identical copies of log groups we keep for the database. Currently this should be set to 1.",
- (gptr*) &innobase_mirrored_log_groups,
- (gptr*) &innobase_mirrored_log_groups, 0, GET_LONG, REQUIRED_ARG, 1, 1, 10,
+ (uchar**) &innobase_mirrored_log_groups,
+ (uchar**) &innobase_mirrored_log_groups, 0, GET_LONG, REQUIRED_ARG, 1, 1, 10,
0, 1, 0},
{"innodb_open_files", OPT_INNODB_OPEN_FILES,
"How many files at the maximum InnoDB keeps open at the same time.",
- (gptr*) &innobase_open_files, (gptr*) &innobase_open_files, 0,
+ (uchar**) &innobase_open_files, (uchar**) &innobase_open_files, 0,
GET_LONG, REQUIRED_ARG, 300L, 10L, ~0L, 0, 1L, 0},
{"innodb_sync_spin_loops", OPT_INNODB_SYNC_SPIN_LOOPS,
"Count of spin-loop rounds in InnoDB mutexes",
- (gptr*) &srv_n_spin_wait_rounds,
- (gptr*) &srv_n_spin_wait_rounds,
+ (uchar**) &srv_n_spin_wait_rounds,
+ (uchar**) &srv_n_spin_wait_rounds,
0, GET_LONG, REQUIRED_ARG, 20L, 0L, ~0L, 0, 1L, 0},
{"innodb_thread_concurrency", OPT_INNODB_THREAD_CONCURRENCY,
"Helps in performance tuning in heavily concurrent environments. "
"Sets the maximum number of threads allowed inside InnoDB. Value 0"
" will disable the thread throttling.",
- (gptr*) &srv_thread_concurrency, (gptr*) &srv_thread_concurrency,
+ (uchar**) &srv_thread_concurrency, (uchar**) &srv_thread_concurrency,
0, GET_LONG, REQUIRED_ARG, 8, 0, 1000, 0, 1, 0},
{"innodb_thread_sleep_delay", OPT_INNODB_THREAD_SLEEP_DELAY,
"Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0"
" disable a sleep",
- (gptr*) &srv_thread_sleep_delay,
- (gptr*) &srv_thread_sleep_delay,
+ (uchar**) &srv_thread_sleep_delay,
+ (uchar**) &srv_thread_sleep_delay,
0, GET_LONG, REQUIRED_ARG, 10000L, 0L, ~0L, 0, 1L, 0},
#endif /* WITH_INNOBASE_STORAGE_ENGINE */
{"interactive_timeout", OPT_INTERACTIVE_TIMEOUT,
"The number of seconds the server waits for activity on an interactive connection before closing it.",
- (gptr*) &global_system_variables.net_interactive_timeout,
- (gptr*) &max_system_variables.net_interactive_timeout, 0,
+ (uchar**) &global_system_variables.net_interactive_timeout,
+ (uchar**) &max_system_variables.net_interactive_timeout, 0,
GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"join_buffer_size", OPT_JOIN_BUFF_SIZE,
"The size of the buffer that is used for full joins.",
- (gptr*) &global_system_variables.join_buff_size,
- (gptr*) &max_system_variables.join_buff_size, 0, GET_ULONG,
+ (uchar**) &global_system_variables.join_buff_size,
+ (uchar**) &max_system_variables.join_buff_size, 0, GET_ULONG,
REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD,
IO_SIZE, 0},
{"key_buffer_size", OPT_KEY_BUFFER_SIZE,
"The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.",
- (gptr*) &dflt_key_cache_var.param_buff_size,
- (gptr*) 0,
+ (uchar**) &dflt_key_cache_var.param_buff_size,
+ (uchar**) 0,
0, (GET_ULL | GET_ASK_ADDR),
REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, ~(ulong) 0, MALLOC_OVERHEAD,
IO_SIZE, 0},
{"key_cache_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD,
"This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache",
- (gptr*) &dflt_key_cache_var.param_age_threshold,
- (gptr*) 0,
+ (uchar**) &dflt_key_cache_var.param_age_threshold,
+ (uchar**) 0,
0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
300, 100, ~0L, 0, 100, 0},
{"key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE,
"The default size of key cache blocks",
- (gptr*) &dflt_key_cache_var.param_block_size,
- (gptr*) 0,
+ (uchar**) &dflt_key_cache_var.param_block_size,
+ (uchar**) 0,
0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
KEY_CACHE_BLOCK_SIZE , 512, 1024*16, MALLOC_OVERHEAD, 512, 0},
{"key_cache_division_limit", OPT_KEY_CACHE_DIVISION_LIMIT,
"The minimum percentage of warm blocks in key cache",
- (gptr*) &dflt_key_cache_var.param_division_limit,
- (gptr*) 0,
+ (uchar**) &dflt_key_cache_var.param_division_limit,
+ (uchar**) 0,
0, (GET_ULONG | GET_ASK_ADDR) , REQUIRED_ARG, 100,
1, 100, 0, 1, 0},
{"long_query_time", OPT_LONG_QUERY_TIME,
"Log all queries that have taken more than long_query_time seconds to execute to file.",
- (gptr*) &global_system_variables.long_query_time,
- (gptr*) &max_system_variables.long_query_time, 0, GET_ULONG,
+ (uchar**) &global_system_variables.long_query_time,
+ (uchar**) &max_system_variables.long_query_time, 0, GET_ULONG,
REQUIRED_ARG, 10, 1, LONG_TIMEOUT, 0, 1, 0},
{"lower_case_table_names", OPT_LOWER_CASE_TABLE_NAMES,
"If set to 1 table names are stored in lowercase on disk and table names will be case-insensitive. Should be set to 2 if you are using a case insensitive file system",
- (gptr*) &lower_case_table_names,
- (gptr*) &lower_case_table_names, 0, GET_UINT, OPT_ARG,
+ (uchar**) &lower_case_table_names,
+ (uchar**) &lower_case_table_names, 0, GET_UINT, OPT_ARG,
#ifdef FN_NO_CASE_SENCE
1
#else
@@ -6140,351 +6140,351 @@ log and this option does nothing anymore.",
, 0, 2, 0, 1, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
"Max packetlength to send/receive from to server.",
- (gptr*) &global_system_variables.max_allowed_packet,
- (gptr*) &max_system_variables.max_allowed_packet, 0, GET_ULONG,
+ (uchar**) &global_system_variables.max_allowed_packet,
+ (uchar**) &max_system_variables.max_allowed_packet, 0, GET_ULONG,
REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
{"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE,
"Can be used to restrict the total size used to cache a multi-transaction query.",
- (gptr*) &max_binlog_cache_size, (gptr*) &max_binlog_cache_size, 0,
+ (uchar**) &max_binlog_cache_size, (uchar**) &max_binlog_cache_size, 0,
GET_ULONG, REQUIRED_ARG, ~0L, IO_SIZE, ~0L, 0, IO_SIZE, 0},
{"max_binlog_size", OPT_MAX_BINLOG_SIZE,
"Binary log will be rotated automatically when the size exceeds this \
value. Will also apply to relay logs if max_relay_log_size is 0. \
The minimum value for this variable is 4096.",
- (gptr*) &max_binlog_size, (gptr*) &max_binlog_size, 0, GET_ULONG,
+ (uchar**) &max_binlog_size, (uchar**) &max_binlog_size, 0, GET_ULONG,
REQUIRED_ARG, 1024*1024L*1024L, IO_SIZE, 1024*1024L*1024L, 0, IO_SIZE, 0},
{"max_connect_errors", OPT_MAX_CONNECT_ERRORS,
"If there is more than this number of interrupted connections from a host this host will be blocked from further connections.",
- (gptr*) &max_connect_errors, (gptr*) &max_connect_errors, 0, GET_ULONG,
+ (uchar**) &max_connect_errors, (uchar**) &max_connect_errors, 0, GET_ULONG,
REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, ~0L, 0, 1, 0},
// Default max_connections of 151 is larger than Apache's default max
// children, to avoid "too many connections" error in a common setup
{"max_connections", OPT_MAX_CONNECTIONS,
- "The number of simultaneous clients allowed.", (gptr*) &max_connections,
- (gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 151, 1, 100000, 0, 1,
+ "The number of simultaneous clients allowed.", (uchar**) &max_connections,
+ (uchar**) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 151, 1, 100000, 0, 1,
0},
{"max_delayed_threads", OPT_MAX_DELAYED_THREADS,
"Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero, which means INSERT DELAYED is not used.",
- (gptr*) &global_system_variables.max_insert_delayed_threads,
- (gptr*) &max_system_variables.max_insert_delayed_threads,
+ (uchar**) &global_system_variables.max_insert_delayed_threads,
+ (uchar**) &max_system_variables.max_insert_delayed_threads,
0, GET_ULONG, REQUIRED_ARG, 20, 0, 16384, 0, 1, 0},
{"max_error_count", OPT_MAX_ERROR_COUNT,
"Max number of errors/warnings to store for a statement.",
- (gptr*) &global_system_variables.max_error_count,
- (gptr*) &max_system_variables.max_error_count,
+ (uchar**) &global_system_variables.max_error_count,
+ (uchar**) &max_system_variables.max_error_count,
0, GET_ULONG, REQUIRED_ARG, DEFAULT_ERROR_COUNT, 0, 65535, 0, 1, 0},
{"max_heap_table_size", OPT_MAX_HEP_TABLE_SIZE,
"Don't allow creation of heap tables bigger than this.",
- (gptr*) &global_system_variables.max_heap_table_size,
- (gptr*) &max_system_variables.max_heap_table_size, 0, GET_ULL,
+ (uchar**) &global_system_variables.max_heap_table_size,
+ (uchar**) &max_system_variables.max_heap_table_size, 0, GET_ULL,
REQUIRED_ARG, 16*1024*1024L, 16384, MAX_MEM_TABLE_SIZE,
MALLOC_OVERHEAD, 1024, 0},
{"max_join_size", OPT_MAX_JOIN_SIZE,
"Joins that are probably going to read more than max_join_size records return an error.",
- (gptr*) &global_system_variables.max_join_size,
- (gptr*) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG,
+ (uchar**) &global_system_variables.max_join_size,
+ (uchar**) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG,
~0L, 1, ~0L, 0, 1, 0},
{"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA,
"Max number of bytes in sorted records.",
- (gptr*) &global_system_variables.max_length_for_sort_data,
- (gptr*) &max_system_variables.max_length_for_sort_data, 0, GET_ULONG,
+ (uchar**) &global_system_variables.max_length_for_sort_data,
+ (uchar**) &max_system_variables.max_length_for_sort_data, 0, GET_ULONG,
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
{"max_prepared_stmt_count", OPT_MAX_PREPARED_STMT_COUNT,
"Maximum number of prepared statements in the server.",
- (gptr*) &max_prepared_stmt_count, (gptr*) &max_prepared_stmt_count,
+ (uchar**) &max_prepared_stmt_count, (uchar**) &max_prepared_stmt_count,
0, GET_ULONG, REQUIRED_ARG, 16382, 0, 1*1024*1024, 0, 1, 0},
{"max_relay_log_size", OPT_MAX_RELAY_LOG_SIZE,
"If non-zero: relay log will be rotated automatically when the size exceeds this value; if zero (the default): when the size exceeds max_binlog_size. 0 excepted, the minimum value for this variable is 4096.",
- (gptr*) &max_relay_log_size, (gptr*) &max_relay_log_size, 0, GET_ULONG,
+ (uchar**) &max_relay_log_size, (uchar**) &max_relay_log_size, 0, GET_ULONG,
REQUIRED_ARG, 0L, 0L, 1024*1024L*1024L, 0, IO_SIZE, 0},
{ "max_seeks_for_key", OPT_MAX_SEEKS_FOR_KEY,
"Limit assumed max number of seeks when looking up rows based on a key",
- (gptr*) &global_system_variables.max_seeks_for_key,
- (gptr*) &max_system_variables.max_seeks_for_key, 0, GET_ULONG,
+ (uchar**) &global_system_variables.max_seeks_for_key,
+ (uchar**) &max_system_variables.max_seeks_for_key, 0, GET_ULONG,
REQUIRED_ARG, ~0L, 1, ~0L, 0, 1, 0 },
{"max_sort_length", OPT_MAX_SORT_LENGTH,
"The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored).",
- (gptr*) &global_system_variables.max_sort_length,
- (gptr*) &max_system_variables.max_sort_length, 0, GET_ULONG,
+ (uchar**) &global_system_variables.max_sort_length,
+ (uchar**) &max_system_variables.max_sort_length, 0, GET_ULONG,
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
{"max_sp_recursion_depth", OPT_MAX_SP_RECURSION_DEPTH,
"Maximum stored procedure recursion depth. (discussed with docs).",
- (gptr*) &global_system_variables.max_sp_recursion_depth,
- (gptr*) &max_system_variables.max_sp_recursion_depth, 0, GET_ULONG,
+ (uchar**) &global_system_variables.max_sp_recursion_depth,
+ (uchar**) &max_system_variables.max_sp_recursion_depth, 0, GET_ULONG,
OPT_ARG, 0, 0, 255, 0, 1, 0 },
{"max_tmp_tables", OPT_MAX_TMP_TABLES,
"Maximum number of temporary tables a client can keep open at a time.",
- (gptr*) &global_system_variables.max_tmp_tables,
- (gptr*) &max_system_variables.max_tmp_tables, 0, GET_ULONG,
+ (uchar**) &global_system_variables.max_tmp_tables,
+ (uchar**) &max_system_variables.max_tmp_tables, 0, GET_ULONG,
REQUIRED_ARG, 32, 1, ~0L, 0, 1, 0},
{"max_user_connections", OPT_MAX_USER_CONNECTIONS,
"The maximum number of active connections for a single user (0 = no limit).",
- (gptr*) &max_user_connections, (gptr*) &max_user_connections, 0, GET_UINT,
+ (uchar**) &max_user_connections, (uchar**) &max_user_connections, 0, GET_UINT,
REQUIRED_ARG, 0, 1, ~0, 0, 1, 0},
{"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT,
"After this many write locks, allow some read locks to run in between.",
- (gptr*) &max_write_lock_count, (gptr*) &max_write_lock_count, 0, GET_ULONG,
+ (uchar**) &max_write_lock_count, (uchar**) &max_write_lock_count, 0, GET_ULONG,
REQUIRED_ARG, ~0L, 1, ~0L, 0, 1, 0},
{"multi_range_count", OPT_MULTI_RANGE_COUNT,
"Number of key ranges to request at once.",
- (gptr*) &global_system_variables.multi_range_count,
- (gptr*) &max_system_variables.multi_range_count, 0,
+ (uchar**) &global_system_variables.multi_range_count,
+ (uchar**) &max_system_variables.multi_range_count, 0,
GET_ULONG, REQUIRED_ARG, 256, 1, ~0L, 0, 1, 0},
{"myisam_block_size", OPT_MYISAM_BLOCK_SIZE,
"Block size to be used for MyISAM index pages.",
- (gptr*) &opt_myisam_block_size,
- (gptr*) &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &opt_myisam_block_size,
+ (uchar**) &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG,
MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH,
0, MI_MIN_KEY_BLOCK_LENGTH, 0},
{"myisam_data_pointer_size", OPT_MYISAM_DATA_POINTER_SIZE,
"Default pointer size to be used for MyISAM tables.",
- (gptr*) &myisam_data_pointer_size,
- (gptr*) &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &myisam_data_pointer_size,
+ (uchar**) &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG,
6, 2, 7, 0, 1, 0},
{"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
"Deprecated option",
- (gptr*) &global_system_variables.myisam_max_extra_sort_file_size,
- (gptr*) &max_system_variables.myisam_max_extra_sort_file_size,
+ (uchar**) &global_system_variables.myisam_max_extra_sort_file_size,
+ (uchar**) &max_system_variables.myisam_max_extra_sort_file_size,
0, GET_ULL, REQUIRED_ARG, (ulonglong) MI_MAX_TEMP_LENGTH,
0, (ulonglong) MAX_FILE_SIZE, 0, 1, 0},
{"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE,
"Don't use the fast sort index method to created index if the temporary file would get bigger than this.",
- (gptr*) &global_system_variables.myisam_max_sort_file_size,
- (gptr*) &max_system_variables.myisam_max_sort_file_size, 0,
+ (uchar**) &global_system_variables.myisam_max_sort_file_size,
+ (uchar**) &max_system_variables.myisam_max_sort_file_size, 0,
GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, (ulonglong) MAX_FILE_SIZE,
0, 1024*1024, 0},
{"myisam_repair_threads", OPT_MYISAM_REPAIR_THREADS,
"Number of threads to use when repairing MyISAM tables. The value of 1 disables parallel repair.",
- (gptr*) &global_system_variables.myisam_repair_threads,
- (gptr*) &max_system_variables.myisam_repair_threads, 0,
+ (uchar**) &global_system_variables.myisam_repair_threads,
+ (uchar**) &max_system_variables.myisam_repair_threads, 0,
GET_ULONG, REQUIRED_ARG, 1, 1, ~0L, 0, 1, 0},
{"myisam_sort_buffer_size", OPT_MYISAM_SORT_BUFFER_SIZE,
"The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE.",
- (gptr*) &global_system_variables.myisam_sort_buff_size,
- (gptr*) &max_system_variables.myisam_sort_buff_size, 0,
+ (uchar**) &global_system_variables.myisam_sort_buff_size,
+ (uchar**) &max_system_variables.myisam_sort_buff_size, 0,
GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ~0L, 0, 1, 0},
{"myisam_use_mmap", OPT_MYISAM_USE_MMAP,
"Use memory mapping for reading and writing MyISAM tables",
- (gptr*) &opt_myisam_use_mmap,
- (gptr*) &opt_myisam_use_mmap, 0, GET_BOOL, NO_ARG, 0,
+ (uchar**) &opt_myisam_use_mmap,
+ (uchar**) &opt_myisam_use_mmap, 0, GET_BOOL, NO_ARG, 0,
0, 0, 0, 0, 0},
{"myisam_stats_method", OPT_MYISAM_STATS_METHOD,
"Specifies how MyISAM index statistics collection code should threat NULLs. "
"Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), "
"\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".",
- (gptr*) &myisam_stats_method_str, (gptr*) &myisam_stats_method_str, 0,
+ (uchar**) &myisam_stats_method_str, (uchar**) &myisam_stats_method_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"net_buffer_length", OPT_NET_BUFFER_LENGTH,
"Buffer length for TCP/IP and socket communication.",
- (gptr*) &global_system_variables.net_buffer_length,
- (gptr*) &max_system_variables.net_buffer_length, 0, GET_ULONG,
+ (uchar**) &global_system_variables.net_buffer_length,
+ (uchar**) &max_system_variables.net_buffer_length, 0, GET_ULONG,
REQUIRED_ARG, 16384, 1024, 1024*1024L, 0, 1024, 0},
{"net_read_timeout", OPT_NET_READ_TIMEOUT,
"Number of seconds to wait for more data from a connection before aborting the read.",
- (gptr*) &global_system_variables.net_read_timeout,
- (gptr*) &max_system_variables.net_read_timeout, 0, GET_ULONG,
+ (uchar**) &global_system_variables.net_read_timeout,
+ (uchar**) &max_system_variables.net_read_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_READ_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"net_retry_count", OPT_NET_RETRY_COUNT,
"If a read on a communication port is interrupted, retry this many times before giving up.",
- (gptr*) &global_system_variables.net_retry_count,
- (gptr*) &max_system_variables.net_retry_count,0,
+ (uchar**) &global_system_variables.net_retry_count,
+ (uchar**) &max_system_variables.net_retry_count,0,
GET_ULONG, REQUIRED_ARG, MYSQLD_NET_RETRY_COUNT, 1, ~0L, 0, 1, 0},
{"net_write_timeout", OPT_NET_WRITE_TIMEOUT,
"Number of seconds to wait for a block to be written to a connection before aborting the write.",
- (gptr*) &global_system_variables.net_write_timeout,
- (gptr*) &max_system_variables.net_write_timeout, 0, GET_ULONG,
+ (uchar**) &global_system_variables.net_write_timeout,
+ (uchar**) &max_system_variables.net_write_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_WRITE_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{ "old", OPT_OLD_MODE, "Use compatible behavior.",
- (gptr*) &global_system_variables.old_mode,
- (gptr*) &max_system_variables.old_mode, 0, GET_BOOL, NO_ARG,
+ (uchar**) &global_system_variables.old_mode,
+ (uchar**) &max_system_variables.old_mode, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"open_files_limit", OPT_OPEN_FILES_LIMIT,
"If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of files.",
- (gptr*) &open_files_limit, (gptr*) &open_files_limit, 0, GET_ULONG,
+ (uchar**) &open_files_limit, (uchar**) &open_files_limit, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, OS_FILE_LIMIT, 0, 1, 0},
{"optimizer_prune_level", OPT_OPTIMIZER_PRUNE_LEVEL,
"Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search; 1 - prune plans based on number of retrieved rows.",
- (gptr*) &global_system_variables.optimizer_prune_level,
- (gptr*) &max_system_variables.optimizer_prune_level,
+ (uchar**) &global_system_variables.optimizer_prune_level,
+ (uchar**) &max_system_variables.optimizer_prune_level,
0, GET_ULONG, OPT_ARG, 1, 0, 1, 0, 1, 0},
{"optimizer_search_depth", OPT_OPTIMIZER_SEARCH_DEPTH,
"Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Smaller values than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value; if set to MAX_TABLES+2, the optimizer will switch to the original find_best (used for testing/comparison).",
- (gptr*) &global_system_variables.optimizer_search_depth,
- (gptr*) &max_system_variables.optimizer_search_depth,
+ (uchar**) &global_system_variables.optimizer_search_depth,
+ (uchar**) &max_system_variables.optimizer_search_depth,
0, GET_ULONG, OPT_ARG, MAX_TABLES+1, 0, MAX_TABLES+2, 0, 1, 0},
{"plugin_dir", OPT_PLUGIN_DIR,
"Directory for plugins.",
- (gptr*) &opt_plugin_dir_ptr, (gptr*) &opt_plugin_dir_ptr, 0,
+ (uchar**) &opt_plugin_dir_ptr, (uchar**) &opt_plugin_dir_ptr, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE,
"The size of the buffer that is allocated when preloading indexes",
- (gptr*) &global_system_variables.preload_buff_size,
- (gptr*) &max_system_variables.preload_buff_size, 0, GET_ULONG,
+ (uchar**) &global_system_variables.preload_buff_size,
+ (uchar**) &max_system_variables.preload_buff_size, 0, GET_ULONG,
REQUIRED_ARG, 32*1024L, 1024, 1024*1024*1024L, 0, 1, 0},
{"query_alloc_block_size", OPT_QUERY_ALLOC_BLOCK_SIZE,
"Allocation block size for query parsing and execution",
- (gptr*) &global_system_variables.query_alloc_block_size,
- (gptr*) &max_system_variables.query_alloc_block_size, 0, GET_ULONG,
+ (uchar**) &global_system_variables.query_alloc_block_size,
+ (uchar**) &max_system_variables.query_alloc_block_size, 0, GET_ULONG,
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ~0L, 0, 1024, 0},
#ifdef HAVE_QUERY_CACHE
{"query_cache_limit", OPT_QUERY_CACHE_LIMIT,
"Don't cache results that are bigger than this.",
- (gptr*) &query_cache_limit, (gptr*) &query_cache_limit, 0, GET_ULONG,
+ (uchar**) &query_cache_limit, (uchar**) &query_cache_limit, 0, GET_ULONG,
REQUIRED_ARG, 1024*1024L, 0, (longlong) ULONG_MAX, 0, 1, 0},
{"query_cache_min_res_unit", OPT_QUERY_CACHE_MIN_RES_UNIT,
"minimal size of unit in wich space for results is allocated (last unit will be trimed after writing all result data.",
- (gptr*) &query_cache_min_res_unit, (gptr*) &query_cache_min_res_unit,
+ (uchar**) &query_cache_min_res_unit, (uchar**) &query_cache_min_res_unit,
0, GET_ULONG, REQUIRED_ARG, QUERY_CACHE_MIN_RESULT_DATA_SIZE,
0, (longlong) ULONG_MAX, 0, 1, 0},
#endif /*HAVE_QUERY_CACHE*/
{"query_cache_size", OPT_QUERY_CACHE_SIZE,
"The memory allocated to store results from old queries.",
- (gptr*) &query_cache_size, (gptr*) &query_cache_size, 0, GET_ULONG,
+ (uchar**) &query_cache_size, (uchar**) &query_cache_size, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, (longlong) ULONG_MAX, 0, 1024, 0},
#ifdef HAVE_QUERY_CACHE
{"query_cache_type", OPT_QUERY_CACHE_TYPE,
"0 = OFF = Don't cache or retrieve results. 1 = ON = Cache all results except SELECT SQL_NO_CACHE ... queries. 2 = DEMAND = Cache only SELECT SQL_CACHE ... queries.",
- (gptr*) &global_system_variables.query_cache_type,
- (gptr*) &max_system_variables.query_cache_type,
+ (uchar**) &global_system_variables.query_cache_type,
+ (uchar**) &max_system_variables.query_cache_type,
0, GET_ULONG, REQUIRED_ARG, 1, 0, 2, 0, 1, 0},
{"query_cache_wlock_invalidate", OPT_QUERY_CACHE_WLOCK_INVALIDATE,
"Invalidate queries in query cache on LOCK for write",
- (gptr*) &global_system_variables.query_cache_wlock_invalidate,
- (gptr*) &max_system_variables.query_cache_wlock_invalidate,
+ (uchar**) &global_system_variables.query_cache_wlock_invalidate,
+ (uchar**) &max_system_variables.query_cache_wlock_invalidate,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
#endif /*HAVE_QUERY_CACHE*/
{"query_prealloc_size", OPT_QUERY_PREALLOC_SIZE,
"Persistent buffer for query parsing and execution",
- (gptr*) &global_system_variables.query_prealloc_size,
- (gptr*) &max_system_variables.query_prealloc_size, 0, GET_ULONG,
+ (uchar**) &global_system_variables.query_prealloc_size,
+ (uchar**) &max_system_variables.query_prealloc_size, 0, GET_ULONG,
REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, QUERY_ALLOC_PREALLOC_SIZE,
~0L, 0, 1024, 0},
{"range_alloc_block_size", OPT_RANGE_ALLOC_BLOCK_SIZE,
"Allocation block size for storing ranges during optimization",
- (gptr*) &global_system_variables.range_alloc_block_size,
- (gptr*) &max_system_variables.range_alloc_block_size, 0, GET_ULONG,
+ (uchar**) &global_system_variables.range_alloc_block_size,
+ (uchar**) &max_system_variables.range_alloc_block_size, 0, GET_ULONG,
REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, 4096, ~0L, 0, 1024, 0},
{"read_buffer_size", OPT_RECORD_BUFFER,
"Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value.",
- (gptr*) &global_system_variables.read_buff_size,
- (gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &global_system_variables.read_buff_size,
+ (uchar**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, SSIZE_MAX, MALLOC_OVERHEAD, IO_SIZE,
0},
{"read_only", OPT_READONLY,
"Make all non-temporary tables read-only, with the exception for replication (slave) threads and users with the SUPER privilege",
- (gptr*) &opt_readonly,
- (gptr*) &opt_readonly,
+ (uchar**) &opt_readonly,
+ (uchar**) &opt_readonly,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
{"read_rnd_buffer_size", OPT_RECORD_RND_BUFFER,
"When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks. If not set, then it's set to the value of record_buffer.",
- (gptr*) &global_system_variables.read_rnd_buff_size,
- (gptr*) &max_system_variables.read_rnd_buff_size, 0,
+ (uchar**) &global_system_variables.read_rnd_buff_size,
+ (uchar**) &max_system_variables.read_rnd_buff_size, 0,
GET_ULONG, REQUIRED_ARG, 256*1024L, IO_SIZE*2+MALLOC_OVERHEAD,
SSIZE_MAX, MALLOC_OVERHEAD, IO_SIZE, 0},
{"record_buffer", OPT_RECORD_BUFFER,
"Alias for read_buffer_size",
- (gptr*) &global_system_variables.read_buff_size,
- (gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &global_system_variables.read_buff_size,
+ (uchar**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, SSIZE_MAX, MALLOC_OVERHEAD, IO_SIZE, 0},
#ifdef HAVE_REPLICATION
{"relay_log_purge", OPT_RELAY_LOG_PURGE,
"0 = do not purge relay logs. 1 = purge them as soon as they are no more needed.",
- (gptr*) &relay_log_purge,
- (gptr*) &relay_log_purge, 0, GET_BOOL, NO_ARG,
+ (uchar**) &relay_log_purge,
+ (uchar**) &relay_log_purge, 0, GET_BOOL, NO_ARG,
1, 0, 1, 0, 1, 0},
{"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT,
"Maximum space to use for all relay logs.",
- (gptr*) &relay_log_space_limit,
- (gptr*) &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L,
+ (uchar**) &relay_log_space_limit,
+ (uchar**) &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L,
(longlong) ULONG_MAX, 0, 1, 0},
{"slave_compressed_protocol", OPT_SLAVE_COMPRESSED_PROTOCOL,
"Use compression on master/slave protocol.",
- (gptr*) &opt_slave_compressed_protocol,
- (gptr*) &opt_slave_compressed_protocol,
+ (uchar**) &opt_slave_compressed_protocol,
+ (uchar**) &opt_slave_compressed_protocol,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
{"slave_net_timeout", OPT_SLAVE_NET_TIMEOUT,
"Number of seconds to wait for more data from a master/slave connection before aborting the read.",
- (gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 0,
+ (uchar**) &slave_net_timeout, (uchar**) &slave_net_timeout, 0,
GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"slave_transaction_retries", OPT_SLAVE_TRANS_RETRIES,
"Number of times the slave SQL thread will retry a transaction in case "
"it failed with a deadlock or elapsed lock wait timeout, "
"before giving up and stopping.",
- (gptr*) &slave_trans_retries, (gptr*) &slave_trans_retries, 0,
+ (uchar**) &slave_trans_retries, (uchar**) &slave_trans_retries, 0,
GET_ULONG, REQUIRED_ARG, 10L, 0L, (longlong) ULONG_MAX, 0, 1, 0},
#endif /* HAVE_REPLICATION */
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
"If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.",
- (gptr*) &slow_launch_time, (gptr*) &slow_launch_time, 0, GET_ULONG,
+ (uchar**) &slow_launch_time, (uchar**) &slow_launch_time, 0, GET_ULONG,
REQUIRED_ARG, 2L, 0L, LONG_TIMEOUT, 0, 1, 0},
{"sort_buffer_size", OPT_SORT_BUFFER,
"Each thread that needs to do a sort allocates a buffer of this size.",
- (gptr*) &global_system_variables.sortbuff_size,
- (gptr*) &max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &global_system_variables.sortbuff_size,
+ (uchar**) &max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG,
MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, ~0L, MALLOC_OVERHEAD,
1, 0},
{"sync-binlog", OPT_SYNC_BINLOG,
"Synchronously flush binary log to disk after every #th event. "
"Use 0 (default) to disable synchronous flushing.",
- (gptr*) &sync_binlog_period, (gptr*) &sync_binlog_period, 0, GET_ULONG,
+ (uchar**) &sync_binlog_period, (uchar**) &sync_binlog_period, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, ~0L, 0, 1, 0},
{"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default.",
- (gptr*) &opt_sync_frm, (gptr*) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0,
+ (uchar**) &opt_sync_frm, (uchar**) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0,
0, 0, 0, 0},
{"table_cache", OPT_TABLE_OPEN_CACHE,
"Deprecated; use --table_open_cache instead.",
- (gptr*) &table_cache_size, (gptr*) &table_cache_size, 0, GET_ULONG,
+ (uchar**) &table_cache_size, (uchar**) &table_cache_size, 0, GET_ULONG,
REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0},
{"table_definition_cache", OPT_TABLE_DEF_CACHE,
"The number of cached table definitions.",
- (gptr*) &table_def_size, (gptr*) &table_def_size,
+ (uchar**) &table_def_size, (uchar**) &table_def_size,
0, GET_ULONG, REQUIRED_ARG, 128, 1, 512*1024L, 0, 1, 0},
{"table_open_cache", OPT_TABLE_OPEN_CACHE,
"The number of cached open tables.",
- (gptr*) &table_cache_size, (gptr*) &table_cache_size, 0, GET_ULONG,
+ (uchar**) &table_cache_size, (uchar**) &table_cache_size, 0, GET_ULONG,
REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0},
{"table_lock_wait_timeout", OPT_TABLE_LOCK_WAIT_TIMEOUT,
"Timeout in seconds to wait for a table level lock before returning an "
"error. Used only if the connection has active cursors.",
- (gptr*) &table_lock_wait_timeout, (gptr*) &table_lock_wait_timeout,
+ (uchar**) &table_lock_wait_timeout, (uchar**) &table_lock_wait_timeout,
0, GET_ULONG, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0},
{"thread_cache_size", OPT_THREAD_CACHE_SIZE,
"How many threads we should keep in a cache for reuse.",
- (gptr*) &thread_cache_size, (gptr*) &thread_cache_size, 0, GET_ULONG,
+ (uchar**) &thread_cache_size, (uchar**) &thread_cache_size, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 16384, 0, 1, 0},
{"thread_concurrency", OPT_THREAD_CONCURRENCY,
"Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.",
- (gptr*) &concurrency, (gptr*) &concurrency, 0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &concurrency, (uchar**) &concurrency, 0, GET_ULONG, REQUIRED_ARG,
DEFAULT_CONCURRENCY, 1, 512, 0, 1, 0},
#if HAVE_POOL_OF_THREADS == 1
{"thread_pool_size", OPT_THREAD_CACHE_SIZE,
"How many threads we should create to handle query requests in case of 'thread_handling=pool-of-threads'",
- (gptr*) &thread_pool_size, (gptr*) &thread_pool_size, 0, GET_ULONG,
+ (uchar**) &thread_pool_size, (uchar**) &thread_pool_size, 0, GET_ULONG,
REQUIRED_ARG, 20, 1, 16384, 0, 1, 0},
#endif
{"thread_stack", OPT_THREAD_STACK,
- "The stack size for each thread.", (gptr*) &thread_stack,
- (gptr*) &thread_stack, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK,
+ "The stack size for each thread.", (uchar**) &thread_stack,
+ (uchar**) &thread_stack, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK,
1024L*128L, ~0L, 0, 1024, 0},
{ "time_format", OPT_TIME_FORMAT,
"The TIME format (for future).",
- (gptr*) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME],
- (gptr*) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME],
+ (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME],
+ (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME],
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmp_table_size", OPT_TMP_TABLE_SIZE,
"If an in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table.",
- (gptr*) &global_system_variables.tmp_table_size,
- (gptr*) &max_system_variables.tmp_table_size, 0, GET_ULL,
+ (uchar**) &global_system_variables.tmp_table_size,
+ (uchar**) &max_system_variables.tmp_table_size, 0, GET_ULL,
REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0},
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
"Allocation block size for various transaction-related structures",
- (gptr*) &global_system_variables.trans_alloc_block_size,
- (gptr*) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG,
+ (uchar**) &global_system_variables.trans_alloc_block_size,
+ (uchar**) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG,
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ~0L, 0, 1024, 0},
{"transaction_prealloc_size", OPT_TRANS_PREALLOC_SIZE,
"Persistent buffer for various transaction-related structures",
- (gptr*) &global_system_variables.trans_prealloc_size,
- (gptr*) &max_system_variables.trans_prealloc_size, 0, GET_ULONG,
+ (uchar**) &global_system_variables.trans_prealloc_size,
+ (uchar**) &max_system_variables.trans_prealloc_size, 0, GET_ULONG,
REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ~0L, 0, 1024, 0},
{"thread_handling", OPT_THREAD_HANDLING,
"Define threads usage for handling queries: "
@@ -6492,13 +6492,13 @@ The minimum value for this variable is 4096.",
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"updatable_views_with_limit", OPT_UPDATABLE_VIEWS_WITH_LIMIT,
"1 = YES = Don't issue an error message (warning only) if a VIEW without presence of a key of the underlying table is used in queries with a LIMIT clause for updating. 0 = NO = Prohibit update of a VIEW, which does not contain a key of the underlying table and the query uses a LIMIT clause (usually get from GUI tools).",
- (gptr*) &global_system_variables.updatable_views_with_limit,
- (gptr*) &max_system_variables.updatable_views_with_limit,
+ (uchar**) &global_system_variables.updatable_views_with_limit,
+ (uchar**) &max_system_variables.updatable_views_with_limit,
0, GET_ULONG, REQUIRED_ARG, 1, 0, 1, 0, 1, 0},
{"wait_timeout", OPT_WAIT_TIMEOUT,
"The number of seconds the server waits for activity on a connection before closing it.",
- (gptr*) &global_system_variables.net_wait_timeout,
- (gptr*) &max_system_variables.net_wait_timeout, 0, GET_ULONG,
+ (uchar**) &global_system_variables.net_wait_timeout,
+ (uchar**) &max_system_variables.net_wait_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT),
0, 1, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
@@ -7194,7 +7194,7 @@ static void mysql_init_variables(void)
prepared_stmt_count= 0;
errmesg= 0;
mysqld_unix_port= opt_mysql_tmpdir= my_bind_addr_str= NullS;
- bzero((gptr) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list));
+ bzero((uchar*) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list));
bzero((char *) &global_status_var, sizeof(global_status_var));
opt_large_pages= 0;
key_map_full.set_all();
@@ -7894,7 +7894,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
}
case OPT_FT_BOOLEAN_SYNTAX:
- if (ft_boolean_check_syntax_string((byte*) argument))
+ if (ft_boolean_check_syntax_string((uchar*) argument))
{
fprintf(stderr, "Invalid ft-boolean-syntax string: %s\n", argument);
exit(1);
@@ -7915,7 +7915,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
}
/* Initiates DEBUG - but no debugging here ! */
-static gptr *
+static uchar* *
mysql_getopt_value(const char *keyname, uint key_length,
const struct my_option *option)
{
@@ -7930,13 +7930,13 @@ mysql_getopt_value(const char *keyname, uint key_length,
exit(1);
switch (option->id) {
case OPT_KEY_BUFFER_SIZE:
- return (gptr*) &key_cache->param_buff_size;
+ return (uchar**) &key_cache->param_buff_size;
case OPT_KEY_CACHE_BLOCK_SIZE:
- return (gptr*) &key_cache->param_block_size;
+ return (uchar**) &key_cache->param_block_size;
case OPT_KEY_CACHE_DIVISION_LIMIT:
- return (gptr*) &key_cache->param_division_limit;
+ return (uchar**) &key_cache->param_division_limit;
case OPT_KEY_CACHE_AGE_THRESHOLD:
- return (gptr*) &key_cache->param_age_threshold;
+ return (uchar**) &key_cache->param_age_threshold;
}
}
}
@@ -8102,7 +8102,7 @@ static char *get_relative_path(const char *path)
*/
bool
-fn_format_relative_to_data_home(my_string to, const char *name,
+fn_format_relative_to_data_home(char * to, const char *name,
const char *dir, const char *extension)
{
char tmp_path[FN_REFLEN];
@@ -8220,7 +8220,7 @@ static ulong find_bit_type(const char *x, TYPELIB *bit_lib)
found=0;
found_end= 0;
- pos=(my_string) x;
+ pos=(char *) x;
while (*pos == ' ') pos++;
found_end= *pos == 0;
while (!found_end)
@@ -8317,7 +8317,7 @@ static void create_pid_file()
char buff[21], *end;
end= int10_to_str((long) getpid(), buff, 10);
*end++= '\n';
- if (!my_write(file, (byte*) buff, (uint) (end-buff), MYF(MY_WME | MY_NABP)))
+ if (!my_write(file, (uchar*) buff, (uint) (end-buff), MYF(MY_WME | MY_NABP)))
{
(void) my_close(file, MYF(0));
return;
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 719e2ee0d3c..ec12c4cabf3 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -108,7 +108,7 @@ extern void query_cache_insert(NET *net, const char *packet, ulong length);
#define TEST_BLOCKING 8
#define MAX_PACKET_LENGTH (256L*256L*256L-1)
-static my_bool net_write_buff(NET *net,const char *packet,ulong len);
+static my_bool net_write_buff(NET *net,const uchar *packet,ulong len);
/* Init with packet info */
@@ -117,7 +117,7 @@ my_bool my_net_init(NET *net, Vio* vio)
{
DBUG_ENTER("my_net_init");
my_net_local_init(net); /* Set some limits */
- if (!(net->buff=(uchar*) my_malloc((uint32) net->max_packet+
+ if (!(net->buff=(uchar*) my_malloc((size_t) net->max_packet+
NET_HEADER_SIZE + COMP_HEADER_SIZE,
MYF(MY_WME))))
DBUG_RETURN(1);
@@ -157,7 +157,7 @@ my_bool my_net_init(NET *net, Vio* vio)
void net_end(NET *net)
{
DBUG_ENTER("net_end");
- my_free((gptr) net->buff,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(net->buff,MYF(MY_ALLOW_ZERO_PTR));
net->buff=0;
DBUG_VOID_RETURN;
}
@@ -165,17 +165,17 @@ void net_end(NET *net)
/* Realloc the packet buffer */
-my_bool net_realloc(NET *net, ulong length)
+my_bool net_realloc(NET *net, size_t length)
{
uchar *buff;
- ulong pkt_length;
+ size_t pkt_length;
DBUG_ENTER("net_realloc");
- DBUG_PRINT("enter",("length: %lu", length));
+ DBUG_PRINT("enter",("length: %lu", (ulong) length));
if (length >= net->max_packet_size)
{
DBUG_PRINT("error", ("Packet too large. Max size: %lu",
- net->max_packet_size));
+ net->max_packet_size));
net->error= 1;
net->report_error= 1;
net->last_errno= ER_NET_PACKET_TOO_LARGE;
@@ -186,9 +186,9 @@ my_bool net_realloc(NET *net, ulong length)
We must allocate some extra bytes for the end 0 and to be able to
read big compressed blocks
*/
- if (!(buff=(uchar*) my_realloc((char*) net->buff, (uint32) pkt_length +
- NET_HEADER_SIZE + COMP_HEADER_SIZE,
- MYF(MY_WME))))
+ if (!(buff= (uchar*) my_realloc((char*) net->buff, pkt_length +
+ NET_HEADER_SIZE + COMP_HEADER_SIZE,
+ MYF(MY_WME))))
{
net->error= 1;
net->report_error= 1;
@@ -196,7 +196,7 @@ my_bool net_realloc(NET *net, ulong length)
DBUG_RETURN(1);
}
net->buff=net->write_pos=buff;
- net->buff_end=buff+(net->max_packet=pkt_length);
+ net->buff_end=buff+(net->max_packet= (ulong) pkt_length);
DBUG_RETURN(0);
}
@@ -283,7 +283,8 @@ static int net_data_is_ready(my_socket sd)
void net_clear(NET *net, my_bool clear_buffer)
{
#if !defined(EMBEDDED_LIBRARY)
- int count, ready;
+ size_t count;
+ int ready;
#endif
DBUG_ENTER("net_clear");
@@ -293,14 +294,14 @@ void net_clear(NET *net, my_bool clear_buffer)
while ((ready= net_data_is_ready(net->vio->sd)) > 0)
{
/* The socket is ready */
- if ((count= vio_read(net->vio, (char*) (net->buff),
- (uint32) net->max_packet)) > 0)
+ if ((long) (count= vio_read(net->vio, net->buff,
+ (size_t) net->max_packet)) > 0)
{
- DBUG_PRINT("info",("skipped %d bytes from file: %s",
- count, vio_description(net->vio)));
+ DBUG_PRINT("info",("skipped %ld bytes from file: %s",
+ (long) count, vio_description(net->vio)));
#if defined(EXTRA_DEBUG)
- fprintf(stderr,"Note: net_clear() skipped %d bytes from file: %s\n",
- count, vio_description(net->vio));
+ fprintf(stderr,"Note: net_clear() skipped %ld bytes from file: %s\n",
+ (long) count, vio_description(net->vio));
#endif
}
else
@@ -318,10 +319,10 @@ void net_clear(NET *net, my_bool clear_buffer)
my_bool old_mode;
if (!vio_blocking(net->vio, FALSE, &old_mode))
{
- while ((count= vio_read(net->vio, (char*) (net->buff),
- (uint32) net->max_packet)) > 0)
- DBUG_PRINT("info",("skipped %d bytes from file: %s",
- count, vio_description(net->vio)));
+ while ((long) (count= vio_read(net->vio, net->buff,
+ (size_t) net->max_packet)) > 0)
+ DBUG_PRINT("info",("skipped %ld bytes from file: %s",
+ (long) count, vio_description(net->vio)));
vio_blocking(net->vio, TRUE, &old_mode);
}
}
@@ -342,8 +343,8 @@ my_bool net_flush(NET *net)
DBUG_ENTER("net_flush");
if (net->buff != net->write_pos)
{
- error=test(net_real_write(net,(char*) net->buff,
- (ulong) (net->write_pos - net->buff)));
+ error=test(net_real_write(net, net->buff,
+ (size_t) (net->write_pos - net->buff)));
net->write_pos=net->buff;
}
/* Sync packet number if using compression */
@@ -367,7 +368,7 @@ my_bool net_flush(NET *net)
*/
my_bool
-my_net_write(NET *net,const char *packet,ulong len)
+my_net_write(NET *net,const uchar *packet,size_t len)
{
uchar buff[NET_HEADER_SIZE];
if (unlikely(!net->vio)) /* nowhere to write */
@@ -382,7 +383,7 @@ my_net_write(NET *net,const char *packet,ulong len)
const ulong z_size = MAX_PACKET_LENGTH;
int3store(buff, z_size);
buff[3]= (uchar) net->pkt_nr++;
- if (net_write_buff(net, (char*) buff, NET_HEADER_SIZE) ||
+ if (net_write_buff(net, buff, NET_HEADER_SIZE) ||
net_write_buff(net, packet, z_size))
return 1;
packet += z_size;
@@ -391,10 +392,10 @@ my_net_write(NET *net,const char *packet,ulong len)
/* Write last packet */
int3store(buff,len);
buff[3]= (uchar) net->pkt_nr++;
- if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE))
+ if (net_write_buff(net, buff, NET_HEADER_SIZE))
return 1;
#ifndef DEBUG_DATA_PACKETS
- DBUG_DUMP("packet_header",(char*) buff,NET_HEADER_SIZE);
+ DBUG_DUMP("packet_header", buff, NET_HEADER_SIZE);
#endif
return test(net_write_buff(net,packet,len));
}
@@ -429,8 +430,8 @@ my_net_write(NET *net,const char *packet,ulong len)
my_bool
net_write_command(NET *net,uchar command,
- const char *header, ulong head_len,
- const char *packet, ulong len)
+ const uchar *header, size_t head_len,
+ const uchar *packet, size_t len)
{
ulong length=len+1+head_len; /* 1 extra byte for command */
uchar buff[NET_HEADER_SIZE+1];
@@ -448,7 +449,7 @@ net_write_command(NET *net,uchar command,
{
int3store(buff, MAX_PACKET_LENGTH);
buff[3]= (uchar) net->pkt_nr++;
- if (net_write_buff(net,(char*) buff, header_size) ||
+ if (net_write_buff(net, buff, header_size) ||
net_write_buff(net, header, head_len) ||
net_write_buff(net, packet, len))
DBUG_RETURN(1);
@@ -462,9 +463,9 @@ net_write_command(NET *net,uchar command,
}
int3store(buff,length);
buff[3]= (uchar) net->pkt_nr++;
- DBUG_RETURN(test(net_write_buff(net, (char*) buff, header_size) ||
- (head_len && net_write_buff(net, (char*) header, head_len)) ||
- net_write_buff(net, packet, len) || net_flush(net)));
+ DBUG_RETURN(test(net_write_buff(net, buff, header_size) ||
+ (head_len && net_write_buff(net, header, head_len)) ||
+ net_write_buff(net, packet, len) || net_flush(net)));
}
/*
@@ -497,7 +498,7 @@ net_write_command(NET *net,uchar command,
*/
static my_bool
-net_write_buff(NET *net,const char *packet,ulong len)
+net_write_buff(NET *net, const uchar *packet, ulong len)
{
ulong left_length;
if (net->compress && net->max_packet > MAX_PACKET_LENGTH)
@@ -514,8 +515,8 @@ net_write_buff(NET *net,const char *packet,ulong len)
{
/* Fill up already used packet and write it */
memcpy((char*) net->write_pos,packet,left_length);
- if (net_real_write(net,(char*) net->buff,
- (ulong) (net->write_pos - net->buff) + left_length))
+ if (net_real_write(net, net->buff,
+ (size_t) (net->write_pos - net->buff) + left_length))
return 1;
net->write_pos= net->buff;
packet+= left_length;
@@ -552,10 +553,10 @@ net_write_buff(NET *net,const char *packet,ulong len)
*/
int
-net_real_write(NET *net,const char *packet,ulong len)
+net_real_write(NET *net,const uchar *packet, size_t len)
{
- long int length;
- char *pos,*end;
+ size_t length;
+ const uchar *pos,*end;
thr_alarm_t alarmed;
#ifndef NO_ALARM
ALARM alarm_buff;
@@ -565,7 +566,7 @@ net_real_write(NET *net,const char *packet,ulong len)
DBUG_ENTER("net_real_write");
#if defined(MYSQL_SERVER) && defined(USE_QUERY_CACHE)
- query_cache_insert(net, packet, len);
+ query_cache_insert(net, (char*) packet, len);
#endif
if (net->error == 2)
@@ -575,11 +576,11 @@ net_real_write(NET *net,const char *packet,ulong len)
#ifdef HAVE_COMPRESS
if (net->compress)
{
- ulong complen;
+ size_t complen;
uchar *b;
uint header_length=NET_HEADER_SIZE+COMP_HEADER_SIZE;
- if (!(b=(uchar*) my_malloc((uint32) len + NET_HEADER_SIZE +
- COMP_HEADER_SIZE, MYF(MY_WME))))
+ if (!(b= (uchar*) my_malloc(len + NET_HEADER_SIZE +
+ COMP_HEADER_SIZE, MYF(MY_WME))))
{
#ifdef MYSQL_SERVER
net->last_errno= ER_OUT_OF_RESOURCES;
@@ -592,18 +593,18 @@ net_real_write(NET *net,const char *packet,ulong len)
}
memcpy(b+header_length,packet,len);
- if (my_compress((byte*) b+header_length,&len,&complen))
+ if (my_compress(b+header_length, &len, &complen))
complen=0;
int3store(&b[NET_HEADER_SIZE],complen);
int3store(b,len);
b[3]=(uchar) (net->compress_pkt_nr++);
len+= header_length;
- packet= (char*) b;
+ packet= b;
}
#endif /* HAVE_COMPRESS */
#ifdef DEBUG_DATA_PACKETS
- DBUG_DUMP("data",packet,len);
+ DBUG_DUMP("data", packet, len);
#endif
#ifndef NO_ALARM
@@ -615,14 +616,15 @@ net_real_write(NET *net,const char *packet,ulong len)
/* Write timeout is set in net_set_write_timeout */
#endif /* NO_ALARM */
- pos=(char*) packet; end=pos+len;
+ pos= packet;
+ end=pos+len;
while (pos != end)
{
- if ((long) (length=vio_write(net->vio,pos,(uint32) (end-pos))) <= 0)
+ if ((long) (length= vio_write(net->vio,pos,(size_t) (end-pos))) <= 0)
{
my_bool interrupted = vio_should_retry(net->vio);
#if !defined(__WIN__)
- if ((interrupted || length==0) && !thr_alarm_in_use(&alarmed))
+ if ((interrupted || length == 0) && !thr_alarm_in_use(&alarmed))
{
if (!thr_alarm(&alarmed,(uint) net->write_timeout,&alarm_buff))
{ /* Always true for client */
@@ -701,14 +703,14 @@ net_real_write(NET *net,const char *packet,ulong len)
#ifndef NO_ALARM
-static my_bool net_safe_read(NET *net, char *buff, uint32 length,
+static my_bool net_safe_read(NET *net, uchar *buff, size_t length,
thr_alarm_t *alarmed)
{
uint retry_count=0;
while (length > 0)
{
- int tmp;
- if ((tmp=vio_read(net->vio,(char*) net->buff, length)) <= 0)
+ size_t tmp;
+ if ((long) (tmp= vio_read(net->vio, buff, length)) <= 0)
{
my_bool interrupted = vio_should_retry(net->vio);
if (!thr_got_alarm(alarmed) && interrupted)
@@ -719,6 +721,7 @@ static my_bool net_safe_read(NET *net, char *buff, uint32 length,
return 1;
}
length-= tmp;
+ buff+= tmp;
}
return 0;
}
@@ -759,15 +762,15 @@ static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed,
{
while (remain > 0)
{
- uint length= min(remain, net->max_packet);
- if (net_safe_read(net, (char*) net->buff, length, alarmed))
+ size_t length= min(remain, net->max_packet);
+ if (net_safe_read(net, net->buff, length, alarmed))
DBUG_RETURN(1);
update_statistics(thd_increment_bytes_received(length));
remain -= (uint32) length;
}
if (old != MAX_PACKET_LENGTH)
break;
- if (net_safe_read(net, (char*) net->buff, NET_HEADER_SIZE, alarmed))
+ if (net_safe_read(net, net->buff, NET_HEADER_SIZE, alarmed))
DBUG_RETURN(1);
old=remain= uint3korr(net->buff);
net->pkt_nr++;
@@ -784,10 +787,10 @@ static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed,
*/
static ulong
-my_real_read(NET *net, ulong *complen)
+my_real_read(NET *net, size_t *complen)
{
uchar *pos;
- long length;
+ size_t length;
uint i,retry_count=0;
ulong len=packet_error;
thr_alarm_t alarmed;
@@ -814,12 +817,12 @@ my_real_read(NET *net, ulong *complen)
while (remain > 0)
{
/* First read is done with non blocking mode */
- if ((int) (length=vio_read(net->vio,(char*) pos,remain)) <= 0L)
+ if ((long) (length= vio_read(net->vio, pos, remain)) <= 0L)
{
my_bool interrupted = vio_should_retry(net->vio);
DBUG_PRINT("info",("vio_read returned %ld errno: %d",
- length, vio_errno(net->vio)));
+ (long) length, vio_errno(net->vio)));
#if !defined(__WIN__) || defined(MYSQL_SERVER)
/*
We got an error that there was no data on the socket. We now set up
@@ -875,7 +878,7 @@ my_real_read(NET *net, ulong *complen)
}
#endif
DBUG_PRINT("error",("Couldn't read packet: remain: %u errno: %d length: %ld",
- remain, vio_errno(net->vio), length));
+ remain, vio_errno(net->vio), (long) length));
len= packet_error;
net->error= 2; /* Close socket */
net->report_error= 1;
@@ -886,13 +889,13 @@ my_real_read(NET *net, ulong *complen)
goto end;
}
remain -= (uint32) length;
- pos+= (ulong) length;
+ pos+= length;
update_statistics(thd_increment_bytes_received(length));
}
if (i == 0)
{ /* First parts is packet length */
ulong helping;
- DBUG_DUMP("packet_header",(char*) net->buff+net->where_b,
+ DBUG_DUMP("packet_header", net->buff+net->where_b,
NET_HEADER_SIZE);
if (net->buff[net->where_b + 3] != (uchar) net->pkt_nr)
{
@@ -963,7 +966,7 @@ end:
net->reading_or_writing=0;
#ifdef DEBUG_DATA_PACKETS
if (len != packet_error)
- DBUG_DUMP("data",(char*) net->buff+net->where_b, len);
+ DBUG_DUMP("data", net->buff+net->where_b, len);
#endif
return(len);
}
@@ -985,7 +988,7 @@ end:
ulong
my_net_read(NET *net)
{
- ulong len,complen;
+ size_t len, complen;
#ifdef HAVE_COMPRESS
if (!net->compress)
@@ -996,7 +999,7 @@ my_net_read(NET *net)
{
/* First packet of a multi-packet. Concatenate the packets */
ulong save_pos = net->where_b;
- ulong total_length=0;
+ size_t total_length= 0;
do
{
net->where_b += len;
@@ -1094,7 +1097,7 @@ my_net_read(NET *net)
net->where_b=buf_length;
if ((packet_len = my_real_read(net,&complen)) == packet_error)
return packet_error;
- if (my_uncompress((byte*) net->buff + net->where_b, &packet_len,
+ if (my_uncompress(net->buff + net->where_b, packet_len,
&complen))
{
net->error= 2; /* caller will close socket */
@@ -1104,7 +1107,7 @@ my_net_read(NET *net)
#endif
return packet_error;
}
- buf_length+=packet_len;
+ buf_length+= complen;
}
net->read_pos= net->buff+ first_packet_offset + NET_HEADER_SIZE;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index f5cf79bd609..f606e96e94c 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -80,9 +80,9 @@
*/
#define double2rows(x) ((ha_rows)(x))
-static int sel_cmp(Field *f,char *a,char *b,uint8 a_flag,uint8 b_flag);
+static int sel_cmp(Field *f,uchar *a,uchar *b,uint8 a_flag,uint8 b_flag);
-static char is_null_string[2]= {1,0};
+static uchar is_null_string[2]= {1,0};
class RANGE_OPT_PARAM;
/*
@@ -274,7 +274,7 @@ public:
ulong use_count;
Field *field;
- char *min_value,*max_value; // Pointer to range
+ uchar *min_value,*max_value; // Pointer to range
SEL_ARG *left,*right; /* R-B tree children */
SEL_ARG *next,*prev; /* Links for bi-directional interval list */
@@ -287,8 +287,8 @@ public:
SEL_ARG() {}
SEL_ARG(SEL_ARG &);
- SEL_ARG(Field *,const char *,const char *);
- SEL_ARG(Field *field, uint8 part, char *min_value, char *max_value,
+ SEL_ARG(Field *,const uchar *, const uchar *);
+ SEL_ARG(Field *field, uint8 part, uchar *min_value, uchar *max_value,
uint8 min_flag, uint8 max_flag, uint8 maybe_flag);
SEL_ARG(enum Type type_arg)
:min_flag(0),elements(1),use_count(1),left(0),next_key_part(0),
@@ -324,7 +324,7 @@ public:
}
SEL_ARG *clone_and(SEL_ARG* arg)
{ // Get overlapping range
- char *new_min,*new_max;
+ uchar *new_min,*new_max;
uint8 flag_min,flag_max;
if (cmp_min_to_min(arg) >= 0)
{
@@ -398,7 +398,7 @@ public:
min_flag=arg->max_flag & NEAR_MAX ? 0 : NEAR_MIN;
}
/* returns a number of keypart values (0 or 1) appended to the key buffer */
- int store_min(uint length,char **min_key,uint min_key_flag)
+ int store_min(uint length, uchar **min_key,uint min_key_flag)
{
if ((min_flag & GEOM_FLAG) ||
(!(min_flag & NO_MIN_RANGE) &&
@@ -417,7 +417,7 @@ public:
return 0;
}
/* returns a number of keypart values (0 or 1) appended to the key buffer */
- int store_max(uint length,char **max_key, uint max_key_flag)
+ int store_max(uint length, uchar **max_key, uint max_key_flag)
{
if (!(max_flag & NO_MAX_RANGE) &&
!(max_key_flag & (NO_MAX_RANGE | NEAR_MAX)))
@@ -436,7 +436,7 @@ public:
}
/* returns a number of keypart values appended to the key buffer */
- int store_min_key(KEY_PART *key,char **range_key, uint *range_key_flag)
+ int store_min_key(KEY_PART *key, uchar **range_key, uint *range_key_flag)
{
SEL_ARG *key_tree= first();
uint res= key_tree->store_min(key[key_tree->part].store_length,
@@ -452,7 +452,7 @@ public:
}
/* returns a number of keypart values appended to the key buffer */
- int store_max_key(KEY_PART *key,char **range_key, uint *range_key_flag)
+ int store_max_key(KEY_PART *key, uchar **range_key, uint *range_key_flag)
{
SEL_ARG *key_tree= last();
uint res=key_tree->store_max(key[key_tree->part].store_length,
@@ -534,8 +534,8 @@ public:
*/
if (min_flag || max_flag)
return FALSE;
- byte *min_val= (byte *)min_value;
- byte *max_val= (byte *)max_value;
+ uchar *min_val= min_value;
+ uchar *max_val= max_value;
if (maybe_null)
{
@@ -641,8 +641,7 @@ public:
longlong baseflag;
uint max_key_part, range_count;
-
- char min_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH],
+ uchar min_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH],
max_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH];
bool quick; // Don't calulate possible keys
@@ -683,8 +682,8 @@ static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts);
static ha_rows check_quick_select(PARAM *param,uint index,SEL_ARG *key_tree,
bool update_tbl_stats);
static ha_rows check_quick_keys(PARAM *param,uint index,SEL_ARG *key_tree,
- char *min_key, uint min_key_flag, int,
- char *max_key, uint max_key_flag, int);
+ uchar *min_key, uint min_key_flag, int,
+ uchar *max_key, uint max_key_flag, int);
QUICK_RANGE_SELECT *get_quick_select(PARAM *param,uint index,
SEL_ARG *key_tree,
@@ -726,12 +725,12 @@ static SEL_ARG *key_and(RANGE_OPT_PARAM *param, SEL_ARG *key1, SEL_ARG *key2,
uint clone_flag);
static bool get_range(SEL_ARG **e1,SEL_ARG **e2,SEL_ARG *root1);
bool get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key,
- SEL_ARG *key_tree,char *min_key,uint min_key_flag,
- char *max_key,uint max_key_flag);
+ SEL_ARG *key_tree, uchar *min_key,uint min_key_flag,
+ uchar *max_key,uint max_key_flag);
static bool eq_tree(SEL_ARG* a,SEL_ARG *b);
static SEL_ARG null_element(SEL_ARG::IMPOSSIBLE);
-static bool null_part_in_key(KEY_PART *key_part, const char *key,
+static bool null_part_in_key(KEY_PART *key_part, const uchar *key,
uint length);
bool sel_trees_can_be_ored(SEL_TREE *tree1, SEL_TREE *tree2, RANGE_OPT_PARAM* param);
@@ -986,7 +985,7 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables,
select->file= *head->sort.io_cache;
select->records=(ha_rows) (select->file.end_of_file/
head->file->ref_length);
- my_free((gptr) (head->sort.io_cache),MYF(0));
+ my_free(head->sort.io_cache, MYF(0));
head->sort.io_cache=0;
}
DBUG_RETURN(select);
@@ -1192,8 +1191,8 @@ QUICK_ROR_INTERSECT_SELECT::QUICK_ROR_INTERSECT_SELECT(THD *thd_param,
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0);
else
bzero(&alloc, sizeof(MEM_ROOT));
- last_rowid= (byte*)alloc_root(parent_alloc? parent_alloc : &alloc,
- head->file->ref_length);
+ last_rowid= (uchar*) alloc_root(parent_alloc? parent_alloc : &alloc,
+ head->file->ref_length);
}
@@ -1450,7 +1449,7 @@ int QUICK_ROR_UNION_SELECT::init()
DBUG_RETURN(1);
}
- if (!(cur_rowid= (byte*)alloc_root(&alloc, 2*head->file->ref_length)))
+ if (!(cur_rowid= (uchar*) alloc_root(&alloc, 2*head->file->ref_length)))
DBUG_RETURN(1);
prev_rowid= cur_rowid + head->file->ref_length;
DBUG_RETURN(0);
@@ -1468,7 +1467,7 @@ int QUICK_ROR_UNION_SELECT::init()
val2 Second merged select
*/
-int QUICK_ROR_UNION_SELECT::queue_cmp(void *arg, byte *val1, byte *val2)
+int QUICK_ROR_UNION_SELECT::queue_cmp(void *arg, uchar *val1, uchar *val2)
{
QUICK_ROR_UNION_SELECT *self= (QUICK_ROR_UNION_SELECT*)arg;
return self->head->file->cmp_ref(((QUICK_SELECT_I*)val1)->last_rowid,
@@ -1519,7 +1518,7 @@ int QUICK_ROR_UNION_SELECT::reset()
DBUG_RETURN(error);
}
quick->save_last_pos();
- queue_insert(&queue, (byte*)quick);
+ queue_insert(&queue, (uchar*)quick);
}
if (head->file->ha_rnd_init(1))
@@ -1580,16 +1579,18 @@ inline void SEL_ARG::make_root()
use_count=0; elements=1;
}
-SEL_ARG::SEL_ARG(Field *f,const char *min_value_arg,const char *max_value_arg)
+SEL_ARG::SEL_ARG(Field *f,const uchar *min_value_arg,
+ const uchar *max_value_arg)
:min_flag(0), max_flag(0), maybe_flag(0), maybe_null(f->real_maybe_null()),
- elements(1), use_count(1), field(f), min_value((char*) min_value_arg),
- max_value((char*) max_value_arg), next(0),prev(0),
+ elements(1), use_count(1), field(f), min_value((uchar*) min_value_arg),
+ max_value((uchar*) max_value_arg), next(0),prev(0),
next_key_part(0),color(BLACK),type(KEY_RANGE)
{
left=right= &null_element;
}
-SEL_ARG::SEL_ARG(Field *field_,uint8 part_,char *min_value_,char *max_value_,
+SEL_ARG::SEL_ARG(Field *field_,uint8 part_,
+ uchar *min_value_, uchar *max_value_,
uint8 min_flag_,uint8 max_flag_,uint8 maybe_flag_)
:min_flag(min_flag_),max_flag(max_flag_),maybe_flag(maybe_flag_),
part(part_),maybe_null(field_->real_maybe_null()), elements(1),use_count(1),
@@ -1667,7 +1668,8 @@ SEL_ARG *SEL_ARG::last()
Returns -2 or 2 if the ranges where 'joined' like < 2 and >= 2
*/
-static int sel_cmp(Field *field, char *a,char *b,uint8 a_flag,uint8 b_flag)
+static int sel_cmp(Field *field, uchar *a, uchar *b, uint8 a_flag,
+ uint8 b_flag)
{
int cmp;
/* First check if there was a compare to a min or max element */
@@ -1691,7 +1693,7 @@ static int sel_cmp(Field *field, char *a,char *b,uint8 a_flag,uint8 b_flag)
goto end; // NULL where equal
a++; b++; // Skip NULL marker
}
- cmp=field->key_cmp((byte*) a,(byte*) b);
+ cmp=field->key_cmp(a , b);
if (cmp) return cmp < 0 ? -1 : 1; // The values differed
// Check if the compared equal arguments was defined with open/closed range
@@ -1970,7 +1972,7 @@ private:
KEY *index_info;
uint index;
uint key_infix_len;
- byte key_infix[MAX_KEY_LENGTH];
+ uchar key_infix[MAX_KEY_LENGTH];
SEL_TREE *range_tree; /* Represents all range predicates in the query. */
SEL_ARG *index_tree; /* The SEL_ARG sub-tree corresponding to index_info. */
uint param_idx; /* Index of used key in param->key. */
@@ -1983,7 +1985,7 @@ public:
uint group_prefix_len_arg, uint used_key_parts_arg,
uint group_key_parts_arg, KEY *index_info_arg,
uint index_arg, uint key_infix_len_arg,
- byte *key_infix_arg,
+ uchar *key_infix_arg,
SEL_TREE *tree_arg, SEL_ARG *index_tree_arg,
uint param_idx_arg, ha_rows quick_prefix_records_arg)
: have_min(have_min_arg), have_max(have_max_arg),
@@ -2714,7 +2716,7 @@ end:
format.
*/
-void store_key_image_to_rec(Field *field, char *ptr, uint len)
+void store_key_image_to_rec(Field *field, uchar *ptr, uint len)
{
/* Do the same as print_key() does */
my_bitmap_map *old_map;
@@ -3416,7 +3418,7 @@ static void dbug_print_segment_range(SEL_ARG *arg, KEY_PART *part)
DBUG_LOCK_FILE;
if (!(arg->min_flag & NO_MIN_RANGE))
{
- store_key_image_to_rec(part->field, (char*)(arg->min_value), part->length);
+ store_key_image_to_rec(part->field, arg->min_value, part->length);
dbug_print_field(part->field);
if (arg->min_flag & NEAR_MIN)
fputs(" < ", DBUG_FILE);
@@ -3432,7 +3434,7 @@ static void dbug_print_segment_range(SEL_ARG *arg, KEY_PART *part)
fputs(" < ", DBUG_FILE);
else
fputs(" <= ", DBUG_FILE);
- store_key_image_to_rec(part->field, (char*)(arg->max_value), part->length);
+ store_key_image_to_rec(part->field, arg->max_value, part->length);
dbug_print_field(part->field);
}
fputs("\n", DBUG_FILE);
@@ -4169,8 +4171,8 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info,
{
double selectivity_mult= 1.0;
KEY_PART_INFO *key_part= info->param->table->key_info[scan->keynr].key_part;
- byte key_val[MAX_KEY_LENGTH+MAX_FIELD_WIDTH]; /* key values tuple */
- char *key_ptr= (char*) key_val;
+ uchar key_val[MAX_KEY_LENGTH+MAX_FIELD_WIDTH]; /* key values tuple */
+ uchar *key_ptr= key_val;
SEL_ARG *sel_arg, *tuple_arg= NULL;
key_part_map keypart_map= 0;
bool cur_covered;
@@ -4178,9 +4180,9 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info,
key_part->fieldnr-1));
key_range min_range;
key_range max_range;
- min_range.key= (byte*) key_val;
+ min_range.key= key_val;
min_range.flag= HA_READ_KEY_EXACT;
- max_range.key= (byte*) key_val;
+ max_range.key= key_val;
max_range.flag= HA_READ_AFTER_KEY;
ha_rows prev_records= info->param->table->file->stats.records;
DBUG_ENTER("ror_scan_selectivity");
@@ -4209,7 +4211,7 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info,
&key_ptr, 0);
keypart_map= (keypart_map << 1) | 1;
}
- min_range.length= max_range.length= ((char*) key_ptr - (char*) key_val);
+ min_range.length= max_range.length= (size_t) (key_ptr - key_val);
min_range.keypart_map= max_range.keypart_map= keypart_map;
records= (info->param->table->file->
records_in_range(scan->keynr, &min_range, &max_range));
@@ -5549,7 +5551,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
bool optimize_range;
SEL_ARG *tree= 0;
MEM_ROOT *alloc= param->mem_root;
- char *str;
+ uchar *str;
ulong orig_sql_mode;
int err;
DBUG_ENTER("get_mm_leaf");
@@ -5611,9 +5613,10 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
if (type == Item_func::LIKE_FUNC)
{
bool like_error;
- char buff1[MAX_FIELD_WIDTH],*min_str,*max_str;
+ char buff1[MAX_FIELD_WIDTH];
+ uchar *min_str,*max_str;
String tmp(buff1,sizeof(buff1),value->collation.collation),*res;
- uint length,offset,min_length,max_length;
+ size_t length, offset, min_length, max_length;
uint field_length= field->pack_length()+maybe_null;
if (!optimize_range)
@@ -5660,7 +5663,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
field_length= length;
}
length+=offset;
- if (!(min_str= (char*) alloc_root(alloc, length*2)))
+ if (!(min_str= (uchar*) alloc_root(alloc, length*2)))
goto end;
max_str=min_str+length;
@@ -5673,7 +5676,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
((Item_func_like*)(param->cond))->escape,
wild_one, wild_many,
field_length,
- min_str+offset, max_str+offset,
+ (char*) min_str+offset, (char*) max_str+offset,
&min_length, &max_length);
if (like_error) // Can't optimize with LIKE
goto end;
@@ -5735,12 +5738,13 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
goto end;
}
field->table->in_use->variables.sql_mode= orig_sql_mode;
- str= (char*) alloc_root(alloc, key_part->store_length+1);
+ str= (uchar*) alloc_root(alloc, key_part->store_length+1);
if (!str)
goto end;
if (maybe_null)
- *str= (char) field->is_real_null(); // Set to 1 if null
- field->get_key_image(str+maybe_null, key_part->length, key_part->image_type);
+ *str= (uchar) field->is_real_null(); // Set to 1 if null
+ field->get_key_image(str+maybe_null, key_part->length,
+ key_part->image_type);
if (!(tree= new (alloc) SEL_ARG(field, str, str)))
goto end; // out of memory
@@ -7244,13 +7248,13 @@ check_quick_select(PARAM *param,uint idx,SEL_ARG *tree, bool update_tbl_stats)
static ha_rows
check_quick_keys(PARAM *param, uint idx, SEL_ARG *key_tree,
- char *min_key, uint min_key_flag, int min_keypart,
- char *max_key, uint max_key_flag, int max_keypart)
+ uchar *min_key, uint min_key_flag, int min_keypart,
+ uchar *max_key, uint max_key_flag, int max_keypart)
{
ha_rows records=0, tmp;
uint tmp_min_flag, tmp_max_flag, keynr, min_key_length, max_key_length;
uint tmp_min_keypart= min_keypart, tmp_max_keypart= max_keypart;
- char *tmp_min_key, *tmp_max_key;
+ uchar *tmp_min_key, *tmp_max_key;
uint8 save_first_null_comp= param->first_null_comp;
param->max_key_part=max(param->max_key_part,key_tree->part);
@@ -7370,7 +7374,7 @@ check_quick_keys(PARAM *param, uint idx, SEL_ARG *key_tree,
if (tmp_min_flag & GEOM_FLAG)
{
key_range min_range;
- min_range.key= (byte*) param->min_key;
+ min_range.key= param->min_key;
min_range.length= min_key_length;
min_range.keypart_map= make_keypart_map(tmp_min_keypart);
/* In this case tmp_min_flag contains the handler-read-function */
@@ -7383,12 +7387,12 @@ check_quick_keys(PARAM *param, uint idx, SEL_ARG *key_tree,
{
key_range min_range, max_range;
- min_range.key= (byte*) param->min_key;
+ min_range.key= param->min_key;
min_range.length= min_key_length;
min_range.flag= (tmp_min_flag & NEAR_MIN ? HA_READ_AFTER_KEY :
HA_READ_KEY_EXACT);
min_range.keypart_map= make_keypart_map(tmp_min_keypart);
- max_range.key= (byte*) param->max_key;
+ max_range.key= param->max_key;
max_range.length= max_key_length;
max_range.flag= (tmp_max_flag & NEAR_MAX ?
HA_READ_BEFORE_KEY : HA_READ_AFTER_KEY);
@@ -7557,8 +7561,8 @@ get_quick_select(PARAM *param,uint idx,SEL_ARG *key_tree,
*/
bool
get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key,
- SEL_ARG *key_tree,char *min_key,uint min_key_flag,
- char *max_key, uint max_key_flag)
+ SEL_ARG *key_tree, uchar *min_key,uint min_key_flag,
+ uchar *max_key, uint max_key_flag)
{
QUICK_RANGE *range;
uint flag;
@@ -7571,7 +7575,7 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key,
min_key,min_key_flag, max_key, max_key_flag))
return 1;
}
- char *tmp_min_key=min_key,*tmp_max_key=max_key;
+ uchar *tmp_min_key=min_key,*tmp_max_key=max_key;
min_part+= key_tree->store_min(key[key_tree->part].store_length,
&tmp_min_key,min_key_flag);
max_part+= key_tree->store_max(key[key_tree->part].store_length,
@@ -7595,10 +7599,10 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key,
uint tmp_min_flag=key_tree->min_flag,tmp_max_flag=key_tree->max_flag;
if (!tmp_min_flag)
min_part+= key_tree->next_key_part->store_min_key(key, &tmp_min_key,
- &tmp_min_flag);
+ &tmp_min_flag);
if (!tmp_max_flag)
max_part+= key_tree->next_key_part->store_max_key(key, &tmp_max_key,
- &tmp_max_flag);
+ &tmp_max_flag);
flag=tmp_min_flag | tmp_max_flag;
}
}
@@ -7646,10 +7650,10 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key,
}
/* Get range for retrieving rows in QUICK_SELECT::get_next */
- if (!(range= new QUICK_RANGE((const char *) param->min_key,
+ if (!(range= new QUICK_RANGE(param->min_key,
(uint) (tmp_min_key - param->min_key),
min_part >=0 ? make_keypart_map(min_part) : 0,
- (const char *) param->max_key,
+ param->max_key,
(uint) (tmp_max_key - param->max_key),
max_part >=0 ? make_keypart_map(max_part) : 0,
flag)))
@@ -7658,7 +7662,7 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key,
set_if_bigger(quick->max_used_key_length, range->min_length);
set_if_bigger(quick->max_used_key_length, range->max_length);
set_if_bigger(quick->used_key_parts, (uint) key_tree->part+1);
- if (insert_dynamic(&quick->ranges, (gptr)&range))
+ if (insert_dynamic(&quick->ranges, (uchar*) &range))
return 1;
end:
@@ -7691,9 +7695,9 @@ bool QUICK_RANGE_SELECT::unique_key_range()
/* Returns TRUE if any part of the key is NULL */
-static bool null_part_in_key(KEY_PART *key_part, const char *key, uint length)
+static bool null_part_in_key(KEY_PART *key_part, const uchar *key, uint length)
{
- for (const char *end=key+length ;
+ for (const uchar *end=key+length ;
key < end;
key+= key_part++->store_length)
{
@@ -7796,7 +7800,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
!(range= new(alloc) QUICK_RANGE()))
goto err; // out of memory
- range->min_key= range->max_key= (char*) ref->key_buff;
+ range->min_key= range->max_key= ref->key_buff;
range->min_length= range->max_length= ref->key_length;
range->min_keypart_map= range->max_keypart_map=
make_prev_keypart_map(ref->key_parts);
@@ -7817,7 +7821,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
key_part->null_bit= key_info->key_part[part].null_bit;
key_part->flag= (uint8) key_info->key_part[part].key_part_flag;
}
- if (insert_dynamic(&quick->ranges,(gptr)&range))
+ if (insert_dynamic(&quick->ranges,(uchar*)&range))
goto err;
/*
@@ -7832,13 +7836,13 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
*ref->null_ref_key= 1; // Set null byte then create a range
if (!(null_range= new (alloc)
- QUICK_RANGE((char*)ref->key_buff, ref->key_length,
+ QUICK_RANGE(ref->key_buff, ref->key_length,
make_prev_keypart_map(ref->key_parts),
- (char*)ref->key_buff, ref->key_length,
+ ref->key_buff, ref->key_length,
make_prev_keypart_map(ref->key_parts), EQ_RANGE)))
goto err;
*ref->null_ref_key= 0; // Clear null byte
- if (insert_dynamic(&quick->ranges,(gptr)&null_range))
+ if (insert_dynamic(&quick->ranges,(uchar*)&null_range))
goto err;
}
@@ -8093,7 +8097,7 @@ int QUICK_ROR_UNION_SELECT::get_next()
{
int error, dup_row;
QUICK_SELECT_I *quick;
- byte *tmp;
+ uchar *tmp;
DBUG_ENTER("QUICK_ROR_UNION_SELECT::get_next");
do
@@ -8143,7 +8147,7 @@ int QUICK_ROR_UNION_SELECT::get_next()
int QUICK_RANGE_SELECT::reset()
{
uint mrange_bufsiz;
- byte *mrange_buff;
+ uchar *mrange_buff;
DBUG_ENTER("QUICK_RANGE_SELECT::reset");
next=0;
last_range= NULL;
@@ -8186,8 +8190,9 @@ int QUICK_RANGE_SELECT::reset()
while (mrange_bufsiz &&
! my_multi_malloc(MYF(MY_WME),
- &multi_range_buff, sizeof(*multi_range_buff),
- &mrange_buff, mrange_bufsiz,
+ &multi_range_buff,
+ (uint) sizeof(*multi_range_buff),
+ &mrange_buff, (uint) mrange_bufsiz,
NullS))
{
/* Try to shrink the buffers until both are 0. */
@@ -8282,13 +8287,13 @@ int QUICK_RANGE_SELECT::get_next()
end_key= &mrange_slot->end_key;
last_range= *(cur_range++);
- start_key->key= (const byte*) last_range->min_key;
+ start_key->key= (const uchar*) last_range->min_key;
start_key->length= last_range->min_length;
start_key->flag= ((last_range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY :
(last_range->flag & EQ_RANGE) ?
HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT);
start_key->keypart_map= last_range->min_keypart_map;
- end_key->key= (const byte*) last_range->max_key;
+ end_key->key= (const uchar*) last_range->max_key;
end_key->length= last_range->max_length;
/*
We use HA_READ_AFTER_KEY here because if we are reading on a key
@@ -8348,7 +8353,7 @@ end:
int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length,
key_part_map keypart_map,
- byte *cur_prefix)
+ uchar *cur_prefix)
{
DBUG_ENTER("QUICK_RANGE_SELECT::get_next_prefix");
@@ -8374,13 +8379,13 @@ int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length,
}
last_range= *(cur_range++);
- start_key.key= (const byte*) last_range->min_key;
+ start_key.key= (const uchar*) last_range->min_key;
start_key.length= min(last_range->min_length, prefix_length);
start_key.keypart_map= last_range->min_keypart_map & keypart_map;
start_key.flag= ((last_range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY :
(last_range->flag & EQ_RANGE) ?
HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT);
- end_key.key= (const byte*) last_range->max_key;
+ end_key.key= (const uchar*) last_range->max_key;
end_key.length= min(last_range->max_length, prefix_length);
end_key.keypart_map= last_range->max_keypart_map & keypart_map;
/*
@@ -8416,7 +8421,7 @@ int QUICK_RANGE_SELECT_GEOM::get_next()
if (last_range)
{
// Already read through key
- result= file->index_next_same(record, (byte*) last_range->min_key,
+ result= file->index_next_same(record, last_range->min_key,
last_range->min_length);
if (result != HA_ERR_END_OF_FILE)
DBUG_RETURN(result);
@@ -8431,7 +8436,7 @@ int QUICK_RANGE_SELECT_GEOM::get_next()
}
last_range= *(cur_range++);
- result= file->index_read(record, (byte*) last_range->min_key,
+ result= file->index_read(record, last_range->min_key,
last_range->min_keypart_map,
(ha_rkey_function)(last_range->flag ^ GEOM_FLAG));
if (result != HA_ERR_KEY_NOT_FOUND && result != HA_ERR_END_OF_FILE)
@@ -8536,7 +8541,7 @@ int QUICK_SELECT_DESC::get_next()
if (last_range)
{ // Already read through key
result = ((last_range->flag & EQ_RANGE)
- ? file->index_next_same(record, (byte*) last_range->min_key,
+ ? file->index_next_same(record, last_range->min_key,
last_range->min_length) :
file->index_prev(record));
if (!result)
@@ -8564,14 +8569,14 @@ int QUICK_SELECT_DESC::get_next()
if (last_range->flag & EQ_RANGE)
{
- result = file->index_read(record, (byte*) last_range->max_key,
+ result = file->index_read(record, last_range->max_key,
last_range->max_keypart_map, HA_READ_KEY_EXACT);
}
else
{
DBUG_ASSERT(last_range->flag & NEAR_MAX ||
range_reads_after_key(last_range));
- result=file->index_read(record, (byte*) last_range->max_key,
+ result=file->index_read(record, last_range->max_key,
last_range->max_keypart_map,
((last_range->flag & NEAR_MAX) ?
HA_READ_BEFORE_KEY :
@@ -8608,7 +8613,7 @@ int QUICK_RANGE_SELECT::cmp_next(QUICK_RANGE *range_arg)
KEY_PART *key_part=key_parts;
uint store_length;
- for (char *key=range_arg->max_key, *end=key+range_arg->max_length;
+ for (uchar *key=range_arg->max_key, *end=key+range_arg->max_length;
key < end;
key+= store_length, key_part++)
{
@@ -8627,7 +8632,7 @@ int QUICK_RANGE_SELECT::cmp_next(QUICK_RANGE *range_arg)
key++; // Skip null byte
store_length--;
}
- if ((cmp=key_part->field->key_cmp((byte*) key, key_part->length)) < 0)
+ if ((cmp=key_part->field->key_cmp(key, key_part->length)) < 0)
return 0;
if (cmp > 0)
return 1;
@@ -8646,7 +8651,7 @@ int QUICK_RANGE_SELECT::cmp_prev(QUICK_RANGE *range_arg)
if (range_arg->flag & NO_MIN_RANGE)
return 0; /* key can't be to small */
- cmp= key_cmp(key_part_info, (byte*) range_arg->min_key,
+ cmp= key_cmp(key_part_info, range_arg->min_key,
range_arg->min_length);
if (cmp > 0 || cmp == 0 && !(range_arg->flag & NEAR_MIN))
return 0;
@@ -8896,7 +8901,7 @@ static bool get_constant_key_infix(KEY *index_info, SEL_ARG *index_range_tree,
KEY_PART_INFO *first_non_group_part,
KEY_PART_INFO *min_max_arg_part,
KEY_PART_INFO *last_part, THD *thd,
- byte *key_infix, uint *key_infix_len,
+ uchar *key_infix, uint *key_infix_len,
KEY_PART_INFO **first_non_infix_part);
static bool
check_group_min_max_predicates(COND *cond, Item_field *min_max_arg_item,
@@ -9053,7 +9058,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
uint index= 0; /* The id of the chosen index. */
uint group_key_parts= 0; // Number of index key parts in the group prefix.
uint used_key_parts= 0; /* Number of index key parts used for access. */
- byte key_infix[MAX_KEY_LENGTH]; /* Constants from equality predicates.*/
+ uchar key_infix[MAX_KEY_LENGTH]; /* Constants from equality predicates.*/
uint key_infix_len= 0; /* Length of key_infix. */
TRP_GROUP_MIN_MAX *read_plan= NULL; /* The eventually constructed TRP. */
uint key_part_nr;
@@ -9337,7 +9342,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
/* Check if cur_part is referenced in the WHERE clause. */
if (join->conds->walk(&Item::find_item_in_field_list_processor, 0,
- (byte*) key_part_range))
+ (uchar*) key_part_range))
goto next_index;
}
}
@@ -9607,7 +9612,7 @@ get_constant_key_infix(KEY *index_info, SEL_ARG *index_range_tree,
KEY_PART_INFO *first_non_group_part,
KEY_PART_INFO *min_max_arg_part,
KEY_PART_INFO *last_part, THD *thd,
- byte *key_infix, uint *key_infix_len,
+ uchar *key_infix, uint *key_infix_len,
KEY_PART_INFO **first_non_infix_part)
{
SEL_ARG *cur_range;
@@ -9616,7 +9621,7 @@ get_constant_key_infix(KEY *index_info, SEL_ARG *index_range_tree,
KEY_PART_INFO *end_part= min_max_arg_part ? min_max_arg_part : last_part;
*key_infix_len= 0;
- byte *key_ptr= key_infix;
+ uchar *key_ptr= key_infix;
for (cur_part= first_non_group_part; cur_part != end_part; cur_part++)
{
/*
@@ -10006,7 +10011,7 @@ QUICK_GROUP_MIN_MAX_SELECT(TABLE *table, JOIN *join_arg, bool have_min_arg,
uint used_key_parts_arg, KEY *index_info_arg,
uint use_index, double read_cost_arg,
ha_rows records_arg, uint key_infix_len_arg,
- byte *key_infix_arg, MEM_ROOT *parent_alloc)
+ uchar *key_infix_arg, MEM_ROOT *parent_alloc)
:join(join_arg), index_info(index_info_arg),
group_prefix_len(group_prefix_len_arg), have_min(have_min_arg),
have_max(have_max_arg), seen_first_key(FALSE),
@@ -10064,13 +10069,13 @@ int QUICK_GROUP_MIN_MAX_SELECT::init()
if (group_prefix) /* Already initialized. */
return 0;
- if (!(last_prefix= (byte*) alloc_root(&alloc, group_prefix_len)))
+ if (!(last_prefix= (uchar*) alloc_root(&alloc, group_prefix_len)))
return 1;
/*
We may use group_prefix to store keys with all select fields, so allocate
enough space for it.
*/
- if (!(group_prefix= (byte*) alloc_root(&alloc,
+ if (!(group_prefix= (uchar*) alloc_root(&alloc,
real_prefix_len + min_max_arg_len)))
return 1;
@@ -10080,7 +10085,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::init()
The memory location pointed to by key_infix will be deleted soon, so
allocate a new buffer and copy the key_infix into it.
*/
- byte *tmp_key_infix= (byte*) alloc_root(&alloc, key_infix_len);
+ uchar *tmp_key_infix= (uchar*) alloc_root(&alloc, key_infix_len);
if (!tmp_key_infix)
return 1;
memcpy(tmp_key_infix, this->key_infix, key_infix_len);
@@ -10195,7 +10200,7 @@ bool QUICK_GROUP_MIN_MAX_SELECT::add_range(SEL_ARG *sel_range)
range_flag);
if (!range)
return TRUE;
- if (insert_dynamic(&min_max_ranges, (gptr)&range))
+ if (insert_dynamic(&min_max_ranges, (uchar*)&range))
return TRUE;
return FALSE;
}
@@ -10230,7 +10235,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::adjust_prefix_ranges ()
{
QUICK_RANGE *range;
- get_dynamic(arr, (gptr)&range, inx);
+ get_dynamic(arr, (uchar*)&range, inx);
range->flag &= ~(NEAR_MIN | NEAR_MAX);
}
}
@@ -10266,7 +10271,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::update_key_stat()
QUICK_RANGE *cur_range;
if (have_min)
{ /* Check if the right-most range has a lower boundary. */
- get_dynamic(&min_max_ranges, (gptr)&cur_range,
+ get_dynamic(&min_max_ranges, (uchar*)&cur_range,
min_max_ranges.elements - 1);
if (!(cur_range->flag & NO_MIN_RANGE))
{
@@ -10277,7 +10282,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::update_key_stat()
}
if (have_max)
{ /* Check if the left-most range has an upper boundary. */
- get_dynamic(&min_max_ranges, (gptr)&cur_range, 0);
+ get_dynamic(&min_max_ranges, (uchar*)&cur_range, 0);
if (!(cur_range->flag & NO_MAX_RANGE))
{
max_used_key_length+= min_max_arg_len;
@@ -10603,7 +10608,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_prefix()
if (quick_prefix_select)
{
- byte *cur_prefix= seen_first_key ? group_prefix : NULL;
+ uchar *cur_prefix= seen_first_key ? group_prefix : NULL;
if ((result= quick_prefix_select->get_next_prefix(group_prefix_len,
make_prev_keypart_map(group_key_parts), cur_prefix)))
DBUG_RETURN(result);
@@ -10673,14 +10678,14 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min_in_range()
for (uint range_idx= 0; range_idx < min_max_ranges.elements; range_idx++)
{ /* Search from the left-most range to the right. */
- get_dynamic(&min_max_ranges, (gptr)&cur_range, range_idx);
+ get_dynamic(&min_max_ranges, (uchar*)&cur_range, range_idx);
/*
If the current value for the min/max argument is bigger than the right
boundary of cur_range, there is no need to check this range.
*/
if (range_idx != 0 && !(cur_range->flag & NO_MAX_RANGE) &&
- (key_cmp(min_max_arg_part, (const byte*) cur_range->max_key,
+ (key_cmp(min_max_arg_part, (const uchar*) cur_range->max_key,
min_max_arg_len) == 1))
continue;
@@ -10741,7 +10746,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min_in_range()
if ( !(cur_range->flag & NO_MAX_RANGE) )
{
/* Compose the MAX key for the range. */
- byte *max_key= (byte*) my_alloca(real_prefix_len + min_max_arg_len);
+ uchar *max_key= (uchar*) my_alloca(real_prefix_len + min_max_arg_len);
memcpy(max_key, group_prefix, real_prefix_len);
memcpy(max_key + real_prefix_len, cur_range->max_key,
cur_range->max_length);
@@ -10805,7 +10810,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range()
for (uint range_idx= min_max_ranges.elements; range_idx > 0; range_idx--)
{ /* Search from the right-most range to the left. */
- get_dynamic(&min_max_ranges, (gptr)&cur_range, range_idx - 1);
+ get_dynamic(&min_max_ranges, (uchar*)&cur_range, range_idx - 1);
/*
If the current value for the min/max argument is smaller than the left
@@ -10813,7 +10818,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range()
*/
if (range_idx != min_max_ranges.elements &&
!(cur_range->flag & NO_MIN_RANGE) &&
- (key_cmp(min_max_arg_part, (const byte*) cur_range->min_key,
+ (key_cmp(min_max_arg_part, (const uchar*) cur_range->min_key,
min_max_arg_len) == -1))
continue;
@@ -10859,7 +10864,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range()
if ( !(cur_range->flag & NO_MIN_RANGE) )
{
/* Compose the MIN key for the range. */
- byte *min_key= (byte*) my_alloca(real_prefix_len + min_max_arg_len);
+ uchar *min_key= (uchar*) my_alloca(real_prefix_len + min_max_arg_len);
memcpy(min_key, group_prefix, real_prefix_len);
memcpy(min_key + real_prefix_len, cur_range->min_key,
cur_range->min_length);
@@ -11030,10 +11035,10 @@ static void print_ror_scans_arr(TABLE *table, const char *msg,
*****************************************************************************/
static void
-print_key(KEY_PART *key_part,const char *key,uint used_length)
+print_key(KEY_PART *key_part, const uchar *key, uint used_length)
{
char buff[1024];
- const char *key_end= key+used_length;
+ const uchar *key_end= key+used_length;
String tmp(buff,sizeof(buff),&my_charset_bin);
uint store_length;
TABLE *table= key_part->field->table;
@@ -11056,7 +11061,7 @@ print_key(KEY_PART *key_part,const char *key,uint used_length)
key++; // Skip null byte
store_length--;
}
- field->set_key_image((char*) key, key_part->length);
+ field->set_key_image(key, key_part->length);
if (field->type() == MYSQL_TYPE_BIT)
(void) field->val_int_as_str(&tmp, 1);
else
@@ -11111,7 +11116,7 @@ void QUICK_RANGE_SELECT::dbug_dump(int indent, bool verbose)
range= *pr;
if (!(range->flag & NO_MIN_RANGE))
{
- print_key(key_parts,range->min_key,range->min_length);
+ print_key(key_parts, range->min_key, range->min_length);
if (range->flag & NEAR_MIN)
fputs(" < ",DBUG_FILE);
else
@@ -11125,7 +11130,7 @@ void QUICK_RANGE_SELECT::dbug_dump(int indent, bool verbose)
fputs(" < ",DBUG_FILE);
else
fputs(" <= ",DBUG_FILE);
- print_key(key_parts,range->max_key,range->max_length);
+ print_key(key_parts, range->max_key, range->max_length);
}
fputs("\n",DBUG_FILE);
}
diff --git a/sql/opt_range.h b/sql/opt_range.h
index 1ad9567cddd..d86cab11ef3 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -35,7 +35,7 @@ typedef struct st_key_part {
class QUICK_RANGE :public Sql_alloc {
public:
- char *min_key,*max_key;
+ uchar *min_key,*max_key;
uint16 min_length,max_length,flag;
key_part_map min_keypart_map, // bitmap of used keyparts in min_key
max_keypart_map; // bitmap of used keyparts in max_key
@@ -43,13 +43,13 @@ class QUICK_RANGE :public Sql_alloc {
uint16 dummy; /* Avoid warnings on 'flag' */
#endif
QUICK_RANGE(); /* Full range */
- QUICK_RANGE(const char *min_key_arg, uint min_length_arg,
+ QUICK_RANGE(const uchar *min_key_arg, uint min_length_arg,
key_part_map min_keypart_map_arg,
- const char *max_key_arg, uint max_length_arg,
+ const uchar *max_key_arg, uint max_length_arg,
key_part_map max_keypart_map_arg,
uint flag_arg)
- : min_key((char*) sql_memdup(min_key_arg,min_length_arg+1)),
- max_key((char*) sql_memdup(max_key_arg,max_length_arg+1)),
+ : min_key((uchar*) sql_memdup(min_key_arg,min_length_arg+1)),
+ max_key((uchar*) sql_memdup(max_key_arg,max_length_arg+1)),
min_length((uint16) min_length_arg),
max_length((uint16) max_length_arg),
min_keypart_map(min_keypart_map_arg),
@@ -241,12 +241,12 @@ public:
rowid of last row retrieved by this quick select. This is used only when
doing ROR-index_merge selects
*/
- byte *last_rowid;
+ uchar *last_rowid;
/*
Table record buffer used by this quick select.
*/
- byte *record;
+ uchar *record;
#ifndef DBUG_OFF
/*
Print quick select information to DBUG_FILE. Caller is responsible
@@ -296,8 +296,8 @@ protected:
friend bool get_quick_keys(PARAM *param,
QUICK_RANGE_SELECT *quick,KEY_PART *key,
SEL_ARG *key_tree,
- char *min_key, uint min_key_flag,
- char *max_key, uint max_key_flag);
+ uchar *min_key, uint min_key_flag,
+ uchar *max_key, uint max_key_flag);
friend QUICK_RANGE_SELECT *get_quick_select(PARAM*,uint idx,
SEL_ARG *key_tree,
MEM_ROOT *alloc);
@@ -327,7 +327,7 @@ public:
int get_next();
void range_end();
int get_next_prefix(uint prefix_length, key_part_map keypart_map,
- byte *cur_prefix);
+ uchar *cur_prefix);
bool reverse_sorted() { return 0; }
bool unique_key_range();
int init_ror_merged_scan(bool reuse_handler);
@@ -561,12 +561,12 @@ public:
MEM_ROOT alloc; /* Memory pool for this and merged quick selects data. */
THD *thd; /* current thread */
- byte *cur_rowid; /* buffer used in get_next() */
- byte *prev_rowid; /* rowid of last row returned by get_next() */
+ uchar *cur_rowid; /* buffer used in get_next() */
+ uchar *prev_rowid; /* rowid of last row returned by get_next() */
bool have_prev_rowid; /* true if prev_rowid has valid data */
uint rowid_length; /* table rowid length */
private:
- static int queue_cmp(void *arg, byte *val1, byte *val2);
+ static int queue_cmp(void *arg, uchar *val1, uchar *val2);
bool scans_inited;
};
@@ -610,19 +610,19 @@ private:
handler *file; /* The handler used to get data. */
JOIN *join; /* Descriptor of the current query */
KEY *index_info; /* The index chosen for data access */
- byte *record; /* Buffer where the next record is returned. */
- byte *tmp_record; /* Temporary storage for next_min(), next_max(). */
- byte *group_prefix; /* Key prefix consisting of the GROUP fields. */
+ uchar *record; /* Buffer where the next record is returned. */
+ uchar *tmp_record; /* Temporary storage for next_min(), next_max(). */
+ uchar *group_prefix; /* Key prefix consisting of the GROUP fields. */
uint group_prefix_len; /* Length of the group prefix. */
uint group_key_parts; /* A number of keyparts in the group prefix */
- byte *last_prefix; /* Prefix of the last group for detecting EOF. */
+ uchar *last_prefix; /* Prefix of the last group for detecting EOF. */
bool have_min; /* Specify whether we are computing */
bool have_max; /* a MIN, a MAX, or both. */
bool seen_first_key; /* Denotes whether the first key was retrieved.*/
KEY_PART_INFO *min_max_arg_part; /* The keypart of the only argument field */
/* of all MIN/MAX functions. */
uint min_max_arg_len; /* The length of the MIN/MAX argument field */
- byte *key_infix; /* Infix of constants from equality predicates. */
+ uchar *key_infix; /* Infix of constants from equality predicates. */
uint key_infix_len;
DYNAMIC_ARRAY min_max_ranges; /* Array of range ptrs for the MIN/MAX field. */
uint real_prefix_len; /* Length of key prefix extended with key_infix. */
@@ -652,7 +652,7 @@ public:
uint group_prefix_len, uint group_key_parts,
uint used_key_parts, KEY *index_info, uint
use_index, double read_cost, ha_rows records, uint
- key_infix_len, byte *key_infix, MEM_ROOT
+ key_infix_len, uchar *key_infix, MEM_ROOT
*parent_alloc);
~QUICK_GROUP_MIN_MAX_SELECT();
bool add_range(SEL_ARG *sel_range);
@@ -736,7 +736,7 @@ uint get_index_for_order(TABLE *table, ORDER *order, ha_rows limit);
#ifdef WITH_PARTITION_STORAGE_ENGINE
bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond);
-void store_key_image_to_rec(Field *field, char *ptr, uint len);
+void store_key_image_to_rec(Field *field, uchar *ptr, uint len);
#endif
#endif
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index f9a06f3fb6e..83023b59867 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -222,7 +222,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
Item *expr=item_sum->args[0];
if (expr->real_item()->type() == Item::FIELD_ITEM)
{
- byte key_buff[MAX_KEY_LENGTH];
+ uchar key_buff[MAX_KEY_LENGTH];
TABLE_REF ref;
uint range_fl, prefix_len;
@@ -309,7 +309,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
Item *expr=item_sum->args[0];
if (expr->real_item()->type() == Item::FIELD_ITEM)
{
- byte key_buff[MAX_KEY_LENGTH];
+ uchar key_buff[MAX_KEY_LENGTH];
TABLE_REF ref;
uint range_fl, prefix_len;
@@ -603,7 +603,7 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
less_fl= 1-less_fl; // Convert '<' -> '>' (etc)
/* Check if field is part of the tested partial key */
- byte *key_ptr= ref->key_buff;
+ uchar *key_ptr= ref->key_buff;
KEY_PART_INFO *part;
for (part= keyinfo->key_part; ; key_ptr+= part++->store_length)
@@ -652,15 +652,15 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
if (is_null)
{
part->field->set_null();
- *key_ptr= (byte) 1;
+ *key_ptr= (uchar) 1;
}
else
{
store_val_in_field(part->field, args[between && max_fl ? 2 : 1],
CHECK_FIELD_IGNORE);
if (part->null_bit)
- *key_ptr++= (byte) test(part->field->is_null());
- part->field->get_key_image((char*) key_ptr, part->length, Field::itRAW);
+ *key_ptr++= (uchar) test(part->field->is_null());
+ part->field->get_key_image(key_ptr, part->length, Field::itRAW);
}
if (is_field_part)
{
diff --git a/sql/parse_file.cc b/sql/parse_file.cc
index f06c7c15202..5ea49396cb4 100644
--- a/sql/parse_file.cc
+++ b/sql/parse_file.cc
@@ -49,27 +49,27 @@ write_escaped_string(IO_CACHE *file, LEX_STRING *val_s)
*/
switch(*ptr) {
case '\\': // escape character
- if (my_b_append(file, (const byte *)STRING_WITH_LEN("\\\\")))
+ if (my_b_append(file, (const uchar *)STRING_WITH_LEN("\\\\")))
return TRUE;
break;
case '\n': // parameter value delimiter
- if (my_b_append(file, (const byte *)STRING_WITH_LEN("\\n")))
+ if (my_b_append(file, (const uchar *)STRING_WITH_LEN("\\n")))
return TRUE;
break;
case '\0': // problem for some string processing utilities
- if (my_b_append(file, (const byte *)STRING_WITH_LEN("\\0")))
+ if (my_b_append(file, (const uchar *)STRING_WITH_LEN("\\0")))
return TRUE;
break;
case 26: // problem for windows utilities (Ctrl-Z)
- if (my_b_append(file, (const byte *)STRING_WITH_LEN("\\z")))
+ if (my_b_append(file, (const uchar *)STRING_WITH_LEN("\\z")))
return TRUE;
break;
case '\'': // list of string delimiter
- if (my_b_append(file, (const byte *)STRING_WITH_LEN("\\\'")))
+ if (my_b_append(file, (const uchar *)STRING_WITH_LEN("\\\'")))
return TRUE;
break;
default:
- if (my_b_append(file, (const byte *)ptr, 1))
+ if (my_b_append(file, (const uchar *)ptr, 1))
return TRUE;
}
}
@@ -93,7 +93,7 @@ write_escaped_string(IO_CACHE *file, LEX_STRING *val_s)
*/
static my_bool
-write_parameter(IO_CACHE *file, gptr base, File_option *parameter,
+write_parameter(IO_CACHE *file, uchar* base, File_option *parameter,
ulonglong *old_version)
{
char num_buf[20]; // buffer for numeric operations
@@ -105,7 +105,7 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter,
case FILE_OPTIONS_STRING:
{
LEX_STRING *val_s= (LEX_STRING *)(base + parameter->offset);
- if (my_b_append(file, (const byte *)val_s->str, val_s->length))
+ if (my_b_append(file, (const uchar *)val_s->str, val_s->length))
DBUG_RETURN(TRUE);
break;
}
@@ -118,7 +118,7 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter,
case FILE_OPTIONS_ULONGLONG:
{
num.set(*((ulonglong *)(base + parameter->offset)), &my_charset_bin);
- if (my_b_append(file, (const byte *)num.ptr(), num.length()))
+ if (my_b_append(file, (const uchar *)num.ptr(), num.length()))
DBUG_RETURN(TRUE);
break;
}
@@ -127,7 +127,7 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter,
ulonglong *val_i= (ulonglong *)(base + parameter->offset);
*old_version= (*val_i)++;
num.set(*val_i, &my_charset_bin);
- if (my_b_append(file, (const byte *)num.ptr(), num.length()))
+ if (my_b_append(file, (const uchar *)num.ptr(), num.length()))
DBUG_RETURN(TRUE);
break;
}
@@ -140,7 +140,7 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter,
get_date(val_s->str, GETDATE_DATE_TIME|GETDATE_GMT|GETDATE_FIXEDLENGTH,
tm);
val_s->length= PARSE_FILE_TIMESTAMPLENGTH;
- if (my_b_append(file, (const byte *)val_s->str,
+ if (my_b_append(file, (const uchar *)val_s->str,
PARSE_FILE_TIMESTAMPLENGTH))
DBUG_RETURN(TRUE);
break;
@@ -154,10 +154,10 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter,
while ((str= it++))
{
// We need ' ' after string to detect list continuation
- if ((!first && my_b_append(file, (const byte *)STRING_WITH_LEN(" "))) ||
- my_b_append(file, (const byte *)STRING_WITH_LEN("\'")) ||
+ if ((!first && my_b_append(file, (const uchar *)STRING_WITH_LEN(" "))) ||
+ my_b_append(file, (const uchar *)STRING_WITH_LEN("\'")) ||
write_escaped_string(file, str) ||
- my_b_append(file, (const byte *)STRING_WITH_LEN("\'")))
+ my_b_append(file, (const uchar *)STRING_WITH_LEN("\'")))
{
DBUG_RETURN(TRUE);
}
@@ -175,8 +175,8 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter,
{
num.set(*val, &my_charset_bin);
// We need ' ' after string to detect list continuation
- if ((!first && my_b_append(file, (const byte *)STRING_WITH_LEN(" "))) ||
- my_b_append(file, (const byte *)num.ptr(), num.length()))
+ if ((!first && my_b_append(file, (const uchar *)STRING_WITH_LEN(" "))) ||
+ my_b_append(file, (const uchar *)num.ptr(), num.length()))
{
DBUG_RETURN(TRUE);
}
@@ -212,7 +212,7 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter,
my_bool
sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
const LEX_STRING *type,
- gptr base, File_option *parameters,
+ uchar* base, File_option *parameters,
uint max_versions)
{
File handler;
@@ -254,19 +254,19 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
goto err_w_file;
// write header (file signature)
- if (my_b_append(&file, (const byte *)STRING_WITH_LEN("TYPE=")) ||
- my_b_append(&file, (const byte *)type->str, type->length) ||
- my_b_append(&file, (const byte *)STRING_WITH_LEN("\n")))
+ if (my_b_append(&file, (const uchar *)STRING_WITH_LEN("TYPE=")) ||
+ my_b_append(&file, (const uchar *)type->str, type->length) ||
+ my_b_append(&file, (const uchar *)STRING_WITH_LEN("\n")))
goto err_w_file;
// write parameters to temporary file
for (param= parameters; param->name.str; param++)
{
- if (my_b_append(&file, (const byte *)param->name.str,
+ if (my_b_append(&file, (const uchar *)param->name.str,
param->name.length) ||
- my_b_append(&file, (const byte *)STRING_WITH_LEN("=")) ||
+ my_b_append(&file, (const uchar *)STRING_WITH_LEN("=")) ||
write_parameter(&file, base, param, &old_version) ||
- my_b_append(&file, (const byte *)STRING_WITH_LEN("\n")))
+ my_b_append(&file, (const uchar *)STRING_WITH_LEN("\n")))
goto err_w_cache;
}
@@ -423,7 +423,7 @@ sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root,
bool bad_format_errors)
{
MY_STAT stat_info;
- uint len;
+ size_t len;
char *end, *sign;
File_parser *parser;
File file;
@@ -445,7 +445,7 @@ sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root,
DBUG_RETURN(0);
}
- if (!(parser->buff= alloc_root(mem_root, stat_info.st_size+1)))
+ if (!(parser->buff= (char*) alloc_root(mem_root, stat_info.st_size+1)))
{
DBUG_RETURN(0);
}
@@ -455,7 +455,7 @@ sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root,
DBUG_RETURN(0);
}
- if ((len= my_read(file, (byte *)parser->buff,
+ if ((len= my_read(file, (uchar *)parser->buff,
stat_info.st_size, MYF(MY_WME))) ==
MY_FILE_ERROR)
{
@@ -533,11 +533,8 @@ parse_string(char *ptr, char *end, MEM_ROOT *mem_root, LEX_STRING *str)
str->length= eol - ptr;
- if (!(str->str= alloc_root(mem_root, str->length+1)))
+ if (!(str->str= strmake_root(mem_root, ptr, str->length)))
return 0;
-
- memcpy(str->str, ptr, str->length);
- str->str[str->length]= '\0'; // just for safety
return eol+1;
}
@@ -623,7 +620,7 @@ parse_escaped_string(char *ptr, char *end, MEM_ROOT *mem_root, LEX_STRING *str)
char *eol= strchr(ptr, '\n');
if (eol == 0 || eol >= end ||
- !(str->str= alloc_root(mem_root, (eol - ptr) + 1)) ||
+ !(str->str= (char*) alloc_root(mem_root, (eol - ptr) + 1)) ||
read_escaped_string(ptr, eol, str))
return 0;
@@ -668,7 +665,7 @@ parse_quoted_escaped_string(char *ptr, char *end,
// process string
if (eol >= end ||
- !(str->str= alloc_root(mem_root, result_len + 1)) ||
+ !(str->str= (char*) alloc_root(mem_root, result_len + 1)) ||
read_escaped_string(ptr, eol, str))
return 0;
@@ -691,7 +688,7 @@ parse_quoted_escaped_string(char *ptr, char *end,
*/
bool get_file_options_ulllist(char *&ptr, char *end, char *line,
- gptr base, File_option *parameter,
+ uchar* base, File_option *parameter,
MEM_ROOT *mem_root)
{
List<ulonglong> *nlist= (List<ulonglong>*)(base + parameter->offset);
@@ -754,7 +751,7 @@ nlist_err:
*/
my_bool
-File_parser::parse(gptr base, MEM_ROOT *mem_root,
+File_parser::parse(uchar* base, MEM_ROOT *mem_root,
struct File_option *parameters, uint required,
Unknown_key_hook *hook)
{
@@ -963,7 +960,7 @@ list_err:
bool
File_parser_dummy_hook::process_unknown_string(char *&unknown_key,
- gptr base, MEM_ROOT *mem_root,
+ uchar* base, MEM_ROOT *mem_root,
char *end)
{
DBUG_ENTER("file_parser_dummy_hook::process_unknown_string");
diff --git a/sql/parse_file.h b/sql/parse_file.h
index 21873b32904..91700959681 100644
--- a/sql/parse_file.h
+++ b/sql/parse_file.h
@@ -50,7 +50,7 @@ class Unknown_key_hook
public:
Unknown_key_hook() {} /* Remove gcc warning */
virtual ~Unknown_key_hook() {} /* Remove gcc warning */
- virtual bool process_unknown_string(char *&unknown_key, gptr base,
+ virtual bool process_unknown_string(char *&unknown_key, uchar* base,
MEM_ROOT *mem_root, char *end)= 0;
};
@@ -61,14 +61,14 @@ class File_parser_dummy_hook: public Unknown_key_hook
{
public:
File_parser_dummy_hook() {} /* Remove gcc warning */
- virtual bool process_unknown_string(char *&unknown_key, gptr base,
+ virtual bool process_unknown_string(char *&unknown_key, uchar* base,
MEM_ROOT *mem_root, char *end);
};
extern File_parser_dummy_hook file_parser_dummy_hook;
bool get_file_options_ulllist(char *&ptr, char *end, char *line,
- gptr base, File_option *parameter,
+ uchar* base, File_option *parameter,
MEM_ROOT *mem_root);
char *
@@ -81,7 +81,7 @@ File_parser *sql_parse_prepare(const LEX_STRING *file_name,
my_bool
sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
const LEX_STRING *type,
- gptr base, File_option *parameters, uint versions);
+ uchar* base, File_option *parameters, uint versions);
my_bool rename_in_schema_file(const char *schema, const char *old_name,
const char *new_name, ulonglong revision,
uint num_view_backups);
@@ -97,7 +97,7 @@ public:
my_bool ok() { return content_ok; }
LEX_STRING *type() { return &file_type; }
- my_bool parse(gptr base, MEM_ROOT *mem_root,
+ my_bool parse(uchar* base, MEM_ROOT *mem_root,
struct File_option *parameters, uint required,
Unknown_key_hook *hook);
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 3e0257f5b1d..23bc3c96e8f 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -90,10 +90,11 @@ partition_info *partition_info::get_clone()
#define MAX_PART_NAME_SIZE 8
-char *partition_info::create_default_partition_names(uint part_no, uint no_parts,
+char *partition_info::create_default_partition_names(uint part_no,
+ uint no_parts,
uint start_no)
{
- char *ptr= sql_calloc(no_parts*MAX_PART_NAME_SIZE);
+ char *ptr= (char*) sql_calloc(no_parts*MAX_PART_NAME_SIZE);
char *move_ptr= ptr;
uint i= 0;
DBUG_ENTER("create_default_partition_names");
@@ -129,7 +130,7 @@ char *partition_info::create_subpartition_name(uint subpart_no,
const char *part_name)
{
uint size_alloc= strlen(part_name) + MAX_PART_NAME_SIZE;
- char *ptr= sql_calloc(size_alloc);
+ char *ptr= (char*) sql_calloc(size_alloc);
DBUG_ENTER("create_subpartition_name");
if (likely(ptr != NULL))
@@ -902,7 +903,7 @@ void partition_info::print_no_partition_found(TABLE *table)
bool partition_info::set_up_charset_field_preps()
{
Field *field, **ptr;
- char **char_ptrs;
+ uchar **char_ptrs;
unsigned i;
bool found;
size_t size;
@@ -927,14 +928,14 @@ bool partition_info::set_up_charset_field_preps()
}
}
size= tot_part_fields * sizeof(char*);
- if (!(char_ptrs= (char**)sql_calloc(size)))
+ if (!(char_ptrs= (uchar**)sql_calloc(size)))
goto error;
part_field_buffers= char_ptrs;
- if (!(char_ptrs= (char**)sql_calloc(size)))
+ if (!(char_ptrs= (uchar**)sql_calloc(size)))
goto error;
restore_part_field_ptrs= char_ptrs;
size= (tot_part_fields + 1) * sizeof(Field*);
- if (!(char_ptrs= (char**)sql_alloc(size)))
+ if (!(char_ptrs= (uchar**)sql_alloc(size)))
goto error;
part_charset_field_array= (Field**)char_ptrs;
ptr= part_field_array;
@@ -943,9 +944,9 @@ bool partition_info::set_up_charset_field_preps()
{
if (field_is_partition_charset(field))
{
- char *field_buf;
+ uchar *field_buf;
size= field->pack_length();
- if (!(field_buf= sql_calloc(size)))
+ if (!(field_buf= (uchar*) sql_calloc(size)))
goto error;
part_charset_field_array[i]= field;
part_field_buffers[i++]= field_buf;
@@ -964,14 +965,14 @@ bool partition_info::set_up_charset_field_preps()
tot_subpart_fields++;
}
size= tot_subpart_fields * sizeof(char*);
- if (!(char_ptrs= (char**)sql_calloc(size)))
+ if (!(char_ptrs= (uchar**) sql_calloc(size)))
goto error;
subpart_field_buffers= char_ptrs;
- if (!(char_ptrs= (char**)sql_calloc(size)))
+ if (!(char_ptrs= (uchar**) sql_calloc(size)))
goto error;
restore_subpart_field_ptrs= char_ptrs;
size= (tot_subpart_fields + 1) * sizeof(Field*);
- if (!(char_ptrs= (char**)sql_alloc(size)))
+ if (!(char_ptrs= (uchar**) sql_alloc(size)))
goto error;
subpart_charset_field_array= (Field**)char_ptrs;
i= 0;
@@ -979,7 +980,7 @@ bool partition_info::set_up_charset_field_preps()
{
unsigned j= 0;
CHARSET_INFO *cs;
- char *field_buf;
+ uchar *field_buf;
LINT_INIT(field_buf);
if (!field_is_partition_charset(field))
@@ -995,12 +996,12 @@ bool partition_info::set_up_charset_field_preps()
if (!found)
{
tot_fields++;
- if (!(field_buf= sql_calloc(size)))
+ if (!(field_buf= (uchar*) sql_calloc(size)))
goto error;
}
subpart_field_buffers[i++]= field_buf;
}
- if (!(char_ptrs= (char**)sql_calloc(size)))
+ if (!(char_ptrs= (uchar**) sql_calloc(size)))
goto error;
restore_subpart_field_ptrs= char_ptrs;
}
@@ -1009,14 +1010,14 @@ bool partition_info::set_up_charset_field_preps()
uint j,k,l;
size= tot_fields*sizeof(char**);
- if (!(char_ptrs= (char**)sql_calloc(size)))
+ if (!(char_ptrs= (uchar**)sql_calloc(size)))
goto error;
full_part_field_buffers= char_ptrs;
- if (!(char_ptrs= (char**)sql_calloc(size)))
+ if (!(char_ptrs= (uchar**)sql_calloc(size)))
goto error;
restore_full_part_field_ptrs= char_ptrs;
size= (tot_fields + 1) * sizeof(char**);
- if (!(char_ptrs= (char**)sql_calloc(size)))
+ if (!(char_ptrs= (uchar**)sql_calloc(size)))
goto error;
full_part_charset_field_array= (Field**)char_ptrs;
for (i= 0; i < tot_part_fields; i++)
diff --git a/sql/partition_info.h b/sql/partition_info.h
index 6c21002c184..ce2f2a7b358 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -87,12 +87,12 @@ public:
partition functions we must allocate field buffers for the field of
the fields in the partition function.
*/
- char **part_field_buffers;
- char **subpart_field_buffers;
- char **full_part_field_buffers;
- char **restore_part_field_ptrs;
- char **restore_subpart_field_ptrs;
- char **restore_full_part_field_ptrs;
+ uchar **part_field_buffers;
+ uchar **subpart_field_buffers;
+ uchar **full_part_field_buffers;
+ uchar **restore_part_field_ptrs;
+ uchar **restore_subpart_field_ptrs;
+ uchar **restore_full_part_field_ptrs;
Item *part_expr;
Item *subpart_expr;
diff --git a/sql/protocol.cc b/sql/protocol.cc
index d537fd346f9..2ed241c4c98 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -33,9 +33,9 @@ static void write_eof_packet(THD *thd, NET *net);
#endif
#ifndef EMBEDDED_LIBRARY
-bool Protocol::net_store_data(const char *from, uint length)
+bool Protocol::net_store_data(const uchar *from, size_t length)
#else
-bool Protocol_binary::net_store_data(const char *from, uint length)
+bool Protocol_binary::net_store_data(const uchar *from, size_t length)
#endif
{
ulong packet_length=packet->length();
@@ -46,10 +46,9 @@ bool Protocol_binary::net_store_data(const char *from, uint length)
if (packet_length+9+length > packet->alloced_length() &&
packet->realloc(packet_length+9+length))
return 1;
- char *to=(char*) net_store_length((char*) packet->ptr()+packet_length,
- length);
+ uchar *to= net_store_length((uchar*) packet->ptr()+packet_length, length);
memcpy(to,from,length);
- packet->length((uint) (to+length-packet->ptr()));
+ packet->length((uint) (to+length-(uchar*) packet->ptr()));
return 0;
}
@@ -227,7 +226,7 @@ net_printf_error(THD *thd, uint errcode, ...)
memcpy(pos+3, mysql_errno_to_sqlstate(errcode), SQLSTATE_LENGTH);
}
}
- VOID(net_real_write(net,(char*) net->buff,length+head_length+1+offset));
+ VOID(net_real_write(net, net->buff, length+head_length+1+offset));
#else
net->last_errno= errcode;
strmake(net->last_error, text_pos, length);
@@ -271,7 +270,7 @@ void
send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message)
{
NET *net= &thd->net;
- char buff[MYSQL_ERRMSG_SIZE+10],*pos;
+ uchar buff[MYSQL_ERRMSG_SIZE+10],*pos;
DBUG_ENTER("send_ok");
if (net->no_send_ok || !net->vio) // hack for re-parsing queries
@@ -307,8 +306,8 @@ send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message)
pos+=2;
}
if (message)
- pos=net_store_data((char*) pos, message, strlen(message));
- VOID(my_net_write(net,buff,(uint) (pos-buff)));
+ pos= net_store_data(pos, (uchar*) message, strlen(message));
+ VOID(my_net_write(net, buff, (size_t) (pos-buff)));
VOID(net_flush(net));
/* We can't anymore send an error to the client */
thd->net.report_error= 0;
@@ -318,7 +317,7 @@ send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message)
DBUG_VOID_RETURN;
}
-static char eof_buff[1]= { (char) 254 }; /* Marker for end of fields */
+static uchar eof_buff[1]= { (uchar) 254 }; /* Marker for end of fields */
/*
Send eof (= end of result set) to the client
@@ -383,7 +382,7 @@ static void write_eof_packet(THD *thd, NET *net)
if (thd->is_fatal_error)
thd->server_status&= ~SERVER_MORE_RESULTS_EXISTS;
int2store(buff+3, thd->server_status);
- VOID(my_net_write(net, (char*) buff, 5));
+ VOID(my_net_write(net, buff, 5));
}
else
VOID(my_net_write(net, eof_buff, 1));
@@ -411,7 +410,7 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
{
NET *net= &thd->net;
uint length;
- char buff[MYSQL_ERRMSG_SIZE+2], *pos;
+ uchar buff[MYSQL_ERRMSG_SIZE+2], *pos;
DBUG_ENTER("send_error_packet");
@@ -433,17 +432,19 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
{
/* The first # is to make the protocol backward compatible */
buff[2]= '#';
- pos= strmov(buff+3, mysql_errno_to_sqlstate(sql_errno));
+ pos= (uchar*) strmov((char*) buff+3, mysql_errno_to_sqlstate(sql_errno));
}
- length= (uint) (strmake(pos, err, MYSQL_ERRMSG_SIZE-1) - buff);
- err=buff;
+ length= (uint) (strmake((char*) pos, err, MYSQL_ERRMSG_SIZE-1) -
+ (char*) buff);
+ err= (char*) buff;
}
else
{
length=(uint) strlen(err);
set_if_smaller(length,MYSQL_ERRMSG_SIZE-1);
}
- VOID(net_write_command(net,(uchar) 255, "", 0, (char*) err,length));
+ VOID(net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) err,
+ length));
DBUG_VOID_RETURN;
}
@@ -459,17 +460,16 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
ulonglong for bigger numbers.
*/
-static char *net_store_length_fast(char *pkg, uint length)
+static uchar *net_store_length_fast(uchar *packet, uint length)
{
- uchar *packet=(uchar*) pkg;
if (length < 251)
{
*packet=(uchar) length;
- return (char*) packet+1;
+ return packet+1;
}
*packet++=252;
int2store(packet,(uint) length);
- return (char*) packet+2;
+ return packet+2;
}
@@ -480,14 +480,14 @@ static char *net_store_length_fast(char *pkg, uint length)
/* The following will only be used for short strings < 65K */
-char *net_store_data(char *to,const char *from, uint length)
+uchar *net_store_data(uchar *to, const uchar *from, size_t length)
{
to=net_store_length_fast(to,length);
memcpy(to,from,length);
return to+length;
}
-char *net_store_data(char *to,int32 from)
+uchar *net_store_data(uchar *to,int32 from)
{
char buff[20];
uint length=(uint) (int10_to_str(from,buff,10)-buff);
@@ -496,7 +496,7 @@ char *net_store_data(char *to,int32 from)
return to+length;
}
-char *net_store_data(char *to,longlong from)
+uchar *net_store_data(uchar *to,longlong from)
{
char buff[22];
uint length=(uint) (longlong10_to_str(from,buff,10)-buff);
@@ -555,7 +555,7 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
{
List_iterator_fast<Item> it(*list);
Item *item;
- char buff[80];
+ uchar buff[80];
String tmp((char*) buff,sizeof(buff),&my_charset_bin);
Protocol_text prot(thd);
String *local_packet= prot.storage_packet();
@@ -564,8 +564,8 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
if (flags & SEND_NUM_ROWS)
{ // Packet with number of elements
- char *pos=net_store_length(buff, list->elements);
- (void) my_net_write(&thd->net, buff,(uint) (pos-buff));
+ uchar *pos= net_store_length(buff, list->elements);
+ (void) my_net_write(&thd->net, buff, (size_t) (pos-buff));
}
#ifndef DBUG_OFF
@@ -698,7 +698,8 @@ err:
bool Protocol::write()
{
DBUG_ENTER("Protocol::write");
- DBUG_RETURN(my_net_write(&thd->net, packet->ptr(), packet->length()));
+ DBUG_RETURN(my_net_write(&thd->net, (uchar*) packet->ptr(),
+ packet->length()));
}
#endif /* EMBEDDED_LIBRARY */
@@ -785,7 +786,7 @@ bool Protocol_text::store_null()
and store in network buffer.
*/
-bool Protocol::store_string_aux(const char *from, uint length,
+bool Protocol::store_string_aux(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
{
/* 'tocs' is set 0 when client issues SET character_set_results=NULL */
@@ -794,15 +795,15 @@ bool Protocol::store_string_aux(const char *from, uint length,
tocs != &my_charset_bin)
{
uint dummy_errors;
- return convert->copy(from, length, fromcs, tocs, &dummy_errors) ||
- net_store_data(convert->ptr(), convert->length());
+ return (convert->copy(from, length, fromcs, tocs, &dummy_errors) ||
+ net_store_data((uchar*) convert->ptr(), convert->length()));
}
- return net_store_data(from, length);
+ return net_store_data((uchar*) from, length);
}
-bool Protocol_text::store(const char *from, uint length,
- CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
+bool Protocol_text::store(const char *from, size_t length,
+ CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
{
#ifndef DBUG_OFF
DBUG_ASSERT(field_types == 0 ||
@@ -817,7 +818,7 @@ bool Protocol_text::store(const char *from, uint length,
}
-bool Protocol_text::store(const char *from, uint length,
+bool Protocol_text::store(const char *from, size_t length,
CHARSET_INFO *fromcs)
{
CHARSET_INFO *tocs= this->thd->variables.character_set_results;
@@ -841,8 +842,8 @@ bool Protocol_text::store_tiny(longlong from)
field_pos++;
#endif
char buff[20];
- return net_store_data((char*) buff,
- (uint) (int10_to_str((int) from,buff, -10)-buff));
+ return net_store_data((uchar*) buff,
+ (size_t) (int10_to_str((int) from, buff, -10) - buff));
}
@@ -855,8 +856,9 @@ bool Protocol_text::store_short(longlong from)
field_pos++;
#endif
char buff[20];
- return net_store_data((char*) buff,
- (uint) (int10_to_str((int) from,buff, -10)-buff));
+ return net_store_data((uchar*) buff,
+ (size_t) (int10_to_str((int) from, buff, -10) -
+ buff));
}
@@ -869,8 +871,9 @@ bool Protocol_text::store_long(longlong from)
field_pos++;
#endif
char buff[20];
- return net_store_data((char*) buff,
- (uint) (int10_to_str((long int)from,buff, (from <0)?-10:10)-buff));
+ return net_store_data((uchar*) buff,
+ (size_t) (int10_to_str((long int)from, buff,
+ (from <0)?-10:10)-buff));
}
@@ -882,10 +885,10 @@ bool Protocol_text::store_longlong(longlong from, bool unsigned_flag)
field_pos++;
#endif
char buff[22];
- return net_store_data((char*) buff,
- (uint) (longlong10_to_str(from,buff,
- unsigned_flag ? 10 : -10)-
- buff));
+ return net_store_data((uchar*) buff,
+ (size_t) (longlong10_to_str(from,buff,
+ unsigned_flag ? 10 : -10)-
+ buff));
}
@@ -899,7 +902,7 @@ bool Protocol_text::store_decimal(const my_decimal *d)
char buff[DECIMAL_MAX_STR_LENGTH];
String str(buff, sizeof(buff), &my_charset_bin);
(void) my_decimal2string(E_DEC_FATAL_ERROR, d, 0, 0, 0, &str);
- return net_store_data(str.ptr(), str.length());
+ return net_store_data((uchar*) str.ptr(), str.length());
}
@@ -911,7 +914,7 @@ bool Protocol_text::store(float from, uint32 decimals, String *buffer)
field_pos++;
#endif
buffer->set_real((double) from, decimals, thd->charset());
- return net_store_data((char*) buffer->ptr(), buffer->length());
+ return net_store_data((uchar*) buffer->ptr(), buffer->length());
}
@@ -923,7 +926,7 @@ bool Protocol_text::store(double from, uint32 decimals, String *buffer)
field_pos++;
#endif
buffer->set_real(from, decimals, thd->charset());
- return net_store_data((char*) buffer->ptr(), buffer->length());
+ return net_store_data((uchar*) buffer->ptr(), buffer->length());
}
@@ -979,8 +982,9 @@ bool Protocol_text::store(MYSQL_TIME *tm)
(int) tm->minute,
(int) tm->second));
if (tm->second_part)
- length+= my_sprintf(buff+length,(buff+length, ".%06d", (int)tm->second_part));
- return net_store_data((char*) buff, length);
+ length+= my_sprintf(buff+length,(buff+length, ".%06d",
+ (int)tm->second_part));
+ return net_store_data((uchar*) buff, length);
}
@@ -992,8 +996,8 @@ bool Protocol_text::store_date(MYSQL_TIME *tm)
field_pos++;
#endif
char buff[MAX_DATE_STRING_REP_LENGTH];
- int length= my_date_to_str(tm, buff);
- return net_store_data(buff, (uint) length);
+ size_t length= my_date_to_str(tm, buff);
+ return net_store_data((uchar*) buff, length);
}
@@ -1020,7 +1024,7 @@ bool Protocol_text::store_time(MYSQL_TIME *tm)
(int) tm->second));
if (tm->second_part)
length+= my_sprintf(buff+length,(buff+length, ".%06d", (int)tm->second_part));
- return net_store_data((char*) buff, length);
+ return net_store_data((uchar*) buff, length);
}
@@ -1057,12 +1061,12 @@ bool Protocol_binary::prepare_for_send(List<Item> *item_list)
void Protocol_binary::prepare_for_resend()
{
packet->length(bit_fields+1);
- bzero((char*) packet->ptr(), 1+bit_fields);
+ bzero((uchar*) packet->ptr(), 1+bit_fields);
field_pos=0;
}
-bool Protocol_binary::store(const char *from, uint length,
+bool Protocol_binary::store(const char *from, size_t length,
CHARSET_INFO *fromcs)
{
CHARSET_INFO *tocs= thd->variables.character_set_results;
@@ -1070,7 +1074,7 @@ bool Protocol_binary::store(const char *from, uint length,
return store_string_aux(from, length, fromcs, tocs);
}
-bool Protocol_binary::store(const char *from,uint length,
+bool Protocol_binary::store(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
{
field_pos++;
diff --git a/sql/protocol.h b/sql/protocol.h
index e0672240e0e..46a2b6d36b6 100644
--- a/sql/protocol.h
+++ b/sql/protocol.h
@@ -35,14 +35,14 @@ protected:
#endif
uint field_count;
#ifndef EMBEDDED_LIBRARY
- bool net_store_data(const char *from, uint length);
+ bool net_store_data(const uchar *from, size_t length);
#else
- virtual bool net_store_data(const char *from, uint length);
+ virtual bool net_store_data(const uchar *from, size_t length);
char **next_field;
MYSQL_FIELD *next_mysql_field;
MEM_ROOT *alloc;
#endif
- bool store_string_aux(const char *from, uint length,
+ bool store_string_aux(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
public:
Protocol() {}
@@ -83,8 +83,8 @@ public:
virtual bool store_long(longlong from)=0;
virtual bool store_longlong(longlong from, bool unsigned_flag)=0;
virtual bool store_decimal(const my_decimal *)=0;
- virtual bool store(const char *from, uint length, CHARSET_INFO *cs)=0;
- virtual bool store(const char *from, uint length,
+ virtual bool store(const char *from, size_t length, CHARSET_INFO *cs)=0;
+ virtual bool store(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)=0;
virtual bool store(float from, uint32 decimals, String *buffer)=0;
virtual bool store(double from, uint32 decimals, String *buffer)=0;
@@ -124,8 +124,8 @@ public:
virtual bool store_long(longlong from);
virtual bool store_longlong(longlong from, bool unsigned_flag);
virtual bool store_decimal(const my_decimal *);
- virtual bool store(const char *from, uint length, CHARSET_INFO *cs);
- virtual bool store(const char *from, uint length,
+ virtual bool store(const char *from, size_t length, CHARSET_INFO *cs);
+ virtual bool store(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
virtual bool store(MYSQL_TIME *time);
virtual bool store_date(MYSQL_TIME *time);
@@ -151,7 +151,7 @@ public:
virtual void prepare_for_resend();
#ifdef EMBEDDED_LIBRARY
virtual bool write();
- bool net_store_data(const char *from, uint length);
+ bool net_store_data(const uchar *from, size_t length);
#endif
virtual bool store_null();
virtual bool store_tiny(longlong from);
@@ -159,8 +159,8 @@ public:
virtual bool store_long(longlong from);
virtual bool store_longlong(longlong from, bool unsigned_flag);
virtual bool store_decimal(const my_decimal *);
- virtual bool store(const char *from,uint length, CHARSET_INFO *cs);
- virtual bool store(const char *from, uint length,
+ virtual bool store(const char *from, size_t length, CHARSET_INFO *cs);
+ virtual bool store(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
virtual bool store(MYSQL_TIME *time);
virtual bool store_date(MYSQL_TIME *time);
@@ -178,7 +178,7 @@ void send_ok(THD *thd, ha_rows affected_rows=0L, ulonglong id=0L,
const char *info=0);
void send_eof(THD *thd);
bool send_old_password_request(THD *thd);
-char *net_store_data(char *to,const char *from, uint length);
-char *net_store_data(char *to,int32 from);
-char *net_store_data(char *to,longlong from);
+uchar *net_store_data(uchar *to,const uchar *from, size_t length);
+uchar *net_store_data(uchar *to,int32 from);
+uchar *net_store_data(uchar *to,longlong from);
diff --git a/sql/records.cc b/sql/records.cc
index 0fb9f4f9650..81c26da4b4d 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -432,7 +432,7 @@ static int rr_unpack_from_tempfile(READ_RECORD *info)
static int rr_from_pointers(READ_RECORD *info)
{
int tmp;
- byte *cache_pos;
+ uchar *cache_pos;
for (;;)
{
@@ -502,7 +502,7 @@ static int init_rr_cache(THD *thd, READ_RECORD *info)
// We have to allocate one more byte to use uint3korr (see comments for it)
if (info->cache_records <= 2 ||
- !(info->cache=(byte*) my_malloc_lock(rec_cache_size+info->cache_records*
+ !(info->cache=(uchar*) my_malloc_lock(rec_cache_size+info->cache_records*
info->struct_length+1,
MYF(0))))
DBUG_RETURN(1);
@@ -523,7 +523,7 @@ static int rr_from_cache(READ_RECORD *info)
ulong length;
my_off_t rest_of_file;
int16 error;
- byte *position,*ref_position,*record_pos;
+ uchar *position,*ref_position,*record_pos;
ulong record;
for (;;)
@@ -560,7 +560,7 @@ static int rr_from_cache(READ_RECORD *info)
ref_position=info->read_positions;
for (i=0 ; i < length ; i++,position+=info->ref_length)
{
- memcpy(ref_position,position,(size_s) info->ref_length);
+ memcpy(ref_position,position,(size_t) info->ref_length);
ref_position+=MAX_REFLENGTH;
int3store(ref_position,(long) i);
ref_position+=3;
@@ -570,7 +570,7 @@ static int rr_from_cache(READ_RECORD *info)
position=info->read_positions;
for (i=0 ; i < length ; i++)
{
- memcpy(info->ref_pos,position,(size_s) info->ref_length);
+ memcpy(info->ref_pos,position,(size_t) info->ref_length);
position+=MAX_REFLENGTH;
record=uint3korr(position);
position+=3;
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 6470f15e458..8bab1ff1ca3 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -134,9 +134,9 @@ void unregister_slave(THD* thd, bool only_mine, bool need_mutex)
SLAVE_INFO* old_si;
if ((old_si = (SLAVE_INFO*)hash_search(&slave_list,
- (byte*)&thd->server_id, 4)) &&
+ (uchar*)&thd->server_id, 4)) &&
(!only_mine || old_si->thd == thd))
- hash_delete(&slave_list, (byte*)old_si);
+ hash_delete(&slave_list, (uchar*)old_si);
if (need_mutex)
pthread_mutex_unlock(&LOCK_slave_list);
@@ -180,12 +180,12 @@ int register_slave(THD* thd, uchar* packet, uint packet_length)
pthread_mutex_lock(&LOCK_slave_list);
unregister_slave(thd,0,0);
- res= my_hash_insert(&slave_list, (byte*) si);
+ res= my_hash_insert(&slave_list, (uchar*) si);
pthread_mutex_unlock(&LOCK_slave_list);
return res;
err:
- my_free((gptr) si, MYF(MY_WME));
+ my_free(si, MYF(MY_WME));
my_message(ER_UNKNOWN_ERROR, "Wrong parameters to function register_slave",
MYF(0));
err2:
@@ -193,7 +193,7 @@ err2:
}
extern "C" uint32
-*slave_list_key(SLAVE_INFO* si, uint* len,
+*slave_list_key(SLAVE_INFO* si, size_t *len,
my_bool not_used __attribute__((unused)))
{
*len = 4;
@@ -202,7 +202,7 @@ extern "C" uint32
extern "C" void slave_info_free(void *s)
{
- my_free((gptr) s, MYF(MY_WME));
+ my_free(s, MYF(MY_WME));
}
void init_slave_list()
@@ -531,7 +531,7 @@ HOSTS";
SLAVE_INFO* si, *old_si;
log_server_id = atoi(row[0]);
if ((old_si= (SLAVE_INFO*)hash_search(&slave_list,
- (byte*)&log_server_id,4)))
+ (uchar*)&log_server_id,4)))
si = old_si;
else
{
@@ -542,7 +542,7 @@ HOSTS";
goto err;
}
si->server_id = log_server_id;
- my_hash_insert(&slave_list, (byte*)si);
+ my_hash_insert(&slave_list, (uchar*)si);
}
strmake(si->host, row[1], sizeof(si->host)-1);
si->port = atoi(row[port_ind]);
diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc
index f76f798f6a6..bb5db0106eb 100644
--- a/sql/rpl_filter.cc
+++ b/sql/rpl_filter.cc
@@ -103,12 +103,12 @@ Rpl_filter::tables_ok(const char* db, TABLE_LIST* tables)
len= (uint) (strmov(end, tables->table_name) - hash_key);
if (do_table_inited) // if there are any do's
{
- if (hash_search(&do_table, (byte*) hash_key, len))
+ if (hash_search(&do_table, (uchar*) hash_key, len))
DBUG_RETURN(1);
}
if (ignore_table_inited) // if there are any ignores
{
- if (hash_search(&ignore_table, (byte*) hash_key, len))
+ if (hash_search(&ignore_table, (uchar*) hash_key, len))
DBUG_RETURN(0);
}
if (wild_do_table_inited &&
@@ -319,7 +319,7 @@ Rpl_filter::add_table_rule(HASH* h, const char* table_spec)
e->key_len= len;
memcpy(e->db, table_spec, len);
- return my_hash_insert(h, (byte*)e);
+ return my_hash_insert(h, (uchar*)e);
}
@@ -340,7 +340,7 @@ Rpl_filter::add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec)
e->tbl_name= e->db + (dot - table_spec) + 1;
e->key_len= len;
memcpy(e->db, table_spec, len);
- insert_dynamic(a, (gptr)&e);
+ insert_dynamic(a, (uchar*)&e);
return 0;
}
@@ -363,13 +363,13 @@ Rpl_filter::add_ignore_db(const char* table_spec)
}
-static byte* get_table_key(const byte* a, uint* len,
+static uchar* get_table_key(const uchar* a, size_t *len,
my_bool __attribute__((unused)))
{
TABLE_RULE_ENT *e= (TABLE_RULE_ENT *) a;
*len= e->key_len;
- return (byte*)e->db;
+ return (uchar*)e->db;
}
@@ -377,7 +377,7 @@ static void free_table_ent(void* a)
{
TABLE_RULE_ENT *e= (TABLE_RULE_ENT *) a;
- my_free((gptr) e, MYF(0));
+ my_free((uchar*) e, MYF(0));
}
@@ -408,7 +408,7 @@ Rpl_filter::find_wild(DYNAMIC_ARRAY *a, const char* key, int len)
for (i= 0; i < a->elements; i++)
{
TABLE_RULE_ENT* e ;
- get_dynamic(a, (gptr)&e, i);
+ get_dynamic(a, (uchar*)&e, i);
if (!my_wildcmp(system_charset_info, key, key_end,
(const char*)e->db,
(const char*)(e->db + e->key_len),
@@ -427,7 +427,7 @@ Rpl_filter::free_string_array(DYNAMIC_ARRAY *a)
for (i= 0; i < a->elements; i++)
{
char* p;
- get_dynamic(a, (gptr) &p, i);
+ get_dynamic(a, (uchar*) &p, i);
my_free(p, MYF(MY_WME));
}
delete_dynamic(a);
@@ -474,7 +474,7 @@ Rpl_filter::table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a,
for (uint i= 0; i < a->elements; i++)
{
TABLE_RULE_ENT* e;
- get_dynamic(a, (gptr)&e, i);
+ get_dynamic(a, (uchar*)&e, i);
if (s->length())
s->append(',');
s->append(e->db,e->key_len);
@@ -512,7 +512,7 @@ Rpl_filter::get_wild_ignore_table(String* str)
const char*
-Rpl_filter::get_rewrite_db(const char* db, uint *new_len)
+Rpl_filter::get_rewrite_db(const char* db, size_t *new_len)
{
if (rewrite_db.is_empty() || !db)
return db;
diff --git a/sql/rpl_filter.h b/sql/rpl_filter.h
index 396207d3a28..ff7e4081bb1 100644
--- a/sql/rpl_filter.h
+++ b/sql/rpl_filter.h
@@ -69,7 +69,7 @@ public:
void get_wild_do_table(String* str);
void get_wild_ignore_table(String* str);
- const char* get_rewrite_db(const char* db, uint *new_len);
+ const char* get_rewrite_db(const char* db, size_t *new_len);
I_List<i_string>* get_do_db();
I_List<i_string>* get_ignore_db();
diff --git a/sql/rpl_injector.h b/sql/rpl_injector.h
index 9c444ee20b3..4ece092c5b8 100644
--- a/sql/rpl_injector.h
+++ b/sql/rpl_injector.h
@@ -74,7 +74,7 @@ public:
friend class injector;
public:
/* Convenience definitions */
- typedef byte* record_type;
+ typedef uchar* record_type;
typedef uint32 server_id_type;
/*
diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc
index 4c6686cf446..45edb42374b 100644
--- a/sql/rpl_record.cc
+++ b/sql/rpl_record.cc
@@ -51,14 +51,14 @@
@return The number of bytes written at @c row_data.
*/
#if !defined(MYSQL_CLIENT)
-my_size_t
+size_t
pack_row(TABLE *table, MY_BITMAP const* cols,
- byte *row_data, const byte *record)
+ uchar *row_data, const uchar *record)
{
Field **p_field= table->field, *field;
int const null_byte_count= (bitmap_bits_set(cols) + 7) / 8;
- byte *pack_ptr = row_data + null_byte_count;
- byte *null_ptr = row_data;
+ uchar *pack_ptr = row_data + null_byte_count;
+ uchar *null_ptr = row_data;
my_ptrdiff_t const rec_offset= record - table->record[0];
my_ptrdiff_t const def_offset= table->s->default_values - table->record[0];
@@ -90,7 +90,7 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
/*
We only store the data of the field if it is non-null
*/
- pack_ptr= (byte*)field->pack((char *) pack_ptr, field->ptr + offset);
+ pack_ptr= field->pack(pack_ptr, field->ptr + offset);
}
null_mask <<= 1;
@@ -119,7 +119,7 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
*/
DBUG_ASSERT(null_ptr == row_data + null_byte_count);
- return static_cast<my_size_t>(pack_ptr - row_data);
+ return static_cast<size_t>(pack_ptr - row_data);
}
#endif
@@ -164,17 +164,17 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
int
unpack_row(RELAY_LOG_INFO const *rli,
TABLE *table, uint const colcnt,
- char const *const row_data, MY_BITMAP const *cols,
- char const **const row_end, ulong *const master_reclength,
+ uchar const *const row_data, MY_BITMAP const *cols,
+ uchar const **const row_end, ulong *const master_reclength,
MY_BITMAP* const rw_set, Log_event_type const event_type)
{
DBUG_ENTER("unpack_row");
DBUG_ASSERT(row_data);
- my_size_t const master_null_byte_count= (bitmap_bits_set(cols) + 7) / 8;
+ size_t const master_null_byte_count= (bitmap_bits_set(cols) + 7) / 8;
int error= 0;
- char const *null_ptr= row_data;
- char const *pack_ptr= row_data + master_null_byte_count;
+ uchar const *null_ptr= row_data;
+ uchar const *pack_ptr= row_data + master_null_byte_count;
bitmap_clear_all(rw_set);
@@ -239,7 +239,7 @@ unpack_row(RELAY_LOG_INFO const *rli,
if (master_reclength)
{
if (*field_ptr)
- *master_reclength = (*field_ptr)->ptr - (char*) table->record[0];
+ *master_reclength = (*field_ptr)->ptr - table->record[0];
else
*master_reclength = table->s->reclength;
}
diff --git a/sql/rpl_record.h b/sql/rpl_record.h
index 7ff1bbc7c8e..12c2f1fc713 100644
--- a/sql/rpl_record.h
+++ b/sql/rpl_record.h
@@ -17,15 +17,15 @@
#define RPL_RECORD_H
#if !defined(MYSQL_CLIENT)
-my_size_t pack_row(TABLE* table, MY_BITMAP const* cols,
- byte *row_data, const byte *data);
+size_t pack_row(TABLE* table, MY_BITMAP const* cols,
+ uchar *row_data, const uchar *data);
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int unpack_row(RELAY_LOG_INFO const *rli,
TABLE *table, uint const colcnt,
- char const *const row_data, MY_BITMAP const *cols,
- char const **const row_end, ulong *const master_reclength,
+ uchar const *const row_data, MY_BITMAP const *cols,
+ uchar const **const row_end, ulong *const master_reclength,
MY_BITMAP* const rw_set,
Log_event_type const event_type);
#endif
diff --git a/sql/rpl_record_old.cc b/sql/rpl_record_old.cc
index 73e2f4e7344..b6f170082fe 100644
--- a/sql/rpl_record_old.cc
+++ b/sql/rpl_record_old.cc
@@ -2,13 +2,13 @@
#include "mysql_priv.h"
#include "rpl_record_old.h"
-my_size_t
+size_t
pack_row_old(TABLE *table, MY_BITMAP const* cols,
- byte *row_data, const byte *record)
+ uchar *row_data, const uchar *record)
{
Field **p_field= table->field, *field;
int n_null_bytes= table->s->null_bytes;
- byte *ptr;
+ uchar *ptr;
uint i;
my_ptrdiff_t const rec_offset= record - table->record[0];
my_ptrdiff_t const def_offset= table->s->default_values - table->record[0];
@@ -22,11 +22,11 @@ pack_row_old(TABLE *table, MY_BITMAP const* cols,
my_ptrdiff_t const offset=
field->is_null(rec_offset) ? def_offset : rec_offset;
field->move_field_offset(offset);
- ptr= (byte*)field->pack((char *) ptr, field->ptr);
+ ptr= field->pack(ptr, field->ptr);
field->move_field_offset(-offset);
}
}
- return (static_cast<my_size_t>(ptr - row_data));
+ return (static_cast<size_t>(ptr - row_data));
}
@@ -70,14 +70,14 @@ pack_row_old(TABLE *table, MY_BITMAP const* cols,
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int
unpack_row_old(RELAY_LOG_INFO *rli,
- TABLE *table, uint const colcnt, byte *record,
- char const *row, MY_BITMAP const *cols,
- char const **row_end, ulong *master_reclength,
+ TABLE *table, uint const colcnt, uchar *record,
+ uchar const *row, MY_BITMAP const *cols,
+ uchar const **row_end, ulong *master_reclength,
MY_BITMAP* const rw_set, Log_event_type const event_type)
{
DBUG_ASSERT(record && row);
- my_ptrdiff_t const offset= record - (byte*) table->record[0];
- my_size_t master_null_bytes= table->s->null_bytes;
+ my_ptrdiff_t const offset= record - (uchar*) table->record[0];
+ size_t master_null_bytes= table->s->null_bytes;
if (colcnt != table->s->fields)
{
@@ -108,7 +108,7 @@ unpack_row_old(RELAY_LOG_INFO *rli,
Field **const begin_ptr = table->field;
Field **field_ptr;
- char const *ptr= row + master_null_bytes;
+ uchar const *ptr= row + master_null_bytes;
Field **const end_ptr= begin_ptr + colcnt;
for (field_ptr= begin_ptr ; field_ptr < end_ptr ; ++field_ptr)
{
@@ -130,7 +130,7 @@ unpack_row_old(RELAY_LOG_INFO *rli,
if (master_reclength)
{
if (*field_ptr)
- *master_reclength = (*field_ptr)->ptr - (char*) table->record[0];
+ *master_reclength = (*field_ptr)->ptr - table->record[0];
else
*master_reclength = table->s->reclength;
}
diff --git a/sql/rpl_record_old.h b/sql/rpl_record_old.h
index 6ddb01de07c..6af61141d47 100644
--- a/sql/rpl_record_old.h
+++ b/sql/rpl_record_old.h
@@ -17,14 +17,14 @@
#define RPL_RECORD_OLD_H
#ifndef MYSQL_CLIENT
-my_size_t pack_row_old(TABLE *table, MY_BITMAP const* cols,
- byte *row_data, const byte *record);
+size_t pack_row_old(TABLE *table, MY_BITMAP const* cols,
+ uchar *row_data, const uchar *record);
#ifdef HAVE_REPLICATION
int unpack_row_old(RELAY_LOG_INFO *rli,
- TABLE *table, uint const colcnt, byte *record,
- char const *row, MY_BITMAP const *cols,
- char const **row_end, ulong *master_reclength,
+ TABLE *table, uint const colcnt, uchar *record,
+ uchar const *row, MY_BITMAP const *cols,
+ uchar const **row_end, ulong *master_reclength,
MY_BITMAP* const rw_set,
Log_event_type const event_type);
#endif
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 702dec72f56..0c8f74bb35e 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -1078,7 +1078,8 @@ bool st_relay_log_info::cached_charset_compare(char *charset) const
{
DBUG_ENTER("st_relay_log_info::cached_charset_compare");
- if (bcmp(cached_charset, charset, sizeof(cached_charset)))
+ if (bcmp((uchar*) cached_charset, (uchar*) charset,
+ sizeof(cached_charset)))
{
memcpy(const_cast<char*>(cached_charset), charset, sizeof(cached_charset));
DBUG_RETURN(1);
@@ -1168,7 +1169,7 @@ void st_relay_log_info::clear_tables_to_lock()
{
while (tables_to_lock)
{
- gptr to_free= reinterpret_cast<gptr>(tables_to_lock);
+ uchar* to_free= reinterpret_cast<uchar*>(tables_to_lock);
if (tables_to_lock->m_tabledef_valid)
{
tables_to_lock->m_tabledef.table_def::~table_def();
diff --git a/sql/rpl_tblmap.cc b/sql/rpl_tblmap.cc
index 7df4bcbdde7..6c8b494dfa9 100644
--- a/sql/rpl_tblmap.cc
+++ b/sql/rpl_tblmap.cc
@@ -104,11 +104,11 @@ int table_mapping::set_table(ulong table_id, TABLE* table)
m_free= m_free->next;
}
else
- hash_delete(&m_table_ids,(byte *)e);
+ hash_delete(&m_table_ids,(uchar *)e);
e->table_id= table_id;
e->table= table;
- my_hash_insert(&m_table_ids,(byte *)e);
+ my_hash_insert(&m_table_ids,(uchar *)e);
DBUG_PRINT("info", ("tid %lu -> table 0x%lx (%s)",
table_id, (long) e->table,
@@ -121,7 +121,7 @@ int table_mapping::remove_table(ulong table_id)
entry *e= find_entry(table_id);
if (e)
{
- hash_delete(&m_table_ids,(byte *)e);
+ hash_delete(&m_table_ids,(uchar *)e);
/* we add this entry to the chain of free (free for use) entries */
e->next= m_free;
m_free= e;
diff --git a/sql/rpl_tblmap.h b/sql/rpl_tblmap.h
index dbc968d0f67..446833d5ed6 100644
--- a/sql/rpl_tblmap.h
+++ b/sql/rpl_tblmap.h
@@ -85,7 +85,7 @@ private:
entry *find_entry(ulong table_id)
{
return (entry *)hash_search(&m_table_ids,
- (byte*)&table_id,
+ (uchar*)&table_id,
sizeof(table_id));
}
int expand();
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index 1d7cc808f0c..dcbf85f5939 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -17,7 +17,7 @@
uint32
field_length_from_packed(enum_field_types const field_type,
- byte const *const data)
+ uchar const *const data)
{
uint32 length;
diff --git a/sql/rpl_utility.h b/sql/rpl_utility.h
index 17879a9ecfc..baca224a3e5 100644
--- a/sql/rpl_utility.h
+++ b/sql/rpl_utility.h
@@ -26,7 +26,7 @@ struct st_relay_log_info;
typedef st_relay_log_info RELAY_LOG_INFO;
uint32
-field_length_from_packed(enum_field_types field_type, byte const *data);
+field_length_from_packed(enum_field_types field_type, uchar const *data);
/**
A table definition from the master.
@@ -58,7 +58,7 @@ public:
@param types Array of types
@param size Number of elements in array 'types'
*/
- table_def(field_type *types, my_size_t size)
+ table_def(field_type *types, ulong size)
: m_type(new unsigned char [size]), m_size(size)
{
if (m_type)
@@ -81,7 +81,7 @@ public:
@return The number of fields that there is type data for.
*/
- my_size_t size() const { return m_size; }
+ ulong size() const { return m_size; }
/*
@@ -93,10 +93,9 @@ public:
<code>index</code>. Currently, only the type identifier is
returned.
*/
- field_type type(my_ptrdiff_t index) const
+ field_type type(ulong index) const
{
- DBUG_ASSERT(0 <= index);
- DBUG_ASSERT(static_cast<my_size_t>(index) < m_size);
+ DBUG_ASSERT(index < m_size);
return m_type[index];
}
@@ -120,7 +119,7 @@ public:
int compatible_with(RELAY_LOG_INFO const *rli, TABLE *table) const;
private:
- my_size_t m_size; // Number of elements in the types array
+ ulong m_size; // Number of elements in the types array
field_type *m_type; // Array of type descriptors
};
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 325167ff9fa..283aa0104ce 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -152,9 +152,9 @@ static void fix_trans_mem_root(THD *thd, enum_var_type type);
static void fix_server_id(THD *thd, enum_var_type type);
static KEY_CACHE *create_key_cache(const char *name, uint length);
void fix_sql_mode_var(THD *thd, enum_var_type type);
-static byte *get_error_count(THD *thd);
-static byte *get_warning_count(THD *thd);
-static byte *get_tmpdir(THD *thd);
+static uchar *get_error_count(THD *thd);
+static uchar *get_warning_count(THD *thd);
+static uchar *get_tmpdir(THD *thd);
static int sys_check_log_path(THD *thd, set_var *var);
static bool sys_update_general_log_path(THD *thd, set_var * var);
static void sys_default_general_log_path(THD *thd, enum_var_type type);
@@ -1136,7 +1136,7 @@ static void sys_default_init_slave(THD* thd, enum_var_type type)
static int sys_check_ftb_syntax(THD *thd, set_var *var)
{
if (thd->security_ctx->master_access & SUPER_ACL)
- return (ft_boolean_check_syntax_string((byte*)
+ return (ft_boolean_check_syntax_string((uchar*)
var->value->str_value.c_ptr()) ?
-1 : 0);
else
@@ -1514,9 +1514,9 @@ bool sys_var_enum::update(THD *thd, set_var *var)
}
-byte *sys_var_enum::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+uchar *sys_var_enum::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{
- return (byte*) enum_names->type_names[*value];
+ return (uchar*) enum_names->type_names[*value];
}
bool sys_var_thd_ulong::check(THD *thd, set_var *var)
@@ -1561,12 +1561,12 @@ void sys_var_thd_ulong::set_default(THD *thd, enum_var_type type)
}
-byte *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
if (type == OPT_GLOBAL)
- return (byte*) &(global_system_variables.*offset);
- return (byte*) &(thd->variables.*offset);
+ return (uchar*) &(global_system_variables.*offset);
+ return (uchar*) &(thd->variables.*offset);
}
@@ -1607,12 +1607,12 @@ void sys_var_thd_ha_rows::set_default(THD *thd, enum_var_type type)
}
-byte *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
if (type == OPT_GLOBAL)
- return (byte*) &(global_system_variables.*offset);
- return (byte*) &(thd->variables.*offset);
+ return (uchar*) &(global_system_variables.*offset);
+ return (uchar*) &(thd->variables.*offset);
}
bool sys_var_thd_ulonglong::update(THD *thd, set_var *var)
@@ -1650,12 +1650,12 @@ void sys_var_thd_ulonglong::set_default(THD *thd, enum_var_type type)
}
-byte *sys_var_thd_ulonglong::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_thd_ulonglong::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
if (type == OPT_GLOBAL)
- return (byte*) &(global_system_variables.*offset);
- return (byte*) &(thd->variables.*offset);
+ return (uchar*) &(global_system_variables.*offset);
+ return (uchar*) &(thd->variables.*offset);
}
@@ -1678,12 +1678,12 @@ void sys_var_thd_bool::set_default(THD *thd, enum_var_type type)
}
-byte *sys_var_thd_bool::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_thd_bool::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
if (type == OPT_GLOBAL)
- return (byte*) &(global_system_variables.*offset);
- return (byte*) &(thd->variables.*offset);
+ return (uchar*) &(global_system_variables.*offset);
+ return (uchar*) &(thd->variables.*offset);
}
@@ -1867,13 +1867,13 @@ void sys_var_thd_enum::set_default(THD *thd, enum_var_type type)
}
-byte *sys_var_thd_enum::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_thd_enum::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
ulong tmp= ((type == OPT_GLOBAL) ?
global_system_variables.*offset :
thd->variables.*offset);
- return (byte*) enum_names->type_names[tmp];
+ return (uchar*) enum_names->type_names[tmp];
}
bool sys_var_thd_bit::check(THD *thd, set_var *var)
@@ -1889,7 +1889,7 @@ bool sys_var_thd_bit::update(THD *thd, set_var *var)
}
-byte *sys_var_thd_bit::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_thd_bit::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
/*
@@ -1898,7 +1898,7 @@ byte *sys_var_thd_bit::value_ptr(THD *thd, enum_var_type type,
*/
thd->sys_var_tmp.my_bool_value= ((thd->options & bit_flag) ?
!reverse : reverse);
- return (byte*) &thd->sys_var_tmp.my_bool_value;
+ return (uchar*) &thd->sys_var_tmp.my_bool_value;
}
@@ -1909,7 +1909,7 @@ void sys_var_thd_date_time_format::update2(THD *thd, enum_var_type type,
{
DATE_TIME_FORMAT *old;
DBUG_ENTER("sys_var_date_time_format::update2");
- DBUG_DUMP("positions",(char*) new_value->positions,
+ DBUG_DUMP("positions", (uchar*) new_value->positions,
sizeof(new_value->positions));
if (type == OPT_GLOBAL)
@@ -1989,7 +1989,7 @@ void sys_var_thd_date_time_format::set_default(THD *thd, enum_var_type type)
}
-byte *sys_var_thd_date_time_format::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_thd_date_time_format::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
if (type == OPT_GLOBAL)
@@ -2002,9 +2002,9 @@ byte *sys_var_thd_date_time_format::value_ptr(THD *thd, enum_var_type type,
*/
res= thd->strmake((global_system_variables.*offset)->format.str,
(global_system_variables.*offset)->format.length);
- return (byte*) res;
+ return (uchar*) res;
}
- return (byte*) (thd->variables.*offset)->format.str;
+ return (uchar*) (thd->variables.*offset)->format.str;
}
@@ -2125,11 +2125,11 @@ bool sys_var_character_set::update(THD *thd, set_var *var)
}
-byte *sys_var_character_set::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_character_set::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
CHARSET_INFO *cs= ci_ptr(thd,type)[0];
- return cs ? (byte*) cs->csname : (byte*) NULL;
+ return cs ? (uchar*) cs->csname : (uchar*) NULL;
}
@@ -2284,13 +2284,13 @@ bool sys_var_collation_connection::update(THD *thd, set_var *var)
}
-byte *sys_var_collation_connection::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_collation_connection::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
global_system_variables.collation_connection :
thd->variables.collation_connection);
- return cs ? (byte*) cs->name : (byte*) "NULL";
+ return cs ? (uchar*) cs->name : (uchar*) "NULL";
}
@@ -2319,13 +2319,13 @@ bool sys_var_collation_database::update(THD *thd, set_var *var)
}
-byte *sys_var_collation_database::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_collation_database::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
global_system_variables.collation_database :
thd->variables.collation_database);
- return cs ? (byte*) cs->name : (byte*) "NULL";
+ return cs ? (uchar*) cs->name : (uchar*) "NULL";
}
@@ -2355,13 +2355,13 @@ bool sys_var_collation_server::update(THD *thd, set_var *var)
}
-byte *sys_var_collation_server::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_collation_server::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
global_system_variables.collation_server :
thd->variables.collation_server);
- return cs ? (byte*) cs->name : (byte*) "NULL";
+ return cs ? (uchar*) cs->name : (uchar*) "NULL";
}
@@ -2392,13 +2392,13 @@ KEY_CACHE *get_key_cache(LEX_STRING *cache_name)
}
-byte *sys_var_key_cache_param::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_key_cache_param::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
KEY_CACHE *key_cache= get_key_cache(base);
if (!key_cache)
key_cache= &zero_key_cache;
- return (byte*) key_cache + offset ;
+ return (uchar*) key_cache + offset ;
}
@@ -2584,11 +2584,12 @@ static int sys_check_log_path(THD *thd, set_var *var)
}
else
{
+ size_t path_length;
/*
Check if directory exists and
we have permission to create file & write to file
*/
- (void) dirname_part(path, var_path);
+ (void) dirname_part(path, var_path, &path_length);
if (my_access(path, (F_OK|W_OK)))
return -1;
}
@@ -2714,7 +2715,7 @@ void sys_var_log_output::set_default(THD *thd, enum_var_type type)
}
-byte *sys_var_log_output::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_log_output::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
char buff[256];
@@ -2735,7 +2736,7 @@ byte *sys_var_log_output::value_ptr(THD *thd, enum_var_type type,
if ((length= tmp.length()))
length--;
- return (byte*) thd->strmake(tmp.ptr(), length);
+ return (uchar*) thd->strmake(tmp.ptr(), length);
}
@@ -2774,11 +2775,11 @@ void sys_var_timestamp::set_default(THD *thd, enum_var_type type)
}
-byte *sys_var_timestamp::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_timestamp::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
thd->sys_var_tmp.long_value= (long) thd->start_time;
- return (byte*) &thd->sys_var_tmp.long_value;
+ return (uchar*) &thd->sys_var_tmp.long_value;
}
@@ -2790,7 +2791,7 @@ bool sys_var_last_insert_id::update(THD *thd, set_var *var)
}
-byte *sys_var_last_insert_id::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_last_insert_id::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
/*
@@ -2799,7 +2800,7 @@ byte *sys_var_last_insert_id::value_ptr(THD *thd, enum_var_type type,
*/
thd->sys_var_tmp.ulonglong_value=
thd->read_first_successful_insert_id_in_prev_stmt();
- return (byte*) &thd->sys_var_tmp.ulonglong_value;
+ return (uchar*) &thd->sys_var_tmp.ulonglong_value;
}
@@ -2810,12 +2811,12 @@ bool sys_var_insert_id::update(THD *thd, set_var *var)
}
-byte *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
thd->sys_var_tmp.ulonglong_value=
thd->auto_inc_intervals_forced.minimum();
- return (byte*) &thd->sys_var_tmp.ulonglong_value;
+ return (uchar*) &thd->sys_var_tmp.ulonglong_value;
}
@@ -2908,7 +2909,7 @@ bool sys_var_thd_time_zone::update(THD *thd, set_var *var)
}
-byte *sys_var_thd_time_zone::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_thd_time_zone::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
/*
@@ -2916,7 +2917,7 @@ byte *sys_var_thd_time_zone::value_ptr(THD *thd, enum_var_type type,
time zone name is guaranteed to be zero ended.
*/
if (type == OPT_GLOBAL)
- return (byte *)(global_system_variables.time_zone->get_name()->ptr());
+ return (uchar *)(global_system_variables.time_zone->get_name()->ptr());
else
{
/*
@@ -2928,7 +2929,7 @@ byte *sys_var_thd_time_zone::value_ptr(THD *thd, enum_var_type type,
(binlog code stores session value only).
*/
thd->time_zone_used= 1;
- return (byte *)(thd->variables.time_zone->get_name()->ptr());
+ return (uchar *)(thd->variables.time_zone->get_name()->ptr());
}
}
@@ -2990,13 +2991,13 @@ void sys_var_max_user_conn::set_default(THD *thd, enum_var_type type)
}
-byte *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
if (type != OPT_GLOBAL &&
thd->user_connect && thd->user_connect->user_resources.user_conn)
- return (byte*) &(thd->user_connect->user_resources.user_conn);
- return (byte*) &(max_user_connections);
+ return (uchar*) &(thd->user_connect->user_resources.user_conn);
+ return (uchar*) &(max_user_connections);
}
@@ -3047,12 +3048,12 @@ bool sys_var_thd_lc_time_names::update(THD *thd, set_var *var)
}
-byte *sys_var_thd_lc_time_names::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_thd_lc_time_names::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
return type == OPT_GLOBAL ?
- (byte *) global_system_variables.lc_time_names->name :
- (byte *) thd->variables.lc_time_names->name;
+ (uchar *) global_system_variables.lc_time_names->name :
+ (uchar *) thd->variables.lc_time_names->name;
}
@@ -3161,20 +3162,20 @@ static int check_pseudo_thread_id(THD *thd, set_var *var)
#endif
}
-static byte *get_warning_count(THD *thd)
+static uchar *get_warning_count(THD *thd)
{
thd->sys_var_tmp.long_value=
(thd->warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_NOTE] +
thd->warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_ERROR] +
thd->warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_WARN]);
- return (byte*) &thd->sys_var_tmp.long_value;
+ return (uchar*) &thd->sys_var_tmp.long_value;
}
-static byte *get_error_count(THD *thd)
+static uchar *get_error_count(THD *thd)
{
thd->sys_var_tmp.long_value=
thd->warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_ERROR];
- return (byte*) &thd->sys_var_tmp.long_value;
+ return (uchar*) &thd->sys_var_tmp.long_value;
}
@@ -3195,11 +3196,11 @@ static byte *get_error_count(THD *thd)
RETURN VALUES
ptr pointer to NUL-terminated string
*/
-static byte *get_tmpdir(THD *thd)
+static uchar *get_tmpdir(THD *thd)
{
if (opt_mysql_tmpdir)
- return (byte *)opt_mysql_tmpdir;
- return (byte*)mysql_tmpdir;
+ return (uchar *)opt_mysql_tmpdir;
+ return (uchar*)mysql_tmpdir;
}
/****************************************************************************
@@ -3245,11 +3246,11 @@ static struct my_option *find_option(struct my_option *opt, const char *name)
Return variable name and length for hashing of variables
*/
-static byte *get_sys_var_length(const sys_var *var, uint *length,
- my_bool first)
+static uchar *get_sys_var_length(const sys_var *var, size_t *length,
+ my_bool first)
{
*length= var->name_length;
- return (byte*) var->name;
+ return (uchar*) var->name;
}
@@ -3268,7 +3269,7 @@ void set_var_init()
{
var->name_length= strlen(var->name);
var->option_limits= find_option(my_long_options, var->name);
- my_hash_insert(&system_variable_hash, (byte*) var);
+ my_hash_insert(&system_variable_hash, (uchar*) var);
}
/*
Special cases
@@ -3303,7 +3304,7 @@ void set_var_free()
sys_var *find_sys_var(const char *str, uint length)
{
sys_var *var= (sys_var*) hash_search(&system_variable_hash,
- (byte*) str,
+ (uchar*) str,
length ? length :
strlen(str));
if (!var)
@@ -3595,13 +3596,13 @@ err:
}
-byte *sys_var_thd_storage_engine::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_thd_storage_engine::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
handlerton *val;
val= (type == OPT_GLOBAL) ? global_system_variables.*offset :
thd->variables.*offset;
- return (byte *) hton2plugin[val->slot]->name.str;
+ return (uchar *) hton2plugin[val->slot]->name.str;
}
@@ -3684,14 +3685,14 @@ symbolic_mode_representation(THD *thd, ulonglong val, LEX_STRING *rep)
}
-byte *sys_var_thd_sql_mode::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_thd_sql_mode::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
LEX_STRING sql_mode;
ulonglong val= ((type == OPT_GLOBAL) ? global_system_variables.*offset :
thd->variables.*offset);
(void) symbolic_mode_representation(thd, val, &sql_mode);
- return (byte *) sql_mode.str;
+ return (uchar *) sql_mode.str;
}
@@ -3782,7 +3783,7 @@ ulong fix_sql_mode(ulong sql_mode)
Named list handling
****************************************************************************/
-gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
+uchar* find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
NAMED_LIST **found)
{
I_List_iterator<NAMED_LIST> it(*list);
@@ -3801,7 +3802,7 @@ gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
void delete_elements(I_List<NAMED_LIST> *list,
- void (*free_element)(const char *name, gptr))
+ void (*free_element)(const char *name, uchar*))
{
NAMED_LIST *element;
DBUG_ENTER("delete_elements");
@@ -3825,7 +3826,7 @@ static KEY_CACHE *create_key_cache(const char *name, uint length)
if ((key_cache= (KEY_CACHE*) my_malloc(sizeof(KEY_CACHE),
MYF(MY_ZEROFILL | MY_WME))))
{
- if (!new NAMED_LIST(&key_caches, name, length, (gptr) key_cache))
+ if (!new NAMED_LIST(&key_caches, name, length, (uchar*) key_cache))
{
my_free((char*) key_cache, MYF(0));
key_cache= 0;
@@ -3984,14 +3985,14 @@ bool sys_var_thd_dbug::update(THD *thd, set_var *var)
}
-byte *sys_var_thd_dbug::value_ptr(THD *thd, enum_var_type type, LEX_STRING *b)
+uchar *sys_var_thd_dbug::value_ptr(THD *thd, enum_var_type type, LEX_STRING *b)
{
char buf[256];
if (type == OPT_GLOBAL)
DBUG_EXPLAIN_INITIAL(buf, sizeof(buf));
else
DBUG_EXPLAIN(buf, sizeof(buf));
- return (byte*) thd->strdup(buf);
+ return (uchar*) thd->strdup(buf);
}
@@ -4034,10 +4035,10 @@ sys_var_event_scheduler::update(THD *thd, set_var *var)
}
-byte *sys_var_event_scheduler::value_ptr(THD *thd, enum_var_type type,
+uchar *sys_var_event_scheduler::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
- return (byte *) Events::get_opt_event_scheduler_str();
+ return (uchar *) Events::get_opt_event_scheduler_str();
}
diff --git a/sql/set_var.h b/sql/set_var.h
index a3963171192..8e506734f60 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -35,7 +35,7 @@ typedef int (*sys_check_func)(THD *, set_var *);
typedef bool (*sys_update_func)(THD *, set_var *);
typedef void (*sys_after_update_func)(THD *,enum_var_type);
typedef void (*sys_set_default_func)(THD *, enum_var_type);
-typedef byte *(*sys_value_ptr_func)(THD *thd);
+typedef uchar *(*sys_value_ptr_func)(THD *thd);
class sys_var
{
@@ -66,7 +66,7 @@ public:
virtual bool update(THD *thd, set_var *var)=0;
virtual void set_default(THD *thd_arg, enum_var_type type) {}
virtual SHOW_TYPE show_type() { return SHOW_UNDEF; }
- virtual byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+ virtual uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{ return 0; }
virtual bool check_type(enum_var_type type)
{ return type != OPT_GLOBAL; } /* Error if not GLOBAL */
@@ -115,8 +115,8 @@ public:
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_LONG; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
- { return (byte*) value; }
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+ { return (uchar*) value; }
};
@@ -144,8 +144,8 @@ public:
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_LONGLONG; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
- { return (byte*) value; }
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+ { return (uchar*) value; }
};
@@ -163,8 +163,8 @@ public:
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
- { return (byte*) value; }
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+ { return (uchar*) value; }
bool check_update_type(Item_result type) { return 0; }
};
@@ -205,8 +205,8 @@ public:
(*set_default_func)(thd, type);
}
SHOW_TYPE show_type() { return SHOW_CHAR; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
- { return (byte*) value; }
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+ { return (uchar*) value; }
bool check_update_type(Item_result type)
{
return type != STRING_RESULT; /* Only accept strings */
@@ -231,9 +231,9 @@ public:
return 1;
}
SHOW_TYPE show_type() { return SHOW_CHAR; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{
- return (byte*) value;
+ return (uchar*) value;
}
bool check_update_type(Item_result type)
{
@@ -260,9 +260,9 @@ public:
return 1;
}
SHOW_TYPE show_type() { return SHOW_CHAR; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{
- return (byte*) *value;
+ return (uchar*) *value;
}
bool check_update_type(Item_result type)
{
@@ -288,7 +288,7 @@ public:
}
bool update(THD *thd, set_var *var);
SHOW_TYPE show_type() { return SHOW_CHAR; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check_update_type(Item_result type) { return 0; }
};
@@ -323,7 +323,7 @@ public:
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_LONG; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
@@ -341,7 +341,7 @@ public:
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_HA_ROWS; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
@@ -361,7 +361,7 @@ public:
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_LONGLONG; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check_default(enum_var_type type)
{
return type == OPT_GLOBAL && !option_limits;
@@ -387,7 +387,7 @@ public:
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check(THD *thd, set_var *var)
{
return check_enum(thd, var, &bool_typelib);
@@ -430,7 +430,7 @@ public:
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_CHAR; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check_update_type(Item_result type) { return 0; }
};
@@ -449,7 +449,7 @@ public:
return check_set(thd, var, enum_names);
}
void set_default(THD *thd, enum_var_type type);
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
static bool symbolic_mode_representation(THD *thd, ulonglong sql_mode,
LEX_STRING *rep);
};
@@ -471,7 +471,7 @@ public:
}
void set_default(THD *thd, enum_var_type type);
bool update(THD *thd, set_var *var);
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
class sys_var_thd_table_type :public sys_var_thd_storage_engine
@@ -503,7 +503,7 @@ public:
bool check_update_type(Item_result type) { return 0; }
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
class sys_var_thd_dbug :public sys_var_thd
@@ -515,7 +515,7 @@ public:
SHOW_TYPE show_type() { return SHOW_CHAR; }
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type) { DBUG_POP(); }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *b);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *b);
};
@@ -531,7 +531,7 @@ public:
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
bool check_default(enum_var_type type) { return 0; }
SHOW_TYPE show_type() { return SHOW_LONG; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
@@ -542,7 +542,7 @@ public:
bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
SHOW_TYPE show_type() { return SHOW_LONGLONG; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
@@ -553,7 +553,7 @@ public:
bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
SHOW_TYPE show_type() { return SHOW_LONGLONG; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
@@ -636,7 +636,7 @@ public:
}
bool check_default(enum_var_type type) { return 0; }
bool update(THD *thd, set_var *var);
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
virtual void set_default(THD *thd, enum_var_type type)= 0;
virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0;
};
@@ -702,7 +702,7 @@ public:
sys_var_collation_connection(const char *name_arg) :sys_var_collation(name_arg) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
class sys_var_collation_server :public sys_var_collation
@@ -711,7 +711,7 @@ public:
sys_var_collation_server(const char *name_arg) :sys_var_collation(name_arg) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
class sys_var_collation_database :public sys_var_collation
@@ -720,7 +720,7 @@ public:
sys_var_collation_database(const char *name_arg) :sys_var_collation(name_arg) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
@@ -732,7 +732,7 @@ public:
sys_var_key_cache_param(const char *name_arg, size_t offset_arg)
:sys_var(name_arg), offset(offset_arg)
{}
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check_default(enum_var_type type) { return 1; }
bool is_struct() { return 1; }
};
@@ -780,7 +780,7 @@ public:
bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var);
void update2(THD *thd, enum_var_type type, DATE_TIME_FORMAT *new_value);
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
void set_default(THD *thd, enum_var_type type);
};
@@ -810,7 +810,7 @@ public:
return check_set(thd, var, enum_names);
}
bool update(THD *thd, set_var *var);
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check_update_type(Item_result type) { return 0; }
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_CHAR; }
@@ -835,7 +835,7 @@ public:
bool check_default(enum_var_type type) { return 1; }
bool check_type(enum_var_type type) { return type != var_type; }
bool check_update_type(Item_result type) { return 1; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{
return (*value_ptr_func)(thd);
}
@@ -854,9 +854,9 @@ public:
sys_var(variable_name),
have_variable(have_variable_arg)
{ }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{
- return (byte*) show_comp_option_name[*have_variable];
+ return (uchar*) show_comp_option_name[*have_variable];
}
bool update(THD *thd, set_var *var) { return 1; }
bool check_default(enum_var_type type) { return 1; }
@@ -883,7 +883,7 @@ public:
}
bool check_default(enum_var_type type) { return 0; }
bool update(THD *thd, set_var *var);
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
virtual void set_default(THD *thd, enum_var_type type);
};
@@ -901,7 +901,7 @@ public:
}
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_INT; }
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
class sys_var_trust_routine_creators :public sys_var_bool_ptr
@@ -948,7 +948,7 @@ public:
}
bool check_default(enum_var_type type) { return 0; }
bool update(THD *thd, set_var *var);
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
virtual void set_default(THD *thd, enum_var_type type);
};
@@ -960,7 +960,7 @@ public:
sys_var_event_scheduler(const char *name_arg) :
sys_var_long_ptr(name_arg, NULL, NULL) {};
bool update(THD *thd, set_var *var);
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
SHOW_TYPE show_type() { return SHOW_CHAR; }
bool check(THD *thd, set_var *var);
bool check_update_type(Item_result type)
@@ -1102,10 +1102,10 @@ class NAMED_LIST :public ilink
const char *name;
uint name_length;
public:
- gptr data;
+ uchar* data;
NAMED_LIST(I_List<NAMED_LIST> *links, const char *name_arg,
- uint name_length_arg, gptr data_arg)
+ uint name_length_arg, uchar* data_arg)
:name_length(name_length_arg), data(data_arg)
{
name= my_strndup(name_arg, name_length, MYF(MY_WME));
@@ -1117,12 +1117,12 @@ public:
}
~NAMED_LIST()
{
- my_free((char*) name, MYF(0));
+ my_free((uchar*) name, MYF(0));
}
friend bool process_key_caches(int (* func) (const char *name,
KEY_CACHE *));
friend void delete_elements(I_List<NAMED_LIST> *list,
- void (*free_element)(const char*, gptr));
+ void (*free_element)(const char*, uchar*));
};
/* updated in sql_acl.cc */
@@ -1155,7 +1155,7 @@ extern sys_var_str sys_init_slave;
extern sys_var_thd_time_zone sys_time_zone;
extern sys_var_thd_bit sys_autocommit;
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
-gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
+uchar* find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
NAMED_LIST **found);
extern sys_var_str sys_var_general_log_path, sys_var_slow_log_path;
@@ -1166,4 +1166,4 @@ KEY_CACHE *get_or_create_key_cache(const char *name, uint length);
void free_key_cache(const char *name, KEY_CACHE *key_cache);
bool process_key_caches(int (* func) (const char *name, KEY_CACHE *));
void delete_elements(I_List<NAMED_LIST> *list,
- void (*free_element)(const char*, gptr));
+ void (*free_element)(const char*, uchar*));
diff --git a/sql/slave.cc b/sql/slave.cc
index f1b9ea8476b..54504d18f00 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -450,7 +450,7 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start,
#ifdef NOT_USED_YET
-static int end_slave_on_walk(MASTER_INFO* mi, gptr /*unused*/)
+static int end_slave_on_walk(MASTER_INFO* mi, uchar* /*unused*/)
{
DBUG_ENTER("end_slave_on_walk");
@@ -620,7 +620,7 @@ void skip_load_data_infile(NET *net)
(void)net_request_file(net, "/dev/null");
(void)my_net_read(net); // discard response
- (void)net_write_command(net, 0, "", 0, "", 0); // Send ok
+ (void)net_write_command(net, 0, (uchar*) "", 0, (uchar*) "", 0); // ok
DBUG_VOID_RETURN;
}
@@ -628,7 +628,8 @@ void skip_load_data_infile(NET *net)
bool net_request_file(NET* net, const char* fname)
{
DBUG_ENTER("net_request_file");
- DBUG_RETURN(net_write_command(net, 251, fname, strlen(fname), "", 0));
+ DBUG_RETURN(net_write_command(net, 251, (uchar*) fname, strlen(fname),
+ (uchar*) "", 0));
}
/*
@@ -1157,7 +1158,7 @@ static void write_ignored_events_info_to_relay_log(THD *thd, MASTER_INFO *mi)
int register_slave_on_master(MYSQL* mysql)
{
- char buf[1024], *pos= buf;
+ uchar buf[1024], *pos= buf;
uint report_host_len, report_user_len=0, report_password_len=0;
DBUG_ENTER("register_slave_on_master");
@@ -1174,16 +1175,15 @@ int register_slave_on_master(MYSQL* mysql)
DBUG_RETURN(0); // safety
int4store(pos, server_id); pos+= 4;
- pos= net_store_data(pos, report_host, report_host_len);
- pos= net_store_data(pos, report_user, report_user_len);
- pos= net_store_data(pos, report_password, report_password_len);
+ pos= net_store_data(pos, (uchar*) report_host, report_host_len);
+ pos= net_store_data(pos, (uchar*) report_user, report_user_len);
+ pos= net_store_data(pos, (uchar*) report_password, report_password_len);
int2store(pos, (uint16) report_port); pos+= 2;
int4store(pos, rpl_recovery_rank); pos+= 4;
/* The master will fill in master_id */
int4store(pos, 0); pos+= 4;
- if (simple_command(mysql, COM_REGISTER_SLAVE, (char*) buf,
- (uint) (pos- buf), 0))
+ if (simple_command(mysql, COM_REGISTER_SLAVE, buf, (size_t) (pos- buf), 0))
{
sql_print_error("Error on COM_REGISTER_SLAVE: %d '%s'",
mysql_errno(mysql),
@@ -1370,7 +1370,7 @@ bool show_master_info(THD* thd, MASTER_INFO* mi)
pthread_mutex_unlock(&mi->rli.data_lock);
pthread_mutex_unlock(&mi->data_lock);
- if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
+ if (my_net_write(&thd->net, (uchar*) thd->packet.ptr(), packet->length()))
DBUG_RETURN(TRUE);
}
send_eof(thd);
@@ -1498,7 +1498,7 @@ static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed,
static int request_dump(MYSQL* mysql, MASTER_INFO* mi,
bool *suppress_warnings)
{
- char buf[FN_REFLEN + 10];
+ uchar buf[FN_REFLEN + 10];
int len;
int binlog_flags = 0; // for now
char* logname = mi->master_log_name;
@@ -1532,10 +1532,9 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi,
static int request_table_dump(MYSQL* mysql, const char* db, const char* table)
{
- char buf[1024];
+ uchar buf[1024], *p = buf;
DBUG_ENTER("request_table_dump");
- char * p = buf;
uint table_len = (uint) strlen(table);
uint db_len = (uint) strlen(db);
if (table_len + db_len > sizeof(buf) - 2)
@@ -2580,7 +2579,8 @@ static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev)
}
if (unlikely(!num_bytes)) /* eof */
{
- net_write_command(net, 0, "", 0, "", 0);/* 3.23 master wants it */
+ /* 3.23 master wants it */
+ net_write_command(net, 0, (uchar*) "", 0, (uchar*) "", 0);
/*
If we wrote Create_file_log_event, then we need to write
Execute_load_log_event. If we did not write Create_file_log_event,
@@ -3295,7 +3295,7 @@ bool flush_relay_log_info(RELAY_LOG_INFO* rli)
*pos++='\n';
pos=longlong2str(rli->group_master_log_pos, pos, 10);
*pos='\n';
- if (my_b_write(file, (byte*) buff, (ulong) (pos-buff)+1))
+ if (my_b_write(file, (uchar*) buff, (size_t) (pos-buff)+1))
error=1;
if (flush_io_cache(file))
error=1;
diff --git a/sql/slave.h b/sql/slave.h
index cb880c8125d..57806e65af7 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -94,9 +94,9 @@ class MASTER_INFO;
extern ulong master_retry_count;
extern MY_BITMAP slave_error_mask;
extern bool use_slave_mask;
-extern char* slave_load_tmpdir;
-extern my_string master_info_file,relay_log_info_file;
-extern my_string opt_relay_logname, opt_relaylog_index_name;
+extern char *slave_load_tmpdir;
+extern char *master_info_file, *relay_log_info_file;
+extern char *opt_relay_logname, *opt_relaylog_index_name;
extern my_bool opt_skip_slave_start, opt_reckless_slave;
extern my_bool opt_log_slave_updates;
extern ulonglong relay_log_space_limit;
@@ -201,13 +201,13 @@ extern int disconnect_slave_event_count, abort_slave_event_count ;
/* the master variables are defaults read from my.cnf or command line */
extern uint master_port, master_connect_retry, report_port;
-extern my_string master_user, master_password, master_host,
- master_info_file, relay_log_info_file, report_user, report_host,
- report_password;
+extern char * master_user, *master_password, *master_host;
+extern char *master_info_file, *relay_log_info_file, *report_user;
+extern char *report_host, *report_password;
extern my_bool master_ssl;
-extern my_string master_ssl_ca, master_ssl_capath, master_ssl_cert,
- master_ssl_cipher, master_ssl_key;
+extern char *master_ssl_ca, *master_ssl_capath, *master_ssl_cert;
+extern char *master_ssl_cipher, *master_ssl_key;
extern I_List<THD> threads;
diff --git a/sql/sp.cc b/sql/sp.cc
index d96e4295a83..244890f200d 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -147,10 +147,10 @@ static TABLE *open_proc_table_for_update(THD *thd)
static int
db_find_routine_aux(THD *thd, int type, sp_name *name, TABLE *table)
{
- byte key[MAX_KEY_LENGTH]; // db, name, optional key length type
+ uchar key[MAX_KEY_LENGTH]; // db, name, optional key length type
DBUG_ENTER("db_find_routine_aux");
- DBUG_PRINT("enter", ("type: %d name: %.*s",
- type, name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("type: %d name: %.*s",
+ type, (int) name->m_name.length, name->m_name.str));
/*
Create key to find row. We have to use field->store() to be able to
@@ -215,7 +215,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
Open_tables_state open_tables_state_backup;
DBUG_ENTER("db_find_routine");
DBUG_PRINT("enter", ("type: %d name: %.*s",
- type, name->m_name.length, name->m_name.str));
+ type, (int) name->m_name.length, name->m_name.str));
*sphp= 0; // In case of errors
if (!(table= open_proc_table_for_read(thd, &open_tables_state_backup)))
@@ -444,7 +444,7 @@ db_create_routine(THD *thd, int type, sp_head *sp)
TABLE *table;
char definer[USER_HOST_BUFF_SIZE];
DBUG_ENTER("db_create_routine");
- DBUG_PRINT("enter", ("type: %d name: %.*s",type,sp->m_name.length,
+ DBUG_PRINT("enter", ("type: %d name: %.*s",type, (int) sp->m_name.length,
sp->m_name.str));
/*
@@ -587,8 +587,8 @@ db_drop_routine(THD *thd, int type, sp_name *name)
TABLE *table;
int ret;
DBUG_ENTER("db_drop_routine");
- DBUG_PRINT("enter", ("type: %d name: %.*s",
- type, name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("type: %d name: %.*s",
+ type, (int) name->m_name.length, name->m_name.str));
/*
This statement will be replicated as a statement, even when using
@@ -626,8 +626,8 @@ db_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics)
TABLE *table;
int ret;
DBUG_ENTER("db_update_routine");
- DBUG_PRINT("enter", ("type: %d name: %.*s",
- type, name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("type: %d name: %.*s",
+ type, (int) name->m_name.length, name->m_name.str));
/*
This statement will be replicated as a statement, even when using
@@ -875,7 +875,7 @@ sp_drop_db_routines(THD *thd, char *db)
ret= SP_OK;
table->file->ha_index_init(0, 1);
if (! table->file->index_read(table->record[0],
- (byte *)table->field[MYSQL_PROC_FIELD_DB]->ptr,
+ (uchar *)table->field[MYSQL_PROC_FIELD_DB]->ptr,
(key_part_map)1, HA_READ_KEY_EXACT))
{
int nxtres;
@@ -892,7 +892,7 @@ sp_drop_db_routines(THD *thd, char *db)
break;
}
} while (! (nxtres= table->file->index_next_same(table->record[0],
- (byte *)table->field[MYSQL_PROC_FIELD_DB]->ptr,
+ (uchar *)table->field[MYSQL_PROC_FIELD_DB]->ptr,
key_len)));
if (nxtres != HA_ERR_END_OF_FILE)
ret= SP_KEY_NOT_FOUND;
@@ -939,9 +939,9 @@ sp_find_routine(THD *thd, int type, sp_name *name, sp_cache **cp,
thd->variables.max_sp_recursion_depth :
0);
DBUG_ENTER("sp_find_routine");
- DBUG_PRINT("enter", ("name: %.*s.%.*s, type: %d, cache only %d",
- name->m_db.length, name->m_db.str,
- name->m_name.length, name->m_name.str,
+ DBUG_PRINT("enter", ("name: %.*s.%.*s type: %d cache only %d",
+ (int) name->m_db.length, name->m_db.str,
+ (int) name->m_name.length, name->m_name.str,
type, cache_only));
if ((sp= sp_cache_lookup(cp, name)))
@@ -1109,7 +1109,7 @@ sp_create_procedure(THD *thd, sp_head *sp)
{
int ret;
DBUG_ENTER("sp_create_procedure");
- DBUG_PRINT("enter", ("name: %.*s", sp->m_name.length, sp->m_name.str));
+ DBUG_PRINT("enter", ("name: %.*s", (int) sp->m_name.length, sp->m_name.str));
ret= db_create_routine(thd, TYPE_ENUM_PROCEDURE, sp);
DBUG_RETURN(ret);
@@ -1121,7 +1121,8 @@ sp_drop_procedure(THD *thd, sp_name *name)
{
int ret;
DBUG_ENTER("sp_drop_procedure");
- DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("name: %.*s",
+ (int) name->m_name.length, name->m_name.str));
ret= db_drop_routine(thd, TYPE_ENUM_PROCEDURE, name);
if (!ret)
@@ -1135,7 +1136,8 @@ sp_update_procedure(THD *thd, sp_name *name, st_sp_chistics *chistics)
{
int ret;
DBUG_ENTER("sp_update_procedure");
- DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("name: %.*s",
+ (int) name->m_name.length, name->m_name.str));
ret= db_update_routine(thd, TYPE_ENUM_PROCEDURE, name, chistics);
if (!ret)
@@ -1150,7 +1152,8 @@ sp_show_create_procedure(THD *thd, sp_name *name)
int ret= SP_KEY_NOT_FOUND;
sp_head *sp;
DBUG_ENTER("sp_show_create_procedure");
- DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("name: %.*s",
+ (int) name->m_name.length, name->m_name.str));
/*
Increase the recursion limit for this statement. SHOW CREATE PROCEDURE
@@ -1186,7 +1189,8 @@ sp_create_function(THD *thd, sp_head *sp)
{
int ret;
DBUG_ENTER("sp_create_function");
- DBUG_PRINT("enter", ("name: %.*s", sp->m_name.length, sp->m_name.str));
+ DBUG_PRINT("enter", ("name: %.*s",
+ (int) sp->m_name.length, sp->m_name.str));
ret= db_create_routine(thd, TYPE_ENUM_FUNCTION, sp);
DBUG_RETURN(ret);
@@ -1198,7 +1202,8 @@ sp_drop_function(THD *thd, sp_name *name)
{
int ret;
DBUG_ENTER("sp_drop_function");
- DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("name: %.*s",
+ (int) name->m_name.length, name->m_name.str));
ret= db_drop_routine(thd, TYPE_ENUM_FUNCTION, name);
if (!ret)
@@ -1212,7 +1217,8 @@ sp_update_function(THD *thd, sp_name *name, st_sp_chistics *chistics)
{
int ret;
DBUG_ENTER("sp_update_procedure");
- DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("name: %.*s",
+ (int) name->m_name.length, name->m_name.str));
ret= db_update_routine(thd, TYPE_ENUM_FUNCTION, name, chistics);
if (!ret)
@@ -1226,7 +1232,8 @@ sp_show_create_function(THD *thd, sp_name *name)
{
sp_head *sp;
DBUG_ENTER("sp_show_create_function");
- DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str));
+ DBUG_PRINT("enter", ("name: %.*s",
+ (int) name->m_name.length, name->m_name.str));
if ((sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, name,
&thd->sp_func_cache, FALSE)))
@@ -1273,11 +1280,12 @@ struct Sroutine_hash_entry
};
-extern "C" byte* sp_sroutine_key(const byte *ptr, uint *plen, my_bool first)
+extern "C" uchar* sp_sroutine_key(const uchar *ptr, size_t *plen,
+ my_bool first)
{
Sroutine_hash_entry *rn= (Sroutine_hash_entry *)ptr;
*plen= rn->key.length;
- return (byte *)rn->key.str;
+ return (uchar *)rn->key.str;
}
@@ -1358,7 +1366,7 @@ static bool add_used_routine(LEX *lex, Query_arena *arena,
Query_tables_list::START_SROUTINES_HASH_SIZE,
0, 0, sp_sroutine_key, 0, 0);
- if (!hash_search(&lex->sroutines, (byte *)key->str, key->length))
+ if (!hash_search(&lex->sroutines, (uchar *)key->str, key->length))
{
Sroutine_hash_entry *rn=
(Sroutine_hash_entry *)arena->alloc(sizeof(Sroutine_hash_entry) +
@@ -1368,8 +1376,8 @@ static bool add_used_routine(LEX *lex, Query_arena *arena,
rn->key.length= key->length;
rn->key.str= (char *)rn + sizeof(Sroutine_hash_entry);
memcpy(rn->key.str, key->str, key->length);
- my_hash_insert(&lex->sroutines, (byte *)rn);
- lex->sroutines_list.link_in_list((byte *)rn, (byte **)&rn->next);
+ my_hash_insert(&lex->sroutines, (uchar *)rn);
+ lex->sroutines_list.link_in_list((uchar *)rn, (uchar **)&rn->next);
rn->belong_to_view= belong_to_view;
return TRUE;
}
@@ -1427,7 +1435,7 @@ void sp_remove_not_own_routines(LEX *lex)
but we want to be more future-proof.
*/
next_rt= not_own_rt->next;
- hash_delete(&lex->sroutines, (byte *)not_own_rt);
+ hash_delete(&lex->sroutines, (uchar *)not_own_rt);
}
*(Sroutine_hash_entry **)lex->sroutines_list_own_last= NULL;
@@ -1459,8 +1467,8 @@ void sp_update_sp_used_routines(HASH *dst, HASH *src)
for (uint i=0 ; i < src->records ; i++)
{
Sroutine_hash_entry *rt= (Sroutine_hash_entry *)hash_element(src, i);
- if (!hash_search(dst, (byte *)rt->key.str, rt->key.length))
- my_hash_insert(dst, (byte *)rt);
+ if (!hash_search(dst, (uchar *)rt->key.str, rt->key.length))
+ my_hash_insert(dst, (uchar *)rt);
}
}
diff --git a/sql/sp.h b/sql/sp.h
index 24c0756c426..6884634c00c 100644
--- a/sql/sp.h
+++ b/sql/sp.h
@@ -93,7 +93,8 @@ int sp_cache_routines_and_add_tables_for_view(THD *thd, LEX *lex,
int sp_cache_routines_and_add_tables_for_triggers(THD *thd, LEX *lex,
TABLE_LIST *table);
-extern "C" byte* sp_sroutine_key(const byte *ptr, uint *plen, my_bool first);
+extern "C" uchar* sp_sroutine_key(const uchar *ptr, size_t *plen,
+ my_bool first);
/*
Routines which allow open/lock and close mysql.proc table even when
diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc
index de4e1efd496..84b15ee15c4 100644
--- a/sql/sp_cache.cc
+++ b/sql/sp_cache.cc
@@ -39,12 +39,12 @@ public:
inline void insert(sp_head *sp)
{
/* TODO: why don't we check return value? */
- my_hash_insert(&m_hashtable, (const byte *)sp);
+ my_hash_insert(&m_hashtable, (const uchar *)sp);
}
inline sp_head *lookup(char *name, uint namelen)
{
- return (sp_head *)hash_search(&m_hashtable, (const byte *)name, namelen);
+ return (sp_head *)hash_search(&m_hashtable, (const uchar *)name, namelen);
}
#ifdef NOT_USED
@@ -53,7 +53,7 @@ public:
sp_head *sp= lookup(name, namelen);
if (sp)
{
- hash_delete(&m_hashtable, (byte *)sp);
+ hash_delete(&m_hashtable, (uchar *)sp);
return TRUE;
}
return FALSE;
@@ -130,7 +130,7 @@ void sp_cache_insert(sp_cache **cp, sp_head *sp)
return; // End of memory error
c->version= Cversion; // No need to lock when reading long variable
}
- DBUG_PRINT("info",("sp_cache: inserting: %.*s", sp->m_qname.length,
+ DBUG_PRINT("info",("sp_cache: inserting: %.*s", (int) sp->m_qname.length,
sp->m_qname.str));
c->insert(sp);
*cp= c; // Update *cp if it was NULL
@@ -214,12 +214,12 @@ void sp_cache_flush_obsolete(sp_cache **cp)
Internal functions
*************************************************************************/
-static byte *hash_get_key_for_sp_head(const byte *ptr, uint *plen,
- my_bool first)
+static uchar *hash_get_key_for_sp_head(const uchar *ptr, size_t *plen,
+ my_bool first)
{
sp_head *sp= (sp_head *)ptr;
*plen= sp->m_qname.length;
- return (byte*) sp->m_qname.str;
+ return (uchar*) sp->m_qname.str;
}
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 04a7b2574a4..8d4cf464be9 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -385,13 +385,13 @@ void
sp_name::init_qname(THD *thd)
{
m_sroutines_key.length= m_db.length + m_name.length + 2;
- if (!(m_sroutines_key.str= thd->alloc(m_sroutines_key.length + 1)))
+ if (!(m_sroutines_key.str= (char*) thd->alloc(m_sroutines_key.length + 1)))
return;
m_qname.length= m_sroutines_key.length - 1;
m_qname.str= m_sroutines_key.str + 1;
sprintf(m_qname.str, "%.*s.%.*s",
- m_db.length, (m_db.length ? m_db.str : ""),
- m_name.length, m_name.str);
+ (int) m_db.length, (m_db.length ? m_db.str : ""),
+ (int) m_name.length, m_name.str);
}
@@ -485,8 +485,7 @@ sp_head::sp_head()
*/
m_db= m_name= m_qname= str_reset;
- extern byte *
- sp_table_key(const byte *ptr, uint *plen, my_bool first);
+ extern uchar *sp_table_key(const uchar *ptr, size_t *plen, my_bool first);
DBUG_ENTER("sp_head::sp_head");
m_backpatch.empty();
@@ -713,7 +712,7 @@ sp_head::create_result_field(uint field_max_length, const char *field_name,
field_max_length : m_return_field_def.length;
field= ::make_field(table->s, /* TABLE_SHARE ptr */
- (char*) 0, /* field ptr */
+ (uchar*) 0, /* field ptr */
field_length, /* field [max] length */
(uchar*) "", /* null ptr */
0, /* null bit */
@@ -977,7 +976,7 @@ sp_head::execute(THD *thd)
String old_packet;
/* Use some extra margin for possible SP recursion and functions */
- if (check_stack_overrun(thd, 8 * STACK_MIN_SIZE, (char*)&old_packet))
+ if (check_stack_overrun(thd, 8 * STACK_MIN_SIZE, (uchar*)&old_packet))
DBUG_RETURN(TRUE);
/* init per-instruction memroot */
@@ -1664,7 +1663,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
{
List_iterator<Item> it_args(*args);
- DBUG_PRINT("info",(" %.*s: eval args", m_name.length, m_name.str));
+ DBUG_PRINT("info",(" %.*s: eval args", (int) m_name.length, m_name.str));
for (uint i= 0 ; i < params ; i++)
{
@@ -1722,7 +1721,8 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
if (!thd->in_sub_stmt)
close_thread_tables(thd, 0, 0);
- DBUG_PRINT("info",(" %.*s: eval args done", m_name.length, m_name.str));
+ DBUG_PRINT("info",(" %.*s: eval args done",
+ (int) m_name.length, m_name.str));
}
if (!(m_flags & LOG_SLOW_STATEMENTS) && thd->enable_slow_log)
{
@@ -2181,7 +2181,7 @@ void sp_head::add_instr(sp_instr *instr)
entire stored procedure, as their life span is equal.
*/
instr->mem_root= &main_mem_root;
- insert_dynamic(&m_instr, (gptr)&instr);
+ insert_dynamic(&m_instr, (uchar*)&instr);
}
@@ -2267,7 +2267,7 @@ void sp_head::optimize()
sp_instr *ibp;
List_iterator_fast<sp_instr> li(bp);
- set_dynamic(&m_instr, (gptr)&i, dst);
+ set_dynamic(&m_instr, (uchar*)&i, dst);
while ((ibp= li++))
{
sp_instr_opt_meta *im= static_cast<sp_instr_opt_meta *>(ibp);
@@ -3458,12 +3458,12 @@ typedef struct st_sp_table
uint query_lock_count;
} SP_TABLE;
-byte *
-sp_table_key(const byte *ptr, uint *plen, my_bool first)
+uchar *
+sp_table_key(const uchar *ptr, size_t *plen, my_bool first)
{
SP_TABLE *tab= (SP_TABLE *)ptr;
*plen= tab->qname.length;
- return (byte *)tab->qname.str;
+ return (uchar *)tab->qname.str;
}
@@ -3524,8 +3524,8 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check)
(and therefore should not be prelocked). Otherwise we will erroneously
treat table with same name but with different alias as non-temporary.
*/
- if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (byte *)tname, tlen)) ||
- ((tab= (SP_TABLE *)hash_search(&m_sptabs, (byte *)tname,
+ if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname, tlen)) ||
+ ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname,
tlen - alen - 1)) &&
tab->temp))
{
@@ -3555,7 +3555,7 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check)
tab->db_length= table->db_length;
tab->lock_type= table->lock_type;
tab->lock_count= tab->query_lock_count= 1;
- my_hash_insert(&m_sptabs, (byte *)tab);
+ my_hash_insert(&m_sptabs, (uchar *)tab);
}
}
return TRUE;
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 551707fa7bd..bea03e5c2a0 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -243,7 +243,7 @@ public:
{
sp_instr *i;
- get_dynamic(&m_instr, (gptr)&i, m_instr.elements-1);
+ get_dynamic(&m_instr, (uchar*)&i, m_instr.elements-1);
return i;
}
@@ -325,7 +325,7 @@ public:
sp_instr *ip;
if (i < m_instr.elements)
- get_dynamic(&m_instr, (gptr)&ip, i);
+ get_dynamic(&m_instr, (uchar*)&ip, i);
else
ip= NULL;
return ip;
diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc
index 780243cc79f..9c96485b8ec 100644
--- a/sql/sp_pcontext.cc
+++ b/sql/sp_pcontext.cc
@@ -211,7 +211,7 @@ sp_pcontext::find_variable(LEX_STRING *name, my_bool scoped)
{
sp_variable_t *p;
- get_dynamic(&m_vars, (gptr)&p, i);
+ get_dynamic(&m_vars, (uchar*)&p, i);
if (my_strnncoll(system_charset_info,
(const uchar *)name->str, name->length,
(const uchar *)p->name.str, p->name.length) == 0)
@@ -238,7 +238,7 @@ sp_pcontext::find_variable(uint offset)
{ // This frame
sp_variable_t *p;
- get_dynamic(&m_vars, (gptr)&p, offset - m_var_offset);
+ get_dynamic(&m_vars, (uchar*)&p, offset - m_var_offset);
return p;
}
if (m_parent)
@@ -263,7 +263,7 @@ sp_pcontext::push_variable(LEX_STRING *name, enum enum_field_types type,
p->mode= mode;
p->offset= current_var_count();
p->dflt= NULL;
- insert_dynamic(&m_vars, (gptr)&p);
+ insert_dynamic(&m_vars, (uchar*)&p);
return p;
}
@@ -318,7 +318,7 @@ sp_pcontext::push_cond(LEX_STRING *name, sp_cond_type_t *val)
p->name.str= name->str;
p->name.length= name->length;
p->val= val;
- insert_dynamic(&m_conds, (gptr)&p);
+ insert_dynamic(&m_conds, (uchar*)&p);
}
}
@@ -334,7 +334,7 @@ sp_pcontext::find_cond(LEX_STRING *name, my_bool scoped)
{
sp_cond_t *p;
- get_dynamic(&m_conds, (gptr)&p, i);
+ get_dynamic(&m_conds, (uchar*)&p, i);
if (my_strnncoll(system_charset_info,
(const uchar *)name->str, name->length,
(const uchar *)p->name.str, p->name.length) == 0)
@@ -361,7 +361,7 @@ sp_pcontext::find_handler(sp_cond_type_t *cond)
{
sp_cond_type_t *p;
- get_dynamic(&m_handlers, (gptr)&p, i);
+ get_dynamic(&m_handlers, (uchar*)&p, i);
if (cond->type == p->type)
{
switch (p->type)
@@ -391,7 +391,7 @@ sp_pcontext::push_cursor(LEX_STRING *name)
m_max_cursor_index+= 1;
n.str= name->str;
n.length= name->length;
- insert_dynamic(&m_cursors, (gptr)&n);
+ insert_dynamic(&m_cursors, (uchar*)&n);
}
/*
@@ -406,7 +406,7 @@ sp_pcontext::find_cursor(LEX_STRING *name, uint *poff, my_bool scoped)
{
LEX_STRING n;
- get_dynamic(&m_cursors, (gptr)&n, i);
+ get_dynamic(&m_cursors, (uchar*)&n, i);
if (my_strnncoll(system_charset_info,
(const uchar *)name->str, name->length,
(const uchar *)n.str, n.length) == 0)
@@ -429,7 +429,7 @@ sp_pcontext::retrieve_field_definitions(List<create_field> *field_def_lst)
for (uint i = 0; i < m_vars.elements; ++i)
{
sp_variable_t *var_def;
- get_dynamic(&m_vars, (gptr) &var_def, i);
+ get_dynamic(&m_vars, (uchar*) &var_def, i);
field_def_lst->push_back(&var_def->field_def);
}
@@ -453,7 +453,7 @@ sp_pcontext::find_cursor(uint offset, LEX_STRING *n)
if (m_cursor_offset <= offset &&
offset < m_cursor_offset + m_cursors.elements)
{ // This frame
- get_dynamic(&m_cursors, (gptr)n, offset - m_cursor_offset);
+ get_dynamic(&m_cursors, (uchar*)n, offset - m_cursor_offset);
return TRUE;
}
if (m_parent)
diff --git a/sql/sp_pcontext.h b/sql/sp_pcontext.h
index 5bffda79f98..3b8b165a6e0 100644
--- a/sql/sp_pcontext.h
+++ b/sql/sp_pcontext.h
@@ -273,7 +273,7 @@ public:
inline bool
push_case_expr_id(int case_expr_id)
{
- return insert_dynamic(&m_case_expr_id_lst, (gptr) &case_expr_id);
+ return insert_dynamic(&m_case_expr_id_lst, (uchar*) &case_expr_id);
}
inline void
@@ -287,7 +287,7 @@ public:
{
int case_expr_id;
- get_dynamic((DYNAMIC_ARRAY*)&m_case_expr_id_lst, (gptr) &case_expr_id,
+ get_dynamic((DYNAMIC_ARRAY*)&m_case_expr_id_lst, (uchar*) &case_expr_id,
m_case_expr_id_lst.elements - 1);
return case_expr_id;
@@ -343,7 +343,7 @@ public:
inline void
push_handler(sp_cond_type_t *cond)
{
- insert_dynamic(&m_handlers, (gptr)&cond);
+ insert_dynamic(&m_handlers, (uchar*)&cond);
}
bool
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index ba1ec66fb02..8ab92ced6c1 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -160,11 +160,11 @@ public:
};
-static byte* acl_entry_get_key(acl_entry *entry,uint *length,
- my_bool not_used __attribute__((unused)))
+static uchar* acl_entry_get_key(acl_entry *entry, size_t *length,
+ my_bool not_used __attribute__((unused)))
{
*length=(uint) entry->length;
- return (byte*) entry->key;
+ return (uchar*) entry->key;
}
#define IP_ADDR_STRLEN (3+1+3+1+3+1+3)
@@ -362,9 +362,9 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
host.access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL | CREATE_TMP_ACL;
}
#endif
- VOID(push_dynamic(&acl_hosts,(gptr) &host));
+ VOID(push_dynamic(&acl_hosts,(uchar*) &host));
}
- qsort((gptr) dynamic_element(&acl_hosts,0,ACL_HOST*),acl_hosts.elements,
+ qsort((uchar*) dynamic_element(&acl_hosts,0,ACL_HOST*),acl_hosts.elements,
sizeof(ACL_HOST),(qsort_cmp) acl_compare);
end_read_record(&read_record_info);
freeze_size(&acl_hosts);
@@ -546,13 +546,13 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
user.access|= SUPER_ACL | EXECUTE_ACL;
#endif
}
- VOID(push_dynamic(&acl_users,(gptr) &user));
+ VOID(push_dynamic(&acl_users,(uchar*) &user));
if (!user.host.hostname ||
(user.host.hostname[0] == wild_many && !user.host.hostname[1]))
allow_all_hosts=1; // Anyone can connect
}
}
- qsort((gptr) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements,
+ qsort((uchar*) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements,
sizeof(ACL_USER),(qsort_cmp) acl_compare);
end_read_record(&read_record_info);
freeze_size(&acl_users);
@@ -609,9 +609,9 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
db.access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL;
}
#endif
- VOID(push_dynamic(&acl_dbs,(gptr) &db));
+ VOID(push_dynamic(&acl_dbs,(uchar*) &db));
}
- qsort((gptr) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
+ qsort((uchar*) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
sizeof(ACL_DB),(qsort_cmp) acl_compare);
end_read_record(&read_record_info);
freeze_size(&acl_dbs);
@@ -1152,11 +1152,11 @@ bool acl_getroot_no_password(Security_context *sctx, char *user, char *host,
DBUG_RETURN(res);
}
-static byte* check_get_key(ACL_USER *buff,uint *length,
- my_bool not_used __attribute__((unused)))
+static uchar* check_get_key(ACL_USER *buff, size_t *length,
+ my_bool not_used __attribute__((unused)))
{
*length=buff->hostname_length;
- return (byte*) buff->host.hostname;
+ return (uchar*) buff->host.hostname;
}
@@ -1237,11 +1237,11 @@ static void acl_insert_user(const char *user, const char *host,
set_user_salt(&acl_user, password, password_len);
- VOID(push_dynamic(&acl_users,(gptr) &acl_user));
+ VOID(push_dynamic(&acl_users,(uchar*) &acl_user));
if (!acl_user.host.hostname ||
(acl_user.host.hostname[0] == wild_many && !acl_user.host.hostname[1]))
allow_all_hosts=1; // Anyone can connect /* purecov: tested */
- qsort((gptr) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements,
+ qsort((uchar*) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements,
sizeof(ACL_USER),(qsort_cmp) acl_compare);
/* Rebuild 'acl_check_hosts' since 'acl_users' has been modified */
@@ -1303,8 +1303,8 @@ static void acl_insert_db(const char *user, const char *host, const char *db,
acl_db.db=strdup_root(&mem,db);
acl_db.access=privileges;
acl_db.sort=get_sort(3,acl_db.host.hostname,acl_db.db,acl_db.user);
- VOID(push_dynamic(&acl_dbs,(gptr) &acl_db));
- qsort((gptr) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
+ VOID(push_dynamic(&acl_dbs,(uchar*) &acl_db));
+ qsort((uchar*) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
sizeof(ACL_DB),(qsort_cmp) acl_compare);
}
@@ -1321,7 +1321,8 @@ ulong acl_get(const char *host, const char *ip,
const char *user, const char *db, my_bool db_is_pattern)
{
ulong host_access= ~(ulong)0, db_access= 0;
- uint i,key_length;
+ uint i;
+ size_t key_length;
char key[ACL_KEY_LENGTH],*tmp_db,*end;
acl_entry *entry;
DBUG_ENTER("acl_get");
@@ -1333,8 +1334,9 @@ ulong acl_get(const char *host, const char *ip,
my_casedn_str(files_charset_info, tmp_db);
db=tmp_db;
}
- key_length=(uint) (end-key);
- if (!db_is_pattern && (entry=(acl_entry*) acl_cache->search(key,key_length)))
+ key_length= (size_t) (end-key);
+ if (!db_is_pattern && (entry=(acl_entry*) acl_cache->search((uchar*) key,
+ key_length)))
{
db_access=entry->access;
VOID(pthread_mutex_unlock(&acl_cache->lock));
@@ -1388,7 +1390,7 @@ exit:
{
entry->access=(db_access & host_access);
entry->length=key_length;
- memcpy((gptr) entry->key,key,key_length);
+ memcpy((uchar*) entry->key,key,key_length);
acl_cache->add(entry);
}
VOID(pthread_mutex_unlock(&acl_cache->lock));
@@ -1430,12 +1432,12 @@ static void init_check_host(void)
break; // already stored
}
if (j == acl_wild_hosts.elements) // If new
- (void) push_dynamic(&acl_wild_hosts,(char*) &acl_user->host);
+ (void) push_dynamic(&acl_wild_hosts,(uchar*) &acl_user->host);
}
- else if (!hash_search(&acl_check_hosts,(byte*) acl_user->host.hostname,
- (uint) strlen(acl_user->host.hostname)))
+ else if (!hash_search(&acl_check_hosts,(uchar*) acl_user->host.hostname,
+ strlen(acl_user->host.hostname)))
{
- if (my_hash_insert(&acl_check_hosts,(byte*) acl_user))
+ if (my_hash_insert(&acl_check_hosts,(uchar*) acl_user))
{ // End of memory
allow_all_hosts=1; // Should never happen
DBUG_VOID_RETURN;
@@ -1473,8 +1475,8 @@ bool acl_check_host(const char *host, const char *ip)
return 0;
VOID(pthread_mutex_lock(&acl_cache->lock));
- if (host && hash_search(&acl_check_hosts,(byte*) host,(uint) strlen(host)) ||
- ip && hash_search(&acl_check_hosts,(byte*) ip,(uint) strlen(ip)))
+ if (host && hash_search(&acl_check_hosts,(uchar*) host,strlen(host)) ||
+ ip && hash_search(&acl_check_hosts,(uchar*) ip, strlen(ip)))
{
VOID(pthread_mutex_unlock(&acl_cache->lock));
return 0; // Found host
@@ -1533,7 +1535,7 @@ bool check_change_password(THD *thd, const char *host, const char *user,
MYF(0));
return(1);
}
- uint len=strlen(new_password);
+ size_t len= strlen(new_password);
if (len && len != SCRAMBLED_PASSWORD_CHAR_LENGTH &&
len != SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
{
@@ -1567,7 +1569,7 @@ bool change_password(THD *thd, const char *host, const char *user,
/* Buffer should be extended when password length is extended. */
char buff[512];
ulong query_length;
- uint new_password_len= strlen(new_password);
+ uint new_password_len= (uint) strlen(new_password);
bool result= 1;
DBUG_ENTER("change_password");
DBUG_PRINT("enter",("host: '%s' user: '%s' new_password: '%s'",
@@ -1768,8 +1770,8 @@ bool hostname_requires_resolving(const char *hostname)
char cur;
if (!hostname)
return FALSE;
- int namelen= strlen(hostname);
- int lhlen= strlen(my_localhost);
+ size_t namelen= strlen(hostname);
+ size_t lhlen= strlen(my_localhost);
if ((namelen == lhlen) &&
!my_strnncoll(system_charset_info, (const uchar *)hostname, namelen,
(const uchar *)my_localhost, strlen(my_localhost)))
@@ -1809,11 +1811,11 @@ static bool update_user_table(THD *thd, TABLE *table,
table->use_all_columns();
table->field[0]->store(host,(uint) strlen(host), system_charset_info);
table->field[1]->store(user,(uint) strlen(user), system_charset_info);
- key_copy((byte *) user_key, table->record[0], table->key_info,
+ key_copy((uchar *) user_key, table->record[0], table->key_info,
table->key_info->key_length);
if (table->file->index_read_idx(table->record[0], 0,
- (byte *) user_key, HA_WHOLE_KEY,
+ (uchar *) user_key, HA_WHOLE_KEY,
HA_READ_KEY_EXACT))
{
my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH),
@@ -1878,7 +1880,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
const char *password= "";
uint password_len= 0;
char what= (revoke_grant) ? 'N' : 'Y';
- byte user_key[MAX_KEY_LENGTH];
+ uchar user_key[MAX_KEY_LENGTH];
LEX *lex= thd->lex;
DBUG_ENTER("replace_user_table");
@@ -2096,7 +2098,7 @@ static int replace_db_table(TABLE *table, const char *db,
bool old_row_exists=0;
int error;
char what= (revoke_grant) ? 'N' : 'Y';
- byte user_key[MAX_KEY_LENGTH];
+ uchar user_key[MAX_KEY_LENGTH];
DBUG_ENTER("replace_db_table");
if (!initialized)
@@ -2198,16 +2200,16 @@ public:
uint key_length;
GRANT_COLUMN(String &c, ulong y) :rights (y)
{
- column= memdup_root(&memex,c.ptr(), key_length=c.length());
+ column= (char*) memdup_root(&memex,c.ptr(), key_length=c.length());
}
};
-static byte* get_key_column(GRANT_COLUMN *buff,uint *length,
+static uchar* get_key_column(GRANT_COLUMN *buff, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length=buff->key_length;
- return (byte*) buff->column;
+ return (uchar*) buff->column;
}
@@ -2218,7 +2220,7 @@ public:
char *db, *user, *tname, *hash_key;
ulong privs;
ulong sort;
- uint key_length;
+ size_t key_length;
GRANT_NAME(const char *h, const char *d,const char *u,
const char *t, ulong p);
GRANT_NAME (TABLE *form);
@@ -2257,8 +2259,8 @@ GRANT_NAME::GRANT_NAME(const char *h, const char *d,const char *u,
my_casedn_str(files_charset_info, db);
my_casedn_str(files_charset_info, tname);
}
- key_length =(uint) strlen(d)+(uint) strlen(u)+(uint) strlen(t)+3;
- hash_key = (char*) alloc_root(&memex,key_length);
+ key_length= strlen(d) + strlen(u)+ strlen(t)+3;
+ hash_key= (char*) alloc_root(&memex,key_length);
strmov(strmov(strmov(hash_key,user)+1,db)+1,tname);
}
@@ -2292,9 +2294,8 @@ GRANT_NAME::GRANT_NAME(TABLE *form)
my_casedn_str(files_charset_info, db);
my_casedn_str(files_charset_info, tname);
}
- key_length = ((uint) strlen(db) + (uint) strlen(user) +
- (uint) strlen(tname) + 3);
- hash_key = (char*) alloc_root(&memex,key_length);
+ key_length= (strlen(db) + strlen(user) + strlen(tname) + 3);
+ hash_key= (char*) alloc_root(&memex, key_length);
strmov(strmov(strmov(hash_key,user)+1,db)+1,tname);
privs = (ulong) form->field[6]->val_int();
privs = fix_rights_for_table(privs);
@@ -2304,7 +2305,7 @@ GRANT_NAME::GRANT_NAME(TABLE *form)
GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
:GRANT_NAME(form)
{
- byte key[MAX_KEY_LENGTH];
+ uchar key[MAX_KEY_LENGTH];
if (!db || !tname)
{
@@ -2338,7 +2339,7 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
col_privs->field[4]->store("",0, &my_charset_latin1);
col_privs->file->ha_index_init(0, 1);
- if (col_privs->file->index_read(col_privs->record[0], (byte*) key,
+ if (col_privs->file->index_read(col_privs->record[0], (uchar*) key,
(key_part_map)15, HA_READ_KEY_EXACT))
{
cols = 0; /* purecov: deadcode */
@@ -2359,7 +2360,7 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
privs = cols = 0; /* purecov: deadcode */
return; /* purecov: deadcode */
}
- my_hash_insert(&hash_columns, (byte *) mem_check);
+ my_hash_insert(&hash_columns, (uchar *) mem_check);
} while (!col_privs->file->index_next(col_privs->record[0]) &&
!key_cmp_if_same(col_privs,key,0,key_prefix_len));
col_privs->file->ha_index_end();
@@ -2373,11 +2374,11 @@ GRANT_TABLE::~GRANT_TABLE()
}
-static byte* get_grant_table(GRANT_NAME *buff,uint *length,
+static uchar* get_grant_table(GRANT_NAME *buff, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length=buff->key_length;
- return (byte*) buff->hash_key;
+ return (uchar*) buff->hash_key;
}
@@ -2401,10 +2402,10 @@ static GRANT_NAME *name_hash_search(HASH *name_hash,
HASH_SEARCH_STATE state;
len = (uint) (strmov(strmov(strmov(helping,user)+1,db)+1,tname)-helping)+ 1;
- for (grant_name= (GRANT_NAME*) hash_first(name_hash, (byte*) helping,
+ for (grant_name= (GRANT_NAME*) hash_first(name_hash, (uchar*) helping,
len, &state);
grant_name ;
- grant_name= (GRANT_NAME*) hash_next(name_hash,(byte*) helping,
+ grant_name= (GRANT_NAME*) hash_next(name_hash,(uchar*) helping,
len, &state))
{
if (exact)
@@ -2449,7 +2450,7 @@ table_hash_search(const char *host, const char *ip, const char *db,
inline GRANT_COLUMN *
column_hash_search(GRANT_TABLE *t, const char *cname, uint length)
{
- return (GRANT_COLUMN*) hash_search(&t->hash_columns, (byte*) cname,length);
+ return (GRANT_COLUMN*) hash_search(&t->hash_columns, (uchar*) cname,length);
}
@@ -2460,7 +2461,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
ulong rights, bool revoke_grant)
{
int error=0,result=0;
- byte key[MAX_KEY_LENGTH];
+ uchar key[MAX_KEY_LENGTH];
uint key_prefix_length;
KEY_PART_INFO *key_part= table->key_info->key_part;
DBUG_ENTER("replace_column_table");
@@ -2491,7 +2492,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
{
ulong privileges= column->rights;
bool old_row_exists=0;
- byte user_key[MAX_KEY_LENGTH];
+ uchar user_key[MAX_KEY_LENGTH];
key_restore(table->record[0],key,table->key_info,
key_prefix_length);
@@ -2562,7 +2563,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
goto end; /* purecov: inspected */
}
grant_column= new GRANT_COLUMN(column->column,privileges);
- my_hash_insert(&g_t->hash_columns,(byte*) grant_column);
+ my_hash_insert(&g_t->hash_columns,(uchar*) grant_column);
}
}
@@ -2573,7 +2574,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
if (revoke_grant)
{
- byte user_key[MAX_KEY_LENGTH];
+ uchar user_key[MAX_KEY_LENGTH];
key_copy(user_key, table->record[0], table->key_info,
key_prefix_length);
@@ -2625,7 +2626,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
goto end; /* purecov: deadcode */
}
if (grant_column)
- hash_delete(&g_t->hash_columns,(byte*) grant_column);
+ hash_delete(&g_t->hash_columns,(uchar*) grant_column);
}
}
} while (!table->file->index_next(table->record[0]) &&
@@ -2648,7 +2649,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
int old_row_exists = 1;
int error=0;
ulong store_table_rights, store_col_rights;
- byte user_key[MAX_KEY_LENGTH];
+ uchar user_key[MAX_KEY_LENGTH];
DBUG_ENTER("replace_table_table");
strxmov(grantor, thd->security_ctx->user, "@",
@@ -2748,7 +2749,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
}
else
{
- hash_delete(&column_priv_hash,(byte*) grant_table);
+ hash_delete(&column_priv_hash,(uchar*) grant_table);
}
DBUG_RETURN(0);
@@ -2802,7 +2803,7 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name,
store_record(table,record[1]); // store at pos 1
if (table->file->index_read_idx(table->record[0], 0,
- (byte*) table->field[0]->ptr, HA_WHOLE_KEY,
+ (uchar*) table->field[0]->ptr, HA_WHOLE_KEY,
HA_READ_KEY_EXACT))
{
/*
@@ -2865,7 +2866,7 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name,
}
else
{
- hash_delete(is_proc ? &proc_priv_hash : &func_priv_hash,(byte*) grant_name);
+ hash_delete(is_proc ? &proc_priv_hash : &func_priv_hash,(uchar*) grant_name);
}
DBUG_RETURN(0);
@@ -3081,7 +3082,7 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
result= TRUE; /* purecov: deadcode */
continue; /* purecov: deadcode */
}
- my_hash_insert(&column_priv_hash,(byte*) grant_table);
+ my_hash_insert(&column_priv_hash,(uchar*) grant_table);
}
/* If revoke_grant, calculate the new column privilege for tables_priv */
@@ -3300,7 +3301,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
result= TRUE;
continue;
}
- my_hash_insert(is_proc ? &proc_priv_hash : &func_priv_hash,(byte*) grant_name);
+ my_hash_insert(is_proc ? &proc_priv_hash : &func_priv_hash,(uchar*) grant_name);
}
if (replace_routine_table(thd, grant_name, tables[1].table, *Str,
@@ -3572,7 +3573,7 @@ static my_bool grant_load(TABLE_LIST *tables)
if (! mem_check->ok())
delete mem_check;
- else if (my_hash_insert(&column_priv_hash,(byte*) mem_check))
+ else if (my_hash_insert(&column_priv_hash,(uchar*) mem_check))
{
delete mem_check;
grant_option= FALSE;
@@ -3628,7 +3629,7 @@ static my_bool grant_load(TABLE_LIST *tables)
mem_check->privs= fix_rights_for_procedure(mem_check->privs);
if (! mem_check->ok())
delete mem_check;
- else if (my_hash_insert(hash, (byte*) mem_check))
+ else if (my_hash_insert(hash, (uchar*) mem_check))
{
delete mem_check;
grant_option= FALSE;
@@ -5002,7 +5003,7 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop,
char *user_str= user_from->user.str;
const char *host;
const char *user;
- byte user_key[MAX_KEY_LENGTH];
+ uchar user_key[MAX_KEY_LENGTH];
uint key_prefix_length;
DBUG_ENTER("handle_grant_table");
@@ -5239,11 +5240,11 @@ static int handle_grant_struct(uint struct_no, bool drop,
break;
case 2:
- hash_delete(&column_priv_hash, (byte*) grant_name);
+ hash_delete(&column_priv_hash, (uchar*) grant_name);
break;
case 3:
- hash_delete(&proc_priv_hash, (byte*) grant_name);
+ hash_delete(&proc_priv_hash, (uchar*) grant_name);
break;
}
elements--;
@@ -6081,15 +6082,15 @@ void update_schema_privilege(TABLE *table, char *buff, const char* db,
int i= 2;
CHARSET_INFO *cs= system_charset_info;
restore_record(table, s->default_values);
- table->field[0]->store(buff, strlen(buff), cs);
+ table->field[0]->store(buff, (uint) strlen(buff), cs);
if (db)
- table->field[i++]->store(db, strlen(db), cs);
+ table->field[i++]->store(db, (uint) strlen(db), cs);
if (t_name)
- table->field[i++]->store(t_name, strlen(t_name), cs);
+ table->field[i++]->store(t_name, (uint) strlen(t_name), cs);
if (column)
table->field[i++]->store(column, col_length, cs);
table->field[i++]->store(priv, priv_length, cs);
- table->field[i]->store(is_grantable, strlen(is_grantable), cs);
+ table->field[i]->store(is_grantable, (uint) strlen(is_grantable), cs);
table->file->ha_write_row(table->record[0]);
}
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index e7decf4a8fc..6b4aaa26236 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -498,7 +498,7 @@ void field_decimal::add()
if (room_in_tree)
{
- char buf[DECIMAL_MAX_FIELD_SIZE];
+ uchar buf[DECIMAL_MAX_FIELD_SIZE];
my_decimal2binary(E_DEC_FATAL_ERROR, dec, buf,
item->max_length, item->decimals);
if (!(element = tree_insert(&tree, (void*)buf, 0, tree.custom_arg)))
@@ -1108,7 +1108,7 @@ int collect_real(double *element, element_count count __attribute__((unused)),
} // collect_real
-int collect_decimal(char *element, element_count count,
+int collect_decimal(uchar *element, element_count count,
TREE_INFO *info)
{
char buff[DECIMAL_MAX_STR_LENGTH];
diff --git a/sql/sql_analyse.h b/sql/sql_analyse.h
index ac671b85e1e..ae5d88bf93e 100644
--- a/sql/sql_analyse.h
+++ b/sql/sql_analyse.h
@@ -143,7 +143,7 @@ public:
};
-int collect_decimal(char *element, element_count count,
+int collect_decimal(uchar *element, element_count count,
TREE_INFO *info);
class field_decimal :public field_info
@@ -165,7 +165,7 @@ public:
String *get_min_arg(String *);
String *get_max_arg(String *);
String *avg(String *s, ha_rows rows);
- friend int collect_decimal(char *element, element_count count,
+ friend int collect_decimal(uchar *element, element_count count,
TREE_INFO *info);
tree_walk_action collect_enum()
{ return (tree_walk_action) collect_decimal; }
diff --git a/sql/sql_array.h b/sql/sql_array.h
index e2e12bee241..ab6fdd0c5c0 100644
--- a/sql/sql_array.h
+++ b/sql/sql_array.h
@@ -45,7 +45,7 @@ public:
bool append(Elem &el)
{
- return (insert_dynamic(&array, (gptr)&el));
+ return (insert_dynamic(&array, (uchar*)&el));
}
int elements()
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index f26d6e5777b..561d176c342 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -104,19 +104,19 @@ static bool
has_two_write_locked_tables_with_auto_increment(TABLE_LIST *tables);
-extern "C" byte *table_cache_key(const byte *record,uint *length,
+extern "C" uchar *table_cache_key(const uchar *record, size_t *length,
my_bool not_used __attribute__((unused)))
{
TABLE *entry=(TABLE*) record;
*length= entry->s->table_cache_key.length;
- return (byte*) entry->s->table_cache_key.str;
+ return (uchar*) entry->s->table_cache_key.str;
}
bool table_cache_init(void)
{
return hash_init(&open_cache, &my_charset_bin, table_cache_size+16,
- 0, 0,table_cache_key,
+ 0, 0, table_cache_key,
(hash_free_key) free_cache_entry, 0) != 0;
}
@@ -243,12 +243,12 @@ uint create_table_def_key(THD *thd, char *key, TABLE_LIST *table_list,
Functions to handle table definition cach (TABLE_SHARE)
*****************************************************************************/
-extern "C" byte *table_def_key(const byte *record, uint *length,
+extern "C" uchar *table_def_key(const uchar *record, size_t *length,
my_bool not_used __attribute__((unused)))
{
TABLE_SHARE *entry=(TABLE_SHARE*) record;
*length= entry->table_cache_key.length;
- return (byte*) entry->table_cache_key.str;
+ return (uchar*) entry->table_cache_key.str;
}
@@ -334,7 +334,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
*error= 0;
/* Read table definition from cache */
- if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(byte*) key,
+ if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key,
key_length)))
goto found;
@@ -351,7 +351,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
pthread_mutex_unlock(&LOCK_open);
pthread_mutex_lock(&LOCK_open);
/* Check that another thread didn't insert the same table in between */
- if ((old_share= hash_search(&table_def_cache, (byte*) key, key_length)))
+ if ((old_share= hash_search(&table_def_cache, (uchar*) key, key_length)))
{
(void) pthread_mutex_lock(&share->mutex);
free_table_share(share);
@@ -381,7 +381,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
*/
assign_new_table_id(share);
- if (my_hash_insert(&table_def_cache, (byte*) share))
+ if (my_hash_insert(&table_def_cache, (uchar*) share))
{
#ifdef WAITING_FOR_TABLE_DEF_CACHE_STAGE_3
pthread_mutex_unlock(&LOCK_open);
@@ -407,7 +407,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
(void) pthread_mutex_lock(&share->mutex);
#endif
*error= share->error;
- (void) hash_delete(&table_def_cache, (byte*) share);
+ (void) hash_delete(&table_def_cache, (uchar*) share);
DBUG_RETURN(0);
}
share->ref_count++; // Mark in use
@@ -462,7 +462,7 @@ found:
oldest_unused_share->next)
{
pthread_mutex_lock(&oldest_unused_share->mutex);
- VOID(hash_delete(&table_def_cache, (byte*) oldest_unused_share));
+ VOID(hash_delete(&table_def_cache, (uchar*) oldest_unused_share));
}
DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u",
@@ -585,7 +585,7 @@ void release_table_share(TABLE_SHARE *share, enum release_type type)
if (to_be_deleted)
{
DBUG_PRINT("info", ("Deleting share"));
- hash_delete(&table_def_cache, (byte*) share);
+ hash_delete(&table_def_cache, (uchar*) share);
DBUG_VOID_RETURN;
}
pthread_mutex_unlock(&share->mutex);
@@ -611,13 +611,13 @@ void release_table_share(TABLE_SHARE *share, enum release_type type)
This code is execured when someone does FLUSH TABLES while on has
locked tables.
*/
- (void) hash_search(&def_cache,(byte*) key,key_length);
- hash_replace(&def_cache, def_cache.current_record,(byte*) name_lock);
+ (void) hash_search(&def_cache,(uchar*) key,key_length);
+ hash_replace(&def_cache, def_cache.current_record,(uchar*) name_lock);
}
else
{
/* Remove table definition */
- hash_delete(&def_cache,(byte*) share);
+ hash_delete(&def_cache,(uchar*) share);
}
pthread_mutex_unlock(&LOCK_open);
free_table_share(share);
@@ -662,7 +662,7 @@ TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name)
table_list.db= (char*) db;
table_list.table_name= (char*) table_name;
key_length= create_table_def_key((THD*) 0, key, &table_list, 0);
- return (TABLE_SHARE*) hash_search(&table_def_cache,(byte*) key, key_length);
+ return (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key, key_length);
}
@@ -840,7 +840,7 @@ static void free_cache_entry(TABLE *table)
}
check_unused(); // consisty check
}
- my_free((gptr) table,MYF(0));
+ my_free((uchar*) table,MYF(0));
DBUG_VOID_RETURN;
}
@@ -852,7 +852,7 @@ void free_io_cache(TABLE *table)
if (table->sort.io_cache)
{
close_cached_file(table->sort.io_cache);
- my_free((gptr) table->sort.io_cache,MYF(0));
+ my_free((uchar*) table->sort.io_cache,MYF(0));
table->sort.io_cache=0;
}
DBUG_VOID_RETURN;
@@ -881,17 +881,17 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
while (unused_tables)
{
#ifdef EXTRA_DEBUG
- if (hash_delete(&open_cache,(byte*) unused_tables))
+ if (hash_delete(&open_cache,(uchar*) unused_tables))
printf("Warning: Couldn't delete open table from hash\n");
#else
- VOID(hash_delete(&open_cache,(byte*) unused_tables));
+ VOID(hash_delete(&open_cache,(uchar*) unused_tables));
#endif
}
/* Free table shares */
while (oldest_unused_share->next)
{
pthread_mutex_lock(&oldest_unused_share->mutex);
- VOID(hash_delete(&table_def_cache, (byte*) oldest_unused_share));
+ VOID(hash_delete(&table_def_cache, (uchar*) oldest_unused_share));
}
}
else
@@ -1216,7 +1216,7 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived)
/* Free tables to hold down open files */
while (open_cache.records > table_cache_size && unused_tables)
- VOID(hash_delete(&open_cache,(byte*) unused_tables)); /* purecov: tested */
+ VOID(hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */
check_unused();
if (found_old_table)
{
@@ -1255,7 +1255,7 @@ bool close_thread_table(THD *thd, TABLE **table_ptr)
if (table->s->version != refresh_version ||
thd->version != refresh_version || !table->db_stat)
{
- VOID(hash_delete(&open_cache,(byte*) table));
+ VOID(hash_delete(&open_cache,(uchar*) table));
found_old_table=1;
}
else
@@ -1799,7 +1799,7 @@ TABLE *unlink_open_table(THD *thd, TABLE *list, TABLE *find)
{
if (thd->locked_tables)
mysql_lock_remove(thd, thd->locked_tables,list);
- VOID(hash_delete(&open_cache,(byte*) list)); // Close table
+ VOID(hash_delete(&open_cache,(uchar*) list)); // Close table
}
else
{
@@ -1964,7 +1964,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
*refresh=0;
/* an open table operation needs a lot of the stack space */
- if (check_stack_overrun(thd, STACK_MIN_SIZE_FOR_OPEN, (char *)&alias))
+ if (check_stack_overrun(thd, STACK_MIN_SIZE_FOR_OPEN, (uchar *)&alias))
DBUG_RETURN(0);
if (thd->killed)
@@ -2179,10 +2179,10 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
an implicit "pending locks queue" - see
wait_for_locked_table_names for details.
*/
- for (table= (TABLE*) hash_first(&open_cache, (byte*) key, key_length,
+ for (table= (TABLE*) hash_first(&open_cache, (uchar*) key, key_length,
&state);
table && table->in_use ;
- table= (TABLE*) hash_next(&open_cache, (byte*) key, key_length,
+ table= (TABLE*) hash_next(&open_cache, (uchar*) key, key_length,
&state))
{
/*
@@ -2271,7 +2271,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
int error;
/* Free cache if too big */
while (open_cache.records > table_cache_size && unused_tables)
- VOID(hash_delete(&open_cache,(byte*) unused_tables)); /* purecov: tested */
+ VOID(hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */
/* make a new table */
if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME))))
@@ -2284,7 +2284,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
mem_root, (flags & OPEN_VIEW_NO_PARSE));
if (error > 0)
{
- my_free((gptr)table, MYF(0));
+ my_free((uchar*)table, MYF(0));
VOID(pthread_mutex_unlock(&LOCK_open));
DBUG_RETURN(NULL);
}
@@ -2297,12 +2297,12 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
if (error < 0)
table_list->view= (st_lex*)1;
- my_free((gptr)table, MYF(0));
+ my_free((uchar*)table, MYF(0));
VOID(pthread_mutex_unlock(&LOCK_open));
DBUG_RETURN(0); // VIEW
}
DBUG_PRINT("info", ("inserting table 0x%lx into the cache", (long) table));
- VOID(my_hash_insert(&open_cache,(byte*) table));
+ VOID(my_hash_insert(&open_cache,(uchar*) table));
}
check_unused(); // Debugging call
@@ -2525,7 +2525,7 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh)
if (!tables || (!db_stat && reopen_table(table)))
{
my_error(ER_CANT_REOPEN_TABLE, MYF(0), table->alias);
- VOID(hash_delete(&open_cache,(byte*) table));
+ VOID(hash_delete(&open_cache,(uchar*) table));
error=1;
}
else
@@ -2556,7 +2556,7 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh)
}
if (get_locks && tables)
{
- my_afree((gptr) tables);
+ my_afree((uchar*) tables);
}
broadcast_refresh();
*prev=0;
@@ -2623,10 +2623,10 @@ bool table_is_used(TABLE *table, bool wait_for_name_lock)
DBUG_PRINT("loop", ("table_name: %s", table->alias));
HASH_SEARCH_STATE state;
- for (TABLE *search= (TABLE*) hash_first(&open_cache, (byte*) key,
+ for (TABLE *search= (TABLE*) hash_first(&open_cache, (uchar*) key,
key_length, &state);
search ;
- search= (TABLE*) hash_next(&open_cache, (byte*) key,
+ search= (TABLE*) hash_next(&open_cache, (uchar*) key,
key_length, &state))
{
DBUG_PRINT("info", ("share: 0x%lx locked_by_logger: %d "
@@ -2741,7 +2741,7 @@ TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name)
else
{
/* We already have a name lock, remove copy */
- VOID(hash_delete(&open_cache,(byte*) table));
+ VOID(hash_delete(&open_cache,(uchar*) table));
}
}
else
@@ -2755,7 +2755,7 @@ TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name)
broadcast_refresh();
if (thd->locked_tables && thd->locked_tables->table_count == 0)
{
- my_free((gptr) thd->locked_tables,MYF(0));
+ my_free((uchar*) thd->locked_tables,MYF(0));
thd->locked_tables=0;
}
DBUG_RETURN(found);
@@ -4157,7 +4157,7 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, uint length,
field_ptr= table->field + cached_field_index;
else if (table->s->name_hash.records)
{
- field_ptr= (Field**) hash_search(&table->s->name_hash, (byte*) name,
+ field_ptr= (Field**) hash_search(&table->s->name_hash, (uchar*) name,
length);
if (field_ptr)
{
@@ -4365,7 +4365,7 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
else
{
if (thd->mark_used_columns == MARK_COLUMNS_READ)
- it->walk(&Item::register_field_in_read_map, 1, (byte *) 0);
+ it->walk(&Item::register_field_in_read_map, 1, (uchar *) 0);
}
}
else
@@ -4404,7 +4404,7 @@ Field *find_field_in_table_sef(TABLE *table, const char *name)
Field **field_ptr;
if (table->s->name_hash.records)
{
- field_ptr= (Field**)hash_search(&table->s->name_hash,(byte*) name,
+ field_ptr= (Field**)hash_search(&table->s->name_hash,(uchar*) name,
strlen(name));
if (field_ptr)
{
@@ -6496,14 +6496,15 @@ my_bool mysql_rm_tmp_tables(void)
(file->name[1] == '.' && !file->name[2])))
continue;
- if (!bcmp(file->name,tmp_file_prefix,tmp_file_prefix_length))
+ if (!bcmp((uchar*) file->name, (uchar*) tmp_file_prefix,
+ tmp_file_prefix_length))
{
char *ext= fn_ext(file->name);
uint ext_len= strlen(ext);
uint filePath_len= my_snprintf(filePath, sizeof(filePath),
"%s%c%s", tmpdir, FN_LIBCHAR,
file->name);
- if (!bcmp(reg_ext, ext, ext_len))
+ if (!bcmp((uchar*) reg_ext, (uchar*) ext, ext_len))
{
handler *handler_file= 0;
/* We should cut file extention before deleting of table */
@@ -6566,7 +6567,7 @@ void remove_db_from_cache(const char *db)
}
}
while (unused_tables && !unused_tables->s->version)
- VOID(hash_delete(&open_cache,(byte*) unused_tables));
+ VOID(hash_delete(&open_cache,(uchar*) unused_tables));
}
@@ -6582,7 +6583,7 @@ void flush_tables()
{
(void) pthread_mutex_lock(&LOCK_open);
while (unused_tables)
- hash_delete(&open_cache,(byte*) unused_tables);
+ hash_delete(&open_cache,(uchar*) unused_tables);
(void) pthread_mutex_unlock(&LOCK_open);
}
@@ -6619,10 +6620,10 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
HASH_SEARCH_STATE state;
result= signalled= 0;
- for (table= (TABLE*) hash_first(&open_cache, (byte*) key, key_length,
+ for (table= (TABLE*) hash_first(&open_cache, (uchar*) key, key_length,
&state);
table;
- table= (TABLE*) hash_next(&open_cache, (byte*) key, key_length,
+ table= (TABLE*) hash_next(&open_cache, (uchar*) key, key_length,
&state))
{
THD *in_use;
@@ -6677,11 +6678,11 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
}
}
while (unused_tables && !unused_tables->s->version)
- VOID(hash_delete(&open_cache,(byte*) unused_tables));
+ VOID(hash_delete(&open_cache,(uchar*) unused_tables));
DBUG_PRINT("info", ("Removing table from table_def_cache"));
/* Remove table from table definition cache if it's not in use */
- if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(byte*) key,
+ if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key,
key_length)))
{
DBUG_PRINT("info", ("share version: %lu ref_count: %u",
@@ -6690,7 +6691,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
if (share->ref_count == 0)
{
pthread_mutex_lock(&share->mutex);
- VOID(hash_delete(&table_def_cache, (byte*) share));
+ VOID(hash_delete(&table_def_cache, (uchar*) share));
}
}
@@ -6932,10 +6933,10 @@ void mysql_wait_completed_table(ALTER_PARTITION_PARAM_TYPE *lpt, TABLE *my_table
key_length=(uint) (strmov(strmov(key,lpt->db)+1,lpt->table_name)-key)+1;
VOID(pthread_mutex_lock(&LOCK_open));
HASH_SEARCH_STATE state;
- for (table= (TABLE*) hash_first(&open_cache,(byte*) key,key_length,
+ for (table= (TABLE*) hash_first(&open_cache,(uchar*) key,key_length,
&state) ;
table;
- table= (TABLE*) hash_next(&open_cache,(byte*) key,key_length,
+ table= (TABLE*) hash_next(&open_cache,(uchar*) key,key_length,
&state))
{
THD *in_use= table->in_use;
diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc
index d3fdd95707c..77432ce518e 100644
--- a/sql/sql_binlog.cc
+++ b/sql/sql_binlog.cc
@@ -33,8 +33,8 @@ void mysql_client_binlog_statement(THD* thd)
{
DBUG_ENTER("mysql_client_binlog_statement");
DBUG_PRINT("info",("binlog base64: '%*s'",
- (thd->lex->comment.length < 2048 ?
- thd->lex->comment.length : 2048),
+ (int) (thd->lex->comment.length < 2048 ?
+ thd->lex->comment.length : 2048),
thd->lex->comment.str));
/*
@@ -44,8 +44,8 @@ void mysql_client_binlog_statement(THD* thd)
my_bool nsok= thd->net.no_send_ok;
thd->net.no_send_ok= TRUE;
- my_size_t coded_len= thd->lex->comment.length + 1;
- my_size_t decoded_len= base64_needed_decoded_length(coded_len);
+ size_t coded_len= thd->lex->comment.length + 1;
+ size_t decoded_len= base64_needed_decoded_length(coded_len);
DBUG_ASSERT(coded_len > 0);
/*
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 8d8838d4585..ae8f82204cb 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -365,7 +365,7 @@ TYPELIB query_cache_type_typelib=
inline Query_cache_block * Query_cache_block_table::block()
{
- return (Query_cache_block *)(((byte*)this) -
+ return (Query_cache_block *)(((uchar*)this) -
ALIGN_SIZE(sizeof(Query_cache_block_table)*n) -
ALIGN_SIZE(sizeof(Query_cache_block)));
}
@@ -401,9 +401,9 @@ inline uint Query_cache_block::headers_len()
ALIGN_SIZE(sizeof(Query_cache_block)));
}
-inline gptr Query_cache_block::data(void)
+inline uchar* Query_cache_block::data(void)
{
- return (gptr)( ((byte*)this) + headers_len() );
+ return (uchar*)( ((uchar*)this) + headers_len() );
}
inline Query_cache_query * Query_cache_block::query()
@@ -437,7 +437,7 @@ inline Query_cache_result * Query_cache_block::result()
inline Query_cache_block_table * Query_cache_block::table(TABLE_COUNTER_TYPE n)
{
return ((Query_cache_block_table *)
- (((byte*)this)+ALIGN_SIZE(sizeof(Query_cache_block)) +
+ (((uchar*)this)+ALIGN_SIZE(sizeof(Query_cache_block)) +
n*sizeof(Query_cache_block_table)));
}
@@ -448,13 +448,13 @@ inline Query_cache_block_table * Query_cache_block::table(TABLE_COUNTER_TYPE n)
extern "C"
{
-byte *query_cache_table_get_key(const byte *record, uint *length,
+uchar *query_cache_table_get_key(const uchar *record, size_t *length,
my_bool not_used __attribute__((unused)))
{
Query_cache_block* table_block = (Query_cache_block*) record;
*length = (table_block->used - table_block->headers_len() -
ALIGN_SIZE(sizeof(Query_cache_table)));
- return (((byte *) table_block->data()) +
+ return (((uchar *) table_block->data()) +
ALIGN_SIZE(sizeof(Query_cache_table)));
}
}
@@ -522,7 +522,7 @@ void Query_cache_query::init_n_lock()
my_rwlock_init(&lock, NULL);
lock_writing();
DBUG_PRINT("qcache", ("inited & locked query for block 0x%lx",
- (long) (((byte*) this) -
+ (long) (((uchar*) this) -
ALIGN_SIZE(sizeof(Query_cache_block)))));
DBUG_VOID_RETURN;
}
@@ -532,7 +532,7 @@ void Query_cache_query::unlock_n_destroy()
{
DBUG_ENTER("Query_cache_query::unlock_n_destroy");
DBUG_PRINT("qcache", ("destroyed & unlocked query for block 0x%lx",
- (long) (((byte*) this) -
+ (long) (((uchar*) this) -
ALIGN_SIZE(sizeof(Query_cache_block)))));
/*
The following call is not needed on system where one can destroy an
@@ -546,13 +546,13 @@ void Query_cache_query::unlock_n_destroy()
extern "C"
{
-byte *query_cache_query_get_key(const byte *record, uint *length,
+uchar *query_cache_query_get_key(const uchar *record, size_t *length,
my_bool not_used)
{
Query_cache_block *query_block = (Query_cache_block*) record;
*length = (query_block->used - query_block->headers_len() -
ALIGN_SIZE(sizeof(Query_cache_query)));
- return (((byte *) query_block->data()) +
+ return (((uchar *) query_block->data()) +
ALIGN_SIZE(sizeof(Query_cache_query)));
}
}
@@ -639,7 +639,7 @@ void query_cache_insert(NET *net, const char *packet, ulong length)
done by query_cache.append_result_data if success (if not we need
query_cache.structure_guard_mutex locked to free query)
*/
- if (!query_cache.append_result_data(&result, length, (gptr) packet,
+ if (!query_cache.append_result_data(&result, length, (uchar*) packet,
query_block))
{
DBUG_PRINT("warning", ("Can't append data"));
@@ -927,13 +927,13 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
/* Check if another thread is processing the same query? */
Query_cache_block *competitor = (Query_cache_block *)
- hash_search(&queries, (byte*) thd->query, tot_length);
+ hash_search(&queries, (uchar*) thd->query, tot_length);
DBUG_PRINT("qcache", ("competitor 0x%lx", (ulong) competitor));
if (competitor == 0)
{
/* Query is not in cache and no one is working with it; Store it */
Query_cache_block *query_block;
- query_block= write_block_data(tot_length, (gptr) thd->query,
+ query_block= write_block_data(tot_length, (uchar*) thd->query,
ALIGN_SIZE(sizeof(Query_cache_query)),
Query_cache_block::QUERY, local_tables, 1);
if (query_block != 0)
@@ -943,7 +943,7 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
Query_cache_query *header = query_block->query();
header->init_n_lock();
- if (my_hash_insert(&queries, (byte*) query_block))
+ if (my_hash_insert(&queries, (uchar*) query_block))
{
refused++;
DBUG_PRINT("qcache", ("insertion in query hash"));
@@ -956,7 +956,7 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
{
refused++;
DBUG_PRINT("warning", ("tables list including failed"));
- hash_delete(&queries, (byte *) query_block);
+ hash_delete(&queries, (uchar *) query_block);
header->unlock_n_destroy();
free_memory_block(query_block);
STRUCT_UNLOCK(&structure_guard_mutex);
@@ -965,7 +965,7 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
double_linked_list_simple_include(query_block, &queries_blocks);
inserts++;
queries_in_cache++;
- net->query_cache_query= (gptr) query_block;
+ net->query_cache_query= (uchar*) query_block;
header->writer(net);
header->tables_type(tables_type);
@@ -1130,9 +1130,9 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
flags.sql_mode,
flags.max_sort_length,
flags.group_concat_max_len));
- memcpy((void *)(sql + (tot_length - QUERY_CACHE_FLAGS_SIZE)),
- &flags, QUERY_CACHE_FLAGS_SIZE);
- query_block = (Query_cache_block *) hash_search(&queries, (byte*) sql,
+ memcpy((uchar *)(sql + (tot_length - QUERY_CACHE_FLAGS_SIZE)),
+ (uchar*) &flags, QUERY_CACHE_FLAGS_SIZE);
+ query_block = (Query_cache_block *) hash_search(&queries, (uchar*) sql,
tot_length);
/* Quick abort on unlocked data */
if (query_block == 0 ||
@@ -1243,7 +1243,7 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
("Handler require invalidation queries of %s.%s %lu-%lu",
table_list.db, table_list.alias,
(ulong) engine_data, (ulong) table->engine_data()));
- invalidate_table((byte *) table->db(), table->key_length());
+ invalidate_table((uchar *) table->db(), table->key_length());
}
else
thd->lex->safe_to_cache_query= 0; // Don't try to cache this
@@ -1347,7 +1347,7 @@ void Query_cache::invalidate(CHANGED_TABLE_LIST *tables_used)
DUMP(this);
for (; tables_used; tables_used= tables_used->next)
{
- invalidate_table((byte*) tables_used->key, tables_used->key_length);
+ invalidate_table((uchar*) tables_used->key, tables_used->key_length);
DBUG_PRINT("qcache", ("db: %s table: %s", tables_used->key,
tables_used->key+
strlen(tables_used->key)+1));
@@ -1428,7 +1428,7 @@ void Query_cache::invalidate(THD *thd, const char *key, uint32 key_length,
if (using_transactions) // used for innodb => has_transactions() is TRUE
thd->add_changed_table(key, key_length);
else
- invalidate_table((byte*)key, key_length);
+ invalidate_table((uchar*)key, key_length);
}
STRUCT_UNLOCK(&structure_guard_mutex);
@@ -1489,8 +1489,8 @@ void Query_cache::invalidate_by_MyISAM_filename(const char *filename)
uint key_length= filename_2_table_key(key, filename, &db_length);
Query_cache_block *table_block;
if ((table_block = (Query_cache_block*) hash_search(&tables,
- (byte*) key,
- key_length)))
+ (uchar*) key,
+ key_length)))
invalidate_table(table_block);
}
STRUCT_UNLOCK(&structure_guard_mutex);
@@ -1576,7 +1576,7 @@ ulong Query_cache::init_cache()
DBUG_ENTER("Query_cache::init_cache");
approx_additional_data_size = (sizeof(Query_cache) +
- sizeof(gptr)*(def_query_hash_size+
+ sizeof(uchar*)*(def_query_hash_size+
def_table_hash_size));
if (query_cache_size < approx_additional_data_size)
goto err;
@@ -1632,7 +1632,7 @@ ulong Query_cache::init_cache()
goto err;
query_cache_size -= additional_data_size;
- if (!(cache= (byte *)
+ if (!(cache= (uchar *)
my_malloc_lock(query_cache_size+additional_data_size, MYF(0))))
goto err;
@@ -1800,7 +1800,7 @@ void Query_cache::free_cache()
DBUG_PRINT("qcache", ("free memory %lu (should be %lu)",
free_memory , query_cache_size));
#endif
- my_free((gptr) cache, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) cache, MYF(MY_ALLOW_ZERO_PTR));
make_disabled();
hash_free(&queries);
hash_free(&tables);
@@ -2004,7 +2004,7 @@ void Query_cache::free_query(Query_cache_block *query_block)
(ulong) query_block,
query_block->query()->length() ));
- hash_delete(&queries,(byte *) query_block);
+ hash_delete(&queries,(uchar *) query_block);
free_query_internal(query_block);
DBUG_VOID_RETURN;
@@ -2015,7 +2015,7 @@ void Query_cache::free_query(Query_cache_block *query_block)
*****************************************************************************/
Query_cache_block *
-Query_cache::write_block_data(ulong data_len, gptr data,
+Query_cache::write_block_data(ulong data_len, uchar* data,
ulong header_len,
Query_cache_block::block_type type,
TABLE_COUNTER_TYPE ntab,
@@ -2038,8 +2038,7 @@ Query_cache::write_block_data(ulong data_len, gptr data,
block->n_tables = ntab;
block->used = len;
- memcpy((void*) (((byte *) block)+ all_headers_len),
- (void*) data, data_len);
+ memcpy((uchar *) block+ all_headers_len, data, data_len);
}
DBUG_RETURN(block);
}
@@ -2051,7 +2050,7 @@ Query_cache::write_block_data(ulong data_len, gptr data,
my_bool
Query_cache::append_result_data(Query_cache_block **current_block,
- ulong data_len, gptr data,
+ ulong data_len, uchar* data,
Query_cache_block *query_block)
{
DBUG_ENTER("Query_cache::append_result_data");
@@ -2107,7 +2106,7 @@ Query_cache::append_result_data(Query_cache_block **current_block,
by the next call
*/
success = write_result_data(&new_block, data_len-last_block_free_space,
- (gptr)(((byte*)data)+last_block_free_space),
+ (uchar*)(((uchar*)data)+last_block_free_space),
query_block,
Query_cache_block::RES_CONT);
/*
@@ -2129,8 +2128,7 @@ Query_cache::append_result_data(Query_cache_block **current_block,
ulong to_copy = min(data_len,last_block_free_space);
DBUG_PRINT("qcache", ("use free space %lub at block 0x%lx to copy %lub",
last_block_free_space, (ulong)last_block, to_copy));
- memcpy((void*) (((byte*) last_block) + last_block->used), (void*) data,
- to_copy);
+ memcpy((uchar*) last_block + last_block->used, data, to_copy);
last_block->used+=to_copy;
}
DBUG_RETURN(success);
@@ -2138,7 +2136,7 @@ Query_cache::append_result_data(Query_cache_block **current_block,
my_bool Query_cache::write_result_data(Query_cache_block **result_block,
- ulong data_len, gptr data,
+ ulong data_len, uchar* data,
Query_cache_block *query_block,
Query_cache_block::block_type type)
{
@@ -2164,7 +2162,7 @@ my_bool Query_cache::write_result_data(Query_cache_block **result_block,
ALIGN_SIZE(sizeof(Query_cache_result)));
#ifndef EMBEDDED_LIBRARY
Query_cache_block *block= *result_block;
- byte *rest= (byte*) data;
+ uchar *rest= data;
// Now fill list of blocks that created by allocate_data_chain
do
{
@@ -2172,7 +2170,7 @@ my_bool Query_cache::write_result_data(Query_cache_block **result_block,
ulong length = block->used - headers_len;
DBUG_PRINT("qcache", ("write %lu byte in block 0x%lx",length,
(ulong)block));
- memcpy((void*)(((byte*) block)+headers_len), (void*) rest, length);
+ memcpy((uchar*) block+headers_len, rest, length);
rest += length;
block = block->next;
type = Query_cache_block::RES_CONT;
@@ -2307,18 +2305,18 @@ void Query_cache::invalidate_table(TABLE_LIST *table_list)
// We don't store temporary tables => no key_length+=4 ...
if ((table_block = (Query_cache_block*)
- hash_search(&tables,(byte*) key,key_length)))
+ hash_search(&tables,(uchar*) key,key_length)))
invalidate_table(table_block);
}
}
void Query_cache::invalidate_table(TABLE *table)
{
- invalidate_table((byte*) table->s->table_cache_key.str,
+ invalidate_table((uchar*) table->s->table_cache_key.str,
table->s->table_cache_key.length);
}
-void Query_cache::invalidate_table(byte * key, uint32 key_length)
+void Query_cache::invalidate_table(uchar * key, uint32 key_length)
{
Query_cache_block *table_block;
if ((table_block = ((Query_cache_block*)
@@ -2396,11 +2394,11 @@ Query_cache::register_tables_from_list(TABLE_LIST *tables_used,
else
{
DBUG_PRINT("qcache",
- ("table: %s db: %s openinfo: 0x%lx keylen: %u key: 0x%lx",
+ ("table: %s db: %s openinfo: 0x%lx keylen: %lu key: 0x%lx",
tables_used->table->s->table_name.str,
tables_used->table->s->table_cache_key.str,
(ulong) tables_used->table,
- tables_used->table->s->table_cache_key.length,
+ (ulong) tables_used->table->s->table_cache_key.length,
(ulong) tables_used->table->s->table_cache_key.str));
if (!insert_table(tables_used->table->s->table_cache_key.length,
tables_used->table->s->table_cache_key.str,
@@ -2491,7 +2489,7 @@ Query_cache::insert_table(uint key_len, char *key,
(ulong)node, key_len));
Query_cache_block *table_block = ((Query_cache_block *)
- hash_search(&tables, (byte*) key,
+ hash_search(&tables, (uchar*) key,
key_len));
if (table_block &&
@@ -2515,7 +2513,7 @@ Query_cache::insert_table(uint key_len, char *key,
{
DBUG_PRINT("qcache", ("new table block from 0x%lx (%u)",
(ulong) key, (int) key_len));
- table_block = write_block_data(key_len, (gptr) key,
+ table_block = write_block_data(key_len, (uchar*) key,
ALIGN_SIZE(sizeof(Query_cache_table)),
Query_cache_block::TABLE,
1, 1);
@@ -2530,7 +2528,7 @@ Query_cache::insert_table(uint key_len, char *key,
Query_cache_block_table *list_root = table_block->table(0);
list_root->n = 0;
list_root->next = list_root->prev = list_root;
- if (my_hash_insert(&tables, (const byte *) table_block))
+ if (my_hash_insert(&tables, (const uchar *) table_block))
{
DBUG_PRINT("qcache", ("Can't insert table to hash"));
// write_block_data return locked block
@@ -2567,7 +2565,7 @@ void Query_cache::unlink_table(Query_cache_block_table *node)
Query_cache_block *table_block = neighbour->block();
double_linked_list_exclude(table_block,
&tables_blocks);
- hash_delete(&tables,(byte *) table_block);
+ hash_delete(&tables,(uchar *) table_block);
free_memory_block(table_block);
}
DBUG_VOID_RETURN;
@@ -2722,7 +2720,7 @@ void Query_cache::free_memory_block(Query_cache_block *block)
void Query_cache::split_block(Query_cache_block *block, ulong len)
{
DBUG_ENTER("Query_cache::split_block");
- Query_cache_block *new_block = (Query_cache_block*)(((byte*) block)+len);
+ Query_cache_block *new_block = (Query_cache_block*)(((uchar*) block)+len);
new_block->init(block->length - len);
total_blocks++;
@@ -3149,7 +3147,7 @@ void Query_cache::pack_cache()
DBUG_EXECUTE("check_querycache",query_cache.check_integrity(1););
- byte *border = 0;
+ uchar *border = 0;
Query_cache_block *before = 0;
ulong gap = 0;
my_bool ok = 1;
@@ -3185,7 +3183,7 @@ void Query_cache::pack_cache()
}
-my_bool Query_cache::move_by_type(byte **border,
+my_bool Query_cache::move_by_type(uchar **border,
Query_cache_block **before, ulong *gap,
Query_cache_block *block)
{
@@ -3198,7 +3196,7 @@ my_bool Query_cache::move_by_type(byte **border,
DBUG_PRINT("qcache", ("block 0x%lx FREE", (ulong) block));
if (*border == 0)
{
- *border = (byte *) block;
+ *border = (uchar *) block;
*before = block->pprev;
DBUG_PRINT("qcache", ("gap beginning here"));
}
@@ -3228,10 +3226,10 @@ my_bool Query_cache::move_by_type(byte **border,
*new_block =(Query_cache_block *) *border;
uint tablename_offset = block->table()->table() - block->table()->db();
char *data = (char*) block->data();
- byte *key;
- uint key_length;
- key=query_cache_table_get_key((byte*) block, &key_length, 0);
- hash_first(&tables, (byte*) key, key_length, &record_idx);
+ uchar *key;
+ size_t key_length;
+ key=query_cache_table_get_key((uchar*) block, &key_length, 0);
+ hash_first(&tables, (uchar*) key, key_length, &record_idx);
block->destroy();
new_block->init(len);
@@ -3265,7 +3263,7 @@ my_bool Query_cache::move_by_type(byte **border,
/* Fix pointer to table name */
new_block->table()->table(new_block->table()->db() + tablename_offset);
/* Fix hash to point at moved block */
- hash_replace(&tables, &record_idx, (byte*) new_block);
+ hash_replace(&tables, &record_idx, (uchar*) new_block);
DBUG_PRINT("qcache", ("moved %lu bytes to 0x%lx, new gap at 0x%lx",
len, (ulong) new_block, (ulong) *border));
@@ -3288,10 +3286,10 @@ my_bool Query_cache::move_by_type(byte **border,
char *data = (char*) block->data();
Query_cache_block *first_result_block = ((Query_cache_query *)
block->data())->result();
- byte *key;
- uint key_length;
- key=query_cache_query_get_key((byte*) block, &key_length, 0);
- hash_first(&queries, (byte*) key, key_length, &record_idx);
+ uchar *key;
+ size_t key_length;
+ key=query_cache_query_get_key((uchar*) block, &key_length, 0);
+ hash_first(&queries, (uchar*) key, key_length, &record_idx);
// Move table of used tables
memmove((char*) new_block->table(0), (char*) block->table(0),
ALIGN_SIZE(n_tables*sizeof(Query_cache_block_table)));
@@ -3307,7 +3305,7 @@ my_bool Query_cache::move_by_type(byte **border,
queries_blocks = new_block;
Query_cache_block_table *beg_of_table_table= block->table(0),
*end_of_table_table= block->table(n_tables);
- byte *beg_of_new_table_table= (byte*) new_block->table(0);
+ uchar *beg_of_new_table_table= (uchar*) new_block->table(0);
for (TABLE_COUNTER_TYPE j=0; j < n_tables; j++)
{
@@ -3317,8 +3315,8 @@ my_bool Query_cache::move_by_type(byte **border,
if ((beg_of_table_table <= block_table->next) &&
(block_table->next < end_of_table_table))
((Query_cache_block_table *)(beg_of_new_table_table +
- (((byte*)block_table->next) -
- ((byte*)beg_of_table_table))))->prev=
+ (((uchar*)block_table->next) -
+ ((uchar*)beg_of_table_table))))->prev=
block_table;
else
block_table->next->prev= block_table;
@@ -3327,8 +3325,8 @@ my_bool Query_cache::move_by_type(byte **border,
if ((beg_of_table_table <= block_table->prev) &&
(block_table->prev < end_of_table_table))
((Query_cache_block_table *)(beg_of_new_table_table +
- (((byte*)block_table->prev) -
- ((byte*)beg_of_table_table))))->next=
+ (((uchar*)block_table->prev) -
+ ((uchar*)beg_of_table_table))))->next=
block_table;
else
block_table->prev->next = block_table;
@@ -3356,10 +3354,10 @@ my_bool Query_cache::move_by_type(byte **border,
NET *net = new_block->query()->writer();
if (net != 0)
{
- net->query_cache_query= (gptr) new_block;
+ net->query_cache_query= (uchar*) new_block;
}
/* Fix hash to point at moved block */
- hash_replace(&queries, &record_idx, (byte*) new_block);
+ hash_replace(&queries, &record_idx, (uchar*) new_block);
DBUG_PRINT("qcache", ("moved %lu bytes to 0x%lx, new gap at 0x%lx",
len, (ulong) new_block, (ulong) *border));
break;
@@ -3495,7 +3493,7 @@ my_bool Query_cache::join_results(ulong join_limit)
Query_cache_result *new_result = new_result_block->result();
new_result->parent(block);
- byte *write_to = (byte*) new_result->data();
+ uchar *write_to = (uchar*) new_result->data();
Query_cache_block *result_block = first_result;
do
{
@@ -3679,18 +3677,18 @@ void Query_cache::queries_dump()
Query_cache_block *block = queries_blocks;
do
{
- uint len;
- char *str = (char*) query_cache_query_get_key((byte*) block, &len, 0);
+ size_t len;
+ char *str = (char*) query_cache_query_get_key((uchar*) block, &len, 0);
len-= QUERY_CACHE_FLAGS_SIZE; // Point at flags
Query_cache_query_flags flags;
memcpy(&flags, str+len, QUERY_CACHE_FLAGS_SIZE);
str[len]= 0; // make zero ending DB name
- DBUG_PRINT("qcache", ("F: %u C: %u L: %lu T: '%s' (%u) '%s' '%s'",
+ DBUG_PRINT("qcache", ("F: %u C: %u L: %lu T: '%s' (%lu) '%s' '%s'",
flags.client_long_flag,
flags.character_set_client_num,
(ulong)flags.limit,
flags.time_zone->get_name()->ptr(),
- len, str, strend(str)+1));
+ (ulong) len, str, strend(str)+1));
DBUG_PRINT("qcache", ("-b- 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx", (ulong) block,
(ulong) block->next, (ulong) block->prev,
(ulong)block->pnext, (ulong)block->pprev));
@@ -3804,25 +3802,25 @@ my_bool Query_cache::check_integrity(bool locked)
// Check memory allocation
if (block->pnext == first_block) // Is it last block?
{
- if (((byte*)block) + block->length !=
- ((byte*)first_block) + query_cache_size)
+ if (((uchar*)block) + block->length !=
+ ((uchar*)first_block) + query_cache_size)
{
DBUG_PRINT("error",
("block 0x%lx, type %u, ended at 0x%lx, but cache ended at 0x%lx",
(ulong) block, (uint) block->type,
- (ulong) (((byte*)block) + block->length),
- (ulong) (((byte*)first_block) + query_cache_size)));
+ (ulong) (((uchar*)block) + block->length),
+ (ulong) (((uchar*)first_block) + query_cache_size)));
result = 1;
}
}
else
- if (((byte*)block) + block->length != ((byte*)block->pnext))
+ if (((uchar*)block) + block->length != ((uchar*)block->pnext))
{
DBUG_PRINT("error",
("block 0x%lx, type %u, ended at 0x%lx, but next block begining at 0x%lx",
(ulong) block, (uint) block->type,
- (ulong) (((byte*)block) + block->length),
- (ulong) ((byte*)block->pnext)));
+ (ulong) (((uchar*)block) + block->length),
+ (ulong) ((uchar*)block->pnext)));
}
if (block->type == Query_cache_block::FREE)
free+= block->length;
@@ -3834,8 +3832,8 @@ my_bool Query_cache::check_integrity(bool locked)
Query_cache_memory_bin *bin = *((Query_cache_memory_bin **)
block->data());
//is it correct pointer?
- if (((byte*)bin) < ((byte*)bins) ||
- ((byte*)bin) >= ((byte*)first_block))
+ if (((uchar*)bin) < ((uchar*)bins) ||
+ ((uchar*)bin) >= ((uchar*)first_block))
{
DBUG_PRINT("error",
("free block 0x%lx have bin pointer 0x%lx beyaond of bins array bounds [0x%lx,0x%lx]",
@@ -3847,7 +3845,7 @@ my_bool Query_cache::check_integrity(bool locked)
}
else
{
- int idx = (((byte*)bin) - ((byte*)bins)) /
+ int idx = (((uchar*)bin) - ((uchar*)bins)) /
sizeof(Query_cache_memory_bin);
if (in_list(bins[idx].free_blocks, block, "free memory"))
result = 1;
@@ -3869,7 +3867,7 @@ my_bool Query_cache::check_integrity(bool locked)
Query_cache_block_table *block_table = block->table(j);
Query_cache_block_table *block_table_root =
(Query_cache_block_table *)
- (((byte*)block_table->parent) -
+ (((uchar*)block_table->parent) -
ALIGN_SIZE(sizeof(Query_cache_block_table)));
if (in_table_list(block_table, block_table_root, "table list"))
@@ -3885,15 +3883,15 @@ my_bool Query_cache::check_integrity(bool locked)
case Query_cache_block::RESULT:
{
Query_cache_block * query_block = block->result()->parent();
- if (((byte*)query_block) < ((byte*)first_block) ||
- ((byte*)query_block) >= (((byte*)first_block) + query_cache_size))
+ if (((uchar*)query_block) < ((uchar*)first_block) ||
+ ((uchar*)query_block) >= (((uchar*)first_block) + query_cache_size))
{
DBUG_PRINT("error",
("result block 0x%lx have query block pointer 0x%lx beyaond of block pool bounds [0x%lx,0x%lx]",
(ulong) block,
(ulong) query_block,
(ulong) first_block,
- (ulong) (((byte*)first_block) + query_cache_size)));
+ (ulong) (((uchar*)first_block) + query_cache_size)));
result = 1;
}
else
@@ -3940,10 +3938,10 @@ my_bool Query_cache::check_integrity(bool locked)
{
DBUG_PRINT("qcache", ("block 0x%lx, type %u...",
(ulong) block, (uint) block->type));
- uint length;
- byte *key = query_cache_query_get_key((byte*) block, &length, 0);
- gptr val = hash_search(&queries, key, length);
- if (((gptr)block) != val)
+ size_t length;
+ uchar *key = query_cache_query_get_key((uchar*) block, &length, 0);
+ uchar* val = hash_search(&queries, key, length);
+ if (((uchar*)block) != val)
{
DBUG_PRINT("error", ("block 0x%lx found in queries hash like 0x%lx",
(ulong) block, (ulong) val));
@@ -3975,10 +3973,10 @@ my_bool Query_cache::check_integrity(bool locked)
{
DBUG_PRINT("qcache", ("block 0x%lx, type %u...",
(ulong) block, (uint) block->type));
- uint length;
- byte *key = query_cache_table_get_key((byte*) block, &length, 0);
- gptr val = hash_search(&tables, key, length);
- if (((gptr)block) != val)
+ size_t length;
+ uchar *key = query_cache_table_get_key((uchar*) block, &length, 0);
+ uchar* val = hash_search(&tables, key, length);
+ if (((uchar*)block) != val)
{
DBUG_PRINT("error", ("block 0x%lx found in tables hash like 0x%lx",
(ulong) block, (ulong) val));
diff --git a/sql/sql_cache.h b/sql/sql_cache.h
index bc00f7ea629..3c5d784ce94 100644
--- a/sql/sql_cache.h
+++ b/sql/sql_cache.h
@@ -98,7 +98,7 @@ struct Query_cache_block
void init(ulong length);
void destroy();
inline uint headers_len();
- inline gptr data(void);
+ inline uchar* data(void);
inline Query_cache_query *query();
inline Query_cache_table *table();
inline Query_cache_result *result();
@@ -128,17 +128,15 @@ struct Query_cache_query
inline ulong length() { return len; }
inline ulong add(ulong packet_len) { return(len+= packet_len); }
inline void length(ulong length_arg) { len= length_arg; }
- inline gptr query()
+ inline uchar* query()
{
- return (gptr)(((byte*)this)+
- ALIGN_SIZE(sizeof(Query_cache_query)));
+ return (((uchar*)this) + ALIGN_SIZE(sizeof(Query_cache_query)));
}
void lock_writing();
void lock_reading();
my_bool try_lock_writing();
void unlock_writing();
void unlock_reading();
- static byte *cache_key(const byte *record, uint *length, my_bool not_used);
};
@@ -164,9 +162,9 @@ struct Query_cache_table
inline void callback(qc_engine_callback fn){ callback_func= fn; }
inline ulonglong engine_data() { return engine_data_buff; }
inline void engine_data(ulonglong data_arg){ engine_data_buff= data_arg; }
- inline gptr data()
+ inline uchar* data()
{
- return (gptr)(((byte*)this)+
+ return (uchar*)(((uchar*)this)+
ALIGN_SIZE(sizeof(Query_cache_table)));
}
};
@@ -176,9 +174,9 @@ struct Query_cache_result
Query_cache_result() {} /* Remove gcc warning */
Query_cache_block *query;
- inline gptr data()
+ inline uchar* data()
{
- return (gptr)(((byte*) this)+
+ return (uchar*)(((uchar*) this)+
ALIGN_SIZE(sizeof(Query_cache_result)));
}
/* data_continue (if not whole packet contained by this block) */
@@ -189,10 +187,10 @@ struct Query_cache_result
extern "C"
{
- byte *query_cache_query_get_key(const byte *record, uint *length,
- my_bool not_used);
- byte *query_cache_table_get_key(const byte *record, uint *length,
- my_bool not_used);
+ uchar *query_cache_query_get_key(const uchar *record, size_t *length,
+ my_bool not_used);
+ uchar *query_cache_table_get_key(const uchar *record, size_t *length,
+ my_bool not_used);
}
extern "C" void query_cache_invalidate_by_MyISAM_filename(const char* filename);
@@ -261,7 +259,7 @@ protected:
till the end of a flush operation.
*/
pthread_mutex_t structure_guard_mutex;
- byte *cache; // cache memory
+ uchar *cache; // cache memory
Query_cache_block *first_block; // physical location block list
Query_cache_block *queries_blocks; // query list (LIFO)
Query_cache_block *tables_blocks;
@@ -299,7 +297,7 @@ protected:
my_bool first_block);
void invalidate_table(TABLE_LIST *table);
void invalidate_table(TABLE *table);
- void invalidate_table(byte *key, uint32 key_length);
+ void invalidate_table(uchar *key, uint32 key_length);
void invalidate_table(Query_cache_block *table_block);
TABLE_COUNTER_TYPE
register_tables_from_list(TABLE_LIST *tables_used,
@@ -324,7 +322,7 @@ protected:
ulong add_size);
void exclude_from_free_memory_list(Query_cache_block *free_block);
void insert_into_free_memory_list(Query_cache_block *new_block);
- my_bool move_by_type(byte **border, Query_cache_block **before,
+ my_bool move_by_type(uchar **border, Query_cache_block **before,
ulong *gap, Query_cache_block *i);
uint find_bin(ulong size);
void move_to_query_list_end(Query_cache_block *block);
@@ -346,16 +344,16 @@ protected:
ulong init_cache();
void make_disabled();
void free_cache();
- Query_cache_block *write_block_data(ulong data_len, gptr data,
+ Query_cache_block *write_block_data(ulong data_len, uchar* data,
ulong header_len,
Query_cache_block::block_type type,
TABLE_COUNTER_TYPE ntab = 0,
my_bool under_guard=0);
my_bool append_result_data(Query_cache_block **result,
- ulong data_len, gptr data,
+ ulong data_len, uchar* data,
Query_cache_block *parent);
my_bool write_result_data(Query_cache_block **result,
- ulong data_len, gptr data,
+ ulong data_len, uchar* data,
Query_cache_block *parent,
Query_cache_block::block_type
type=Query_cache_block::RESULT);
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index fd44817811e..48a165dc34c 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -71,11 +71,11 @@ template class List_iterator<Alter_column>;
** User variables
****************************************************************************/
-extern "C" byte *get_var_key(user_var_entry *entry, uint *length,
- my_bool not_used __attribute__((unused)))
+extern "C" uchar *get_var_key(user_var_entry *entry, size_t *length,
+ my_bool not_used __attribute__((unused)))
{
- *length=(uint) entry->name.length;
- return (byte*) entry->name.str;
+ *length= entry->name.length;
+ return (uchar*) entry->name.str;
}
extern "C" void free_user_var(user_var_entry *entry)
@@ -545,7 +545,7 @@ THD::~THD()
void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var)
{
- ulong *end= (ulong*) ((byte*) to_var +
+ ulong *end= (ulong*) ((uchar*) to_var +
offsetof(STATUS_VAR, last_system_status_var) +
sizeof(ulong));
ulong *to= (ulong*) to_var, *from= (ulong*) from_var;
@@ -570,7 +570,7 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var)
void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
STATUS_VAR *dec_var)
{
- ulong *end= (ulong*) ((byte*) to_var + offsetof(STATUS_VAR,
+ ulong *end= (ulong*) ((uchar*) to_var + offsetof(STATUS_VAR,
last_system_status_var) +
sizeof(ulong));
ulong *to= (ulong*) to_var, *from= (ulong*) from_var, *dec= (ulong*) dec_var;
@@ -741,9 +741,9 @@ bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
CHARSET_INFO *from_cs)
{
DBUG_ENTER("convert_string");
- size_s new_length= to_cs->mbmaxlen * from_length;
+ size_t new_length= to_cs->mbmaxlen * from_length;
uint dummy_errors;
- if (!(to->str= alloc(new_length+1)))
+ if (!(to->str= (char*) alloc(new_length+1)))
{
to->length= 0; // Safety fix
DBUG_RETURN(1); // EOM
@@ -887,8 +887,7 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, long key_length)
return 0;
}
- new_table->key = (char *) (((byte*)new_table)+
- ALIGN_SIZE(sizeof(CHANGED_TABLE_LIST)));
+ new_table->key= ((char*)new_table)+ ALIGN_SIZE(sizeof(CHANGED_TABLE_LIST));
new_table->next = 0;
new_table->key_length = key_length;
::memcpy(new_table->key, key, key_length);
@@ -1342,7 +1341,7 @@ bool select_export::send_data(List<Item> &items)
uint used_length=0,items_left=items.elements;
List_iterator_fast<Item> li(items);
- if (my_b_write(&cache,(byte*) exchange->line_start->ptr(),
+ if (my_b_write(&cache,(uchar*) exchange->line_start->ptr(),
exchange->line_start->length()))
goto err;
while ((item=li++))
@@ -1351,7 +1350,7 @@ bool select_export::send_data(List<Item> &items)
res=item->str_result(&tmp);
if (res && (!exchange->opt_enclosed || result_type == STRING_RESULT))
{
- if (my_b_write(&cache,(byte*) exchange->enclosed->ptr(),
+ if (my_b_write(&cache,(uchar*) exchange->enclosed->ptr(),
exchange->enclosed->length()))
goto err;
}
@@ -1363,10 +1362,10 @@ bool select_export::send_data(List<Item> &items)
{
null_buff[0]=escape_char;
null_buff[1]='N';
- if (my_b_write(&cache,(byte*) null_buff,2))
+ if (my_b_write(&cache,(uchar*) null_buff,2))
goto err;
}
- else if (my_b_write(&cache,(byte*) "NULL",4))
+ else if (my_b_write(&cache,(uchar*) "NULL",4))
goto err;
}
else
@@ -1406,16 +1405,16 @@ bool select_export::send_data(List<Item> &items)
char tmp_buff[2];
tmp_buff[0]= escape_char;
tmp_buff[1]= *pos ? *pos : '0';
- if (my_b_write(&cache,(byte*) start,(uint) (pos-start)) ||
- my_b_write(&cache,(byte*) tmp_buff,2))
+ if (my_b_write(&cache,(uchar*) start,(uint) (pos-start)) ||
+ my_b_write(&cache,(uchar*) tmp_buff,2))
goto err;
start=pos+1;
}
}
- if (my_b_write(&cache,(byte*) start,(uint) (pos-start)))
+ if (my_b_write(&cache,(uchar*) start,(uint) (pos-start)))
goto err;
}
- else if (my_b_write(&cache,(byte*) res->ptr(),used_length))
+ else if (my_b_write(&cache,(uchar*) res->ptr(),used_length))
goto err;
}
if (fixed_row_size)
@@ -1431,27 +1430,27 @@ bool select_export::send_data(List<Item> &items)
uint length=item->max_length-used_length;
for (; length > sizeof(space) ; length-=sizeof(space))
{
- if (my_b_write(&cache,(byte*) space,sizeof(space)))
+ if (my_b_write(&cache,(uchar*) space,sizeof(space)))
goto err;
}
- if (my_b_write(&cache,(byte*) space,length))
+ if (my_b_write(&cache,(uchar*) space,length))
goto err;
}
}
if (res && (!exchange->opt_enclosed || result_type == STRING_RESULT))
{
- if (my_b_write(&cache, (byte*) exchange->enclosed->ptr(),
+ if (my_b_write(&cache, (uchar*) exchange->enclosed->ptr(),
exchange->enclosed->length()))
goto err;
}
if (--items_left)
{
- if (my_b_write(&cache, (byte*) exchange->field_term->ptr(),
+ if (my_b_write(&cache, (uchar*) exchange->field_term->ptr(),
field_term_length))
goto err;
}
}
- if (my_b_write(&cache,(byte*) exchange->line_term->ptr(),
+ if (my_b_write(&cache,(uchar*) exchange->line_term->ptr(),
exchange->line_term->length()))
goto err;
DBUG_RETURN(0);
@@ -1498,10 +1497,10 @@ bool select_dump::send_data(List<Item> &items)
res=item->str_result(&tmp);
if (!res) // If NULL
{
- if (my_b_write(&cache,(byte*) "",1))
+ if (my_b_write(&cache,(uchar*) "",1))
goto err;
}
- else if (my_b_write(&cache,(byte*) res->ptr(),res->length()))
+ else if (my_b_write(&cache,(uchar*) res->ptr(),res->length()))
{
my_error(ER_ERROR_ON_WRITE, MYF(0), path, my_errno);
goto err;
@@ -1836,13 +1835,13 @@ Statement::~Statement()
C_MODE_START
-static byte *
-get_statement_id_as_hash_key(const byte *record, uint *key_length,
+static uchar *
+get_statement_id_as_hash_key(const uchar *record, size_t *key_length,
my_bool not_used __attribute__((unused)))
{
const Statement *statement= (const Statement *) record;
*key_length= sizeof(statement->id);
- return (byte *) &((const Statement *) statement)->id;
+ return (uchar *) &((const Statement *) statement)->id;
}
static void delete_statement_as_hash_key(void *key)
@@ -1850,11 +1849,11 @@ static void delete_statement_as_hash_key(void *key)
delete (Statement *) key;
}
-static byte *get_stmt_name_hash_key(Statement *entry, uint *length,
+static uchar *get_stmt_name_hash_key(Statement *entry, size_t *length,
my_bool not_used __attribute__((unused)))
{
- *length=(uint) entry->name.length;
- return (byte*) entry->name.str;
+ *length= entry->name.length;
+ return (uchar*) entry->name.str;
}
C_MODE_END
@@ -1899,7 +1898,7 @@ Statement_map::Statement_map() :
int Statement_map::insert(THD *thd, Statement *statement)
{
- if (my_hash_insert(&st_hash, (byte*) statement))
+ if (my_hash_insert(&st_hash, (uchar*) statement))
{
/*
Delete is needed only in case of an insert failure. In all other
@@ -1909,7 +1908,7 @@ int Statement_map::insert(THD *thd, Statement *statement)
my_error(ER_OUT_OF_RESOURCES, MYF(0));
goto err_st_hash;
}
- if (statement->name.str && my_hash_insert(&names_hash, (byte*) statement))
+ if (statement->name.str && my_hash_insert(&names_hash, (uchar*) statement))
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
goto err_names_hash;
@@ -1937,9 +1936,9 @@ int Statement_map::insert(THD *thd, Statement *statement)
err_max:
if (statement->name.str)
- hash_delete(&names_hash, (byte*) statement);
+ hash_delete(&names_hash, (uchar*) statement);
err_names_hash:
- hash_delete(&st_hash, (byte*) statement);
+ hash_delete(&st_hash, (uchar*) statement);
err_st_hash:
return 1;
}
@@ -1960,9 +1959,9 @@ void Statement_map::erase(Statement *statement)
if (statement == last_found_statement)
last_found_statement= 0;
if (statement->name.str)
- hash_delete(&names_hash, (byte *) statement);
+ hash_delete(&names_hash, (uchar *) statement);
- hash_delete(&st_hash, (byte *) statement);
+ hash_delete(&st_hash, (uchar *) statement);
pthread_mutex_lock(&LOCK_prepared_stmt_count);
DBUG_ASSERT(prepared_stmt_count > 0);
prepared_stmt_count--;
@@ -2377,7 +2376,7 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup)
pthread_mutex_t LOCK_xid_cache;
HASH xid_cache;
-static byte *xid_get_hash_key(const byte *ptr,uint *length,
+static uchar *xid_get_hash_key(const uchar *ptr, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length=((XID_STATE*)ptr)->xid.key_length();
@@ -2387,7 +2386,7 @@ static byte *xid_get_hash_key(const byte *ptr,uint *length,
static void xid_free_hash (void *ptr)
{
if (!((XID_STATE*)ptr)->in_thd)
- my_free((gptr)ptr, MYF(0));
+ my_free((uchar*)ptr, MYF(0));
}
bool xid_cache_init()
@@ -2429,7 +2428,7 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state)
xs->xa_state=xa_state;
xs->xid.set(xid);
xs->in_thd=0;
- res=my_hash_insert(&xid_cache, (byte*)xs);
+ res=my_hash_insert(&xid_cache, (uchar*)xs);
}
pthread_mutex_unlock(&LOCK_xid_cache);
return res;
@@ -2441,7 +2440,7 @@ bool xid_cache_insert(XID_STATE *xid_state)
pthread_mutex_lock(&LOCK_xid_cache);
DBUG_ASSERT(hash_search(&xid_cache, xid_state->xid.key(),
xid_state->xid.key_length())==0);
- my_bool res=my_hash_insert(&xid_cache, (byte*)xid_state);
+ my_bool res=my_hash_insert(&xid_cache, (uchar*)xid_state);
pthread_mutex_unlock(&LOCK_xid_cache);
return res;
}
@@ -2450,7 +2449,7 @@ bool xid_cache_insert(XID_STATE *xid_state)
void xid_cache_delete(XID_STATE *xid_state)
{
pthread_mutex_lock(&LOCK_xid_cache);
- hash_delete(&xid_cache, (byte *)xid_state);
+ hash_delete(&xid_cache, (uchar *)xid_state);
pthread_mutex_unlock(&LOCK_xid_cache);
}
@@ -2486,8 +2485,8 @@ void xid_cache_delete(XID_STATE *xid_state)
template <class RowsEventT> Rows_log_event*
THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
MY_BITMAP const* cols,
- my_size_t colcnt,
- my_size_t needed,
+ size_t colcnt,
+ size_t needed,
bool is_transactional,
RowsEventT *hint __attribute__((unused)))
{
@@ -2557,17 +2556,17 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
*/
template Rows_log_event*
THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*,
- my_size_t, my_size_t, bool,
+ size_t, size_t, bool,
Write_rows_log_event*);
template Rows_log_event*
THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*,
- my_size_t colcnt, my_size_t, bool,
+ size_t colcnt, size_t, bool,
Delete_rows_log_event *);
template Rows_log_event*
THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*,
- my_size_t colcnt, my_size_t, bool,
+ size_t colcnt, size_t, bool,
Update_rows_log_event *);
#endif
@@ -2636,27 +2635,6 @@ field_type_name(enum_field_types type)
#endif
-my_size_t THD::max_row_length_blob(TABLE *table, const byte *data) const
-{
- my_size_t length= 0;
- TABLE_SHARE *table_s= table->s;
- uint* const beg= table_s->blob_field;
- uint* const end= beg + table_s->blob_fields;
-
- for (uint *ptr= beg ; ptr != end ; ++ptr)
- {
- Field_blob* const blob= (Field_blob*) table->field[*ptr];
- length+= blob->get_length((const char*) (data +
- blob->offset(table->record[0]))) +
- HA_KEY_BLOB_LENGTH;
- }
-
- return length;
-}
-
-
-
-
namespace {
/**
Class to handle temporary allocation of memory for row data.
@@ -2685,7 +2663,7 @@ namespace {
@param length
Length of data that is needed, if the record contain blobs.
*/
- Row_data_memory(TABLE *table, my_size_t const len1)
+ Row_data_memory(TABLE *table, size_t const len1)
: m_memory(0)
{
#ifndef DBUG_OFF
@@ -2696,7 +2674,7 @@ namespace {
m_ptr[1]= 0;
}
- Row_data_memory(TABLE *table, my_size_t const len1, my_size_t const len2)
+ Row_data_memory(TABLE *table, size_t const len1, size_t const len2)
: m_memory(0)
{
#ifndef DBUG_OFF
@@ -2710,7 +2688,7 @@ namespace {
~Row_data_memory()
{
if (m_memory != 0 && m_release_memory_on_destruction)
- my_free((gptr) m_memory, MYF(MY_WME));
+ my_free((uchar*) m_memory, MYF(MY_WME));
}
/**
@@ -2726,7 +2704,7 @@ namespace {
return m_memory != 0;
}
- byte *slot(uint s)
+ uchar *slot(uint s)
{
DBUG_ASSERT(s < sizeof(m_ptr)/sizeof(*m_ptr));
DBUG_ASSERT(m_ptr[s] != 0);
@@ -2735,7 +2713,7 @@ namespace {
}
private:
- void allocate_memory(TABLE *const table, my_size_t const total_length)
+ void allocate_memory(TABLE *const table, size_t const total_length)
{
if (table->s->blob_fields == 0)
{
@@ -2749,7 +2727,7 @@ namespace {
to add two bytes for each field, which can potentially be
added to hold the length of a packed field.
*/
- my_size_t const maxlen= table->s->reclength + 2 * table->s->fields;
+ size_t const maxlen= table->s->reclength + 2 * table->s->fields;
/*
Allocate memory for two records if memory hasn't been
@@ -2758,13 +2736,13 @@ namespace {
*/
if (table->write_row_record == 0)
table->write_row_record=
- (byte *) alloc_root(&table->mem_root, 2 * maxlen);
+ (uchar *) alloc_root(&table->mem_root, 2 * maxlen);
m_memory= table->write_row_record;
m_release_memory_on_destruction= FALSE;
}
else
{
- m_memory= (byte *) my_malloc(total_length, MYF(MY_WME));
+ m_memory= (uchar *) my_malloc(total_length, MYF(MY_WME));
m_release_memory_on_destruction= TRUE;
}
}
@@ -2773,15 +2751,15 @@ namespace {
mutable bool m_alloc_checked;
#endif
bool m_release_memory_on_destruction;
- byte *m_memory;
- byte *m_ptr[2];
+ uchar *m_memory;
+ uchar *m_ptr[2];
};
}
int THD::binlog_write_row(TABLE* table, bool is_trans,
- MY_BITMAP const* cols, my_size_t colcnt,
- byte const *record)
+ MY_BITMAP const* cols, size_t colcnt,
+ uchar const *record)
{
DBUG_ASSERT(current_stmt_binlog_row_based && mysql_bin_log.is_open());
@@ -2793,9 +2771,9 @@ int THD::binlog_write_row(TABLE* table, bool is_trans,
if (!memory.has_memory())
return HA_ERR_OUT_OF_MEM;
- byte *row_data= memory.slot(0);
+ uchar *row_data= memory.slot(0);
- my_size_t const len= pack_row(table, cols, row_data, record);
+ size_t const len= pack_row(table, cols, row_data, record);
Rows_log_event* const ev=
binlog_prepare_pending_rows_event(table, server_id, cols, colcnt,
@@ -2809,25 +2787,25 @@ int THD::binlog_write_row(TABLE* table, bool is_trans,
}
int THD::binlog_update_row(TABLE* table, bool is_trans,
- MY_BITMAP const* cols, my_size_t colcnt,
- const byte *before_record,
- const byte *after_record)
+ MY_BITMAP const* cols, size_t colcnt,
+ const uchar *before_record,
+ const uchar *after_record)
{
DBUG_ASSERT(current_stmt_binlog_row_based && mysql_bin_log.is_open());
- my_size_t const before_maxlen = max_row_length(table, before_record);
- my_size_t const after_maxlen = max_row_length(table, after_record);
+ size_t const before_maxlen = max_row_length(table, before_record);
+ size_t const after_maxlen = max_row_length(table, after_record);
Row_data_memory row_data(table, before_maxlen, after_maxlen);
if (!row_data.has_memory())
return HA_ERR_OUT_OF_MEM;
- byte *before_row= row_data.slot(0);
- byte *after_row= row_data.slot(1);
+ uchar *before_row= row_data.slot(0);
+ uchar *after_row= row_data.slot(1);
- my_size_t const before_size= pack_row(table, cols, before_row,
+ size_t const before_size= pack_row(table, cols, before_row,
before_record);
- my_size_t const after_size= pack_row(table, cols, after_row,
+ size_t const after_size= pack_row(table, cols, after_row,
after_record);
/*
@@ -2835,10 +2813,10 @@ int THD::binlog_update_row(TABLE* table, bool is_trans,
trigger false warnings.
*/
#ifndef HAVE_purify
- DBUG_DUMP("before_record", (const char *)before_record, table->s->reclength);
- DBUG_DUMP("after_record", (const char *)after_record, table->s->reclength);
- DBUG_DUMP("before_row", (const char *)before_row, before_size);
- DBUG_DUMP("after_row", (const char *)after_row, after_size);
+ DBUG_DUMP("before_record", before_record, table->s->reclength);
+ DBUG_DUMP("after_record", after_record, table->s->reclength);
+ DBUG_DUMP("before_row", before_row, before_size);
+ DBUG_DUMP("after_row", after_row, after_size);
#endif
Rows_log_event* const ev=
@@ -2855,8 +2833,8 @@ int THD::binlog_update_row(TABLE* table, bool is_trans,
}
int THD::binlog_delete_row(TABLE* table, bool is_trans,
- MY_BITMAP const* cols, my_size_t colcnt,
- byte const *record)
+ MY_BITMAP const* cols, size_t colcnt,
+ uchar const *record)
{
DBUG_ASSERT(current_stmt_binlog_row_based && mysql_bin_log.is_open());
@@ -2868,9 +2846,9 @@ int THD::binlog_delete_row(TABLE* table, bool is_trans,
if (unlikely(!memory.has_memory()))
return HA_ERR_OUT_OF_MEM;
- byte *row_data= memory.slot(0);
+ uchar *row_data= memory.slot(0);
- my_size_t const len= pack_row(table, cols, row_data, record);
+ size_t const len= pack_row(table, cols, row_data, record);
Rows_log_event* const ev=
binlog_prepare_pending_rows_event(table, server_id, cols, colcnt,
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 48a88087fd3..95d07c57e46 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -422,30 +422,31 @@ public:
inline bool is_conventional() const
{ return state == CONVENTIONAL_EXECUTION; }
- inline gptr alloc(unsigned int size) { return alloc_root(mem_root,size); }
- inline gptr calloc(unsigned int size)
+ inline void* alloc(size_t size) { return alloc_root(mem_root,size); }
+ inline void* calloc(size_t size)
{
- gptr ptr;
+ void *ptr;
if ((ptr=alloc_root(mem_root,size)))
- bzero((char*) ptr,size);
+ bzero(ptr, size);
return ptr;
}
inline char *strdup(const char *str)
{ return strdup_root(mem_root,str); }
- inline char *strmake(const char *str, uint size)
+ inline char *strmake(const char *str, size_t size)
{ return strmake_root(mem_root,str,size); }
- inline bool LEX_STRING_make(LEX_STRING *lex_str, const char *str, uint size)
+ inline bool LEX_STRING_make(LEX_STRING *lex_str, const char *str,
+ size_t size)
{
return ((lex_str->str=
strmake_root(mem_root, str, (lex_str->length= size)))) == 0;
}
- inline char *memdup(const char *str, uint size)
+ inline void *memdup(const void *str, size_t size)
{ return memdup_root(mem_root,str,size); }
- inline char *memdup_w_gap(const char *str, uint size, uint gap)
+ inline void *memdup_w_gap(const void *str, size_t size, uint gap)
{
- gptr ptr;
- if ((ptr=alloc_root(mem_root,size+gap)))
+ void *ptr;
+ if ((ptr= alloc_root(mem_root,size+gap)))
memcpy(ptr,str,size);
return ptr;
}
@@ -567,7 +568,7 @@ public:
Statement *find_by_name(LEX_STRING *name)
{
Statement *stmt;
- stmt= (Statement*)hash_search(&names_hash, (byte*)name->str,
+ stmt= (Statement*)hash_search(&names_hash, (uchar*)name->str,
name->length);
return stmt;
}
@@ -577,7 +578,7 @@ public:
if (last_found_statement == 0 || id != last_found_statement->id)
{
Statement *stmt;
- stmt= (Statement *) hash_search(&st_hash, (byte *) &id, sizeof(id));
+ stmt= (Statement *) hash_search(&st_hash, (uchar *) &id, sizeof(id));
if (stmt && stmt->name.str)
return NULL;
last_found_statement= stmt;
@@ -1020,14 +1021,14 @@ public:
void binlog_set_stmt_begin();
int binlog_write_table_map(TABLE *table, bool is_transactional);
int binlog_write_row(TABLE* table, bool is_transactional,
- MY_BITMAP const* cols, my_size_t colcnt,
- const byte *buf);
+ MY_BITMAP const* cols, size_t colcnt,
+ const uchar *buf);
int binlog_delete_row(TABLE* table, bool is_transactional,
- MY_BITMAP const* cols, my_size_t colcnt,
- const byte *buf);
+ MY_BITMAP const* cols, size_t colcnt,
+ const uchar *buf);
int binlog_update_row(TABLE* table, bool is_transactional,
- MY_BITMAP const* cols, my_size_t colcnt,
- const byte *old_data, const byte *new_data);
+ MY_BITMAP const* cols, size_t colcnt,
+ const uchar *old_data, const uchar *new_data);
void set_server_id(uint32 sid) { server_id = sid; }
@@ -1037,24 +1038,12 @@ public:
template <class RowsEventT> Rows_log_event*
binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
MY_BITMAP const* cols,
- my_size_t colcnt,
- my_size_t needed,
+ size_t colcnt,
+ size_t needed,
bool is_transactional,
RowsEventT* hint);
Rows_log_event* binlog_get_pending_rows_event() const;
void binlog_set_pending_rows_event(Rows_log_event* ev);
-
- my_size_t max_row_length_blob(TABLE* table, const byte *data) const;
- my_size_t max_row_length(TABLE* table, const byte *data) const
- {
- TABLE_SHARE *table_s= table->s;
- my_size_t length= table_s->reclength + 2 * table_s->fields;
- if (table_s->blob_fields == 0)
- return length;
-
- return (length+max_row_length_blob(table,data));
- }
-
int binlog_flush_pending_rows_event(bool stmt_end);
void binlog_delete_pending_rows_event();
@@ -1516,7 +1505,7 @@ public:
{
return !stmt_arena->is_stmt_prepare();
}
- inline gptr trans_alloc(unsigned int size)
+ inline void* trans_alloc(unsigned int size)
{
return alloc_root(&transaction.mem_root,size);
}
@@ -1667,7 +1656,7 @@ public:
This way the user will notice the error as there will be no current
database selected (in addition to the error message set by malloc).
*/
- bool set_db(const char *new_db, uint new_db_len)
+ bool set_db(const char *new_db, size_t new_db_len)
{
/* Do not reallocate memory if current chunk is big enough. */
if (db && new_db && db_length >= new_db_len)
@@ -1680,7 +1669,7 @@ public:
db_length= db ? new_db_len : 0;
return new_db && !db;
}
- void reset_db(char *new_db, uint new_db_len)
+ void reset_db(char *new_db, size_t new_db_len)
{
db= new_db;
db_length= new_db_len;
@@ -1690,7 +1679,7 @@ public:
allocate memory for a deep copy: current database may be freed after
a statement is parsed but before it's executed.
*/
- bool copy_db_to(char **p_db, uint *p_db_length)
+ bool copy_db_to(char **p_db, size_t *p_db_length)
{
if (db == NULL)
{
@@ -1969,7 +1958,7 @@ public:
List<Item> save_copy_funcs;
Copy_field *copy_field, *copy_field_end;
Copy_field *save_copy_field, *save_copy_field_end;
- byte *group_buff;
+ uchar *group_buff;
Item **items_to_copy; /* Fields in tmp table */
MI_COLUMNDEF *recinfo,*start_recinfo;
KEY *keyinfo;
@@ -2175,7 +2164,7 @@ class Unique :public Sql_alloc
ulonglong max_in_memory_size;
IO_CACHE file;
TREE tree;
- byte *record_pointers;
+ uchar *record_pointers;
bool flush();
uint size;
@@ -2208,8 +2197,8 @@ public:
void reset();
bool walk(tree_walk_action action, void *walk_action_arg);
- friend int unique_write_to_file(gptr key, element_count count, Unique *unique);
- friend int unique_write_to_ptrs(gptr key, element_count count, Unique *unique);
+ friend int unique_write_to_file(uchar* key, element_count count, Unique *unique);
+ friend int unique_write_to_ptrs(uchar* key, element_count count, Unique *unique);
};
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index d03a17079d8..f01d9576c56 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -80,7 +80,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
temp_len= (strmov(strmov(temp_user, user)+1, host) - temp_user)+1;
(void) pthread_mutex_lock(&LOCK_user_conn);
if (!(uc = (struct user_conn *) hash_search(&hash_user_connections,
- (byte*) temp_user, temp_len)))
+ (uchar*) temp_user, temp_len)))
{
/* First connection for user; Create a user connection object */
if (!(uc= ((struct user_conn*)
@@ -98,7 +98,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
uc->connections= uc->questions= uc->updates= uc->conn_per_hour= 0;
uc->user_resources= *mqh;
uc->intime= thd->thr_create_time;
- if (my_hash_insert(&hash_user_connections, (byte*) uc))
+ if (my_hash_insert(&hash_user_connections, (uchar*) uc))
{
my_free((char*) uc,0);
net_send_error(thd, 0, NullS); // Out of memory
@@ -200,7 +200,7 @@ void decrease_user_connections(USER_CONN *uc)
if (!--uc->connections && !mqh_used)
{
/* Last connection for user; Delete it */
- (void) hash_delete(&hash_user_connections,(byte*) uc);
+ (void) hash_delete(&hash_user_connections,(uchar*) uc);
}
(void) pthread_mutex_unlock(&LOCK_user_conn);
DBUG_VOID_RETURN;
@@ -512,11 +512,11 @@ int check_user(THD *thd, enum enum_server_command command,
started with corresponding variable that is greater then 0.
*/
-extern "C" byte *get_key_conn(user_conn *buff, uint *length,
+extern "C" uchar *get_key_conn(user_conn *buff, size_t *length,
my_bool not_used __attribute__((unused)))
{
- *length=buff->len;
- return (byte*) buff->user;
+ *length= buff->len;
+ return (uchar*) buff->user;
}
@@ -559,7 +559,7 @@ void reset_mqh(LEX_USER *lu, bool get_them= 0)
memcpy(temp_user+lu->user.length+1,lu->host.str,lu->host.length);
temp_user[lu->user.length]='\0'; temp_user[temp_len-1]=0;
if ((uc = (struct user_conn *) hash_search(&hash_user_connections,
- (byte*) temp_user, temp_len)))
+ (uchar*) temp_user, temp_len)))
{
uc->questions=0;
get_mqh(temp_user,&temp_user[lu->user.length+1],uc);
@@ -747,8 +747,8 @@ static int check_connection(THD *thd)
SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323) + 1;
/* At this point we write connection message and read reply */
- if (net_write_command(net, (uchar) protocol_version, "", 0, buff,
- (uint) (end-buff)) ||
+ if (net_write_command(net, (uchar) protocol_version, (uchar*) "", 0,
+ (uchar*) buff, (size_t) (end-buff)) ||
(pkt_len= my_net_read(net)) == packet_error ||
pkt_len < MIN_HANDSHAKE_SIZE)
{
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index cfd610638ce..f9422b5a921 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -59,11 +59,11 @@ typedef struct my_dblock_st
lock_db key.
*/
-static byte* lock_db_get_key(my_dblock_t *ptr, uint *length,
- my_bool not_used __attribute__((unused)))
+static uchar* lock_db_get_key(my_dblock_t *ptr, size_t *length,
+ my_bool not_used __attribute__((unused)))
{
*length= ptr->name_length;
- return (byte*) ptr->name;
+ return (uchar*) ptr->name;
}
@@ -73,7 +73,7 @@ static byte* lock_db_get_key(my_dblock_t *ptr, uint *length,
static void lock_db_free_element(void *ptr)
{
- my_free((gptr) ptr, MYF(0));
+ my_free(ptr, MYF(0));
}
@@ -98,12 +98,12 @@ static my_bool lock_db_insert(const char *dbname, uint length)
safe_mutex_assert_owner(&LOCK_lock_db);
if (!(opt= (my_dblock_t*) hash_search(&lock_db_cache,
- (byte*) dbname, length)))
+ (uchar*) dbname, length)))
{
/* Db is not in the hash, insert it */
char *tmp_name;
if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
- &opt, (uint) sizeof(*opt), &tmp_name, length+1,
+ &opt, (uint) sizeof(*opt), &tmp_name, (uint) length+1,
NullS))
{
error= 1;
@@ -114,11 +114,8 @@ static my_bool lock_db_insert(const char *dbname, uint length)
strmov(opt->name, dbname);
opt->name_length= length;
- if ((error= my_hash_insert(&lock_db_cache, (byte*) opt)))
- {
- my_free((gptr) opt, MYF(0));
- goto end;
- }
+ if ((error= my_hash_insert(&lock_db_cache, (uchar*) opt)))
+ my_free(opt, MYF(0));
}
end:
@@ -135,8 +132,8 @@ void lock_db_delete(const char *name, uint length)
my_dblock_t *opt;
safe_mutex_assert_owner(&LOCK_lock_db);
if ((opt= (my_dblock_t *)hash_search(&lock_db_cache,
- (const byte*) name, length)))
- hash_delete(&lock_db_cache, (byte*) opt);
+ (const uchar*) name, length)))
+ hash_delete(&lock_db_cache, (uchar*) opt);
}
@@ -158,11 +155,11 @@ typedef struct my_dbopt_st
Function we use in the creation of our hash to get key.
*/
-static byte* dboptions_get_key(my_dbopt_t *opt, uint *length,
- my_bool not_used __attribute__((unused)))
+static uchar* dboptions_get_key(my_dbopt_t *opt, size_t *length,
+ my_bool not_used __attribute__((unused)))
{
*length= opt->name_length;
- return (byte*) opt->name;
+ return (uchar*) opt->name;
}
@@ -187,7 +184,7 @@ static inline void write_to_binlog(THD *thd, char *query, uint q_len,
static void free_dbopt(void *dbopt)
{
- my_free((gptr) dbopt, MYF(0));
+ my_free((uchar*) dbopt, MYF(0));
}
@@ -280,7 +277,7 @@ static my_bool get_dbopt(const char *dbname, HA_CREATE_INFO *create)
length= (uint) strlen(dbname);
rw_rdlock(&LOCK_dboptions);
- if ((opt= (my_dbopt_t*) hash_search(&dboptions, (byte*) dbname, length)))
+ if ((opt= (my_dbopt_t*) hash_search(&dboptions, (uchar*) dbname, length)))
{
create->default_table_charset= opt->charset;
error= 0;
@@ -312,12 +309,12 @@ static my_bool put_dbopt(const char *dbname, HA_CREATE_INFO *create)
length= (uint) strlen(dbname);
rw_wrlock(&LOCK_dboptions);
- if (!(opt= (my_dbopt_t*) hash_search(&dboptions, (byte*) dbname, length)))
+ if (!(opt= (my_dbopt_t*) hash_search(&dboptions, (uchar*) dbname, length)))
{
/* Options are not in the hash, insert them */
char *tmp_name;
if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
- &opt, (uint) sizeof(*opt), &tmp_name, length+1,
+ &opt, (uint) sizeof(*opt), &tmp_name, (uint) length+1,
NullS))
{
error= 1;
@@ -328,9 +325,9 @@ static my_bool put_dbopt(const char *dbname, HA_CREATE_INFO *create)
strmov(opt->name, dbname);
opt->name_length= length;
- if ((error= my_hash_insert(&dboptions, (byte*) opt)))
+ if ((error= my_hash_insert(&dboptions, (uchar*) opt)))
{
- my_free((gptr) opt, MYF(0));
+ my_free(opt, MYF(0));
goto end;
}
}
@@ -352,9 +349,9 @@ void del_dbopt(const char *path)
{
my_dbopt_t *opt;
rw_wrlock(&LOCK_dboptions);
- if ((opt= (my_dbopt_t *)hash_search(&dboptions, (const byte*) path,
+ if ((opt= (my_dbopt_t *)hash_search(&dboptions, (const uchar*) path,
strlen(path))))
- hash_delete(&dboptions, (byte*) opt);
+ hash_delete(&dboptions, (uchar*) opt);
rw_unlock(&LOCK_dboptions);
}
@@ -392,7 +389,7 @@ static bool write_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
"\n", NullS) - buf);
/* Error is written by my_write */
- if (!my_write(file,(byte*) buf, length, MYF(MY_NABP+MY_WME)))
+ if (!my_write(file,(uchar*) buf, length, MYF(MY_NABP+MY_WME)))
error=0;
my_close(file,MYF(0));
}
@@ -920,7 +917,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
TABLE_LIST *tbl;
uint db_len;
- if (!(query= thd->alloc(MAX_DROP_TABLE_Q_LEN)))
+ if (!(query= (char*) thd->alloc(MAX_DROP_TABLE_Q_LEN)))
goto exit; /* not much else we can do */
query_pos= query_data_start= strmov(query,"drop table ");
query_end= query + MAX_DROP_TABLE_Q_LEN;
@@ -1021,7 +1018,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
DBUG_PRINT("my",("New subdir found: %s", newpath));
if ((mysql_rm_known_files(thd, new_dirp, NullS, newpath,1,0)) < 0)
goto err;
- if (!(copy_of_path= thd->memdup(newpath, length+1)) ||
+ if (!(copy_of_path= (char*) thd->memdup(newpath, length+1)) ||
!(dir= new (thd->mem_root) String(copy_of_path, length,
&my_charset_bin)) ||
raid_dirs.push_back(dir))
@@ -1511,8 +1508,8 @@ lock_databases(THD *thd, const char *db1, uint length1,
{
pthread_mutex_lock(&LOCK_lock_db);
while (!thd->killed &&
- (hash_search(&lock_db_cache,(byte*) db1, length1) ||
- hash_search(&lock_db_cache,(byte*) db2, length2)))
+ (hash_search(&lock_db_cache,(uchar*) db1, length1) ||
+ hash_search(&lock_db_cache,(uchar*) db2, length2)))
{
wait_for_condition(thd, &LOCK_lock_db, &COND_refresh);
pthread_mutex_lock(&LOCK_lock_db);
@@ -1654,7 +1651,7 @@ bool mysql_rename_db(THD *thd, LEX_STRING *old_db, LEX_STRING *new_db)
table_str.length= filename_to_tablename(file->name,
tname, sizeof(tname)-1);
- table_str.str= sql_memdup(tname, table_str.length + 1);
+ table_str.str= (char*) sql_memdup(tname, table_str.length + 1);
Table_ident *old_ident= new Table_ident(thd, *old_db, table_str, 0);
Table_ident *new_ident= new Table_ident(thd, *new_db, table_str, 0);
if (!old_ident || !new_ident ||
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 26c12dea081..c441c70d36f 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -438,7 +438,7 @@ bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b)
{
handler *file= (handler*)arg;
- return file->cmp_ref((const byte*)a, (const byte*)b);
+ return file->cmp_ref((const uchar*)a, (const uchar*)b);
}
/*
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index cd87330cedb..db6fc03cbad 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -92,7 +92,7 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags);
Pointer to the TABLE_LIST struct.
*/
-static char *mysql_ha_hash_get_key(TABLE_LIST *tables, uint *key_len_p,
+static char *mysql_ha_hash_get_key(TABLE_LIST *tables, size_t *key_len_p,
my_bool first __attribute__((unused)))
{
*key_len_p= strlen(tables->alias) + 1 ; /* include '\0' in comparisons */
@@ -167,7 +167,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
}
else if (! reopen) /* Otherwise we have 'tables' already. */
{
- if (hash_search(&thd->handler_tables_hash, (byte*) tables->alias,
+ if (hash_search(&thd->handler_tables_hash, (uchar*) tables->alias,
strlen(tables->alias) + 1))
{
DBUG_PRINT("info",("duplicate '%s'", tables->alias));
@@ -208,10 +208,10 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
namelen= strlen(tables->table_name) + 1;
aliaslen= strlen(tables->alias) + 1;
if (!(my_multi_malloc(MYF(MY_WME),
- &hash_tables, sizeof(*hash_tables),
- &db, dblen,
- &name, namelen,
- &alias, aliaslen,
+ &hash_tables, (uint) sizeof(*hash_tables),
+ &db, (uint) dblen,
+ &name, (uint) namelen,
+ &alias, (uint) aliaslen,
NullS)))
goto err;
/* structure copy */
@@ -224,7 +224,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
memcpy(hash_tables->alias, tables->alias, aliaslen);
/* add to hash */
- if (my_hash_insert(&thd->handler_tables_hash, (byte*) hash_tables))
+ if (my_hash_insert(&thd->handler_tables_hash, (uchar*) hash_tables))
{
my_free((char*) hash_tables, MYF(0));
mysql_ha_close(thd, tables);
@@ -270,7 +270,7 @@ bool mysql_ha_close(THD *thd, TABLE_LIST *tables)
tables->db, tables->table_name, tables->alias));
if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
- (byte*) tables->alias,
+ (uchar*) tables->alias,
strlen(tables->alias) + 1)))
{
/*
@@ -295,7 +295,7 @@ bool mysql_ha_close(THD *thd, TABLE_LIST *tables)
}
VOID(pthread_mutex_unlock(&LOCK_open));
}
- hash_delete(&thd->handler_tables_hash, (byte*) hash_tables);
+ hash_delete(&thd->handler_tables_hash, (uchar*) hash_tables);
}
else
{
@@ -345,7 +345,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
String buffer(buff, sizeof(buff), system_charset_info);
int error, keyno= -1;
uint num_rows;
- byte *key;
+ uchar *key;
uint key_len;
bool not_used;
DBUG_ENTER("mysql_ha_read");
@@ -362,7 +362,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
it++;
if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
- (byte*) tables->alias,
+ (uchar*) tables->alias,
strlen(tables->alias) + 1)))
{
table= hash_tables->table;
@@ -536,7 +536,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
keypart_map= (keypart_map << 1) | 1;
}
- if (!(key= (byte*) thd->calloc(ALIGN_SIZE(key_len))))
+ if (!(key= (uchar*) thd->calloc(ALIGN_SIZE(key_len))))
goto err;
table->file->ha_index_or_rnd_end();
table->file->ha_index_init(keyno, 1);
@@ -732,13 +732,13 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags)
table->alias, mode_flags));
if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
- (byte*) table->alias,
+ (uchar*) table->alias,
strlen(table->alias) + 1)))
{
if (! (mode_flags & MYSQL_HA_REOPEN_ON_USAGE))
{
/* This is a final close. Remove from hash. */
- hash_delete(&thd->handler_tables_hash, (byte*) hash_tables);
+ hash_delete(&thd->handler_tables_hash, (uchar*) hash_tables);
}
else
{
@@ -785,7 +785,7 @@ void mysql_ha_mark_tables_for_reopen(THD *thd, TABLE *table)
{
TABLE_LIST *hash_tables;
if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
- (byte*) table->alias,
+ (uchar*) table->alias,
strlen(table->alias) + 1)))
{
/* Mark table as ready for reopen. */
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index 79d658c2a85..023bd1fec94 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -272,7 +272,7 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations,
List<String> *names,
String *name, String *description, String *example)
{
- char buff[8]; // Max int length
+ uchar buff[8]; // Max int length
int count= 0;
int iindex_topic, iindex_relations;
Field *rtopic_id, *rkey_id;
@@ -295,20 +295,20 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations,
rkey_id->store((longlong) key_id, TRUE);
rkey_id->get_key_image(buff, rkey_id->pack_length(), Field::itRAW);
int key_res= relations->file->index_read(relations->record[0],
- (byte *) buff, (key_part_map)1,
+ buff, (key_part_map) 1,
HA_READ_KEY_EXACT);
for ( ;
!key_res && key_id == (int16) rkey_id->val_int() ;
key_res= relations->file->index_next(relations->record[0]))
{
- char topic_id_buff[8];
+ uchar topic_id_buff[8];
longlong topic_id= rtopic_id->val_int();
Field *field= find_fields[help_topic_help_topic_id].field;
field->store((longlong) topic_id, TRUE);
field->get_key_image(topic_id_buff, field->pack_length(), Field::itRAW);
- if (!topics->file->index_read(topics->record[0], (byte *)topic_id_buff,
+ if (!topics->file->index_read(topics->record[0], topic_id_buff,
(key_part_map)1, HA_READ_KEY_EXACT))
{
memorize_variant_topic(thd,topics,count,find_fields,
@@ -637,7 +637,7 @@ bool mysqld_help(THD *thd, const char *mask)
MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("mysqld_help");
- bzero((gptr)tables,sizeof(tables));
+ bzero((uchar*)tables,sizeof(tables));
tables[0].alias= tables[0].table_name= (char*) "help_topic";
tables[0].lock_type= TL_READ;
tables[0].next_global= tables[0].next_local=
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index f6ae2df3750..4a7a7e67134 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1256,9 +1256,9 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
goto err;
}
}
- key_copy((byte*) key,table->record[0],table->key_info+key_nr,0);
+ key_copy((uchar*) key,table->record[0],table->key_info+key_nr,0);
if ((error=(table->file->index_read_idx(table->record[1],key_nr,
- (byte*) key, HA_WHOLE_KEY,
+ (uchar*) key, HA_WHOLE_KEY,
HA_READ_KEY_EXACT))))
goto err;
}
@@ -1739,7 +1739,7 @@ TABLE *delayed_insert::get_local_table(THD* client_thd)
Field **field,**org_field, *found_next_number_field;
TABLE *copy;
TABLE_SHARE *share= table->s;
- byte *bitmap;
+ uchar *bitmap;
DBUG_ENTER("delayed_insert::get_local_table");
/* First request insert thread to get a lock */
@@ -1784,7 +1784,7 @@ TABLE *delayed_insert::get_local_table(THD* client_thd)
/* We don't need to change the file handler here */
/* Assign the pointers for the field pointers array and the record. */
field= copy->field= (Field**) (copy + 1);
- bitmap= (byte*) (field + share->fields + 1);
+ bitmap= (uchar*) (field + share->fields + 1);
copy->record[0]= (bitmap + share->column_bitmap_size * 2);
memcpy((char*) copy->record[0], (char*) table->record[0], share->reclength);
/*
@@ -1853,7 +1853,8 @@ write_delayed(THD *thd,TABLE *table, enum_duplicates duplic,
delayed_insert *di=thd->di;
const Discrete_interval *forced_auto_inc;
DBUG_ENTER("write_delayed");
- DBUG_PRINT("enter", ("query = '%s' length %u", query.str, query.length));
+ DBUG_PRINT("enter", ("query = '%s' length %lu", query.str,
+ (ulong) query.length));
thd->proc_info="waiting for handler insert";
pthread_mutex_lock(&di->mutex);
@@ -2227,7 +2228,7 @@ static void free_delayed_insert_blobs(register TABLE *table)
{
if ((*ptr)->flags & BLOB_FLAG)
{
- char *str;
+ uchar *str;
((Field_blob *) (*ptr))->get_ptr(&str);
my_free(str,MYF(MY_ALLOW_ZERO_PTR));
((Field_blob *) (*ptr))->reset();
@@ -2289,8 +2290,9 @@ bool delayed_insert::handle_inserts(void)
use values from the previous interval (of the previous rows).
*/
bool log_query= (row->log_query && row->query.str != NULL);
- DBUG_PRINT("delayed", ("query: '%s' length: %u", row->query.str ?
- row->query.str : "[NULL]", row->query.length));
+ DBUG_PRINT("delayed", ("query: '%s' length: %lu", row->query.str ?
+ row->query.str : "[NULL]",
+ (ulong) row->query.length));
if (log_query)
{
/*
@@ -2622,7 +2624,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
while ((item= li++))
{
item->transform(&Item::update_value_transformer,
- (byte*)lex->current_select);
+ (uchar*)lex->current_select);
}
}
@@ -3108,7 +3110,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
MYSQL_LOCK_IGNORE_FLUSH, &not_used)))
{
VOID(pthread_mutex_lock(&LOCK_open));
- hash_delete(&open_cache,(byte*) table);
+ hash_delete(&open_cache,(uchar*) table);
VOID(pthread_mutex_unlock(&LOCK_open));
quick_rm_table(create_info->db_type, create_table->db,
table_case_name(create_info, create_table->table_name), 0);
@@ -3369,7 +3371,7 @@ void select_create::abort()
{
ulong version= table->s->version;
table->s->version= 0;
- hash_delete(&open_cache,(byte*) table);
+ hash_delete(&open_cache,(uchar*) table);
if (!create_info->table_existed)
quick_rm_table(table_type, create_table->db,
create_table->table_name, 0);
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 26955c18342..5e5308f4ab7 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1214,7 +1214,7 @@ void st_select_lex::init_select()
linkage= UNSPECIFIED_TYPE;
order_list.elements= 0;
order_list.first= 0;
- order_list.next= (byte**) &order_list.first;
+ order_list.next= (uchar**) &order_list.first;
/* Set limit and offset to default values */
select_limit= 0; /* denotes the default limit = HA_POS_ERROR */
offset_limit= 0; /* denotes the default offset = 0 */
@@ -2020,7 +2020,7 @@ TABLE_LIST *st_lex::unlink_first_table(bool *link_to_local)
{
select_lex.context.table_list=
select_lex.context.first_name_resolution_table= first->next_local;
- select_lex.table_list.first= (byte*) (first->next_local);
+ select_lex.table_list.first= (uchar*) (first->next_local);
select_lex.table_list.elements--; //safety
first->next_local= 0;
/*
@@ -2101,7 +2101,7 @@ void st_lex::link_first_table_back(TABLE_LIST *first,
{
first->next_local= (TABLE_LIST*) select_lex.table_list.first;
select_lex.context.table_list= first;
- select_lex.table_list.first= (byte*) first;
+ select_lex.table_list.first= (uchar*) first;
select_lex.table_list.elements++; //safety
}
}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 5a0e6bfdd0c..e8f319a4dbc 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -221,7 +221,7 @@ enum tablespace_op_type
Keep in sync with index_hint_type.
*/
extern const char * index_hint_type_name[];
-typedef byte index_clause_map;
+typedef uchar index_clause_map;
/*
Bits in index_clause_map : one for each possible FOR clause in
@@ -409,7 +409,7 @@ public:
static void *operator new(size_t size)
{
- return (void*) sql_alloc((uint) size);
+ return sql_alloc(size);
}
static void *operator new(size_t size, MEM_ROOT *mem_root)
{ return (void*) alloc_root(mem_root, (uint) size); }
@@ -733,7 +733,7 @@ public:
{
order_list.elements= 0;
order_list.first= 0;
- order_list.next= (byte**) &order_list.first;
+ order_list.next= (uchar**) &order_list.first;
}
/*
This method created for reiniting LEX in mysql_admin_table() and can be
@@ -913,7 +913,7 @@ public:
in which it was right after query parsing.
*/
SQL_LIST sroutines_list;
- byte **sroutines_list_own_last;
+ uchar **sroutines_list_own_last;
uint sroutines_list_own_elements;
/*
@@ -1024,7 +1024,7 @@ typedef struct st_lex : public Query_tables_list
LEX_STRING comment, ident;
LEX_USER *grant_user;
XID *xid;
- gptr yacc_yyss,yacc_yyvs;
+ uchar* yacc_yyss, *yacc_yyvs;
THD *thd;
CHARSET_INFO *charset, *underscore_charset;
/* store original leaf_tables for INSERT SELECT and PS/SP */
@@ -1312,7 +1312,7 @@ struct st_lex_local: public st_lex
{
static void *operator new(size_t size)
{
- return (void*) sql_alloc((uint) size);
+ return sql_alloc(size);
}
static void *operator new(size_t size, MEM_ROOT *mem_root)
{
diff --git a/sql/sql_list.h b/sql/sql_list.h
index ba61a931e04..79e3804d208 100644
--- a/sql/sql_list.h
+++ b/sql/sql_list.h
@@ -25,16 +25,16 @@ class Sql_alloc
public:
static void *operator new(size_t size) throw ()
{
- return (void*) sql_alloc((uint) size);
+ return sql_alloc(size);
}
static void *operator new[](size_t size)
{
- return (void*) sql_alloc((uint) size);
+ return sql_alloc(size);
}
static void *operator new[](size_t size, MEM_ROOT *mem_root) throw ()
- { return (void*) alloc_root(mem_root, (uint) size); }
+ { return alloc_root(mem_root, size); }
static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
- { return (void*) alloc_root(mem_root, (uint) size); }
+ { return alloc_root(mem_root, size); }
static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); }
static void operator delete(void *ptr, MEM_ROOT *mem_root)
{ /* never called */ }
@@ -424,7 +424,7 @@ struct ilink
}
static void operator delete(void* ptr_arg, size_t size)
{
- my_free((gptr)ptr_arg, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
+ my_free((uchar*)ptr_arg, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
}
inline ilink()
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 71cc4c0507c..e137481ccef 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -25,7 +25,7 @@
class READ_INFO {
File file;
- byte *buffer, /* Buffer for read text */
+ uchar *buffer, /* Buffer for read text */
*end_of_buff; /* Data in bufferts ends here */
uint buff_length, /* Length of buffert */
max_length; /* Max length of row */
@@ -40,7 +40,7 @@ class READ_INFO {
public:
bool error,line_cuted,found_null,enclosed;
- byte *row_start, /* Found row starts here */
+ uchar *row_start, /* Found row starts here */
*row_end; /* Found row ends here */
CHARSET_INFO *read_charset;
@@ -576,7 +576,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
continue;
}
it.rewind();
- byte *pos=read_info.row_start;
+ uchar *pos=read_info.row_start;
#ifdef HAVE_purify
read_info.row_end[0]=0;
#endif
@@ -609,7 +609,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
else
{
uint length;
- byte save_chr;
+ uchar save_chr;
if ((length=(uint) (read_info.row_end-pos)) >
field->field_length)
length=field->field_length;
@@ -703,7 +703,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
while ((item= it++))
{
uint length;
- byte *pos;
+ uchar *pos;
if (read_info.read_field())
break;
@@ -910,7 +910,7 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs,
set_if_bigger(length,line_start.length());
stack=stack_pos=(int*) sql_alloc(sizeof(int)*length);
- if (!(buffer=(byte*) my_malloc(buff_length+1,MYF(0))))
+ if (!(buffer=(uchar*) my_malloc(buff_length+1,MYF(0))))
error=1; /* purecov: inspected */
else
{
@@ -920,7 +920,7 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs,
(is_fifo ? READ_FIFO : READ_CACHE),0L,1,
MYF(MY_WME)))
{
- my_free((gptr) buffer,MYF(0)); /* purecov: inspected */
+ my_free((uchar*) buffer,MYF(0)); /* purecov: inspected */
error=1;
}
else
@@ -951,7 +951,7 @@ READ_INFO::~READ_INFO()
{
if (need_end_io_cache)
::end_io_cache(&cache);
- my_free((gptr) buffer,MYF(0));
+ my_free((uchar*) buffer,MYF(0));
error=1;
}
}
@@ -984,7 +984,7 @@ inline int READ_INFO::terminator(char *ptr,uint length)
int READ_INFO::read_field()
{
int chr,found_enclosed_char;
- byte *to,*new_buffer;
+ uchar *to,*new_buffer;
found_null=0;
if (found_end_of_line)
@@ -1007,7 +1007,7 @@ int READ_INFO::read_field()
if (chr == enclosed_char)
{
found_enclosed_char=enclosed_char;
- *to++=(byte) chr; // If error
+ *to++=(uchar) chr; // If error
}
else
{
@@ -1049,7 +1049,7 @@ int READ_INFO::read_field()
{
if ((chr=GET) == my_b_EOF)
{
- *to++= (byte) escape_char;
+ *to++= (uchar) escape_char;
goto found_eof;
}
/*
@@ -1061,7 +1061,7 @@ int READ_INFO::read_field()
*/
if (escape_char != enclosed_char || chr == escape_char)
{
- *to++ = (byte) unescape((char) chr);
+ *to++ = (uchar) unescape((char) chr);
continue;
}
PUSH(chr);
@@ -1086,7 +1086,7 @@ int READ_INFO::read_field()
{
if ((chr=GET) == found_enclosed_char)
{ // Remove dupplicated
- *to++ = (byte) chr;
+ *to++ = (uchar) chr;
continue;
}
// End of enclosed field if followed by field_term or line_term
@@ -1126,12 +1126,12 @@ int READ_INFO::read_field()
return 0;
}
}
- *to++ = (byte) chr;
+ *to++ = (uchar) chr;
}
/*
** We come here if buffer is too small. Enlarge it and continue
*/
- if (!(new_buffer=(byte*) my_realloc((char*) buffer,buff_length+1+IO_SIZE,
+ if (!(new_buffer=(uchar*) my_realloc((char*) buffer,buff_length+1+IO_SIZE,
MYF(MY_WME))))
return (error=1);
to=new_buffer + (to-buffer);
@@ -1166,7 +1166,7 @@ found_eof:
int READ_INFO::read_fixed_length()
{
int chr;
- byte *to;
+ uchar *to;
if (found_end_of_line)
return 1; // One have to call next_line
@@ -1186,10 +1186,10 @@ int READ_INFO::read_fixed_length()
{
if ((chr=GET) == my_b_EOF)
{
- *to++= (byte) escape_char;
+ *to++= (uchar) escape_char;
goto found_eof;
}
- *to++ =(byte) unescape((char) chr);
+ *to++ =(uchar) unescape((char) chr);
continue;
}
if (chr == line_term_char)
@@ -1201,7 +1201,7 @@ int READ_INFO::read_fixed_length()
return 0;
}
}
- *to++ = (byte) chr;
+ *to++ = (uchar) chr;
}
row_end=to; // Found full line
return 0;
@@ -1232,7 +1232,7 @@ int READ_INFO::next_line()
#ifdef USE_MB
if (my_mbcharlen(read_charset, chr) > 1)
{
- for (int i=1;
+ for (uint i=1;
chr != my_b_EOF && i<my_mbcharlen(read_charset, chr);
i++)
chr = GET;
diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc
index b0ca7667a62..171ab55145a 100644
--- a/sql/sql_manager.cc
+++ b/sql/sql_manager.cc
@@ -118,7 +118,7 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused)))
{
struct handler_cb *next= cb->next;
cb->action();
- my_free((gptr)cb, MYF(0));
+ my_free((uchar*)cb, MYF(0));
cb= next;
}
diff --git a/sql/sql_map.cc b/sql/sql_map.cc
index 36a47f1aefc..0a494377fc6 100644
--- a/sql/sql_map.cc
+++ b/sql/sql_map.cc
@@ -24,7 +24,7 @@
#include <sys/mman.h>
#endif
-mapped_files::mapped_files(const my_string filename,byte *magic,uint magic_length)
+mapped_files::mapped_files(const char * filename,uchar *magic,uint magic_length)
{
#ifdef HAVE_MMAP
name=my_strdup(filename,MYF(0));
@@ -37,12 +37,12 @@ mapped_files::mapped_files(const my_string filename,byte *magic,uint magic_lengt
struct stat stat_buf;
if (!fstat(file,&stat_buf))
{
- if (!(map=(byte*) my_mmap(0,(size=(ulong) stat_buf.st_size),PROT_READ,
+ if (!(map=(uchar*) my_mmap(0,(size=(ulong) stat_buf.st_size),PROT_READ,
MAP_SHARED | MAP_NORESERVE,file,
0L)))
{
error=errno;
- my_error(ER_NO_FILE_MAPPING, MYF(0), (my_string) name, error);
+ my_error(ER_NO_FILE_MAPPING, MYF(0), (char *) name, error);
}
}
if (map && memcmp(map,magic,magic_length))
@@ -82,7 +82,7 @@ static I_List<mapped_files> maps_in_use;
** else alloc new object
*/
-mapped_files *map_file(const my_string name,byte *magic,uint magic_length)
+mapped_files *map_file(const char * name,uchar *magic,uint magic_length)
{
#ifdef HAVE_MMAP
VOID(pthread_mutex_lock(&LOCK_mapped_file));
diff --git a/sql/sql_map.h b/sql/sql_map.h
index d8eb64995aa..a1efba0da6f 100644
--- a/sql/sql_map.h
+++ b/sql/sql_map.h
@@ -21,11 +21,11 @@
#endif
class mapped_files;
-mapped_files *map_file(const my_string name,byte *magic,uint magic_length);
+mapped_files *map_file(const char * name,uchar *magic,uint magic_length);
void unmap_file(mapped_files *map);
class mapped_files :public ilink {
- byte *map;
+ uchar *map;
ha_rows size;
char *name; // name of mapped file
File file; // >= 0 if open
@@ -33,11 +33,11 @@ class mapped_files :public ilink {
uint use_count;
public:
- mapped_files(const my_string name,byte *magic,uint magic_length);
+ mapped_files(const char * name,uchar *magic,uint magic_length);
~mapped_files();
friend class mapped_file;
- friend mapped_files *map_file(const my_string name,byte *magic,
+ friend mapped_files *map_file(const char * name,uchar *magic,
uint magic_length);
friend void unmap_file(mapped_files *map);
};
@@ -47,7 +47,7 @@ class mapped_file
{
mapped_files *file;
public:
- mapped_file(const my_string name,byte *magic,uint magic_length)
+ mapped_file(const char * name,uchar *magic,uint magic_length)
{
file=map_file(name,magic,magic_length); /* old or new map */
}
@@ -55,7 +55,7 @@ public:
{
unmap_file(file); /* free map */
}
- byte *map()
+ uchar *map()
{
return file->map;
}
diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc
index 818825d566b..dccfcbaf8ac 100644
--- a/sql/sql_olap.cc
+++ b/sql/sql_olap.cc
@@ -54,8 +54,8 @@ static int make_new_olap_select(LEX *lex, SELECT_LEX *select_lex, List<Item> new
new_select->linkage=OLAP_TYPE;
new_select->olap=NON_EXISTING_ONE;
new_select->group_list.elements=0;
- new_select->group_list.first=(byte *)0;
- new_select->group_list.next=(byte **)&new_select->group_list.first;
+ new_select->group_list.first=(uchar *)0;
+ new_select->group_list.next=(uchar **)&new_select->group_list.first;
List<Item> privlist;
List_iterator<Item> list_it(select_lex->item_list);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index af80ea91397..ae297c11e4e 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -192,7 +192,7 @@ uint sql_command_flags[SQLCOM_END+1];
void init_update_queries(void)
{
- bzero((gptr) &sql_command_flags, sizeof(sql_command_flags));
+ bzero((uchar*) &sql_command_flags, sizeof(sql_command_flags));
sql_command_flags[SQLCOM_CREATE_TABLE]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_CREATE_INDEX]= CF_CHANGES_DATA;
@@ -370,8 +370,9 @@ pthread_handler_t handle_bootstrap(void *arg)
continue;
thd->query_length=length;
- thd->query= thd->memdup_w_gap(buff, length+1,
- thd->db_length+1+QUERY_CACHE_FLAGS_SIZE);
+ thd->query= (char*) thd->memdup_w_gap(buff, length+1,
+ thd->db_length+1+
+ QUERY_CACHE_FLAGS_SIZE);
thd->query[length] = '\0';
DBUG_PRINT("query",("%-.4096s",thd->query));
/*
@@ -758,13 +759,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
statistic_increment(thd->status_var.com_other, &LOCK_status);
thd->enable_slow_log= opt_log_slow_admin_statements;
- db.str= thd->alloc(db_len + tbl_len + 2);
- db.length= db_len;
+ db.str= (char*) thd->alloc(db_len + tbl_len + 2);
if (!db.str)
{
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
break;
}
+ db.length= db_len;
tbl_name= strmake(db.str, packet + 1, db_len)+1;
strmake(tbl_name, packet + db_len + 2, tbl_len);
mysql_table_dump(thd, &db, tbl_name);
@@ -852,8 +853,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (save_user_connect)
decrease_user_connections(save_user_connect);
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
- x_free((gptr) save_db);
- x_free((gptr) save_security_ctx.user);
+ x_free((uchar*) save_db);
+ x_free((uchar*) save_security_ctx.user);
}
break;
}
@@ -948,7 +949,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
/* Locked closure of all tables */
TABLE_LIST table_list;
LEX_STRING conv_name;
- uint dummy;
+ size_t dummy;
/* used as fields initializator */
lex_start(thd, 0, 0);
@@ -976,7 +977,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
thd->query_length= (uint) (packet_end - packet); // Don't count end \0
- if (!(thd->query=fields=thd->memdup(packet,thd->query_length+1)))
+ if (!(thd->query=fields= (char*) thd->memdup(packet,thd->query_length+1)))
break;
general_log_print(thd, command, "%s %s", table_list.table_name, fields);
if (lower_case_table_names)
@@ -992,8 +993,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
table_list.select_lex= &(thd->lex->select_lex);
mysql_init_query(thd, "", 0);
thd->lex->
- select_lex.table_list.link_in_list((byte*) &table_list,
- (byte**) &table_list.next_local);
+ select_lex.table_list.link_in_list((uchar*) &table_list,
+ (uchar**) &table_list.next_local);
thd->lex->add_to_query_tables(&table_list);
/* switch on VIEW optimisation: do not fill temporary tables */
@@ -1189,7 +1190,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
#endif
#ifndef EMBEDDED_LIBRARY
- VOID(my_net_write(net, buff, length));
+ VOID(my_net_write(net, (uchar*) buff, length));
VOID(net_flush(net));
#endif
break;
@@ -1388,7 +1389,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
#else
{
LEX_STRING db;
- uint dummy;
+ size_t dummy;
if (lex->select_lex.db == NULL &&
thd->copy_db_to(&lex->select_lex.db, &dummy))
{
@@ -1489,7 +1490,7 @@ bool alloc_query(THD *thd, const char *packet, uint packet_length)
}
/* We must allocate some extra memory for query cache */
thd->query_length= 0; // Extra safety: Avoid races
- if (!(thd->query= (char*) thd->memdup_w_gap((gptr) (packet),
+ if (!(thd->query= (char*) thd->memdup_w_gap((uchar*) (packet),
packet_length,
thd->db_length+ 1 +
QUERY_CACHE_FLAGS_SIZE)))
@@ -1954,7 +1955,7 @@ mysql_execute_command(THD *thd)
goto error; /* purecov: inspected */
thd->enable_slow_log= opt_log_slow_admin_statements;
res = mysql_backup_table(thd, first_table);
- select_lex->table_list.first= (byte*) first_table;
+ select_lex->table_list.first= (uchar*) first_table;
lex->query_tables=all_tables;
break;
}
@@ -1966,7 +1967,7 @@ mysql_execute_command(THD *thd)
goto error; /* purecov: inspected */
thd->enable_slow_log= opt_log_slow_admin_statements;
res = mysql_restore_table(thd, first_table);
- select_lex->table_list.first= (byte*) first_table;
+ select_lex->table_list.first= (uchar*) first_table;
lex->query_tables=all_tables;
break;
}
@@ -2449,7 +2450,7 @@ end_with_restore_list:
thd->query, thd->query_length, 0, FALSE);
}
}
- select_lex->table_list.first= (byte*) first_table;
+ select_lex->table_list.first= (uchar*) first_table;
lex->query_tables=all_tables;
break;
}
@@ -2460,7 +2461,7 @@ end_with_restore_list:
goto error; /* purecov: inspected */
thd->enable_slow_log= opt_log_slow_admin_statements;
res = mysql_check_table(thd, first_table, &lex->check_opt);
- select_lex->table_list.first= (byte*) first_table;
+ select_lex->table_list.first= (uchar*) first_table;
lex->query_tables=all_tables;
break;
}
@@ -2484,7 +2485,7 @@ end_with_restore_list:
thd->query, thd->query_length, 0, FALSE);
}
}
- select_lex->table_list.first= (byte*) first_table;
+ select_lex->table_list.first= (uchar*) first_table;
lex->query_tables=all_tables;
break;
}
@@ -2511,7 +2512,7 @@ end_with_restore_list:
thd->query, thd->query_length, 0, FALSE);
}
}
- select_lex->table_list.first= (byte*) first_table;
+ select_lex->table_list.first= (uchar*) first_table;
lex->query_tables=all_tables;
break;
}
@@ -2677,7 +2678,7 @@ end_with_restore_list:
{
/* Skip first table, which is the table we are inserting in */
TABLE_LIST *second_table= first_table->next_local;
- select_lex->table_list.first= (byte*) second_table;
+ select_lex->table_list.first= (uchar*) second_table;
select_lex->context.table_list=
select_lex->context.first_name_resolution_table= second_table;
res= mysql_insert_select_prepare(thd);
@@ -2710,7 +2711,7 @@ end_with_restore_list:
delete sel_result;
}
/* revert changes for SP */
- select_lex->table_list.first= (byte*) first_table;
+ select_lex->table_list.first= (uchar*) first_table;
}
/*
@@ -4991,7 +4992,7 @@ long max_stack_used;
- Passing to check_stack_overrun() prevents the compiler from removing it.
*/
bool check_stack_overrun(THD *thd, long margin,
- char *buf __attribute__((unused)))
+ uchar *buf __attribute__((unused)))
{
long stack_used;
DBUG_ASSERT(thd == current_thd);
@@ -5023,19 +5024,19 @@ bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, ulong *yystacksize)
if (!lex->yacc_yyvs)
old_info= *yystacksize;
*yystacksize= set_zone((*yystacksize)*2,MY_YACC_INIT,MY_YACC_MAX);
- if (!(lex->yacc_yyvs= (char*)
- my_realloc((gptr) lex->yacc_yyvs,
+ if (!(lex->yacc_yyvs= (uchar*)
+ my_realloc(lex->yacc_yyvs,
*yystacksize*sizeof(**yyvs),
MYF(MY_ALLOW_ZERO_PTR | MY_FREE_ON_ERROR))) ||
- !(lex->yacc_yyss= (char*)
- my_realloc((gptr) lex->yacc_yyss,
+ !(lex->yacc_yyss= (uchar*)
+ my_realloc(lex->yacc_yyss,
*yystacksize*sizeof(**yyss),
MYF(MY_ALLOW_ZERO_PTR | MY_FREE_ON_ERROR))))
return 1;
if (old_info)
{ // Copy old info from stack
- memcpy(lex->yacc_yyss, (gptr) *yyss, old_info*sizeof(**yyss));
- memcpy(lex->yacc_yyvs, (gptr) *yyvs, old_info*sizeof(**yyvs));
+ memcpy(lex->yacc_yyss, (uchar*) *yyss, old_info*sizeof(**yyss));
+ memcpy(lex->yacc_yyvs, (uchar*) *yyvs, old_info*sizeof(**yyvs));
}
*yyss=(short*) lex->yacc_yyss;
*yyvs=(YYSTYPE*) lex->yacc_yyvs;
@@ -5488,7 +5489,7 @@ add_proc_to_list(THD* thd, Item *item)
*item_ptr= item;
order->item=item_ptr;
order->free_me=0;
- thd->lex->proc_list.link_in_list((byte*) order,(byte**) &order->next);
+ thd->lex->proc_list.link_in_list((uchar*) order,(uchar**) &order->next);
return 0;
}
@@ -5510,7 +5511,7 @@ bool add_to_list(THD *thd, SQL_LIST &list,Item *item,bool asc)
order->free_me=0;
order->used=0;
order->counter_used= 0;
- list.link_in_list((byte*) order,(byte**) &order->next);
+ list.link_in_list((uchar*) order,(uchar**) &order->next);
DBUG_RETURN(0);
}
@@ -5575,7 +5576,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
ER(ER_DERIVED_MUST_HAVE_ALIAS), MYF(0));
DBUG_RETURN(0);
}
- if (!(alias_str=thd->memdup(alias_str,table->table.length+1)))
+ if (!(alias_str= (char*) thd->memdup(alias_str,table->table.length+1)))
DBUG_RETURN(0);
}
if (!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))
@@ -5662,7 +5663,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
previous table reference to 'ptr'. Here we also add one element to the
list 'table_list'.
*/
- table_list.link_in_list((byte*) ptr, (byte**) &ptr->next_local);
+ table_list.link_in_list((uchar*) ptr, (uchar**) &ptr->next_local);
ptr->next_name_resolution_table= NULL;
/* Link table in global list (all used tables) */
lex->add_to_query_tables(ptr);
@@ -5701,7 +5702,7 @@ bool st_select_lex::init_nested_join(THD *thd)
sizeof(NESTED_JOIN))))
DBUG_RETURN(1);
nested_join= ptr->nested_join=
- ((NESTED_JOIN*) ((byte*) ptr + ALIGN_SIZE(sizeof(TABLE_LIST))));
+ ((NESTED_JOIN*) ((uchar*) ptr + ALIGN_SIZE(sizeof(TABLE_LIST))));
join_list->push_front(ptr);
ptr->embedding= embedding;
@@ -5787,7 +5788,7 @@ TABLE_LIST *st_select_lex::nest_last_join(THD *thd)
sizeof(NESTED_JOIN))))
DBUG_RETURN(0);
nested_join= ptr->nested_join=
- ((NESTED_JOIN*) ((byte*) ptr + ALIGN_SIZE(sizeof(TABLE_LIST))));
+ ((NESTED_JOIN*) ((uchar*) ptr + ALIGN_SIZE(sizeof(TABLE_LIST))));
ptr->embedding= embedding;
ptr->join_list= join_list;
@@ -6380,7 +6381,7 @@ bool append_file_to_dir(THD *thd, const char **filename_ptr,
/* Fix is using unix filename format on dos */
strmov(buff,*filename_ptr);
end=convert_dirname(buff, *filename_ptr, NullS);
- if (!(ptr=thd->alloc((uint) (end-buff)+(uint) strlen(table_name)+1)))
+ if (!(ptr= (char*) thd->alloc((size_t) (end-buff) + strlen(table_name)+1)))
return 1; // End of memory
*filename_ptr=ptr;
strxmov(ptr,buff,table_name,NullS);
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index d445c8bfbe0..149db3e6adf 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -123,23 +123,23 @@ uint32 get_partition_id_hash_sub(partition_info *part_info);
uint32 get_partition_id_key_sub(partition_info *part_info);
uint32 get_partition_id_linear_hash_sub(partition_info *part_info);
uint32 get_partition_id_linear_key_sub(partition_info *part_info);
-#endif
-
static uint32 get_next_partition_via_walking(PARTITION_ITERATOR*);
+static void set_up_range_analysis_info(partition_info *part_info);
static uint32 get_next_subpartition_via_walking(PARTITION_ITERATOR*);
+#endif
+
uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter);
uint32 get_next_partition_id_list(PARTITION_ITERATOR* part_iter);
int get_part_iter_for_interval_via_mapping(partition_info *part_info,
bool is_subpart,
- char *min_value, char *max_value,
+ uchar *min_value, uchar *max_value,
uint flags,
PARTITION_ITERATOR *part_iter);
int get_part_iter_for_interval_via_walking(partition_info *part_info,
bool is_subpart,
- char *min_value, char *max_value,
+ uchar *min_value, uchar *max_value,
uint flags,
PARTITION_ITERATOR *part_iter);
-static void set_up_range_analysis_info(partition_info *part_info);
/*
A routine used by the parser to decide whether we are specifying a full
@@ -318,8 +318,8 @@ bool check_reorganise_list(partition_info *new_part_info,
> 0 Error code
*/
-int get_parts_for_update(const byte *old_data, byte *new_data,
- const byte *rec0, partition_info *part_info,
+int get_parts_for_update(const uchar *old_data, uchar *new_data,
+ const uchar *rec0, partition_info *part_info,
uint32 *old_part_id, uint32 *new_part_id,
longlong *new_func_value)
{
@@ -392,7 +392,7 @@ int get_parts_for_update(const byte *old_data, byte *new_data,
calculate the partition id.
*/
-int get_part_for_delete(const byte *buf, const byte *rec0,
+int get_part_for_delete(const uchar *buf, const uchar *rec0,
partition_info *part_info, uint32 *part_id)
{
int error;
@@ -931,7 +931,7 @@ bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
context->table_list= &tables;
context->first_name_resolution_table= &tables;
context->last_name_resolution_table= NULL;
- func_expr->walk(&Item::change_context_processor, 0, (byte*) context);
+ func_expr->walk(&Item::change_context_processor, 0, (uchar*) context);
save_where= thd->where;
thd->where= "partition function";
/*
@@ -1697,7 +1697,7 @@ end:
static int add_write(File fptr, const char *buf, uint len)
{
- uint len_written= my_write(fptr, (const byte*)buf, len, MYF(0));
+ uint len_written= my_write(fptr, (const uchar*)buf, len, MYF(0));
if (likely(len == len_written))
return 0;
@@ -2144,13 +2144,13 @@ char *generate_partition_syntax(partition_info *part_info,
goto close_file;
*buf_length= (uint)buffer_length;
if (use_sql_alloc)
- buf= sql_alloc(*buf_length+1);
+ buf= (char*) sql_alloc(*buf_length+1);
else
- buf= my_malloc(*buf_length+1, MYF(MY_WME));
+ buf= (char*) my_malloc(*buf_length+1, MYF(MY_WME));
if (!buf)
goto close_file;
- if (unlikely(my_read(fptr, (byte*)buf, *buf_length, MYF(MY_FNABP))))
+ if (unlikely(my_read(fptr, (uchar*)buf, *buf_length, MYF(MY_FNABP))))
{
if (!use_sql_alloc)
my_free(buf, MYF(0));
@@ -2413,8 +2413,8 @@ static uint32 get_part_id_linear_key(partition_info *part_info,
*/
static void copy_to_part_field_buffers(Field **ptr,
- char **field_bufs,
- char **restore_ptr)
+ uchar **field_bufs,
+ uchar **restore_ptr)
{
Field *field;
while ((field= *(ptr++)))
@@ -2425,7 +2425,7 @@ static void copy_to_part_field_buffers(Field **ptr,
{
CHARSET_INFO *cs= ((Field_str*)field)->charset();
uint len= field->pack_length();
- char *field_buf= *field_bufs;
+ uchar *field_buf= *field_bufs;
/*
We only use the field buffer for VARCHAR and CHAR strings
which isn't of a binary collation. We also only use the
@@ -2436,17 +2436,17 @@ static void copy_to_part_field_buffers(Field **ptr,
if (field->type() == MYSQL_TYPE_VARCHAR)
{
uint len_bytes= ((Field_varstring*)field)->length_bytes;
- my_strnxfrm(cs, (uchar*)(field_buf + len_bytes), (len - len_bytes),
- (uchar*)(field->ptr + len_bytes), field->field_length);
+ my_strnxfrm(cs, field_buf + len_bytes, (len - len_bytes),
+ field->ptr + len_bytes, field->field_length);
if (len_bytes == 1)
- *field_buf= (uchar)field->field_length;
+ *field_buf= (uchar) field->field_length;
else
int2store(field_buf, field->field_length);
}
else
{
- my_strnxfrm(cs, (uchar*)field_buf, len,
- (uchar*)field->ptr, field->field_length);
+ my_strnxfrm(cs, field_buf, len,
+ field->ptr, field->field_length);
}
field->ptr= field_buf;
}
@@ -2465,7 +2465,7 @@ static void copy_to_part_field_buffers(Field **ptr,
RETURN VALUES
*/
-static void restore_part_field_pointers(Field **ptr, char **restore_ptr)
+static void restore_part_field_pointers(Field **ptr, uchar **restore_ptr)
{
Field *field;
while ((field= *(ptr++)))
@@ -3307,16 +3307,16 @@ static bool check_part_func_bound(Field **ptr)
get the partition identity and restore field pointers afterwards.
*/
-static uint32 get_sub_part_id_from_key(const TABLE *table,byte *buf,
+static uint32 get_sub_part_id_from_key(const TABLE *table,uchar *buf,
KEY *key_info,
const key_range *key_spec)
{
- byte *rec0= table->record[0];
+ uchar *rec0= table->record[0];
partition_info *part_info= table->part_info;
uint32 part_id;
DBUG_ENTER("get_sub_part_id_from_key");
- key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
+ key_restore(buf, (uchar*)key_spec->key, key_info, key_spec->length);
if (likely(rec0 == buf))
part_id= part_info->get_subpartition_id(part_info);
else
@@ -3350,16 +3350,16 @@ static uint32 get_sub_part_id_from_key(const TABLE *table,byte *buf,
get the partition identity and restore field pointers afterwards.
*/
-bool get_part_id_from_key(const TABLE *table, byte *buf, KEY *key_info,
+bool get_part_id_from_key(const TABLE *table, uchar *buf, KEY *key_info,
const key_range *key_spec, uint32 *part_id)
{
bool result;
- byte *rec0= table->record[0];
+ uchar *rec0= table->record[0];
partition_info *part_info= table->part_info;
longlong func_value;
DBUG_ENTER("get_part_id_from_key");
- key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
+ key_restore(buf, (uchar*)key_spec->key, key_info, key_spec->length);
if (likely(rec0 == buf))
result= part_info->get_part_partition_id(part_info, part_id,
&func_value);
@@ -3395,18 +3395,18 @@ bool get_part_id_from_key(const TABLE *table, byte *buf, KEY *key_info,
get the partition identity and restore field pointers afterwards.
*/
-void get_full_part_id_from_key(const TABLE *table, byte *buf,
+void get_full_part_id_from_key(const TABLE *table, uchar *buf,
KEY *key_info,
const key_range *key_spec,
part_id_range *part_spec)
{
bool result;
partition_info *part_info= table->part_info;
- byte *rec0= table->record[0];
+ uchar *rec0= table->record[0];
longlong func_value;
DBUG_ENTER("get_full_part_id_from_key");
- key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
+ key_restore(buf, (uchar*)key_spec->key, key_info, key_spec->length);
if (likely(rec0 == buf))
result= part_info->get_partition_id(part_info, &part_spec->start_part,
&func_value);
@@ -3494,7 +3494,7 @@ void prune_partition_set(const TABLE *table, part_id_range *part_spec)
RETURN VALUE
part_spec
*/
-void get_partition_set(const TABLE *table, byte *buf, const uint index,
+void get_partition_set(const TABLE *table, uchar *buf, const uint index,
const key_range *key_spec, part_id_range *part_spec)
{
partition_info *part_info= table->part_info;
@@ -3831,9 +3831,9 @@ bool mysql_unpack_partition(THD *thd,
char *part_func_string= NULL;
char *subpart_func_string= NULL;
if ((part_func_len &&
- !((part_func_string= thd->alloc(part_func_len)))) ||
+ !((part_func_string= (char*) thd->alloc(part_func_len)))) ||
(subpart_func_len &&
- !((subpart_func_string= thd->alloc(subpart_func_len)))))
+ !((subpart_func_string= (char*) thd->alloc(subpart_func_len)))))
{
mem_alloc_error(part_func_len);
thd->free_items();
@@ -6404,8 +6404,8 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
also for other programs.
*/
-void set_field_ptr(Field **ptr, const byte *new_buf,
- const byte *old_buf)
+void set_field_ptr(Field **ptr, const uchar *new_buf,
+ const uchar *old_buf)
{
my_ptrdiff_t diff= (new_buf - old_buf);
DBUG_ENTER("set_field_ptr");
@@ -6438,8 +6438,8 @@ void set_field_ptr(Field **ptr, const byte *new_buf,
also for other programs.
*/
-void set_key_field_ptr(KEY *key_info, const byte *new_buf,
- const byte *old_buf)
+void set_key_field_ptr(KEY *key_info, const uchar *new_buf,
+ const uchar *old_buf)
{
KEY_PART_INFO *key_part= key_info->key_part;
uint key_parts= key_info->key_parts;
@@ -6690,7 +6690,7 @@ typedef uint32 (*get_endpoint_func)(partition_info*, bool left_endpoint,
int get_part_iter_for_interval_via_mapping(partition_info *part_info,
bool is_subpart,
- char *min_value, char *max_value,
+ uchar *min_value, uchar *max_value,
uint flags,
PARTITION_ITERATOR *part_iter)
{
@@ -6846,7 +6846,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
int get_part_iter_for_interval_via_walking(partition_info *part_info,
bool is_subpart,
- char *min_value, char *max_value,
+ uchar *min_value, uchar *max_value,
uint flags,
PARTITION_ITERATOR *part_iter)
{
diff --git a/sql/sql_partition.h b/sql/sql_partition.h
index e0c0f1c5bd3..d0c66083768 100644
--- a/sql/sql_partition.h
+++ b/sql/sql_partition.h
@@ -56,11 +56,11 @@ bool check_reorganise_list(partition_info *new_part_info,
partition_info *old_part_info,
List<char> list_part_names);
handler *get_ha_partition(partition_info *part_info);
-int get_parts_for_update(const byte *old_data, byte *new_data,
- const byte *rec0, partition_info *part_info,
+int get_parts_for_update(const uchar *old_data, uchar *new_data,
+ const uchar *rec0, partition_info *part_info,
uint32 *old_part_id, uint32 *new_part_id,
longlong *func_value);
-int get_part_for_delete(const byte *buf, const byte *rec0,
+int get_part_for_delete(const uchar *buf, const uchar *rec0,
partition_info *part_info, uint32 *part_id);
void prune_partition_set(const TABLE *table, part_id_range *part_spec);
bool check_partition_info(partition_info *part_info,handlerton **eng_type,
@@ -70,10 +70,10 @@ char *generate_partition_syntax(partition_info *part_info,
uint *buf_length, bool use_sql_alloc,
bool show_partition_options);
bool partition_key_modified(TABLE *table, const MY_BITMAP *fields);
-void get_partition_set(const TABLE *table, byte *buf, const uint index,
+void get_partition_set(const TABLE *table, uchar *buf, const uint index,
const key_range *key_spec,
part_id_range *part_spec);
-void get_full_part_id_from_key(const TABLE *table, byte *buf,
+void get_full_part_id_from_key(const TABLE *table, uchar *buf,
KEY *key_info,
const key_range *key_spec,
part_id_range *part_spec);
@@ -201,7 +201,7 @@ typedef struct st_partition_iter
typedef int (*get_partitions_in_range_iter)(partition_info *part_info,
bool is_subpart,
- char *min_val, char *max_val,
+ uchar *min_val, uchar *max_val,
uint flags,
PARTITION_ITERATOR *part_iter);
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index bc3e3cf0b05..0344ce2fbb0 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -128,7 +128,7 @@ static st_plugin_dl *plugin_dl_insert_or_reuse(struct st_plugin_dl *plugin_dl)
DBUG_RETURN(tmp);
}
}
- if (insert_dynamic(&plugin_dl_array, (gptr)plugin_dl))
+ if (insert_dynamic(&plugin_dl_array, (uchar*)plugin_dl))
DBUG_RETURN(0);
DBUG_RETURN(dynamic_element(&plugin_dl_array, plugin_dl_array.elements - 1,
struct st_plugin_dl *));
@@ -144,7 +144,7 @@ static inline void free_plugin_mem(struct st_plugin_dl *p)
#endif
my_free(p->dl.str, MYF(MY_ALLOW_ZERO_PTR));
if (p->version != MYSQL_PLUGIN_INTERFACE_VERSION)
- my_free((gptr)p->plugins, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*)p->plugins, MYF(MY_ALLOW_ZERO_PTR));
}
static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
@@ -295,7 +295,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
/* Duplicate and convert dll name */
plugin_dl.dl.length= dl->length * files_charset_info->mbmaxlen + 1;
- if (! (plugin_dl.dl.str= my_malloc(plugin_dl.dl.length, MYF(0))))
+ if (! (plugin_dl.dl.str= (char*) my_malloc(plugin_dl.dl.length, MYF(0))))
{
free_plugin_mem(&plugin_dl);
if (report & REPORT_TO_USER)
@@ -369,14 +369,14 @@ static struct st_plugin_int *plugin_find_internal(const LEX_STRING *name, int ty
for (i= 0; i < MYSQL_MAX_PLUGIN_TYPE_NUM; i++)
{
struct st_plugin_int *plugin= (st_plugin_int *)
- hash_search(&plugin_hash[i], (const byte *)name->str, name->length);
+ hash_search(&plugin_hash[i], (const uchar *)name->str, name->length);
if (plugin)
DBUG_RETURN(plugin);
}
}
else
DBUG_RETURN((st_plugin_int *)
- hash_search(&plugin_hash[type], (const byte *)name->str, name->length));
+ hash_search(&plugin_hash[type], (const uchar *)name->str, name->length));
DBUG_RETURN(0);
}
@@ -426,7 +426,7 @@ static st_plugin_int *plugin_insert_or_reuse(struct st_plugin_int *plugin)
DBUG_RETURN(tmp);
}
}
- if (insert_dynamic(&plugin_array, (gptr)plugin))
+ if (insert_dynamic(&plugin_array, (uchar*)plugin))
DBUG_RETURN(0);
DBUG_RETURN(dynamic_element(&plugin_array, plugin_array.elements - 1,
struct st_plugin_int *));
@@ -481,7 +481,7 @@ static my_bool plugin_add(const LEX_STRING *name, const LEX_STRING *dl, int repo
if (! (tmp_plugin_ptr= plugin_insert_or_reuse(&tmp)))
goto err;
plugin_array_version++;
- if (my_hash_insert(&plugin_hash[plugin->type], (byte*)tmp_plugin_ptr))
+ if (my_hash_insert(&plugin_hash[plugin->type], (uchar*)tmp_plugin_ptr))
{
tmp_plugin_ptr->state= PLUGIN_IS_FREED;
goto err;
@@ -546,7 +546,7 @@ void plugin_deinitialize(struct st_plugin_int *plugin)
static void plugin_del(struct st_plugin_int *plugin)
{
DBUG_ENTER("plugin_del(plugin)");
- hash_delete(&plugin_hash[plugin->plugin->type], (byte*)plugin);
+ hash_delete(&plugin_hash[plugin->plugin->type], (uchar*)plugin);
plugin_dl_del(&plugin->plugin_dl->dl);
plugin->state= PLUGIN_IS_FREED;
plugin_array_version++;
@@ -633,12 +633,12 @@ err:
DBUG_RETURN(1);
}
-static byte *get_hash_key(const byte *buff, uint *length,
+static uchar *get_hash_key(const uchar *buff, size_t *length,
my_bool not_used __attribute__((unused)))
{
struct st_plugin_int *plugin= (st_plugin_int *)buff;
*length= (uint)plugin->name.length;
- return((byte *)plugin->name.str);
+ return((uchar *)plugin->name.str);
}
@@ -738,11 +738,11 @@ my_bool plugin_register_builtin(struct st_mysql_plugin *plugin)
tmp.ref_count= 1;
tmp.plugin_dl= 0;
- if (insert_dynamic(&plugin_array, (gptr)&tmp))
+ if (insert_dynamic(&plugin_array, (uchar*)&tmp))
DBUG_RETURN(1);
if (my_hash_insert(&plugin_hash[plugin->type],
- (byte*)dynamic_element(&plugin_array,
+ (uchar*)dynamic_element(&plugin_array,
plugin_array.elements - 1,
struct st_plugin_int *)))
DBUG_RETURN(1);
@@ -772,7 +772,7 @@ void plugin_load(void)
new_thd->store_globals();
new_thd->db= my_strdup("mysql", MYF(0));
new_thd->db_length= 5;
- bzero((gptr)&tables, sizeof(tables));
+ bzero((uchar*)&tables, sizeof(tables));
tables.alias= tables.table_name= (char*)"plugin";
tables.lock_type= TL_READ;
tables.db= new_thd->db;
@@ -945,7 +945,7 @@ my_bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name)
table->use_all_columns();
table->field[0]->store(name->str, name->length, system_charset_info);
if (! table->file->index_read_idx(table->record[0], 0,
- (byte *)table->field[0]->ptr, HA_WHOLE_KEY,
+ (uchar *)table->field[0]->ptr, HA_WHOLE_KEY,
HA_READ_KEY_EXACT))
{
int error;
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 31a6c7af04a..73f315b2441 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -229,7 +229,7 @@ find_prepared_statement(THD *thd, ulong id, const char *where)
static bool send_prep_stmt(Prepared_statement *stmt, uint columns)
{
NET *net= &stmt->thd->net;
- char buff[12];
+ uchar buff[12];
uint tmp;
DBUG_ENTER("send_prep_stmt");
@@ -946,7 +946,7 @@ static bool insert_params_from_vars(Prepared_statement *stmt,
Item_param *param= *it;
varname= var_it++;
entry= (user_var_entry*)hash_search(&stmt->thd->user_vars,
- (byte*) varname->str,
+ (uchar*) varname->str,
varname->length);
if (param->set_from_user_var(stmt->thd, entry) ||
param->convert_str_value(stmt->thd))
@@ -1077,7 +1077,7 @@ static bool mysql_test_insert(Prepared_statement *stmt,
if (table_list->table)
{
// don't allocate insert_values
- table_list->table->insert_values=(byte *)1;
+ table_list->table->insert_values=(uchar *)1;
}
if (mysql_prepare_insert(thd, table_list, table_list->table,
@@ -1590,7 +1590,7 @@ static bool mysql_insert_select_prepare_tester(THD *thd)
next_local;
/* Skip first table, which is the table we are inserting in */
- first_select->table_list.first= (byte *) second_table;
+ first_select->table_list.first= (uchar *) second_table;
thd->lex->select_lex.context.table_list=
thd->lex->select_lex.context.first_name_resolution_table= second_table;
@@ -1621,7 +1621,7 @@ static bool mysql_test_insert_select(Prepared_statement *stmt,
if (tables->table)
{
// don't allocate insert_values
- tables->table->insert_values=(byte *)1;
+ tables->table->insert_values=(uchar *)1;
}
if (insert_precheck(stmt->thd, tables))
@@ -1636,7 +1636,7 @@ static bool mysql_test_insert_select(Prepared_statement *stmt,
&mysql_insert_select_prepare_tester,
OPTION_SETUP_TABLES_DONE);
/* revert changes made by mysql_insert_select_prepare_tester */
- lex->select_lex.table_list.first= (byte*) first_local_table;
+ lex->select_lex.table_list.first= (uchar*) first_local_table;
return res;
}
@@ -1970,7 +1970,7 @@ static const char *get_dynamic_sql_string(LEX *lex, uint *query_len)
*/
if ((entry=
(user_var_entry*)hash_search(&thd->user_vars,
- (byte*)lex->prepared_stmt_code.str,
+ (uchar*)lex->prepared_stmt_code.str,
lex->prepared_stmt_code.length))
&& entry->value)
{
@@ -1999,7 +1999,7 @@ static const char *get_dynamic_sql_string(LEX *lex, uint *query_len)
len= (needs_conversion ? var_value->length() * to_cs->mbmaxlen :
var_value->length());
- if (!(query_str= alloc_root(thd->mem_root, len+1)))
+ if (!(query_str= (char*) alloc_root(thd->mem_root, len+1)))
goto end;
if (needs_conversion)
@@ -2352,7 +2352,7 @@ void mysql_sql_stmt_execute(THD *thd)
/* Query text for binary, general or slow log, if any of them is open */
String expanded_query;
DBUG_ENTER("mysql_sql_stmt_execute");
- DBUG_PRINT("info", ("EXECUTE: %.*s\n", name->length, name->str));
+ DBUG_PRINT("info", ("EXECUTE: %.*s\n", (int) name->length, name->str));
if (!(stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name)))
{
@@ -2540,7 +2540,8 @@ void mysql_sql_stmt_close(THD *thd)
{
Prepared_statement* stmt;
LEX_STRING *name= &thd->lex->prepared_stmt_name;
- DBUG_PRINT("info", ("DEALLOCATE PREPARE: %.*s\n", name->length, name->str));
+ DBUG_PRINT("info", ("DEALLOCATE PREPARE: %.*s\n", (int) name->length,
+ name->str));
if (! (stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name)))
{
@@ -2785,7 +2786,7 @@ void Prepared_statement::cleanup_stmt()
bool Prepared_statement::set_name(LEX_STRING *name_arg)
{
name.length= name_arg->length;
- name.str= memdup_root(mem_root, (char*) name_arg->str, name_arg->length);
+ name.str= (char*) memdup_root(mem_root, name_arg->str, name_arg->length);
return name.str == 0;
}
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index a7200a772bd..596b13b5123 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -72,7 +72,7 @@ static int fake_rotate_event(NET* net, String* packet, char* log_file_name,
int8store(buf+R_POS_OFFSET,position);
packet->append(buf, ROTATE_HEADER_LEN);
packet->append(p,ident_len);
- if (my_net_write(net, (char*)packet->ptr(), packet->length()))
+ if (my_net_write(net, (uchar*) packet->ptr(), packet->length()))
{
*errmsg = "failed on my_net_write()";
DBUG_RETURN(-1);
@@ -83,12 +83,13 @@ static int fake_rotate_event(NET* net, String* packet, char* log_file_name,
static int send_file(THD *thd)
{
NET* net = &thd->net;
- int fd = -1,bytes, error = 1;
+ int fd = -1, error = 1;
+ size_t bytes;
char fname[FN_REFLEN+1];
const char *errmsg = 0;
int old_timeout;
unsigned long packet_len;
- char buf[IO_SIZE]; // It's safe to alloc this
+ uchar buf[IO_SIZE]; // It's safe to alloc this
DBUG_ENTER("send_file");
/*
@@ -121,7 +122,7 @@ static int send_file(THD *thd)
goto err;
}
- while ((bytes = (int) my_read(fd, (byte*) buf, IO_SIZE, MYF(0))) > 0)
+ while ((long) (bytes= my_read(fd, buf, IO_SIZE, MYF(0))) > 0)
{
if (my_net_write(net, buf, bytes))
{
@@ -131,7 +132,7 @@ static int send_file(THD *thd)
}
end:
- if (my_net_write(net, "", 0) || net_flush(net) ||
+ if (my_net_write(net, (uchar*) "", 0) || net_flush(net) ||
(my_net_read(net) == packet_error))
{
errmsg = "while negotiating file transfer close";
@@ -217,7 +218,8 @@ bool log_in_use(const char* log_name)
if ((linfo = tmp->current_linfo))
{
pthread_mutex_lock(&linfo->lock);
- result = !bcmp(log_name, linfo->log_file_name, log_name_len);
+ result = !bcmp((uchar*) log_name, (uchar*) linfo->log_file_name,
+ log_name_len);
pthread_mutex_unlock(&linfo->lock);
if (result)
break;
@@ -480,7 +482,7 @@ impossible position";
int4store((char*) packet->ptr()+LOG_EVENT_MINIMAL_HEADER_LEN+
ST_CREATED_OFFSET+1, (ulong) 0);
/* send it */
- if (my_net_write(net, (char*)packet->ptr(), packet->length()))
+ if (my_net_write(net, (uchar*) packet->ptr(), packet->length()))
{
errmsg = "Failed on my_net_write()";
my_errno= ER_UNKNOWN_ERROR;
@@ -538,7 +540,7 @@ impossible position";
else if ((*packet)[EVENT_TYPE_OFFSET+1] == STOP_EVENT)
binlog_can_be_corrupted= FALSE;
- if (my_net_write(net, (char*)packet->ptr(), packet->length()))
+ if (my_net_write(net, (uchar*) packet->ptr(), packet->length()))
{
errmsg = "Failed on my_net_write()";
my_errno= ER_UNKNOWN_ERROR;
@@ -651,7 +653,7 @@ impossible position";
if (read_packet)
{
thd->proc_info = "Sending binlog event to slave";
- if (my_net_write(net, (char*)packet->ptr(), packet->length()) )
+ if (my_net_write(net, (uchar*) packet->ptr(), packet->length()) )
{
errmsg = "Failed on my_net_write()";
my_errno= ER_UNKNOWN_ERROR;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index dff810e57b0..e67495a08f6 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -76,7 +76,7 @@ static double prev_record_reads(JOIN *join, uint idx, table_map found_ref);
static bool get_best_combination(JOIN *join);
static store_key *get_store_key(THD *thd,
KEYUSE *keyuse, table_map used_tables,
- KEY_PART_INFO *key_part, char *key_buff,
+ KEY_PART_INFO *key_part, uchar *key_buff,
uint maybe_null);
static bool make_simple_join(JOIN *join,TABLE *tmp_table);
static void make_outerjoin_info(JOIN *join);
@@ -1298,7 +1298,7 @@ JOIN::optimize()
for (ORDER *tmp_order= order; tmp_order ; tmp_order=tmp_order->next)
{
Item *item= *tmp_order->item;
- if (item->walk(&Item::is_expensive_processor, 0, (byte*)0))
+ if (item->walk(&Item::is_expensive_processor, 0, (uchar*)0))
{
/* Force tmp table without sort */
need_tmp=1; simple_order=simple_group=0;
@@ -1511,7 +1511,7 @@ JOIN::save_join_tab()
{
if (!join_tab_save && select_lex->master_unit()->uncacheable)
{
- if (!(join_tab_save= (JOIN_TAB*)thd->memdup((gptr) join_tab,
+ if (!(join_tab_save= (JOIN_TAB*)thd->memdup((uchar*) join_tab,
sizeof(JOIN_TAB) * tables)))
return 1;
}
@@ -2733,7 +2733,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
}
else
{
- memcpy((gptr) join->best_positions,(gptr) join->positions,
+ memcpy((uchar*) join->best_positions,(uchar*) join->positions,
sizeof(POSITION)*join->const_tables);
join->best_read=1.0;
}
@@ -3354,7 +3354,7 @@ add_key_part(DYNAMIC_ARRAY *keyuse_array,KEY_FIELD *key_field)
keyuse.optimize= key_field->optimize & KEY_OPTIMIZE_REF_OR_NULL;
keyuse.null_rejecting= key_field->null_rejecting;
keyuse.cond_guard= key_field->cond_guard;
- VOID(insert_dynamic(keyuse_array,(gptr) &keyuse));
+ VOID(insert_dynamic(keyuse_array,(uchar*) &keyuse));
}
}
}
@@ -3421,7 +3421,7 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
keyuse.used_tables=cond_func->key_item()->used_tables();
keyuse.optimize= 0;
keyuse.keypart_map= 0;
- VOID(insert_dynamic(keyuse_array,(gptr) &keyuse));
+ VOID(insert_dynamic(keyuse_array,(uchar*) &keyuse));
}
@@ -3636,7 +3636,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
(qsort_cmp) sort_keyuse);
bzero((char*) &key_end,sizeof(key_end)); /* Add for easy testing */
- VOID(insert_dynamic(keyuse,(gptr) &key_end));
+ VOID(insert_dynamic(keyuse,(uchar*) &key_end));
use=save_pos=dynamic_element(keyuse,0,KEYUSE*);
prev= &key_end;
@@ -3671,7 +3671,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
save_pos++;
}
i=(uint) (save_pos-(KEYUSE*) keyuse->buffer);
- VOID(set_dynamic(keyuse,(gptr) &key_end,i));
+ VOID(set_dynamic(keyuse,(uchar*) &key_end,i));
keyuse->elements=i;
}
return FALSE;
@@ -3752,7 +3752,7 @@ add_group_and_distinct_keys(JOIN *join, JOIN_TAB *join_tab)
{ /* Collect all query fields referenced in the GROUP clause. */
for (cur_group= join->group_list; cur_group; cur_group= cur_group->next)
(*cur_group->item)->walk(&Item::collect_item_field_processor, 0,
- (byte*) &indexed_fields);
+ (uchar*) &indexed_fields);
}
else if (join->select_distinct)
{ /* Collect all query fields referenced in the SELECT clause. */
@@ -3761,7 +3761,7 @@ add_group_and_distinct_keys(JOIN *join, JOIN_TAB *join_tab)
Item *item;
while ((item= select_items_it++))
item->walk(&Item::collect_item_field_processor, 0,
- (byte*) &indexed_fields);
+ (uchar*) &indexed_fields);
}
else
return;
@@ -4582,7 +4582,7 @@ optimize_straight_join(JOIN *join, table_map join_tables)
if (join->sort_by_table &&
join->sort_by_table != join->positions[join->const_tables].table->table)
read_time+= record_count; // We have to make a temp table
- memcpy((gptr) join->best_positions, (gptr) join->positions,
+ memcpy((uchar*) join->best_positions, (uchar*) join->positions,
sizeof(POSITION)*idx);
join->best_read= read_time;
}
@@ -4964,7 +4964,7 @@ best_extension_by_limited_search(JOIN *join,
current_read_time+= current_record_count;
if ((search_depth == 1) || (current_read_time < join->best_read))
{
- memcpy((gptr) join->best_positions, (gptr) join->positions,
+ memcpy((uchar*) join->best_positions, (uchar*) join->positions,
sizeof(POSITION) * (idx + 1));
join->best_read= current_read_time - 0.001;
}
@@ -5002,7 +5002,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
read_time+=record_count; // We have to make a temp table
if (read_time < join->best_read)
{
- memcpy((gptr) join->best_positions,(gptr) join->positions,
+ memcpy((uchar*) join->best_positions,(uchar*) join->positions,
sizeof(POSITION)*idx);
join->best_read= read_time - 0.001;
}
@@ -5313,7 +5313,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
j->ref.key_parts=keyparts;
j->ref.key_length=length;
j->ref.key=(int) key;
- if (!(j->ref.key_buff= (byte*) thd->calloc(ALIGN_SIZE(length)*2)) ||
+ if (!(j->ref.key_buff= (uchar*) thd->calloc(ALIGN_SIZE(length)*2)) ||
!(j->ref.key_copy= (store_key**) thd->alloc((sizeof(store_key*) *
(keyparts+1)))) ||
!(j->ref.items= (Item**) thd->alloc(sizeof(Item*)*keyparts)) ||
@@ -5327,7 +5327,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
keyuse=org_keyuse;
store_key **ref_key= j->ref.key_copy;
- byte *key_buff=j->ref.key_buff, *null_ref_key= 0;
+ uchar *key_buff=j->ref.key_buff, *null_ref_key= 0;
bool keyuse_uses_no_tables= TRUE;
if (ftkey)
{
@@ -5358,8 +5358,8 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
!(join->select_options & SELECT_DESCRIBE))
{ // Compare against constant
store_key_item tmp(thd, keyinfo->key_part[i].field,
- (char*)key_buff + maybe_null,
- maybe_null ? (char*) key_buff : 0,
+ key_buff + maybe_null,
+ maybe_null ? key_buff : 0,
keyinfo->key_part[i].length, keyuse->val);
if (thd->is_fatal_error)
DBUG_RETURN(TRUE);
@@ -5369,7 +5369,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
*ref_key++= get_store_key(thd,
keyuse,join->const_table_map,
&keyinfo->key_part[i],
- (char*) key_buff,maybe_null);
+ key_buff, maybe_null);
/*
Remember if we are going to use REF_OR_NULL
But only if field _really_ can be null i.e. we force JT_REF
@@ -5413,7 +5413,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
static store_key *
get_store_key(THD *thd, KEYUSE *keyuse, table_map used_tables,
- KEY_PART_INFO *key_part, char *key_buff, uint maybe_null)
+ KEY_PART_INFO *key_part, uchar *key_buff, uint maybe_null)
{
if (!((~used_tables) & keyuse->used_tables)) // if const item
{
@@ -5906,7 +5906,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
{
DBUG_EXECUTE("where",print_where(tmp,tab->table->alias););
SQL_SELECT *sel= tab->select= ((SQL_SELECT*)
- thd->memdup((gptr) select,
+ thd->memdup((uchar*) select,
sizeof(*select)));
if (!sel)
DBUG_RETURN(1); // End of memory
@@ -6058,7 +6058,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
{
DBUG_EXECUTE("where",print_where(tmp,"cache"););
tab->cache.select=(SQL_SELECT*)
- thd->memdup((gptr) sel, sizeof(SQL_SELECT));
+ thd->memdup((uchar*) sel, sizeof(SQL_SELECT));
tab->cache.select->cond=tmp;
tab->cache.select->read_tables=join->const_table_map;
}
@@ -7497,11 +7497,11 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond,
as soon the field is not of a string type or the field reference is
an argument of a comparison predicate.
*/
- byte *is_subst_valid= (byte *) 1;
+ uchar *is_subst_valid= (uchar *) 1;
cond= cond->compile(&Item::subst_argument_checker,
&is_subst_valid,
&Item::equal_fields_propagator,
- (byte *) inherited);
+ (uchar *) inherited);
cond->update_used_tables();
}
return cond;
@@ -9261,7 +9261,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
a tmp_set bitmap to be used by things like filesort.
*/
-void setup_tmp_table_column_bitmaps(TABLE *table, byte *bitmaps)
+void setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps)
{
uint field_count= table->s->fields;
bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count,
@@ -9331,7 +9331,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
bool use_packed_rows= 0;
bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS);
char *tmpname,path[FN_REFLEN];
- byte *pos, *group_buff, *bitmaps;
+ uchar *pos, *group_buff, *bitmaps;
uchar *null_flags;
Field **reg_field, **from_field, **default_field;
uint *blob_field;
@@ -9672,7 +9672,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
{
uint alloc_length=ALIGN_SIZE(reclength+MI_UNIQUE_HASH_LENGTH+1);
share->rec_buff_length= alloc_length;
- if (!(table->record[0]= (byte*)
+ if (!(table->record[0]= (uchar*)
alloc_root(&table->mem_root, alloc_length*3)))
goto err;
table->record[1]= table->record[0]+alloc_length;
@@ -9688,7 +9688,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
pos=table->record[0]+ null_pack_length;
if (null_pack_length)
{
- bzero((byte*) recinfo,sizeof(*recinfo));
+ bzero((uchar*) recinfo,sizeof(*recinfo));
recinfo->type=FIELD_NORMAL;
recinfo->length=null_pack_length;
recinfo++;
@@ -9704,7 +9704,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
{
Field *field= *reg_field;
uint length;
- bzero((byte*) recinfo,sizeof(*recinfo));
+ bzero((uchar*) recinfo,sizeof(*recinfo));
if (!(field->flags & NOT_NULL_FLAG))
{
@@ -9718,19 +9718,19 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
recinfo->length=1;
recinfo->type=FIELD_NORMAL;
recinfo++;
- bzero((byte*) recinfo,sizeof(*recinfo));
+ bzero((uchar*) recinfo,sizeof(*recinfo));
}
else
{
recinfo->null_bit= 1 << (null_count & 7);
recinfo->null_pos= null_count/8;
}
- field->move_field((char*) pos,null_flags+null_count/8,
+ field->move_field(pos,null_flags+null_count/8,
1 << (null_count & 7));
null_count++;
}
else
- field->move_field((char*) pos,(uchar*) 0,0);
+ field->move_field(pos,(uchar*) 0,0);
if (field->type() == MYSQL_TYPE_BIT)
{
/* We have to reserve place for extra bits among null bits */
@@ -9848,10 +9848,10 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
{
cur_group->buff=(char*) group_buff;
if (!(cur_group->field= field->new_key_field(thd->mem_root,table,
- (char*) group_buff +
- test(maybe_null),
- field->null_ptr,
- field->null_bit)))
+ group_buff +
+ test(maybe_null),
+ field->null_ptr,
+ field->null_bit)))
goto err; /* purecov: inspected */
if (maybe_null)
{
@@ -9913,7 +9913,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
key_part_info->null_bit=0;
key_part_info->offset=hidden_null_pack_length;
key_part_info->length=null_pack_length;
- key_part_info->field= new Field_string((char*) table->record[0],
+ key_part_info->field= new Field_string(table->record[0],
(uint32) key_part_info->length,
(uchar*) 0,
(uint) 0,
@@ -10002,7 +10002,7 @@ TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list)
uint null_count= 0; /* number of columns which may be null */
uint null_pack_length; /* NULL representation array length */
uint *blob_field;
- byte *bitmaps;
+ uchar *bitmaps;
TABLE *table;
TABLE_SHARE *share;
@@ -10053,7 +10053,7 @@ TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list)
null_pack_length= (null_count + 7)/8;
share->reclength= record_length + null_pack_length;
share->rec_buff_length= ALIGN_SIZE(share->reclength + 1);
- table->record[0]= (byte*) thd->alloc(share->rec_buff_length);
+ table->record[0]= (uchar*) thd->alloc(share->rec_buff_length);
if (!table->record[0])
goto error;
@@ -10067,18 +10067,18 @@ TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list)
table->in_use= thd; /* field->reset() may access table->in_use */
{
/* Set up field pointers */
- byte *null_pos= table->record[0];
- byte *field_pos= null_pos + share->null_bytes;
+ uchar *null_pos= table->record[0];
+ uchar *field_pos= null_pos + share->null_bytes;
uint null_bit= 1;
for (field= table->field; *field; ++field)
{
Field *cur_field= *field;
if ((cur_field->flags & NOT_NULL_FLAG))
- cur_field->move_field((char*) field_pos);
+ cur_field->move_field(field_pos);
else
{
- cur_field->move_field((char*) field_pos, (uchar*) null_pos, null_bit);
+ cur_field->move_field(field_pos, (uchar*) null_pos, null_bit);
null_bit<<= 1;
if (null_bit == (1 << 8))
{
@@ -10147,7 +10147,7 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param,
uniquedef.null_are_equal=1;
/* Create extra column for hash value */
- bzero((byte*) param->recinfo,sizeof(*param->recinfo));
+ bzero((uchar*) param->recinfo,sizeof(*param->recinfo));
param->recinfo->type= FIELD_CHECK;
param->recinfo->length=MI_UNIQUE_HASH_LENGTH;
param->recinfo++;
@@ -11193,7 +11193,7 @@ join_read_const(JOIN_TAB *tab)
else
{
error=table->file->index_read_idx(table->record[0],tab->ref.key,
- (byte*) tab->ref.key_buff,
+ (uchar*) tab->ref.key_buff,
make_prev_keypart_map(tab->ref.key_parts),
HA_READ_KEY_EXACT);
}
@@ -11770,7 +11770,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if (item->maybe_null)
{
Field *field=item->get_tmp_table_field();
- field->ptr[-1]= (byte) (field->is_null() ? 1 : 0);
+ field->ptr[-1]= (uchar) (field->is_null() ? 1 : 0);
}
}
}
@@ -12953,7 +12953,7 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
{
handler *file=table->file;
char *org_record,*new_record;
- byte *record;
+ uchar *record;
int error;
ulong reclength= table->s->reclength-offset;
DBUG_ENTER("remove_dup_with_compare");
@@ -13044,7 +13044,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
ulong key_length,
Item *having)
{
- byte *key_buffer, *key_pos, *record=table->record[0];
+ uchar *key_buffer, *key_pos, *record=table->record[0];
int error;
handler *file= table->file;
ulong extra_length= ALIGN_SIZE(key_length)-key_length;
@@ -13088,7 +13088,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
key_pos=key_buffer;
for (;;)
{
- byte *org_key_pos;
+ uchar *org_key_pos;
if (thd->killed)
{
thd->send_kill_message();
@@ -13115,7 +13115,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
field_length=field_lengths;
for (Field **ptr= first_field ; *ptr ; ptr++)
{
- (*ptr)->sort_string((char*) key_pos,*field_length);
+ (*ptr)->sort_string(key_pos,*field_length);
key_pos+= *field_length++;
}
/* Check if it exists before */
@@ -13218,7 +13218,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
sizeof(CACHE_FIELD*))))
{
- my_free((gptr) cache->buff,MYF(0)); /* purecov: inspected */
+ my_free((uchar*) cache->buff,MYF(0)); /* purecov: inspected */
cache->buff=0; /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */
}
@@ -13251,7 +13251,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
/* Copy null bits from table */
if (null_fields && tables[i].table->s->null_fields)
{ /* must copy null bits */
- copy->str=(char*) tables[i].table->null_flags;
+ copy->str= tables[i].table->null_flags;
copy->length= tables[i].table->s->null_bytes;
copy->strip=0;
copy->blob_field=0;
@@ -13262,7 +13262,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
/* If outer join table, copy null_row flag */
if (tables[i].table->maybe_null)
{
- copy->str= (char*) &tables[i].table->null_row;
+ copy->str= (uchar*) &tables[i].table->null_row;
copy->length=sizeof(tables[i].table->null_row);
copy->strip=0;
copy->blob_field=0;
@@ -13325,13 +13325,13 @@ store_record_in_cache(JOIN_CACHE *cache)
{
if (last_record)
{
- copy->blob_field->get_image((char*) pos,copy->length+sizeof(char*),
+ copy->blob_field->get_image(pos, copy->length+sizeof(char*),
copy->blob_field->charset());
pos+=copy->length+sizeof(char*);
}
else
{
- copy->blob_field->get_image((char*) pos,copy->length, // blob length
+ copy->blob_field->get_image(pos, copy->length, // blob length
copy->blob_field->charset());
memcpy(pos+copy->length,copy->str,copy->blob_length); // Blob data
pos+=copy->length+copy->blob_length;
@@ -13341,7 +13341,7 @@ store_record_in_cache(JOIN_CACHE *cache)
{
if (copy->strip)
{
- char *str,*end;
+ uchar *str,*end;
for (str=copy->str,end= str+copy->length;
end > str && end[-1] == ' ' ;
end--) ;
@@ -13397,13 +13397,13 @@ read_cached_record(JOIN_TAB *tab)
{
if (last_record)
{
- copy->blob_field->set_image((char*) pos,copy->length+sizeof(char*),
+ copy->blob_field->set_image(pos, copy->length+sizeof(char*),
copy->blob_field->charset());
pos+=copy->length+sizeof(char*);
}
else
{
- copy->blob_field->set_ptr((char*) pos,(char*) pos+copy->length);
+ copy->blob_field->set_ptr(pos, pos+copy->length);
pos+=copy->length+copy->blob_field->get_length();
}
}
@@ -14153,7 +14153,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
for (i= 0; (pos= li++); i++)
{
Field *field;
- char *tmp;
+ uchar *tmp;
Item *real_pos= pos->real_item();
if (real_pos->type() == Item::FIELD_ITEM)
{
@@ -14198,8 +14198,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
another extra byte to not get warnings from purify in
Field_string::val_int
*/
- tmp= (char*) sql_alloc(field->pack_length()+2);
- if (!tmp)
+ if (!(tmp= (uchar*) sql_alloc(field->pack_length()+2)))
goto err;
if (copy)
{
diff --git a/sql/sql_select.h b/sql/sql_select.h
index ca37c7bd274..4b8d07ff88b 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -56,8 +56,8 @@ typedef struct st_table_ref
uint key_parts; // num of ...
uint key_length; // length of key_buff
int key; // key no
- byte *key_buff; // value to look for with key
- byte *key_buff2; // key_buff+key_length
+ uchar *key_buff; // value to look for with key
+ uchar *key_buff2; // key_buff+key_length
store_key **key_copy; //
Item **items; // val()'s for each keypart
/*
@@ -79,7 +79,7 @@ typedef struct st_table_ref
key_part_map null_rejecting;
table_map depend_map; // Table depends on these tables.
/* null byte position in the key_buf. Used for REF_OR_NULL optimization */
- byte *null_ref_key;
+ uchar *null_ref_key;
} TABLE_REF;
@@ -89,8 +89,8 @@ typedef struct st_table_ref
*/
typedef struct st_cache_field {
- char *str;
- uint length,blob_length;
+ uchar *str;
+ uint length, blob_length;
Field_blob *blob_field;
bool strip;
} CACHE_FIELD;
@@ -530,20 +530,20 @@ class store_key :public Sql_alloc
public:
bool null_key; /* TRUE <=> the value of the key has a null part */
enum store_key_result { STORE_KEY_OK, STORE_KEY_FATAL, STORE_KEY_CONV };
- store_key(THD *thd, Field *field_arg, char *ptr, char *null, uint length)
+ store_key(THD *thd, Field *field_arg, uchar *ptr, uchar *null, uint length)
:null_key(0), null_ptr(null), err(0)
{
if (field_arg->type() == MYSQL_TYPE_BLOB)
{
/* Key segments are always packed with a 2 byte length prefix */
- to_field= new Field_varstring(ptr, length, 2, (uchar*) null, 1,
+ to_field= new Field_varstring(ptr, length, 2, null, 1,
Field::NONE, field_arg->field_name,
field_arg->table->s, field_arg->charset());
to_field->init(field_arg->table);
}
else
to_field=field_arg->new_key_field(thd->mem_root, field_arg->table,
- ptr, (uchar*) null, 1);
+ ptr, null, 1);
}
virtual ~store_key() {} /* Not actually needed */
virtual const char *name() const=0;
@@ -571,8 +571,8 @@ public:
protected:
Field *to_field; // Store data here
- char *null_ptr;
- char err;
+ uchar *null_ptr;
+ uchar err;
virtual enum store_key_result copy_inner()=0;
};
@@ -583,11 +583,12 @@ class store_key_field: public store_key
Copy_field copy_field;
const char *field_name;
public:
- store_key_field(THD *thd, Field *to_field_arg, char *ptr, char *null_ptr_arg,
+ store_key_field(THD *thd, Field *to_field_arg, uchar *ptr,
+ uchar *null_ptr_arg,
uint length, Field *from_field, const char *name_arg)
:store_key(thd, to_field_arg,ptr,
null_ptr_arg ? null_ptr_arg : from_field->maybe_null() ? &err
- : NullS,length), field_name(name_arg)
+ : (uchar*) 0, length), field_name(name_arg)
{
if (to_field)
{
@@ -615,11 +616,11 @@ class store_key_item :public store_key
protected:
Item *item;
public:
- store_key_item(THD *thd, Field *to_field_arg, char *ptr, char *null_ptr_arg,
- uint length, Item *item_arg)
- :store_key(thd, to_field_arg,ptr,
+ store_key_item(THD *thd, Field *to_field_arg, uchar *ptr,
+ uchar *null_ptr_arg, uint length, Item *item_arg)
+ :store_key(thd, to_field_arg, ptr,
null_ptr_arg ? null_ptr_arg : item_arg->maybe_null ?
- &err : NullS, length), item(item_arg)
+ &err : (uchar*) 0, length), item(item_arg)
{}
const char *name() const { return "func"; }
@@ -641,12 +642,12 @@ class store_key_const_item :public store_key_item
{
bool inited;
public:
- store_key_const_item(THD *thd, Field *to_field_arg, char *ptr,
- char *null_ptr_arg, uint length,
+ store_key_const_item(THD *thd, Field *to_field_arg, uchar *ptr,
+ uchar *null_ptr_arg, uint length,
Item *item_arg)
:store_key_item(thd, to_field_arg,ptr,
null_ptr_arg ? null_ptr_arg : item_arg->maybe_null ?
- &err : NullS, length, item_arg), inited(0)
+ &err : (uchar*) 0, length, item_arg), inited(0)
{
}
const char *name() const { return "const"; }
diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc
index a62ce98850b..195e6743a72 100644
--- a/sql/sql_servers.cc
+++ b/sql/sql_servers.cc
@@ -77,7 +77,7 @@ static void merge_server_struct(FOREIGN_SERVER *from, FOREIGN_SERVER *to);
-static byte *servers_cache_get_key(FOREIGN_SERVER *server, uint *length,
+static uchar *servers_cache_get_key(FOREIGN_SERVER *server, size_t *length,
my_bool not_used __attribute__((unused)))
{
DBUG_ENTER("servers_cache_get_key");
@@ -86,7 +86,7 @@ static byte *servers_cache_get_key(FOREIGN_SERVER *server, uint *length,
server->server_name));
*length= (uint) server->server_name_length;
- DBUG_RETURN((byte*) server->server_name);
+ DBUG_RETURN((uchar*) server->server_name);
}
@@ -323,7 +323,7 @@ get_server_from_table_to_cache(TABLE *table)
DBUG_PRINT("info", ("server->username %s", server->username));
DBUG_PRINT("info", ("server->password %s", server->password));
DBUG_PRINT("info", ("server->socket %s", server->socket));
- if (my_hash_insert(&servers_cache, (byte*) server))
+ if (my_hash_insert(&servers_cache, (uchar*) server))
{
DBUG_PRINT("info", ("had a problem inserting server %s at %lx",
server->server_name, (long unsigned int) server));
@@ -411,7 +411,7 @@ insert_server_record_into_cache(FOREIGN_SERVER *server)
DBUG_PRINT("info", ("inserting server %s at %lx, length %d",
server->server_name, (long unsigned int) server,
server->server_name_length));
- if (my_hash_insert(&servers_cache, (byte*) server))
+ if (my_hash_insert(&servers_cache, (uchar*) server))
{
DBUG_PRINT("info", ("had a problem inserting server %s at %lx",
server->server_name, (long unsigned int) server));
@@ -517,7 +517,7 @@ int insert_server_record(TABLE *table, FOREIGN_SERVER *server)
/* read index until record is that specified in server_name */
if ((error= table->file->index_read_idx(table->record[0], 0,
- (byte *)table->field[0]->ptr, HA_WHOLE_KEY,
+ (uchar *)table->field[0]->ptr, HA_WHOLE_KEY,
HA_READ_KEY_EXACT)))
{
/* if not found, err */
@@ -642,7 +642,7 @@ delete_server_record_in_cache(LEX_SERVER_OPTIONS *server_options)
if (!(server= (FOREIGN_SERVER *) hash_search(&servers_cache,
- (byte*) server_options->server_name,
+ (uchar*) server_options->server_name,
server_options->server_name_length)))
{
DBUG_PRINT("info", ("server_name %s length %d not found!",
@@ -658,7 +658,7 @@ delete_server_record_in_cache(LEX_SERVER_OPTIONS *server_options)
server->server_name,
server->server_name_length));
- VOID(hash_delete(&servers_cache, (byte*) server));
+ VOID(hash_delete(&servers_cache, (uchar*) server));
error= 0;
@@ -765,12 +765,12 @@ int update_server_record_in_cache(FOREIGN_SERVER *existing,
/*
delete the existing server struct from the server cache
*/
- VOID(hash_delete(&servers_cache, (byte*)existing));
+ VOID(hash_delete(&servers_cache, (uchar*)existing));
/*
Insert the altered server struct into the server cache
*/
- if (my_hash_insert(&servers_cache, (byte*)altered))
+ if (my_hash_insert(&servers_cache, (uchar*)altered))
{
DBUG_PRINT("info", ("had a problem inserting server %s at %lx",
altered->server_name, (long unsigned int) altered));
@@ -859,7 +859,7 @@ update_server_record(TABLE *table, FOREIGN_SERVER *server)
system_charset_info);
if ((error= table->file->index_read_idx(table->record[0], 0,
- (byte *)table->field[0]->ptr, ~(longlong)0,
+ (uchar *)table->field[0]->ptr, ~(longlong)0,
HA_READ_KEY_EXACT)))
{
if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
@@ -911,7 +911,7 @@ delete_server_record(TABLE *table,
table->field[0]->store(server_name, server_name_length, system_charset_info);
if ((error= table->file->index_read_idx(table->record[0], 0,
- (byte *)table->field[0]->ptr, HA_WHOLE_KEY,
+ (uchar *)table->field[0]->ptr, HA_WHOLE_KEY,
HA_READ_KEY_EXACT)))
{
if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
@@ -954,7 +954,7 @@ int create_server(THD *thd, LEX_SERVER_OPTIONS *server_options)
rw_wrlock(&THR_LOCK_servers);
/* hit the memory first */
- if (hash_search(&servers_cache, (byte*) server_options->server_name,
+ if (hash_search(&servers_cache, (uchar*) server_options->server_name,
server_options->server_name_length))
goto end;
@@ -1000,7 +1000,7 @@ int alter_server(THD *thd, LEX_SERVER_OPTIONS *server_options)
rw_wrlock(&THR_LOCK_servers);
if (!(existing= (FOREIGN_SERVER *) hash_search(&servers_cache,
- (byte*) name.str,
+ (uchar*) name.str,
name.length)))
goto end;
@@ -1260,7 +1260,7 @@ FOREIGN_SERVER *get_server_by_name(MEM_ROOT *mem, const char *server_name,
DBUG_PRINT("info", ("locking servers_cache"));
rw_rdlock(&THR_LOCK_servers);
if (!(server= (FOREIGN_SERVER *) hash_search(&servers_cache,
- (byte*) server_name,
+ (uchar*) server_name,
server_name_length)))
{
DBUG_PRINT("info", ("server_name %s length %d not found!",
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index e4e0fb22a5e..09a00901dda 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -830,7 +830,7 @@ mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd)
}
else
{
- if (my_write(fd, (const byte*) packet->ptr(), packet->length(),
+ if (my_write(fd, (const uchar*) packet->ptr(), packet->length(),
MYF(MY_WME)))
DBUG_RETURN(-1);
}
@@ -1659,7 +1659,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
if (tmp->peer_port && (tmp_sctx->host || tmp_sctx->ip) &&
thd->security_ctx->host_or_ip[0])
{
- if ((thd_info->host= thd->alloc(LIST_PROCESS_HOST_LEN+1)))
+ if ((thd_info->host= (char*) thd->alloc(LIST_PROCESS_HOST_LEN+1)))
my_snprintf((char *) thd_info->host, LIST_PROCESS_HOST_LEN,
"%s:%u", tmp_sctx->host_or_ip, tmp->peer_port);
}
@@ -1911,8 +1911,8 @@ int add_status_vars(SHOW_VAR *list)
goto err;
}
while (list->name)
- res|= insert_dynamic(&all_status_vars, (gptr)list++);
- res|= insert_dynamic(&all_status_vars, (gptr)list); // appending NULL-element
+ res|= insert_dynamic(&all_status_vars, (uchar*)list++);
+ res|= insert_dynamic(&all_status_vars, (uchar*)list); // appending NULL-element
all_status_vars.elements--; // but next insert_dynamic should overwite it
if (status_vars_inited)
sort_dynamic(&all_status_vars, show_var_cmp);
@@ -3080,7 +3080,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
for (ptr=show_table->field; (field= *ptr) ; ptr++)
{
const char *tmp_buff;
- byte *pos;
+ uchar *pos;
bool is_blob;
uint flags=field->flags;
char tmp[MAX_FIELD_WIDTH];
@@ -3158,7 +3158,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
table->field[5]->store("",0, cs);
table->field[5]->set_notnull();
}
- pos=(byte*) ((flags & NOT_NULL_FLAG) ? "NO" : "YES");
+ pos=(uchar*) ((flags & NOT_NULL_FLAG) ? "NO" : "YES");
table->field[6]->store((const char*) pos,
strlen((const char*) pos), cs);
is_blob= (field->type() == MYSQL_TYPE_BLOB);
@@ -3226,16 +3226,16 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
if (field->has_charset())
{
- pos=(byte*) field->charset()->csname;
+ pos=(uchar*) field->charset()->csname;
table->field[12]->store((const char*) pos,
strlen((const char*) pos), cs);
table->field[12]->set_notnull();
- pos=(byte*) field->charset()->name;
+ pos=(uchar*) field->charset()->name;
table->field[13]->store((const char*) pos,
strlen((const char*) pos), cs);
table->field[13]->set_notnull();
}
- pos=(byte*) ((field->flags & PRI_KEY_FLAG) ? "PRI" :
+ pos=(uchar*) ((field->flags & PRI_KEY_FLAG) ? "PRI" :
(field->flags & UNIQUE_KEY_FLAG) ? "UNI" :
(field->flags & MULTIPLE_KEY_FLAG) ? "MUL":"");
table->field[15]->store((const char*) pos,
@@ -3955,6 +3955,7 @@ static int get_schema_key_column_usage_record(THD *thd,
}
+#ifdef WITH_PARTITION_STORAGE_ENGINE
static void collect_partition_expr(List<char> &field_list, String *str)
{
List_iterator<char> part_it(field_list);
@@ -3969,6 +3970,7 @@ static void collect_partition_expr(List<char> &field_list, String *str)
}
return;
}
+#endif
static void store_schema_partitions_record(THD *thd, TABLE *schema_table,
@@ -5985,7 +5987,7 @@ int initialize_schema_table(st_plugin_int *plugin)
DBUG_RETURN(0);
err:
- my_free((gptr)schema_table, MYF(0));
+ my_free(schema_table, MYF(0));
DBUG_RETURN(1);
}
@@ -6002,8 +6004,7 @@ int finalize_schema_table(st_plugin_int *plugin)
DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
plugin->name.str));
}
- my_free((gptr)schema_table, MYF(0));
+ my_free(schema_table, MYF(0));
}
-
DBUG_RETURN(0);
}
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 52af2f2dd90..6c7dea6bf22 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -32,7 +32,7 @@
required by the string function
*/
-extern gptr sql_alloc(unsigned size);
+extern uchar* sql_alloc(unsigned size);
extern void sql_element_free(void *ptr);
#include "sql_string.h"
@@ -496,7 +496,7 @@ bool String::append(FILE* file, uint32 arg_length, myf my_flags)
{
if (realloc(str_length+arg_length))
return TRUE;
- if (my_fread(file, (byte*) Ptr + str_length, arg_length, my_flags))
+ if (my_fread(file, (uchar*) Ptr + str_length, arg_length, my_flags))
{
shrink(str_length);
return TRUE;
@@ -510,7 +510,7 @@ bool String::append(IO_CACHE* file, uint32 arg_length)
{
if (realloc(str_length+arg_length))
return TRUE;
- if (my_b_read(file, (byte*) Ptr + str_length, arg_length))
+ if (my_b_read(file, (uchar*) Ptr + str_length, arg_length))
{
shrink(str_length);
return TRUE;
@@ -635,7 +635,7 @@ bool String::replace(uint32 offset,uint32 arg_length,
{
if (realloc(str_length+(uint32) diff))
return TRUE;
- bmove_upp(Ptr+str_length+diff,Ptr+str_length,
+ bmove_upp((uchar*) Ptr+str_length+diff, (uchar*) Ptr+str_length,
str_length-offset-arg_length);
}
if (to_length)
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 1047b1ec35d..d19fcfd57fb 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -409,11 +409,11 @@ static bool read_ddl_log_file_entry(uint entry_no)
{
bool error= FALSE;
File file_id= global_ddl_log.file_id;
- char *file_entry_buf= (char*)global_ddl_log.file_entry_buf;
+ uchar *file_entry_buf= (uchar*)global_ddl_log.file_entry_buf;
uint io_size= global_ddl_log.io_size;
DBUG_ENTER("read_ddl_log_file_entry");
- if (my_pread(file_id, (byte*)file_entry_buf, io_size, io_size * entry_no,
+ if (my_pread(file_id, file_entry_buf, io_size, io_size * entry_no,
MYF(MY_WME)) != io_size)
error= TRUE;
DBUG_RETURN(error);
@@ -437,7 +437,7 @@ static bool write_ddl_log_file_entry(uint entry_no)
char *file_entry_buf= (char*)global_ddl_log.file_entry_buf;
DBUG_ENTER("write_ddl_log_file_entry");
- if (my_pwrite(file_id, (byte*)file_entry_buf,
+ if (my_pwrite(file_id, (uchar*)file_entry_buf,
IO_SIZE, IO_SIZE * entry_no, MYF(MY_WME)) != IO_SIZE)
error= TRUE;
DBUG_RETURN(error);
@@ -650,7 +650,9 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
int error= TRUE;
char to_path[FN_REFLEN];
char from_path[FN_REFLEN];
+#ifdef WITH_PARTITION_STORAGE_ENGINE
char *par_ext= (char*)".par";
+#endif
handlerton *hton;
DBUG_ENTER("execute_ddl_log_action");
@@ -1235,13 +1237,13 @@ void release_ddl_log()
while (used_list)
{
DDL_LOG_MEMORY_ENTRY *tmp= used_list->next_log_entry;
- my_free((char*)used_list, MYF(0));
+ my_free(used_list, MYF(0));
used_list= tmp;
}
while (free_list)
{
DDL_LOG_MEMORY_ENTRY *tmp= free_list->next_log_entry;
- my_free((char*)free_list, MYF(0));
+ my_free(free_list, MYF(0));
free_list= tmp;
}
close_ddl_log();
@@ -1365,13 +1367,13 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
handlers that have the main version of the frm file stored in the
handler.
*/
- const void *data= 0;
- uint length= 0;
+ uchar *data;
+ size_t length;
if (readfrm(shadow_path, &data, &length) ||
packfrm(data, length, &lpt->pack_frm_data, &lpt->pack_frm_len))
{
- my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
- my_free((char*)lpt->pack_frm_data, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(data, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(lpt->pack_frm_data, MYF(MY_ALLOW_ZERO_PTR));
mem_alloc_error(length);
error= 1;
goto end;
@@ -3024,7 +3026,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
DBUG_RETURN(-1);
}
/* Sort keys in optimized order */
- qsort((gptr) *key_info_buffer, *key_count, sizeof(KEY),
+ qsort((uchar*) *key_info_buffer, *key_count, sizeof(KEY),
(qsort_cmp) sort_keys);
create_info->null_bits= null_fields;
@@ -3597,7 +3599,7 @@ bool mysql_create_table(THD *thd, const char *db, const char *table_name,
/* Wait for any database locks */
pthread_mutex_lock(&LOCK_lock_db);
while (!thd->killed &&
- hash_search(&lock_db_cache,(byte*) db, strlen(db)))
+ hash_search(&lock_db_cache,(uchar*) db, strlen(db)))
{
wait_for_condition(thd, &LOCK_lock_db, &COND_refresh);
pthread_mutex_lock(&LOCK_lock_db);
@@ -4107,7 +4109,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
table->next_global= 0;
save_next_local= table->next_local;
table->next_local= 0;
- select->table_list.first= (byte*)table;
+ select->table_list.first= (uchar*)table;
/*
Time zone tables and SP tables can be add to lex->query_tables list,
so it have to be prepared.
@@ -4719,7 +4721,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
}
}
- bzero((gptr)&src_tables_list, sizeof(src_tables_list));
+ bzero((uchar*)&src_tables_list, sizeof(src_tables_list));
src_tables_list.db= src_db;
src_tables_list.db_length= table_ident->db.length;
src_tables_list.lock_type= TL_READ;
@@ -4853,7 +4855,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
if (open_tables(thd, &table, &counter, 0))
goto err;
- bzero((gptr)&dst_tables_list, sizeof(dst_tables_list));
+ bzero((uchar*)&dst_tables_list, sizeof(dst_tables_list));
dst_tables_list.db= table->db;
dst_tables_list.table_name= table->table_name;
@@ -6505,7 +6507,7 @@ view_err:
{
/* Close the intermediate table that will be the new table */
intern_close_table(new_table);
- my_free((gptr) new_table,MYF(0));
+ my_free(new_table,MYF(0));
}
VOID(pthread_mutex_lock(&LOCK_open));
if (error)
@@ -6720,7 +6722,7 @@ view_err:
if (table)
{
intern_close_table(table);
- my_free((char*) table, MYF(0));
+ my_free(table, MYF(0));
}
else
sql_print_warning("Could not open table %s.%s after rename\n",
@@ -6885,7 +6887,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
copy_ptr->do_copy(copy_ptr);
}
prev_insert_id= to->file->next_insert_id;
- error=to->file->write_row((byte*) to->record[0]);
+ error=to->file->write_row(to->record[0]);
to->auto_increment_field_not_null= FALSE;
if (error)
{
@@ -7071,10 +7073,10 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
{
String tmp;
f->val_str(&tmp);
- row_crc= my_checksum(row_crc, (byte*) tmp.ptr(), tmp.length());
+ row_crc= my_checksum(row_crc, (uchar*) tmp.ptr(), tmp.length());
}
else
- row_crc= my_checksum(row_crc, (byte*) f->ptr,
+ row_crc= my_checksum(row_crc, f->ptr,
f->pack_length());
}
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index d7573b42c5f..d36175908df 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -349,7 +349,7 @@ static void push_locks_into_array(DYNAMIC_ARRAY *ar, THR_LOCK_DATA *data,
table_lock_info.lock_text=text;
// lock_type is also obtainable from THR_LOCK_DATA
table_lock_info.type=table->reginfo.lock_type;
- VOID(push_dynamic(ar,(gptr) &table_lock_info));
+ VOID(push_dynamic(ar,(uchar*) &table_lock_info));
}
}
}
@@ -394,7 +394,7 @@ static void display_table_locks(void)
VOID(pthread_mutex_unlock(&THR_LOCK_lock));
if (!saved_table_locks.elements) goto end;
- qsort((gptr) dynamic_element(&saved_table_locks,0,TABLE_LOCK_INFO *),saved_table_locks.elements,sizeof(TABLE_LOCK_INFO),(qsort_cmp) dl_compare);
+ qsort((uchar*) dynamic_element(&saved_table_locks,0,TABLE_LOCK_INFO *),saved_table_locks.elements,sizeof(TABLE_LOCK_INFO),(qsort_cmp) dl_compare);
freeze_size(&saved_table_locks);
puts("\nThread database.table_name Locked/Waiting Lock_type\n");
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 7b4deba527a..4540cab99c3 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -114,7 +114,7 @@ public:
Handle_old_incorrect_sql_modes_hook(char *file_path)
:path(file_path)
{};
- virtual bool process_unknown_string(char *&unknown_key, gptr base,
+ virtual bool process_unknown_string(char *&unknown_key, uchar* base,
MEM_ROOT *mem_root, char *end);
};
@@ -125,7 +125,7 @@ public:
LEX_STRING *trigger_table_arg)
:path(file_path), trigger_table_value(trigger_table_arg)
{};
- virtual bool process_unknown_string(char *&unknown_key, gptr base,
+ virtual bool process_unknown_string(char *&unknown_key, uchar* base,
MEM_ROOT *mem_root, char *end);
private:
char *path;
@@ -484,7 +484,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
trigname.trigger_table.length= tables->table_name_length;
if (sql_create_definition_file(NULL, &trigname_file, &trigname_file_type,
- (gptr)&trigname, trigname_file_parameters, 0))
+ (uchar*)&trigname, trigname_file_parameters, 0))
return 1;
/*
@@ -574,7 +574,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
/* Create trigger definition file. */
if (!sql_create_definition_file(NULL, &file, &triggers_file_type,
- (gptr)this, triggers_file_parameters, 0))
+ (uchar*)this, triggers_file_parameters, 0))
return 0;
err_with_cleanup:
@@ -654,7 +654,7 @@ static bool save_trigger_file(Table_triggers_list *triggers, const char *db,
triggers_file_ext, 0);
file.str= file_buff;
return sql_create_definition_file(NULL, &file, &triggers_file_type,
- (gptr)triggers, triggers_file_parameters,
+ (uchar*)triggers, triggers_file_parameters,
0);
}
@@ -865,7 +865,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
triggers->definition_modes_list.empty();
triggers->definers_list.empty();
- if (parser->parse((gptr)triggers, &table->mem_root,
+ if (parser->parse((uchar*)triggers, &table->mem_root,
triggers_file_parameters,
TRG_NUM_REQUIRED_PARAMETERS,
&sql_modes_hook))
@@ -945,7 +945,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
of routines used by statement.
*/
triggers->sroutines_key.length= 1+strlen(db)+1+strlen(table_name)+1;
- if (!(triggers->sroutines_key.str=
+ if (!(triggers->sroutines_key.str= (char*)
alloc_root(&table->mem_root, triggers->sroutines_key.length)))
DBUG_RETURN(1);
triggers->sroutines_key.str[0]= TYPE_ENUM_TRIGGER;
@@ -1219,7 +1219,7 @@ add_table_for_trigger(THD *thd, sp_name *trig, bool if_exists,
DBUG_RETURN(1);
}
- if (parser->parse((gptr)&trigname, thd->mem_root,
+ if (parser->parse((uchar*)&trigname, thd->mem_root,
trigname_file_parameters, 1,
&trigger_table_hook))
DBUG_RETURN(1);
@@ -1356,8 +1356,8 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd,
It is OK to allocate some memory on table's MEM_ROOT since this
table instance will be thrown out at the end of rename anyway.
*/
- new_def.str= memdup_root(&trigger_table->mem_root, buff.ptr(),
- buff.length());
+ new_def.str= (char*) memdup_root(&trigger_table->mem_root, buff.ptr(),
+ buff.length());
new_def.length= buff.length();
on_table_name->str= new_def.str + before_on_len;
on_table_name->length= on_q_table_name_len;
@@ -1418,7 +1418,7 @@ Table_triggers_list::change_table_name_in_trignames(const char *db_name,
trigname.trigger_table= *new_table_name;
if (sql_create_definition_file(NULL, &trigname_file, &trigname_file_type,
- (gptr)&trigname, trigname_file_parameters,
+ (uchar*)&trigname, trigname_file_parameters,
0))
return trigger;
}
@@ -1659,7 +1659,7 @@ void Table_triggers_list::mark_fields_used(trg_event_type event)
bool
Handle_old_incorrect_sql_modes_hook::process_unknown_string(char *&unknown_key,
- gptr base,
+ uchar* base,
MEM_ROOT *mem_root,
char *end)
{
@@ -1702,7 +1702,7 @@ Handle_old_incorrect_sql_modes_hook::process_unknown_string(char *&unknown_key,
bool
Handle_old_incorrect_trigger_table_hook::
-process_unknown_string(char *&unknown_key, gptr base, MEM_ROOT *mem_root,
+process_unknown_string(char *&unknown_key, uchar* base, MEM_ROOT *mem_root,
char *end)
{
DBUG_ENTER("Handle_old_incorrect_trigger_table_hook::process_unknown_string");
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 89084c21c0c..2ebdbdf0cd0 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -92,12 +92,12 @@ static char *init_syms(udf_func *tmp, char *nm)
}
-extern "C" byte* get_hash_key(const byte *buff,uint *length,
+extern "C" uchar* get_hash_key(const uchar *buff, size_t *length,
my_bool not_used __attribute__((unused)))
{
udf_func *udf=(udf_func*) buff;
*length=(uint) udf->name.length;
- return (byte*) udf->name.str;
+ return (uchar*) udf->name.str;
}
@@ -137,7 +137,7 @@ void udf_init()
new_thd->store_globals();
new_thd->set_db(db, sizeof(db)-1);
- bzero((gptr) &tables,sizeof(tables));
+ bzero((uchar*) &tables,sizeof(tables));
tables.alias= tables.table_name= (char*) "func";
tables.lock_type = TL_READ;
tables.db= db;
@@ -260,7 +260,7 @@ static void del_udf(udf_func *udf)
DBUG_ENTER("del_udf");
if (!--udf->usage_count)
{
- hash_delete(&udf_hash,(byte*) udf);
+ hash_delete(&udf_hash,(uchar*) udf);
using_udf_functions=udf_hash.records != 0;
}
else
@@ -274,7 +274,7 @@ static void del_udf(udf_func *udf)
uint name_length=udf->name.length;
udf->name.str=(char*) "*";
udf->name.length=1;
- hash_update(&udf_hash,(byte*) udf,(byte*) name,name_length);
+ hash_update(&udf_hash,(uchar*) udf,(uchar*) name,name_length);
}
DBUG_VOID_RETURN;
}
@@ -294,7 +294,7 @@ void free_udf(udf_func *udf)
We come here when someone has deleted the udf function
while another thread still was using the udf
*/
- hash_delete(&udf_hash,(byte*) udf);
+ hash_delete(&udf_hash,(uchar*) udf);
using_udf_functions=udf_hash.records != 0;
if (!find_udf_dl(udf->dl))
dlclose(udf->dlhandle);
@@ -320,7 +320,7 @@ udf_func *find_udf(const char *name,uint length,bool mark_used)
else
rw_rdlock(&THR_LOCK_udf); /* Called during parsing */
- if ((udf=(udf_func*) hash_search(&udf_hash,(byte*) name,
+ if ((udf=(udf_func*) hash_search(&udf_hash,(uchar*) name,
length ? length : (uint) strlen(name))))
{
if (!udf->dlhandle)
@@ -367,7 +367,7 @@ static udf_func *add_udf(LEX_STRING *name, Item_result ret, char *dl,
tmp->returns = ret;
tmp->type = type;
tmp->usage_count=1;
- if (my_hash_insert(&udf_hash,(byte*) tmp))
+ if (my_hash_insert(&udf_hash,(uchar*) tmp))
return 0;
using_udf_functions=1;
return tmp;
@@ -415,7 +415,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
thd->clear_current_stmt_binlog_row_based();
rw_wrlock(&THR_LOCK_udf);
- if ((hash_search(&udf_hash,(byte*) udf->name.str, udf->name.length)))
+ if ((hash_search(&udf_hash,(uchar*) udf->name.str, udf->name.length)))
{
my_error(ER_UDF_EXISTS, MYF(0), udf->name);
goto err;
@@ -519,7 +519,7 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
thd->clear_current_stmt_binlog_row_based();
rw_wrlock(&THR_LOCK_udf);
- if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name->str,
+ if (!(udf=(udf_func*) hash_search(&udf_hash,(uchar*) udf_name->str,
(uint) udf_name->length)))
{
my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), udf_name->str);
@@ -543,7 +543,7 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
table->use_all_columns();
table->field[0]->store(exact_name_str, exact_name_len, &my_charset_bin);
if (!table->file->index_read_idx(table->record[0], 0,
- (byte*) table->field[0]->ptr, HA_WHOLE_KEY,
+ (uchar*) table->field[0]->ptr, HA_WHOLE_KEY,
HA_READ_KEY_EXACT))
{
int error;
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 2a1db422058..0197b9a9abc 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -144,8 +144,8 @@ void
st_select_lex_unit::init_prepare_fake_select_lex(THD *thd_arg)
{
thd_arg->lex->current_select= fake_select_lex;
- fake_select_lex->table_list.link_in_list((byte *)&result_table_list,
- (byte **)
+ fake_select_lex->table_list.link_in_list((uchar *)&result_table_list,
+ (uchar **)
&result_table_list.next_local);
fake_select_lex->context.table_list= fake_select_lex->context.first_name_resolution_table=
fake_select_lex->get_table_list();
@@ -154,7 +154,7 @@ st_select_lex_unit::init_prepare_fake_select_lex(THD *thd_arg)
order=order->next)
{
(*order->item)->walk(&Item::change_context_processor, 0,
- (byte*) &fake_select_lex->context);
+ (uchar*) &fake_select_lex->context);
}
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 6c501562b1c..0ce8d7e9113 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -544,8 +544,8 @@ int mysql_update(THD *thd,
else
{
/* Non-batched update */
- error= table->file->ha_update_row((byte*) table->record[1],
- (byte*) table->record[0]);
+ error= table->file->ha_update_row(table->record[1],
+ table->record[0]);
}
if (!error)
{
@@ -1131,7 +1131,7 @@ int multi_update::prepare(List<Item> &not_used_values,
sizeof(*tl));
if (!tl)
DBUG_RETURN(1);
- update.link_in_list((byte*) tl, (byte**) &tl->next_local);
+ update.link_in_list((uchar*) tl, (uchar**) &tl->next_local);
tl->shared= table_count++;
table->no_keyread=1;
table->covering_keys.clear_all();
@@ -1536,7 +1536,7 @@ int multi_update::do_updates(bool from_send_error)
DBUG_RETURN(0);
for (cur_table= update_tables; cur_table; cur_table= cur_table->next_local)
{
- byte *ref_pos;
+ uchar *ref_pos;
bool can_compare_record;
table = cur_table->table;
@@ -1569,7 +1569,7 @@ int multi_update::do_updates(bool from_send_error)
bitmap_is_subset(table->write_set,
table->read_set));
- ref_pos= (byte*) tmp_table->field[0]->ptr;
+ ref_pos= tmp_table->field[0]->ptr;
for (;;)
{
if (thd->killed && trans_safe)
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 9dc7d2100d6..a8816d611c5 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -754,7 +754,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
TODO: read dependence list, too, to process cascade/restrict
TODO: special cascade/restrict procedure for alter?
*/
- if (parser->parse((gptr)view, thd->mem_root,
+ if (parser->parse((uchar*)view, thd->mem_root,
view_parameters + revision_number_position, 1,
&file_parser_dummy_hook))
{
@@ -846,7 +846,7 @@ loop_out:
}
if (sql_create_definition_file(&dir, &file, view_file_type,
- (gptr)view, view_parameters, num_view_backups))
+ (uchar*)view, view_parameters, num_view_backups))
{
DBUG_RETURN(thd->net.report_error? -1 : 1);
}
@@ -945,7 +945,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
TODO: when VIEWs will be stored in cache, table mem_root should
be used here
*/
- if (parser->parse((gptr)table, thd->mem_root, view_parameters,
+ if (parser->parse((uchar*)table, thd->mem_root, view_parameters,
required_view_parameters, &file_parser_dummy_hook))
goto err;
@@ -1484,7 +1484,7 @@ frm_type_enum mysql_frm_type(THD *thd, char *path, enum legacy_db_type *dbt)
if ((file= my_open(path, O_RDONLY | O_SHARE, MYF(0))) < 0)
DBUG_RETURN(FRMTYPE_ERROR);
- error= my_read(file, (byte*) header, sizeof(header), MYF(MY_WME | MY_NABP));
+ error= my_read(file, (uchar*) header, sizeof(header), MYF(MY_WME | MY_NABP));
my_close(file, MYF(MY_WME));
if (error)
@@ -1747,7 +1747,7 @@ mysql_rename_view(THD *thd,
view_def.view_suid= TRUE;
/* get view definition and source */
- if (parser->parse((gptr)&view_def, thd->mem_root, view_parameters,
+ if (parser->parse((uchar*)&view_def, thd->mem_root, view_parameters,
array_elements(view_parameters)-1,
&file_parser_dummy_hook))
goto err;
@@ -1769,7 +1769,7 @@ mysql_rename_view(THD *thd,
file.length= pathstr.length - dir.length;
if (sql_create_definition_file(&dir, &file, view_file_type,
- (gptr)&view_def, view_parameters,
+ (uchar*)&view_def, view_parameters,
num_view_backups))
{
/* restore renamed view in case of error */
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 87cd33117dc..d46eeb985c9 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -4328,10 +4328,10 @@ create_table_option:
lex->create_info.merge_list= lex->select_lex.table_list;
lex->create_info.merge_list.elements--;
lex->create_info.merge_list.first=
- (byte*) (table_list->next_local);
+ (uchar*) (table_list->next_local);
lex->select_lex.table_list.elements=1;
lex->select_lex.table_list.next=
- (byte**) &(table_list->next_local);
+ (uchar**) &(table_list->next_local);
table_list->next_local= 0;
lex->create_info.used_fields|= HA_CREATE_USED_UNION;
}
@@ -5558,10 +5558,10 @@ alter_list_item:
{
THD *thd= YYTHD;
LEX *lex= thd->lex;
- uint dummy;
+ size_t dummy;
lex->select_lex.db=$3->db.str;
if (lex->select_lex.db == NULL &&
- thd->copy_db_to(&lex->select_lex.db, &dummy))
+ thd->copy_db_to(&lex->select_lex.db, &dummy))
{
MYSQL_YYABORT;
}
@@ -7961,7 +7961,7 @@ procedure_clause:
}
lex->proc_list.elements=0;
lex->proc_list.first=0;
- lex->proc_list.next= (byte**) &lex->proc_list.first;
+ lex->proc_list.next= (uchar**) &lex->proc_list.first;
if (add_proc_to_list(lex->thd, new Item_field(&lex->
current_select->
context,
@@ -9518,8 +9518,9 @@ simple_ident_q:
Let us add this item to list of all Item_trigger_field objects
in trigger.
*/
- lex->trg_table_fields.link_in_list((byte *)trg_fld,
- (byte**)&trg_fld->next_trg_field);
+ lex->trg_table_fields.link_in_list((uchar*) trg_fld,
+ (uchar**) &trg_fld->
+ next_trg_field);
$$= (Item *)trg_fld;
}
@@ -10142,7 +10143,8 @@ option_type_value:
else
qbuff.length= lex->tok_end - sp->m_tmp_query;
- if (!(qbuff.str= alloc_root(YYTHD->mem_root, qbuff.length + 5)))
+ if (!(qbuff.str= (char*) alloc_root(YYTHD->mem_root,
+ qbuff.length + 5)))
MYSQL_YYABORT;
strmake(strmake(qbuff.str, "SET ", 4), sp->m_tmp_query,
@@ -10228,8 +10230,9 @@ sys_option_value:
Let us add this item to list of all Item_trigger_field
objects in trigger.
*/
- lex->trg_table_fields.link_in_list((byte *)trg_fld,
- (byte **)&trg_fld->next_trg_field);
+ lex->trg_table_fields.link_in_list((uchar *)trg_fld,
+ (uchar **) &trg_fld->
+ next_trg_field);
lex->sphead->add_instr(sp_fld);
}
@@ -10802,7 +10805,7 @@ grant_ident:
{
THD *thd= YYTHD;
LEX *lex= thd->lex;
- uint dummy;
+ size_t dummy;
if (thd->copy_db_to(&lex->current_select->db, &dummy))
MYSQL_YYABORT;
if (lex->grant == GLOBAL_ACLS)
diff --git a/sql/stacktrace.c b/sql/stacktrace.c
index 078f62c6b2b..36e64087c5e 100644
--- a/sql/stacktrace.c
+++ b/sql/stacktrace.c
@@ -94,7 +94,7 @@ inline uint32* find_prev_pc(uint32* pc, uchar** fp)
#endif /* defined(__alpha__) && defined(__GNUC__) */
-void print_stacktrace(gptr stack_bottom, ulong thread_stack)
+void print_stacktrace(uchar* stack_bottom, ulong thread_stack)
{
uchar** fp;
uint frame_count = 0, sigreturn_frame_count;
@@ -129,11 +129,11 @@ terribly wrong...\n");
return;
}
- if (!stack_bottom || (gptr) stack_bottom > (gptr) &fp)
+ if (!stack_bottom || (uchar*) stack_bottom > (uchar*) &fp)
{
ulong tmp= min(0x10000,thread_stack);
/* Assume that the stack starts at the previous even 65K */
- stack_bottom= (gptr) (((ulong) &fp + tmp) &
+ stack_bottom= (uchar*) (((ulong) &fp + tmp) &
~(ulong) 0xFFFF);
fprintf(stderr, "Cannot determine thread, fp=%p, backtrace may not be correct.\n", fp);
}
diff --git a/sql/stacktrace.h b/sql/stacktrace.h
index 56b9877180a..1a0b80c88d3 100644
--- a/sql/stacktrace.h
+++ b/sql/stacktrace.h
@@ -28,7 +28,7 @@ extern char* heap_start;
#define init_stacktrace() do { \
heap_start = (char*) &__bss_start; \
} while(0);
-void print_stacktrace(gptr stack_bottom, ulong thread_stack);
+void print_stacktrace(uchar* stack_bottom, ulong thread_stack);
void safe_print_str(const char* name, const char* val, int max_len);
#endif /* (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) */
#endif /* TARGET_OS_LINUX */
diff --git a/sql/structs.h b/sql/structs.h
index 4cf9379d2bb..22d08e51961 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -28,8 +28,8 @@ typedef struct st_date_time_format {
typedef struct st_keyfile_info { /* used with ha_info() */
- byte ref[MAX_REFLENGTH]; /* Pointer to current row */
- byte dupp_ref[MAX_REFLENGTH]; /* Pointer to dupp row */
+ uchar ref[MAX_REFLENGTH]; /* Pointer to current row */
+ uchar dupp_ref[MAX_REFLENGTH]; /* Pointer to dupp row */
uint ref_length; /* Length of ref (1-8) */
uint block_size; /* index block size */
File filenr; /* (uniq) filenr for table */
@@ -126,10 +126,10 @@ typedef struct st_read_record { /* Parameter to read_record */
uint cache_records;
uint ref_length,struct_length,reclength,rec_cache_size,error_offset;
uint index;
- byte *ref_pos; /* pointer to form->refpos */
- byte *record;
- byte *rec_buf; /* to read field values after filesort */
- byte *cache,*cache_pos,*cache_end,*read_positions;
+ uchar *ref_pos; /* pointer to form->refpos */
+ uchar *record;
+ uchar *rec_buf; /* to read field values after filesort */
+ uchar *cache,*cache_pos,*cache_end,*read_positions;
IO_CACHE *io_cache;
bool print_error, ignore_not_found_rows;
} READ_RECORD;
diff --git a/sql/table.cc b/sql/table.cc
index 9be98eb14b9..e0690107f4e 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -29,16 +29,16 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share,
uchar *head, File file);
static void fix_type_pointers(const char ***array, TYPELIB *point_to_type,
uint types, char **names);
-static uint find_field(Field **fields, byte *record, uint start, uint length);
+static uint find_field(Field **fields, uchar *record, uint start, uint length);
/* Get column name from column hash */
-static byte *get_field_name(Field **buff, uint *length,
- my_bool not_used __attribute__((unused)))
+static uchar *get_field_name(Field **buff, size_t *length,
+ my_bool not_used __attribute__((unused)))
{
*length= (uint) strlen((*buff)->field_name);
- return (byte*) (*buff)->field_name;
+ return (uchar*) (*buff)->field_name;
}
@@ -370,7 +370,7 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags)
}
error= 4;
- if (my_read(file,(byte*) head, 64, MYF(MY_NABP)))
+ if (my_read(file, head, 64, MYF(MY_NABP)))
goto err;
if (head[0] == (uchar) 254 && head[1] == 1)
@@ -460,7 +460,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
uint extra_rec_buf_length;
uint i,j;
bool use_hash;
- char *keynames, *record, *names, *comment_pos;
+ char *keynames, *names, *comment_pos;
+ uchar *record;
uchar *disk_buff, *strpos, *null_flags, *null_pos;
ulong pos, record_offset, *rec_per_key, rec_buff_length;
handler *handler_file= 0;
@@ -537,7 +538,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
/* Read keyinformation */
key_info_length= (uint) uint2korr(head+28);
VOID(my_seek(file,(ulong) uint2korr(head+6),MY_SEEK_SET,MYF(0)));
- if (read_string(file,(gptr*) &disk_buff,key_info_length))
+ if (read_string(file,(uchar**) &disk_buff,key_info_length))
goto err; /* purecov: inspected */
if (disk_buff[0] & 0x80)
{
@@ -636,19 +637,21 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if ((n_length= uint4korr(head+55)))
{
/* Read extra data segment */
- char *buff, *next_chunk, *buff_end;
+ uchar *buff, *next_chunk, *buff_end;
DBUG_PRINT("info", ("extra segment size is %u bytes", n_length));
- if (!(next_chunk= buff= my_malloc(n_length, MYF(MY_WME))))
+ if (!(next_chunk= buff= (uchar*) my_malloc(n_length, MYF(MY_WME))))
goto err;
- if (my_pread(file, (byte*)buff, n_length, record_offset + share->reclength,
+ if (my_pread(file, buff, n_length, record_offset + share->reclength,
MYF(MY_NABP)))
{
my_free(buff, MYF(0));
goto err;
}
share->connect_string.length= uint2korr(buff);
- if (! (share->connect_string.str= strmake_root(&share->mem_root,
- next_chunk + 2, share->connect_string.length)))
+ if (!(share->connect_string.str= strmake_root(&share->mem_root,
+ (char*) next_chunk + 2,
+ share->connect_string.
+ length)))
{
my_free(buff, MYF(0));
goto err;
@@ -658,8 +661,13 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (next_chunk + 2 < buff_end)
{
uint str_db_type_length= uint2korr(next_chunk);
- LEX_STRING name= { next_chunk + 2, str_db_type_length };
- handlerton *tmp_db_type= ha_resolve_by_name(thd, &name);
+ LEX_STRING name;
+ handlerton *tmp_db_type;
+
+ name.str= (char*) next_chunk + 2;
+ name.length= str_db_type_length;
+ tmp_db_type= ha_resolve_by_name(thd, &name);
+
if (tmp_db_type != NULL)
{
share->db_type= tmp_db_type;
@@ -670,7 +678,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
#ifdef WITH_PARTITION_STORAGE_ENGINE
else
{
- if (!strncmp(next_chunk + 2, "partition", str_db_type_length))
+ if (!strncmp((char*) next_chunk + 2, "partition", str_db_type_length))
{
/* Use partition handler */
share->db_type= partition_hton;
@@ -688,7 +696,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
#ifdef WITH_PARTITION_STORAGE_ENGINE
if ((share->partition_info_len= partition_info_len))
{
- if (!(share->partition_info=
+ if (!(share->partition_info= (char*)
memdup_root(&share->mem_root, next_chunk + 4,
partition_info_len + 1)))
{
@@ -740,8 +748,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
my_free(buff, MYF(0));
goto err;
}
- parser_name.str= next_chunk;
- parser_name.length= strlen(next_chunk);
+ parser_name.str= (char*) next_chunk;
+ parser_name.length= strlen((char*) next_chunk);
keyinfo->parser= plugin_lock(&parser_name, MYSQL_FTPARSER_PLUGIN);
if (! keyinfo->parser)
{
@@ -759,16 +767,16 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
extra_rec_buf_length= uint2korr(head+59);
rec_buff_length= ALIGN_SIZE(share->reclength + 1 + extra_rec_buf_length);
share->rec_buff_length= rec_buff_length;
- if (!(record= (char *) alloc_root(&share->mem_root,
- rec_buff_length)))
+ if (!(record= (uchar *) alloc_root(&share->mem_root,
+ rec_buff_length)))
goto err; /* purecov: inspected */
- share->default_values= (byte *) record;
- if (my_pread(file,(byte*) record, (uint) share->reclength,
+ share->default_values= record;
+ if (my_pread(file, record, (size_t) share->reclength,
record_offset, MYF(MY_NABP)))
goto err; /* purecov: inspected */
VOID(my_seek(file,pos,MY_SEEK_SET,MYF(0)));
- if (my_read(file,(byte*) head,288,MYF(MY_NABP)))
+ if (my_read(file, head,288,MYF(MY_NABP)))
goto err;
#ifdef HAVE_CRYPTED_FRM
if (crypted)
@@ -798,14 +806,14 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
(uint) ((share->fields+1)*sizeof(Field*)+
interval_count*sizeof(TYPELIB)+
(share->fields+interval_parts+
- keys+3)*sizeof(my_string)+
+ keys+3)*sizeof(char *)+
(n_length+int_length+com_length)))))
goto err; /* purecov: inspected */
share->field= field_ptr;
read_length=(uint) (share->fields * field_pack_length +
pos+ (uint) (n_length+int_length+com_length));
- if (read_string(file,(gptr*) &disk_buff,read_length))
+ if (read_string(file,(uchar**) &disk_buff,read_length))
goto err; /* purecov: inspected */
#ifdef HAVE_CRYPTED_FRM
if (crypted)
@@ -861,7 +869,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
share->db_type)))
goto err;
- record= (char*) share->default_values-1; /* Fieldstart = 1 */
+ record= share->default_values-1; /* Fieldstart = 1 */
if (share->null_field_first)
{
null_flags= null_pos= (uchar*) record+1;
@@ -1055,7 +1063,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (use_hash)
(void) my_hash_insert(&share->name_hash,
- (byte*) field_ptr); // never fail
+ (uchar*) field_ptr); // never fail
}
*field_ptr=0; // End marker
@@ -1114,7 +1122,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
key_part->type= field->key_type();
if (field->null_ptr)
{
- key_part->null_offset=(uint) ((byte*) field->null_ptr -
+ key_part->null_offset=(uint) ((uchar*) field->null_ptr -
share->default_values);
key_part->null_bit= field->null_bit;
key_part->store_length+=HA_KEY_NULL_LENGTH;
@@ -1255,7 +1263,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
}
else
share->primary_key= MAX_KEY;
- x_free((gptr) disk_buff);
+ x_free((uchar*) disk_buff);
disk_buff=0;
if (new_field_pack_flag <= 1)
{
@@ -1327,7 +1335,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
share->error= error;
share->open_errno= my_errno;
share->errarg= errarg;
- x_free((gptr) disk_buff);
+ x_free((uchar*) disk_buff);
delete crypted;
delete handler_file;
hash_free(&share->name_hash);
@@ -1369,7 +1377,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
int error;
uint records, i, bitmap_size;
bool error_reported= FALSE;
- byte *record, *bitmaps;
+ uchar *record, *bitmaps;
Field **field_ptr;
DBUG_ENTER("open_table_from_share");
DBUG_PRINT("enter",("name: '%s.%s' form: 0x%lx", share->db.str,
@@ -1404,7 +1412,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
if (prgflag & (READ_ALL+EXTRA_RECORD))
records++;
- if (!(record= (byte*) alloc_root(&outparam->mem_root,
+ if (!(record= (uchar*) alloc_root(&outparam->mem_root,
share->rec_buff_length * records)))
goto err; /* purecov: inspected */
@@ -1444,7 +1452,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
outparam->field= field_ptr;
- record= (byte*) outparam->record[0]-1; /* Fieldstart = 1 */
+ record= (uchar*) outparam->record[0]-1; /* Fieldstart = 1 */
if (share->null_field_first)
outparam->null_flags= (uchar*) record+1;
else
@@ -1566,7 +1574,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
/* Allocate bitmaps */
bitmap_size= share->column_bitmap_size;
- if (!(bitmaps= (byte*) alloc_root(&outparam->mem_root, bitmap_size*3)))
+ if (!(bitmaps= (uchar*) alloc_root(&outparam->mem_root, bitmap_size*3)))
goto err;
bitmap_init(&outparam->def_read_set,
(my_bitmap_map*) bitmaps, share->fields, FALSE);
@@ -1733,7 +1741,7 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names)
DBUG_ENTER("get_form_pos");
names=uint2korr(head+8);
- a_length=(names+2)*sizeof(my_string); /* Room for two extra */
+ a_length=(names+2)*sizeof(char *); /* Room for two extra */
if (!save_names)
a_length=0;
@@ -1744,12 +1752,12 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names)
{
length=uint2korr(head+4);
VOID(my_seek(file,64L,MY_SEEK_SET,MYF(0)));
- if (!(buf= (uchar*) my_malloc((uint) length+a_length+names*4,
+ if (!(buf= (uchar*) my_malloc((size_t) length+a_length+names*4,
MYF(MY_WME))) ||
- my_read(file,(byte*) buf+a_length,(uint) (length+names*4),
+ my_read(file, buf+a_length, (size_t) (length+names*4),
MYF(MY_NABP)))
{ /* purecov: inspected */
- x_free((gptr) buf); /* purecov: inspected */
+ x_free((uchar*) buf); /* purecov: inspected */
DBUG_RETURN(0L); /* purecov: inspected */
}
pos= buf+a_length+length;
@@ -1758,7 +1766,7 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names)
if (! save_names)
{
if (names)
- my_free((gptr) buf,MYF(0));
+ my_free((uchar*) buf,MYF(0));
}
else if (!names)
bzero((char*) save_names,sizeof(save_names));
@@ -1772,19 +1780,24 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names)
}
- /* Read string from a file with malloc */
+/*
+ Read string from a file with malloc
-int read_string(File file, gptr *to, uint length)
+ NOTES:
+ We add an \0 at end of the read string to make reading of C strings easier
+*/
+
+int read_string(File file, uchar**to, size_t length)
{
DBUG_ENTER("read_string");
- x_free((gptr) *to);
- if (!(*to= (gptr) my_malloc(length+1,MYF(MY_WME))) ||
- my_read(file,(byte*) *to,length,MYF(MY_NABP)))
+ x_free(*to);
+ if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) ||
+ my_read(file, *to, length,MYF(MY_NABP)))
{
- x_free((gptr) *to); /* purecov: inspected */
- *to= 0; /* purecov: inspected */
- DBUG_RETURN(1); /* purecov: inspected */
+ x_free(*to); /* purecov: inspected */
+ *to= 0; /* purecov: inspected */
+ DBUG_RETURN(1); /* purecov: inspected */
}
*((char*) *to+length)= '\0';
DBUG_RETURN (0);
@@ -1798,7 +1811,7 @@ ulong make_new_entry(File file, uchar *fileinfo, TYPELIB *formnames,
{
uint i,bufflength,maxlength,n_length,length,names;
ulong endpos,newpos;
- char buff[IO_SIZE];
+ uchar buff[IO_SIZE];
uchar *pos;
DBUG_ENTER("make_new_entry");
@@ -1818,17 +1831,17 @@ ulong make_new_entry(File file, uchar *fileinfo, TYPELIB *formnames,
while (endpos > maxlength)
{
VOID(my_seek(file,(ulong) (endpos-bufflength),MY_SEEK_SET,MYF(0)));
- if (my_read(file,(byte*) buff,bufflength,MYF(MY_NABP+MY_WME)))
+ if (my_read(file, buff, bufflength, MYF(MY_NABP+MY_WME)))
DBUG_RETURN(0L);
VOID(my_seek(file,(ulong) (endpos-bufflength+IO_SIZE),MY_SEEK_SET,
MYF(0)));
- if ((my_write(file,(byte*) buff,bufflength,MYF(MY_NABP+MY_WME))))
+ if ((my_write(file, buff,bufflength,MYF(MY_NABP+MY_WME))))
DBUG_RETURN(0);
endpos-=bufflength; bufflength=IO_SIZE;
}
bzero(buff,IO_SIZE); /* Null new block */
VOID(my_seek(file,(ulong) maxlength,MY_SEEK_SET,MYF(0)));
- if (my_write(file,(byte*) buff,bufflength,MYF(MY_NABP+MY_WME)))
+ if (my_write(file,buff,bufflength,MYF(MY_NABP+MY_WME)))
DBUG_RETURN(0L);
maxlength+=IO_SIZE; /* Fix old ref */
int2store(fileinfo+6,maxlength);
@@ -1843,15 +1856,15 @@ ulong make_new_entry(File file, uchar *fileinfo, TYPELIB *formnames,
if (n_length == 1 )
{ /* First name */
length++;
- VOID(strxmov(buff,"/",newname,"/",NullS));
+ VOID(strxmov((char*) buff,"/",newname,"/",NullS));
}
else
- VOID(strxmov(buff,newname,"/",NullS)); /* purecov: inspected */
+ VOID(strxmov((char*) buff,newname,"/",NullS)); /* purecov: inspected */
VOID(my_seek(file,63L+(ulong) n_length,MY_SEEK_SET,MYF(0)));
- if (my_write(file,(byte*) buff,(uint) length+1,MYF(MY_NABP+MY_WME)) ||
- (names && my_write(file,(byte*) (*formnames->type_names+n_length-1),
+ if (my_write(file, buff, (size_t) length+1,MYF(MY_NABP+MY_WME)) ||
+ (names && my_write(file,(uchar*) (*formnames->type_names+n_length-1),
names*4, MYF(MY_NABP+MY_WME))) ||
- my_write(file,(byte*) fileinfo+10,(uint) 4,MYF(MY_NABP+MY_WME)))
+ my_write(file, fileinfo+10, 4,MYF(MY_NABP+MY_WME)))
DBUG_RETURN(0L); /* purecov: inspected */
int2store(fileinfo+8,names+1);
@@ -2011,7 +2024,7 @@ TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings)
# field number +1
*/
-static uint find_field(Field **fields, byte *record, uint start, uint length)
+static uint find_field(Field **fields, uchar *record, uint start, uint length)
{
Field **field;
uint i, pos;
@@ -2124,7 +2137,7 @@ File create_frm(THD *thd, const char *name, const char *db,
{
register File file;
ulong length;
- char fill[IO_SIZE];
+ uchar fill[IO_SIZE];
int create_flags= O_RDWR | O_TRUNC;
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
@@ -2187,7 +2200,7 @@ File create_frm(THD *thd, const char *name, const char *db,
bzero(fill,IO_SIZE);
for (; length > IO_SIZE ; length-= IO_SIZE)
{
- if (my_write(file,(byte*) fill,IO_SIZE,MYF(MY_WME | MY_NABP)))
+ if (my_write(file,fill, IO_SIZE, MYF(MY_WME | MY_NABP)))
{
VOID(my_close(file,MYF(0)));
VOID(my_delete(name,MYF(0)));
@@ -2298,7 +2311,7 @@ char *get_field(MEM_ROOT *mem, Field *field)
given a buffer with a key value, and a map of keyparts
that are present in this value, returns the length of the value
*/
-uint calculate_key_len(TABLE *table, uint key, const byte *buf,
+uint calculate_key_len(TABLE *table, uint key, const uchar *buf,
key_part_map keypart_map)
{
/* works only with key prefixes */
@@ -2743,7 +2756,7 @@ bool st_table_list::setup_underlying(THD *thd)
List_iterator_fast<Item> it(select->item_list);
uint field_count= 0;
- if (check_stack_overrun(thd, STACK_MIN_SIZE, (char *)&field_count))
+ if (check_stack_overrun(thd, STACK_MIN_SIZE, (uchar*) &field_count))
{
DBUG_RETURN(TRUE);
}
@@ -3118,7 +3131,7 @@ bool st_table_list::set_insert_values(MEM_ROOT *mem_root)
if (table)
{
if (!table->insert_values &&
- !(table->insert_values= (byte *)alloc_root(mem_root,
+ !(table->insert_values= (uchar *)alloc_root(mem_root,
table->s->rec_buff_length)))
return TRUE;
}
@@ -4371,6 +4384,24 @@ bool st_table_list::process_index_hints(TABLE *table)
return 0;
}
+
+size_t max_row_length(TABLE *table, const uchar *data)
+{
+ TABLE_SHARE *table_s= table->s;
+ size_t length= table_s->reclength + 2 * table_s->fields;
+ uint *const beg= table_s->blob_field;
+ uint *const end= beg + table_s->blob_fields;
+
+ for (uint *ptr= beg ; ptr != end ; ++ptr)
+ {
+ Field_blob* const blob= (Field_blob*) table->field[*ptr];
+ length+= blob->get_length((const uchar*)
+ (data + blob->offset(table->record[0]))) +
+ HA_KEY_BLOB_LENGTH;
+ }
+ return length;
+}
+
/*****************************************************************************
** Instansiate templates
*****************************************************************************/
diff --git a/sql/table.h b/sql/table.h
index 5b6aa2a8a7c..f3fc33c2719 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -73,16 +73,16 @@ enum release_type { RELEASE_NORMAL, RELEASE_WAIT_FOR_DROP };
typedef struct st_filesort_info
{
- IO_CACHE *io_cache; /* If sorted through filebyte */
- uchar **sort_keys; /* Buffer for sorting keys */
- byte *buffpek; /* Buffer for buffpek structures */
- uint buffpek_len; /* Max number of buffpeks in the buffer */
- byte *addon_buf; /* Pointer to a buffer if sorted with fields */
- uint addon_length; /* Length of the buffer */
+ IO_CACHE *io_cache; /* If sorted through filesort */
+ uchar **sort_keys; /* Buffer for sorting keys */
+ uchar *buffpek; /* Buffer for buffpek structures */
+ uint buffpek_len; /* Max number of buffpeks in the buffer */
+ uchar *addon_buf; /* Pointer to a buffer if sorted with fields */
+ size_t addon_length; /* Length of the buffer */
struct st_sort_addon_field *addon_field; /* Pointer to the fields info */
- void (*unpack)(struct st_sort_addon_field *, byte *); /* To unpack back */
- byte *record_pointers; /* If sorted in memory */
- ha_rows found_records; /* How many records in sort */
+ void (*unpack)(struct st_sort_addon_field *, uchar *); /* To unpack back */
+ uchar *record_pointers; /* If sorted in memory */
+ ha_rows found_records; /* How many records in sort */
} FILESORT_INFO;
@@ -137,7 +137,7 @@ typedef struct st_table_share
KEY *key_info; /* data of keys in database */
uint *blob_field; /* Index to blobs in Field arrray*/
- byte *default_values; /* row with default values */
+ uchar *default_values; /* row with default values */
LEX_STRING comment; /* Comment about table */
CHARSET_INFO *table_charset; /* Default charset of string fields */
@@ -321,10 +321,10 @@ struct st_table {
THD *in_use; /* Which thread uses this */
Field **field; /* Pointer to fields */
- byte *record[2]; /* Pointer to records */
- byte *write_row_record; /* Used as optimisation in
+ uchar *record[2]; /* Pointer to records */
+ uchar *write_row_record; /* Used as optimisation in
THD::write_row */
- byte *insert_values; /* used by INSERT ... UPDATE */
+ uchar *insert_values; /* used by INSERT ... UPDATE */
/*
Map of keys that can be used to retrieve all data from this table
needed by the query without reading the row.
@@ -422,12 +422,14 @@ struct st_table {
/*
If true, the current table row is considered to have all columns set to
NULL, including columns declared as "not null" (see maybe_null).
+ */
+ my_bool null_row;
- TODO: Each of these flags take up 8 bits. They can just as easily
+ /*
+ TODO: Each of the following flags take up 8 bits. They can just as easily
be put into one single unsigned long and instead of taking up 18
bytes, it would take up 4.
*/
- my_bool null_row;
my_bool force_index;
my_bool distinct,const_table,no_rows;
my_bool key_read, no_keyread;
@@ -857,8 +859,8 @@ typedef struct st_table_list
thr_lock_type lock_type;
uint outer_join; /* Which join type */
uint shared; /* Used in multi-upd */
- uint db_length;
- uint32 table_name_length;
+ size_t db_length;
+ size_t table_name_length;
bool updatable; /* VIEW/TABLE can be updated now */
bool straight; /* optimize with prev table */
bool updating; /* for replicate-do/ignore table */
@@ -1152,3 +1154,6 @@ static inline void dbug_tmp_restore_column_map(MY_BITMAP *bitmap,
tmp_restore_column_map(bitmap, old);
#endif
}
+
+size_t max_row_length(TABLE *table, const uchar *data);
+
diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc
index 392db9224c3..ddf35002880 100644
--- a/sql/thr_malloc.cc
+++ b/sql/thr_malloc.cc
@@ -35,26 +35,25 @@ void init_sql_alloc(MEM_ROOT *mem_root, uint block_size, uint pre_alloc)
}
-gptr sql_alloc(uint Size)
+void *sql_alloc(size_t Size)
{
MEM_ROOT *root= *my_pthread_getspecific_ptr(MEM_ROOT**,THR_MALLOC);
- char *ptr= (char*) alloc_root(root,Size);
- return ptr;
+ return alloc_root(root,Size);
}
-gptr sql_calloc(uint size)
+void *sql_calloc(size_t size)
{
- gptr ptr;
+ void *ptr;
if ((ptr=sql_alloc(size)))
- bzero((char*) ptr,size);
+ bzero(ptr,size);
return ptr;
}
char *sql_strdup(const char *str)
{
- uint len=(uint) strlen(str)+1;
+ size_t len= strlen(str)+1;
char *pos;
if ((pos= (char*) sql_alloc(len)))
memcpy(pos,str,len);
@@ -62,7 +61,7 @@ char *sql_strdup(const char *str)
}
-char *sql_strmake(const char *str,uint len)
+char *sql_strmake(const char *str, size_t len)
{
char *pos;
if ((pos= (char*) sql_alloc(len+1)))
@@ -74,10 +73,10 @@ char *sql_strmake(const char *str,uint len)
}
-gptr sql_memdup(const void *ptr,uint len)
+void* sql_memdup(const void *ptr, size_t len)
{
- char *pos;
- if ((pos= (char*) sql_alloc(len)))
+ void *pos;
+ if ((pos= sql_alloc(len)))
memcpy(pos,ptr,len);
return pos;
}
@@ -87,17 +86,17 @@ void sql_element_free(void *ptr __attribute__((unused)))
-char *sql_strmake_with_convert(const char *str, uint32 arg_length,
+char *sql_strmake_with_convert(const char *str, size_t arg_length,
CHARSET_INFO *from_cs,
- uint32 max_res_length,
- CHARSET_INFO *to_cs, uint32 *result_length)
+ size_t max_res_length,
+ CHARSET_INFO *to_cs, size_t *result_length)
{
char *pos;
- uint32 new_length= to_cs->mbmaxlen*arg_length;
+ size_t new_length= to_cs->mbmaxlen*arg_length;
max_res_length--; // Reserve place for end null
set_if_smaller(new_length, max_res_length);
- if (!(pos= sql_alloc(new_length+1)))
+ if (!(pos= (char*) sql_alloc(new_length+1)))
return pos; // Error
if ((from_cs == &my_charset_bin) || (to_cs == &my_charset_bin))
diff --git a/sql/tzfile.h b/sql/tzfile.h
index 1a57c0c5f69..1ff82d62329 100644
--- a/sql/tzfile.h
+++ b/sql/tzfile.h
@@ -34,14 +34,14 @@
#define TZ_MAGIC "TZif"
struct tzhead {
- char tzh_magic[4]; /* TZ_MAGIC */
- char tzh_reserved[16]; /* reserved for future use */
- char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
- char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
- char tzh_leapcnt[4]; /* coded number of leap seconds */
- char tzh_timecnt[4]; /* coded number of transition times */
- char tzh_typecnt[4]; /* coded number of local time types */
- char tzh_charcnt[4]; /* coded number of abbr. chars */
+ uchar tzh_magic[4]; /* TZ_MAGIC */
+ uchar tzh_reserved[16]; /* reserved for future use */
+ uchar tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
+ uchar tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
+ uchar tzh_leapcnt[4]; /* coded number of leap seconds */
+ uchar tzh_timecnt[4]; /* coded number of transition times */
+ uchar tzh_typecnt[4]; /* coded number of local time types */
+ uchar tzh_charcnt[4]; /* coded number of abbr. chars */
};
/*
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 08b93cfd203..0c717dd2ece 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -153,7 +153,7 @@ static my_bool prepare_tz_info(TIME_ZONE_INFO *sp, MEM_ROOT *storage);
static my_bool
tz_load(const char *name, TIME_ZONE_INFO *sp, MEM_ROOT *storage)
{
- char *p;
+ uchar *p;
int read_from_file;
uint i;
FILE *file;
@@ -164,8 +164,8 @@ tz_load(const char *name, TIME_ZONE_INFO *sp, MEM_ROOT *storage)
union
{
struct tzhead tzhead;
- char buf[sizeof(struct tzhead) + sizeof(my_time_t) * TZ_MAX_TIMES +
- TZ_MAX_TIMES + sizeof(TRAN_TYPE_INFO) * TZ_MAX_TYPES +
+ uchar buf[sizeof(struct tzhead) + sizeof(my_time_t) * TZ_MAX_TIMES +
+ TZ_MAX_TIMES + sizeof(TRAN_TYPE_INFO) * TZ_MAX_TYPES +
#ifdef ABBR_ARE_USED
max(TZ_MAX_CHARS + 1, (2 * (MY_TZNAME_MAX + 1))) +
#endif
@@ -189,7 +189,7 @@ tz_load(const char *name, TIME_ZONE_INFO *sp, MEM_ROOT *storage)
sp->timecnt= int4net(u.tzhead.tzh_timecnt);
sp->typecnt= int4net(u.tzhead.tzh_typecnt);
sp->charcnt= int4net(u.tzhead.tzh_charcnt);
- p= u.tzhead.tzh_charcnt + sizeof u.tzhead.tzh_charcnt;
+ p= u.tzhead.tzh_charcnt + sizeof(u.tzhead.tzh_charcnt);
if (sp->leapcnt > TZ_MAX_LEAPS ||
sp->typecnt == 0 || sp->typecnt > TZ_MAX_TYPES ||
sp->timecnt > TZ_MAX_TIMES ||
@@ -1489,18 +1489,21 @@ public:
they should obey C calling conventions.
*/
-extern "C" byte* my_tz_names_get_key(Tz_names_entry *entry, uint *length,
- my_bool not_used __attribute__((unused)))
+extern "C" uchar *
+my_tz_names_get_key(Tz_names_entry *entry, size_t *length,
+ my_bool not_used __attribute__((unused)))
{
*length= entry->name.length();
- return (byte*) entry->name.ptr();
+ return (uchar*) entry->name.ptr();
}
-extern "C" byte* my_offset_tzs_get_key(Time_zone_offset *entry, uint *length,
- my_bool not_used __attribute__((unused)))
+extern "C" uchar *
+my_offset_tzs_get_key(Time_zone_offset *entry,
+ size_t *length,
+ my_bool not_used __attribute__((unused)))
{
*length= sizeof(long);
- return (byte*) &entry->offset;
+ return (uchar*) &entry->offset;
}
@@ -1586,7 +1589,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
/* Init all memory structures that require explicit destruction */
if (hash_init(&tz_names, &my_charset_latin1, 20,
- 0, 0, (hash_get_key)my_tz_names_get_key, 0, 0))
+ 0, 0, (hash_get_key) my_tz_names_get_key, 0, 0))
{
sql_print_error("Fatal error: OOM while initializing time zones");
goto end;
@@ -1610,7 +1613,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
}
tmp_tzname->name.set(STRING_WITH_LEN("SYSTEM"), &my_charset_latin1);
tmp_tzname->tz= my_tz_SYSTEM;
- if (my_hash_insert(&tz_names, (const byte *)tmp_tzname))
+ if (my_hash_insert(&tz_names, (const uchar *)tmp_tzname))
{
sql_print_error("Fatal error: OOM while initializing time zones");
goto end_with_cleanup;
@@ -1832,8 +1835,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
DBUG_ENTER("tz_load_from_open_tables");
/* Prepare tz_info for loading also let us make copy of time zone name */
- if (!(alloc_buff= alloc_root(&tz_storage, sizeof(TIME_ZONE_INFO) +
- tz_name->length() + 1)))
+ if (!(alloc_buff= (char*) alloc_root(&tz_storage, sizeof(TIME_ZONE_INFO) +
+ tz_name->length() + 1)))
{
sql_print_error("Out of memory while loading time zone description");
return 0;
@@ -1862,7 +1865,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
*/
(void)table->file->ha_index_init(0, 1);
- if (table->file->index_read(table->record[0], (byte*)table->field[0]->ptr,
+ if (table->file->index_read(table->record[0], table->field[0]->ptr,
HA_WHOLE_KEY, HA_READ_KEY_EXACT))
{
#ifdef EXTRA_DEBUG
@@ -1889,7 +1892,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
table->field[0]->store((longlong) tzid, TRUE);
(void)table->file->ha_index_init(0, 1);
- if (table->file->index_read(table->record[0], (byte*)table->field[0]->ptr,
+ if (table->file->index_read(table->record[0], table->field[0]->ptr,
HA_WHOLE_KEY, HA_READ_KEY_EXACT))
{
sql_print_error("Can't find description of time zone '%u'", tzid);
@@ -1916,7 +1919,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
table->field[0]->store((longlong) tzid, TRUE);
(void)table->file->ha_index_init(0, 1);
- res= table->file->index_read(table->record[0], (byte*)table->field[0]->ptr,
+ res= table->file->index_read(table->record[0], table->field[0]->ptr,
(key_part_map)1, HA_READ_KEY_EXACT);
while (!res)
{
@@ -1965,7 +1968,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
tz_info->typecnt= ttid + 1;
res= table->file->index_next_same(table->record[0],
- (byte*)table->field[0]->ptr, 4);
+ table->field[0]->ptr, 4);
}
if (res != HA_ERR_END_OF_FILE)
@@ -1987,7 +1990,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
table->field[0]->store((longlong) tzid, TRUE);
(void)table->file->ha_index_init(0, 1);
- res= table->file->index_read(table->record[0], (byte*)table->field[0]->ptr,
+ res= table->file->index_read(table->record[0], table->field[0]->ptr,
(key_part_map)1, HA_READ_KEY_EXACT);
while (!res)
{
@@ -2018,7 +2021,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
tzid, (ulong) ttime, ttid));
res= table->file->index_next_same(table->record[0],
- (byte*)table->field[0]->ptr, 4);
+ table->field[0]->ptr, 4);
}
/*
@@ -2038,21 +2041,21 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
/*
Now we will allocate memory and init TIME_ZONE_INFO structure.
*/
- if (!(alloc_buff= alloc_root(&tz_storage,
- ALIGN_SIZE(sizeof(my_time_t) *
- tz_info->timecnt) +
- ALIGN_SIZE(tz_info->timecnt) +
+ if (!(alloc_buff= (char*) alloc_root(&tz_storage,
+ ALIGN_SIZE(sizeof(my_time_t) *
+ tz_info->timecnt) +
+ ALIGN_SIZE(tz_info->timecnt) +
#ifdef ABBR_ARE_USED
- ALIGN_SIZE(tz_info->charcnt) +
+ ALIGN_SIZE(tz_info->charcnt) +
#endif
- sizeof(TRAN_TYPE_INFO) * tz_info->typecnt)))
+ sizeof(TRAN_TYPE_INFO) *
+ tz_info->typecnt)))
{
sql_print_error("Out of memory while loading time zone description");
goto end;
}
-
- tz_info->ats= (my_time_t *)alloc_buff;
+ tz_info->ats= (my_time_t *) alloc_buff;
memcpy(tz_info->ats, ats, tz_info->timecnt * sizeof(my_time_t));
alloc_buff+= ALIGN_SIZE(sizeof(my_time_t) * tz_info->timecnt);
tz_info->types= (uchar *)alloc_buff;
@@ -2087,7 +2090,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
&(tmp_tzname->name))) ||
(tmp_tzname->name.set(tz_name_buff, tz_name->length(),
&my_charset_latin1),
- my_hash_insert(&tz_names, (const byte *)tmp_tzname)))
+ my_hash_insert(&tz_names, (const uchar *)tmp_tzname)))
{
sql_print_error("Out of memory while loading time zone");
goto end;
@@ -2244,13 +2247,13 @@ my_tz_find(THD *thd, const String *name)
{
if (!(result_tz= (Time_zone_offset *)hash_search(&offset_tzs,
- (const byte *)&offset,
+ (const uchar *)&offset,
sizeof(long))))
{
DBUG_PRINT("info", ("Creating new Time_zone_offset object"));
if (!(result_tz= new (&tz_storage) Time_zone_offset(offset)) ||
- my_hash_insert(&offset_tzs, (const byte *) result_tz))
+ my_hash_insert(&offset_tzs, (const uchar *) result_tz))
{
result_tz= 0;
sql_print_error("Fatal error: Out of memory "
@@ -2262,7 +2265,7 @@ my_tz_find(THD *thd, const String *name)
{
result_tz= 0;
if ((tmp_tzname= (Tz_names_entry *)hash_search(&tz_names,
- (const byte *)name->ptr(),
+ (const uchar *)name->ptr(),
name->length())))
result_tz= tmp_tzname->tz;
else if (time_zone_tables_exist)
diff --git a/sql/uniques.cc b/sql/uniques.cc
index 9eb827f62a3..7a05ceaddfc 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -34,7 +34,7 @@
#include "sql_sort.h"
-int unique_write_to_file(gptr key, element_count count, Unique *unique)
+int unique_write_to_file(uchar* key, element_count count, Unique *unique)
{
/*
Use unique->size (size of element stored in the tree) and not
@@ -42,11 +42,10 @@ int unique_write_to_file(gptr key, element_count count, Unique *unique)
when tree implementation chooses to store pointer to key in TREE_ELEMENT
(instead of storing the element itself there)
*/
- return my_b_write(&unique->file, (byte*) key,
- unique->size) ? 1 : 0;
+ return my_b_write(&unique->file, key, unique->size) ? 1 : 0;
}
-int unique_write_to_ptrs(gptr key, element_count count, Unique *unique)
+int unique_write_to_ptrs(uchar* key, element_count count, Unique *unique)
{
memcpy(unique->record_pointers, key, unique->size);
unique->record_pointers+=unique->size;
@@ -330,7 +329,7 @@ bool Unique::flush()
if (tree_walk(&tree, (tree_walk_action) unique_write_to_file,
(void*) this, left_root_right) ||
- insert_dynamic(&file_ptrs, (gptr) &file_ptr))
+ insert_dynamic(&file_ptrs, (uchar*) &file_ptr))
return 1;
delete_tree(&tree);
return 0;
@@ -374,11 +373,11 @@ struct BUFFPEK_COMPARE_CONTEXT
C_MODE_START
-static int buffpek_compare(void *arg, byte *key_ptr1, byte *key_ptr2)
+static int buffpek_compare(void *arg, uchar *key_ptr1, uchar *key_ptr2)
{
BUFFPEK_COMPARE_CONTEXT *ctx= (BUFFPEK_COMPARE_CONTEXT *) arg;
return ctx->key_compare(ctx->key_compare_arg,
- *((byte **) key_ptr1), *((byte **)key_ptr2));
+ *((uchar **) key_ptr1), *((uchar **)key_ptr2));
}
C_MODE_END
@@ -455,7 +454,7 @@ static bool merge_walk(uchar *merge_buffer, ulong merge_buffer_size,
if (bytes_read == (uint) (-1))
goto end;
DBUG_ASSERT(bytes_read);
- queue_insert(&queue, (byte *) top);
+ queue_insert(&queue, (uchar *) top);
}
top= (BUFFPEK *) queue_top(&queue);
while (queue.elements > 1)
@@ -586,7 +585,7 @@ bool Unique::get(TABLE *table)
if (my_b_tell(&file) == 0)
{
/* Whole tree is in memory; Don't use disk if you don't need to */
- if ((record_pointers=table->sort.record_pointers= (byte*)
+ if ((record_pointers=table->sort.record_pointers= (uchar*)
my_malloc(size * tree.elements_in_tree, MYF(0))))
{
(void) tree_walk(&tree, (tree_walk_action) unique_write_to_ptrs,
@@ -641,7 +640,7 @@ bool Unique::get(TABLE *table)
goto err;
error=0;
err:
- x_free((gptr) sort_buffer);
+ x_free(sort_buffer);
if (flush_io_cache(outfile))
error=1;
diff --git a/sql/unireg.cc b/sql/unireg.cc
index a69a9be6a43..a02d24d8ae5 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -104,7 +104,7 @@ bool mysql_create_frm(THD *thd, const char *file_name,
screens, create_info->table_options,
data_offset, db_file))
{
- my_free((gptr) screen_buff,MYF(0));
+ my_free(screen_buff, MYF(0));
if (thd->net.last_errno != ER_TOO_MANY_FIELDS)
DBUG_RETURN(1);
@@ -116,7 +116,7 @@ bool mysql_create_frm(THD *thd, const char *file_name,
create_fields,info_length,
screens, create_info->table_options, data_offset, db_file))
{
- my_free((gptr) screen_buff,MYF(0));
+ my_free(screen_buff, MYF(0));
DBUG_RETURN(1);
}
}
@@ -152,7 +152,7 @@ bool mysql_create_frm(THD *thd, const char *file_name,
if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo,
create_info, keys)) < 0)
{
- my_free((gptr) screen_buff,MYF(0));
+ my_free(screen_buff, MYF(0));
DBUG_RETURN(1);
}
@@ -200,8 +200,8 @@ bool mysql_create_frm(THD *thd, const char *file_name,
#endif
int2store(fileinfo+59,db_file->extra_rec_buf_length());
- if (my_pwrite(file,(byte*) fileinfo,64,0L,MYF_RW) ||
- my_pwrite(file,(byte*) keybuff,key_info_length,
+ if (my_pwrite(file, fileinfo, 64, 0L, MYF_RW) ||
+ my_pwrite(file, keybuff, key_info_length,
(ulong) uint2korr(fileinfo+6),MYF_RW))
goto err;
VOID(my_seek(file,
@@ -213,14 +213,14 @@ bool mysql_create_frm(THD *thd, const char *file_name,
goto err;
int2store(buff, create_info->connect_string.length);
- if (my_write(file, (const byte*)buff, 2, MYF(MY_NABP)) ||
- my_write(file, (const byte*)create_info->connect_string.str,
+ if (my_write(file, (const uchar*)buff, 2, MYF(MY_NABP)) ||
+ my_write(file, (const uchar*)create_info->connect_string.str,
create_info->connect_string.length, MYF(MY_NABP)))
goto err;
int2store(buff, str_db_type.length);
- if (my_write(file, (const byte*)buff, 2, MYF(MY_NABP)) ||
- my_write(file, (const byte*)str_db_type.str,
+ if (my_write(file, (const uchar*)buff, 2, MYF(MY_NABP)) ||
+ my_write(file, (const uchar*)str_db_type.str,
str_db_type.length, MYF(MY_NABP)))
goto err;
@@ -229,32 +229,32 @@ bool mysql_create_frm(THD *thd, const char *file_name,
{
char auto_partitioned= part_info->is_auto_partitioned ? 1 : 0;
int4store(buff, part_info->part_info_len);
- if (my_write(file, (const byte*)buff, 4, MYF_RW) ||
- my_write(file, (const byte*)part_info->part_info_string,
+ if (my_write(file, (const uchar*)buff, 4, MYF_RW) ||
+ my_write(file, (const uchar*)part_info->part_info_string,
part_info->part_info_len + 1, MYF_RW) ||
- my_write(file, (const byte*)&auto_partitioned, 1, MYF_RW))
+ my_write(file, (const uchar*)&auto_partitioned, 1, MYF_RW))
goto err;
}
else
#endif
{
- bzero(buff, 6);
- if (my_write(file, (byte*) buff, 6, MYF_RW))
+ bzero((uchar*) buff, 6);
+ if (my_write(file, (uchar*) buff, 6, MYF_RW))
goto err;
}
for (i= 0; i < keys; i++)
{
if (key_info[i].parser_name)
{
- if (my_write(file, (const byte*)key_info[i].parser_name->str,
+ if (my_write(file, (const uchar*)key_info[i].parser_name->str,
key_info[i].parser_name->length + 1, MYF(MY_NABP)))
goto err;
}
}
VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
- if (my_write(file,(byte*) forminfo,288,MYF_RW) ||
- my_write(file,(byte*) screen_buff,info_length,MYF_RW) ||
+ if (my_write(file, forminfo, 288, MYF_RW) ||
+ my_write(file, screen_buff, info_length, MYF_RW) ||
pack_fields(file, create_fields, data_offset))
goto err;
@@ -267,7 +267,7 @@ bool mysql_create_frm(THD *thd, const char *file_name,
goto err;
uint read_length=uint2korr(forminfo)-256;
VOID(my_seek(file,filepos+256,MY_SEEK_SET,MYF(0)));
- if (read_string(file,(gptr*) &disk_buff,read_length))
+ if (read_string(file,(uchar**) &disk_buff,read_length))
goto err;
crypted->encode(disk_buff,read_length);
delete crypted;
@@ -280,8 +280,8 @@ bool mysql_create_frm(THD *thd, const char *file_name,
}
#endif
- my_free((gptr) screen_buff,MYF(0));
- my_free((gptr) keybuff, MYF(0));
+ my_free(screen_buff,MYF(0));
+ my_free(keybuff, MYF(0));
if (opt_sync_frm && !(create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
my_sync(file, MYF(MY_WME)))
@@ -308,8 +308,8 @@ bool mysql_create_frm(THD *thd, const char *file_name,
DBUG_RETURN(0);
err:
- my_free((gptr) screen_buff,MYF(0));
- my_free((gptr) keybuff, MYF(0));
+ my_free(screen_buff, MYF(0));
+ my_free(keybuff, MYF(0));
err2:
VOID(my_close(file,MYF(MY_WME)));
err3:
@@ -417,7 +417,7 @@ static uchar *pack_screens(List<create_field> &create_fields,
pos[0]= (uchar) start_row-2; /* Header string */
pos[1]= (uchar) (cols >> 2);
pos[2]= (uchar) (cols >> 1) +1;
- strfill((my_string) pos+3,(uint) (cols >> 1),' ');
+ strfill((char *) pos+3,(uint) (cols >> 1),' ');
pos+=(cols >> 1)+4;
}
length=(uint) strlen(cfield->field_name);
@@ -626,7 +626,8 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
length= field->save_interval->type_lengths[pos];
hex_length= length * 2;
field->interval->type_lengths[pos]= hex_length;
- field->interval->type_names[pos]= dst= sql_alloc(hex_length + 1);
+ field->interval->type_names[pos]= dst= (char*) sql_alloc(hex_length +
+ 1);
octet2hex(dst, src, length);
}
}
@@ -756,13 +757,13 @@ static bool pack_fields(File file, List<create_field> &create_fields,
int2store(buff+15, field->comment.length);
comment_length+= field->comment.length;
set_if_bigger(int_count,field->interval_id);
- if (my_write(file,(byte*) buff,FCOMP,MYF_RW))
+ if (my_write(file, buff, FCOMP, MYF_RW))
DBUG_RETURN(1);
}
/* Write fieldnames */
buff[0]=(uchar) NAMES_SEP_CHAR;
- if (my_write(file,(byte*) buff,1,MYF_RW))
+ if (my_write(file, buff, 1, MYF_RW))
DBUG_RETURN(1);
i=0;
it.rewind();
@@ -772,7 +773,7 @@ static bool pack_fields(File file, List<create_field> &create_fields,
*pos++=NAMES_SEP_CHAR;
if (i == create_fields.elements-1)
*pos++=0;
- if (my_write(file,(byte*) buff,(uint) (pos-(char*) buff),MYF_RW))
+ if (my_write(file, buff, (size_t) (pos-(char*) buff),MYF_RW))
DBUG_RETURN(1);
i++;
}
@@ -832,7 +833,7 @@ static bool pack_fields(File file, List<create_field> &create_fields,
tmp.append('\0'); // End of intervall
}
}
- if (my_write(file,(byte*) tmp.ptr(),tmp.length(),MYF_RW))
+ if (my_write(file,(uchar*) tmp.ptr(),tmp.length(),MYF_RW))
DBUG_RETURN(1);
}
if (comment_length)
@@ -842,7 +843,7 @@ static bool pack_fields(File file, List<create_field> &create_fields,
while ((field=it++))
{
if (field->comment.length)
- if (my_write(file, (byte*) field->comment.str, field->comment.length,
+ if (my_write(file, (uchar*) field->comment.str, field->comment.length,
MYF_RW))
DBUG_RETURN(1);
}
@@ -875,7 +876,7 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type,
bzero((char*) &share, sizeof(share));
table.s= &share;
- if (!(buff=(uchar*) my_malloc((uint) reclength,MYF(MY_WME | MY_ZEROFILL))))
+ if (!(buff=(uchar*) my_malloc((size_t) reclength,MYF(MY_WME | MY_ZEROFILL))))
{
DBUG_RETURN(1);
}
@@ -900,7 +901,7 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type,
regfield don't have to be deleted as it's allocated with sql_alloc()
*/
Field *regfield= make_field(&share,
- (char*) buff+field->offset + data_offset,
+ buff+field->offset + data_offset,
field->length,
null_pos + null_count / 8,
null_count & 7,
@@ -968,10 +969,10 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type,
if (null_count & 7)
*(null_pos + null_count / 8)|= ~(((uchar) 1 << (null_count & 7)) - 1);
- error=(int) my_write(file,(byte*) buff, (uint) reclength,MYF_RW);
+ error= my_write(file, buff, (size_t) reclength,MYF_RW) != 0;
err:
- my_free((gptr) buff,MYF(MY_FAE));
+ my_free(buff, MYF(MY_FAE));
thd->count_cuted_fields= old_count_cuted_fields;
DBUG_RETURN(error);
} /* make_empty_rec */
diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c
index 14018217dea..d3c11f1dce2 100644
--- a/storage/archive/archive_reader.c
+++ b/storage/archive/archive_reader.c
@@ -110,7 +110,7 @@ int main(int argc, char *argv[])
if (opt_check)
{
- byte size_buffer[ARCHIVE_ROW_HEADER_SIZE];
+ uchar size_buffer[ARCHIVE_ROW_HEADER_SIZE];
int error;
unsigned int x;
unsigned int read;
@@ -118,7 +118,7 @@ int main(int argc, char *argv[])
unsigned long long row_count= 0;
char buffer;
- while ((read= azread(&reader_handle, (byte *)size_buffer,
+ while ((read= azread(&reader_handle, (uchar *)size_buffer,
ARCHIVE_ROW_HEADER_SIZE, &error)))
{
if (error == Z_STREAM_ERROR || (read && read < ARCHIVE_ROW_HEADER_SIZE))
@@ -171,7 +171,7 @@ int main(int argc, char *argv[])
if (opt_backup)
{
- byte size_buffer[ARCHIVE_ROW_HEADER_SIZE];
+ uchar size_buffer[ARCHIVE_ROW_HEADER_SIZE];
int error;
unsigned int read;
unsigned int row_len;
@@ -213,7 +213,7 @@ int main(int argc, char *argv[])
my_free(ptr, MYF(0));
}
- while ((read= azread(&reader_handle, (byte *)size_buffer,
+ while ((read= azread(&reader_handle, (uchar *)size_buffer,
ARCHIVE_ROW_HEADER_SIZE, &error)))
{
if (error == Z_STREAM_ERROR || (read && read < ARCHIVE_ROW_HEADER_SIZE))
@@ -355,15 +355,15 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-auto-increment", 'A',
"Force auto_increment to start at this or higher value. If no value is given, then sets the next auto_increment value to the highest used value for the auto key + 1.",
- (gptr*) &new_auto_increment,
- (gptr*) &new_auto_increment,
+ (uchar**) &new_auto_increment,
+ (uchar**) &new_auto_increment,
0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's',
"Only print errors. One can use two -s to make archive_reader very silent.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't',
"Path for temporary files.",
- (gptr*) &opt_tmpdir,
+ (uchar**) &opt_tmpdir,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V',
"Print version and exit.",
diff --git a/storage/archive/azio.c b/storage/archive/azio.c
index 6b01d9c3c88..1f7e9d7c1de 100644
--- a/storage/archive/azio.c
+++ b/storage/archive/azio.c
@@ -19,7 +19,7 @@
static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
static int const az_magic[3] = {0xfe, 0x03, 0x01}; /* az magic header */
-/* gzip flag byte */
+/* gzip flag uchar */
#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */
#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
@@ -139,8 +139,8 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd)
}
else if (s->mode == 'w')
{
- unsigned char buffer[AZHEADER_SIZE + AZMETA_BUFFER_SIZE];
- my_pread(s->file, (byte*) buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, 0,
+ uchar buffer[AZHEADER_SIZE + AZMETA_BUFFER_SIZE];
+ my_pread(s->file, buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, 0,
MYF(0));
read_header(s, buffer); /* skip the .az header */
my_seek(s->file, 0, MY_SEEK_END, MYF(0));
@@ -224,7 +224,7 @@ int get_byte(s)
if (s->stream.avail_in == 0)
{
errno = 0;
- s->stream.avail_in = my_read(s->file, (byte *)s->inbuf, AZ_BUFSIZE_READ, MYF(0));
+ s->stream.avail_in = my_read(s->file, (uchar *)s->inbuf, AZ_BUFSIZE_READ, MYF(0));
if (s->stream.avail_in == 0)
{
s->z_eof = 1;
@@ -248,8 +248,8 @@ int get_byte(s)
*/
void check_header(azio_stream *s)
{
- int method; /* method byte */
- int flags; /* flags byte */
+ int method; /* method uchar */
+ int flags; /* flags uchar */
uInt len;
int c;
@@ -260,7 +260,7 @@ void check_header(azio_stream *s)
if (len < 2) {
if (len) s->inbuf[0] = s->stream.next_in[0];
errno = 0;
- len = (uInt)my_read(s->file, (byte *)s->inbuf + len, AZ_BUFSIZE_READ >> len, MYF(0));
+ len = (uInt)my_read(s->file, (uchar *)s->inbuf + len, AZ_BUFSIZE_READ >> len, MYF(0));
if (len == 0) s->z_err = Z_ERRNO;
s->stream.avail_in += len;
s->stream.next_in = s->inbuf;
@@ -442,7 +442,7 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, unsigned int len, int *
if (s->stream.avail_out > 0)
{
s->stream.avail_out -=
- (uInt)my_read(s->file, (byte *)next_out, s->stream.avail_out, MYF(0));
+ (uInt)my_read(s->file, (uchar *)next_out, s->stream.avail_out, MYF(0));
}
len -= s->stream.avail_out;
s->in += len;
@@ -455,7 +455,7 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, unsigned int len, int *
if (s->stream.avail_in == 0 && !s->z_eof) {
errno = 0;
- s->stream.avail_in = (uInt)my_read(s->file, (byte *)s->inbuf, AZ_BUFSIZE_READ, MYF(0));
+ s->stream.avail_in = (uInt)my_read(s->file, (uchar *)s->inbuf, AZ_BUFSIZE_READ, MYF(0));
if (s->stream.avail_in == 0)
{
s->z_eof = 1;
@@ -522,7 +522,7 @@ unsigned int azwrite (azio_stream *s, voidpc buf, unsigned int len)
{
s->stream.next_out = s->outbuf;
- if (my_write(s->file, (byte *)s->outbuf, AZ_BUFSIZE_WRITE,
+ if (my_write(s->file, (uchar *)s->outbuf, AZ_BUFSIZE_WRITE,
MYF(0)) != AZ_BUFSIZE_WRITE)
{
s->z_err = Z_ERRNO;
@@ -569,7 +569,7 @@ int do_flush (azio_stream *s, int flush)
if (len != 0)
{
s->check_point= my_tell(s->file, MYF(0));
- if ((uInt)my_write(s->file, (byte *)s->outbuf, len, MYF(0)) != len)
+ if ((uInt)my_write(s->file, (uchar *)s->outbuf, len, MYF(0)) != len)
{
s->z_err = Z_ERRNO;
return Z_ERRNO;
@@ -611,7 +611,7 @@ int ZEXPORT azflush (s, flush)
if (s->mode == 'r')
{
unsigned char buffer[AZHEADER_SIZE + AZMETA_BUFFER_SIZE];
- my_pread(s->file, (byte*) buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, 0,
+ my_pread(s->file, (uchar*) buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, 0,
MYF(0));
read_header(s, buffer); /* skip the .az header */
@@ -748,7 +748,7 @@ my_off_t ZEXPORT aztell (file)
void putLong (File file, uLong x)
{
int n;
- byte buffer[1];
+ uchar buffer[1];
for (n = 0; n < 4; n++)
{
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 6853e879f55..d1482de18ec 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -113,9 +113,9 @@ static handler *archive_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
int archive_discover(handlerton *hton, THD* thd, const char *db,
- const char *name,
- const void** frmblob,
- uint* frmlen);
+ const char *name,
+ uchar **frmblob,
+ size_t *frmlen);
/*
Number of rows that will force a bulk insert.
@@ -137,11 +137,11 @@ static handler *archive_create_handler(handlerton *hton,
/*
Used for hash table that tracks open tables.
*/
-static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length,
+static uchar* archive_get_key(ARCHIVE_SHARE *share, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length=share->table_name_length;
- return (byte*) share->table_name;
+ return (uchar*) share->table_name;
}
@@ -216,9 +216,9 @@ ha_archive::ha_archive(handlerton *hton, TABLE_SHARE *table_arg)
}
int archive_discover(handlerton *hton, THD* thd, const char *db,
- const char *name,
- const void** frmblob,
- uint* frmlen)
+ const char *name,
+ uchar **frmblob,
+ size_t *frmlen)
{
DBUG_ENTER("archive_discover");
DBUG_PRINT("archive_discover", ("db: %s, name: %s", db, name));
@@ -247,7 +247,7 @@ int archive_discover(handlerton *hton, THD* thd, const char *db,
azclose(&frm_stream);
*frmlen= frm_stream.frm_length;
- *frmblob= frm_ptr;
+ *frmblob= (uchar*) frm_ptr;
DBUG_RETURN(0);
err:
@@ -316,7 +316,7 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc)
length=(uint) strlen(table_name);
if (!(share=(ARCHIVE_SHARE*) hash_search(&archive_open_tables,
- (byte*) table_name,
+ (uchar*) table_name,
length)))
{
char *tmp_name;
@@ -362,7 +362,7 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc)
share->crashed= archive_tmp.dirty;
azclose(&archive_tmp);
- VOID(my_hash_insert(&archive_open_tables, (byte*) share));
+ VOID(my_hash_insert(&archive_open_tables, (uchar*) share));
thr_lock_init(&share->lock);
}
share->use_count++;
@@ -393,7 +393,7 @@ int ha_archive::free_share()
pthread_mutex_lock(&archive_mutex);
if (!--share->use_count)
{
- hash_delete(&archive_open_tables, (byte*) share);
+ hash_delete(&archive_open_tables, (uchar*) share);
thr_lock_delete(&share->lock);
VOID(pthread_mutex_destroy(&share->mutex));
/*
@@ -408,7 +408,7 @@ int ha_archive::free_share()
if (azclose(&(share->archive_write)))
rc= 1;
}
- my_free((gptr) share, MYF(0));
+ my_free((uchar*) share, MYF(0));
}
pthread_mutex_unlock(&archive_mutex);
@@ -579,7 +579,7 @@ int ha_archive::create(const char *name, TABLE *table_arg,
azio_stream create_stream; /* Archive file we are working with */
File frm_file; /* File handler for readers */
MY_STAT file_stat; // Stat information for the data file
- byte *frm_ptr;
+ uchar *frm_ptr;
DBUG_ENTER("ha_archive::create");
@@ -651,12 +651,12 @@ int ha_archive::create(const char *name, TABLE *table_arg,
{
if (!my_fstat(frm_file, &file_stat, MYF(MY_WME)))
{
- frm_ptr= (byte *)my_malloc(sizeof(byte) * file_stat.st_size , MYF(0));
+ frm_ptr= (uchar *)my_malloc(sizeof(uchar) * file_stat.st_size, MYF(0));
if (frm_ptr)
{
my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0));
azwrite_frm(&create_stream, (char *)frm_ptr, file_stat.st_size);
- my_free((gptr)frm_ptr, MYF(0));
+ my_free((uchar*)frm_ptr, MYF(0));
}
}
my_close(frm_file, MYF(0));
@@ -696,7 +696,7 @@ error:
/*
This is where the actual row is written out.
*/
-int ha_archive::real_write_row(byte *buf, azio_stream *writer)
+int ha_archive::real_write_row(uchar *buf, azio_stream *writer)
{
my_off_t written;
unsigned int r_pack_length;
@@ -726,7 +726,7 @@ int ha_archive::real_write_row(byte *buf, azio_stream *writer)
the bytes required for the length in the header.
*/
-uint32 ha_archive::max_row_length(const byte *buf)
+uint32 ha_archive::max_row_length(const uchar *buf)
{
uint32 length= (uint32)(table->s->reclength + table->s->fields*2);
length+= ARCHIVE_ROW_HEADER_SIZE;
@@ -743,9 +743,9 @@ uint32 ha_archive::max_row_length(const byte *buf)
}
-unsigned int ha_archive::pack_row(byte *record)
+unsigned int ha_archive::pack_row(uchar *record)
{
- byte *ptr;
+ uchar *ptr;
DBUG_ENTER("ha_archive::pack_row");
@@ -761,8 +761,7 @@ unsigned int ha_archive::pack_row(byte *record)
for (Field **field=table->field ; *field ; field++)
{
if (!((*field)->is_null()))
- ptr=(byte*) (*field)->pack((char*) ptr,
- (char*) record + (*field)->offset(record));
+ ptr= (*field)->pack(ptr, record + (*field)->offset(record));
}
int4store(record_buffer->buffer, (int)(ptr - record_buffer->buffer -
@@ -784,12 +783,12 @@ unsigned int ha_archive::pack_row(byte *record)
for implementing start_bulk_insert() is that we could skip
setting dirty to true each time.
*/
-int ha_archive::write_row(byte *buf)
+int ha_archive::write_row(uchar *buf)
{
int rc;
- byte *read_buf= NULL;
+ uchar *read_buf= NULL;
ulonglong temp_auto;
- byte *record= table->record[0];
+ uchar *record= table->record[0];
DBUG_ENTER("ha_archive::write_row");
if (share->crashed)
@@ -832,7 +831,7 @@ int ha_archive::write_row(byte *buf)
First we create a buffer that we can use for reading rows, and can pass
to get_row().
*/
- if (!(read_buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME))))
+ if (!(read_buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
{
rc= HA_ERR_OUT_OF_MEM;
goto error;
@@ -882,7 +881,7 @@ int ha_archive::write_row(byte *buf)
error:
pthread_mutex_unlock(&share->mutex);
if (read_buf)
- my_free((gptr) read_buf, MYF(0));
+ my_free((uchar*) read_buf, MYF(0));
DBUG_RETURN(rc);
}
@@ -910,7 +909,7 @@ int ha_archive::index_init(uint keynr, bool sorted)
No indexes, so if we get a request for an index search since we tell
the optimizer that we have unique indexes, we scan
*/
-int ha_archive::index_read(byte *buf, const byte *key,
+int ha_archive::index_read(uchar *buf, const uchar *key,
uint key_len, enum ha_rkey_function find_flag)
{
int rc;
@@ -920,7 +919,7 @@ int ha_archive::index_read(byte *buf, const byte *key,
}
-int ha_archive::index_read_idx(byte *buf, uint index, const byte *key,
+int ha_archive::index_read_idx(uchar *buf, uint index, const uchar *key,
uint key_len, enum ha_rkey_function find_flag)
{
int rc;
@@ -955,7 +954,7 @@ error:
}
-int ha_archive::index_next(byte * buf)
+int ha_archive::index_next(uchar * buf)
{
bool found= 0;
@@ -1024,7 +1023,7 @@ int ha_archive::rnd_init(bool scan)
This is the method that is used to read a row. It assumes that the row is
positioned where you want it.
*/
-int ha_archive::get_row(azio_stream *file_to_read, byte *buf)
+int ha_archive::get_row(azio_stream *file_to_read, uchar *buf)
{
int rc;
DBUG_ENTER("ha_archive::get_row");
@@ -1051,8 +1050,8 @@ bool ha_archive::fix_rec_buff(unsigned int length)
if (length > record_buffer->length)
{
- byte *newptr;
- if (!(newptr=(byte*) my_realloc((gptr) record_buffer->buffer,
+ uchar *newptr;
+ if (!(newptr=(uchar*) my_realloc((uchar*) record_buffer->buffer,
length,
MYF(MY_ALLOW_ZERO_PTR))))
DBUG_RETURN(1);
@@ -1065,17 +1064,17 @@ bool ha_archive::fix_rec_buff(unsigned int length)
DBUG_RETURN(0);
}
-int ha_archive::unpack_row(azio_stream *file_to_read, byte *record)
+int ha_archive::unpack_row(azio_stream *file_to_read, uchar *record)
{
DBUG_ENTER("ha_archive::unpack_row");
unsigned int read;
int error;
- byte size_buffer[ARCHIVE_ROW_HEADER_SIZE];
+ uchar size_buffer[ARCHIVE_ROW_HEADER_SIZE];
unsigned int row_len;
/* First we grab the length stored */
- read= azread(file_to_read, (byte *)size_buffer, ARCHIVE_ROW_HEADER_SIZE, &error);
+ read= azread(file_to_read, size_buffer, ARCHIVE_ROW_HEADER_SIZE, &error);
if (error == Z_STREAM_ERROR || (read && read < ARCHIVE_ROW_HEADER_SIZE))
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
@@ -1100,21 +1099,21 @@ int ha_archive::unpack_row(azio_stream *file_to_read, byte *record)
}
/* Copy null bits */
- const char *ptr= (const char*) record_buffer->buffer;
+ const uchar *ptr= record_buffer->buffer;
memcpy(record, ptr, table->s->null_bytes);
ptr+= table->s->null_bytes;
for (Field **field=table->field ; *field ; field++)
+ {
if (!((*field)->is_null()))
{
- ptr= (*field)->unpack((char *)record +
- (*field)->offset(table->record[0]), ptr);
+ ptr= (*field)->unpack(record + (*field)->offset(table->record[0]), ptr);
}
-
+ }
DBUG_RETURN(0);
}
-int ha_archive::get_row_version3(azio_stream *file_to_read, byte *buf)
+int ha_archive::get_row_version3(azio_stream *file_to_read, uchar *buf)
{
DBUG_ENTER("ha_archive::get_row_version3");
@@ -1124,7 +1123,7 @@ int ha_archive::get_row_version3(azio_stream *file_to_read, byte *buf)
}
-int ha_archive::get_row_version2(azio_stream *file_to_read, byte *buf)
+int ha_archive::get_row_version2(azio_stream *file_to_read, uchar *buf)
{
unsigned int read;
int error;
@@ -1190,7 +1189,7 @@ int ha_archive::get_row_version2(azio_stream *file_to_read, byte *buf)
if ((size_t) read != size)
DBUG_RETURN(HA_ERR_END_OF_FILE);
- ((Field_blob*) table->field[*ptr])->set_ptr(size, last);
+ ((Field_blob*) table->field[*ptr])->set_ptr(size, (uchar*) last);
last += size;
}
else
@@ -1208,7 +1207,7 @@ int ha_archive::get_row_version2(azio_stream *file_to_read, byte *buf)
or by having had ha_archive::rnd_pos() called before it is called.
*/
-int ha_archive::rnd_next(byte *buf)
+int ha_archive::rnd_next(uchar *buf)
{
int rc;
DBUG_ENTER("ha_archive::rnd_next");
@@ -1238,7 +1237,7 @@ int ha_archive::rnd_next(byte *buf)
needed.
*/
-void ha_archive::position(const byte *record)
+void ha_archive::position(const uchar *record)
{
DBUG_ENTER("ha_archive::position");
my_store_ptr(ref, ref_length, current_position);
@@ -1253,7 +1252,7 @@ void ha_archive::position(const byte *record)
correctly ordered row.
*/
-int ha_archive::rnd_pos(byte * buf, byte *pos)
+int ha_archive::rnd_pos(uchar * buf, uchar *pos)
{
DBUG_ENTER("ha_archive::rnd_pos");
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
@@ -1346,8 +1345,8 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt)
{
Field *field= table->found_next_number_field;
ulonglong auto_value=
- (ulonglong) field->val_int((char*)(table->record[0] +
- field->offset(table->record[0])));
+ (ulonglong) field->val_int(table->record[0] +
+ field->offset(table->record[0]));
if (share->archive_write.auto_increment < auto_value)
stats.auto_increment_value= share->archive_write.auto_increment=
auto_value;
@@ -1549,7 +1548,7 @@ bool ha_archive::is_crashed() const
int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt)
{
int rc= 0;
- byte *buf;
+ uchar *buf;
const char *old_proc_info;
ha_rows count= share->rows_recorded;
DBUG_ENTER("ha_archive::check");
@@ -1562,7 +1561,7 @@ int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt)
First we create a buffer that we can use for reading rows, and can pass
to get_row().
*/
- if (!(buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME))))
+ if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
rc= HA_ERR_OUT_OF_MEM;
/*
@@ -1618,7 +1617,7 @@ archive_record_buffer *ha_archive::create_record_buffer(unsigned int length)
}
r->length= (int)length;
- if (!(r->buffer= (byte*) my_malloc(r->length,
+ if (!(r->buffer= (uchar*) my_malloc(r->length,
MYF(MY_WME))))
{
my_free((char*) r, MYF(MY_ALLOW_ZERO_PTR));
diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h
index 8fc54f6715f..936bb6e253d 100644
--- a/storage/archive/ha_archive.h
+++ b/storage/archive/ha_archive.h
@@ -27,7 +27,7 @@
*/
typedef struct st_archive_record_buffer {
- byte *buffer;
+ uchar *buffer;
uint32 length;
} archive_record_buffer;
@@ -62,12 +62,12 @@ class ha_archive: public handler
azio_stream archive; /* Archive file we are working with */
my_off_t current_position; /* The position of the row we just read */
- byte byte_buffer[IO_SIZE]; /* Initial buffer for our string */
+ uchar byte_buffer[IO_SIZE]; /* Initial buffer for our string */
String buffer; /* Buffer used for blob storage */
ha_rows scan_rows; /* Number of rows left in scan */
bool delayed_insert; /* If the insert is delayed */
bool bulk_insert; /* If we are performing a bulk insert */
- const byte *current_key;
+ const uchar *current_key;
uint current_key_len;
uint current_k_offset;
archive_record_buffer *record_buffer;
@@ -101,29 +101,29 @@ public:
uint max_supported_key_length() const { return sizeof(ulonglong); }
uint max_supported_key_part_length() const { return sizeof(ulonglong); }
int index_init(uint keynr, bool sorted);
- virtual int index_read(byte * buf, const byte * key,
+ virtual int index_read(uchar * buf, const uchar * key,
uint key_len, enum ha_rkey_function find_flag);
- virtual int index_read_idx(byte * buf, uint index, const byte * key,
+ virtual int index_read_idx(uchar * buf, uint index, const uchar * key,
uint key_len, enum ha_rkey_function find_flag);
- int index_next(byte * buf);
+ int index_next(uchar * buf);
int open(const char *name, int mode, uint test_if_locked);
int close(void);
- int write_row(byte * buf);
- int real_write_row(byte *buf, azio_stream *writer);
+ int write_row(uchar * buf);
+ int real_write_row(uchar *buf, azio_stream *writer);
int delete_all_rows();
int rnd_init(bool scan=1);
- int rnd_next(byte *buf);
- int rnd_pos(byte * buf, byte *pos);
- int get_row(azio_stream *file_to_read, byte *buf);
- int get_row_version2(azio_stream *file_to_read, byte *buf);
- int get_row_version3(azio_stream *file_to_read, byte *buf);
+ int rnd_next(uchar *buf);
+ int rnd_pos(uchar * buf, uchar *pos);
+ int get_row(azio_stream *file_to_read, uchar *buf);
+ int get_row_version2(azio_stream *file_to_read, uchar *buf);
+ int get_row_version3(azio_stream *file_to_read, uchar *buf);
ARCHIVE_SHARE *get_share(const char *table_name, int *rc);
int free_share();
int init_archive_writer();
int init_archive_reader();
bool auto_repair() const { return 1; } // For the moment we just do this
int read_data_header(azio_stream *file_to_read);
- void position(const byte *record);
+ void position(const uchar *record);
int info(uint);
void update_create_info(HA_CREATE_INFO *create_info);
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
@@ -140,9 +140,9 @@ public:
bool is_crashed() const;
int check(THD* thd, HA_CHECK_OPT* check_opt);
bool check_and_repair(THD *thd);
- uint32 max_row_length(const byte *buf);
+ uint32 max_row_length(const uchar *buf);
bool fix_rec_buff(unsigned int length);
- int unpack_row(azio_stream *file_to_read, byte *record);
- unsigned int pack_row(byte *record);
+ int unpack_row(azio_stream *file_to_read, uchar *record);
+ unsigned int pack_row(uchar *record);
};
diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc
index 6f07c4183f1..f867cbfdeb5 100644
--- a/storage/blackhole/ha_blackhole.cc
+++ b/storage/blackhole/ha_blackhole.cc
@@ -83,7 +83,7 @@ const char *ha_blackhole::index_type(uint key_number)
HA_KEY_ALG_RTREE) ? "RTREE" : "BTREE");
}
-int ha_blackhole::write_row(byte * buf)
+int ha_blackhole::write_row(uchar * buf)
{
DBUG_ENTER("ha_blackhole::write_row");
DBUG_RETURN(0);
@@ -96,14 +96,14 @@ int ha_blackhole::rnd_init(bool scan)
}
-int ha_blackhole::rnd_next(byte *buf)
+int ha_blackhole::rnd_next(uchar *buf)
{
DBUG_ENTER("ha_blackhole::rnd_next");
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
-int ha_blackhole::rnd_pos(byte * buf, byte *pos)
+int ha_blackhole::rnd_pos(uchar * buf, uchar *pos)
{
DBUG_ENTER("ha_blackhole::rnd_pos");
DBUG_ASSERT(0);
@@ -111,7 +111,7 @@ int ha_blackhole::rnd_pos(byte * buf, byte *pos)
}
-void ha_blackhole::position(const byte *record)
+void ha_blackhole::position(const uchar *record)
{
DBUG_ENTER("ha_blackhole::position");
DBUG_ASSERT(0);
@@ -151,7 +151,7 @@ THR_LOCK_DATA **ha_blackhole::store_lock(THD *thd,
}
-int ha_blackhole::index_read(byte * buf, const byte * key,
+int ha_blackhole::index_read(uchar * buf, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -160,7 +160,7 @@ int ha_blackhole::index_read(byte * buf, const byte * key,
}
-int ha_blackhole::index_read_idx(byte * buf, uint idx, const byte * key,
+int ha_blackhole::index_read_idx(uchar * buf, uint idx, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -169,7 +169,7 @@ int ha_blackhole::index_read_idx(byte * buf, uint idx, const byte * key,
}
-int ha_blackhole::index_read_last(byte * buf, const byte * key,
+int ha_blackhole::index_read_last(uchar * buf, const uchar * key,
key_part_map keypart_map)
{
DBUG_ENTER("ha_blackhole::index_read_last");
@@ -177,28 +177,28 @@ int ha_blackhole::index_read_last(byte * buf, const byte * key,
}
-int ha_blackhole::index_next(byte * buf)
+int ha_blackhole::index_next(uchar * buf)
{
DBUG_ENTER("ha_blackhole::index_next");
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
-int ha_blackhole::index_prev(byte * buf)
+int ha_blackhole::index_prev(uchar * buf)
{
DBUG_ENTER("ha_blackhole::index_prev");
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
-int ha_blackhole::index_first(byte * buf)
+int ha_blackhole::index_first(uchar * buf)
{
DBUG_ENTER("ha_blackhole::index_first");
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
-int ha_blackhole::index_last(byte * buf)
+int ha_blackhole::index_last(uchar * buf)
{
DBUG_ENTER("ha_blackhole::index_last");
DBUG_RETURN(HA_ERR_END_OF_FILE);
diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h
index 2af12b33077..e22f1a6beba 100644
--- a/storage/blackhole/ha_blackhole.h
+++ b/storage/blackhole/ha_blackhole.h
@@ -60,20 +60,20 @@ public:
uint max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; }
int open(const char *name, int mode, uint test_if_locked);
int close(void);
- int write_row(byte * buf);
+ int write_row(uchar * buf);
int rnd_init(bool scan);
- int rnd_next(byte *buf);
- int rnd_pos(byte * buf, byte *pos);
- int index_read(byte * buf, const byte * key, key_part_map keypart_map,
+ int rnd_next(uchar *buf);
+ int rnd_pos(uchar * buf, uchar *pos);
+ int index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
enum ha_rkey_function find_flag);
- int index_read_idx(byte * buf, uint idx, const byte * key,
+ int index_read_idx(uchar * buf, uint idx, const uchar * key,
key_part_map keypart_map, enum ha_rkey_function find_flag);
- int index_read_last(byte * buf, const byte * key, key_part_map keypart_map);
- int index_next(byte * buf);
- int index_prev(byte * buf);
- int index_first(byte * buf);
- int index_last(byte * buf);
- void position(const byte *record);
+ int index_read_last(uchar * buf, const uchar * key, key_part_map keypart_map);
+ int index_next(uchar * buf);
+ int index_prev(uchar * buf);
+ int index_first(uchar * buf);
+ int index_last(uchar * buf);
+ void position(const uchar *record);
int info(uint flag);
int external_lock(THD *thd, int lock_type);
uint lock_count(void) const;
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index 07a4ffc65c5..9eead7a059c 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -93,11 +93,11 @@ int sort_set (tina_set *a, tina_set *b)
return ( a->begin > b->begin ? 1 : ( a->begin < b->begin ? -1 : 0 ) );
}
-static byte* tina_get_key(TINA_SHARE *share,uint *length,
+static uchar* tina_get_key(TINA_SHARE *share, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length=share->table_name_length;
- return (byte*) share->table_name;
+ return (uchar*) share->table_name;
}
static int tina_init_func(void *p)
@@ -144,7 +144,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
initialize its members.
*/
if (!(share=(TINA_SHARE*) hash_search(&tina_open_tables,
- (byte*) table_name,
+ (uchar*) table_name,
length)))
{
if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
@@ -174,7 +174,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
goto error;
share->saved_data_file_length= file_stat.st_size;
- if (my_hash_insert(&tina_open_tables, (byte*) share))
+ if (my_hash_insert(&tina_open_tables, (uchar*) share))
goto error;
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
@@ -203,7 +203,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
error:
pthread_mutex_unlock(&tina_mutex);
- my_free((gptr) share, MYF(0));
+ my_free((uchar*) share, MYF(0));
return NULL;
}
@@ -236,7 +236,7 @@ static int read_meta_file(File meta_file, ha_rows *rows)
DBUG_ENTER("ha_tina::read_meta_file");
VOID(my_seek(meta_file, 0, MY_SEEK_SET, MYF(0)));
- if (my_read(meta_file, (byte*)meta_buffer, META_BUFFER_SIZE, 0)
+ if (my_read(meta_file, (uchar*)meta_buffer, META_BUFFER_SIZE, 0)
!= META_BUFFER_SIZE)
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
@@ -305,7 +305,7 @@ static int write_meta_file(File meta_file, ha_rows rows, bool dirty)
*ptr= (uchar)dirty;
VOID(my_seek(meta_file, 0, MY_SEEK_SET, MYF(0)));
- if (my_write(meta_file, (byte *)meta_buffer, META_BUFFER_SIZE, 0)
+ if (my_write(meta_file, (uchar *)meta_buffer, META_BUFFER_SIZE, 0)
!= META_BUFFER_SIZE)
DBUG_RETURN(-1);
@@ -376,10 +376,10 @@ static int free_share(TINA_SHARE *share)
share->tina_write_opened= FALSE;
}
- hash_delete(&tina_open_tables, (byte*) share);
+ hash_delete(&tina_open_tables, (uchar*) share);
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
- my_free((gptr) share, MYF(0));
+ my_free((uchar*) share, MYF(0));
}
pthread_mutex_unlock(&tina_mutex);
@@ -454,7 +454,7 @@ ha_tina::ha_tina(handlerton *hton, TABLE_SHARE *table_arg)
Encode a buffer into the quoted format.
*/
-int ha_tina::encode_quote(byte *buf)
+int ha_tina::encode_quote(uchar *buf)
{
char attribute_buffer[1024];
String attribute(attribute_buffer, sizeof(attribute_buffer),
@@ -558,7 +558,7 @@ int ha_tina::chain_append()
if (chain_alloced)
{
/* Must cast since my_malloc unlike malloc doesn't have a void ptr */
- if ((chain= (tina_set *) my_realloc((gptr)chain,
+ if ((chain= (tina_set *) my_realloc((uchar*)chain,
chain_size, MYF(MY_WME))) == NULL)
return -1;
}
@@ -584,7 +584,7 @@ int ha_tina::chain_append()
/*
Scans for a row.
*/
-int ha_tina::find_current_row(byte *buf)
+int ha_tina::find_current_row(uchar *buf)
{
off_t end_offset, curr_offset= current_position;
int eoln_len;
@@ -851,7 +851,7 @@ int ha_tina::close(void)
of the file and appends the data. In an error case it really should
just truncate to the original position (this is not done yet).
*/
-int ha_tina::write_row(byte * buf)
+int ha_tina::write_row(uchar * buf)
{
int size;
DBUG_ENTER("ha_tina::write_row");
@@ -871,7 +871,7 @@ int ha_tina::write_row(byte * buf)
DBUG_RETURN(-1);
/* use pwrite, as concurrent reader could have changed the position */
- if (my_write(share->tina_write_filedes, (byte*)buffer.ptr(), size,
+ if (my_write(share->tina_write_filedes, (uchar*)buffer.ptr(), size,
MYF(MY_WME | MY_NABP)))
DBUG_RETURN(-1);
@@ -916,7 +916,7 @@ int ha_tina::open_update_temp_file_if_needed()
This will be called in a table scan right before the previous ::rnd_next()
call.
*/
-int ha_tina::update_row(const byte * old_data, byte * new_data)
+int ha_tina::update_row(const uchar * old_data, uchar * new_data)
{
int size;
DBUG_ENTER("ha_tina::update_row");
@@ -934,7 +934,7 @@ int ha_tina::update_row(const byte * old_data, byte * new_data)
if (open_update_temp_file_if_needed())
DBUG_RETURN(-1);
- if (my_write(update_temp_file, (byte*)buffer.ptr(), size,
+ if (my_write(update_temp_file, (uchar*)buffer.ptr(), size,
MYF(MY_WME | MY_NABP)))
DBUG_RETURN(-1);
@@ -954,7 +954,7 @@ int ha_tina::update_row(const byte * old_data, byte * new_data)
The table will then be deleted/positioned based on the ORDER (so RANDOM,
DESC, ASC).
*/
-int ha_tina::delete_row(const byte * buf)
+int ha_tina::delete_row(const uchar * buf)
{
DBUG_ENTER("ha_tina::delete_row");
ha_statistic_increment(&SSV::ha_delete_count);
@@ -1033,7 +1033,7 @@ int ha_tina::rnd_init(bool scan)
NULL and "". This is ok since this table handler is for spreadsheets and
they don't know about them either :)
*/
-int ha_tina::rnd_next(byte *buf)
+int ha_tina::rnd_next(uchar *buf)
{
int rc;
DBUG_ENTER("ha_tina::rnd_next");
@@ -1065,7 +1065,7 @@ int ha_tina::rnd_next(byte *buf)
its just a position. Look at the bdb code if you want to see a case
where something other then a number is stored.
*/
-void ha_tina::position(const byte *record)
+void ha_tina::position(const uchar *record)
{
DBUG_ENTER("ha_tina::position");
my_store_ptr(ref, ref_length, current_position);
@@ -1078,7 +1078,7 @@ void ha_tina::position(const byte *record)
my_get_ptr() retrieves the data for you.
*/
-int ha_tina::rnd_pos(byte * buf, byte *pos)
+int ha_tina::rnd_pos(uchar * buf, uchar *pos)
{
DBUG_ENTER("ha_tina::rnd_pos");
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
@@ -1178,7 +1178,7 @@ int ha_tina::rnd_end()
/* if there is something to write, write it */
if ((write_end - write_begin) &&
(my_write(update_temp_file,
- (byte*)(file_buff->ptr() +
+ (uchar*)(file_buff->ptr() +
(write_begin - file_buff->start())),
write_end - write_begin, MYF_RW)))
goto error;
@@ -1266,7 +1266,7 @@ error:
int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
{
char repaired_fname[FN_REFLEN];
- byte *buf;
+ uchar *buf;
File repair_file;
int rc;
ha_rows rows_repaired= 0;
@@ -1282,7 +1282,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
/* Don't assert in field::val() functions */
table->use_all_columns();
- if (!(buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME))))
+ if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
/* position buffer to the start of the file */
@@ -1338,7 +1338,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
{
write_end= min(file_buff->end(), current_position);
if ((write_end - write_begin) &&
- (my_write(repair_file, (byte*)file_buff->ptr(),
+ (my_write(repair_file, (uchar*)file_buff->ptr(),
write_end - write_begin, MYF_RW)))
DBUG_RETURN(-1);
@@ -1442,13 +1442,13 @@ int ha_tina::create(const char *name, TABLE *table_arg,
int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt)
{
int rc= 0;
- byte *buf;
+ uchar *buf;
const char *old_proc_info;
ha_rows count= share->rows_recorded;
DBUG_ENTER("ha_tina::check");
old_proc_info= thd_proc_info(thd, "Checking table");
- if (!(buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME))))
+ if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
/* position buffer to the start of the file */
diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h
index c096f21fca2..ecb7f006cc4 100644
--- a/storage/csv/ha_tina.h
+++ b/storage/csv/ha_tina.h
@@ -63,7 +63,7 @@ class ha_tina: public handler
off_t current_position; /* Current position in the file during a file scan */
off_t next_position; /* Next position in the file scan */
off_t local_saved_data_file_length; /* save position for reads */
- byte byte_buffer[IO_SIZE];
+ uchar byte_buffer[IO_SIZE];
Transparent_file *file_buff;
File data_file; /* File handler for readers */
File update_temp_file;
@@ -76,7 +76,7 @@ class ha_tina: public handler
tina_set chain_buffer[DEFAULT_CHAIN_LENGTH];
tina_set *chain;
tina_set *chain_ptr;
- byte chain_alloced;
+ uchar chain_alloced;
uint32 chain_size;
bool records_is_known;
@@ -90,7 +90,7 @@ public:
~ha_tina()
{
if (chain_alloced)
- my_free((gptr)chain, 0);
+ my_free(chain, 0);
if (file_buff)
delete file_buff;
}
@@ -133,12 +133,12 @@ public:
bool called_by_logger_thread);
int open(const char *name, int mode, uint open_options);
int close(void);
- int write_row(byte * buf);
- int update_row(const byte * old_data, byte * new_data);
- int delete_row(const byte * buf);
+ int write_row(uchar * buf);
+ int update_row(const uchar * old_data, uchar * new_data);
+ int delete_row(const uchar * buf);
int rnd_init(bool scan=1);
- int rnd_next(byte *buf);
- int rnd_pos(byte * buf, byte *pos);
+ int rnd_next(uchar *buf);
+ int rnd_pos(uchar * buf, uchar *pos);
bool check_and_repair(THD *thd);
int check(THD* thd, HA_CHECK_OPT* check_opt);
bool is_crashed() const;
@@ -146,7 +146,7 @@ public:
int repair(THD* thd, HA_CHECK_OPT* check_opt);
/* This is required for SQL layer to know that we support autorepair */
bool auto_repair() const { return 1; }
- void position(const byte *record);
+ void position(const uchar *record);
int info(uint);
int extra(enum ha_extra_function operation);
int delete_all_rows(void);
@@ -165,8 +165,8 @@ public:
void update_status();
/* The following methods were added just for TINA */
- int encode_quote(byte *buf);
- int find_current_row(byte *buf);
+ int encode_quote(uchar *buf);
+ int find_current_row(uchar *buf);
int chain_append();
};
diff --git a/storage/csv/transparent_file.cc b/storage/csv/transparent_file.cc
index 27cc8c024b4..a200fa6ac36 100644
--- a/storage/csv/transparent_file.cc
+++ b/storage/csv/transparent_file.cc
@@ -22,12 +22,12 @@
Transparent_file::Transparent_file() : lower_bound(0), buff_size(IO_SIZE)
{
- buff= (byte *) my_malloc(buff_size*sizeof(byte), MYF(MY_WME));
+ buff= (uchar *) my_malloc(buff_size*sizeof(uchar), MYF(MY_WME));
}
Transparent_file::~Transparent_file()
{
- my_free((gptr)buff, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*)buff, MYF(MY_ALLOW_ZERO_PTR));
}
void Transparent_file::init_buff(File filedes_arg)
@@ -40,7 +40,7 @@ void Transparent_file::init_buff(File filedes_arg)
upper_bound= my_read(filedes, buff, buff_size, MYF(0));
}
-byte *Transparent_file::ptr()
+uchar *Transparent_file::ptr()
{
return buff;
}
@@ -57,18 +57,18 @@ off_t Transparent_file::end()
off_t Transparent_file::read_next()
{
- off_t bytes_read;
+ size_t bytes_read;
/*
No need to seek here, as the file managed by Transparent_file class
always points to upper_bound byte
*/
if ((bytes_read= my_read(filedes, buff, buff_size, MYF(0))) == MY_FILE_ERROR)
- return -1;
+ return (off_t) -1;
/* end of file */
if (!bytes_read)
- return -1;
+ return (off_t) -1;
lower_bound= upper_bound;
upper_bound+= bytes_read;
@@ -79,26 +79,24 @@ off_t Transparent_file::read_next()
char Transparent_file::get_value(off_t offset)
{
- off_t bytes_read;
+ size_t bytes_read;
/* check boundaries */
if ((lower_bound <= offset) && (offset < upper_bound))
return buff[offset - lower_bound];
- else
- {
- VOID(my_seek(filedes, offset, MY_SEEK_SET, MYF(0)));
- /* read appropriate portion of the file */
- if ((bytes_read= my_read(filedes, buff, buff_size,
- MYF(0))) == MY_FILE_ERROR)
- return 0;
-
- lower_bound= offset;
- upper_bound= lower_bound + bytes_read;
-
- /* end of file */
- if (upper_bound == offset)
- return 0;
-
- return buff[0];
- }
+
+ VOID(my_seek(filedes, offset, MY_SEEK_SET, MYF(0)));
+ /* read appropriate portion of the file */
+ if ((bytes_read= my_read(filedes, buff, buff_size,
+ MYF(0))) == MY_FILE_ERROR)
+ return 0;
+
+ lower_bound= offset;
+ upper_bound= lower_bound + bytes_read;
+
+ /* end of file */
+ if (upper_bound == offset)
+ return 0;
+
+ return buff[0];
}
diff --git a/storage/csv/transparent_file.h b/storage/csv/transparent_file.h
index ceb59ec7caf..4c0f4cce7e7 100644
--- a/storage/csv/transparent_file.h
+++ b/storage/csv/transparent_file.h
@@ -21,7 +21,7 @@
class Transparent_file
{
File filedes;
- byte *buff; /* in-memory window to the file or mmaped area */
+ uchar *buff; /* in-memory window to the file or mmaped area */
/* current window sizes */
off_t lower_bound;
off_t upper_bound;
@@ -33,7 +33,7 @@ public:
~Transparent_file();
void init_buff(File filedes_arg);
- byte *ptr();
+ uchar *ptr();
off_t start();
off_t end();
char get_value (off_t offset);
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index a4cdcafc6d0..45433fd58ce 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -114,11 +114,11 @@ pthread_mutex_t example_mutex;
Function we use in the creation of our hash to get key.
*/
-static byte* example_get_key(EXAMPLE_SHARE *share,uint *length,
+static uchar* example_get_key(EXAMPLE_SHARE *share,uint *length,
my_bool not_used __attribute__((unused)))
{
*length=share->table_name_length;
- return (byte*) share->table_name;
+ return (uchar*) share->table_name;
}
@@ -172,7 +172,7 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table)
length=(uint) strlen(table_name);
if (!(share=(EXAMPLE_SHARE*) hash_search(&example_open_tables,
- (byte*) table_name,
+ (uchar*) table_name,
length)))
{
if (!(share=(EXAMPLE_SHARE *)
@@ -189,7 +189,7 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table)
share->table_name_length=length;
share->table_name=tmp_name;
strmov(share->table_name,table_name);
- if (my_hash_insert(&example_open_tables, (byte*) share))
+ if (my_hash_insert(&example_open_tables, (uchar*) share))
goto error;
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
@@ -201,7 +201,7 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table)
error:
pthread_mutex_destroy(&share->mutex);
- my_free((gptr) share, MYF(0));
+ my_free(share, MYF(0));
return NULL;
}
@@ -218,10 +218,10 @@ static int free_share(EXAMPLE_SHARE *share)
pthread_mutex_lock(&example_mutex);
if (!--share->use_count)
{
- hash_delete(&example_open_tables, (byte*) share);
+ hash_delete(&example_open_tables, (uchar*) share);
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
- my_free((gptr) share, MYF(0));
+ my_free(share, MYF(0));
}
pthread_mutex_unlock(&example_mutex);
@@ -349,7 +349,7 @@ int ha_example::close(void)
sql_insert.cc, sql_select.cc, sql_table.cc, sql_udf.cc and sql_update.cc
*/
-int ha_example::write_row(byte * buf)
+int ha_example::write_row(uchar *buf)
{
DBUG_ENTER("ha_example::write_row");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
@@ -378,7 +378,7 @@ int ha_example::write_row(byte * buf)
@see
sql_select.cc, sql_acl.cc, sql_update.cc and sql_insert.cc
*/
-int ha_example::update_row(const byte * old_data, byte * new_data)
+int ha_example::update_row(const uchar *old_data, uchar *new_data)
{
DBUG_ENTER("ha_example::update_row");
@@ -406,7 +406,7 @@ int ha_example::update_row(const byte * old_data, byte * new_data)
sql_acl.cc, sql_udf.cc, sql_delete.cc, sql_insert.cc and sql_select.cc
*/
-int ha_example::delete_row(const byte * buf)
+int ha_example::delete_row(const uchar *buf)
{
DBUG_ENTER("ha_example::delete_row");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
@@ -420,7 +420,7 @@ int ha_example::delete_row(const byte * buf)
index.
*/
-int ha_example::index_read(byte * buf, const byte * key,
+int ha_example::index_read(uchar *buf, const uchar *key,
key_part_map keypart_map __attribute__((unused)),
enum ha_rkey_function find_flag
__attribute__((unused)))
@@ -435,7 +435,7 @@ int ha_example::index_read(byte * buf, const byte * key,
Used to read forward through the index.
*/
-int ha_example::index_next(byte * buf)
+int ha_example::index_next(uchar *buf)
{
DBUG_ENTER("ha_example::index_next");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
@@ -447,7 +447,7 @@ int ha_example::index_next(byte * buf)
Used to read backwards through the index.
*/
-int ha_example::index_prev(byte * buf)
+int ha_example::index_prev(uchar *buf)
{
DBUG_ENTER("ha_example::index_prev");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
@@ -464,7 +464,7 @@ int ha_example::index_prev(byte * buf)
@see
opt_range.cc, opt_sum.cc, sql_handler.cc and sql_select.cc
*/
-int ha_example::index_first(byte * buf)
+int ha_example::index_first(uchar *buf)
{
DBUG_ENTER("ha_example::index_first");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
@@ -481,7 +481,7 @@ int ha_example::index_first(byte * buf)
@see
opt_range.cc, opt_sum.cc, sql_handler.cc and sql_select.cc
*/
-int ha_example::index_last(byte * buf)
+int ha_example::index_last(uchar *buf)
{
DBUG_ENTER("ha_example::index_last");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
@@ -528,7 +528,7 @@ int ha_example::rnd_end()
@see
filesort.cc, records.cc, sql_handler.cc, sql_select.cc, sql_table.cc and sql_update.cc
*/
-int ha_example::rnd_next(byte *buf)
+int ha_example::rnd_next(uchar *buf)
{
DBUG_ENTER("ha_example::rnd_next");
DBUG_RETURN(HA_ERR_END_OF_FILE);
@@ -556,7 +556,7 @@ int ha_example::rnd_next(byte *buf)
@see
filesort.cc, sql_select.cc, sql_delete.cc and sql_update.cc
*/
-void ha_example::position(const byte *record)
+void ha_example::position(const uchar *record)
{
DBUG_ENTER("ha_example::position");
DBUG_VOID_RETURN;
@@ -576,7 +576,7 @@ void ha_example::position(const byte *record)
@see
filesort.cc, records.cc, sql_insert.cc, sql_select.cc and sql_update.cc
*/
-int ha_example::rnd_pos(byte * buf, byte *pos)
+int ha_example::rnd_pos(uchar *buf, uchar *pos)
{
DBUG_ENTER("ha_example::rnd_pos");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
diff --git a/storage/example/ha_example.h b/storage/example/ha_example.h
index 9777a478209..69b7cf4d336 100644
--- a/storage/example/ha_example.h
+++ b/storage/example/ha_example.h
@@ -172,50 +172,50 @@ public:
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int write_row(byte * buf);
+ int write_row(uchar *buf);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int update_row(const byte * old_data, byte * new_data);
+ int update_row(const uchar *old_data, uchar *new_data);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int delete_row(const byte * buf);
+ int delete_row(const uchar *buf);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int index_read(byte * buf, const byte * key,
+ int index_read(uchar *buf, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function find_flag);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int index_next(byte * buf);
+ int index_next(uchar *buf);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int index_prev(byte * buf);
+ int index_prev(uchar *buf);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int index_first(byte * buf);
+ int index_first(uchar *buf);
/** @brief
We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented.
*/
- int index_last(byte * buf);
+ int index_last(uchar *buf);
/** @brief
Unlike index_init(), rnd_init() can be called two consecutive times
@@ -227,9 +227,9 @@ public:
*/
int rnd_init(bool scan); //required
int rnd_end();
- int rnd_next(byte *buf); ///< required
- int rnd_pos(byte * buf, byte *pos); ///< required
- void position(const byte *record); ///< required
+ int rnd_next(uchar *buf); ///< required
+ int rnd_pos(uchar *buf, uchar *pos); ///< required
+ void position(const uchar *record); ///< required
int info(uint); ///< required
int extra(enum ha_extra_function operation);
int external_lock(THD *thd, int lock_type); ///< required
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index aa7184268f5..103cb9b4cb0 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -414,11 +414,11 @@ static handler *federated_create_handler(handlerton *hton,
/* Function we use in the creation of our hash to get key */
-static byte *federated_get_key(FEDERATED_SHARE *share, uint *length,
+static uchar *federated_get_key(FEDERATED_SHARE *share, size_t *length,
my_bool not_used __attribute__ ((unused)))
{
*length= share->share_key_length;
- return (byte*) share->share_key;
+ return (uchar*) share->share_key;
}
/*
@@ -725,8 +725,8 @@ static int parse_url(MEM_ROOT *mem_root, FEDERATED_SHARE *share, TABLE *table,
share->port= 0;
share->socket= 0;
DBUG_PRINT("info", ("share at %lx", (long unsigned int) share));
- DBUG_PRINT("info", ("Length: %d", table->s->connect_string.length));
- DBUG_PRINT("info", ("String: '%.*s'", table->s->connect_string.length,
+ DBUG_PRINT("info", ("Length: %u", (uint) table->s->connect_string.length));
+ DBUG_PRINT("info", ("String: '%.*s'", (int) table->s->connect_string.length,
table->s->connect_string.str));
share->connection_string= strmake_root(mem_root, table->s->connect_string.str,
table->s->connect_string.length);
@@ -930,7 +930,7 @@ ha_federated::ha_federated(handlerton *hton,
0 After fields have had field values stored from record
*/
-uint ha_federated::convert_row_to_internal_format(byte *record,
+uint ha_federated::convert_row_to_internal_format(uchar *record,
MYSQL_ROW row,
MYSQL_RES *result)
{
@@ -978,7 +978,7 @@ static bool emit_key_part_name(String *to, KEY_PART_INFO *part)
static bool emit_key_part_element(String *to, KEY_PART_INFO *part,
bool needs_quotes, bool is_like,
- const byte *ptr, uint len)
+ const uchar *ptr, uint len)
{
Field *field= part->field;
DBUG_ENTER("emit_key_part_element");
@@ -1019,7 +1019,7 @@ static bool emit_key_part_element(String *to, KEY_PART_INFO *part,
char strbuff[MAX_FIELD_WIDTH];
String str(strbuff, sizeof(strbuff), part->field->charset()), *res;
- res= field->val_str(&str, (char *)ptr);
+ res= field->val_str(&str, ptr);
if (field->result_type() == STRING_RESULT)
{
@@ -1286,7 +1286,7 @@ bool ha_federated::create_where_from_key(String *to,
{
bool both_not_null=
(start_key != NULL && end_key != NULL) ? TRUE : FALSE;
- const byte *ptr;
+ const uchar *ptr;
uint remainder, length;
char tmpbuff[FEDERATED_QUERY_BUFFER_SIZE];
String tmp(tmpbuff, sizeof(tmpbuff), system_charset_info);
@@ -1325,7 +1325,7 @@ bool ha_federated::create_where_from_key(String *to,
uint store_length= key_part->store_length;
uint part_length= min(store_length, length);
needs_quotes= field->str_needs_quotes();
- DBUG_DUMP("key, start of loop", (char *) ptr, length);
+ DBUG_DUMP("key, start of loop", ptr, length);
if (key_part->null_bit)
{
@@ -1507,7 +1507,7 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table)
/* TODO: change tmp_share.scheme to LEX_STRING object */
if (!(share= (FEDERATED_SHARE *) hash_search(&federated_open_tables,
- (byte*) tmp_share.share_key,
+ (uchar*) tmp_share.share_key,
tmp_share.
share_key_length)))
{
@@ -1537,7 +1537,7 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table)
DBUG_PRINT("info",
("share->select_query %s", share->select_query));
- if (my_hash_insert(&federated_open_tables, (byte*) share))
+ if (my_hash_insert(&federated_open_tables, (uchar*) share))
goto error;
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST);
@@ -1571,7 +1571,7 @@ static int free_share(FEDERATED_SHARE *share)
pthread_mutex_lock(&federated_mutex);
if (!--share->use_count)
{
- hash_delete(&federated_open_tables, (byte*) share);
+ hash_delete(&federated_open_tables, (uchar*) share);
thr_lock_delete(&share->lock);
VOID(pthread_mutex_destroy(&share->mutex));
free_root(&mem_root, MYF(0));
@@ -1755,7 +1755,7 @@ static inline uint field_in_record_is_null(TABLE *table,
sql_insert.cc, sql_select.cc, sql_table.cc, sql_udf.cc, and sql_update.cc.
*/
-int ha_federated::write_row(byte *buf)
+int ha_federated::write_row(uchar *buf)
{
/*
I need a bool again, in 5.0, I used table->s->fields to accomplish this.
@@ -2010,7 +2010,7 @@ int ha_federated::repair(THD* thd, HA_CHECK_OPT* check_opt)
Called from sql_select.cc, sql_acl.cc, sql_update.cc, and sql_insert.cc.
*/
-int ha_federated::update_row(const byte *old_data, byte *new_data)
+int ha_federated::update_row(const uchar *old_data, uchar *new_data)
{
/*
This used to control how the query was built. If there was a
@@ -2044,7 +2044,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
String where_string(where_buffer,
sizeof(where_buffer),
&my_charset_bin);
- byte *record= table->record[0];
+ uchar *record= table->record[0];
DBUG_ENTER("ha_federated::update_row");
/*
set string lengths to 0 to avoid misc chars in string
@@ -2103,7 +2103,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
bool needs_quote= (*field)->str_needs_quotes();
where_string.append(STRING_WITH_LEN(" = "));
(*field)->val_str(&field_value,
- (char*) (old_data + (*field)->offset(record)));
+ (old_data + (*field)->offset(record)));
if (needs_quote)
where_string.append('\'');
field_value.print(&where_string);
@@ -2155,7 +2155,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
calls.
*/
-int ha_federated::delete_row(const byte *buf)
+int ha_federated::delete_row(const uchar *buf)
{
char delete_buffer[FEDERATED_QUERY_BUFFER_SIZE];
char data_buffer[FEDERATED_QUERY_BUFFER_SIZE];
@@ -2225,7 +2225,7 @@ int ha_federated::delete_row(const byte *buf)
a WHERE clause on a non-primary key index, simply calls index_read_idx.
*/
-int ha_federated::index_read(byte *buf, const byte *key,
+int ha_federated::index_read(uchar *buf, const uchar *key,
uint key_len, ha_rkey_function find_flag)
{
DBUG_ENTER("ha_federated::index_read");
@@ -2251,7 +2251,7 @@ int ha_federated::index_read(byte *buf, const byte *key,
returns. We need to be able to be calable from ha_rnd_pos()
*/
-int ha_federated::index_read_idx(byte *buf, uint index, const byte *key,
+int ha_federated::index_read_idx(uchar *buf, uint index, const uchar *key,
uint key_len, enum ha_rkey_function find_flag)
{
int retval;
@@ -2277,8 +2277,8 @@ int ha_federated::index_read_idx(byte *buf, uint index, const byte *key,
table->status == STATUS_NOT_FOUND
*/
-int ha_federated::index_read_idx_with_result_set(byte *buf, uint index,
- const byte *key,
+int ha_federated::index_read_idx_with_result_set(uchar *buf, uint index,
+ const uchar *key,
uint key_len,
ha_rkey_function find_flag,
MYSQL_RES **result)
@@ -2411,7 +2411,7 @@ int ha_federated::read_range_next()
/* Used to read forward through the index. */
-int ha_federated::index_next(byte *buf)
+int ha_federated::index_next(uchar *buf)
{
DBUG_ENTER("ha_federated::index_next");
statistic_increment(table->in_use->status_var.ha_read_next_count,
@@ -2525,7 +2525,7 @@ int ha_federated::index_end(void)
sql_table.cc, and sql_update.cc.
*/
-int ha_federated::rnd_next(byte *buf)
+int ha_federated::rnd_next(uchar *buf)
{
DBUG_ENTER("ha_federated::rnd_next");
@@ -2562,7 +2562,7 @@ int ha_federated::rnd_next(byte *buf)
0 no error
*/
-int ha_federated::read_next(byte *buf, MYSQL_RES *result)
+int ha_federated::read_next(uchar *buf, MYSQL_RES *result)
{
int retval;
MYSQL_ROW row;
@@ -2591,11 +2591,11 @@ int ha_federated::read_next(byte *buf, MYSQL_RES *result)
Called from filesort.cc, sql_select.cc, sql_delete.cc and sql_update.cc.
*/
-void ha_federated::position(const byte *record)
+void ha_federated::position(const uchar *record)
{
DBUG_ENTER("ha_federated::position");
if (table->s->primary_key != MAX_KEY)
- key_copy(ref, (byte *)record, table->key_info + table->s->primary_key,
+ key_copy(ref, (uchar *)record, table->key_info + table->s->primary_key,
ref_length);
else
memcpy(ref, record, ref_length);
@@ -2612,7 +2612,7 @@ void ha_federated::position(const byte *record)
Called from filesort.cc records.cc sql_insert.cc sql_select.cc sql_update.cc.
*/
-int ha_federated::rnd_pos(byte *buf, byte *pos)
+int ha_federated::rnd_pos(uchar *buf, uchar *pos)
{
int result;
DBUG_ENTER("ha_federated::rnd_pos");
diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h
index 4d2eefdd986..94f61af96c3 100644
--- a/storage/federated/ha_federated.h
+++ b/storage/federated/ha_federated.h
@@ -94,7 +94,7 @@ private:
return 0 on success
return errorcode otherwise
*/
- uint convert_row_to_internal_format(byte *buf, MYSQL_ROW row,
+ uint convert_row_to_internal_format(uchar *buf, MYSQL_ROW row,
MYSQL_RES *result);
bool create_where_from_key(String *to, KEY *key_info,
const key_range *start_key,
@@ -188,15 +188,15 @@ public:
int open(const char *name, int mode, uint test_if_locked); // required
int close(void); // required
- int write_row(byte *buf);
- int update_row(const byte *old_data, byte *new_data);
- int delete_row(const byte *buf);
+ int write_row(uchar *buf);
+ int update_row(const uchar *old_data, uchar *new_data);
+ int delete_row(const uchar *buf);
int index_init(uint keynr, bool sorted);
- int index_read(byte *buf, const byte *key,
+ int index_read(uchar *buf, const uchar *key,
uint key_len, enum ha_rkey_function find_flag);
- int index_read_idx(byte *buf, uint idx, const byte *key,
+ int index_read_idx(uchar *buf, uint idx, const uchar *key,
uint key_len, enum ha_rkey_function find_flag);
- int index_next(byte *buf);
+ int index_next(uchar *buf);
int index_end();
int read_range_first(const key_range *start_key,
const key_range *end_key,
@@ -212,9 +212,9 @@ public:
*/
int rnd_init(bool scan); //required
int rnd_end();
- int rnd_next(byte *buf); //required
- int rnd_pos(byte *buf, byte *pos); //required
- void position(const byte *record); //required
+ int rnd_next(uchar *buf); //required
+ int rnd_pos(uchar *buf, uchar *pos); //required
+ void position(const uchar *record); //required
int info(uint); //required
void update_auto_increment(void);
@@ -237,9 +237,9 @@ public:
int connection_autocommit(bool state);
int execute_simple_query(const char *query, int len);
- int read_next(byte *buf, MYSQL_RES *result);
- int index_read_idx_with_result_set(byte *buf, uint index,
- const byte *key,
+ int read_next(uchar *buf, MYSQL_RES *result);
+ int index_read_idx_with_result_set(uchar *buf, uint index,
+ const uchar *key,
uint key_len,
ha_rkey_function find_flag,
MYSQL_RES **result);
diff --git a/storage/heap/_check.c b/storage/heap/_check.c
index 05f12dade0d..08b6da62ae1 100644
--- a/storage/heap/_check.c
+++ b/storage/heap/_check.c
@@ -167,7 +167,7 @@ static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records,
HP_KEYDEF *keydef= info->s->keydef + keynr;
int error= 0;
ulong found= 0;
- byte *key, *recpos;
+ uchar *key, *recpos;
uint key_length;
uint not_used[2];
@@ -176,7 +176,7 @@ static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records,
{
do
{
- memcpy(&recpos, key + (*keydef->get_key_length)(keydef,key), sizeof(byte*));
+ memcpy(&recpos, key + (*keydef->get_key_length)(keydef,key), sizeof(uchar*));
key_length= hp_rb_make_key(keydef, info->recbuf, recpos, 0);
if (ha_key_cmp(keydef->seg, (uchar*) info->recbuf, (uchar*) key,
key_length, SEARCH_FIND | SEARCH_SAME, not_used))
diff --git a/storage/heap/_rectest.c b/storage/heap/_rectest.c
index 2fd2d39bed7..068fedf719c 100644
--- a/storage/heap/_rectest.c
+++ b/storage/heap/_rectest.c
@@ -18,7 +18,7 @@
#include "heapdef.h"
-int hp_rectest(register HP_INFO *info, register const byte *old)
+int hp_rectest(register HP_INFO *info, register const uchar *old)
{
DBUG_ENTER("hp_rectest");
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index 8c378f7334f..ec52d6f835c 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -178,7 +178,7 @@ void ha_heap::update_key_stats()
}
-int ha_heap::write_row(byte * buf)
+int ha_heap::write_row(uchar * buf)
{
int res;
statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status);
@@ -202,7 +202,7 @@ int ha_heap::write_row(byte * buf)
return res;
}
-int ha_heap::update_row(const byte * old_data, byte * new_data)
+int ha_heap::update_row(const uchar * old_data, uchar * new_data)
{
int res;
statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status);
@@ -221,7 +221,7 @@ int ha_heap::update_row(const byte * old_data, byte * new_data)
return res;
}
-int ha_heap::delete_row(const byte * buf)
+int ha_heap::delete_row(const uchar * buf)
{
int res;
statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status);
@@ -238,7 +238,7 @@ int ha_heap::delete_row(const byte * buf)
return res;
}
-int ha_heap::index_read(byte * buf, const byte * key, key_part_map keypart_map,
+int ha_heap::index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
DBUG_ASSERT(inited==INDEX);
@@ -249,7 +249,7 @@ int ha_heap::index_read(byte * buf, const byte * key, key_part_map keypart_map,
return error;
}
-int ha_heap::index_read_last(byte *buf, const byte *key, key_part_map keypart_map)
+int ha_heap::index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_key_count,
@@ -260,7 +260,7 @@ int ha_heap::index_read_last(byte *buf, const byte *key, key_part_map keypart_ma
return error;
}
-int ha_heap::index_read_idx(byte * buf, uint index, const byte * key,
+int ha_heap::index_read_idx(uchar * buf, uint index, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -271,7 +271,7 @@ int ha_heap::index_read_idx(byte * buf, uint index, const byte * key,
return error;
}
-int ha_heap::index_next(byte * buf)
+int ha_heap::index_next(uchar * buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_next_count,
@@ -281,7 +281,7 @@ int ha_heap::index_next(byte * buf)
return error;
}
-int ha_heap::index_prev(byte * buf)
+int ha_heap::index_prev(uchar * buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_prev_count,
@@ -291,7 +291,7 @@ int ha_heap::index_prev(byte * buf)
return error;
}
-int ha_heap::index_first(byte * buf)
+int ha_heap::index_first(uchar * buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_first_count,
@@ -301,7 +301,7 @@ int ha_heap::index_first(byte * buf)
return error;
}
-int ha_heap::index_last(byte * buf)
+int ha_heap::index_last(uchar * buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_last_count,
@@ -316,7 +316,7 @@ int ha_heap::rnd_init(bool scan)
return scan ? heap_scan_init(file) : 0;
}
-int ha_heap::rnd_next(byte *buf)
+int ha_heap::rnd_next(uchar *buf)
{
statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
&LOCK_status);
@@ -325,7 +325,7 @@ int ha_heap::rnd_next(byte *buf)
return error;
}
-int ha_heap::rnd_pos(byte * buf, byte *pos)
+int ha_heap::rnd_pos(uchar * buf, uchar *pos)
{
int error;
HEAP_PTR heap_position;
@@ -337,7 +337,7 @@ int ha_heap::rnd_pos(byte * buf, byte *pos)
return error;
}
-void ha_heap::position(const byte *record)
+void ha_heap::position(const uchar *record)
{
*(HEAP_PTR*) ref= heap_position(file); // Ref is aligned
}
@@ -677,7 +677,7 @@ int ha_heap::create(const char *name, TABLE *table_arg,
share->max_rows) ?
share->max_rows : max_rows),
(ulong) share->min_rows, &hp_create_info);
- my_free((gptr) keydef, MYF(0));
+ my_free((uchar*) keydef, MYF(0));
if (file)
info(HA_STATUS_NO_LOCK | HA_STATUS_CONST | HA_STATUS_VARIABLE);
return (error);
diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h
index a2d531fc515..c93a33b524b 100644
--- a/storage/heap/ha_heap.h
+++ b/storage/heap/ha_heap.h
@@ -68,26 +68,26 @@ public:
int open(const char *name, int mode, uint test_if_locked);
int close(void);
void set_keys_for_scanning(void);
- int write_row(byte * buf);
- int update_row(const byte * old_data, byte * new_data);
- int delete_row(const byte * buf);
+ int write_row(uchar * buf);
+ int update_row(const uchar * old_data, uchar * new_data);
+ int delete_row(const uchar * buf);
virtual void get_auto_increment(ulonglong offset, ulonglong increment,
ulonglong nb_desired_values,
ulonglong *first_value,
ulonglong *nb_reserved_values);
- int index_read(byte * buf, const byte * key, key_part_map keypart_map,
+ int index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
enum ha_rkey_function find_flag);
- int index_read_last(byte *buf, const byte *key, key_part_map keypart_map);
- int index_read_idx(byte * buf, uint index, const byte * key,
+ int index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map);
+ int index_read_idx(uchar * buf, uint index, const uchar * key,
key_part_map keypart_map, enum ha_rkey_function find_flag);
- int index_next(byte * buf);
- int index_prev(byte * buf);
- int index_first(byte * buf);
- int index_last(byte * buf);
+ int index_next(uchar * buf);
+ int index_prev(uchar * buf);
+ int index_first(uchar * buf);
+ int index_last(uchar * buf);
int rnd_init(bool scan);
- int rnd_next(byte *buf);
- int rnd_pos(byte * buf, byte *pos);
- void position(const byte *record);
+ int rnd_next(uchar *buf);
+ int rnd_pos(uchar * buf, uchar *pos);
+ void position(const uchar *record);
int info(uint);
int extra(enum ha_extra_function operation);
int reset();
@@ -105,7 +105,7 @@ public:
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type);
- int cmp_ref(const byte *ref1, const byte *ref2)
+ int cmp_ref(const uchar *ref1, const uchar *ref2)
{
HEAP_PTR ptr1=*(HEAP_PTR*)ref1;
HEAP_PTR ptr2=*(HEAP_PTR*)ref2;
diff --git a/storage/heap/heapdef.h b/storage/heap/heapdef.h
index b52a6c60ac6..c43d73eb96d 100644
--- a/storage/heap/heapdef.h
+++ b/storage/heap/heapdef.h
@@ -48,7 +48,7 @@ if (!(info->update & HA_STATE_AKTIV))\
typedef struct st_hp_hash_info
{
struct st_hp_hash_info *next_key;
- byte *ptr_to_rec;
+ uchar *ptr_to_rec;
} HASH_INFO;
typedef struct {
@@ -60,42 +60,42 @@ typedef struct {
/* Prototypes for intern functions */
extern HP_SHARE *hp_find_named_heap(const char *name);
-extern int hp_rectest(HP_INFO *info,const byte *old);
-extern byte *hp_find_block(HP_BLOCK *info,ulong pos);
-extern int hp_get_new_block(HP_BLOCK *info, ulong* alloc_length);
+extern int hp_rectest(HP_INFO *info,const uchar *old);
+extern uchar *hp_find_block(HP_BLOCK *info,ulong pos);
+extern int hp_get_new_block(HP_BLOCK *info, size_t* alloc_length);
extern void hp_free(HP_SHARE *info);
-extern byte *hp_free_level(HP_BLOCK *block,uint level,HP_PTRS *pos,
- byte *last_pos);
+extern uchar *hp_free_level(HP_BLOCK *block,uint level,HP_PTRS *pos,
+ uchar *last_pos);
extern int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
- const byte *record, byte *recpos);
+ const uchar *record, uchar *recpos);
extern int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
- const byte *record, byte *recpos);
+ const uchar *record, uchar *recpos);
extern int hp_rb_delete_key(HP_INFO *info,HP_KEYDEF *keyinfo,
- const byte *record,byte *recpos,int flag);
+ const uchar *record,uchar *recpos,int flag);
extern int hp_delete_key(HP_INFO *info,HP_KEYDEF *keyinfo,
- const byte *record,byte *recpos,int flag);
+ const uchar *record,uchar *recpos,int flag);
extern HASH_INFO *_heap_find_hash(HP_BLOCK *block,ulong pos);
-extern byte *hp_search(HP_INFO *info,HP_KEYDEF *keyinfo,const byte *key,
+extern uchar *hp_search(HP_INFO *info,HP_KEYDEF *keyinfo,const uchar *key,
uint nextflag);
-extern byte *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo,
- const byte *key, HASH_INFO *pos);
-extern ulong hp_hashnr(HP_KEYDEF *keyinfo,const byte *key);
-extern ulong hp_rec_hashnr(HP_KEYDEF *keyinfo,const byte *rec);
+extern uchar *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo,
+ const uchar *key, HASH_INFO *pos);
+extern ulong hp_hashnr(HP_KEYDEF *keyinfo,const uchar *key);
+extern ulong hp_rec_hashnr(HP_KEYDEF *keyinfo,const uchar *rec);
extern ulong hp_mask(ulong hashnr,ulong buffmax,ulong maxlength);
extern void hp_movelink(HASH_INFO *pos,HASH_INFO *next_link,
HASH_INFO *newlink);
-extern int hp_rec_key_cmp(HP_KEYDEF *keydef,const byte *rec1,
- const byte *rec2,
+extern int hp_rec_key_cmp(HP_KEYDEF *keydef,const uchar *rec1,
+ const uchar *rec2,
my_bool diff_if_only_endspace_difference);
-extern int hp_key_cmp(HP_KEYDEF *keydef,const byte *rec,
- const byte *key);
-extern void hp_make_key(HP_KEYDEF *keydef,byte *key,const byte *rec);
-extern uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
- const byte *rec, byte *recpos);
-extern uint hp_rb_key_length(HP_KEYDEF *keydef, const byte *key);
-extern uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key);
-extern uint hp_rb_var_key_length(HP_KEYDEF *keydef, const byte *key);
-extern my_bool hp_if_null_in_key(HP_KEYDEF *keyinfo, const byte *record);
+extern int hp_key_cmp(HP_KEYDEF *keydef,const uchar *rec,
+ const uchar *key);
+extern void hp_make_key(HP_KEYDEF *keydef,uchar *key,const uchar *rec);
+extern uint hp_rb_make_key(HP_KEYDEF *keydef, uchar *key,
+ const uchar *rec, uchar *recpos);
+extern uint hp_rb_key_length(HP_KEYDEF *keydef, const uchar *key);
+extern uint hp_rb_null_key_length(HP_KEYDEF *keydef, const uchar *key);
+extern uint hp_rb_var_key_length(HP_KEYDEF *keydef, const uchar *key);
+extern my_bool hp_if_null_in_key(HP_KEYDEF *keyinfo, const uchar *record);
extern int hp_close(register HP_INFO *info);
extern void hp_clear(HP_SHARE *info);
extern void hp_clear_keys(HP_SHARE *info);
diff --git a/storage/heap/hp_block.c b/storage/heap/hp_block.c
index 85219380287..c622a9e52f8 100644
--- a/storage/heap/hp_block.c
+++ b/storage/heap/hp_block.c
@@ -26,7 +26,7 @@
{p_0, p_1, ...} serve as indexes to descend the blocks tree.
*/
-byte *hp_find_block(HP_BLOCK *block, ulong pos)
+uchar *hp_find_block(HP_BLOCK *block, ulong pos)
{
reg1 int i;
reg3 HP_PTRS *ptr; /* block base ptr */
@@ -36,12 +36,13 @@ byte *hp_find_block(HP_BLOCK *block, ulong pos)
ptr=(HP_PTRS*)ptr->blocks[pos/block->level_info[i].records_under_level];
pos%=block->level_info[i].records_under_level;
}
- return (byte*) ptr+ pos*block->recbuffer;
+ return (uchar*) ptr+ pos*block->recbuffer;
}
/*
Get one new block-of-records. Alloc ptr to block if needed
+
SYNOPSIS
hp_get_new_block()
block HP_BLOCK tree-like block
@@ -53,7 +54,7 @@ byte *hp_find_block(HP_BLOCK *block, ulong pos)
1 Out of memory
*/
-int hp_get_new_block(HP_BLOCK *block, ulong *alloc_length)
+int hp_get_new_block(HP_BLOCK *block, size_t *alloc_length)
{
reg1 uint i,j;
HP_PTRS *root;
@@ -101,13 +102,13 @@ int hp_get_new_block(HP_BLOCK *block, ulong *alloc_length)
/* Occupy the free slot we've found at level i */
block->level_info[i].last_blocks->
blocks[HP_PTRS_IN_NOD - block->level_info[i].free_ptrs_in_block--]=
- (byte*) root;
+ (uchar*) root;
/* Add a block subtree with each node having one left-most child */
for (j=i-1 ; j >0 ; j--)
{
block->level_info[j].last_blocks= root++;
- block->level_info[j].last_blocks->blocks[0]=(byte*) root;
+ block->level_info[j].last_blocks->blocks[0]=(uchar*) root;
block->level_info[j].free_ptrs_in_block=HP_PTRS_IN_NOD-1;
}
@@ -124,27 +125,27 @@ int hp_get_new_block(HP_BLOCK *block, ulong *alloc_length)
/* free all blocks under level */
-byte *hp_free_level(HP_BLOCK *block, uint level, HP_PTRS *pos, byte *last_pos)
+uchar *hp_free_level(HP_BLOCK *block, uint level, HP_PTRS *pos, uchar *last_pos)
{
int i,max_pos;
- byte *next_ptr;
+ uchar *next_ptr;
if (level == 1)
- next_ptr=(byte*) pos+block->recbuffer;
+ next_ptr=(uchar*) pos+block->recbuffer;
else
{
max_pos= (block->level_info[level-1].last_blocks == pos) ?
HP_PTRS_IN_NOD - block->level_info[level-1].free_ptrs_in_block :
HP_PTRS_IN_NOD;
- next_ptr=(byte*) (pos+1);
+ next_ptr=(uchar*) (pos+1);
for (i=0 ; i < max_pos ; i++)
next_ptr=hp_free_level(block,level-1,
(HP_PTRS*) pos->blocks[i],next_ptr);
}
- if ((byte*) pos != last_pos)
+ if ((uchar*) pos != last_pos)
{
- my_free((gptr) pos,MYF(0));
+ my_free((uchar*) pos,MYF(0));
return last_pos;
}
return next_ptr; /* next memory position */
diff --git a/storage/heap/hp_clear.c b/storage/heap/hp_clear.c
index 2d8b8b394d5..babfcbd6f41 100644
--- a/storage/heap/hp_clear.c
+++ b/storage/heap/hp_clear.c
@@ -32,7 +32,7 @@ void hp_clear(HP_SHARE *info)
if (info->block.levels)
VOID(hp_free_level(&info->block,info->block.levels,info->block.root,
- (byte*) 0));
+ (uchar*) 0));
info->block.levels=0;
hp_clear_keys(info);
info->records= info->deleted= 0;
@@ -94,7 +94,7 @@ void hp_clear_keys(HP_SHARE *info)
{
HP_BLOCK *block= &keyinfo->block;
if (block->levels)
- VOID(hp_free_level(block,block->levels,block->root,(byte*) 0));
+ VOID(hp_free_level(block,block->levels,block->root,(uchar*) 0));
block->levels=0;
block->last_allocated=0;
keyinfo->hash_buckets= 0;
diff --git a/storage/heap/hp_close.c b/storage/heap/hp_close.c
index 5f6fc3249b5..79fed859487 100644
--- a/storage/heap/hp_close.c
+++ b/storage/heap/hp_close.c
@@ -45,6 +45,6 @@ int hp_close(register HP_INFO *info)
heap_open_list=list_delete(heap_open_list,&info->open_list);
if (!--info->s->open_count && info->s->delete_on_close)
hp_free(info->s); /* Table was deleted */
- my_free((gptr) info,MYF(0));
+ my_free((uchar*) info,MYF(0));
DBUG_RETURN(error);
}
diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c
index 4e1347966b9..b910b89ffcd 100644
--- a/storage/heap/hp_create.c
+++ b/storage/heap/hp_create.c
@@ -42,10 +42,10 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
DBUG_PRINT("info",("Initializing new table"));
/*
- We have to store sometimes byte* del_link in records,
- so the record length should be at least sizeof(byte*)
+ We have to store sometimes uchar* del_link in records,
+ so the record length should be at least sizeof(uchar*)
*/
- set_if_bigger(reclength, sizeof (byte*));
+ set_if_bigger(reclength, sizeof (uchar*));
for (i= key_segs= max_length= 0, keyinfo= keydef; i < keys; i++, keyinfo++)
{
@@ -112,7 +112,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
}
keyinfo->length= length;
length+= keyinfo->rb_tree.size_of_element +
- ((keyinfo->algorithm == HA_KEY_ALG_BTREE) ? sizeof(byte*) : 0);
+ ((keyinfo->algorithm == HA_KEY_ALG_BTREE) ? sizeof(uchar*) : 0);
if (length > max_length)
max_length= length;
key_segs+= keyinfo->keysegs;
@@ -152,12 +152,12 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
{
/* additional HA_KEYTYPE_END keyseg */
keyseg->type= HA_KEYTYPE_END;
- keyseg->length= sizeof(byte*);
+ keyseg->length= sizeof(uchar*);
keyseg->flag= 0;
keyseg->null_bit= 0;
keyseg++;
- init_tree(&keyinfo->rb_tree, 0, 0, sizeof(byte*),
+ init_tree(&keyinfo->rb_tree, 0, 0, sizeof(uchar*),
(qsort_cmp2)keys_compare, 1, NULL, NULL);
keyinfo->delete_key= hp_rb_delete_key;
keyinfo->write_key= hp_rb_write_key;
@@ -188,7 +188,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
/* Must be allocated separately for rename to work */
if (!(share->name= my_strdup(name,MYF(0))))
{
- my_free((gptr) share,MYF(0));
+ my_free((uchar*) share,MYF(0));
pthread_mutex_unlock(&THR_LOCK_heap);
DBUG_RETURN(1);
}
@@ -218,7 +218,7 @@ static void init_block(HP_BLOCK *block, uint reclength, ulong min_records,
max_records= max(min_records,max_records);
if (!max_records)
max_records= 1000; /* As good as quess as anything */
- recbuffer= (uint) (reclength + sizeof(byte**) - 1) & ~(sizeof(byte**) - 1);
+ recbuffer= (uint) (reclength + sizeof(uchar**) - 1) & ~(sizeof(uchar**) - 1);
records_in_block= max_records / 10;
if (records_in_block < 10 && max_records)
records_in_block= 10;
@@ -285,7 +285,7 @@ void hp_free(HP_SHARE *share)
thr_lock_delete(&share->lock);
VOID(pthread_mutex_destroy(&share->intern_lock));
#endif
- my_free((gptr) share->name, MYF(0));
- my_free((gptr) share, MYF(0));
+ my_free((uchar*) share->name, MYF(0));
+ my_free((uchar*) share, MYF(0));
return;
}
diff --git a/storage/heap/hp_delete.c b/storage/heap/hp_delete.c
index 637e5f1a497..1dd79a42e0b 100644
--- a/storage/heap/hp_delete.c
+++ b/storage/heap/hp_delete.c
@@ -17,9 +17,9 @@
#include "heapdef.h"
-int heap_delete(HP_INFO *info, const byte *record)
+int heap_delete(HP_INFO *info, const uchar *record)
{
- byte *pos;
+ uchar *pos;
HP_SHARE *share=info->s;
HP_KEYDEF *keydef, *end, *p_lastinx;
DBUG_ENTER("heap_delete");
@@ -43,7 +43,7 @@ int heap_delete(HP_INFO *info, const byte *record)
}
info->update=HA_STATE_DELETED;
- *((byte**) pos)=share->del_link;
+ *((uchar**) pos)=share->del_link;
share->del_link=pos;
pos[share->reclength]=0; /* Record deleted */
share->deleted++;
@@ -65,7 +65,7 @@ err:
*/
int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
- const byte *record, byte *recpos, int flag)
+ const uchar *record, uchar *recpos, int flag)
{
heap_rb_param custom_arg;
uint old_allocated;
@@ -105,7 +105,7 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
*/
int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
- const byte *record, byte *recpos, int flag)
+ const uchar *record, uchar *recpos, int flag)
{
ulong blength,pos2,pos_hashnr,lastpos_hashnr;
HASH_INFO *lastpos,*gpos,*pos,*pos3,*empty,*last_ptr;
diff --git a/storage/heap/hp_hash.c b/storage/heap/hp_hash.c
index fbf3e541372..470b8c6841f 100644
--- a/storage/heap/hp_hash.c
+++ b/storage/heap/hp_hash.c
@@ -97,7 +97,7 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, key_range *min_key,
/* Sets info->current_ptr to found record */
/* next_flag: Search=0, next=1, prev =2, same =3 */
-byte *hp_search(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *key,
+uchar *hp_search(HP_INFO *info, HP_KEYDEF *keyinfo, const uchar *key,
uint nextflag)
{
reg1 HASH_INFO *pos,*prev_ptr;
@@ -175,7 +175,7 @@ byte *hp_search(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *key,
since last read !
*/
-byte *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *key,
+uchar *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo, const uchar *key,
HASH_INFO *pos)
{
DBUG_ENTER("hp_search_next");
@@ -238,7 +238,7 @@ void hp_movelink(HASH_INFO *pos, HASH_INFO *next_link, HASH_INFO *newlink)
/* Calc hashvalue for a key */
-ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
+ulong hp_hashnr(register HP_KEYDEF *keydef, register const uchar *key)
{
/*register*/
ulong nr=1, nr2=4;
@@ -304,7 +304,7 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
/* Calc hashvalue for a key in a record */
-ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
+ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec)
{
ulong nr=1, nr2=4;
HA_KEYSEG *seg,*endseg;
@@ -377,7 +377,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
* far, and works well on both numbers and strings.
*/
-ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
+ulong hp_hashnr(register HP_KEYDEF *keydef, register const uchar *key)
{
register ulong nr=0;
HA_KEYSEG *seg,*endseg;
@@ -426,7 +426,7 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
/* Calc hashvalue for a key in a record */
-ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
+ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec)
{
register ulong nr=0;
HA_KEYSEG *seg,*endseg;
@@ -490,7 +490,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
<> 0 Key differes
*/
-int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2,
+int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2,
my_bool diff_if_only_endspace_difference)
{
HA_KEYSEG *seg,*endseg;
@@ -577,7 +577,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2,
/* Compare a key in a record to a whole key */
-int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
+int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key)
{
HA_KEYSEG *seg,*endseg;
@@ -661,7 +661,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
/* Copy a key from a record to a keybuffer */
-void hp_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec)
+void hp_make_key(HP_KEYDEF *keydef, uchar *key, const uchar *rec)
{
HA_KEYSEG *seg,*endseg;
@@ -693,10 +693,10 @@ void hp_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec)
} while(0)
-uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
- const byte *rec, byte *recpos)
+uint hp_rb_make_key(HP_KEYDEF *keydef, uchar *key,
+ const uchar *rec, uchar *recpos)
{
- byte *start_key= key;
+ uchar *start_key= key;
HA_KEYSEG *seg, *endseg;
for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg; seg++)
@@ -710,7 +710,7 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
if (seg->flag & HA_SWAP_KEY)
{
uint length= seg->length;
- byte *pos= (byte*) rec + seg->start;
+ uchar *pos= (uchar*) rec + seg->start;
#ifdef HAVE_ISNAN
if (seg->type == HA_KEYTYPE_FLOAT)
@@ -759,7 +759,7 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
set_if_smaller(length,tmp_length);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((byte*) key,(byte*) pos,(size_t) char_length);
+ memcpy((uchar*) key,(uchar*) pos,(size_t) char_length);
key+= char_length;
continue;
}
@@ -778,7 +778,7 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
memcpy(key, rec + seg->start, (size_t) char_length);
key+= seg->length;
}
- memcpy(key, &recpos, sizeof(byte*));
+ memcpy(key, &recpos, sizeof(uchar*));
return (uint) (key - start_key);
}
@@ -802,7 +802,7 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
if (seg->flag & HA_SWAP_KEY)
{
uint length= seg->length;
- byte *pos= (byte*) old + length;
+ uchar *pos= (uchar*) old + length;
while (length--)
{
@@ -822,7 +822,7 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
set_if_smaller(length,tmp_length); /* Safety */
FIX_LENGTH(cs, old, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((byte*) key, old,(size_t) char_length);
+ memcpy((uchar*) key, old,(size_t) char_length);
key+= char_length;
continue;
}
@@ -844,15 +844,15 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
uint hp_rb_key_length(HP_KEYDEF *keydef,
- const byte *key __attribute__((unused)))
+ const uchar *key __attribute__((unused)))
{
return keydef->length;
}
-uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key)
+uint hp_rb_null_key_length(HP_KEYDEF *keydef, const uchar *key)
{
- const byte *start_key= key;
+ const uchar *start_key= key;
HA_KEYSEG *seg, *endseg;
for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg; seg++)
@@ -865,9 +865,9 @@ uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key)
}
-uint hp_rb_var_key_length(HP_KEYDEF *keydef, const byte *key)
+uint hp_rb_var_key_length(HP_KEYDEF *keydef, const uchar *key)
{
- const byte *start_key= key;
+ const uchar *start_key= key;
HA_KEYSEG *seg, *endseg;
for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg; seg++)
@@ -892,7 +892,7 @@ uint hp_rb_var_key_length(HP_KEYDEF *keydef, const byte *key)
0 otherwise
*/
-my_bool hp_if_null_in_key(HP_KEYDEF *keydef, const byte *record)
+my_bool hp_if_null_in_key(HP_KEYDEF *keydef, const uchar *record)
{
HA_KEYSEG *seg,*endseg;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
@@ -918,7 +918,7 @@ my_bool hp_if_null_in_key(HP_KEYDEF *keydef, const byte *record)
less than zero.
*/
-void heap_update_auto_increment(HP_INFO *info, const byte *record)
+void heap_update_auto_increment(HP_INFO *info, const uchar *record)
{
ulonglong value= 0; /* Store unsigned values here */
longlong s_value= 0; /* Store signed values here */
diff --git a/storage/heap/hp_info.c b/storage/heap/hp_info.c
index 2c58604eed1..ea78c53fd40 100644
--- a/storage/heap/hp_info.c
+++ b/storage/heap/hp_info.c
@@ -18,7 +18,7 @@
#include "heapdef.h"
-byte *heap_position(HP_INFO *info)
+uchar *heap_position(HP_INFO *info)
{
return ((info->update & HA_STATE_AKTIV) ? info->current_ptr :
(HEAP_PTR) 0);
diff --git a/storage/heap/hp_open.c b/storage/heap/hp_open.c
index 02a8d4f95ca..d252704a11b 100644
--- a/storage/heap/hp_open.c
+++ b/storage/heap/hp_open.c
@@ -51,8 +51,8 @@ HP_INFO *heap_open(const char *name, int mode)
pthread_mutex_unlock(&THR_LOCK_heap);
info->s= share;
- info->lastkey= (byte*) (info + 1);
- info->recbuf= (byte*) (info->lastkey + share->max_key_length);
+ info->lastkey= (uchar*) (info + 1);
+ info->recbuf= (uchar*) (info->lastkey + share->max_key_length);
info->mode= mode;
info->current_record= (ulong) ~0L; /* No current record */
info->current_ptr= 0;
diff --git a/storage/heap/hp_rfirst.c b/storage/heap/hp_rfirst.c
index d1842949421..48c1e625bd8 100644
--- a/storage/heap/hp_rfirst.c
+++ b/storage/heap/hp_rfirst.c
@@ -17,7 +17,7 @@
/* Read first record with the current key */
-int heap_rfirst(HP_INFO *info, byte *record, int inx)
+int heap_rfirst(HP_INFO *info, uchar *record, int inx)
{
HP_SHARE *share = info->s;
HP_KEYDEF *keyinfo = share->keydef + inx;
@@ -26,13 +26,13 @@ int heap_rfirst(HP_INFO *info, byte *record, int inx)
info->lastinx= inx;
if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
{
- byte *pos;
+ uchar *pos;
if ((pos = tree_search_edge(&keyinfo->rb_tree, info->parents,
&info->last_pos, offsetof(TREE_ELEMENT, left))))
{
memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos),
- sizeof(byte*));
+ sizeof(uchar*));
info->current_ptr = pos;
memcpy(record, pos, (size_t)share->reclength);
info->update = HA_STATE_AKTIV;
diff --git a/storage/heap/hp_rkey.c b/storage/heap/hp_rkey.c
index ced81985f99..6eeac6acd7b 100644
--- a/storage/heap/hp_rkey.c
+++ b/storage/heap/hp_rkey.c
@@ -15,10 +15,10 @@
#include "heapdef.h"
-int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
+int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function find_flag)
{
- byte *pos;
+ uchar *pos;
HP_SHARE *share= info->s;
HP_KEYDEF *keyinfo= share->keydef + inx;
DBUG_ENTER("heap_rkey");
@@ -53,7 +53,7 @@ int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
info->update= 0;
DBUG_RETURN(my_errno= HA_ERR_KEY_NOT_FOUND);
}
- memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(byte*));
+ memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(uchar*));
info->current_ptr= pos;
}
else
@@ -74,7 +74,7 @@ int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
/* Quick find of record */
-gptr heap_find(HP_INFO *info, int inx, const byte *key)
+uchar* heap_find(HP_INFO *info, int inx, const uchar *key)
{
return hp_search(info, info->s->keydef + inx, key, 0);
}
diff --git a/storage/heap/hp_rlast.c b/storage/heap/hp_rlast.c
index b72e815147f..45ad7c21f49 100644
--- a/storage/heap/hp_rlast.c
+++ b/storage/heap/hp_rlast.c
@@ -18,7 +18,7 @@
/* Read first record with the current key */
-int heap_rlast(HP_INFO *info, byte *record, int inx)
+int heap_rlast(HP_INFO *info, uchar *record, int inx)
{
HP_SHARE *share= info->s;
HP_KEYDEF *keyinfo= share->keydef + inx;
@@ -27,13 +27,13 @@ int heap_rlast(HP_INFO *info, byte *record, int inx)
info->lastinx= inx;
if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
{
- byte *pos;
+ uchar *pos;
if ((pos = tree_search_edge(&keyinfo->rb_tree, info->parents,
&info->last_pos, offsetof(TREE_ELEMENT, right))))
{
memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos),
- sizeof(byte*));
+ sizeof(uchar*));
info->current_ptr = pos;
memcpy(record, pos, (size_t)share->reclength);
info->update = HA_STATE_AKTIV;
diff --git a/storage/heap/hp_rnext.c b/storage/heap/hp_rnext.c
index 3b436fe87aa..262754e9e64 100644
--- a/storage/heap/hp_rnext.c
+++ b/storage/heap/hp_rnext.c
@@ -17,9 +17,9 @@
/* Read next record with the same key */
-int heap_rnext(HP_INFO *info, byte *record)
+int heap_rnext(HP_INFO *info, uchar *record)
{
- byte *pos;
+ uchar *pos;
HP_SHARE *share=info->s;
HP_KEYDEF *keyinfo;
DBUG_ENTER("heap_rnext");
@@ -47,7 +47,7 @@ int heap_rnext(HP_INFO *info, byte *record)
if (pos)
{
memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos),
- sizeof(byte*));
+ sizeof(uchar*));
info->current_ptr = pos;
}
else
diff --git a/storage/heap/hp_rprev.c b/storage/heap/hp_rprev.c
index bfdd2f9d47a..63bfffffba9 100644
--- a/storage/heap/hp_rprev.c
+++ b/storage/heap/hp_rprev.c
@@ -18,9 +18,9 @@
/* Read prev record for key */
-int heap_rprev(HP_INFO *info, byte *record)
+int heap_rprev(HP_INFO *info, uchar *record)
{
- byte *pos;
+ uchar *pos;
HP_SHARE *share=info->s;
HP_KEYDEF *keyinfo;
DBUG_ENTER("heap_rprev");
@@ -47,7 +47,7 @@ int heap_rprev(HP_INFO *info, byte *record)
if (pos)
{
memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos),
- sizeof(byte*));
+ sizeof(uchar*));
info->current_ptr = pos;
}
else
diff --git a/storage/heap/hp_rrnd.c b/storage/heap/hp_rrnd.c
index ad0190cc00c..3ac23d293f2 100644
--- a/storage/heap/hp_rrnd.c
+++ b/storage/heap/hp_rrnd.c
@@ -24,7 +24,7 @@
HA_ERR_END_OF_FILE = EOF.
*/
-int heap_rrnd(register HP_INFO *info, byte *record, byte *pos)
+int heap_rrnd(register HP_INFO *info, uchar *record, uchar *pos)
{
HP_SHARE *share=info->s;
DBUG_ENTER("heap_rrnd");
@@ -59,7 +59,7 @@ int heap_rrnd(register HP_INFO *info, byte *record, byte *pos)
HA_ERR_END_OF_FILE = EOF.
*/
-int heap_rrnd_old(register HP_INFO *info, byte *record, ulong pos)
+int heap_rrnd_old(register HP_INFO *info, uchar *record, ulong pos)
{
HP_SHARE *share=info->s;
DBUG_ENTER("heap_rrnd");
diff --git a/storage/heap/hp_rsame.c b/storage/heap/hp_rsame.c
index 10513f91726..1a3724672b6 100644
--- a/storage/heap/hp_rsame.c
+++ b/storage/heap/hp_rsame.c
@@ -25,7 +25,7 @@
HA_ERR_KEY_NOT_FOUND = Record not found with key
*/
-int heap_rsame(register HP_INFO *info, byte *record, int inx)
+int heap_rsame(register HP_INFO *info, uchar *record, int inx)
{
HP_SHARE *share=info->s;
DBUG_ENTER("heap_rsame");
diff --git a/storage/heap/hp_scan.c b/storage/heap/hp_scan.c
index 4249ac4148a..e8913e92c86 100644
--- a/storage/heap/hp_scan.c
+++ b/storage/heap/hp_scan.c
@@ -34,7 +34,7 @@ int heap_scan_init(register HP_INFO *info)
DBUG_RETURN(0);
}
-int heap_scan(register HP_INFO *info, byte *record)
+int heap_scan(register HP_INFO *info, uchar *record)
{
HP_SHARE *share=info->s;
ulong pos;
diff --git a/storage/heap/hp_test1.c b/storage/heap/hp_test1.c
index 31c9b8f2f30..aad5677db69 100644
--- a/storage/heap/hp_test1.c
+++ b/storage/heap/hp_test1.c
@@ -55,7 +55,7 @@ int main(int argc, char **argv)
keyinfo[0].flag = HA_NOSAME;
deleted=0;
- bzero((gptr) flags,sizeof(flags));
+ bzero((uchar*) flags,sizeof(flags));
printf("- Creating heap-file\n");
if (heap_create(filename,1,keyinfo,30,(ulong) flag*100000L,10L,
diff --git a/storage/heap/hp_test2.c b/storage/heap/hp_test2.c
index dcca5fb44b9..46b1fd61d46 100644
--- a/storage/heap/hp_test2.c
+++ b/storage/heap/hp_test2.c
@@ -42,7 +42,7 @@ static my_bool key3[MAX_RECORDS];
static int reclength=39;
-static int calc_check(byte *buf,uint length);
+static int calc_check(uchar *buf,uint length);
static void make_record(char *record, uint n1, uint n2, uint n3,
const char *mark, uint count);
@@ -674,7 +674,7 @@ static sig_handler endprog(int sig_number __attribute__((unused)))
}
}
-static int calc_check(byte *buf, uint length)
+static int calc_check(uchar *buf, uint length)
{
int check=0;
while (length--)
diff --git a/storage/heap/hp_update.c b/storage/heap/hp_update.c
index e7314e3d38c..11dca974ad4 100644
--- a/storage/heap/hp_update.c
+++ b/storage/heap/hp_update.c
@@ -17,10 +17,10 @@
#include "heapdef.h"
-int heap_update(HP_INFO *info, const byte *old, const byte *heap_new)
+int heap_update(HP_INFO *info, const uchar *old, const uchar *heap_new)
{
HP_KEYDEF *keydef, *end, *p_lastinx;
- byte *pos;
+ uchar *pos;
bool auto_key_changed= 0;
HP_SHARE *share= info->s;
DBUG_ENTER("heap_update");
diff --git a/storage/heap/hp_write.c b/storage/heap/hp_write.c
index 19215fcf017..2abef2d9b43 100644
--- a/storage/heap/hp_write.c
+++ b/storage/heap/hp_write.c
@@ -25,14 +25,14 @@
#define HIGHFIND 4
#define HIGHUSED 8
-static byte *next_free_record_pos(HP_SHARE *info);
+static uchar *next_free_record_pos(HP_SHARE *info);
static HASH_INFO *hp_find_free_hash(HP_SHARE *info, HP_BLOCK *block,
ulong records);
-int heap_write(HP_INFO *info, const byte *record)
+int heap_write(HP_INFO *info, const uchar *record)
{
HP_KEYDEF *keydef, *end;
- byte *pos;
+ uchar *pos;
HP_SHARE *share=info->s;
DBUG_ENTER("heap_write");
#ifndef DBUG_OFF
@@ -88,7 +88,7 @@ err:
}
share->deleted++;
- *((byte**) pos)=share->del_link;
+ *((uchar**) pos)=share->del_link;
share->del_link=pos;
pos[share->reclength]=0; /* Record deleted */
@@ -99,8 +99,8 @@ err:
Write a key to rb_tree-index
*/
-int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *record,
- byte *recpos)
+int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, const uchar *record,
+ uchar *recpos)
{
heap_rb_param custom_arg;
uint old_allocated;
@@ -130,17 +130,17 @@ int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *record,
/* Find where to place new record */
-static byte *next_free_record_pos(HP_SHARE *info)
+static uchar *next_free_record_pos(HP_SHARE *info)
{
int block_pos;
- byte *pos;
- ulong length;
+ uchar *pos;
+ size_t length;
DBUG_ENTER("next_free_record_pos");
if (info->del_link)
{
pos=info->del_link;
- info->del_link= *((byte**) pos);
+ info->del_link= *((uchar**) pos);
info->deleted--;
DBUG_PRINT("exit",("Used old position: 0x%lx",(long) pos));
DBUG_RETURN(pos);
@@ -158,9 +158,9 @@ static byte *next_free_record_pos(HP_SHARE *info)
info->data_length+=length;
}
DBUG_PRINT("exit",("Used new position: 0x%lx",
- (long) ((byte*) info->block.level_info[0].last_blocks+
+ (long) ((uchar*) info->block.level_info[0].last_blocks+
block_pos * info->block.recbuffer)));
- DBUG_RETURN((byte*) info->block.level_info[0].last_blocks+
+ DBUG_RETURN((uchar*) info->block.level_info[0].last_blocks+
block_pos*info->block.recbuffer);
}
@@ -191,12 +191,12 @@ static byte *next_free_record_pos(HP_SHARE *info)
*/
int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
- const byte *record, byte *recpos)
+ const uchar *record, uchar *recpos)
{
HP_SHARE *share = info->s;
int flag;
ulong halfbuff,hashnr,first_index;
- byte *ptr_to_rec,*ptr_to_rec2;
+ uchar *ptr_to_rec,*ptr_to_rec2;
HASH_INFO *empty,*gpos,*gpos2,*pos;
DBUG_ENTER("hp_write_key");
@@ -390,7 +390,7 @@ static HASH_INFO *hp_find_free_hash(HP_SHARE *info,
HP_BLOCK *block, ulong records)
{
uint block_pos;
- ulong length;
+ size_t length;
if (records < block->last_allocated)
return hp_find_hash(block,records);
@@ -401,6 +401,6 @@ static HASH_INFO *hp_find_free_hash(HP_SHARE *info,
info->index_length+=length;
}
block->last_allocated=records+1;
- return((HASH_INFO*) ((byte*) block->level_info[0].last_blocks+
+ return((HASH_INFO*) ((uchar*) block->level_info[0].last_blocks+
block_pos*block->recbuffer));
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index de9cf06fe3a..00d4db12823 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -60,7 +60,7 @@ static handlerton *legacy_innodb_hton;
uses unsigned char; the header univ.i which we include next defines
'byte' as a macro which expands to 'unsigned char' */
-typedef byte mysql_byte;
+typedef uchar mysql_byte;
#define INSIDE_HA_INNOBASE_CC
@@ -147,7 +147,7 @@ static HASH innobase_open_tables;
bool nw_panic = FALSE;
#endif
-static mysql_byte* innobase_get_key(INNOBASE_SHARE *share,uint *length,
+static mysql_byte* innobase_get_key(INNOBASE_SHARE *share, size_t *length,
my_bool not_used __attribute__((unused)));
static INNOBASE_SHARE *get_share(const char *table_name);
static void free_share(INNOBASE_SHARE *share);
@@ -730,7 +730,7 @@ innobase_mysql_print_thd(
len = min(thd->query_length, max_query_len);
if (len > (sizeof(buf) - 1)) {
- dyn_str = my_malloc(len + 1, MYF(0));
+ dyn_str = (char*) my_malloc(len + 1, MYF(0));
str = dyn_str;
}
@@ -1296,12 +1296,12 @@ innobase_print_identifier(
output strings buffers must not be shared. The function
only produces more output when the name contains other
characters than [0-9A-Z_a-z]. */
- char* temp_name = my_malloc((uint) namelen + 1, MYF(MY_WME));
+ char* temp_name = (char*) my_malloc((uint) namelen + 1, MYF(MY_WME));
uint qnamelen = (uint) (namelen
+ (1 + sizeof srv_mysql50_table_name_prefix));
if (temp_name) {
- qname = my_malloc(qnamelen, MYF(MY_WME));
+ qname = (char*) my_malloc(qnamelen, MYF(MY_WME));
if (qname) {
memcpy(temp_name, name, namelen);
temp_name[namelen] = 0;
@@ -2441,7 +2441,7 @@ ha_innobase::open(
"how you can resolve the problem.\n",
norm_name);
free_share(share);
- my_free((gptr) upd_buff, MYF(0));
+ my_free(upd_buff, MYF(0));
my_errno = ENOENT;
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
@@ -2458,7 +2458,7 @@ ha_innobase::open(
"how you can resolve the problem.\n",
norm_name);
free_share(share);
- my_free((gptr) upd_buff, MYF(0));
+ my_free(upd_buff, MYF(0));
my_errno = ENOENT;
dict_table_decrement_handle_count(ib_table);
@@ -2557,7 +2557,7 @@ ha_innobase::close(void)
row_prebuilt_free(prebuilt);
- my_free((gptr) upd_buff, MYF(0));
+ my_free(upd_buff, MYF(0));
free_share(share);
/* Tell InnoDB server that there might be work for
@@ -2580,7 +2580,7 @@ get_field_offset(
TABLE* table, /* in: MySQL table object */
Field* field) /* in: MySQL field object */
{
- return((uint) (field->ptr - (char*) table->record[0]));
+ return((uint) (field->ptr - table->record[0]));
}
/******************************************************************
@@ -4432,7 +4432,7 @@ ha_innobase::rnd_pos(
int error;
uint keynr = active_index;
DBUG_ENTER("rnd_pos");
- DBUG_DUMP("key", (char*) pos, ref_length);
+ DBUG_DUMP("key", pos, ref_length);
ha_statistic_increment(&SSV::ha_read_rnd_count);
@@ -4741,7 +4741,7 @@ create_index(
error = convert_error_code_to_mysql(error, NULL);
- my_free((gptr) field_lengths, MYF(0));
+ my_free(field_lengths, MYF(0));
DBUG_RETURN(error);
}
@@ -5174,7 +5174,7 @@ innobase_drop_database(
}
ptr++;
- namebuf = my_malloc((uint) len + 2, MYF(0));
+ namebuf = (char*) my_malloc((uint) len + 2, MYF(0));
memcpy(namebuf, ptr, len);
namebuf[len] = '/';
@@ -5371,7 +5371,7 @@ ha_innobase::records_in_range(
dtuple_free_for_mysql(heap1);
dtuple_free_for_mysql(heap2);
- my_free((gptr) key_val_buff2, MYF(0));
+ my_free(key_val_buff2, MYF(0));
prebuilt->trx->op_info = (char*)"";
@@ -5828,7 +5828,7 @@ ha_innobase::update_table_comment(
/* allocate buffer for the full string, and
read the contents of the temporary file */
- str = my_malloc(length + flen + 3, MYF(0));
+ str = (char*) my_malloc(length + flen + 3, MYF(0));
if (str) {
char* pos = str + length;
@@ -5896,7 +5896,7 @@ ha_innobase::get_foreign_key_create_info(void)
/* allocate buffer for the string, and
read the contents of the temporary file */
- str = my_malloc(flen + 1, MYF(0));
+ str = (char*) my_malloc(flen + 1, MYF(0));
if (str) {
rewind(srv_dict_tmpfile);
@@ -6028,7 +6028,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
}
FOREIGN_KEY_INFO *pf_key_info= ((FOREIGN_KEY_INFO *)
- thd->memdup((gptr) &f_key_info,
+ thd->memdup(&f_key_info,
sizeof(FOREIGN_KEY_INFO)));
f_key_list->push_back(pf_key_info);
foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
@@ -6556,7 +6556,7 @@ innodb_show_status(
/* allocate buffer for the string, and
read the contents of the temporary file */
- if (!(str = my_malloc(usable_len + 1, MYF(0)))) {
+ if (!(str = (char*) my_malloc(usable_len + 1, MYF(0)))) {
mutex_exit_noninline(&srv_monitor_file_mutex);
DBUG_RETURN(TRUE);
}
@@ -6717,7 +6717,7 @@ bool innobase_show_status(handlerton *hton, THD* thd,
locking.
****************************************************************************/
-static mysql_byte* innobase_get_key(INNOBASE_SHARE* share, uint* length,
+static mysql_byte* innobase_get_key(INNOBASE_SHARE* share, size_t *length,
my_bool not_used __attribute__((unused)))
{
*length=share->table_name_length;
@@ -6745,7 +6745,7 @@ static INNOBASE_SHARE* get_share(const char* table_name)
if (my_hash_insert(&innobase_open_tables,
(mysql_byte*) share)) {
pthread_mutex_unlock(&innobase_share_mutex);
- my_free((gptr) share,0);
+ my_free(share,0);
return 0;
}
@@ -6768,7 +6768,7 @@ static void free_share(INNOBASE_SHARE* share)
hash_delete(&innobase_open_tables, (mysql_byte*) share);
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
- my_free((gptr) share, MYF(0));
+ my_free(share, MYF(0));
}
pthread_mutex_unlock(&innobase_share_mutex);
@@ -7263,9 +7263,8 @@ ha_innobase::cmp_ref(
ref1 += 2;
ref2 += 2;
- result = ((Field_blob*)field)->cmp(
- (const char*)ref1, len1,
- (const char*)ref2, len2);
+ result = ((Field_blob*)field)->cmp( ref1, len1,
+ ref2, len2);
} else {
result = field->key_cmp(ref1, ref2);
}
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 8b6c4d5a3d8..4b9ce2b01bc 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -47,8 +47,8 @@ class ha_innobase: public handler
THR_LOCK_DATA lock;
INNOBASE_SHARE *share;
- byte* upd_buff; /* buffer used in updates */
- byte* key_val_buff; /* buffer used in converting
+ uchar* upd_buff; /* buffer used in updates */
+ uchar* key_val_buff; /* buffer used in converting
search key values from MySQL format
to Innodb format */
ulong upd_and_key_val_buff_len;
@@ -65,10 +65,10 @@ class ha_innobase: public handler
uint num_write_row; /* number of write_row() calls */
uint store_key_val_for_row(uint keynr, char* buff, uint buff_len,
- const byte* record);
+ const uchar* record);
int update_thd(THD* thd);
int change_active_index(uint keynr);
- int general_fetch(byte* buf, uint direction, uint match_mode);
+ int general_fetch(uchar* buf, uint direction, uint match_mode);
int innobase_read_and_init_auto_inc(longlong* ret);
/* Init values for the class: */
@@ -110,32 +110,32 @@ class ha_innobase: public handler
double scan_time();
double read_time(uint index, uint ranges, ha_rows rows);
- int write_row(byte * buf);
- int update_row(const byte * old_data, byte * new_data);
- int delete_row(const byte * buf);
+ int write_row(uchar * buf);
+ int update_row(const uchar * old_data, uchar * new_data);
+ int delete_row(const uchar * buf);
bool was_semi_consistent_read();
void try_semi_consistent_read(bool yes);
void unlock_row();
int index_init(uint index, bool sorted);
int index_end();
- int index_read(byte * buf, const byte * key,
+ int index_read(uchar * buf, const uchar * key,
uint key_len, enum ha_rkey_function find_flag);
- int index_read_idx(byte * buf, uint index, const byte * key,
+ int index_read_idx(uchar * buf, uint index, const uchar * key,
uint key_len, enum ha_rkey_function find_flag);
- int index_read_last(byte * buf, const byte * key, uint key_len);
- int index_next(byte * buf);
- int index_next_same(byte * buf, const byte *key, uint keylen);
- int index_prev(byte * buf);
- int index_first(byte * buf);
- int index_last(byte * buf);
+ int index_read_last(uchar * buf, const uchar * key, uint key_len);
+ int index_next(uchar * buf);
+ int index_next_same(uchar * buf, const uchar *key, uint keylen);
+ int index_prev(uchar * buf);
+ int index_first(uchar * buf);
+ int index_last(uchar * buf);
int rnd_init(bool scan);
int rnd_end();
- int rnd_next(byte *buf);
- int rnd_pos(byte * buf, byte *pos);
+ int rnd_next(uchar *buf);
+ int rnd_pos(uchar * buf, uchar *pos);
- void position(const byte *record);
+ void position(const uchar *record);
int info(uint);
int analyze(THD* thd,HA_CHECK_OPT* check_opt);
int optimize(THD* thd,HA_CHECK_OPT* check_opt);
@@ -145,7 +145,7 @@ class ha_innobase: public handler
int external_lock(THD *thd, int lock_type);
int transactional_table_lock(THD *thd, int lock_type);
int start_stmt(THD *thd, thr_lock_type lock_type);
- void position(byte *record);
+ void position(uchar *record);
ha_rows records_in_range(uint inx, key_range *min_key, key_range
*max_key);
ha_rows estimate_rows_upper_bound();
@@ -185,7 +185,7 @@ class ha_innobase: public handler
static char *get_mysql_bin_log_name();
static ulonglong get_mysql_bin_log_pos();
bool primary_key_is_clustered() { return true; }
- int cmp_ref(const byte *ref1, const byte *ref2);
+ int cmp_ref(const uchar *ref1, const uchar *ref2);
bool check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes);
};
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c
index 68076d7e401..bf4c29f5b4e 100644
--- a/storage/myisam/ft_boolean_search.c
+++ b/storage/myisam/ft_boolean_search.c
@@ -111,7 +111,7 @@ typedef struct st_ftb_word
uint ndepth;
uint len;
uchar off;
- byte word[1];
+ uchar word[1];
} FTB_WORD;
typedef struct st_ft_info
@@ -161,7 +161,7 @@ typedef struct st_my_ftb_param
{
FTB *ftb;
FTB_EXPR *ftbe;
- byte *up_quot;
+ uchar *up_quot;
uint depth;
} MY_FTB_PARAM;
@@ -274,7 +274,7 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info;
CHARSET_INFO *cs= ftb_param->ftb->charset;
- char **start= &query;
+ uchar **start= (uchar**) &query;
char *end= query + len;
FT_WORD w;
@@ -286,7 +286,7 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
}
-static void _ftb_parse_query(FTB *ftb, byte *query, uint len,
+static void _ftb_parse_query(FTB *ftb, uchar *query, uint len,
struct st_mysql_ftparser *parser)
{
MYSQL_FTPARSER_PARAM *param;
@@ -331,7 +331,7 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
my_bool can_go_down;
MI_INFO *info=ftb->info;
uint off, extra=HA_FT_WLEN+info->s->base.rec_reflength;
- byte *lastkey_buf=ftbw->word+ftbw->off;
+ uchar *lastkey_buf=ftbw->word+ftbw->off;
LINT_INIT(off);
if (ftbw->flags & FTB_FLAG_TRUNC)
@@ -505,7 +505,7 @@ static void _ftb_init_index_search(FT_INFO *ftb)
}
-FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
+FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, uchar *query,
uint query_len, CHARSET_INFO *cs)
{
FTB *ftb;
@@ -545,14 +545,14 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
Hack: instead of init_queue, we'll use reinit queue to be able
to alloc queue with alloc_root()
*/
- if (! (ftb->queue.root= (byte **)alloc_root(&ftb->mem_root,
+ if (! (ftb->queue.root= (uchar **)alloc_root(&ftb->mem_root,
(ftb->queue.max_elements + 1) *
sizeof(void *))))
goto err;
reinit_queue(&ftb->queue, ftb->queue.max_elements, 0, 0,
- (int (*)(void*, byte*, byte*))FTB_WORD_cmp, 0);
+ (int (*)(void*, uchar*, uchar*))FTB_WORD_cmp, 0);
for (ftbw= ftb->last_word; ftbw; ftbw= ftbw->prev)
- queue_insert(&ftb->queue, (byte *)ftbw);
+ queue_insert(&ftb->queue, (uchar *)ftbw);
ftb->list=(FTB_WORD **)alloc_root(&ftb->mem_root,
sizeof(FTB_WORD *)*ftb->queue.elements);
memcpy(ftb->list, ftb->queue.root+1, sizeof(FTB_WORD *)*ftb->queue.elements);
@@ -563,7 +563,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
return ftb;
err:
free_root(& ftb->mem_root, MYF(0));
- my_free((gptr)ftb,MYF(0));
+ my_free((uchar*)ftb,MYF(0));
return 0;
}
@@ -617,7 +617,8 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
const char *docend= document + len;
- while (ft_simple_get_word(phrase_param->cs, &document, docend, &word, FALSE))
+ while (ft_simple_get_word(phrase_param->cs, (uchar**) &document, docend,
+ &word, FALSE))
{
param->mysql_add_word(param, word.pos, word.len, 0);
if (phrase_param->match)
@@ -641,7 +642,7 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
1 is returned if phrase found, 0 else.
*/
-static int _ftb_check_phrase(FTB *ftb, const byte *document, uint len,
+static int _ftb_check_phrase(FTB *ftb, const uchar *document, uint len,
FTB_EXPR *ftbe, struct st_mysql_ftparser *parser)
{
MY_FTB_PHRASE_PARAM ftb_param;
@@ -663,7 +664,7 @@ static int _ftb_check_phrase(FTB *ftb, const byte *document, uint len,
param->mysql_add_word= ftb_phrase_add_word;
param->mysql_ftparam= (void *)&ftb_param;
param->cs= ftb->charset;
- param->doc= (byte *)document;
+ param->doc= (uchar *)document;
param->length= len;
param->flags= 0;
param->mode= MYSQL_FTPARSER_WITH_STOPWORDS;
@@ -867,13 +868,13 @@ static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
FT_INFO *ftb= ftb_param->ftb;
char *end= doc + len;
FT_WORD w;
- while (ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE))
+ while (ft_simple_get_word(ftb->charset, (uchar**) &doc, end, &w, TRUE))
param->mysql_add_word(param, w.pos, w.len, 0);
return(0);
}
-float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
+float ft_boolean_find_relevance(FT_INFO *ftb, uchar *record, uint length)
{
FTB_EXPR *ftbe;
FT_SEG_ITERATOR ftsi, ftsi2;
@@ -924,7 +925,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
{
if (!ftsi.pos)
continue;
- param->doc= (byte *)ftsi.pos;
+ param->doc= (uchar *)ftsi.pos;
param->length= ftsi.len;
parser->parse(param);
}
@@ -948,7 +949,7 @@ void ft_boolean_close_search(FT_INFO *ftb)
delete_tree(& ftb->no_dupes);
}
free_root(& ftb->mem_root, MYF(0));
- my_free((gptr)ftb,MYF(0));
+ my_free((uchar*)ftb,MYF(0));
}
diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c
index 5c6f66897ee..bcf6c46d41f 100644
--- a/storage/myisam/ft_nlq_search.c
+++ b/storage/myisam/ft_nlq_search.c
@@ -189,7 +189,7 @@ static int walk_and_push(FT_SUPERDOC *from,
DBUG_ENTER("walk_and_copy");
from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
set_if_smaller(best->elements, ft_query_expansion_limit-1);
- queue_insert(best, (byte *)& from->doc);
+ queue_insert(best, (uchar *)& from->doc);
DBUG_RETURN(0);
}
@@ -201,8 +201,8 @@ static int FT_DOC_cmp(void *unused __attribute__((unused)),
}
-FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query,
- uint query_len, uint flags, byte *record)
+FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, uchar *query,
+ uint query_len, uint flags, uchar *record)
{
TREE wtree;
ALL_IN_ONE aio;
@@ -323,7 +323,7 @@ int ft_nlq_read_next(FT_INFO *handler, char *record)
float ft_nlq_find_relevance(FT_INFO *handler,
- byte *record __attribute__((unused)),
+ uchar *record __attribute__((unused)),
uint length __attribute__((unused)))
{
int a,b,c;
@@ -352,7 +352,7 @@ float ft_nlq_find_relevance(FT_INFO *handler,
void ft_nlq_close_search(FT_INFO *handler)
{
- my_free((gptr)handler,MYF(0));
+ my_free((uchar*)handler,MYF(0));
}
diff --git a/storage/myisam/ft_parser.c b/storage/myisam/ft_parser.c
index 5992d9c118e..ba858c37aee 100644
--- a/storage/myisam/ft_parser.c
+++ b/storage/myisam/ft_parser.c
@@ -78,7 +78,7 @@ FT_WORD * ft_linearize(TREE *wtree, MEM_ROOT *mem_root)
DBUG_RETURN(wlist);
}
-my_bool ft_boolean_check_syntax_string(const byte *str)
+my_bool ft_boolean_check_syntax_string(const uchar *str)
{
uint i, j;
@@ -106,10 +106,10 @@ my_bool ft_boolean_check_syntax_string(const byte *str)
3 - right bracket
4 - stopword found
*/
-byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end,
- FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
+uchar ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
+ FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
{
- byte *doc=*start;
+ uchar *doc=*start;
int ctype;
uint mwc, length, mbl;
@@ -196,10 +196,10 @@ ret:
return param->type;
}
-byte ft_simple_get_word(CHARSET_INFO *cs, byte **start, const byte *end,
- FT_WORD *word, my_bool skip_stopwords)
+uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end,
+ FT_WORD *word, my_bool skip_stopwords)
{
- byte *doc= *start;
+ uchar *doc= *start;
uint mwc, length, mbl;
int ctype;
DBUG_ENTER("ft_simple_get_word");
@@ -260,9 +260,9 @@ static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
wtree= ft_param->wtree;
if (param->flags & MYSQL_FTFLAGS_NEED_COPY)
{
- byte *ptr;
+ uchar *ptr;
DBUG_ASSERT(wtree->with_delete == 0);
- ptr= (byte *)alloc_root(ft_param->mem_root, word_len);
+ ptr= (uchar *)alloc_root(ft_param->mem_root, word_len);
memcpy(ptr, word, word_len);
w.pos= ptr;
}
@@ -279,9 +279,10 @@ static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- char *doc, int doc_len)
+ char *doc_arg, int doc_len)
{
- byte *end=doc+doc_len;
+ uchar *doc= (uchar*) doc_arg;
+ uchar *end= doc + doc_len;
MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam;
TREE *wtree= ft_param->wtree;
FT_WORD w;
@@ -294,9 +295,9 @@ static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
}
-int ft_parse(TREE *wtree, byte *doc, int doclen,
- struct st_mysql_ftparser *parser,
- MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
+int ft_parse(TREE *wtree, uchar *doc, int doclen,
+ struct st_mysql_ftparser *parser,
+ MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{
MY_FT_PARSER_PARAM my_param;
DBUG_ENTER("ft_parse");
diff --git a/storage/myisam/ft_static.c b/storage/myisam/ft_static.c
index 34608be1721..610c20eede6 100644
--- a/storage/myisam/ft_static.c
+++ b/storage/myisam/ft_static.c
@@ -56,8 +56,8 @@ const struct _ft_vft _ft_vft_boolean = {
FT_INFO *ft_init_search(uint flags, void *info, uint keynr,
- byte *query, uint query_len, CHARSET_INFO *cs,
- byte *record)
+ uchar *query, uint query_len, CHARSET_INFO *cs,
+ uchar *record)
{
FT_INFO *res;
if (flags & FT_BOOL)
diff --git a/storage/myisam/ft_stopwords.c b/storage/myisam/ft_stopwords.c
index 63732ebadc9..e6a90bc927a 100644
--- a/storage/myisam/ft_stopwords.c
+++ b/storage/myisam/ft_stopwords.c
@@ -38,7 +38,7 @@ static void FT_STOPWORD_free(FT_STOPWORD *w, TREE_FREE action,
void *arg __attribute__((unused)))
{
if (action == free_free)
- my_free((gptr) w->pos, MYF(0));
+ my_free((uchar*) w->pos, MYF(0));
}
static int ft_add_stopword(const char *w)
@@ -65,7 +65,7 @@ int ft_init_stopwords()
{
File fd;
uint len;
- byte *buffer, *start, *end;
+ uchar *buffer, *start, *end;
FT_WORD w;
int error=-1;
diff --git a/storage/myisam/ft_update.c b/storage/myisam/ft_update.c
index e176d550b1d..e3e4c62158f 100644
--- a/storage/myisam/ft_update.c
+++ b/storage/myisam/ft_update.c
@@ -20,7 +20,7 @@
#include "ftdefs.h"
#include <math.h>
-void _mi_ft_segiterator_init(MI_INFO *info, uint keynr, const byte *record,
+void _mi_ft_segiterator_init(MI_INFO *info, uint keynr, const uchar *record,
FT_SEG_ITERATOR *ftsi)
{
DBUG_ENTER("_mi_ft_segiterator_init");
@@ -31,7 +31,7 @@ void _mi_ft_segiterator_init(MI_INFO *info, uint keynr, const byte *record,
DBUG_VOID_RETURN;
}
-void _mi_ft_segiterator_dummy_init(const byte *record, uint len,
+void _mi_ft_segiterator_dummy_init(const uchar *record, uint len,
FT_SEG_ITERATOR *ftsi)
{
DBUG_ENTER("_mi_ft_segiterator_dummy_init");
@@ -94,7 +94,7 @@ uint _mi_ft_segiterator(register FT_SEG_ITERATOR *ftsi)
/* parses a document i.e. calls ft_parse for every keyseg */
-uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record,
+uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const uchar *record,
MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{
FT_SEG_ITERATOR ftsi;
@@ -108,13 +108,13 @@ uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record,
while (_mi_ft_segiterator(&ftsi))
{
if (ftsi.pos)
- if (ft_parse(parsed, (byte *)ftsi.pos, ftsi.len, parser, param, mem_root))
+ if (ft_parse(parsed, (uchar *)ftsi.pos, ftsi.len, parser, param, mem_root))
DBUG_RETURN(1);
}
DBUG_RETURN(0);
}
-FT_WORD *_mi_ft_parserecord(MI_INFO *info, uint keynr, const byte *record,
+FT_WORD *_mi_ft_parserecord(MI_INFO *info, uint keynr, const uchar *record,
MEM_ROOT *mem_root)
{
TREE ptree;
@@ -130,7 +130,7 @@ FT_WORD *_mi_ft_parserecord(MI_INFO *info, uint keynr, const byte *record,
DBUG_RETURN(ft_linearize(&ptree, mem_root));
}
-static int _mi_ft_store(MI_INFO *info, uint keynr, byte *keybuf,
+static int _mi_ft_store(MI_INFO *info, uint keynr, uchar *keybuf,
FT_WORD *wlist, my_off_t filepos)
{
uint key_length;
@@ -145,7 +145,7 @@ static int _mi_ft_store(MI_INFO *info, uint keynr, byte *keybuf,
DBUG_RETURN(0);
}
-static int _mi_ft_erase(MI_INFO *info, uint keynr, byte *keybuf,
+static int _mi_ft_erase(MI_INFO *info, uint keynr, uchar *keybuf,
FT_WORD *wlist, my_off_t filepos)
{
uint key_length, err=0;
@@ -168,7 +168,7 @@ static int _mi_ft_erase(MI_INFO *info, uint keynr, byte *keybuf,
#define THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT 1
#define GEE_THEY_ARE_ABSOLUTELY_IDENTICAL 0
-int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2)
+int _mi_ft_cmp(MI_INFO *info, uint keynr, const uchar *rec1, const uchar *rec2)
{
FT_SEG_ITERATOR ftsi1, ftsi2;
CHARSET_INFO *cs=info->s->keyinfo[keynr].seg->charset;
@@ -190,8 +190,8 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2)
/* update a document entry */
-int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
- const byte *oldrec, const byte *newrec, my_off_t pos)
+int _mi_ft_update(MI_INFO *info, uint keynr, uchar *keybuf,
+ const uchar *oldrec, const uchar *newrec, my_off_t pos)
{
int error= -1;
FT_WORD *oldlist,*newlist, *old_word, *new_word;
@@ -241,7 +241,7 @@ err:
/* adds a document to the collection */
-int _mi_ft_add(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
+int _mi_ft_add(MI_INFO *info, uint keynr, uchar *keybuf, const uchar *record,
my_off_t pos)
{
int error= -1;
@@ -260,7 +260,7 @@ int _mi_ft_add(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
/* removes a document from the collection */
-int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
+int _mi_ft_del(MI_INFO *info, uint keynr, uchar *keybuf, const uchar *record,
my_off_t pos)
{
int error= -1;
@@ -276,10 +276,10 @@ int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
DBUG_RETURN(error);
}
-uint _ft_make_key(MI_INFO *info, uint keynr, byte *keybuf, FT_WORD *wptr,
+uint _ft_make_key(MI_INFO *info, uint keynr, uchar *keybuf, FT_WORD *wptr,
my_off_t filepos)
{
- byte buf[HA_FT_MAXBYTELEN+16];
+ uchar buf[HA_FT_MAXBYTELEN+16];
DBUG_ENTER("_ft_make_key");
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
diff --git a/storage/myisam/ftdefs.h b/storage/myisam/ftdefs.h
index 26f5e4f266e..22443807b87 100644
--- a/storage/myisam/ftdefs.h
+++ b/storage/myisam/ftdefs.h
@@ -96,44 +96,44 @@
#define FTB_RQUOT (ft_boolean_syntax[11])
typedef struct st_ft_word {
- byte * pos;
+ uchar * pos;
uint len;
double weight;
} FT_WORD;
int is_stopword(char *word, uint len);
-uint _ft_make_key(MI_INFO *, uint , byte *, FT_WORD *, my_off_t);
+uint _ft_make_key(MI_INFO *, uint , uchar *, FT_WORD *, my_off_t);
-byte ft_get_word(CHARSET_INFO *, byte **, byte *, FT_WORD *,
- MYSQL_FTPARSER_BOOLEAN_INFO *);
-byte ft_simple_get_word(CHARSET_INFO *, byte **, const byte *,
- FT_WORD *, my_bool);
+uchar ft_get_word(CHARSET_INFO *, uchar **, uchar *, FT_WORD *,
+ MYSQL_FTPARSER_BOOLEAN_INFO *);
+uchar ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *,
+ FT_WORD *, my_bool);
typedef struct _st_ft_seg_iterator {
uint num, len;
HA_KEYSEG *seg;
- const byte *rec, *pos;
+ const uchar *rec, *pos;
} FT_SEG_ITERATOR;
-void _mi_ft_segiterator_init(MI_INFO *, uint, const byte *, FT_SEG_ITERATOR *);
-void _mi_ft_segiterator_dummy_init(const byte *, uint, FT_SEG_ITERATOR *);
+void _mi_ft_segiterator_init(MI_INFO *, uint, const uchar *, FT_SEG_ITERATOR *);
+void _mi_ft_segiterator_dummy_init(const uchar *, uint, FT_SEG_ITERATOR *);
uint _mi_ft_segiterator(FT_SEG_ITERATOR *);
void ft_parse_init(TREE *, CHARSET_INFO *);
-int ft_parse(TREE *, byte *, int, struct st_mysql_ftparser *parser,
+int ft_parse(TREE *, uchar *, int, struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
FT_WORD * ft_linearize(TREE *, MEM_ROOT *);
-FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, const byte *, MEM_ROOT *);
-uint _mi_ft_parse(TREE *, MI_INFO *, uint, const byte *,
+FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, const uchar *, MEM_ROOT *);
+uint _mi_ft_parse(TREE *, MI_INFO *, uint, const uchar *,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
-FT_INFO *ft_init_nlq_search(MI_INFO *, uint, byte *, uint, uint, byte *);
-FT_INFO *ft_init_boolean_search(MI_INFO *, uint, byte *, uint, CHARSET_INFO *);
+FT_INFO *ft_init_nlq_search(MI_INFO *, uint, uchar *, uint, uint, uchar *);
+FT_INFO *ft_init_boolean_search(MI_INFO *, uint, uchar *, uint, CHARSET_INFO *);
extern const struct _ft_vft _ft_vft_nlq;
int ft_nlq_read_next(FT_INFO *, char *);
-float ft_nlq_find_relevance(FT_INFO *, byte *, uint);
+float ft_nlq_find_relevance(FT_INFO *, uchar *, uint);
void ft_nlq_close_search(FT_INFO *);
float ft_nlq_get_relevance(FT_INFO *);
my_off_t ft_nlq_get_docid(FT_INFO *);
@@ -141,7 +141,7 @@ void ft_nlq_reinit_search(FT_INFO *);
extern const struct _ft_vft _ft_vft_boolean;
int ft_boolean_read_next(FT_INFO *, char *);
-float ft_boolean_find_relevance(FT_INFO *, byte *, uint);
+float ft_boolean_find_relevance(FT_INFO *, uchar *, uint);
void ft_boolean_close_search(FT_INFO *);
float ft_boolean_get_relevance(FT_INFO *);
my_off_t ft_boolean_get_docid(FT_INFO *);
diff --git a/storage/myisam/fulltext.h b/storage/myisam/fulltext.h
index bea2fa96969..856e93e034d 100644
--- a/storage/myisam/fulltext.h
+++ b/storage/myisam/fulltext.h
@@ -29,9 +29,9 @@
extern const HA_KEYSEG ft_keysegs[FT_SEGS];
-int _mi_ft_cmp(MI_INFO *, uint, const byte *, const byte *);
-int _mi_ft_add(MI_INFO *, uint, byte *, const byte *, my_off_t);
-int _mi_ft_del(MI_INFO *, uint, byte *, const byte *, my_off_t);
+int _mi_ft_cmp(MI_INFO *, uint, const uchar *, const uchar *);
+int _mi_ft_add(MI_INFO *, uint, uchar *, const uchar *, my_off_t);
+int _mi_ft_del(MI_INFO *, uint, uchar *, const uchar *, my_off_t);
uint _mi_ft_convert_to_ft2(MI_INFO *, uint, uchar *);
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index d31f5b7e792..d2a45d41566 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -121,7 +121,7 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out,
{
uint i, j, recpos, minpos, fieldpos, temp_length, length;
enum ha_base_keytype type= HA_KEYTYPE_BINARY;
- byte *record;
+ uchar *record;
KEY *pos;
MI_KEYDEF *keydef;
MI_COLUMNDEF *recinfo, *recinfo_pos;
@@ -531,7 +531,7 @@ int ha_myisam::net_read_dump(NET* net)
error= -1;
goto err;
}
- if (my_write(data_fd, (byte*)net->read_pos, (uint) packet_len,
+ if (my_write(data_fd, (uchar*)net->read_pos, (uint) packet_len,
MYF(MY_WME|MY_FNABP)))
{
error = errno;
@@ -550,7 +550,7 @@ int ha_myisam::dump(THD* thd, int fd)
uint blocksize = share->blocksize;
my_off_t bytes_to_read = share->state.state.data_file_length;
int data_fd = file->dfile;
- byte * buf = (byte*) my_malloc(blocksize, MYF(MY_WME));
+ uchar *buf = (uchar*) my_malloc(blocksize, MYF(MY_WME));
if (!buf)
return ENOMEM;
@@ -558,7 +558,7 @@ int ha_myisam::dump(THD* thd, int fd)
my_seek(data_fd, 0L, MY_SEEK_SET, MYF(MY_WME));
for (; bytes_to_read > 0;)
{
- uint bytes = my_read(data_fd, buf, blocksize, MYF(MY_WME));
+ size_t bytes = my_read(data_fd, buf, blocksize, MYF(MY_WME));
if (bytes == MY_FILE_ERROR)
{
error = errno;
@@ -575,7 +575,7 @@ int ha_myisam::dump(THD* thd, int fd)
}
else
{
- if (my_net_write(net, (char*) buf, bytes))
+ if (my_net_write(net, buf, bytes))
{
error = errno ? errno : EPIPE;
goto err;
@@ -586,13 +586,13 @@ int ha_myisam::dump(THD* thd, int fd)
if (fd < 0)
{
- if (my_net_write(net, "", 0))
+ if (my_net_write(net, (uchar*) "", 0))
error = errno ? errno : EPIPE;
net_flush(net);
}
err:
- my_free((gptr) buf, MYF(0));
+ my_free((uchar*) buf, MYF(0));
return error;
}
#endif /* HAVE_REPLICATION */
@@ -710,7 +710,7 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked)
recinfo must be freed.
*/
if (recinfo)
- my_free((gptr) recinfo, MYF(0));
+ my_free((uchar*) recinfo, MYF(0));
return my_errno;
}
@@ -721,7 +721,7 @@ int ha_myisam::close(void)
return mi_close(tmp);
}
-int ha_myisam::write_row(byte * buf)
+int ha_myisam::write_row(uchar *buf)
{
statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status);
@@ -1594,7 +1594,7 @@ bool ha_myisam::is_crashed() const
(my_disable_locking && file->s->state.open_count));
}
-int ha_myisam::update_row(const byte * old_data, byte * new_data)
+int ha_myisam::update_row(const uchar *old_data, uchar *new_data)
{
statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
@@ -1602,13 +1602,13 @@ int ha_myisam::update_row(const byte * old_data, byte * new_data)
return mi_update(file,old_data,new_data);
}
-int ha_myisam::delete_row(const byte * buf)
+int ha_myisam::delete_row(const uchar *buf)
{
statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status);
return mi_delete(file,buf);
}
-int ha_myisam::index_read(byte *buf, const byte *key, key_part_map keypart_map,
+int ha_myisam::index_read(uchar *buf, const uchar *key, key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
DBUG_ASSERT(inited==INDEX);
@@ -1619,7 +1619,7 @@ int ha_myisam::index_read(byte *buf, const byte *key, key_part_map keypart_map,
return error;
}
-int ha_myisam::index_read_idx(byte *buf, uint index, const byte *key,
+int ha_myisam::index_read_idx(uchar *buf, uint index, const uchar *key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -1630,7 +1630,7 @@ int ha_myisam::index_read_idx(byte *buf, uint index, const byte *key,
return error;
}
-int ha_myisam::index_read_last(byte *buf, const byte *key,
+int ha_myisam::index_read_last(uchar *buf, const uchar *key,
key_part_map keypart_map)
{
DBUG_ENTER("ha_myisam::index_read_last");
@@ -1643,7 +1643,7 @@ int ha_myisam::index_read_last(byte *buf, const byte *key,
DBUG_RETURN(error);
}
-int ha_myisam::index_next(byte * buf)
+int ha_myisam::index_next(uchar *buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_next_count,
@@ -1653,7 +1653,7 @@ int ha_myisam::index_next(byte * buf)
return error;
}
-int ha_myisam::index_prev(byte * buf)
+int ha_myisam::index_prev(uchar *buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_prev_count,
@@ -1663,7 +1663,7 @@ int ha_myisam::index_prev(byte * buf)
return error;
}
-int ha_myisam::index_first(byte * buf)
+int ha_myisam::index_first(uchar *buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_first_count,
@@ -1673,7 +1673,7 @@ int ha_myisam::index_first(byte * buf)
return error;
}
-int ha_myisam::index_last(byte * buf)
+int ha_myisam::index_last(uchar *buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_last_count,
@@ -1683,8 +1683,8 @@ int ha_myisam::index_last(byte * buf)
return error;
}
-int ha_myisam::index_next_same(byte * buf,
- const byte *key __attribute__((unused)),
+int ha_myisam::index_next_same(uchar *buf,
+ const uchar *key __attribute__((unused)),
uint length __attribute__((unused)))
{
DBUG_ASSERT(inited==INDEX);
@@ -1703,7 +1703,7 @@ int ha_myisam::rnd_init(bool scan)
return mi_reset(file); // Free buffers
}
-int ha_myisam::rnd_next(byte *buf)
+int ha_myisam::rnd_next(uchar *buf)
{
statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
&LOCK_status);
@@ -1712,12 +1712,12 @@ int ha_myisam::rnd_next(byte *buf)
return error;
}
-int ha_myisam::restart_rnd_next(byte *buf, byte *pos)
+int ha_myisam::restart_rnd_next(uchar *buf, uchar *pos)
{
return rnd_pos(buf,pos);
}
-int ha_myisam::rnd_pos(byte * buf, byte *pos)
+int ha_myisam::rnd_pos(uchar *buf, uchar *pos)
{
statistic_increment(table->in_use->status_var.ha_read_rnd_count,
&LOCK_status);
@@ -1726,7 +1726,7 @@ int ha_myisam::rnd_pos(byte * buf, byte *pos)
return error;
}
-void ha_myisam::position(const byte* record)
+void ha_myisam::position(const uchar *record)
{
my_off_t row_position= mi_position(file);
my_store_ptr(ref, ref_length, row_position);
@@ -1911,7 +1911,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
records, recinfo,
0, (MI_UNIQUEDEF*) 0,
&create_info, create_flags);
- my_free((gptr) recinfo, MYF(0));
+ my_free((uchar*) recinfo, MYF(0));
DBUG_RETURN(error);
}
@@ -1929,7 +1929,7 @@ void ha_myisam::get_auto_increment(ulonglong offset, ulonglong increment,
{
ulonglong nr;
int error;
- byte key[MI_MAX_KEY_LENGTH];
+ uchar key[MI_MAX_KEY_LENGTH];
if (!table->s->next_number_key_offset)
{ // Autoincrement at key-start
@@ -2002,7 +2002,7 @@ ha_rows ha_myisam::records_in_range(uint inx, key_range *min_key,
}
-int ha_myisam::ft_read(byte * buf)
+int ha_myisam::ft_read(uchar *buf)
{
int error;
diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h
index bb439e9914d..6cc9f4811b0 100644
--- a/storage/myisam/ha_myisam.h
+++ b/storage/myisam/ha_myisam.h
@@ -67,19 +67,19 @@ class ha_myisam: public handler
bool called_by_logger_thread);
int open(const char *name, int mode, uint test_if_locked);
int close(void);
- int write_row(byte * buf);
- int update_row(const byte * old_data, byte * new_data);
- int delete_row(const byte * buf);
- int index_read(byte *buf, const byte *key, key_part_map keypart_map,
+ int write_row(uchar * buf);
+ int update_row(const uchar * old_data, uchar * new_data);
+ int delete_row(const uchar * buf);
+ int index_read(uchar *buf, const uchar *key, key_part_map keypart_map,
enum ha_rkey_function find_flag);
- int index_read_idx(byte *buf, uint index, const byte *key,
+ int index_read_idx(uchar *buf, uint index, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function find_flag);
- int index_read_last(byte *buf, const byte *key, key_part_map keypart_map);
- int index_next(byte * buf);
- int index_prev(byte * buf);
- int index_first(byte * buf);
- int index_last(byte * buf);
- int index_next_same(byte *buf, const byte *key, uint keylen);
+ int index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map);
+ int index_next(uchar * buf);
+ int index_prev(uchar * buf);
+ int index_first(uchar * buf);
+ int index_last(uchar * buf);
+ int index_next_same(uchar *buf, const uchar *key, uint keylen);
int ft_init()
{
if (!ft_handler)
@@ -90,15 +90,15 @@ class ha_myisam: public handler
FT_INFO *ft_init_ext(uint flags, uint inx,String *key)
{
return ft_init_search(flags,file,inx,
- (byte *)key->ptr(), key->length(), key->charset(),
+ (uchar *)key->ptr(), key->length(), key->charset(),
table->record[0]);
}
- int ft_read(byte *buf);
+ int ft_read(uchar *buf);
int rnd_init(bool scan);
- int rnd_next(byte *buf);
- int rnd_pos(byte * buf, byte *pos);
- int restart_rnd_next(byte *buf, byte *pos);
- void position(const byte *record);
+ int rnd_next(uchar *buf);
+ int rnd_pos(uchar * buf, uchar *pos);
+ int restart_rnd_next(uchar *buf, uchar *pos);
+ void position(const uchar *record);
int info(uint);
int extra(enum ha_extra_function operation);
int extra_opt(enum ha_extra_function operation, ulong cache_size);
diff --git a/storage/myisam/mi_cache.c b/storage/myisam/mi_cache.c
index 59c9b2c8812..d6dcc431a8d 100644
--- a/storage/myisam/mi_cache.c
+++ b/storage/myisam/mi_cache.c
@@ -35,12 +35,12 @@
#include "myisamdef.h"
-int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length,
+int _mi_read_cache(IO_CACHE *info, uchar *buff, my_off_t pos, uint length,
int flag)
{
uint read_length,in_buff_length;
my_off_t offset;
- char *in_buff_pos;
+ uchar *in_buff_pos;
DBUG_ENTER("_mi_read_cache");
if (pos < info->pos_in_file)
@@ -61,7 +61,7 @@ int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length,
(my_off_t) (info->read_end - info->request_pos))
{
in_buff_pos=info->request_pos+(uint) offset;
- in_buff_length= min(length,(uint) (info->read_end-in_buff_pos));
+ in_buff_length= min(length, (size_t) (info->read_end-in_buff_pos));
memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length);
if (!(length-=in_buff_length))
DBUG_RETURN(0);
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index 7a4d47954a5..e529666f462 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -83,12 +83,12 @@ static int sort_delete_record(MI_SORT_PARAM *sort_param);
/*static int flush_pending_blocks(MI_CHECK *param);*/
static SORT_KEY_BLOCKS *alloc_key_blocks(MI_CHECK *param, uint blocks,
uint buffer_length);
-static ha_checksum mi_byte_checksum(const byte *buf, uint length);
+static ha_checksum mi_byte_checksum(const uchar *buf, uint length);
static void set_data_file_type(SORT_INFO *sort_info, MYISAM_SHARE *share);
void myisamchk_init(MI_CHECK *param)
{
- bzero((gptr) param,sizeof(*param));
+ bzero((uchar*) param,sizeof(*param));
param->opt_follow_links=1;
param->keys_in_use= ~(ulonglong) 0;
param->search_after_block=HA_OFFSET_ERROR;
@@ -296,7 +296,7 @@ static int check_k_link(MI_CHECK *param, register MI_INFO *info, uint nr)
*/
if (!(buff=key_cache_read(info->s->key_cache,
info->s->kfile, next_link, DFLT_INIT_HITS,
- (byte*) info->buff, MI_MIN_KEY_BLOCK_LENGTH,
+ (uchar*) info->buff, MI_MIN_KEY_BLOCK_LENGTH,
MI_MIN_KEY_BLOCK_LENGTH, 1)))
{
/* purecov: begin tested */
@@ -531,7 +531,7 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
/* Check that there isn't a row with auto_increment = 0 in the table */
mi_extra(info,HA_EXTRA_KEYREAD,0);
bzero(info->lastkey,keyinfo->seg->length);
- if (!mi_rkey(info, info->rec_buff, key, (const byte*) info->lastkey,
+ if (!mi_rkey(info, info->rec_buff, key, (const uchar*) info->lastkey,
(key_part_map)1, HA_READ_KEY_EXACT))
{
/* Don't count this as a real warning, as myisamchk can't correct it */
@@ -740,7 +740,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
char llbuff[22];
uint diff_pos[2];
DBUG_ENTER("chk_index");
- DBUG_DUMP("buff",(byte*) buff,mi_getint(buff));
+ DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff));
/* TODO: implement appropriate check for RTree keys */
if (keyinfo->flag & HA_SPATIAL)
@@ -798,8 +798,8 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
(flag=ha_key_cmp(keyinfo->seg,info->lastkey,key,key_length,
comp_flag, diff_pos)) >=0)
{
- DBUG_DUMP("old",(byte*) info->lastkey, info->lastkey_length);
- DBUG_DUMP("new",(byte*) key, key_length);
+ DBUG_DUMP("old",(uchar*) info->lastkey, info->lastkey_length);
+ DBUG_DUMP("new",(uchar*) key, key_length);
DBUG_DUMP("new_in_page",(char*) old_keypos,(uint) (keypos-old_keypos));
if (comp_flag & SEARCH_FIND && flag == 0)
@@ -831,7 +831,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
key);
}
}
- (*key_checksum)+= mi_byte_checksum((byte*) key,
+ (*key_checksum)+= mi_byte_checksum((uchar*) key,
key_length- info->s->rec_reflength);
record= _mi_dpos(info,0,key+key_length);
if (keyinfo->flag & HA_FULLTEXT) /* special handling for ft2 */
@@ -869,7 +869,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
DBUG_PRINT("test",("page: %s record: %s filelength: %s",
llstr(page,llbuff),llstr(record,llbuff2),
llstr(info->state->data_file_length,llbuff3)));
- DBUG_DUMP("key",(byte*) key,key_length);
+ DBUG_DUMP("key",(uchar*) key,key_length);
DBUG_DUMP("new_in_page",(char*) old_keypos,(uint) (keypos-old_keypos));
goto err;
}
@@ -881,10 +881,10 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
llstr(page,llbuff), used_length, (keypos - buff));
goto err;
}
- my_afree((byte*) temp_buff);
+ my_afree((uchar*) temp_buff);
DBUG_RETURN(0);
err:
- my_afree((byte*) temp_buff);
+ my_afree((uchar*) temp_buff);
DBUG_RETURN(1);
} /* chk_index */
@@ -939,7 +939,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
ha_rows records,del_blocks;
my_off_t used,empty,pos,splits,start_recpos,
del_length,link_used,start_block;
- byte *record,*to;
+ uchar *record,*to;
char llbuff[22],llbuff2[22],llbuff3[22];
ha_checksum intern_record_checksum;
ha_checksum key_checksum[MI_MAX_POSSIBLE_KEY];
@@ -956,7 +956,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
puts("- check record links");
}
- if (!(record= (byte*) my_malloc(info->s->base.pack_reclength,MYF(0))))
+ if (!(record= (uchar*) my_malloc(info->s->base.pack_reclength,MYF(0))))
{
mi_check_print_error(param,"Not enough memory for record");
DBUG_RETURN(-1);
@@ -991,7 +991,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
goto err2;
switch (info->s->data_file_type) {
case STATIC_RECORD:
- if (my_b_read(&param->read_cache,(byte*) record,
+ if (my_b_read(&param->read_cache,(uchar*) record,
info->s->base.pack_reclength))
goto err;
start_recpos=pos;
@@ -1011,7 +1011,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
block_info.next_filepos=pos;
do
{
- if (_mi_read_cache(&param->read_cache,(byte*) block_info.header,
+ if (_mi_read_cache(&param->read_cache,(uchar*) block_info.header,
(start_block=block_info.next_filepos),
sizeof(block_info.header),
(flag ? 0 : READING_NEXT) | READING_HEADER))
@@ -1115,7 +1115,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
got_error=1;
break;
}
- if (_mi_read_cache(&param->read_cache,(byte*) to,block_info.filepos,
+ if (_mi_read_cache(&param->read_cache,(uchar*) to,block_info.filepos,
(uint) block_info.data_len,
flag == 1 ? READING_NEXT : 0))
goto err;
@@ -1176,7 +1176,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
pos=block_info.filepos+block_info.block_len;
break;
case COMPRESSED_RECORD:
- if (_mi_read_cache(&param->read_cache,(byte*) block_info.header, pos,
+ if (_mi_read_cache(&param->read_cache,(uchar*) block_info.header, pos,
info->s->pack.ref_length, READING_NEXT))
goto err;
start_recpos=pos;
@@ -1193,7 +1193,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
got_error=1;
break;
}
- if (_mi_read_cache(&param->read_cache,(byte*) info->rec_buff,
+ if (_mi_read_cache(&param->read_cache,(uchar*) info->rec_buff,
block_info.filepos, block_info.rec_len, READING_NEXT))
goto err;
if (_mi_pack_rec_unpack(info, &info->bit_buff, record,
@@ -1253,7 +1253,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
}
}
else
- key_checksum[key]+=mi_byte_checksum((byte*) info->lastkey,
+ key_checksum[key]+=mi_byte_checksum((uchar*) info->lastkey,
key_length);
}
}
@@ -1363,12 +1363,12 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
printf("Lost space: %12s Linkdata: %10s\n",
llstr(empty,llbuff),llstr(link_used,llbuff2));
}
- my_free((gptr) record,MYF(0));
+ my_free((uchar*) record,MYF(0));
DBUG_RETURN (error);
err:
mi_check_print_error(param,"got error: %d when reading datafile at record: %s",my_errno, llstr(records,llbuff));
err2:
- my_free((gptr) record,MYF(0));
+ my_free((uchar*) record,MYF(0));
param->testflag|=T_RETRY_WITHOUT_QUICK;
DBUG_RETURN(1);
} /* chk_data_link */
@@ -1378,7 +1378,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
/* Save new datafile-name in temp_filename */
int mi_repair(MI_CHECK *param, register MI_INFO *info,
- my_string name, int rep_quick)
+ char * name, int rep_quick)
{
int error,got_error;
uint i;
@@ -1427,7 +1427,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
MYF(MY_WME | MY_WAIT_IF_FULL)))
goto err;
info->opt_flag|=WRITE_CACHE_USED;
- if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength,
+ if (!(sort_param.record=(uchar*) my_malloc((uint) share->base.pack_reclength,
MYF(0))) ||
!mi_alloc_rec_buff(info, -1, &sort_param.rec_buff))
{
@@ -1514,7 +1514,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
{
if (my_errno != HA_ERR_FOUND_DUPP_KEY)
goto err;
- DBUG_DUMP("record",(byte*) sort_param.record,share->base.pack_reclength);
+ DBUG_DUMP("record",(uchar*) sort_param.record,share->base.pack_reclength);
mi_check_print_info(param,"Duplicate key %2d for record at %10s against new record at %10s",
info->errkey+1,
llstr(sort_param.start_recpos,llbuff),
@@ -1660,7 +1660,7 @@ static int writekeys(MI_SORT_PARAM *sort_param)
register uint i;
uchar *key;
MI_INFO *info= sort_param->sort_info->info;
- byte *buff= sort_param->record;
+ uchar *buff= sort_param->record;
my_off_t filepos= sort_param->filepos;
DBUG_ENTER("writekeys");
@@ -1724,7 +1724,7 @@ static int writekeys(MI_SORT_PARAM *sort_param)
/* Change all key-pointers that points to a records */
-int movepoint(register MI_INFO *info, byte *record, my_off_t oldpos,
+int movepoint(register MI_INFO *info, uchar *record, my_off_t oldpos,
my_off_t newpos, uint prot_key)
{
register uint i;
@@ -1801,7 +1801,7 @@ int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file)
/* Sort index for more efficent reads */
-int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
+int mi_sort_index(MI_CHECK *param, register MI_INFO *info, char * name)
{
reg2 uint key;
reg1 MI_KEYDEF *keyinfo;
@@ -1944,7 +1944,7 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
("From page: %ld, keyoffset: %lu used_length: %d",
(ulong) pagepos, (ulong) (keypos - buff),
(int) used_length));
- DBUG_DUMP("buff",(byte*) buff,used_length);
+ DBUG_DUMP("buff",(uchar*) buff,used_length);
goto err;
}
}
@@ -1973,17 +1973,17 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
/* Fill block with zero and write it to the new index file */
length=mi_getint(buff);
- bzero((byte*) buff+length,keyinfo->block_length-length);
- if (my_pwrite(new_file,(byte*) buff,(uint) keyinfo->block_length,
+ bzero((uchar*) buff+length,keyinfo->block_length-length);
+ if (my_pwrite(new_file,(uchar*) buff,(uint) keyinfo->block_length,
new_page_pos,MYF(MY_NABP | MY_WAIT_IF_FULL)))
{
mi_check_print_error(param,"Can't write indexblock, error: %d",my_errno);
goto err;
}
- my_afree((gptr) buff);
+ my_afree((uchar*) buff);
DBUG_RETURN(0);
err:
- my_afree((gptr) buff);
+ my_afree((uchar*) buff);
DBUG_RETURN(1);
} /* sort_one_index */
@@ -2054,13 +2054,13 @@ int filecopy(MI_CHECK *param, File to,File from,my_off_t start,
VOID(my_seek(from,start,MY_SEEK_SET,MYF(0)));
while (length > buff_length)
{
- if (my_read(from,(byte*) buff,buff_length,MYF(MY_NABP)) ||
- my_write(to,(byte*) buff,buff_length,param->myf_rw))
+ if (my_read(from,(uchar*) buff,buff_length,MYF(MY_NABP)) ||
+ my_write(to,(uchar*) buff,buff_length,param->myf_rw))
goto err;
length-= buff_length;
}
- if (my_read(from,(byte*) buff,(uint) length,MYF(MY_NABP)) ||
- my_write(to,(byte*) buff,(uint) length,param->myf_rw))
+ if (my_read(from,(uchar*) buff,(uint) length,MYF(MY_NABP)) ||
+ my_write(to,(uchar*) buff,(uint) length,param->myf_rw))
goto err;
if (buff != tmp_buff)
my_free(buff,MYF(0));
@@ -2141,7 +2141,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
info->opt_flag|=WRITE_CACHE_USED;
info->rec_cache.file=info->dfile; /* for sort_delete_record */
- if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength,
+ if (!(sort_param.record=(uchar*) my_malloc((uint) share->base.pack_reclength,
MYF(0))) ||
!mi_alloc_rec_buff(info, -1, &sort_param.rec_buff))
{
@@ -2454,8 +2454,8 @@ err:
my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff),
MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
- my_free((gptr) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
- my_free((gptr) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
VOID(end_io_cache(&param->read_cache));
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
@@ -2987,9 +2987,9 @@ err:
pthread_cond_destroy (&sort_info.cond);
pthread_mutex_destroy(&sort_info.mutex);
- my_free((gptr) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
- my_free((gptr) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
- my_free((gptr) sort_param,MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) sort_param,MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
VOID(end_io_cache(&param->read_cache));
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
@@ -3119,7 +3119,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
int parallel_flag;
uint found_record,b_type,left_length;
my_off_t pos;
- byte *to;
+ uchar *to;
MI_BLOCK_INFO block_info;
SORT_INFO *sort_info=sort_param->sort_info;
MI_CHECK *param=sort_info->param;
@@ -3197,7 +3197,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
llstr(param->search_after_block,llbuff),
llstr(sort_param->start_recpos,llbuff2));
if (_mi_read_cache(&sort_param->read_cache,
- (byte*) block_info.header,pos,
+ (uchar*) block_info.header,pos,
MI_BLOCK_INFO_HEADER_LENGTH,
(! found_record ? READING_NEXT : 0) |
parallel_flag | READING_HEADER))
@@ -3461,7 +3461,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
case COMPRESSED_RECORD:
for (searching=0 ;; searching=1, sort_param->pos++)
{
- if (_mi_read_cache(&sort_param->read_cache,(byte*) block_info.header,
+ if (_mi_read_cache(&sort_param->read_cache,(uchar*) block_info.header,
sort_param->pos,
share->pack.ref_length,READING_NEXT))
DBUG_RETURN(-1);
@@ -3489,7 +3489,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
llstr(sort_param->pos,llbuff));
continue;
}
- if (_mi_read_cache(&sort_param->read_cache,(byte*) sort_param->rec_buff,
+ if (_mi_read_cache(&sort_param->read_cache,(uchar*) sort_param->rec_buff,
block_info.filepos, block_info.rec_len,
READING_NEXT))
{
@@ -3545,8 +3545,8 @@ int sort_write_record(MI_SORT_PARAM *sort_param)
int flag;
uint length;
ulong block_length,reclength;
- byte *from;
- byte block_buff[8];
+ uchar *from;
+ uchar block_buff[8];
SORT_INFO *sort_info=sort_param->sort_info;
MI_CHECK *param=sort_info->param;
MI_INFO *info=sort_info->info;
@@ -3622,7 +3622,7 @@ int sort_write_record(MI_SORT_PARAM *sort_param)
length+= save_pack_length((uint) share->pack.version,
block_buff + length, info->blob_length);
if (my_b_write(&info->rec_cache,block_buff,length) ||
- my_b_write(&info->rec_cache,(byte*) sort_param->rec_buff,reclength))
+ my_b_write(&info->rec_cache,(uchar*) sort_param->rec_buff,reclength))
{
mi_check_print_error(param,"%d when writing to datafile",my_errno);
DBUG_RETURN(1);
@@ -3922,7 +3922,7 @@ static int sort_insert_key(MI_SORT_PARAM *sort_param,
/* Fill block with end-zero and write filled block */
mi_putint(anc_buff,key_block->last_length,nod_flag);
- bzero((byte*) anc_buff+key_block->last_length,
+ bzero((uchar*) anc_buff+key_block->last_length,
keyinfo->block_length- key_block->last_length);
key_file_length=info->state->key_file_length;
if ((filepos=_mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR)
@@ -3934,10 +3934,10 @@ static int sort_insert_key(MI_SORT_PARAM *sort_param,
if (_mi_write_keypage(info, keyinfo, filepos, DFLT_INIT_HITS, anc_buff))
DBUG_RETURN(1);
}
- else if (my_pwrite(info->s->kfile,(byte*) anc_buff,
+ else if (my_pwrite(info->s->kfile,(uchar*) anc_buff,
(uint) keyinfo->block_length,filepos, param->myf_rw))
DBUG_RETURN(1);
- DBUG_DUMP("buff",(byte*) anc_buff,mi_getint(anc_buff));
+ DBUG_DUMP("buff",(uchar*) anc_buff,mi_getint(anc_buff));
/* Write separator-key to block in next level */
if (sort_insert_key(sort_param,key_block+1,key_block->lastkey,filepos))
@@ -4028,7 +4028,7 @@ int flush_pending_blocks(MI_SORT_PARAM *sort_param)
if (nod_flag)
_mi_kpointer(info,key_block->end_pos,filepos);
key_file_length=info->state->key_file_length;
- bzero((byte*) key_block->buff+length, keyinfo->block_length-length);
+ bzero((uchar*) key_block->buff+length, keyinfo->block_length-length);
if ((filepos=_mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR)
DBUG_RETURN(1);
@@ -4039,10 +4039,10 @@ int flush_pending_blocks(MI_SORT_PARAM *sort_param)
DFLT_INIT_HITS, key_block->buff))
DBUG_RETURN(1);
}
- else if (my_pwrite(info->s->kfile,(byte*) key_block->buff,
+ else if (my_pwrite(info->s->kfile,(uchar*) key_block->buff,
(uint) keyinfo->block_length,filepos, myf_rw))
DBUG_RETURN(1);
- DBUG_DUMP("buff",(byte*) key_block->buff,length);
+ DBUG_DUMP("buff",(uchar*) key_block->buff,length);
nod_flag=1;
}
info->s->state.key_root[sort_param->key]=filepos; /* Last is root for tree */
@@ -4113,34 +4113,34 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
(param->testflag & T_UNPACK);
if (!(keyinfo=(MI_KEYDEF*) my_alloca(sizeof(MI_KEYDEF)*share.base.keys)))
DBUG_RETURN(0);
- memcpy((byte*) keyinfo,(byte*) share.keyinfo,
+ memcpy((uchar*) keyinfo,(uchar*) share.keyinfo,
(size_t) (sizeof(MI_KEYDEF)*share.base.keys));
key_parts= share.base.all_key_parts;
if (!(keysegs=(HA_KEYSEG*) my_alloca(sizeof(HA_KEYSEG)*
(key_parts+share.base.keys))))
{
- my_afree((gptr) keyinfo);
+ my_afree((uchar*) keyinfo);
DBUG_RETURN(1);
}
if (!(recdef=(MI_COLUMNDEF*)
my_alloca(sizeof(MI_COLUMNDEF)*(share.base.fields+1))))
{
- my_afree((gptr) keyinfo);
- my_afree((gptr) keysegs);
+ my_afree((uchar*) keyinfo);
+ my_afree((uchar*) keysegs);
DBUG_RETURN(1);
}
if (!(uniquedef=(MI_UNIQUEDEF*)
my_alloca(sizeof(MI_UNIQUEDEF)*(share.state.header.uniques+1))))
{
- my_afree((gptr) recdef);
- my_afree((gptr) keyinfo);
- my_afree((gptr) keysegs);
+ my_afree((uchar*) recdef);
+ my_afree((uchar*) keyinfo);
+ my_afree((uchar*) keysegs);
DBUG_RETURN(1);
}
/* Copy the column definitions */
- memcpy((byte*) recdef,(byte*) share.rec,
+ memcpy((uchar*) recdef,(uchar*) share.rec,
(size_t) (sizeof(MI_COLUMNDEF)*(share.base.fields+1)));
for (rec=recdef,end=recdef+share.base.fields; rec != end ; rec++)
{
@@ -4152,7 +4152,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
}
/* Change the new key to point at the saved key segments */
- memcpy((byte*) keysegs,(byte*) share.keyparts,
+ memcpy((uchar*) keysegs,(uchar*) share.keyparts,
(size_t) (sizeof(HA_KEYSEG)*(key_parts+share.base.keys+
share.state.header.uniques)));
keyseg=keysegs;
@@ -4169,7 +4169,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
/* Copy the unique definitions and change them to point at the new key
segments*/
- memcpy((byte*) uniquedef,(byte*) share.uniqueinfo,
+ memcpy((uchar*) uniquedef,(uchar*) share.uniqueinfo,
(size_t) (sizeof(MI_UNIQUEDEF)*(share.state.header.uniques)));
for (u_ptr=uniquedef,u_end=uniquedef+share.state.header.uniques;
u_ptr != u_end ; u_ptr++)
@@ -4251,10 +4251,10 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
goto end;
error=0;
end:
- my_afree((gptr) uniquedef);
- my_afree((gptr) keyinfo);
- my_afree((gptr) recdef);
- my_afree((gptr) keysegs);
+ my_afree((uchar*) uniquedef);
+ my_afree((uchar*) keyinfo);
+ my_afree((uchar*) recdef);
+ my_afree((uchar*) keysegs);
DBUG_RETURN(error);
}
@@ -4357,7 +4357,7 @@ err:
void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
my_bool repair_only)
{
- byte *record;
+ uchar *record;
DBUG_ENTER("update_auto_increment_key");
if (!info->s->base.auto_key ||
@@ -4376,7 +4376,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
We have to use an allocated buffer instead of info->rec_buff as
_mi_put_key_in_record() may use info->rec_buff
*/
- if (!(record= (byte*) my_malloc((uint) info->s->base.pack_reclength,
+ if (!(record= (uchar*) my_malloc((uint) info->s->base.pack_reclength,
MYF(0))))
{
mi_check_print_error(param,"Not enough memory for extra record");
@@ -4504,10 +4504,10 @@ void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part,
}
-static ha_checksum mi_byte_checksum(const byte *buf, uint length)
+static ha_checksum mi_byte_checksum(const uchar *buf, uint length)
{
ha_checksum crc;
- const byte *end=buf+length;
+ const uchar *end=buf+length;
for (crc=0; buf != end; buf++)
crc=((crc << 1) + *((uchar*) buf)) +
test(crc & (((ha_checksum) 1) << (8*sizeof(ha_checksum)-1)));
diff --git a/storage/myisam/mi_checksum.c b/storage/myisam/mi_checksum.c
index 711e87c1547..4e87de373bd 100644
--- a/storage/myisam/mi_checksum.c
+++ b/storage/myisam/mi_checksum.c
@@ -17,7 +17,7 @@
#include "myisamdef.h"
-ha_checksum mi_checksum(MI_INFO *info, const byte *buf)
+ha_checksum mi_checksum(MI_INFO *info, const uchar *buf)
{
uint i;
ha_checksum crc=0;
@@ -25,7 +25,7 @@ ha_checksum mi_checksum(MI_INFO *info, const byte *buf)
for (i=info->s->base.fields ; i-- ; buf+=(rec++)->length)
{
- const byte *pos;
+ const uchar *pos;
ulong length;
switch (rec->type) {
case FIELD_BLOB:
@@ -52,13 +52,13 @@ ha_checksum mi_checksum(MI_INFO *info, const byte *buf)
pos=buf;
break;
}
- crc=my_checksum(crc, pos ? pos : "", length);
+ crc=my_checksum(crc, pos ? pos : (uchar*) "", length);
}
return crc;
}
-ha_checksum mi_static_checksum(MI_INFO *info, const byte *pos)
+ha_checksum mi_static_checksum(MI_INFO *info, const uchar *pos)
{
return my_checksum(0, pos, info->s->base.reclength);
}
diff --git a/storage/myisam/mi_close.c b/storage/myisam/mi_close.c
index 47b7ba855c0..07105aea88d 100644
--- a/storage/myisam/mi_close.c
+++ b/storage/myisam/mi_close.c
@@ -87,8 +87,8 @@ int mi_close(register MI_INFO *info)
#endif
if (share->decode_trees)
{
- my_free((gptr) share->decode_trees,MYF(0));
- my_free((gptr) share->decode_tables,MYF(0));
+ my_free((uchar*) share->decode_trees,MYF(0));
+ my_free((uchar*) share->decode_tables,MYF(0));
}
#ifdef THREAD
thr_lock_delete(&share->lock);
@@ -102,19 +102,19 @@ int mi_close(register MI_INFO *info)
}
}
#endif
- my_free((gptr) info->s,MYF(0));
+ my_free((uchar*) info->s,MYF(0));
}
pthread_mutex_unlock(&THR_LOCK_myisam);
if (info->ftparser_param)
{
- my_free((gptr)info->ftparser_param, MYF(0));
+ my_free((uchar*)info->ftparser_param, MYF(0));
info->ftparser_param= 0;
}
if (info->dfile >= 0 && my_close(info->dfile,MYF(0)))
error = my_errno;
myisam_log_command(MI_LOG_CLOSE,info,NULL,0,error);
- my_free((gptr) info,MYF(0));
+ my_free((uchar*) info,MYF(0));
if (error)
{
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c
index 71d377c8b6b..c177aa8d987 100644
--- a/storage/myisam/mi_create.c
+++ b/storage/myisam/mi_create.c
@@ -76,7 +76,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
LINT_INIT(file);
errpos=0;
options=0;
- bzero((byte*) &share,sizeof(share));
+ bzero((uchar*) &share,sizeof(share));
if (flags & HA_DONT_TOUCH_DATA)
{
@@ -498,7 +498,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
goto err;
}
- bmove(share.state.header.file_version,(byte*) myisam_file_magic,4);
+ bmove(share.state.header.file_version,(uchar*) myisam_file_magic,4);
ci->old_options=options| (ci->old_options & HA_OPTION_TEMP_COMPRESS_RECORD ?
HA_OPTION_COMPRESS_RECORD |
HA_OPTION_TEMP_COMPRESS_RECORD: 0);
diff --git a/storage/myisam/mi_delete.c b/storage/myisam/mi_delete.c
index 409930ff7fb..29a84570f1e 100644
--- a/storage/myisam/mi_delete.c
+++ b/storage/myisam/mi_delete.c
@@ -32,7 +32,7 @@ static int _mi_ck_real_delete(register MI_INFO *info,MI_KEYDEF *keyinfo,
uchar *key, uint key_length, my_off_t *root);
-int mi_delete(MI_INFO *info,const byte *record)
+int mi_delete(MI_INFO *info,const uchar *record)
{
uint i;
uchar *old_key;
@@ -100,7 +100,7 @@ int mi_delete(MI_INFO *info,const byte *record)
info->state->records--;
mi_sizestore(lastpos,info->lastpos);
- myisam_log_command(MI_LOG_DELETE,info,(byte*) lastpos,sizeof(lastpos),0);
+ myisam_log_command(MI_LOG_DELETE,info,(uchar*) lastpos,sizeof(lastpos),0);
VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
allow_break(); /* Allow SIGHUP & SIGINT */
if (info->invalidator != 0)
@@ -114,7 +114,7 @@ int mi_delete(MI_INFO *info,const byte *record)
err:
save_errno=my_errno;
mi_sizestore(lastpos,info->lastpos);
- myisam_log_command(MI_LOG_DELETE,info,(byte*) lastpos, sizeof(lastpos),0);
+ myisam_log_command(MI_LOG_DELETE,info,(uchar*) lastpos, sizeof(lastpos),0);
if (save_errno != HA_ERR_RECORD_CHANGED)
{
mi_print_error(info->s, HA_ERR_CRASHED);
@@ -198,7 +198,7 @@ static int _mi_ck_real_delete(register MI_INFO *info, MI_KEYDEF *keyinfo,
}
}
err:
- my_afree((gptr) root_buff);
+ my_afree((uchar*) root_buff);
DBUG_PRINT("exit",("Return: %d",error));
DBUG_RETURN(error);
} /* _mi_ck_real_delete */
@@ -223,7 +223,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
my_off_t leaf_page,next_block;
uchar lastkey[MI_MAX_KEY_BUFF];
DBUG_ENTER("d_search");
- DBUG_DUMP("page",(byte*) anc_buff,mi_getint(anc_buff));
+ DBUG_DUMP("page",(uchar*) anc_buff,mi_getint(anc_buff));
search_key_length= (comp_flag & SEARCH_FIND) ? key_length : USE_WHOLE_KEY;
flag=(*keyinfo->bin_search)(info,keyinfo,anc_buff,key, search_key_length,
@@ -381,14 +381,14 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
ret_value|=_mi_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,anc_buff);
else
{
- DBUG_DUMP("page",(byte*) anc_buff,mi_getint(anc_buff));
+ DBUG_DUMP("page",(uchar*) anc_buff,mi_getint(anc_buff));
}
- my_afree((byte*) leaf_buff);
+ my_afree((uchar*) leaf_buff);
DBUG_PRINT("exit",("Return: %d",ret_value));
DBUG_RETURN(ret_value);
err:
- my_afree((byte*) leaf_buff);
+ my_afree((uchar*) leaf_buff);
DBUG_PRINT("exit",("Error: %d",my_errno));
DBUG_RETURN (-1);
} /* d_search */
@@ -411,7 +411,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key,
DBUG_ENTER("del");
DBUG_PRINT("enter",("leaf_page: %ld keypos: 0x%lx", (long) leaf_page,
(ulong) keypos));
- DBUG_DUMP("leaf_buff",(byte*) leaf_buff,mi_getint(leaf_buff));
+ DBUG_DUMP("leaf_buff",(uchar*) leaf_buff,mi_getint(leaf_buff));
endpos=leaf_buff+mi_getint(leaf_buff);
if (!(key_start=_mi_get_last_key(info,keyinfo,leaf_buff,keybuff,endpos,
@@ -428,7 +428,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key,
ret_value= -1;
else
{
- DBUG_DUMP("next_page",(byte*) next_buff,mi_getint(next_buff));
+ DBUG_DUMP("next_page",(uchar*) next_buff,mi_getint(next_buff));
if ((ret_value=del(info,keyinfo,key,anc_buff,next_page,next_buff,
keypos,next_block,ret_key)) >0)
{
@@ -455,7 +455,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key,
if (_mi_write_keypage(info,keyinfo,leaf_page,DFLT_INIT_HITS,leaf_buff))
goto err;
}
- my_afree((byte*) next_buff);
+ my_afree((uchar*) next_buff);
DBUG_RETURN(ret_value);
}
@@ -479,7 +479,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key,
prev_key, prev_key,
keybuff,&s_temp);
if (length > 0)
- bmove_upp((byte*) endpos+length,(byte*) endpos,(uint) (endpos-keypos));
+ bmove_upp((uchar*) endpos+length,(uchar*) endpos,(uint) (endpos-keypos));
else
bmove(keypos,keypos-length, (int) (endpos-keypos)+length);
(*keyinfo->store_key)(keyinfo,keypos,&s_temp);
@@ -517,8 +517,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
DBUG_ENTER("underflow");
DBUG_PRINT("enter",("leaf_page: %ld keypos: 0x%lx",(long) leaf_page,
(ulong) keypos));
- DBUG_DUMP("anc_buff",(byte*) anc_buff,mi_getint(anc_buff));
- DBUG_DUMP("leaf_buff",(byte*) leaf_buff,mi_getint(leaf_buff));
+ DBUG_DUMP("anc_buff",(uchar*) anc_buff,mi_getint(anc_buff));
+ DBUG_DUMP("leaf_buff",(uchar*) leaf_buff,mi_getint(leaf_buff));
buff=info->buff;
info->buff_used=1;
@@ -554,10 +554,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (!_mi_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,buff,0))
goto err;
buff_length=mi_getint(buff);
- DBUG_DUMP("next",(byte*) buff,buff_length);
+ DBUG_DUMP("next",(uchar*) buff,buff_length);
/* find keys to make a big key-page */
- bmove((byte*) next_keypos-key_reflength,(byte*) buff+2,
+ bmove((uchar*) next_keypos-key_reflength,(uchar*) buff+2,
key_reflength);
if (!_mi_get_last_key(info,keyinfo,anc_buff,anc_key,next_keypos,&length)
|| !_mi_get_last_key(info,keyinfo,leaf_buff,leaf_key,
@@ -572,8 +572,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
length=buff_length-p_length;
endpos=buff+length+leaf_length+t_length;
/* buff will always be larger than before !*/
- bmove_upp((byte*) endpos, (byte*) buff+buff_length,length);
- memcpy((byte*) buff, (byte*) leaf_buff,(size_t) leaf_length);
+ bmove_upp((uchar*) endpos, (uchar*) buff+buff_length,length);
+ memcpy((uchar*) buff, (uchar*) leaf_buff,(size_t) leaf_length);
(*keyinfo->store_key)(keyinfo,buff+leaf_length,&s_temp);
buff_length=(uint) (endpos-buff);
mi_putint(buff,buff_length,nod_flag);
@@ -589,7 +589,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (buff_length <= keyinfo->block_length)
{ /* Keys in one page */
- memcpy((byte*) leaf_buff,(byte*) buff,(size_t) buff_length);
+ memcpy((uchar*) leaf_buff,(uchar*) buff,(size_t) buff_length);
if (_mi_dispose(info,keyinfo,next_page,DFLT_INIT_HITS))
goto err;
}
@@ -605,7 +605,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
&key_length, &after_key)))
goto err;
length=(uint) (half_pos-buff);
- memcpy((byte*) leaf_buff,(byte*) buff,(size_t) length);
+ memcpy((uchar*) leaf_buff,(uchar*) buff,(size_t) length);
mi_putint(leaf_buff,length,nod_flag);
/* Correct new keypointer to leaf_page */
@@ -619,7 +619,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
prev_key, prev_key,
leaf_key, &s_temp);
if (t_length >= 0)
- bmove_upp((byte*) endpos+t_length,(byte*) endpos,
+ bmove_upp((uchar*) endpos+t_length,(uchar*) endpos,
(uint) (endpos-keypos));
else
bmove(keypos,keypos-t_length,(uint) (endpos-keypos)+t_length);
@@ -628,7 +628,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
/* Store key first in new page */
if (nod_flag)
- bmove((byte*) buff+2,(byte*) half_pos-nod_flag,(size_t) nod_flag);
+ bmove((uchar*) buff+2,(uchar*) half_pos-nod_flag,(size_t) nod_flag);
if (!(*keyinfo->get_key)(keyinfo,nod_flag,&half_pos,leaf_key))
goto err;
t_length=(int) (*keyinfo->pack_key)(keyinfo, nod_flag, (uchar*) 0,
@@ -636,7 +636,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
leaf_key, &s_temp);
/* t_length will always be > 0 for a new page !*/
length=(uint) ((buff+mi_getint(buff))-half_pos);
- bmove((byte*) buff+p_length+t_length,(byte*) half_pos,(size_t) length);
+ bmove((uchar*) buff+p_length+t_length,(uchar*) half_pos,(size_t) length);
(*keyinfo->store_key)(keyinfo,buff+p_length,&s_temp);
mi_putint(buff,length+t_length+p_length,nod_flag);
@@ -659,10 +659,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
goto err;
buff_length=mi_getint(buff);
endpos=buff+buff_length;
- DBUG_DUMP("prev",(byte*) buff,buff_length);
+ DBUG_DUMP("prev",(uchar*) buff,buff_length);
/* find keys to make a big key-page */
- bmove((byte*) next_keypos - key_reflength,(byte*) leaf_buff+2,
+ bmove((uchar*) next_keypos - key_reflength,(uchar*) leaf_buff+2,
key_reflength);
next_keypos=keypos;
if (!(*keyinfo->get_key)(keyinfo,key_reflength,&next_keypos,
@@ -679,10 +679,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
prev_key, prev_key,
anc_key, &s_temp);
if (t_length >= 0)
- bmove((byte*) endpos+t_length,(byte*) leaf_buff+p_length,
+ bmove((uchar*) endpos+t_length,(uchar*) leaf_buff+p_length,
(size_t) (leaf_length-p_length));
else /* We gained space */
- bmove((byte*) endpos,(byte*) leaf_buff+((int) p_length-t_length),
+ bmove((uchar*) endpos,(uchar*) leaf_buff+((int) p_length-t_length),
(size_t) (leaf_length-p_length+t_length));
(*keyinfo->store_key)(keyinfo,endpos,&s_temp);
@@ -715,8 +715,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
goto err;
_mi_kpointer(info,leaf_key+key_length,leaf_page);
/* Save key in anc_buff */
- DBUG_DUMP("anc_buff",(byte*) anc_buff,anc_length);
- DBUG_DUMP("key_to_anc",(byte*) leaf_key,key_length);
+ DBUG_DUMP("anc_buff",(uchar*) anc_buff,anc_length);
+ DBUG_DUMP("key_to_anc",(uchar*) leaf_key,key_length);
temp_pos=anc_buff+anc_length;
t_length=(*keyinfo->pack_key)(keyinfo,key_reflength,
@@ -725,7 +725,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
anc_pos, anc_pos,
leaf_key,&s_temp);
if (t_length > 0)
- bmove_upp((byte*) temp_pos+t_length,(byte*) temp_pos,
+ bmove_upp((uchar*) temp_pos+t_length,(uchar*) temp_pos,
(uint) (temp_pos-keypos));
else
bmove(keypos,keypos-t_length,(uint) (temp_pos-keypos)+t_length);
@@ -734,15 +734,15 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
/* Store first key on new page */
if (nod_flag)
- bmove((byte*) leaf_buff+2,(byte*) half_pos-nod_flag,(size_t) nod_flag);
+ bmove((uchar*) leaf_buff+2,(uchar*) half_pos-nod_flag,(size_t) nod_flag);
if (!(length=(*keyinfo->get_key)(keyinfo,nod_flag,&half_pos,leaf_key)))
goto err;
- DBUG_DUMP("key_to_leaf",(byte*) leaf_key,length);
+ DBUG_DUMP("key_to_leaf",(uchar*) leaf_key,length);
t_length=(*keyinfo->pack_key)(keyinfo,nod_flag, (uchar*) 0,
(uchar*) 0, (uchar*) 0, leaf_key, &s_temp);
length=(uint) ((buff+buff_length)-half_pos);
DBUG_PRINT("info",("t_length: %d length: %d",t_length,(int) length));
- bmove((byte*) leaf_buff+p_length+t_length,(byte*) half_pos,
+ bmove((uchar*) leaf_buff+p_length+t_length,(uchar*) half_pos,
(size_t) length);
(*keyinfo->store_key)(keyinfo,leaf_buff+p_length,&s_temp);
mi_putint(leaf_buff,length+t_length+p_length,nod_flag);
@@ -886,7 +886,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag,
}
}
end:
- bmove((byte*) start,(byte*) start+s_length,
+ bmove((uchar*) start,(uchar*) start+s_length,
(uint) (page_end-start-s_length));
DBUG_RETURN((uint) s_length);
} /* remove_key */
diff --git a/storage/myisam/mi_delete_all.c b/storage/myisam/mi_delete_all.c
index a17514486d5..dea0385cbca 100644
--- a/storage/myisam/mi_delete_all.c
+++ b/storage/myisam/mi_delete_all.c
@@ -47,7 +47,7 @@ int mi_delete_all_rows(MI_INFO *info)
for (i=0 ; i < share->base.keys ; i++)
state->key_root[i]= HA_OFFSET_ERROR;
- myisam_log_command(MI_LOG_DELETE_ALL,info,(byte*) 0,0,0);
+ myisam_log_command(MI_LOG_DELETE_ALL,info,(uchar*) 0,0,0);
/*
If we are using delayed keys or if the user has done changes to the tables
since it was locked then there may be key blocks in the key cache
diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c
index 5342619c79b..eba868bfb82 100644
--- a/storage/myisam/mi_dynrec.c
+++ b/storage/myisam/mi_dynrec.c
@@ -28,15 +28,15 @@
/* Enough for comparing if number is zero */
static char zero_string[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-static int write_dynamic_record(MI_INFO *info,const byte *record,
+static int write_dynamic_record(MI_INFO *info,const uchar *record,
ulong reclength);
static int _mi_find_writepos(MI_INFO *info,ulong reclength,my_off_t *filepos,
ulong *length);
-static int update_dynamic_record(MI_INFO *info,my_off_t filepos,byte *record,
+static int update_dynamic_record(MI_INFO *info,my_off_t filepos,uchar *record,
ulong reclength);
static int delete_dynamic_record(MI_INFO *info,my_off_t filepos,
uint second_read);
-static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos,
+static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
uint length);
#ifdef THREAD
@@ -79,13 +79,13 @@ my_bool mi_dynmap_file(MI_INFO *info, my_off_t size)
mapping. When swap space is not reserved one might get SIGSEGV
upon a write if no physical memory is available.
*/
- info->s->file_map= (byte*)
+ info->s->file_map= (uchar*)
my_mmap(0, (size_t)(size + MEMMAP_EXTRA_MARGIN),
info->s->mode==O_RDONLY ? PROT_READ :
PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_NORESERVE,
info->dfile, 0L);
- if (info->s->file_map == (byte*) MAP_FAILED)
+ if (info->s->file_map == (uchar*) MAP_FAILED)
{
info->s->file_map= NULL;
DBUG_RETURN(1);
@@ -135,7 +135,7 @@ void mi_remap_file(MI_INFO *info, my_off_t size)
0 ok
*/
-uint mi_mmap_pread(MI_INFO *info, byte *Buffer,
+uint mi_mmap_pread(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags)
{
DBUG_PRINT("info", ("mi_read with mmap %d\n", info->dfile));
@@ -167,7 +167,7 @@ uint mi_mmap_pread(MI_INFO *info, byte *Buffer,
/* wrapper for my_pread in case if mmap isn't used */
-uint mi_nommap_pread(MI_INFO *info, byte *Buffer,
+uint mi_nommap_pread(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags)
{
return my_pread(info->dfile, Buffer, Count, offset, MyFlags);
@@ -190,7 +190,7 @@ uint mi_nommap_pread(MI_INFO *info, byte *Buffer,
!=0 error. In this case return error from pwrite
*/
-uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer,
+uint mi_mmap_pwrite(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags)
{
DBUG_PRINT("info", ("mi_write with mmap %d\n", info->dfile));
@@ -224,28 +224,28 @@ uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer,
/* wrapper for my_pwrite in case if mmap isn't used */
-uint mi_nommap_pwrite(MI_INFO *info, byte *Buffer,
+uint mi_nommap_pwrite(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags)
{
return my_pwrite(info->dfile, Buffer, Count, offset, MyFlags);
}
-int _mi_write_dynamic_record(MI_INFO *info, const byte *record)
+int _mi_write_dynamic_record(MI_INFO *info, const uchar *record)
{
ulong reclength=_mi_rec_pack(info,info->rec_buff,record);
return (write_dynamic_record(info,info->rec_buff,reclength));
}
-int _mi_update_dynamic_record(MI_INFO *info, my_off_t pos, const byte *record)
+int _mi_update_dynamic_record(MI_INFO *info, my_off_t pos, const uchar *record)
{
uint length=_mi_rec_pack(info,info->rec_buff,record);
return (update_dynamic_record(info,pos,info->rec_buff,length));
}
-int _mi_write_blob_record(MI_INFO *info, const byte *record)
+int _mi_write_blob_record(MI_INFO *info, const uchar *record)
{
- byte *rec_buff;
+ uchar *rec_buff;
int error;
ulong reclength,reclength2,extra;
@@ -260,7 +260,7 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record)
return -1;
}
#endif
- if (!(rec_buff=(byte*) my_alloca(reclength)))
+ if (!(rec_buff=(uchar*) my_alloca(reclength)))
{
my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
return(-1);
@@ -277,9 +277,9 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record)
}
-int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const byte *record)
+int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const uchar *record)
{
- byte *rec_buff;
+ uchar *rec_buff;
int error;
ulong reclength,extra;
@@ -294,7 +294,7 @@ int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const byte *record)
return -1;
}
#endif
- if (!(rec_buff=(byte*) my_alloca(reclength)))
+ if (!(rec_buff=(uchar*) my_alloca(reclength)))
{
my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
return(-1);
@@ -317,7 +317,7 @@ int _mi_delete_dynamic_record(MI_INFO *info)
/* Write record to data-file */
-static int write_dynamic_record(MI_INFO *info, const byte *record,
+static int write_dynamic_record(MI_INFO *info, const uchar *record,
ulong reclength)
{
int flag;
@@ -333,7 +333,7 @@ static int write_dynamic_record(MI_INFO *info, const byte *record,
if (_mi_write_part_record(info,filepos,length,
(info->append_insert_at_end ?
HA_OFFSET_ERROR : info->s->state.dellink),
- (byte**) &record,&reclength,&flag))
+ (uchar**) &record,&reclength,&flag))
goto err;
} while (reclength);
@@ -543,7 +543,7 @@ static int delete_dynamic_record(MI_INFO *info, my_off_t filepos,
bfill(block_info.header+12,8,255);
else
mi_sizestore(block_info.header+12,block_info.next_filepos);
- if (info->s->file_write(info,(byte*) block_info.header,20,filepos,
+ if (info->s->file_write(info,(uchar*) block_info.header,20,filepos,
MYF(MY_NABP)))
DBUG_RETURN(1);
info->s->state.dellink = filepos;
@@ -566,12 +566,12 @@ int _mi_write_part_record(MI_INFO *info,
my_off_t filepos, /* points at empty block */
ulong length, /* length of block */
my_off_t next_filepos,/* Next empty block */
- byte **record, /* pointer to record ptr */
+ uchar **record, /* pointer to record ptr */
ulong *reclength, /* length of *record */
int *flag) /* *flag == 0 if header */
{
ulong head_length,res_length,extra_length,long_block,del_length;
- byte *pos,*record_end;
+ uchar *pos,*record_end;
my_off_t next_delete_block;
uchar temp[MI_SPLIT_LENGTH+MI_DYN_DELETE_BLOCK_HEADER];
DBUG_ENTER("_mi_write_part_record");
@@ -615,7 +615,7 @@ int _mi_write_part_record(MI_INFO *info,
temp[0]=13;
mi_int4store(temp+1,*reclength);
mi_int3store(temp+5,length-head_length);
- mi_sizestore((byte*) temp+8,next_filepos);
+ mi_sizestore((uchar*) temp+8,next_filepos);
}
else
{
@@ -625,13 +625,13 @@ int _mi_write_part_record(MI_INFO *info,
{
mi_int3store(temp+1,*reclength);
mi_int3store(temp+4,length-head_length);
- mi_sizestore((byte*) temp+7,next_filepos);
+ mi_sizestore((uchar*) temp+7,next_filepos);
}
else
{
mi_int2store(temp+1,*reclength);
mi_int2store(temp+3,length-head_length);
- mi_sizestore((byte*) temp+5,next_filepos);
+ mi_sizestore((uchar*) temp+5,next_filepos);
}
}
}
@@ -642,12 +642,12 @@ int _mi_write_part_record(MI_INFO *info,
if (long_block)
{
mi_int3store(temp+1,length-head_length);
- mi_sizestore((byte*) temp+4,next_filepos);
+ mi_sizestore((uchar*) temp+4,next_filepos);
}
else
{
mi_int2store(temp+1,length-head_length);
- mi_sizestore((byte*) temp+3,next_filepos);
+ mi_sizestore((uchar*) temp+3,next_filepos);
}
}
}
@@ -668,14 +668,14 @@ int _mi_write_part_record(MI_INFO *info,
}
length= *reclength+head_length; /* Write only what is needed */
}
- DBUG_DUMP("header",(byte*) temp,head_length);
+ DBUG_DUMP("header",(uchar*) temp,head_length);
/* Make a long block for one write */
record_end= *record+length-head_length;
del_length=(res_length ? MI_DYN_DELETE_BLOCK_HEADER : 0);
- bmove((byte*) (*record-head_length),(byte*) temp,head_length);
+ bmove((uchar*) (*record-head_length),(uchar*) temp,head_length);
memcpy(temp,record_end,(size_t) (extra_length+del_length));
- bzero((byte*) record_end,extra_length);
+ bzero((uchar*) record_end,extra_length);
if (res_length)
{
@@ -715,18 +715,18 @@ int _mi_write_part_record(MI_INFO *info,
if (info->update & HA_STATE_EXTEND_BLOCK)
{
info->update&= ~HA_STATE_EXTEND_BLOCK;
- if (my_block_write(&info->rec_cache,(byte*) *record-head_length,
+ if (my_block_write(&info->rec_cache,(uchar*) *record-head_length,
length+extra_length+del_length,filepos))
goto err;
}
- else if (my_b_write(&info->rec_cache,(byte*) *record-head_length,
+ else if (my_b_write(&info->rec_cache,(uchar*) *record-head_length,
length+extra_length+del_length))
goto err;
}
else
{
info->rec_cache.seek_not_done=1;
- if (info->s->file_write(info,(byte*) *record-head_length,length+extra_length+
+ if (info->s->file_write(info,(uchar*) *record-head_length,length+extra_length+
del_length,filepos,info->s->write_flag))
goto err;
}
@@ -752,7 +752,7 @@ err:
/* update record from datafile */
-static int update_dynamic_record(MI_INFO *info, my_off_t filepos, byte *record,
+static int update_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *record,
ulong reclength)
{
int flag;
@@ -836,7 +836,7 @@ static int update_dynamic_record(MI_INFO *info, my_off_t filepos, byte *record,
mi_int3store(del_block.header+1, rest_length);
mi_sizestore(del_block.header+4,info->s->state.dellink);
bfill(del_block.header+12,8,255);
- if (info->s->file_write(info,(byte*) del_block.header,20, next_pos,
+ if (info->s->file_write(info,(uchar*) del_block.header,20, next_pos,
MYF(MY_NABP)))
DBUG_RETURN(1);
info->s->state.dellink= next_pos;
@@ -875,10 +875,11 @@ err:
/* Pack a record. Return new reclength */
-uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from)
+uint _mi_rec_pack(MI_INFO *info, register uchar *to,
+ register const uchar *from)
{
uint length,new_length,flag,bit,i;
- char *pos,*end,*startpos,*packpos;
+ uchar *pos,*end,*startpos,*packpos;
enum en_fieldtype type;
reg3 MI_COLUMNDEF *rec;
MI_BLOB *blob;
@@ -901,7 +902,7 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from)
{
char *temp_pos;
size_t tmp_length=length-mi_portable_sizeof_char_ptr;
- memcpy((byte*) to,from,tmp_length);
+ memcpy((uchar*) to,from,tmp_length);
memcpy_fixed(&temp_pos,from+tmp_length,sizeof(char*));
memcpy(to+tmp_length,temp_pos,(size_t) blob->length);
to+=tmp_length+blob->length;
@@ -910,17 +911,17 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from)
}
else if (type == FIELD_SKIP_ZERO)
{
- if (memcmp((byte*) from,zero_string,length) == 0)
+ if (memcmp((uchar*) from,zero_string,length) == 0)
flag|=bit;
else
{
- memcpy((byte*) to,from,(size_t) length); to+=length;
+ memcpy((uchar*) to,from,(size_t) length); to+=length;
}
}
else if (type == FIELD_SKIP_ENDSPACE ||
type == FIELD_SKIP_PRESPACE)
{
- pos= (byte*) from; end= (byte*) from + length;
+ pos= (uchar*) from; end= (uchar*) from + length;
if (type == FIELD_SKIP_ENDSPACE)
{ /* Pack trailing spaces */
while (end > from && *(end-1) == ' ')
@@ -943,7 +944,7 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from)
}
else
*to++= (char) new_length;
- memcpy((byte*) to,pos,(size_t) new_length); to+=new_length;
+ memcpy((uchar*) to,pos,(size_t) new_length); to+=new_length;
flag|=bit;
}
else
@@ -1000,11 +1001,11 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from)
Returns 0 if record is ok.
*/
-my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff,
+my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *rec_buff,
ulong packed_length, my_bool with_checksum)
{
uint length,new_length,flag,bit,i;
- char *pos,*end,*packpos,*to;
+ uchar *pos,*end,*packpos,*to;
enum en_fieldtype type;
reg3 MI_COLUMNDEF *rec;
DBUG_ENTER("_mi_rec_check");
@@ -1029,7 +1030,7 @@ my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff,
}
else if (type == FIELD_SKIP_ZERO)
{
- if (memcmp((byte*) record,zero_string,length) == 0)
+ if (memcmp((uchar*) record,zero_string,length) == 0)
{
if (!(flag & bit))
goto err;
@@ -1040,7 +1041,7 @@ my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff,
else if (type == FIELD_SKIP_ENDSPACE ||
type == FIELD_SKIP_PRESPACE)
{
- pos= (byte*) record; end= (byte*) record + length;
+ pos= (uchar*) record; end= (uchar*) record + length;
if (type == FIELD_SKIP_ENDSPACE)
{ /* Pack trailing spaces */
while (end > record && *(end-1) == ' ')
@@ -1122,12 +1123,12 @@ err:
/* Returns -1 and my_errno =HA_ERR_RECORD_DELETED if reclength isn't */
/* right. Returns reclength (>0) if ok */
-ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from,
+ulong _mi_rec_unpack(register MI_INFO *info, register uchar *to, uchar *from,
ulong found_length)
{
uint flag,bit,length,rec_length,min_pack_length;
enum en_fieldtype type;
- byte *from_end,*to_end,*packpos;
+ uchar *from_end,*to_end,*packpos;
reg3 MI_COLUMNDEF *rec,*end_field;
DBUG_ENTER("_mi_rec_unpack");
@@ -1173,7 +1174,7 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from,
if (flag & bit)
{
if (type == FIELD_BLOB || type == FIELD_SKIP_ZERO)
- bzero((byte*) to,rec_length);
+ bzero((uchar*) to,rec_length);
else if (type == FIELD_SKIP_ENDSPACE ||
type == FIELD_SKIP_PRESPACE)
{
@@ -1195,13 +1196,13 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from,
goto err;
if (type == FIELD_SKIP_ENDSPACE)
{
- memcpy(to,(byte*) from,(size_t) length);
- bfill((byte*) to+length,rec_length-length,' ');
+ memcpy(to,(uchar*) from,(size_t) length);
+ bfill((uchar*) to+length,rec_length-length,' ');
}
else
{
- bfill((byte*) to,rec_length-length,' ');
- memcpy(to+rec_length-length,(byte*) from,(size_t) length);
+ bfill((uchar*) to,rec_length-length,' ');
+ memcpy(to+rec_length-length,(uchar*) from,(size_t) length);
}
from+=length;
}
@@ -1215,9 +1216,9 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from,
from_left - size_length < blob_length ||
from_left - size_length - blob_length < min_pack_length)
goto err;
- memcpy((byte*) to,(byte*) from,(size_t) size_length);
+ memcpy((uchar*) to,(uchar*) from,(size_t) size_length);
from+=size_length;
- memcpy_fixed((byte*) to+size_length,(byte*) &from,sizeof(char*));
+ memcpy_fixed((uchar*) to+size_length,(uchar*) &from,sizeof(char*));
from+=blob_length;
}
else
@@ -1226,7 +1227,7 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from,
min_pack_length--;
if (min_pack_length + rec_length > (uint) (from_end - from))
goto err;
- memcpy(to,(byte*) from,(size_t) rec_length); from+=rec_length;
+ memcpy(to,(uchar*) from,(size_t) rec_length); from+=rec_length;
}
if ((bit= bit << 1) >= 256)
{
@@ -1238,7 +1239,7 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from,
if (min_pack_length > (uint) (from_end - from))
goto err;
min_pack_length-=rec_length;
- memcpy(to, (byte*) from, (size_t) rec_length);
+ memcpy(to, (uchar*) from, (size_t) rec_length);
from+=rec_length;
}
}
@@ -1251,14 +1252,14 @@ err:
my_errno= HA_ERR_WRONG_IN_RECORD;
DBUG_PRINT("error",("to_end: 0x%lx -> 0x%lx from_end: 0x%lx -> 0x%lx",
(long) to, (long) to_end, (long) from, (long) from_end));
- DBUG_DUMP("from",(byte*) info->rec_buff,info->s->base.min_pack_length);
+ DBUG_DUMP("from",(uchar*) info->rec_buff,info->s->base.min_pack_length);
DBUG_RETURN(MY_FILE_ERROR);
} /* _mi_rec_unpack */
/* Calc length of blob. Update info in blobs->length */
-ulong _my_calc_total_blob_length(MI_INFO *info, const byte *record)
+ulong _my_calc_total_blob_length(MI_INFO *info, const uchar *record)
{
ulong length;
MI_BLOB *blob,*end;
@@ -1274,7 +1275,7 @@ ulong _my_calc_total_blob_length(MI_INFO *info, const byte *record)
}
-ulong _mi_calc_blob_length(uint length, const byte *pos)
+ulong _mi_calc_blob_length(uint length, const uchar *pos)
{
switch (length) {
case 1:
@@ -1292,7 +1293,7 @@ ulong _mi_calc_blob_length(uint length, const byte *pos)
}
-void _my_store_blob_length(byte *pos,uint pack_length,uint length)
+void _my_store_blob_length(uchar *pos,uint pack_length,uint length)
{
switch (pack_length) {
case 1:
@@ -1345,11 +1346,11 @@ void _my_store_blob_length(byte *pos,uint pack_length,uint length)
-1 Error
*/
-int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf)
+int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *buf)
{
int block_of_record;
uint b_type,left_length;
- byte *to;
+ uchar *to;
MI_BLOCK_INFO block_info;
File file;
DBUG_ENTER("mi_read_dynamic_record");
@@ -1405,7 +1406,7 @@ int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf)
prefetch_len= block_info.data_len;
if (prefetch_len)
{
- memcpy((byte*) to, block_info.header + offset, prefetch_len);
+ memcpy((uchar*) to, block_info.header + offset, prefetch_len);
block_info.data_len-= prefetch_len;
left_length-= prefetch_len;
to+= prefetch_len;
@@ -1423,7 +1424,7 @@ int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf)
there is no equivalent without seeking. We are at the right
position already. :(
*/
- if (info->s->file_read(info, (byte*) to, block_info.data_len,
+ if (info->s->file_read(info, (uchar*) to, block_info.data_len,
filepos, MYF(MY_NABP)))
goto panic;
left_length-=block_info.data_len;
@@ -1450,9 +1451,9 @@ err:
/* compare unique constraint between stored rows */
int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def,
- const byte *record, my_off_t pos)
+ const uchar *record, my_off_t pos)
{
- byte *rec_buff,*old_record;
+ uchar *rec_buff,*old_record;
int error;
DBUG_ENTER("_mi_cmp_dynamic_unique");
@@ -1478,11 +1479,11 @@ int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def,
/* Compare of record one disk with packed record in memory */
-int _mi_cmp_dynamic_record(register MI_INFO *info, register const byte *record)
+int _mi_cmp_dynamic_record(register MI_INFO *info, register const uchar *record)
{
uint flag,reclength,b_type;
my_off_t filepos;
- byte *buffer;
+ uchar *buffer;
MI_BLOCK_INFO block_info;
DBUG_ENTER("_mi_cmp_dynamic_record");
@@ -1504,7 +1505,7 @@ int _mi_cmp_dynamic_record(register MI_INFO *info, register const byte *record)
{ /* If check isn't disabled */
if (info->s->base.blobs)
{
- if (!(buffer=(byte*) my_alloca(info->s->base.pack_reclength+
+ if (!(buffer=(uchar*) my_alloca(info->s->base.pack_reclength+
_my_calc_total_blob_length(info,record))))
DBUG_RETURN(-1);
}
@@ -1552,14 +1553,14 @@ int _mi_cmp_dynamic_record(register MI_INFO *info, register const byte *record)
my_errno=0;
err:
if (buffer != info->rec_buff)
- my_afree((gptr) buffer);
+ my_afree((uchar*) buffer);
DBUG_RETURN(my_errno);
}
/* Compare file to buffert */
-static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos,
+static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
uint length)
{
uint next_length;
@@ -1571,7 +1572,7 @@ static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos,
while (length > IO_SIZE*2)
{
if (my_pread(file,temp_buff,next_length,filepos, MYF(MY_NABP)) ||
- memcmp((byte*) buff,temp_buff,next_length))
+ memcmp((uchar*) buff,temp_buff,next_length))
goto err;
filepos+=next_length;
buff+=next_length;
@@ -1580,7 +1581,7 @@ static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos,
}
if (my_pread(file,temp_buff,length,filepos,MYF(MY_NABP)))
goto err;
- DBUG_RETURN(memcmp((byte*) buff,temp_buff,length));
+ DBUG_RETURN(memcmp((uchar*) buff,temp_buff,length));
err:
DBUG_RETURN(1);
}
@@ -1620,13 +1621,13 @@ err:
!= 0 Error
*/
-int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
+int _mi_read_rnd_dynamic_record(MI_INFO *info, uchar *buf,
register my_off_t filepos,
my_bool skip_deleted_blocks)
{
int block_of_record, info_read, save_errno;
uint left_len,b_type;
- byte *to;
+ uchar *to;
MI_BLOCK_INFO block_info;
MYISAM_SHARE *share=info->s;
DBUG_ENTER("_mi_read_rnd_dynamic_record");
@@ -1672,7 +1673,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
}
if (info->opt_flag & READ_CACHE_USED)
{
- if (_mi_read_cache(&info->rec_cache,(byte*) block_info.header,filepos,
+ if (_mi_read_cache(&info->rec_cache,(uchar*) block_info.header,filepos,
sizeof(block_info.header),
(!block_of_record && skip_deleted_blocks ?
READING_NEXT : 0) | READING_HEADER))
@@ -1735,7 +1736,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
tmp_length= block_info.data_len;
if (tmp_length)
{
- memcpy((byte*) to, block_info.header+offset,tmp_length);
+ memcpy((uchar*) to, block_info.header+offset,tmp_length);
block_info.data_len-=tmp_length;
left_len-=tmp_length;
to+=tmp_length;
@@ -1747,7 +1748,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
{
if (info->opt_flag & READ_CACHE_USED)
{
- if (_mi_read_cache(&info->rec_cache,(byte*) to,filepos,
+ if (_mi_read_cache(&info->rec_cache,(uchar*) to,filepos,
block_info.data_len,
(!block_of_record && skip_deleted_blocks) ?
READING_NEXT : 0))
@@ -1761,7 +1762,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
flush_io_cache(&info->rec_cache))
goto err;
/* VOID(my_seek(info->dfile,filepos,MY_SEEK_SET,MYF(0))); */
- if (my_read(info->dfile,(byte*) to,block_info.data_len,MYF(MY_NABP)))
+ if (my_read(info->dfile,(uchar*) to,block_info.data_len,MYF(MY_NABP)))
{
if (my_errno == -1)
my_errno= HA_ERR_WRONG_IN_RECORD; /* Unexpected end of file */
@@ -1818,7 +1819,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
sizeof(info->header))
goto err;
}
- DBUG_DUMP("header",(byte*) header,MI_BLOCK_INFO_HEADER_LENGTH);
+ DBUG_DUMP("header",(uchar*) header,MI_BLOCK_INFO_HEADER_LENGTH);
if (info->second_read)
{
if (info->header[0] <= 6 || info->header[0] == 13)
diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c
index 729174b6f88..72c40741a22 100644
--- a/storage/myisam/mi_extra.c
+++ b/storage/myisam/mi_extra.c
@@ -180,8 +180,8 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
case HA_EXTRA_KEYREAD: /* Read only keys to record */
case HA_EXTRA_REMEMBER_POS:
info->opt_flag |= REMEMBER_OLD_POS;
- bmove((byte*) info->lastkey+share->base.max_key_length*2,
- (byte*) info->lastkey,info->lastkey_length);
+ bmove((uchar*) info->lastkey+share->base.max_key_length*2,
+ (uchar*) info->lastkey,info->lastkey_length);
info->save_update= info->update;
info->save_lastinx= info->lastinx;
info->save_lastpos= info->lastpos;
@@ -197,8 +197,8 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
case HA_EXTRA_RESTORE_POS:
if (info->opt_flag & REMEMBER_OLD_POS)
{
- bmove((byte*) info->lastkey,
- (byte*) info->lastkey+share->base.max_key_length*2,
+ bmove((uchar*) info->lastkey,
+ (uchar*) info->lastkey+share->base.max_key_length*2,
info->save_lastkey_length);
info->update= info->save_update | HA_STATE_WRITTEN;
info->lastinx= info->save_lastinx;
@@ -385,7 +385,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
{
char tmp[1];
tmp[0]=function;
- myisam_log_command(MI_LOG_EXTRA,info,(byte*) tmp,1,error);
+ myisam_log_command(MI_LOG_EXTRA,info,(uchar*) tmp,1,error);
}
DBUG_RETURN(error);
} /* mi_extra */
diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c
index 2f4915dec39..230ebac3bb0 100644
--- a/storage/myisam/mi_key.c
+++ b/storage/myisam/mi_key.c
@@ -31,7 +31,7 @@
set_if_smaller(char_length,length); \
} while(0)
-static int _mi_put_key_in_record(MI_INFO *info,uint keynr,byte *record);
+static int _mi_put_key_in_record(MI_INFO *info,uint keynr,uchar *record);
/*
Make a intern key from a record
@@ -49,9 +49,9 @@ static int _mi_put_key_in_record(MI_INFO *info,uint keynr,byte *record);
*/
uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
- const byte *record, my_off_t filepos)
+ const uchar *record, my_off_t filepos)
{
- byte *pos;
+ uchar *pos;
uchar *start;
reg1 HA_KEYSEG *keyseg;
my_bool is_ft= info->s->keyinfo[keynr].flag & HA_FULLTEXT;
@@ -90,7 +90,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
char_length= ((!is_ft && cs && cs->mbmaxlen > 1) ? length/cs->mbmaxlen :
length);
- pos= (byte*) record+keyseg->start;
+ pos= (uchar*) record+keyseg->start;
if (type == HA_KEYTYPE_BIT)
{
if (keyseg->bit_length)
@@ -100,7 +100,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
*key++= bits;
length--;
}
- memcpy((byte*) key, pos, length);
+ memcpy((uchar*) key, pos, length);
key+= length;
continue;
}
@@ -112,14 +112,14 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
}
else
{
- byte *end= pos + length;
+ uchar *end= pos + length;
while (pos < end && pos[0] == ' ')
pos++;
length=(uint) (end-pos);
}
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((byte*) key,(byte*) pos,(size_t) char_length);
+ memcpy((uchar*) key,(uchar*) pos,(size_t) char_length);
key+=char_length;
continue;
}
@@ -132,18 +132,18 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
set_if_smaller(length,tmp_length);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((byte*) key,(byte*) pos,(size_t) char_length);
+ memcpy((uchar*) key,(uchar*) pos,(size_t) char_length);
key+= char_length;
continue;
}
else if (keyseg->flag & HA_BLOB_PART)
{
uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos);
- memcpy_fixed((byte*) &pos,pos+keyseg->bit_start,sizeof(char*));
+ memcpy_fixed((uchar*) &pos,pos+keyseg->bit_start,sizeof(char*));
set_if_smaller(length,tmp_length);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((byte*) key,(byte*) pos,(size_t) char_length);
+ memcpy((uchar*) key,(uchar*) pos,(size_t) char_length);
key+= char_length;
continue;
}
@@ -182,14 +182,14 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
continue;
}
FIX_LENGTH(cs, pos, length, char_length);
- memcpy((byte*) key, pos, char_length);
+ memcpy((uchar*) key, pos, char_length);
if (length > char_length)
cs->cset->fill(cs, (char*) key+char_length, length-char_length, ' ');
key+= length;
}
_mi_dpointer(info,key,filepos);
DBUG_PRINT("exit",("keynr: %d",keynr));
- DBUG_DUMP("key",(byte*) start,(uint) (key-start)+keyseg->length);
+ DBUG_DUMP("key",(uchar*) start,(uint) (key-start)+keyseg->length);
DBUG_EXECUTE("key",
_mi_print_key(DBUG_FILE,info->s->keyinfo[keynr].seg,start,
(uint) (key-start)););
@@ -267,7 +267,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
length=(uint) (end-pos);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((byte*) key,pos,(size_t) char_length);
+ memcpy((uchar*) key,pos,(size_t) char_length);
key+= char_length;
continue;
}
@@ -280,7 +280,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
old+=2; /* Skip length */
- memcpy((byte*) key, pos,(size_t) char_length);
+ memcpy((uchar*) key, pos,(size_t) char_length);
key+= char_length;
continue;
}
@@ -292,7 +292,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
continue;
}
FIX_LENGTH(cs, pos, length, char_length);
- memcpy((byte*) key, pos, char_length);
+ memcpy((uchar*) key, pos, char_length);
if (length > char_length)
cs->cset->fill(cs, (char*) key+char_length, length-char_length, ' ');
key+= length;
@@ -325,16 +325,16 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
*/
static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
- byte *record)
+ uchar *record)
{
- reg2 byte *key;
- byte *pos,*key_end;
+ reg2 uchar *key;
+ uchar *pos,*key_end;
reg1 HA_KEYSEG *keyseg;
- byte *blob_ptr;
+ uchar *blob_ptr;
DBUG_ENTER("_mi_put_key_in_record");
- blob_ptr= (byte*) info->lastkey2; /* Place to put blob parts */
- key=(byte*) info->lastkey; /* KEy that was read */
+ blob_ptr= (uchar*) info->lastkey2; /* Place to put blob parts */
+ key=(uchar*) info->lastkey; /* KEy that was read */
key_end=key+info->lastkey_length;
for (keyseg=info->s->keyinfo[keynr].seg ; keyseg->type ;keyseg++)
{
@@ -363,7 +363,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
clr_rec_bits(record + keyseg->bit_pos, keyseg->bit_start,
keyseg->bit_length);
}
- memcpy(record + keyseg->start, (byte*) key, length);
+ memcpy(record + keyseg->start, (uchar*) key, length);
key+= length;
continue;
}
@@ -406,7 +406,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
else
int2store(record+keyseg->start, length);
/* And key data */
- memcpy(record+keyseg->start + keyseg->bit_start, (byte*) key, length);
+ memcpy(record+keyseg->start + keyseg->bit_start, (uchar*) key, length);
key+= length;
}
else if (keyseg->flag & HA_BLOB_PART)
@@ -431,8 +431,8 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
}
else if (keyseg->flag & HA_SWAP_KEY)
{
- byte *to= record+keyseg->start+keyseg->length;
- byte *end= key+keyseg->length;
+ uchar *to= record+keyseg->start+keyseg->length;
+ uchar *end= key+keyseg->length;
#ifdef CHECK_KEYS
if (end > key_end)
goto err;
@@ -449,7 +449,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
if (key+keyseg->length > key_end)
goto err;
#endif
- memcpy(record+keyseg->start,(byte*) key,
+ memcpy(record+keyseg->start,(uchar*) key,
(size_t) keyseg->length);
key+= keyseg->length;
}
@@ -463,7 +463,7 @@ err:
/* Here when key reads are used */
-int _mi_read_key_record(MI_INFO *info, my_off_t filepos, byte *buf)
+int _mi_read_key_record(MI_INFO *info, my_off_t filepos, uchar *buf)
{
fast_mi_writeinfo(info);
if (filepos != HA_OFFSET_ERROR)
@@ -498,7 +498,7 @@ int _mi_read_key_record(MI_INFO *info, my_off_t filepos, byte *buf)
less than zero.
*/
-ulonglong retrieve_auto_increment(MI_INFO *info,const byte *record)
+ulonglong retrieve_auto_increment(MI_INFO *info,const uchar *record)
{
ulonglong value= 0; /* Store unsigned values here */
longlong s_value= 0; /* Store signed values here */
diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c
index e822ea9e6da..6aa62b70ae3 100644
--- a/storage/myisam/mi_locking.c
+++ b/storage/myisam/mi_locking.c
@@ -254,7 +254,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
pthread_mutex_unlock(&share->intern_lock);
#if defined(FULL_LOG) || defined(_lint)
lock_type|=(int) (flag << 8); /* Set bit to set if real lock */
- myisam_log_command(MI_LOG_LOCK,info,(byte*) &lock_type,sizeof(lock_type),
+ myisam_log_command(MI_LOG_LOCK,info,(uchar*) &lock_type,sizeof(lock_type),
error);
#endif
DBUG_RETURN(error);
diff --git a/storage/myisam/mi_log.c b/storage/myisam/mi_log.c
index f720f752a06..91d3bb6f702 100644
--- a/storage/myisam/mi_log.c
+++ b/storage/myisam/mi_log.c
@@ -74,7 +74,7 @@ int mi_log(int activate_log)
/* All logs starts with command(1) dfile(2) process(4) result(2) */
void _myisam_log(enum myisam_log_commands command, MI_INFO *info,
- const byte *buffert, uint length)
+ const uchar *buffert, uint length)
{
char buff[11];
int error,old_errno;
@@ -98,7 +98,7 @@ void _myisam_log(enum myisam_log_commands command, MI_INFO *info,
void _myisam_log_command(enum myisam_log_commands command, MI_INFO *info,
- const byte *buffert, uint length, int result)
+ const uchar *buffert, uint length, int result)
{
char buff[9];
int error,old_errno;
@@ -122,7 +122,7 @@ void _myisam_log_command(enum myisam_log_commands command, MI_INFO *info,
void _myisam_log_record(enum myisam_log_commands command, MI_INFO *info,
- const byte *record, my_off_t filepos, int result)
+ const uchar *record, my_off_t filepos, int result)
{
char buff[21],*pos;
int error,old_errno;
@@ -143,7 +143,7 @@ void _myisam_log_record(enum myisam_log_commands command, MI_INFO *info,
pthread_mutex_lock(&THR_LOCK_myisam);
error=my_lock(myisam_log_file,F_WRLCK,0L,F_TO_EOF,MYF(MY_SEEK_NOT_DONE));
VOID(my_write(myisam_log_file,buff,sizeof(buff),MYF(0)));
- VOID(my_write(myisam_log_file,(byte*) record,info->s->base.reclength,MYF(0)));
+ VOID(my_write(myisam_log_file,(uchar*) record,info->s->base.reclength,MYF(0)));
if (info->s->base.blobs)
{
MI_BLOB *blob,*end;
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index f4e089b6313..9ff8ecdb14d 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -92,7 +92,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
lock_error=1;
errpos=0;
head_length=sizeof(share_buff.state.header);
- bzero((byte*) &info,sizeof(info));
+ bzero((uchar*) &info,sizeof(info));
my_realpath(name_buff, fn_format(org_name,name,"",MI_NAME_IEXT,
MY_UNPACK_FILENAME),MYF(0));
@@ -100,7 +100,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
if (!(old_info=test_if_reopen(name_buff)))
{
share= &share_buff;
- bzero((gptr) &share_buff,sizeof(share_buff));
+ bzero((uchar*) &share_buff,sizeof(share_buff));
share_buff.state.rec_per_key_part=rec_per_key_part;
share_buff.state.key_root=key_root;
share_buff.state.key_del=key_del;
@@ -127,8 +127,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
my_errno= HA_ERR_NOT_A_TABLE;
goto err;
}
- if (memcmp((byte*) share->state.header.file_version,
- (byte*) myisam_file_magic, 4))
+ if (memcmp((uchar*) share->state.header.file_version,
+ (uchar*) myisam_file_magic, 4))
{
DBUG_PRINT("error",("Wrong header in %s",name_buff));
DBUG_DUMP("error_dump",(char*) share->state.header.file_version,
@@ -504,7 +504,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
else if (share->options & HA_OPTION_PACK_RECORD)
share->data_file_type = DYNAMIC_RECORD;
- my_afree((gptr) disk_cache);
+ my_afree((uchar*) disk_cache);
mi_setup_functions(share);
share->is_log_table= FALSE;
#ifdef THREAD
@@ -642,7 +642,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
if (myisam_log_file >= 0)
{
intern_filename(name_buff,share->index_file_name);
- _myisam_log(MI_LOG_OPEN,m_info,name_buff,(uint) strlen(name_buff));
+ _myisam_log(MI_LOG_OPEN, m_info,name_buff, strlen(name_buff));
}
DBUG_RETURN(m_info);
@@ -654,7 +654,7 @@ err:
mi_report_error(save_errno, name);
switch (errpos) {
case 6:
- my_free((gptr) m_info,MYF(0));
+ my_free((uchar*) m_info,MYF(0));
/* fall through */
case 5:
VOID(my_close(info.dfile,MYF(0)));
@@ -662,14 +662,14 @@ err:
break; /* Don't remove open table */
/* fall through */
case 4:
- my_free((gptr) share,MYF(0));
+ my_free((uchar*) share,MYF(0));
/* fall through */
case 3:
if (! lock_error)
VOID(my_lock(kfile, F_UNLCK, 0L, F_TO_EOF, MYF(MY_SEEK_NOT_DONE)));
/* fall through */
case 2:
- my_afree((gptr) disk_cache);
+ my_afree((uchar*) disk_cache);
/* fall through */
case 1:
VOID(my_close(kfile,MYF(0)));
@@ -684,7 +684,7 @@ err:
} /* mi_open */
-byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf)
+uchar *mi_alloc_rec_buff(MI_INFO *info, ulong length, uchar **buf)
{
uint extra;
uint32 old_length;
@@ -692,7 +692,7 @@ byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf)
if (! *buf || length > (old_length=mi_get_rec_buff_len(info, *buf)))
{
- byte *newptr = *buf;
+ uchar *newptr = *buf;
/* to simplify initial init of info->rec_buf in mi_open and mi_extra */
if (length == (ulong) -1)
@@ -709,7 +709,7 @@ byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf)
MI_REC_BUFF_OFFSET : 0);
if (extra && newptr)
newptr-= MI_REC_BUFF_OFFSET;
- if (!(newptr=(byte*) my_realloc((gptr)newptr, length+extra+8,
+ if (!(newptr=(uchar*) my_realloc((uchar*)newptr, length+extra+8,
MYF(MY_ALLOW_ZERO_PTR))))
return newptr;
*((uint32 *) newptr)= (uint32) length;
@@ -899,10 +899,10 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite)
}
if (pWrite & 1)
- DBUG_RETURN(my_pwrite(file,(char*) buff, (uint) (ptr-buff), 0L,
- MYF(MY_NABP | MY_THREADSAFE)));
- DBUG_RETURN(my_write(file, (char*) buff, (uint) (ptr-buff),
- MYF(MY_NABP)));
+ DBUG_RETURN(my_pwrite(file, buff, (size_t) (ptr-buff), 0L,
+ MYF(MY_NABP | MY_THREADSAFE)) != 0);
+ DBUG_RETURN(my_write(file, buff, (size_t) (ptr-buff),
+ MYF(MY_NABP)) != 0);
}
@@ -968,10 +968,10 @@ uint mi_state_info_read_dsk(File file, MI_STATE_INFO *state, my_bool pRead)
if (pRead)
{
if (my_pread(file, buff, state->state_length,0L, MYF(MY_NABP)))
- return (MY_FILE_ERROR);
+ return 1;
}
else if (my_read(file, buff, state->state_length,MYF(MY_NABP)))
- return (MY_FILE_ERROR);
+ return 1;
mi_state_info_read((uchar*) buff, state);
}
return 0;
@@ -1013,7 +1013,7 @@ uint mi_base_info_write(File file, MI_BASE_INFO *base)
mi_int2store(ptr,base->raid_chunks); ptr +=2;
mi_int4store(ptr,base->raid_chunksize); ptr +=4;
bzero(ptr,6); ptr +=6; /* extra */
- return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP));
+ return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
}
@@ -1073,7 +1073,7 @@ uint mi_keydef_write(File file, MI_KEYDEF *keydef)
mi_int2store(ptr,keydef->keylength); ptr +=2;
mi_int2store(ptr,keydef->minlength); ptr +=2;
mi_int2store(ptr,keydef->maxlength); ptr +=2;
- return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP));
+ return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
}
char *mi_keydef_read(char *ptr, MI_KEYDEF *keydef)
@@ -1117,7 +1117,7 @@ int mi_keyseg_write(File file, const HA_KEYSEG *keyseg)
mi_int4store(ptr, pos);
ptr+=4;
- return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP));
+ return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
}
@@ -1157,7 +1157,7 @@ uint mi_uniquedef_write(File file, MI_UNIQUEDEF *def)
*ptr++= (uchar) def->key;
*ptr++ = (uchar) def->null_are_equal;
- return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP));
+ return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
}
char *mi_uniquedef_read(char *ptr, MI_UNIQUEDEF *def)
@@ -1181,7 +1181,7 @@ uint mi_recinfo_write(File file, MI_COLUMNDEF *recinfo)
mi_int2store(ptr,recinfo->length); ptr +=2;
*ptr++ = recinfo->null_bit;
mi_int2store(ptr,recinfo->null_pos); ptr+= 2;
- return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP));
+ return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
}
char *mi_recinfo_read(char *ptr, MI_COLUMNDEF *recinfo)
@@ -1202,7 +1202,8 @@ The argument file_to_dup is here for the future if there would on some OS
exist a dup()-like call that would give us two different file descriptors.
*************************************************************************/
-int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup __attribute__((unused)))
+int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share,
+ File file_to_dup __attribute__((unused)))
{
#ifdef USE_RAID
if (share->base.raid_type)
diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c
index a5a9aaededd..1231ef026f7 100644
--- a/storage/myisam/mi_packrec.c
+++ b/storage/myisam/mi_packrec.c
@@ -48,7 +48,7 @@
#define OFFSET_TABLE_SIZE 512
static uint read_huff_table(MI_BIT_BUFF *bit_buff,MI_DECODE_TREE *decode_tree,
- uint16 **decode_table,byte **intervall_buff,
+ uint16 **decode_table,uchar **intervall_buff,
uint16 *tmp_buff);
static void make_quick_table(uint16 *to_table,uint16 *decode_table,
uint *next_free,uint value,uint bits,
@@ -107,7 +107,7 @@ static void fill_buffer(MI_BIT_BUFF *bit_buff);
static uint max_bit(uint value);
#ifdef HAVE_MMAP
static uchar *_mi_mempack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
- MI_BLOCK_INFO *info, byte **rec_buff_p,
+ MI_BLOCK_INFO *info, uchar **rec_buff_p,
uchar *header);
#endif
@@ -136,7 +136,8 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
uint i,trees,huff_tree_bits,rec_reflength,length;
uint16 *decode_table,*tmp_buff;
ulong elements,intervall_length;
- char *disk_cache,*intervall_buff;
+ char *disk_cache;
+ uchar *intervall_buff;
uchar header[HEAD_LENGTH];
MYISAM_SHARE *share=info->s;
MI_BIT_BUFF bit_buff;
@@ -149,14 +150,14 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
file=info->dfile;
my_errno=0;
- if (my_read(file,(byte*) header,sizeof(header),MYF(MY_NABP)))
+ if (my_read(file,(uchar*) header,sizeof(header),MYF(MY_NABP)))
{
if (!my_errno)
my_errno=HA_ERR_END_OF_FILE;
goto err0;
}
/* Only the first three bytes of magic number are independent of version. */
- if (memcmp((byte*) header, (byte*) myisam_pack_file_magic, 3))
+ if (memcmp((uchar*) header, (uchar*) myisam_pack_file_magic, 3))
{
my_errno=HA_ERR_WRONG_IN_RECORD;
goto err0;
@@ -195,10 +196,10 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
*/
if (!(share->decode_trees=(MI_DECODE_TREE*)
my_malloc((uint) (trees*sizeof(MI_DECODE_TREE)+
- intervall_length*sizeof(byte)),
+ intervall_length*sizeof(uchar)),
MYF(MY_WME))))
goto err0;
- intervall_buff=(byte*) (share->decode_trees+trees);
+ intervall_buff=(uchar*) (share->decode_trees+trees);
/*
Memory segment #2:
@@ -215,7 +216,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
MYF(MY_WME | MY_ZEROFILL))))
goto err1;
tmp_buff=share->decode_tables+length;
- disk_cache=(byte*) (tmp_buff+OFFSET_TABLE_SIZE);
+ disk_cache=(uchar*) (tmp_buff+OFFSET_TABLE_SIZE);
if (my_read(file,disk_cache,
(uint) (share->pack.header_length-sizeof(header)),
@@ -250,8 +251,8 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
goto err3;
/* Reallocate the decoding tables to the used size. */
decode_table=(uint16*)
- my_realloc((gptr) share->decode_tables,
- (uint) ((byte*) decode_table - (byte*) share->decode_tables),
+ my_realloc((uchar*) share->decode_tables,
+ (uint) ((uchar*) decode_table - (uchar*) share->decode_tables),
MYF(MY_HOLD_ON_ERROR));
/* Fix the table addresses in the tree heads. */
{
@@ -291,9 +292,9 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
err3:
my_errno=HA_ERR_WRONG_IN_RECORD;
err2:
- my_free((gptr) share->decode_tables,MYF(0));
+ my_free((uchar*) share->decode_tables,MYF(0));
err1:
- my_free((gptr) share->decode_trees,MYF(0));
+ my_free((uchar*) share->decode_trees,MYF(0));
err0:
DBUG_RETURN(1);
}
@@ -318,7 +319,7 @@ err0:
*/
static uint read_huff_table(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree,
- uint16 **decode_table, byte **intervall_buff,
+ uint16 **decode_table, uchar **intervall_buff,
uint16 *tmp_buff)
{
uint min_chr,elements,char_bits,offset_bits,size,intervall_length,table_bits,
@@ -697,7 +698,7 @@ static uint find_longest_bitstream(uint16 *table, uint16 *end)
HA_ERR_WRONG_IN_RECORD or -1 on error
*/
-int _mi_read_pack_record(MI_INFO *info, my_off_t filepos, byte *buf)
+int _mi_read_pack_record(MI_INFO *info, my_off_t filepos, uchar *buf)
{
MI_BLOCK_INFO block_info;
File file;
@@ -710,7 +711,7 @@ int _mi_read_pack_record(MI_INFO *info, my_off_t filepos, byte *buf)
if (_mi_pack_get_block_info(info, &info->bit_buff, &block_info,
&info->rec_buff, file, filepos))
goto err;
- if (my_read(file,(byte*) info->rec_buff + block_info.offset ,
+ if (my_read(file,(uchar*) info->rec_buff + block_info.offset ,
block_info.rec_len - block_info.offset, MYF(MY_NABP)))
goto panic;
info->update|= HA_STATE_AKTIV;
@@ -725,9 +726,9 @@ err:
int _mi_pack_rec_unpack(register MI_INFO *info, MI_BIT_BUFF *bit_buff,
- register byte *to, byte *from, ulong reclength)
+ register uchar *to, uchar *from, ulong reclength)
{
- byte *end_field;
+ uchar *end_field;
reg3 MI_COLUMNDEF *end;
MI_COLUMNDEF *current_field;
MYISAM_SHARE *share=info->s;
@@ -834,7 +835,7 @@ static void uf_space_normal(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to,
uchar *end)
{
if (get_bit(bit_buff))
- bfill((byte*) to,(end-to),' ');
+ bfill((uchar*) to,(end-to),' ');
else
decode_bytes(rec,bit_buff,to,end);
}
@@ -844,7 +845,7 @@ static void uf_space_endspace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
{
uint spaces;
if (get_bit(bit_buff))
- bfill((byte*) to,(end-to),' ');
+ bfill((uchar*) to,(end-to),' ');
else
{
if (get_bit(bit_buff))
@@ -856,7 +857,7 @@ static void uf_space_endspace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
}
if (to+spaces != end)
decode_bytes(rec,bit_buff,to,end-spaces);
- bfill((byte*) end-spaces,spaces,' ');
+ bfill((uchar*) end-spaces,spaces,' ');
}
else
decode_bytes(rec,bit_buff,to,end);
@@ -876,7 +877,7 @@ static void uf_endspace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
}
if (to+spaces != end)
decode_bytes(rec,bit_buff,to,end-spaces);
- bfill((byte*) end-spaces,spaces,' ');
+ bfill((uchar*) end-spaces,spaces,' ');
}
else
decode_bytes(rec,bit_buff,to,end);
@@ -887,7 +888,7 @@ static void uf_space_endspace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t
{
uint spaces;
if (get_bit(bit_buff))
- bfill((byte*) to,(end-to),' ');
+ bfill((uchar*) to,(end-to),' ');
else
{
if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end)
@@ -897,7 +898,7 @@ static void uf_space_endspace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t
}
if (to+spaces != end)
decode_bytes(rec,bit_buff,to,end-spaces);
- bfill((byte*) end-spaces,spaces,' ');
+ bfill((uchar*) end-spaces,spaces,' ');
}
}
@@ -912,7 +913,7 @@ static void uf_endspace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to,
}
if (to+spaces != end)
decode_bytes(rec,bit_buff,to,end-spaces);
- bfill((byte*) end-spaces,spaces,' ');
+ bfill((uchar*) end-spaces,spaces,' ');
}
static void uf_space_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
@@ -920,7 +921,7 @@ static void uf_space_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
{
uint spaces;
if (get_bit(bit_buff))
- bfill((byte*) to,(end-to),' ');
+ bfill((uchar*) to,(end-to),' ');
else
{
if (get_bit(bit_buff))
@@ -930,7 +931,7 @@ static void uf_space_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
bit_buff->error=1;
return;
}
- bfill((byte*) to,spaces,' ');
+ bfill((uchar*) to,spaces,' ');
if (to+spaces != end)
decode_bytes(rec,bit_buff,to+spaces,end);
}
@@ -951,7 +952,7 @@ static void uf_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
bit_buff->error=1;
return;
}
- bfill((byte*) to,spaces,' ');
+ bfill((uchar*) to,spaces,' ');
if (to+spaces != end)
decode_bytes(rec,bit_buff,to+spaces,end);
}
@@ -965,7 +966,7 @@ static void uf_space_prespace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t
{
uint spaces;
if (get_bit(bit_buff))
- bfill((byte*) to,(end-to),' ');
+ bfill((uchar*) to,(end-to),' ');
else
{
if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end)
@@ -973,7 +974,7 @@ static void uf_space_prespace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t
bit_buff->error=1;
return;
}
- bfill((byte*) to,spaces,' ');
+ bfill((uchar*) to,spaces,' ');
if (to+spaces != end)
decode_bytes(rec,bit_buff,to+spaces,end);
}
@@ -988,7 +989,7 @@ static void uf_prespace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to,
bit_buff->error=1;
return;
}
- bfill((byte*) to,spaces,' ');
+ bfill((uchar*) to,spaces,' ');
if (to+spaces != end)
decode_bytes(rec,bit_buff,to+spaces,end);
}
@@ -1031,7 +1032,7 @@ static void uf_blob(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
uchar *to, uchar *end)
{
if (get_bit(bit_buff))
- bzero((byte*) to,(end-to));
+ bzero((uchar*) to,(end-to));
else
{
ulong length=get_bits(bit_buff,rec->space_length_bits);
@@ -1039,11 +1040,11 @@ static void uf_blob(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
if (bit_buff->blob_pos+length > bit_buff->blob_end)
{
bit_buff->error=1;
- bzero((byte*) to,(end-to));
+ bzero((uchar*) to,(end-to));
return;
}
decode_bytes(rec,bit_buff,bit_buff->blob_pos,bit_buff->blob_pos+length);
- _my_store_blob_length((byte*) to,pack_length,length);
+ _my_store_blob_length((uchar*) to,pack_length,length);
memcpy_fixed((char*) to+pack_length,(char*) &bit_buff->blob_pos,
sizeof(char*));
bit_buff->blob_pos+=length;
@@ -1286,7 +1287,7 @@ static uint decode_pos(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree)
}
-int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf,
+int _mi_read_rnd_pack_record(MI_INFO *info, uchar *buf,
register my_off_t filepos,
my_bool skip_deleted_blocks)
{
@@ -1303,7 +1304,7 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf,
if (info->opt_flag & READ_CACHE_USED)
{
- if (_mi_read_cache(&info->rec_cache, (byte*) block_info.header,
+ if (_mi_read_cache(&info->rec_cache, (uchar*) block_info.header,
filepos, share->pack.ref_length,
skip_deleted_blocks ? READING_NEXT : 0))
goto err;
@@ -1325,14 +1326,14 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf,
if (info->opt_flag & READ_CACHE_USED)
{
- if (_mi_read_cache(&info->rec_cache, (byte*) info->rec_buff,
+ if (_mi_read_cache(&info->rec_cache, (uchar*) info->rec_buff,
block_info.filepos, block_info.rec_len,
skip_deleted_blocks ? READING_NEXT : 0))
goto err;
}
else
{
- if (my_read(info->dfile,(byte*) info->rec_buff + block_info.offset,
+ if (my_read(info->dfile,(uchar*) info->rec_buff + block_info.offset,
block_info.rec_len-block_info.offset,
MYF(MY_NABP)))
goto err;
@@ -1352,7 +1353,7 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf,
/* Read and process header from a huff-record-file */
uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
- MI_BLOCK_INFO *info, byte **rec_buff_p,
+ MI_BLOCK_INFO *info, uchar **rec_buff_p,
File file, my_off_t filepos)
{
uchar *header=info->header;
@@ -1369,7 +1370,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
if (my_read(file,(char*) header,ref_length,MYF(MY_NABP)))
return BLOCK_FATAL_ERROR;
- DBUG_DUMP("header",(byte*) header,ref_length);
+ DBUG_DUMP("header",(uchar*) header,ref_length);
}
head_length= read_pack_length((uint) myisam->s->pack.version, header,
&info->rec_len);
@@ -1478,8 +1479,8 @@ static uint max_bit(register uint value)
#ifdef HAVE_MMAP
-static int _mi_read_mempack_record(MI_INFO *info,my_off_t filepos,byte *buf);
-static int _mi_read_rnd_mempack_record(MI_INFO*, byte *,my_off_t, my_bool);
+static int _mi_read_mempack_record(MI_INFO *info,my_off_t filepos,uchar *buf);
+static int _mi_read_rnd_mempack_record(MI_INFO*, uchar *,my_off_t, my_bool);
my_bool _mi_memmap_file(MI_INFO *info)
{
@@ -1512,7 +1513,7 @@ void _mi_unmap_file(MI_INFO *info)
static uchar *_mi_mempack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
- MI_BLOCK_INFO *info, byte **rec_buff_p,
+ MI_BLOCK_INFO *info, uchar **rec_buff_p,
uchar *header)
{
header+= read_pack_length((uint) myisam->s->pack.version, header,
@@ -1532,17 +1533,17 @@ static uchar *_mi_mempack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
}
-static int _mi_read_mempack_record(MI_INFO *info, my_off_t filepos, byte *buf)
+static int _mi_read_mempack_record(MI_INFO *info, my_off_t filepos, uchar *buf)
{
MI_BLOCK_INFO block_info;
MYISAM_SHARE *share=info->s;
- byte *pos;
+ uchar *pos;
DBUG_ENTER("mi_read_mempack_record");
if (filepos == HA_OFFSET_ERROR)
DBUG_RETURN(-1); /* _search() didn't find record */
- if (!(pos= (byte*) _mi_mempack_get_block_info(info, &info->bit_buff,
+ if (!(pos= (uchar*) _mi_mempack_get_block_info(info, &info->bit_buff,
&block_info, &info->rec_buff,
(uchar*) share->file_map+
filepos)))
@@ -1553,14 +1554,14 @@ static int _mi_read_mempack_record(MI_INFO *info, my_off_t filepos, byte *buf)
/*ARGSUSED*/
-static int _mi_read_rnd_mempack_record(MI_INFO *info, byte *buf,
+static int _mi_read_rnd_mempack_record(MI_INFO *info, uchar *buf,
register my_off_t filepos,
my_bool skip_deleted_blocks
__attribute__((unused)))
{
MI_BLOCK_INFO block_info;
MYISAM_SHARE *share=info->s;
- byte *pos,*start;
+ uchar *pos,*start;
DBUG_ENTER("_mi_read_rnd_mempack_record");
if (filepos >= share->state.state.data_file_length)
@@ -1568,7 +1569,7 @@ static int _mi_read_rnd_mempack_record(MI_INFO *info, byte *buf,
my_errno=HA_ERR_END_OF_FILE;
goto err;
}
- if (!(pos= (byte*) _mi_mempack_get_block_info(info, &info->bit_buff,
+ if (!(pos= (uchar*) _mi_mempack_get_block_info(info, &info->bit_buff,
&block_info, &info->rec_buff,
(uchar*)
(start=share->file_map+
@@ -1596,7 +1597,7 @@ static int _mi_read_rnd_mempack_record(MI_INFO *info, byte *buf,
/* Save length of row */
-uint save_pack_length(uint version, byte *block_buff, ulong length)
+uint save_pack_length(uint version, uchar *block_buff, ulong length)
{
if (length < 254)
{
diff --git a/storage/myisam/mi_page.c b/storage/myisam/mi_page.c
index da9e19275c9..ede379feea6 100644
--- a/storage/myisam/mi_page.c
+++ b/storage/myisam/mi_page.c
@@ -29,7 +29,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo,
DBUG_PRINT("enter",("page: %ld", (long) page));
tmp=(uchar*) key_cache_read(info->s->key_cache,
- info->s->kfile, page, level, (byte*) buff,
+ info->s->kfile, page, level, (uchar*) buff,
(uint) keyinfo->block_length,
(uint) keyinfo->block_length,
return_buffer);
@@ -80,7 +80,7 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo,
DBUG_RETURN((-1));
}
DBUG_PRINT("page",("write page at: %lu",(long) page));
- DBUG_DUMP("buff",(byte*) buff,mi_getint(buff));
+ DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff));
#endif
if ((length=keyinfo->block_length) > IO_SIZE*2 &&
@@ -89,12 +89,12 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo,
#ifdef HAVE_purify
{
length=mi_getint(buff);
- bzero((byte*) buff+length,keyinfo->block_length-length);
+ bzero((uchar*) buff+length,keyinfo->block_length-length);
length=keyinfo->block_length;
}
#endif
DBUG_RETURN((key_cache_write(info->s->key_cache,
- info->s->kfile,page, level, (byte*) buff,length,
+ info->s->kfile,page, level, (uchar*) buff,length,
(uint) keyinfo->block_length,
(int) ((info->lock_type != F_UNLCK) ||
info->s->delay_key_write))));
diff --git a/storage/myisam/mi_preload.c b/storage/myisam/mi_preload.c
index 78729f18424..1bb5072713d 100644
--- a/storage/myisam/mi_preload.c
+++ b/storage/myisam/mi_preload.c
@@ -76,7 +76,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
/* Read the next block of index file into the preload buffer */
if ((my_off_t) length > (key_file_length-pos))
length= (ulong) (key_file_length-pos);
- if (my_pread(share->kfile, (byte*) buff, length, pos, MYF(MY_FAE|MY_FNABP)))
+ if (my_pread(share->kfile, (uchar*) buff, length, pos, MYF(MY_FAE|MY_FNABP)))
goto err;
if (ignore_leaves)
@@ -88,7 +88,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
{
if (key_cache_insert(share->key_cache,
share->kfile, pos, DFLT_INIT_HITS,
- (byte*) buff, block_length))
+ (uchar*) buff, block_length))
goto err;
}
pos+= block_length;
@@ -100,7 +100,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
{
if (key_cache_insert(share->key_cache,
share->kfile, pos, DFLT_INIT_HITS,
- (byte*) buff, length))
+ (uchar*) buff, length))
goto err;
pos+= length;
}
diff --git a/storage/myisam/mi_range.c b/storage/myisam/mi_range.c
index c7ab6731a2c..932a4abd1b3 100644
--- a/storage/myisam/mi_range.c
+++ b/storage/myisam/mi_range.c
@@ -21,7 +21,7 @@
#include "myisamdef.h"
#include "rt_index.h"
-static ha_rows _mi_record_pos(MI_INFO *, const byte *, key_part_map,
+static ha_rows _mi_record_pos(MI_INFO *, const uchar *, key_part_map,
enum ha_rkey_function);
static double _mi_search_pos(MI_INFO *,MI_KEYDEF *,uchar *, uint,uint,my_off_t);
static uint _mi_keynr(MI_INFO *info,MI_KEYDEF *,uchar *, uchar *,uint *);
@@ -116,7 +116,7 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx,
/* Find relative position (in records) for key in index-tree */
-static ha_rows _mi_record_pos(MI_INFO *info, const byte *key,
+static ha_rows _mi_record_pos(MI_INFO *info, const uchar *key,
key_part_map keypart_map,
enum ha_rkey_function search_flag)
{
diff --git a/storage/myisam/mi_rfirst.c b/storage/myisam/mi_rfirst.c
index d23bda46b1a..5a8b27b3e85 100644
--- a/storage/myisam/mi_rfirst.c
+++ b/storage/myisam/mi_rfirst.c
@@ -17,7 +17,7 @@
/* Read first row through a specfic key */
-int mi_rfirst(MI_INFO *info, byte *buf, int inx)
+int mi_rfirst(MI_INFO *info, uchar *buf, int inx)
{
DBUG_ENTER("mi_rfirst");
info->lastpos= HA_OFFSET_ERROR;
diff --git a/storage/myisam/mi_rkey.c b/storage/myisam/mi_rkey.c
index a69e276a6d8..3dcaa27d3ca 100644
--- a/storage/myisam/mi_rkey.c
+++ b/storage/myisam/mi_rkey.c
@@ -21,7 +21,7 @@
/* Read a record using key */
/* Ordinary search_flag is 0 ; Give error if no record with key */
-int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key,
+int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function search_flag)
{
uchar *key_buff;
diff --git a/storage/myisam/mi_rlast.c b/storage/myisam/mi_rlast.c
index 7805755ab70..07be619617f 100644
--- a/storage/myisam/mi_rlast.c
+++ b/storage/myisam/mi_rlast.c
@@ -17,7 +17,7 @@
/* Read last row with the same key as the previous read. */
-int mi_rlast(MI_INFO *info, byte *buf, int inx)
+int mi_rlast(MI_INFO *info, uchar *buf, int inx)
{
DBUG_ENTER("mi_rlast");
info->lastpos= HA_OFFSET_ERROR;
diff --git a/storage/myisam/mi_rnext.c b/storage/myisam/mi_rnext.c
index f6a0a47413e..7ce66d41e0f 100644
--- a/storage/myisam/mi_rnext.c
+++ b/storage/myisam/mi_rnext.c
@@ -24,7 +24,7 @@
based on the position of the last used key!
*/
-int mi_rnext(MI_INFO *info, byte *buf, int inx)
+int mi_rnext(MI_INFO *info, uchar *buf, int inx)
{
int error,changed;
uint flag;
diff --git a/storage/myisam/mi_rnext_same.c b/storage/myisam/mi_rnext_same.c
index 3a7004bf47c..1892fe3e1e0 100644
--- a/storage/myisam/mi_rnext_same.c
+++ b/storage/myisam/mi_rnext_same.c
@@ -24,7 +24,7 @@
based on the position of the last used key!
*/
-int mi_rnext_same(MI_INFO *info, byte *buf)
+int mi_rnext_same(MI_INFO *info, uchar *buf)
{
int error;
uint inx,not_used[2];
diff --git a/storage/myisam/mi_rprev.c b/storage/myisam/mi_rprev.c
index 09802627185..d1407012590 100644
--- a/storage/myisam/mi_rprev.c
+++ b/storage/myisam/mi_rprev.c
@@ -22,7 +22,7 @@
based on the position of the last used key!
*/
-int mi_rprev(MI_INFO *info, byte *buf, int inx)
+int mi_rprev(MI_INFO *info, uchar *buf, int inx)
{
int error,changed;
register uint flag;
diff --git a/storage/myisam/mi_rrnd.c b/storage/myisam/mi_rrnd.c
index d31e6c24a37..211e5fa51cc 100644
--- a/storage/myisam/mi_rrnd.c
+++ b/storage/myisam/mi_rrnd.c
@@ -29,7 +29,7 @@
HA_ERR_END_OF_FILE = EOF.
*/
-int mi_rrnd(MI_INFO *info, byte *buf, register my_off_t filepos)
+int mi_rrnd(MI_INFO *info, uchar *buf, register my_off_t filepos)
{
my_bool skip_deleted_blocks;
DBUG_ENTER("mi_rrnd");
diff --git a/storage/myisam/mi_rsame.c b/storage/myisam/mi_rsame.c
index 4831ebb3d7c..8093498483f 100644
--- a/storage/myisam/mi_rsame.c
+++ b/storage/myisam/mi_rsame.c
@@ -25,7 +25,7 @@
*/
-int mi_rsame(MI_INFO *info, byte *record, int inx)
+int mi_rsame(MI_INFO *info, uchar *record, int inx)
{
DBUG_ENTER("mi_rsame");
diff --git a/storage/myisam/mi_rsamepos.c b/storage/myisam/mi_rsamepos.c
index 717b9ab52d5..6a1e462b686 100644
--- a/storage/myisam/mi_rsamepos.c
+++ b/storage/myisam/mi_rsamepos.c
@@ -27,7 +27,7 @@
** HA_ERR_END_OF_FILE = End of file
*/
-int mi_rsame_with_pos(MI_INFO *info, byte *record, int inx, my_off_t filepos)
+int mi_rsame_with_pos(MI_INFO *info, uchar *record, int inx, my_off_t filepos)
{
DBUG_ENTER("mi_rsame_with_pos");
DBUG_PRINT("enter",("index: %d filepos: %ld", inx, (long) filepos));
diff --git a/storage/myisam/mi_scan.c b/storage/myisam/mi_scan.c
index 87debb67b37..a225b399660 100644
--- a/storage/myisam/mi_scan.c
+++ b/storage/myisam/mi_scan.c
@@ -36,7 +36,7 @@ int mi_scan_init(register MI_INFO *info)
HA_ERR_END_OF_FILE = EOF.
*/
-int mi_scan(MI_INFO *info, byte *buf)
+int mi_scan(MI_INFO *info, uchar *buf)
{
DBUG_ENTER("mi_scan");
/* Init all but update-flag */
diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c
index d313619e007..acc8c073297 100644
--- a/storage/myisam/mi_search.c
+++ b/storage/myisam/mi_search.c
@@ -78,7 +78,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff,
test(!(nextflag & SEARCH_SAVE_BUFF)))))
goto err;
- DBUG_DUMP("page",(byte*) buff,mi_getint(buff));
+ DBUG_DUMP("page",(uchar*) buff,mi_getint(buff));
flag=(*keyinfo->bin_search)(info,keyinfo,buff,key,key_len,nextflag,
&keypos,lastkey, &last_key);
@@ -753,7 +753,7 @@ void _mi_dpointer(MI_INFO *info, uchar *buff, my_off_t pos)
uint _mi_get_static_key(register MI_KEYDEF *keyinfo, uint nod_flag,
register uchar **page, register uchar *key)
{
- memcpy((byte*) key,(byte*) *page,
+ memcpy((uchar*) key,(uchar*) *page,
(size_t) (keyinfo->keylength+nod_flag));
*page+=keyinfo->keylength+nod_flag;
return(keyinfo->keylength);
@@ -897,12 +897,12 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
else
length=keyseg->length;
}
- memcpy((byte*) key,(byte*) page,(size_t) length);
+ memcpy((uchar*) key,(uchar*) page,(size_t) length);
key+=length;
page+=length;
}
length=keyseg->length+nod_flag;
- bmove((byte*) key,(byte*) page,length);
+ bmove((uchar*) key,(uchar*) page,length);
*page_pos= page+length;
return ((uint) (key-start_key)+keyseg->length);
} /* _mi_get_pack_key */
@@ -1003,7 +1003,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
}
DBUG_PRINT("info",("key: 0x%lx from: 0x%lx length: %u",
(long) key, (long) from, length));
- memmove((byte*) key, (byte*) from, (size_t) length);
+ memmove((uchar*) key, (uchar*) from, (size_t) length);
key+=length;
from+=length;
}
@@ -1035,7 +1035,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
DBUG_RETURN(0); /* Error */
}
/* Copy data pointer and, if appropriate, key block pointer. */
- memcpy((byte*) key,(byte*) from,(size_t) length);
+ memcpy((uchar*) key,(uchar*) from,(size_t) length);
*page_pos= from+length;
}
DBUG_RETURN((uint) (key-start_key)+keyseg->length);
@@ -1054,7 +1054,7 @@ uchar *_mi_get_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
nod_flag=mi_test_if_nod(page);
if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY)))
{
- bmove((byte*) key,(byte*) keypos,keyinfo->keylength+nod_flag);
+ bmove((uchar*) key,(uchar*) keypos,keyinfo->keylength+nod_flag);
DBUG_RETURN(keypos+keyinfo->keylength+nod_flag);
}
else
@@ -1092,7 +1092,7 @@ static my_bool _mi_get_prev_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY)))
{
*return_key_length=keyinfo->keylength;
- bmove((byte*) key,(byte*) keypos- *return_key_length-nod_flag,
+ bmove((uchar*) key,(uchar*) keypos- *return_key_length-nod_flag,
*return_key_length);
DBUG_RETURN(0);
}
@@ -1134,7 +1134,7 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
lastpos=endpos-keyinfo->keylength-nod_flag;
*return_key_length=keyinfo->keylength;
if (lastpos > page)
- bmove((byte*) lastkey,(byte*) lastpos,keyinfo->keylength+nod_flag);
+ bmove((uchar*) lastkey,(uchar*) lastpos,keyinfo->keylength+nod_flag);
}
else
{
@@ -1225,7 +1225,7 @@ uint _mi_keylength_part(MI_KEYDEF *keyinfo, register uchar *key,
uchar *_mi_move_key(MI_KEYDEF *keyinfo, uchar *to, uchar *from)
{
reg1 uint length;
- memcpy((byte*) to, (byte*) from,
+ memcpy((uchar*) to, (uchar*) from,
(size_t) (length=_mi_keylength(keyinfo,from)));
return to+length;
}
@@ -1827,7 +1827,7 @@ void _mi_store_static_key(MI_KEYDEF *keyinfo __attribute__((unused)),
register uchar *key_pos,
register MI_KEY_PARAM *s_temp)
{
- memcpy((byte*) key_pos,(byte*) s_temp->key,(size_t) s_temp->totlength);
+ memcpy((uchar*) key_pos,(uchar*) s_temp->key,(size_t) s_temp->totlength);
}
@@ -1860,7 +1860,7 @@ void _mi_store_var_pack_key(MI_KEYDEF *keyinfo __attribute__((unused)),
/* Not packed against previous key */
store_pack_length(s_temp->pack_marker == 128,key_pos,s_temp->key_length);
}
- bmove((byte*) key_pos,(byte*) s_temp->key,
+ bmove((uchar*) key_pos,(uchar*) s_temp->key,
(length=s_temp->totlength-(uint) (key_pos-start)));
if (!s_temp->next_key_pos) /* No following key */
diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c
index 21a25f66b7c..c92d577b621 100644
--- a/storage/myisam/mi_static.c
+++ b/storage/myisam/mi_static.c
@@ -27,7 +27,7 @@ uchar NEAR myisam_file_magic[]=
{ (uchar) 254, (uchar) 254,'\007', '\001', };
uchar NEAR myisam_pack_file_magic[]=
{ (uchar) 254, (uchar) 254,'\010', '\002', };
-my_string myisam_log_filename=(char*) "myisam.log";
+char * myisam_log_filename=(char*) "myisam.log";
File myisam_log_file= -1;
uint myisam_quick_table_bits=9;
ulong myisam_block_size= MI_KEY_BLOCK_LENGTH; /* Best by test */
diff --git a/storage/myisam/mi_statrec.c b/storage/myisam/mi_statrec.c
index 3f92ec31d4c..93e91fb9e32 100644
--- a/storage/myisam/mi_statrec.c
+++ b/storage/myisam/mi_statrec.c
@@ -18,7 +18,7 @@
#include "myisamdef.h"
-int _mi_write_static_record(MI_INFO *info, const byte *record)
+int _mi_write_static_record(MI_INFO *info, const uchar *record)
{
uchar temp[8]; /* max pointer length */
if (info->s->state.dellink != HA_OFFSET_ERROR &&
@@ -48,14 +48,14 @@ int _mi_write_static_record(MI_INFO *info, const byte *record)
}
if (info->opt_flag & WRITE_CACHE_USED)
{ /* Cash in use */
- if (my_b_write(&info->rec_cache, (byte*) record,
+ if (my_b_write(&info->rec_cache, (uchar*) record,
info->s->base.reclength))
goto err;
if (info->s->base.pack_reclength != info->s->base.reclength)
{
uint length=info->s->base.pack_reclength - info->s->base.reclength;
bzero((char*) temp,length);
- if (my_b_write(&info->rec_cache, (byte*) temp,length))
+ if (my_b_write(&info->rec_cache, (uchar*) temp,length))
goto err;
}
}
@@ -70,7 +70,7 @@ int _mi_write_static_record(MI_INFO *info, const byte *record)
{
uint length=info->s->base.pack_reclength - info->s->base.reclength;
bzero((char*) temp,length);
- if (info->s->file_write(info, (byte*) temp,length,
+ if (info->s->file_write(info, (uchar*) temp,length,
info->state->data_file_length+
info->s->base.reclength,
info->s->write_flag))
@@ -85,7 +85,7 @@ int _mi_write_static_record(MI_INFO *info, const byte *record)
return 1;
}
-int _mi_update_static_record(MI_INFO *info, my_off_t pos, const byte *record)
+int _mi_update_static_record(MI_INFO *info, my_off_t pos, const uchar *record)
{
info->rec_cache.seek_not_done=1; /* We have done a seek */
return (info->s->file_write(info,
@@ -105,12 +105,12 @@ int _mi_delete_static_record(MI_INFO *info)
_mi_dpointer(info,temp+1,info->s->state.dellink);
info->s->state.dellink = info->lastpos;
info->rec_cache.seek_not_done=1;
- return (info->s->file_write(info,(byte*) temp, 1+info->s->rec_reflength,
+ return (info->s->file_write(info,(uchar*) temp, 1+info->s->rec_reflength,
info->lastpos, MYF(MY_NABP)) != 0);
}
-int _mi_cmp_static_record(register MI_INFO *info, register const byte *old)
+int _mi_cmp_static_record(register MI_INFO *info, register const uchar *old)
{
DBUG_ENTER("_mi_cmp_static_record");
@@ -133,7 +133,7 @@ int _mi_cmp_static_record(register MI_INFO *info, register const byte *old)
info->lastpos,
MYF(MY_NABP)))
DBUG_RETURN(-1);
- if (memcmp((byte*) info->rec_buff, (byte*) old,
+ if (memcmp((uchar*) info->rec_buff, (uchar*) old,
(uint) info->s->base.reclength))
{
DBUG_DUMP("read",old,info->s->base.reclength);
@@ -147,7 +147,7 @@ int _mi_cmp_static_record(register MI_INFO *info, register const byte *old)
int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def,
- const byte *record, my_off_t pos)
+ const uchar *record, my_off_t pos)
{
DBUG_ENTER("_mi_cmp_static_unique");
@@ -166,7 +166,7 @@ int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def,
/* MY_FILE_ERROR on read-error or locking-error */
int _mi_read_static_record(register MI_INFO *info, register my_off_t pos,
- register byte *record)
+ register uchar *record)
{
int error;
@@ -199,7 +199,7 @@ int _mi_read_static_record(register MI_INFO *info, register my_off_t pos,
-int _mi_read_rnd_static_record(MI_INFO *info, byte *buf,
+int _mi_read_rnd_static_record(MI_INFO *info, uchar *buf,
register my_off_t filepos,
my_bool skip_deleted_blocks)
{
@@ -274,11 +274,11 @@ int _mi_read_rnd_static_record(MI_INFO *info, byte *buf,
}
/* Read record with cacheing */
- error=my_b_read(&info->rec_cache,(byte*) buf,share->base.reclength);
+ error=my_b_read(&info->rec_cache,(uchar*) buf,share->base.reclength);
if (info->s->base.pack_reclength != info->s->base.reclength && !error)
{
char tmp[8]; /* Skill fill bytes */
- error=my_b_read(&info->rec_cache,(byte*) tmp,
+ error=my_b_read(&info->rec_cache,(uchar*) tmp,
info->s->base.pack_reclength - info->s->base.reclength);
}
if (locked)
diff --git a/storage/myisam/mi_test1.c b/storage/myisam/mi_test1.c
index ebb9cdcb2f7..1165ea4bb32 100644
--- a/storage/myisam/mi_test1.c
+++ b/storage/myisam/mi_test1.c
@@ -109,7 +109,7 @@ static int run_test(const char *filename)
}
keyinfo[0].flag = (uint8) (pack_keys | unique_key);
- bzero((byte*) flags,sizeof(flags));
+ bzero((uchar*) flags,sizeof(flags));
if (opt_unique)
{
uint start;
@@ -534,21 +534,21 @@ static struct my_option my_long_options[] =
{"debug", '#', "Undocumented",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"delete_rows", 'd', "Undocumented", (gptr*) &remove_count,
- (gptr*) &remove_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
+ {"delete_rows", 'd', "Undocumented", (uchar**) &remove_count,
+ (uchar**) &remove_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
{"help", '?', "Display help and exit",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"insert_rows", 'i', "Undocumented", (gptr*) &insert_count,
- (gptr*) &insert_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
+ {"insert_rows", 'i', "Undocumented", (uchar**) &insert_count,
+ (uchar**) &insert_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
{"key_alpha", 'a', "Use a key of type HA_KEYTYPE_TEXT",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"key_binary_pack", 'B', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"key_blob", 'b', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"key_cache", 'K', "Undocumented", (gptr*) &key_cacheing,
- (gptr*) &key_cacheing, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"key_length", 'k', "Undocumented", (gptr*) &key_length, (gptr*) &key_length,
+ {"key_cache", 'K', "Undocumented", (uchar**) &key_cacheing,
+ (uchar**) &key_cacheing, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"key_length", 'k', "Undocumented", (uchar**) &key_length, (uchar**) &key_length,
0, GET_UINT, REQUIRED_ARG, 6, 0, 0, 0, 0, 0},
{"key_multiple", 'm', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -559,21 +559,21 @@ static struct my_option my_long_options[] =
{"key_varchar", 'w', "Test VARCHAR keys",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"null_fields", 'N', "Define fields with NULL",
- (gptr*) &null_fields, (gptr*) &null_fields, 0, GET_BOOL, NO_ARG,
+ (uchar**) &null_fields, (uchar**) &null_fields, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"row_fixed_size", 'S', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"row_pointer_size", 'R', "Undocumented", (gptr*) &rec_pointer_size,
- (gptr*) &rec_pointer_size, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"row_pointer_size", 'R', "Undocumented", (uchar**) &rec_pointer_size,
+ (uchar**) &rec_pointer_size, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Undocumented",
- (gptr*) &silent, (gptr*) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"skip_update", 'U', "Undocumented", (gptr*) &skip_update,
- (gptr*) &skip_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"unique", 'C', "Undocumented", (gptr*) &opt_unique, (gptr*) &opt_unique, 0,
+ (uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"skip_update", 'U', "Undocumented", (uchar**) &skip_update,
+ (uchar**) &skip_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"unique", 'C', "Undocumented", (uchar**) &opt_unique, (uchar**) &opt_unique, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"update_rows", 'u', "Undocumented", (gptr*) &update_count,
- (gptr*) &update_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
- {"verbose", 'v', "Be more verbose", (gptr*) &verbose, (gptr*) &verbose, 0,
+ {"update_rows", 'u', "Undocumented", (uchar**) &update_count,
+ (uchar**) &update_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
+ {"verbose", 'v', "Be more verbose", (uchar**) &verbose, (uchar**) &verbose, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Print version number and exit",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c
index 878bba31ea8..96ee82e023c 100644
--- a/storage/myisam/mi_test2.c
+++ b/storage/myisam/mi_test2.c
@@ -36,7 +36,7 @@
static void get_options(int argc, char *argv[]);
static uint rnd(uint max_value);
-static void fix_length(byte *record,uint length);
+static void fix_length(uchar *record,uint length);
static void put_blob_in_record(char *blob_pos,char **blob_buffer);
static void copy_key(struct st_myisam_info *info,uint inx,
uchar *record,uchar *key);
@@ -455,8 +455,8 @@ int main(int argc, char *argv[])
bcmp(read_record2,read_record3,reclength))
{
printf("Can't find last record\n");
- DBUG_DUMP("record2",(byte*) read_record2,reclength);
- DBUG_DUMP("record3",(byte*) read_record3,reclength);
+ DBUG_DUMP("record2",(uchar*) read_record2,reclength);
+ DBUG_DUMP("record3",(uchar*) read_record3,reclength);
goto end;
}
ant=1;
@@ -1001,7 +1001,7 @@ static uint rnd(uint max_value)
/* Create a variable length record */
-static void fix_length(byte *rec, uint length)
+static void fix_length(uchar *rec, uint length)
{
bmove(rec+STANDARD_LENGTH,
"0123456789012345678901234567890123456789012345678901234567890",
diff --git a/storage/myisam/mi_test3.c b/storage/myisam/mi_test3.c
index 3987c20ab69..982b999c3a5 100644
--- a/storage/myisam/mi_test3.c
+++ b/storage/myisam/mi_test3.c
@@ -243,7 +243,7 @@ int test_read(MI_INFO *file,int id)
for (i=0 ; i < 100 ; i++)
{
find=rnd(100000);
- if (!mi_rkey(file,record.id,1,(byte*) &find,
+ if (!mi_rkey(file,record.id,1,(uchar*) &find,
sizeof(find),HA_READ_KEY_EXACT))
found++;
else
@@ -426,7 +426,7 @@ int test_update(MI_INFO *file,int id,int lock_type)
{
tmp=rnd(100000);
int4store(find,tmp);
- if (!mi_rkey(file,record.id,1,(byte*) find,
+ if (!mi_rkey(file,record.id,1,(uchar*) find,
sizeof(find),HA_READ_KEY_EXACT))
found++;
else
diff --git a/storage/myisam/mi_unique.c b/storage/myisam/mi_unique.c
index 635f6c18247..e490fb683e4 100644
--- a/storage/myisam/mi_unique.c
+++ b/storage/myisam/mi_unique.c
@@ -18,7 +18,7 @@
#include "myisamdef.h"
#include <m_ctype.h>
-my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record,
+my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record,
ha_checksum unique_hash, my_off_t disk_pos)
{
my_off_t lastpos=info->lastpos;
@@ -73,9 +73,9 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record,
Add support for bit fields
*/
-ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
+ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *record)
{
- const byte *pos, *end;
+ const uchar *pos, *end;
ha_checksum crc= 0;
ulong seed1=0, seed2= 4;
HA_KEYSEG *keyseg;
@@ -111,7 +111,7 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
else if (keyseg->flag & HA_BLOB_PART)
{
uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos);
- memcpy_fixed((byte*) &pos,pos+keyseg->bit_start,sizeof(char*));
+ memcpy_fixed((uchar*) &pos,pos+keyseg->bit_start,sizeof(char*));
if (!length || length > tmp_length)
length=tmp_length; /* The whole blob */
}
@@ -145,10 +145,10 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
# Rows are different
*/
-int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b,
+int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b,
my_bool null_are_equal)
{
- const byte *pos_a, *pos_b, *end;
+ const uchar *pos_a, *pos_b, *end;
HA_KEYSEG *keyseg;
for (keyseg=def->seg ; keyseg < def->end ; keyseg++)
@@ -206,8 +206,8 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b,
set_if_smaller(a_length, keyseg->length);
set_if_smaller(b_length, keyseg->length);
}
- memcpy_fixed((byte*) &pos_a,pos_a+keyseg->bit_start,sizeof(char*));
- memcpy_fixed((byte*) &pos_b,pos_b+keyseg->bit_start,sizeof(char*));
+ memcpy_fixed((uchar*) &pos_a,pos_a+keyseg->bit_start,sizeof(char*));
+ memcpy_fixed((uchar*) &pos_b,pos_b+keyseg->bit_start,sizeof(char*));
}
if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT1 ||
type == HA_KEYTYPE_VARTEXT2)
diff --git a/storage/myisam/mi_update.c b/storage/myisam/mi_update.c
index bea457d2e9a..924cdfcbc21 100644
--- a/storage/myisam/mi_update.c
+++ b/storage/myisam/mi_update.c
@@ -18,7 +18,7 @@
#include "fulltext.h"
#include "rt_index.h"
-int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
+int mi_update(register MI_INFO *info, const uchar *oldrec, uchar *newrec)
{
int flag,key_changed,save_errno;
reg3 my_off_t pos;
@@ -115,7 +115,7 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
info->update&= ~HA_STATE_RNEXT_SAME;
if (new_length != old_length ||
- memcmp((byte*) old_key,(byte*) new_key,new_length))
+ memcmp((uchar*) old_key,(uchar*) new_key,new_length))
{
if ((int) i == info->lastinx)
key_changed|=HA_STATE_WRITTEN; /* Mark that keyfile changed */
diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c
index 57c054f2de8..8ae979f8bf6 100644
--- a/storage/myisam/mi_write.c
+++ b/storage/myisam/mi_write.c
@@ -40,7 +40,7 @@ int _mi_ck_write_btree(register MI_INFO *info, uint keynr,uchar *key,
/* Write new record to database */
-int mi_write(MI_INFO *info, byte *record)
+int mi_write(MI_INFO *info, uchar *record)
{
MYISAM_SHARE *share=info->s;
uint i;
@@ -286,7 +286,7 @@ int _mi_ck_write_btree(register MI_INFO *info, uint keynr, uchar *key,
if (!error)
error= _mi_ft_convert_to_ft2(info, keynr, key);
delete_dynamic(info->ft1_to_ft2);
- my_free((gptr)info->ft1_to_ft2, MYF(0));
+ my_free((uchar*)info->ft1_to_ft2, MYF(0));
info->ft1_to_ft2=0;
}
DBUG_RETURN(error);
@@ -403,14 +403,14 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
ft_intXstore(keypos, subkeys);
if (!error)
error=_mi_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,temp_buff);
- my_afree((byte*) temp_buff);
+ my_afree((uchar*) temp_buff);
DBUG_RETURN(error);
}
}
else /* not HA_FULLTEXT, normal HA_NOSAME key */
{
info->dupp_key_pos= dupp_key_pos;
- my_afree((byte*) temp_buff);
+ my_afree((uchar*) temp_buff);
my_errno=HA_ERR_FOUND_DUPP_KEY;
DBUG_RETURN(-1);
}
@@ -429,10 +429,10 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (_mi_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,temp_buff))
goto err;
}
- my_afree((byte*) temp_buff);
+ my_afree((uchar*) temp_buff);
DBUG_RETURN(error);
err:
- my_afree((byte*) temp_buff);
+ my_afree((uchar*) temp_buff);
DBUG_PRINT("exit",("Error: %d",my_errno));
DBUG_RETURN (-1);
} /* w_search */
@@ -488,7 +488,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (key_pos != anc_buff+2+nod_flag && (keyinfo->flag &
(HA_BINARY_PACK_KEY | HA_PACK_KEY)))
{
- DBUG_DUMP("prev_key",(byte*) key_buff,_mi_keylength(keyinfo,key_buff));
+ DBUG_DUMP("prev_key",(uchar*) key_buff,_mi_keylength(keyinfo,key_buff));
}
if (keyinfo->flag & HA_PACK_KEY)
{
@@ -506,7 +506,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo,
my_errno=HA_ERR_CRASHED;
DBUG_RETURN(-1);
}
- bmove_upp((byte*) endpos+t_length,(byte*) endpos,(uint) (endpos-key_pos));
+ bmove_upp((uchar*) endpos+t_length,(uchar*) endpos,(uint) (endpos-key_pos));
}
else
{
@@ -595,7 +595,7 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo,
MI_KEY_PARAM s_temp;
DBUG_ENTER("mi_split_page");
LINT_INIT(after_key);
- DBUG_DUMP("buff",(byte*) buff,mi_getint(buff));
+ DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff));
if (info->s->keyinfo+info->lastinx == keyinfo)
info->page_changed=1; /* Info->buff is used */
@@ -619,7 +619,7 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo,
{
DBUG_PRINT("test",("Splitting nod"));
pos=key_pos-nod_flag;
- memcpy((byte*) info->buff+2,(byte*) pos,(size_t) nod_flag);
+ memcpy((uchar*) info->buff+2,(uchar*) pos,(size_t) nod_flag);
}
/* Move middle item to key and pointer to new page */
@@ -635,14 +635,14 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo,
(uchar*) 0, (uchar*) 0,
key_buff, &s_temp);
length=(uint) ((buff+a_length)-key_pos);
- memcpy((byte*) info->buff+key_ref_length+t_length,(byte*) key_pos,
+ memcpy((uchar*) info->buff+key_ref_length+t_length,(uchar*) key_pos,
(size_t) length);
(*keyinfo->store_key)(keyinfo,info->buff+key_ref_length,&s_temp);
mi_putint(info->buff,length+t_length+key_ref_length,nod_flag);
if (_mi_write_keypage(info,keyinfo,new_pos,DFLT_INIT_HITS,info->buff))
DBUG_RETURN(-1);
- DBUG_DUMP("key",(byte*) key,_mi_keylength(keyinfo,key));
+ DBUG_DUMP("key",(uchar*) key,_mi_keylength(keyinfo,key));
DBUG_RETURN(2); /* Middle key up */
} /* _mi_split_page */
@@ -764,7 +764,7 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo,
length,keys;
uchar *pos,*buff,*extra_buff;
my_off_t next_page,new_pos;
- byte tmp_part_key[MI_MAX_KEY_BUFF];
+ uchar tmp_part_key[MI_MAX_KEY_BUFF];
DBUG_ENTER("_mi_balance_page");
k_length=keyinfo->keylength;
@@ -796,7 +796,7 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo,
if (!_mi_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,info->buff,0))
goto err;
- DBUG_DUMP("next",(byte*) info->buff,mi_getint(info->buff));
+ DBUG_DUMP("next",(uchar*) info->buff,mi_getint(info->buff));
/* Test if there is room to share keys */
@@ -815,23 +815,23 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo,
if (left_length < new_left_length)
{ /* Move keys buff -> leaf */
pos=curr_buff+left_length;
- memcpy((byte*) pos,(byte*) father_key_pos, (size_t) k_length);
- memcpy((byte*) pos+k_length, (byte*) buff+2,
+ memcpy((uchar*) pos,(uchar*) father_key_pos, (size_t) k_length);
+ memcpy((uchar*) pos+k_length, (uchar*) buff+2,
(size_t) (length=new_left_length - left_length - k_length));
pos=buff+2+length;
- memcpy((byte*) father_key_pos,(byte*) pos,(size_t) k_length);
- bmove((byte*) buff+2,(byte*) pos+k_length,new_right_length);
+ memcpy((uchar*) father_key_pos,(uchar*) pos,(size_t) k_length);
+ bmove((uchar*) buff+2,(uchar*) pos+k_length,new_right_length);
}
else
{ /* Move keys -> buff */
- bmove_upp((byte*) buff+new_right_length,(byte*) buff+right_length,
+ bmove_upp((uchar*) buff+new_right_length,(uchar*) buff+right_length,
right_length-2);
length=new_right_length-right_length-k_length;
- memcpy((byte*) buff+2+length,father_key_pos,(size_t) k_length);
+ memcpy((uchar*) buff+2+length,father_key_pos,(size_t) k_length);
pos=curr_buff+new_left_length;
- memcpy((byte*) father_key_pos,(byte*) pos,(size_t) k_length);
- memcpy((byte*) buff+2,(byte*) pos+k_length,(size_t) length);
+ memcpy((uchar*) father_key_pos,(uchar*) pos,(size_t) k_length);
+ memcpy((uchar*) buff+2,(uchar*) pos+k_length,(size_t) length);
}
if (_mi_write_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,info->buff) ||
@@ -858,22 +858,22 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo,
/* move first largest keys to new page */
pos=buff+right_length-extra_length;
- memcpy((byte*) extra_buff+2,pos,(size_t) extra_length);
+ memcpy((uchar*) extra_buff+2,pos,(size_t) extra_length);
/* Save new parting key */
memcpy(tmp_part_key, pos-k_length,k_length);
/* Make place for new keys */
- bmove_upp((byte*) buff+new_right_length,(byte*) pos-k_length,
+ bmove_upp((uchar*) buff+new_right_length,(uchar*) pos-k_length,
right_length-extra_length-k_length-2);
/* Copy keys from left page */
pos= curr_buff+new_left_length;
- memcpy((byte*) buff+2,(byte*) pos+k_length,
+ memcpy((uchar*) buff+2,(uchar*) pos+k_length,
(size_t) (length=left_length-new_left_length-k_length));
/* Copy old parting key */
- memcpy((byte*) buff+2+length,father_key_pos,(size_t) k_length);
+ memcpy((uchar*) buff+2+length,father_key_pos,(size_t) k_length);
/* Move new parting keys up to caller */
- memcpy((byte*) (right ? key : father_key_pos),pos,(size_t) k_length);
- memcpy((byte*) (right ? father_key_pos : key),tmp_part_key, k_length);
+ memcpy((uchar*) (right ? key : father_key_pos),pos,(size_t) k_length);
+ memcpy((uchar*) (right ? father_key_pos : key),tmp_part_key, k_length);
if ((new_pos=_mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR)
goto err;
diff --git a/storage/myisam/myisam_ftdump.c b/storage/myisam/myisam_ftdump.c
index 4bc1833cca6..63d954242a0 100644
--- a/storage/myisam/myisam_ftdump.c
+++ b/storage/myisam/myisam_ftdump.c
@@ -46,7 +46,7 @@ static struct my_option my_long_options[] =
{"stats", 's', "Report global stats.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Be verbose.",
- (gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index 066e6cdb81b..3700251ab15 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -68,9 +68,9 @@ static void get_options(int *argc,char * * *argv);
static void print_version(void);
static void usage(void);
static int myisamchk(MI_CHECK *param, char *filename);
-static void descript(MI_CHECK *param, register MI_INFO *info, my_string name);
+static void descript(MI_CHECK *param, register MI_INFO *info, char * name);
static int mi_sort_records(MI_CHECK *param, register MI_INFO *info,
- my_string name, uint sort_key,
+ char * name, uint sort_key,
my_bool write_info, my_bool update_index);
static int sort_record_index(MI_SORT_PARAM *sort_param, MI_INFO *info,
MI_KEYDEF *keyinfo,
@@ -167,7 +167,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.",
- (gptr*) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"check", 'c',
"Check table for errors.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -187,8 +187,8 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"data-file-length", 'D',
"Max length of data file (when recreating data-file when it's full).",
- (gptr*) &check_param.max_data_file_length,
- (gptr*) &check_param.max_data_file_length,
+ (uchar**) &check_param.max_data_file_length,
+ (uchar**) &check_param.max_data_file_length,
0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extend-check", 'e',
"If used when checking a table, ensure that the table is 100 percent consistent, which will take a long time. If used when repairing a table, try to recover every possible row from the data file. Normally this will also find a lot of garbage rows; Don't use this option with repair if you are not totally desperate.",
@@ -210,13 +210,13 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"keys-used", 'k',
"Tell MyISAM to update only some specific keys. # is a bit mask of which keys to use. This can be used to get faster inserts.",
- (gptr*) &check_param.keys_in_use,
- (gptr*) &check_param.keys_in_use,
+ (uchar**) &check_param.keys_in_use,
+ (uchar**) &check_param.keys_in_use,
0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0},
{"max-record-length", OPT_MAX_RECORD_LENGTH,
"Skip rows bigger than this if myisamchk can't allocate memory to hold it",
- (gptr*) &check_param.max_record_length,
- (gptr*) &check_param.max_record_length,
+ (uchar**) &check_param.max_record_length,
+ (uchar**) &check_param.max_record_length,
0, GET_ULL, REQUIRED_ARG, LONGLONG_MAX, 0, LONGLONG_MAX, 0, 0, 0},
{"medium-check", 'm',
"Faster than extend-check, but only finds 99.99% of all errors. Should be good enough for most cases.",
@@ -245,12 +245,12 @@ static struct my_option my_long_options[] =
#endif
{"set-auto-increment", 'A',
"Force auto_increment to start at this or higher value. If no value is given, then sets the next auto_increment value to the highest used value for the auto key + 1.",
- (gptr*) &check_param.auto_increment_value,
- (gptr*) &check_param.auto_increment_value,
+ (uchar**) &check_param.auto_increment_value,
+ (uchar**) &check_param.auto_increment_value,
0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"set-collation", OPT_SET_COLLATION,
"Change the collation used by the index",
- (gptr*) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -262,12 +262,12 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"sort-records", 'R',
"Sort records according to an index. This makes your data much more localized and may speed up things. (It may be VERY slow to do a sort the first time!)",
- (gptr*) &check_param.opt_sort_key,
- (gptr*) &check_param.opt_sort_key,
+ (uchar**) &check_param.opt_sort_key,
+ (uchar**) &check_param.opt_sort_key,
0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't',
"Path for temporary files.",
- (gptr*) &opt_tmpdir,
+ (uchar**) &opt_tmpdir,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"update-state", 'U',
"Mark tables as crashed if any errors were found.",
@@ -285,54 +285,54 @@ static struct my_option my_long_options[] =
"Wait if table is locked.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{ "key_buffer_size", OPT_KEY_BUFFER_SIZE, "",
- (gptr*) &check_param.use_buffers, (gptr*) &check_param.use_buffers, 0,
+ (uchar**) &check_param.use_buffers, (uchar**) &check_param.use_buffers, 0,
GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT, (long) MALLOC_OVERHEAD,
(long) ~0L, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0},
{ "key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE, "",
- (gptr*) &opt_key_cache_block_size,
- (gptr*) &opt_key_cache_block_size, 0,
+ (uchar**) &opt_key_cache_block_size,
+ (uchar**) &opt_key_cache_block_size, 0,
GET_LONG, REQUIRED_ARG, MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH,
MI_MAX_KEY_BLOCK_LENGTH, 0, MI_MIN_KEY_BLOCK_LENGTH, 0},
{ "myisam_block_size", OPT_MYISAM_BLOCK_SIZE, "",
- (gptr*) &opt_myisam_block_size, (gptr*) &opt_myisam_block_size, 0,
+ (uchar**) &opt_myisam_block_size, (uchar**) &opt_myisam_block_size, 0,
GET_LONG, REQUIRED_ARG, MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH,
MI_MAX_KEY_BLOCK_LENGTH, 0, MI_MIN_KEY_BLOCK_LENGTH, 0},
{ "read_buffer_size", OPT_READ_BUFFER_SIZE, "",
- (gptr*) &check_param.read_buffer_length,
- (gptr*) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &check_param.read_buffer_length,
+ (uchar**) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
(long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "",
- (gptr*) &check_param.write_buffer_length,
- (gptr*) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &check_param.write_buffer_length,
+ (uchar**) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
(long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "",
- (gptr*) &check_param.sort_buffer_length,
- (gptr*) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &check_param.sort_buffer_length,
+ (uchar**) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
(long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "",
- (gptr*) &check_param.sort_key_blocks,
- (gptr*) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
+ (uchar**) &check_param.sort_key_blocks,
+ (uchar**) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
BUFFERS_WHEN_SORTING, 4L, 100L, 0L, 1L, 0},
- { "decode_bits", OPT_DECODE_BITS, "", (gptr*) &decode_bits,
- (gptr*) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0},
- { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (gptr*) &ft_min_word_len,
- (gptr*) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN,
+ { "decode_bits", OPT_DECODE_BITS, "", (uchar**) &decode_bits,
+ (uchar**) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0},
+ { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (uchar**) &ft_min_word_len,
+ (uchar**) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN,
0, 1, 0},
- { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (gptr*) &ft_max_word_len,
- (gptr*) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10,
+ { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (uchar**) &ft_max_word_len,
+ (uchar**) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10,
HA_FT_MAXCHARLEN, 0, 1, 0},
{ "ft_stopword_file", OPT_FT_STOPWORD_FILE,
"Use stopwords from this file instead of built-in list.",
- (gptr*) &ft_stopword_file, (gptr*) &ft_stopword_file, 0, GET_STR,
+ (uchar**) &ft_stopword_file, (uchar**) &ft_stopword_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"stats_method", OPT_STATS_METHOD,
"Specifies how index statistics collection code should threat NULLs. "
"Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), "
"\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".",
- (gptr*) &myisam_stats_method_str, (gptr*) &myisam_stats_method_str, 0,
+ (uchar**) &myisam_stats_method_str, (uchar**) &myisam_stats_method_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -794,7 +794,7 @@ static void get_options(register int *argc,register char ***argv)
/* Check table */
-static int myisamchk(MI_CHECK *param, my_string filename)
+static int myisamchk(MI_CHECK *param, char * filename)
{
int error,lock_type,recreate;
int rep_quick= param->testflag & (T_QUICK | T_FORCE_UNIQUENESS);
@@ -1199,7 +1199,7 @@ end2:
/* Write info about table */
-static void descript(MI_CHECK *param, register MI_INFO *info, my_string name)
+static void descript(MI_CHECK *param, register MI_INFO *info, char * name)
{
uint key,keyseg_nr,field,start;
reg3 MI_KEYDEF *keyinfo;
@@ -1465,7 +1465,7 @@ static void descript(MI_CHECK *param, register MI_INFO *info, my_string name)
/* Sort records according to one key */
static int mi_sort_records(MI_CHECK *param,
- register MI_INFO *info, my_string name,
+ register MI_INFO *info, char * name,
uint sort_key,
my_bool write_info,
my_bool update_index)
@@ -1536,7 +1536,7 @@ static int mi_sort_records(MI_CHECK *param,
mi_check_print_error(param,"Not enough memory for key block");
goto err;
}
- if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength,
+ if (!(sort_param.record=(uchar*) my_malloc((uint) share->base.pack_reclength,
MYF(0))))
{
mi_check_print_error(param,"Not enough memory for record");
@@ -1567,7 +1567,7 @@ static int mi_sort_records(MI_CHECK *param,
for (key=0 ; key < share->base.keys ; key++)
share->keyinfo[key].flag|= HA_SORT_ALLOWS_SAME;
- if (my_pread(share->kfile,(byte*) temp_buff,
+ if (my_pread(share->kfile,(uchar*) temp_buff,
(uint) keyinfo->block_length,
share->state.key_root[sort_key],
MYF(MY_NABP+MY_WME)))
@@ -1630,7 +1630,7 @@ err:
}
if (temp_buff)
{
- my_afree((gptr) temp_buff);
+ my_afree((uchar*) temp_buff);
}
my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
@@ -1679,7 +1679,7 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info,
if (nod_flag)
{
next_page=_mi_kpos(nod_flag,keypos);
- if (my_pread(info->s->kfile,(byte*) temp_buff,
+ if (my_pread(info->s->kfile,(uchar*) temp_buff,
(uint) keyinfo->block_length, next_page,
MYF(MY_NABP+MY_WME)))
{
@@ -1718,19 +1718,19 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info,
goto err;
}
/* Clear end of block to get better compression if the table is backuped */
- bzero((byte*) buff+used_length,keyinfo->block_length-used_length);
- if (my_pwrite(info->s->kfile,(byte*) buff,(uint) keyinfo->block_length,
+ bzero((uchar*) buff+used_length,keyinfo->block_length-used_length);
+ if (my_pwrite(info->s->kfile,(uchar*) buff,(uint) keyinfo->block_length,
page,param->myf_rw))
{
mi_check_print_error(param,"%d when updating keyblock",my_errno);
goto err;
}
if (temp_buff)
- my_afree((gptr) temp_buff);
+ my_afree((uchar*) temp_buff);
DBUG_RETURN(0);
err:
if (temp_buff)
- my_afree((gptr) temp_buff);
+ my_afree((uchar*) temp_buff);
DBUG_RETURN(1);
} /* sort_record_index */
diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h
index a491e6d210c..f68d66d4cbb 100644
--- a/storage/myisam/myisamdef.h
+++ b/storage/myisam/myisamdef.h
@@ -167,22 +167,22 @@ typedef struct st_mi_isam_share { /* Shared between opens */
char *unique_file_name; /* realpath() of index file */
char *data_file_name, /* Resolved path names from symlinks */
*index_file_name;
- byte *file_map; /* mem-map of file if possible */
+ uchar *file_map; /* mem-map of file if possible */
KEY_CACHE *key_cache; /* ref to the current key cache */
MI_DECODE_TREE *decode_trees;
uint16 *decode_tables;
- int (*read_record)(struct st_myisam_info*, my_off_t, byte*);
- int (*write_record)(struct st_myisam_info*, const byte*);
- int (*update_record)(struct st_myisam_info*, my_off_t, const byte*);
+ int (*read_record)(struct st_myisam_info*, my_off_t, uchar*);
+ int (*write_record)(struct st_myisam_info*, const uchar*);
+ int (*update_record)(struct st_myisam_info*, my_off_t, const uchar*);
int (*delete_record)(struct st_myisam_info*);
- int (*read_rnd)(struct st_myisam_info*, byte*, my_off_t, my_bool);
- int (*compare_record)(struct st_myisam_info*, const byte *);
+ int (*read_rnd)(struct st_myisam_info*, uchar*, my_off_t, my_bool);
+ int (*compare_record)(struct st_myisam_info*, const uchar *);
/* Function to use for a row checksum. */
- ha_checksum (*calc_checksum)(struct st_myisam_info*, const byte *);
+ ha_checksum (*calc_checksum)(struct st_myisam_info*, const uchar *);
int (*compare_unique)(struct st_myisam_info*, MI_UNIQUEDEF *,
- const byte *record, my_off_t pos);
- uint (*file_read)(MI_INFO *, byte *, uint, my_off_t, myf);
- uint (*file_write)(MI_INFO *, byte *, uint, my_off_t, myf);
+ const uchar *record, my_off_t pos);
+ uint (*file_read)(MI_INFO *, uchar *, uint, my_off_t, myf);
+ uint (*file_write)(MI_INFO *, uchar *, uint, my_off_t, myf);
invalidator_by_filename invalidator; /* query cache invalidator */
ulong this_process; /* processid */
ulong last_process; /* For table-change-check */
@@ -245,12 +245,12 @@ struct st_myisam_info {
uchar *buff, /* Temp area for key */
*lastkey,*lastkey2; /* Last used search key */
uchar *first_mbr_key; /* Searhed spatial key */
- byte *rec_buff; /* Tempbuff for recordpack */
+ uchar *rec_buff; /* Tempbuff for recordpack */
uchar *int_keypos, /* Save position for next/previous */
*int_maxpos; /* -""- */
uint int_nod_flag; /* -""- */
uint32 int_keytree_version; /* -""- */
- int (*read_record)(struct st_myisam_info*, my_off_t, byte*);
+ int (*read_record)(struct st_myisam_info*, my_off_t, uchar*);
invalidator_by_filename invalidator; /* query cache invalidator */
ulong this_unique; /* uniq filenumber or thread */
ulong last_unique; /* last unique number */
@@ -334,10 +334,10 @@ typedef struct st_mi_sort_param
HA_KEYSEG *seg;
SORT_INFO *sort_info;
uchar **sort_keys;
- byte *rec_buff;
+ uchar *rec_buff;
void *wordlist, *wordptr;
MEM_ROOT wordroot;
- char *record;
+ uchar *record;
MY_TMPDIR *tmpdir;
int (*key_cmp)(struct st_mi_sort_param *, const void *, const void *);
int (*key_read)(struct st_mi_sort_param *,void *);
@@ -349,6 +349,7 @@ typedef struct st_mi_sort_param
NEAR int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,char *,
uint, uint);
} MI_SORT_PARAM;
+
/* Some defines used by isam-funktions */
#define USE_WHOLE_KEY MI_MAX_KEY_BUFF*2 /* Use whole key in _mi_search() */
@@ -497,20 +498,20 @@ typedef struct st_mi_s_param
/* Prototypes for intern functions */
-extern int _mi_read_dynamic_record(MI_INFO *info,my_off_t filepos,byte *buf);
-extern int _mi_write_dynamic_record(MI_INFO*, const byte*);
-extern int _mi_update_dynamic_record(MI_INFO*, my_off_t, const byte*);
+extern int _mi_read_dynamic_record(MI_INFO *info,my_off_t filepos,uchar *buf);
+extern int _mi_write_dynamic_record(MI_INFO*, const uchar*);
+extern int _mi_update_dynamic_record(MI_INFO*, my_off_t, const uchar*);
extern int _mi_delete_dynamic_record(MI_INFO *info);
-extern int _mi_cmp_dynamic_record(MI_INFO *info,const byte *record);
-extern int _mi_read_rnd_dynamic_record(MI_INFO *, byte *,my_off_t, my_bool);
-extern int _mi_write_blob_record(MI_INFO*, const byte*);
-extern int _mi_update_blob_record(MI_INFO*, my_off_t, const byte*);
-extern int _mi_read_static_record(MI_INFO *info, my_off_t filepos,byte *buf);
-extern int _mi_write_static_record(MI_INFO*, const byte*);
-extern int _mi_update_static_record(MI_INFO*, my_off_t, const byte*);
+extern int _mi_cmp_dynamic_record(MI_INFO *info,const uchar *record);
+extern int _mi_read_rnd_dynamic_record(MI_INFO *, uchar *,my_off_t, my_bool);
+extern int _mi_write_blob_record(MI_INFO*, const uchar*);
+extern int _mi_update_blob_record(MI_INFO*, my_off_t, const uchar*);
+extern int _mi_read_static_record(MI_INFO *info, my_off_t filepos,uchar *buf);
+extern int _mi_write_static_record(MI_INFO*, const uchar*);
+extern int _mi_update_static_record(MI_INFO*, my_off_t, const uchar*);
extern int _mi_delete_static_record(MI_INFO *info);
-extern int _mi_cmp_static_record(MI_INFO *info,const byte *record);
-extern int _mi_read_rnd_static_record(MI_INFO*, byte *,my_off_t, my_bool);
+extern int _mi_cmp_static_record(MI_INFO *info,const uchar *record);
+extern int _mi_read_rnd_static_record(MI_INFO*, uchar *,my_off_t, my_bool);
extern int _mi_ck_write(MI_INFO *info,uint keynr,uchar *key,uint length);
extern int _mi_ck_real_write_btree(MI_INFO *info, MI_KEYDEF *keyinfo,
uchar *key, uint key_length,
@@ -604,39 +605,39 @@ extern int _mi_dispose(MI_INFO *info,MI_KEYDEF *keyinfo,my_off_t pos,
int level);
extern my_off_t _mi_new(MI_INFO *info,MI_KEYDEF *keyinfo,int level);
extern uint _mi_make_key(MI_INFO *info,uint keynr,uchar *key,
- const byte *record,my_off_t filepos);
+ const uchar *record,my_off_t filepos);
extern uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key,
uchar *old, key_part_map keypart_map,
HA_KEYSEG **last_used_keyseg);
-extern int _mi_read_key_record(MI_INFO *info,my_off_t filepos,byte *buf);
-extern int _mi_read_cache(IO_CACHE *info,byte *buff,my_off_t pos,
+extern int _mi_read_key_record(MI_INFO *info,my_off_t filepos,uchar *buf);
+extern int _mi_read_cache(IO_CACHE *info,uchar *buff,my_off_t pos,
uint length,int re_read_if_possibly);
-extern ulonglong retrieve_auto_increment(MI_INFO *info,const byte *record);
+extern ulonglong retrieve_auto_increment(MI_INFO *info,const uchar *record);
-extern byte *mi_alloc_rec_buff(MI_INFO *,ulong, byte**);
+extern uchar *mi_alloc_rec_buff(MI_INFO *,ulong, uchar**);
#define mi_get_rec_buff_ptr(info,buf) \
((((info)->s->options & HA_OPTION_PACK_RECORD) && (buf)) ? \
(buf) - MI_REC_BUFF_OFFSET : (buf))
#define mi_get_rec_buff_len(info,buf) \
(*((uint32 *)(mi_get_rec_buff_ptr(info,buf))))
-extern ulong _mi_rec_unpack(MI_INFO *info,byte *to,byte *from,
+extern ulong _mi_rec_unpack(MI_INFO *info,uchar *to,uchar *from,
ulong reclength);
-extern my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *packpos,
+extern my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *packpos,
ulong packed_length, my_bool with_checkum);
extern int _mi_write_part_record(MI_INFO *info,my_off_t filepos,ulong length,
- my_off_t next_filepos,byte **record,
+ my_off_t next_filepos,uchar **record,
ulong *reclength,int *flag);
extern void _mi_print_key(FILE *stream,HA_KEYSEG *keyseg,const uchar *key,
uint length);
extern my_bool _mi_read_pack_info(MI_INFO *info,pbool fix_keys);
-extern int _mi_read_pack_record(MI_INFO *info,my_off_t filepos,byte *buf);
-extern int _mi_read_rnd_pack_record(MI_INFO*, byte *,my_off_t, my_bool);
+extern int _mi_read_pack_record(MI_INFO *info,my_off_t filepos,uchar *buf);
+extern int _mi_read_rnd_pack_record(MI_INFO*, uchar *,my_off_t, my_bool);
extern int _mi_pack_rec_unpack(MI_INFO *info, MI_BIT_BUFF *bit_buff,
- byte *to, byte *from, ulong reclength);
+ uchar *to, uchar *from, ulong reclength);
extern ulonglong mi_safe_mul(ulonglong a,ulonglong b);
-extern int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
- const byte *oldrec, const byte *newrec, my_off_t pos);
+extern int _mi_ft_update(MI_INFO *info, uint keynr, uchar *keybuf,
+ const uchar *oldrec, const uchar *newrec, my_off_t pos);
struct st_sort_info;
@@ -697,32 +698,32 @@ extern "C" {
#endif
extern uint _mi_get_block_info(MI_BLOCK_INFO *,File, my_off_t);
-extern uint _mi_rec_pack(MI_INFO *info,byte *to,const byte *from);
+extern uint _mi_rec_pack(MI_INFO *info,uchar *to,const uchar *from);
extern uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
- MI_BLOCK_INFO *info, byte **rec_buff_p,
+ MI_BLOCK_INFO *info, uchar **rec_buff_p,
File file, my_off_t filepos);
-extern void _my_store_blob_length(byte *pos,uint pack_length,uint length);
+extern void _my_store_blob_length(uchar *pos,uint pack_length,uint length);
extern void _myisam_log(enum myisam_log_commands command,MI_INFO *info,
- const byte *buffert,uint length);
+ const uchar *buffert,uint length);
extern void _myisam_log_command(enum myisam_log_commands command,
- MI_INFO *info, const byte *buffert,
+ MI_INFO *info, const uchar *buffert,
uint length, int result);
extern void _myisam_log_record(enum myisam_log_commands command,MI_INFO *info,
- const byte *record,my_off_t filepos,
+ const uchar *record,my_off_t filepos,
int result);
extern void mi_report_error(int errcode, const char *file_name);
extern my_bool _mi_memmap_file(MI_INFO *info);
extern void _mi_unmap_file(MI_INFO *info);
-extern uint save_pack_length(uint version, byte *block_buff, ulong length);
+extern uint save_pack_length(uint version, uchar *block_buff, ulong length);
extern uint read_pack_length(uint version, const uchar *buf, ulong *length);
extern uint calc_pack_length(uint version, ulong length);
-extern uint mi_mmap_pread(MI_INFO *info, byte *Buffer,
+extern uint mi_mmap_pread(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags);
-extern uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer,
+extern uint mi_mmap_pwrite(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags);
-extern uint mi_nommap_pread(MI_INFO *info, byte *Buffer,
+extern uint mi_nommap_pread(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags);
-extern uint mi_nommap_pwrite(MI_INFO *info, byte *Buffer,
+extern uint mi_nommap_pwrite(MI_INFO *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags);
uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite);
@@ -741,17 +742,17 @@ char *mi_recinfo_read(char *ptr, MI_COLUMNDEF *recinfo);
extern int mi_disable_indexes(MI_INFO *info);
extern int mi_enable_indexes(MI_INFO *info);
extern int mi_indexes_are_disabled(MI_INFO *info);
-ulong _my_calc_total_blob_length(MI_INFO *info, const byte *record);
-ha_checksum mi_checksum(MI_INFO *info, const byte *buf);
-ha_checksum mi_static_checksum(MI_INFO *info, const byte *buf);
-my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record,
+ulong _my_calc_total_blob_length(MI_INFO *info, const uchar *record);
+ha_checksum mi_checksum(MI_INFO *info, const uchar *buf);
+ha_checksum mi_static_checksum(MI_INFO *info, const uchar *buf);
+my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record,
ha_checksum unique_hash, my_off_t pos);
-ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *buf);
+ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *buf);
int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def,
- const byte *record, my_off_t pos);
+ const uchar *record, my_off_t pos);
int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def,
- const byte *record, my_off_t pos);
-int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b,
+ const uchar *record, my_off_t pos);
+int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b,
my_bool null_are_equal);
void mi_get_status(void* param, int concurrent_insert);
void mi_update_status(void* param);
diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c
index 0bcf74d87a4..1cf4ad730cb 100644
--- a/storage/myisam/myisamlog.c
+++ b/storage/myisam/myisamlog.c
@@ -32,14 +32,14 @@ struct file_info {
long process;
int filenr,id;
uint rnd;
- my_string name,show_name,record;
+ char *name, *show_name, *record;
MI_INFO *isam;
bool closed,used;
ulong accessed;
};
struct test_if_open_param {
- my_string name;
+ char * name;
int max_id;
};
@@ -53,24 +53,25 @@ struct st_access_param
extern int main(int argc,char * *argv);
static void get_options(int *argc,char ***argv);
-static int examine_log(my_string file_name,char **table_names);
-static int read_string(IO_CACHE *file,gptr *to,uint length);
+static int examine_log(char * file_name,char **table_names);
+static int read_string(IO_CACHE *file,uchar* *to,uint length);
static int file_info_compare(void *cmp_arg, void *a,void *b);
static int test_if_open(struct file_info *key,element_count count,
struct test_if_open_param *param);
-static void fix_blob_pointers(MI_INFO *isam,byte *record);
+static void fix_blob_pointers(MI_INFO *isam,uchar *record);
static int test_when_accessed(struct file_info *key,element_count count,
struct st_access_param *access_param);
static void file_info_free(struct file_info *info);
static int close_some_file(TREE *tree);
static int reopen_closed_file(TREE *tree,struct file_info *file_info);
-static int find_record_with_key(struct file_info *file_info,byte *record);
+static int find_record_with_key(struct file_info *file_info,uchar *record);
static void printf_log(const char *str,...);
-static bool cmp_filename(struct file_info *file_info,my_string name);
+static bool cmp_filename(struct file_info *file_info,char * name);
static uint verbose=0,update=0,test_info=0,max_files=0,re_open_count=0,
recover=0,prefix_remove=0,opt_processes=0;
-static my_string log_filename=0,filepath=0,write_filename=0,record_pos_file=0;
+static char *log_filename=0, *filepath=0, *write_filename=0;
+static char *record_pos_file= 0;
static ulong com_count[10][3],number_of_commands=(ulong) ~0L,
isamlog_process;
static my_off_t isamlog_filepos,start_offset=0,record_pos= HA_OFFSET_ERROR;
@@ -296,7 +297,7 @@ static void get_options(register int *argc, register char ***argv)
}
-static int examine_log(my_string file_name, char **table_names)
+static int examine_log(char * file_name, char **table_names)
{
uint command,result,files_open;
ulong access_time,length;
@@ -304,7 +305,7 @@ static int examine_log(my_string file_name, char **table_names)
int lock_command,mi_result;
char isam_file_name[FN_REFLEN],llbuff[21],llbuff2[21];
uchar head[20];
- gptr buff;
+ uchar* buff;
struct test_if_open_param open_param;
IO_CACHE cache;
File file;
@@ -327,7 +328,7 @@ static int examine_log(my_string file_name, char **table_names)
}
init_io_cache(&cache,file,0,READ_CACHE,start_offset,0,MYF(0));
- bzero((gptr) com_count,sizeof(com_count));
+ bzero((uchar*) com_count,sizeof(com_count));
init_tree(&tree,0,0,sizeof(file_info),(qsort_cmp2) file_info_compare,1,
(tree_element_free) file_info_free, NULL);
VOID(init_key_cache(dflt_key_cache,KEY_CACHE_BLOCK_SIZE,KEY_CACHE_SIZE,
@@ -335,7 +336,7 @@ static int examine_log(my_string file_name, char **table_names)
files_open=0; access_time=0;
while (access_time++ != number_of_commands &&
- !my_b_read(&cache,(byte*) head,9))
+ !my_b_read(&cache,(uchar*) head,9))
{
isamlog_filepos=my_b_tell(&cache)-9L;
file_info.filenr= mi_uint2korr(head+1);
@@ -375,14 +376,15 @@ static int examine_log(my_string file_name, char **table_names)
}
if (curr_file_info)
- printf("\nWarning: %s is opened with same process and filenumber\nMaybe you should use the -P option ?\n",
+ printf("\nWarning: %s is opened with same process and filenumber\n"
+ "Maybe you should use the -P option ?\n",
curr_file_info->show_name);
- if (my_b_read(&cache,(byte*) head,2))
+ if (my_b_read(&cache,(uchar*) head,2))
goto err;
file_info.name=0;
file_info.show_name=0;
file_info.record=0;
- if (read_string(&cache,(gptr*) &file_info.name,
+ if (read_string(&cache,(uchar**) &file_info.name,
(uint) mi_uint2korr(head)))
goto err;
{
@@ -455,7 +457,7 @@ static int examine_log(my_string file_name, char **table_names)
files_open++;
file_info.closed=0;
}
- VOID(tree_insert(&tree, (gptr) &file_info, 0, tree.custom_arg));
+ VOID(tree_insert(&tree, (uchar*) &file_info, 0, tree.custom_arg));
if (file_info.used)
{
if (verbose && !record_pos_file)
@@ -474,11 +476,11 @@ static int examine_log(my_string file_name, char **table_names)
{
if (!curr_file_info->closed)
files_open--;
- VOID(tree_delete(&tree, (gptr) curr_file_info, 0, tree.custom_arg));
+ VOID(tree_delete(&tree, (uchar*) curr_file_info, 0, tree.custom_arg));
}
break;
case MI_LOG_EXTRA:
- if (my_b_read(&cache,(byte*) head,1))
+ if (my_b_read(&cache,(uchar*) head,1))
goto err;
extra_command=(enum ha_extra_function) head[0];
if (verbose && !record_pos_file &&
@@ -499,7 +501,7 @@ static int examine_log(my_string file_name, char **table_names)
}
break;
case MI_LOG_DELETE:
- if (my_b_read(&cache,(byte*) head,8))
+ if (my_b_read(&cache,(uchar*) head,8))
goto err;
filepos=mi_sizekorr(head);
if (verbose && (!record_pos_file ||
@@ -534,7 +536,7 @@ static int examine_log(my_string file_name, char **table_names)
break;
case MI_LOG_WRITE:
case MI_LOG_UPDATE:
- if (my_b_read(&cache,(byte*) head,12))
+ if (my_b_read(&cache,(uchar*) head,12))
goto err;
filepos=mi_sizekorr(head);
length=mi_uint4korr(head+8);
@@ -616,7 +618,7 @@ static int examine_log(my_string file_name, char **table_names)
my_free(buff,MYF(0));
break;
case MI_LOG_LOCK:
- if (my_b_read(&cache,(byte*) head,sizeof(lock_command)))
+ if (my_b_read(&cache,(uchar*) head,sizeof(lock_command)))
goto err;
memcpy_fixed(&lock_command,head,sizeof(lock_command));
if (verbose && !record_pos_file &&
@@ -675,14 +677,14 @@ static int examine_log(my_string file_name, char **table_names)
}
-static int read_string(IO_CACHE *file, register gptr *to, register uint length)
+static int read_string(IO_CACHE *file, register uchar* *to, register uint length)
{
DBUG_ENTER("read_string");
if (*to)
- my_free((gptr) *to,MYF(0));
- if (!(*to= (gptr) my_malloc(length+1,MYF(MY_WME))) ||
- my_b_read(file,(byte*) *to,length))
+ my_free((uchar*) *to,MYF(0));
+ if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) ||
+ my_b_read(file,(uchar*) *to,length))
{
if (*to)
my_free(*to,MYF(0));
@@ -717,9 +719,9 @@ static int test_if_open (struct file_info *key,
}
-static void fix_blob_pointers(MI_INFO *info, byte *record)
+static void fix_blob_pointers(MI_INFO *info, uchar *record)
{
- byte *pos;
+ uchar *pos;
MI_BLOB *blob,*end;
pos=record+info->s->base.reclength;
@@ -801,7 +803,7 @@ static int reopen_closed_file(TREE *tree, struct file_info *fileinfo)
/* Try to find record with uniq key */
-static int find_record_with_key(struct file_info *file_info, byte *record)
+static int find_record_with_key(struct file_info *file_info, uchar *record)
{
uint key;
MI_INFO *info=file_info->isam;
@@ -836,7 +838,7 @@ static void printf_log(const char *format,...)
}
-static bool cmp_filename(struct file_info *file_info, my_string name)
+static bool cmp_filename(struct file_info *file_info, char * name)
{
if (!file_info)
return 1;
diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c
index fb631b5e63e..5f7c4ee8f2e 100644
--- a/storage/myisam/myisampack.c
+++ b/storage/myisam/myisampack.c
@@ -69,8 +69,8 @@ typedef struct st_huff_counts {
my_off_t pre_space[8];
my_off_t tot_end_space,tot_pre_space,zero_fields,empty_fields,bytes_packed;
TREE int_tree; /* Tree for detecting distinct column values. */
- byte *tree_buff; /* Column values, 'field_length' each. */
- byte *tree_pos; /* Points to end of column values in 'tree_buff'. */
+ uchar *tree_buff; /* Column values, 'field_length' each. */
+ uchar *tree_pos; /* Points to end of column values in 'tree_buff'. */
} HUFF_COUNTS;
typedef struct st_huff_element HUFF_ELEMENT;
@@ -141,8 +141,8 @@ static int test_space_compress(HUFF_COUNTS *huff_counts,my_off_t records,
enum en_fieldtype field_type);
static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts,uint trees);
static int make_huff_tree(HUFF_TREE *tree,HUFF_COUNTS *huff_counts);
-static int compare_huff_elements(void *not_used, byte *a,byte *b);
-static int save_counts_in_queue(byte *key,element_count count,
+static int compare_huff_elements(void *not_used, uchar *a,uchar *b);
+static int save_counts_in_queue(uchar *key,element_count count,
HUFF_TREE *tree);
static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,uint flag);
static uint join_same_trees(HUFF_COUNTS *huff_counts,uint trees);
@@ -171,7 +171,7 @@ static int save_state(MI_INFO *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length,
static int save_state_mrg(File file,PACK_MRG_INFO *isam_file,my_off_t new_length,
ha_checksum crc);
static int mrg_close(PACK_MRG_INFO *mrg);
-static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf);
+static int mrg_rrnd(PACK_MRG_INFO *info,uchar *buf);
static void mrg_reset(PACK_MRG_INFO *mrg);
#if !defined(DBUG_OFF)
static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count);
@@ -257,10 +257,10 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"backup", 'b', "Make a backup of the table as table_name.OLD.",
- (gptr*) &backup, (gptr*) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (uchar**) &backup, (uchar**) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR_MP,
- "Directory where character sets are.", (gptr*) &charsets_dir,
- (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory where character sets are.", (uchar**) &charsets_dir,
+ (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f',
@@ -268,7 +268,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"join", 'j',
"Join all given tables into 'new_table_name'. All tables MUST have identical layouts.",
- (gptr*) &join_table, (gptr*) &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ (uchar**) &join_table, (uchar**) &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"help", '?', "Display this help and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -282,8 +282,8 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"wait", 'w', "Wait and retry if table is in use.", (gptr*) &opt_wait,
- (gptr*) &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"wait", 'w', "Wait and retry if table is in use.", (uchar**) &opt_wait,
+ (uchar**) &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -478,7 +478,7 @@ static bool open_isam_files(PACK_MRG_INFO *mrg,char **names,uint count)
error:
while (i--)
mi_close(mrg->file[i]);
- my_free((gptr) mrg->file,MYF(0));
+ my_free((uchar*) mrg->file,MYF(0));
return 1;
}
@@ -811,11 +811,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees,
for (i=0 ; i < trees ; i++)
{
if (huff_trees[i].element_buffer)
- my_free((gptr) huff_trees[i].element_buffer,MYF(0));
+ my_free((uchar*) huff_trees[i].element_buffer,MYF(0));
if (huff_trees[i].code)
- my_free((gptr) huff_trees[i].code,MYF(0));
+ my_free((uchar*) huff_trees[i].code,MYF(0));
}
- my_free((gptr) huff_trees,MYF(0));
+ my_free((uchar*) huff_trees,MYF(0));
}
if (huff_counts)
{
@@ -823,11 +823,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees,
{
if (huff_counts[i].tree_buff)
{
- my_free((gptr) huff_counts[i].tree_buff,MYF(0));
+ my_free((uchar*) huff_counts[i].tree_buff,MYF(0));
delete_tree(&huff_counts[i].int_tree);
}
}
- my_free((gptr) huff_counts,MYF(0));
+ my_free((uchar*) huff_counts,MYF(0));
}
delete_queue(&queue); /* This is safe to free */
return;
@@ -840,7 +840,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
int error;
uint length;
ulong reclength,max_blob_length;
- byte *record,*pos,*next_pos,*end_pos,*start_pos;
+ uchar *record,*pos,*next_pos,*end_pos,*start_pos;
ha_rows record_count;
my_bool static_row_size;
HUFF_COUNTS *count,*end_count;
@@ -848,7 +848,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
DBUG_ENTER("get_statistic");
reclength=mrg->file[0]->s->base.reclength;
- record=(byte*) my_alloca(reclength);
+ record=(uchar*) my_alloca(reclength);
end_count=huff_counts+mrg->file[0]->s->base.fields;
record_count=0; glob_crc=0;
max_blob_length=0;
@@ -1032,7 +1032,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
{
uint i;
/* Zero fields are just counted. Go to the next record. */
- if (!memcmp((byte*) start_pos,zero_string,count->field_length))
+ if (!memcmp((uchar*) start_pos,zero_string,count->field_length))
{
count->zero_fields++;
continue;
@@ -1141,12 +1141,12 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
mrg->records=record_count;
mrg->max_blob_length=max_blob_length;
- my_afree((gptr) record);
+ my_afree((uchar*) record);
DBUG_RETURN(error != HA_ERR_END_OF_FILE);
}
static int compare_huff_elements(void *not_used __attribute__((unused)),
- byte *a, byte *b)
+ uchar *a, uchar *b)
{
return *((my_off_t*) a) < *((my_off_t*) b) ? -1 :
(*((my_off_t*) a) == *((my_off_t*) b) ? 0 : 1);
@@ -1162,7 +1162,7 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees,
my_off_t old_length,new_length,length;
DBUG_ENTER("check_counts");
- bzero((gptr) field_count,sizeof(field_count));
+ bzero((uchar*) field_count,sizeof(field_count));
space_fields=fill_zero_fields=0;
for (; trees-- ; huff_counts++)
@@ -1328,12 +1328,12 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees,
}
else
{
- my_free((gptr) huff_counts->tree_buff,MYF(0));
+ my_free((uchar*) huff_counts->tree_buff,MYF(0));
delete_tree(&huff_counts->int_tree);
huff_counts->tree_buff=0;
}
if (tree.element_buffer)
- my_free((gptr) tree.element_buffer,MYF(0));
+ my_free((uchar*) tree.element_buffer,MYF(0));
}
if (huff_counts->pack_type & PACK_TYPE_SPACE_FIELDS)
space_fields++;
@@ -1450,8 +1450,8 @@ static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts, uint trees)
if (make_huff_tree(huff_tree+tree,huff_counts+tree))
{
while (tree--)
- my_free((gptr) huff_tree[tree].element_buffer,MYF(0));
- my_free((gptr) huff_tree,MYF(0));
+ my_free((uchar*) huff_tree[tree].element_buffer,MYF(0));
+ my_free((uchar*) huff_tree,MYF(0));
DBUG_RETURN(0);
}
}
@@ -1526,7 +1526,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
{
HUFF_ELEMENT *temp;
if (!(temp=
- (HUFF_ELEMENT*) my_realloc((gptr) huff_tree->element_buffer,
+ (HUFF_ELEMENT*) my_realloc((uchar*) huff_tree->element_buffer,
found*2*sizeof(HUFF_ELEMENT),
MYF(MY_WME))))
return 1;
@@ -1561,7 +1561,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
*/
tree_walk(&huff_counts->int_tree,
(int (*)(void*, element_count,void*)) save_counts_in_queue,
- (gptr) huff_tree, left_root_right);
+ (uchar*) huff_tree, left_root_right);
}
else
{
@@ -1587,7 +1587,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
new_huff_el->count=huff_counts->counts[i];
new_huff_el->a.leaf.null=0;
new_huff_el->a.leaf.element_nr=i;
- queue.root[found]=(byte*) new_huff_el;
+ queue.root[found]=(uchar*) new_huff_el;
}
}
/*
@@ -1604,7 +1604,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
new_huff_el->a.leaf.element_nr=huff_tree->min_chr=last-1;
else
new_huff_el->a.leaf.element_nr=huff_tree->max_chr=last+1;
- queue.root[found]=(byte*) new_huff_el;
+ queue.root[found]=(uchar*) new_huff_el;
}
}
@@ -1654,7 +1654,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
Replace the copied top element by the new element and re-order the
queue.
*/
- queue.root[1]=(byte*) new_huff_el;
+ queue.root[1]=(uchar*) new_huff_el;
queue_replaced(&queue);
}
huff_tree->root=(HUFF_ELEMENT*) queue.root[1];
@@ -1693,7 +1693,7 @@ static int compare_tree(void* cmp_arg __attribute__((unused)),
0
*/
-static int save_counts_in_queue(byte *key, element_count count,
+static int save_counts_in_queue(uchar *key, element_count count,
HUFF_TREE *tree)
{
HUFF_ELEMENT *new_huff_el;
@@ -1703,7 +1703,7 @@ static int save_counts_in_queue(byte *key, element_count count,
new_huff_el->a.leaf.null=0;
new_huff_el->a.leaf.element_nr= (uint) (key- tree->counts->tree_buff) /
tree->counts->field_length;
- queue.root[tree->elements]=(byte*) new_huff_el;
+ queue.root[tree->elements]=(uchar*) new_huff_el;
return 0;
}
@@ -1760,7 +1760,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,
first=i;
last=i;
/* We start with root[1], which is the queues top element. */
- queue.root[found]=(byte*) &huff_counts->counts[i];
+ queue.root[found]=(uchar*) &huff_counts->counts[i];
}
}
if (!found)
@@ -1771,7 +1771,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,
the loop, which follows the Huffman algorithm.
*/
if (found < 2)
- queue.root[++found]=(byte*) &huff_counts->counts[last ? 0 : 1];
+ queue.root[++found]=(uchar*) &huff_counts->counts[last ? 0 : 1];
/* Make a queue from the queue buffer. */
queue.elements=found;
@@ -1826,7 +1826,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,
queue. This successively replaces the references to counts by
references to HUFF_ELEMENTs.
*/
- queue.root[1]=(byte*) new_huff_el;
+ queue.root[1]=(uchar*) new_huff_el;
queue_replaced(&queue);
}
DBUG_RETURN(bytes_packed+(bits_packed+7)/8);
@@ -1859,12 +1859,12 @@ static uint join_same_trees(HUFF_COUNTS *huff_counts, uint trees)
i->tree->tree_pack_length+j->tree->tree_pack_length+
ALLOWED_JOIN_DIFF)
{
- memcpy_fixed((byte*) i->counts,(byte*) count.counts,
+ memcpy_fixed((uchar*) i->counts,(uchar*) count.counts,
sizeof(count.counts[0])*256);
- my_free((gptr) j->tree->element_buffer,MYF(0));
+ my_free((uchar*) j->tree->element_buffer,MYF(0));
j->tree->element_buffer=0;
j->tree=i->tree;
- bmove((byte*) i->counts,(byte*) count.counts,
+ bmove((uchar*) i->counts,(uchar*) count.counts,
sizeof(count.counts[0])*256);
if (make_huff_tree(i->tree,i))
return (uint) -1;
@@ -2007,7 +2007,7 @@ static char *hexdigits(ulonglong value)
static int write_header(PACK_MRG_INFO *mrg,uint head_length,uint trees,
my_off_t tot_elements,my_off_t filelength)
{
- byte *buff= (byte*) file_buffer.pos;
+ uchar *buff= (uchar*) file_buffer.pos;
bzero(buff,HEAD_LENGTH);
memcpy_fixed(buff,myisam_pack_file_magic,4);
@@ -2023,7 +2023,7 @@ static int write_header(PACK_MRG_INFO *mrg,uint head_length,uint trees,
if (test_only)
return 0;
VOID(my_seek(file_buffer.file,0L,MY_SEEK_SET,MYF(0)));
- return my_write(file_buffer.file,(const byte *) file_buffer.pos,HEAD_LENGTH,
+ return my_write(file_buffer.file,(const uchar *) file_buffer.pos,HEAD_LENGTH,
MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)) != 0;
}
@@ -2159,7 +2159,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
{ /* This should be impossible */
VOID(fprintf(stderr, "Tree offset got too big: %d, aborted\n",
huff_tree->max_offset));
- my_afree((gptr) packed_tree);
+ my_afree((uchar*) packed_tree);
return 0;
}
@@ -2331,7 +2331,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
DBUG_PRINT("info", (" "));
if (verbose >= 2)
VOID(printf("\n"));
- my_afree((gptr) packed_tree);
+ my_afree((uchar*) packed_tree);
if (errors)
{
VOID(fprintf(stderr, "Error: Generated decode trees are corrupt. Stop.\n"));
@@ -2412,7 +2412,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
my_off_t record_count;
char llbuf[32];
ulong length,pack_length;
- byte *record,*pos,*end_pos,*record_pos,*start_pos;
+ uchar *record,*pos,*end_pos,*record_pos,*start_pos;
HUFF_COUNTS *count,*end_count;
HUFF_TREE *tree;
MI_INFO *isam_file=mrg->file[0];
@@ -2420,7 +2420,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
DBUG_ENTER("compress_isam_file");
/* Allocate a buffer for the records (excluding blobs). */
- if (!(record=(byte*) my_alloca(isam_file->s->base.reclength)))
+ if (!(record=(uchar*) my_alloca(isam_file->s->base.reclength)))
return -1;
end_count=huff_counts+isam_file->s->base.fields;
@@ -2471,7 +2471,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
{
if (flush_buffer((ulong) max_calc_length + (ulong) max_pack_length))
break;
- record_pos= (byte*) file_buffer.pos;
+ record_pos= (uchar*) file_buffer.pos;
file_buffer.pos+=max_pack_length;
for (start_pos=record, count= huff_counts; count < end_count ; count++)
{
@@ -2508,7 +2508,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
switch (count->field_type) {
case FIELD_SKIP_ZERO:
- if (!memcmp((byte*) start_pos,zero_string,field_length))
+ if (!memcmp((uchar*) start_pos,zero_string,field_length))
{
DBUG_PRINT("fields", ("FIELD_SKIP_ZERO zeroes only, bits: 1"));
write_bits(1,1);
@@ -2637,7 +2637,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
break;
case FIELD_INTERVALL:
global_count=count;
- pos=(byte*) tree_search(&count->int_tree, start_pos,
+ pos=(uchar*) tree_search(&count->int_tree, start_pos,
count->int_tree.custom_arg);
intervall=(uint) (pos - count->tree_buff)/field_length;
DBUG_PRINT("fields", ("FIELD_INTERVALL"));
@@ -2660,7 +2660,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
}
else
{
- byte *blob,*blob_end;
+ uchar *blob,*blob_end;
DBUG_PRINT("fields", ("FIELD_BLOB not empty, bits: 1"));
write_bits(0,1);
/* Write the blob length. */
@@ -2701,7 +2701,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
}
else
{
- byte *end= start_pos + var_pack_length + col_length;
+ uchar *end= start_pos + var_pack_length + col_length;
DBUG_PRINT("fields", ("FIELD_VARCHAR not empty, bits: 1"));
write_bits(0,1);
/* Write the varchar length. */
@@ -2733,7 +2733,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
DBUG_PRINT("fields", ("---"));
}
flush_bits();
- length=(ulong) ((byte*) file_buffer.pos - record_pos) - max_pack_length;
+ length=(ulong) ((uchar*) file_buffer.pos - record_pos) - max_pack_length;
pack_length= save_pack_length(pack_version, record_pos, length);
if (pack_blob_length)
pack_length+= save_pack_length(pack_version, record_pos + pack_length,
@@ -2773,7 +2773,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
if (verbose >= 2)
VOID(printf("wrote %s records.\n", llstr((longlong) record_count, llbuf)));
- my_afree((gptr) record);
+ my_afree((uchar*) record);
mrg->ref_length=max_pack_length;
mrg->min_pack_length=max_record_length ? min_record_length : 0;
mrg->max_pack_length=max_record_length;
@@ -2840,7 +2840,7 @@ static int flush_buffer(ulong neaded_length)
if (test_only)
return 0;
if (error_on_write|| my_write(file_buffer.file,
- (const byte*) file_buffer.buffer,
+ (const uchar*) file_buffer.buffer,
length,
MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)))
{
@@ -2867,7 +2867,7 @@ static int flush_buffer(ulong neaded_length)
static void end_file_buffer(void)
{
- my_free((gptr) file_buffer.buffer,MYF(0));
+ my_free((uchar*) file_buffer.buffer,MYF(0));
}
/* output `bits` low bits of `value' */
@@ -3025,7 +3025,7 @@ static void mrg_reset(PACK_MRG_INFO *mrg)
}
}
-static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf)
+static int mrg_rrnd(PACK_MRG_INFO *info,uchar *buf)
{
int error;
MI_INFO *isam_info;
@@ -3048,7 +3048,7 @@ static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf)
for (;;)
{
isam_info->update&= HA_STATE_CHANGED;
- if (!(error=(*isam_info->s->read_rnd)(isam_info,(byte*) buf,
+ if (!(error=(*isam_info->s->read_rnd)(isam_info,(uchar*) buf,
filepos, 1)) ||
error != HA_ERR_END_OF_FILE)
return (error);
@@ -3071,7 +3071,7 @@ static int mrg_close(PACK_MRG_INFO *mrg)
for (i=0 ; i < mrg->count ; i++)
error|=mi_close(mrg->file[i]);
if (mrg->free_file)
- my_free((gptr) mrg->file,MYF(0));
+ my_free((uchar*) mrg->file,MYF(0));
return error;
}
@@ -3134,7 +3134,7 @@ static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count)
*/
if (huff_counts->tree_buff)
{
- my_free((gptr) huff_counts->tree_buff, MYF(0));
+ my_free((uchar*) huff_counts->tree_buff, MYF(0));
delete_tree(&huff_counts->int_tree);
huff_counts->tree_buff= NULL;
DBUG_PRINT("fakebigcodes", ("freed distinct column values"));
diff --git a/storage/myisam/rt_index.c b/storage/myisam/rt_index.c
index cf144839dd1..63ed60586d6 100644
--- a/storage/myisam/rt_index.c
+++ b/storage/myisam/rt_index.c
@@ -141,11 +141,11 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag,
res = 1;
ok:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
return res;
err1:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
info->lastpos = HA_OFFSET_ERROR;
return -1;
}
@@ -356,11 +356,11 @@ static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length,
res = 1;
ok:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
return res;
err1:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
info->lastpos = HA_OFFSET_ERROR;
return -1;
}
@@ -602,11 +602,11 @@ static int rtree_insert_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
}
ok:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
DBUG_RETURN(res);
err1:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
DBUG_RETURN(-1); /* purecov: inspected */
}
@@ -690,10 +690,10 @@ static int rtree_insert_level(MI_INFO *info, uint keynr, uchar *key,
DBUG_PRINT("rtree", ("new root page: %lu level: %d nod_flag: %u",
(ulong) new_root, 0, mi_test_if_nod(new_root_buf)));
- my_afree((byte*)new_root_buf);
+ my_afree((uchar*)new_root_buf);
break;
err1:
- my_afree((byte*)new_root_buf);
+ my_afree((uchar*)new_root_buf);
DBUG_RETURN(-1); /* purecov: inspected */
}
default:
@@ -739,7 +739,7 @@ static int rtree_fill_reinsert_list(stPageList *ReinsertList, my_off_t page,
if (ReinsertList->n_pages == ReinsertList->m_pages)
{
ReinsertList->m_pages += REINSERT_BUFFER_INC;
- if (!(ReinsertList->pages = (stPageLevel*)my_realloc((gptr)ReinsertList->pages,
+ if (!(ReinsertList->pages = (stPageLevel*)my_realloc((uchar*)ReinsertList->pages,
ReinsertList->m_pages * sizeof(stPageLevel), MYF(MY_ALLOW_ZERO_PTR))))
goto err1;
}
@@ -891,11 +891,11 @@ static int rtree_delete_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
res = 1;
ok:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
DBUG_RETURN(res);
err1:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
DBUG_RETURN(-1); /* purecov: inspected */
}
@@ -968,7 +968,7 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length)
if ((res= rtree_insert_level(info, keynr, k, key_length,
ReinsertList.pages[i].level)) == -1)
{
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
goto err1;
}
if (res)
@@ -984,13 +984,13 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length)
}
}
}
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
if (_mi_dispose(info, keyinfo, ReinsertList.pages[i].offs,
DFLT_INIT_HITS))
goto err1;
}
if (ReinsertList.pages)
- my_free((byte*) ReinsertList.pages, MYF(0));
+ my_free((uchar*) ReinsertList.pages, MYF(0));
/* check for redundant root (not leaf, 1 child) and eliminate */
if ((old_root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR)
@@ -1117,11 +1117,11 @@ ha_rows rtree_estimate(MI_INFO *info, uint keynr, uchar *key,
res = HA_POS_ERROR;
}
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
return res;
err1:
- my_afree((byte*)page_buf);
+ my_afree((uchar*)page_buf);
return HA_POS_ERROR;
}
diff --git a/storage/myisam/rt_split.c b/storage/myisam/rt_split.c
index 0f6dc872958..ef988dbd048 100644
--- a/storage/myisam/rt_split.c
+++ b/storage/myisam/rt_split.c
@@ -345,10 +345,10 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
DFLT_INIT_HITS, new_page);
DBUG_PRINT("rtree", ("split new block: %lu", (ulong) *new_page_offs));
- my_afree((byte*)new_page);
+ my_afree((uchar*)new_page);
split_err:
- my_afree((byte*) coord_buf);
+ my_afree((uchar*) coord_buf);
DBUG_RETURN(err_code);
}
diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c
index 53eb6b2e310..c7d970768f4 100644
--- a/storage/myisam/sort.c
+++ b/storage/myisam/sort.c
@@ -84,7 +84,7 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
char* key, uint sort_length,
uint count);
static inline int
-my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs);
+my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs);
/*
Creates a index of sorted keys
@@ -163,7 +163,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer,
maxbuffer/2))
{
- my_free((gptr) sort_keys,MYF(0));
+ my_free((uchar*) sort_keys,MYF(0));
sort_keys= 0;
}
else
@@ -230,9 +230,9 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
reinit_io_cache(&tempfile_for_exceptions,READ_CACHE,0L,0,0))
goto err;
- while (!my_b_read(&tempfile_for_exceptions,(byte*)&key_length,
+ while (!my_b_read(&tempfile_for_exceptions,(uchar*)&key_length,
sizeof(key_length))
- && !my_b_read(&tempfile_for_exceptions,(byte*)sort_keys,
+ && !my_b_read(&tempfile_for_exceptions,(uchar*)sort_keys,
(uint) key_length))
{
if (_mi_ck_write(idx,keyno,(uchar*) sort_keys,key_length-ref_length))
@@ -244,7 +244,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
err:
if (sort_keys)
- my_free((gptr) sort_keys,MYF(0));
+ my_free((uchar*) sort_keys,MYF(0));
delete_dynamic(&buffpek);
close_cached_file(&tempfile);
close_cached_file(&tempfile_for_exceptions);
@@ -383,7 +383,7 @@ pthread_handler_t thr_find_all_keys(void *arg)
if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK),
maxbuffer, maxbuffer/2))
{
- my_free((gptr) sort_keys,MYF(0));
+ my_free((uchar*) sort_keys,MYF(0));
sort_keys= (uchar **) NULL; /* for err: label */
}
else
@@ -453,7 +453,7 @@ err:
DBUG_PRINT("error", ("got some error"));
sort_param->sort_info->got_error= 1; /* no need to protect with a mutex */
if (sort_keys)
- my_free((gptr) sort_keys,MYF(0));
+ my_free((uchar*) sort_keys,MYF(0));
sort_param->sort_keys= 0;
delete_dynamic(& sort_param->buffpek);
close_cached_file(&sort_param->tempfile);
@@ -495,7 +495,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
MI_INFO *info=sort_info->info;
MYISAM_SHARE *share=info->s;
MI_SORT_PARAM *sinfo;
- byte *mergebuf=0;
+ uchar *mergebuf=0;
DBUG_ENTER("thr_write_keys");
LINT_INIT(length);
@@ -530,7 +530,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
sinfo->notnull: NULL,
(ulonglong) info->state->records);
}
- my_free((gptr) sinfo->sort_keys,MYF(0));
+ my_free((uchar*) sinfo->sort_keys,MYF(0));
my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff),
MYF(MY_ALLOW_ZERO_PTR));
sinfo->sort_keys=0;
@@ -621,12 +621,12 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
}
while (!got_error &&
- !my_b_read(&sinfo->tempfile_for_exceptions,(byte*)&key_length,
+ !my_b_read(&sinfo->tempfile_for_exceptions,(uchar*)&key_length,
sizeof(key_length)))
{
- byte ft_buf[HA_FT_MAXBYTELEN + HA_FT_WLEN + 10];
+ uchar ft_buf[HA_FT_MAXBYTELEN + HA_FT_WLEN + 10];
if (key_length > sizeof(ft_buf) ||
- my_b_read(&sinfo->tempfile_for_exceptions, (byte*)ft_buf,
+ my_b_read(&sinfo->tempfile_for_exceptions, (uchar*)ft_buf,
(uint)key_length) ||
_mi_ck_write(info, sinfo->key, (uchar*)ft_buf,
key_length - info->s->rec_reflength))
@@ -634,7 +634,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
}
}
}
- my_free((gptr) mergebuf,MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) mergebuf,MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN(got_error);
}
#endif /* THREAD */
@@ -648,7 +648,7 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys,
uint sort_length=info->key_length;
DBUG_ENTER("write_keys");
- qsort2((byte*) sort_keys,count,sizeof(byte*),(qsort2_cmp) info->key_cmp,
+ qsort2((uchar*) sort_keys,count,sizeof(uchar*),(qsort2_cmp) info->key_cmp,
info);
if (!my_b_inited(tempfile) &&
open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST",
@@ -660,7 +660,7 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys,
for (end=sort_keys+count ; sort_keys != end ; sort_keys++)
{
- if (my_b_write(tempfile,(byte*) *sort_keys,(uint) sort_length))
+ if (my_b_write(tempfile,(uchar*) *sort_keys,(uint) sort_length))
DBUG_RETURN(1); /* purecov: inspected */
}
DBUG_RETURN(0);
@@ -668,13 +668,13 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys,
static inline int
-my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs)
+my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs)
{
int err;
uint16 len = _mi_keylength(info->keyinfo, (uchar*) bufs);
/* The following is safe as this is a local file */
- if ((err= my_b_write(to_file, (byte*)&len, sizeof(len))))
+ if ((err= my_b_write(to_file, (uchar*)&len, sizeof(len))))
return (err);
if ((err= my_b_write(to_file,bufs, (uint) len)))
return (err);
@@ -691,7 +691,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info,
int err;
DBUG_ENTER("write_keys_varlen");
- qsort2((byte*) sort_keys,count,sizeof(byte*),(qsort2_cmp) info->key_cmp,
+ qsort2((uchar*) sort_keys,count,sizeof(uchar*),(qsort2_cmp) info->key_cmp,
info);
if (!my_b_inited(tempfile) &&
open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST",
@@ -702,7 +702,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info,
buffpek->count=count;
for (end=sort_keys+count ; sort_keys != end ; sort_keys++)
{
- if ((err= my_var_write(info,tempfile, (byte*) *sort_keys)))
+ if ((err= my_var_write(info,tempfile, (uchar*) *sort_keys)))
DBUG_RETURN(err);
}
DBUG_RETURN(0);
@@ -720,8 +720,8 @@ static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key,
DISK_BUFFER_SIZE, info->sort_info->param->myf_rw))
DBUG_RETURN(1);
- if (my_b_write(tempfile,(byte*)&key_length,sizeof(key_length)) ||
- my_b_write(tempfile,(byte*)key,(uint) key_length))
+ if (my_b_write(tempfile,(uchar*)&key_length,sizeof(key_length)) ||
+ my_b_write(tempfile,(uchar*)key,(uint) key_length))
DBUG_RETURN(1);
DBUG_RETURN(0);
} /* write_key */
@@ -734,7 +734,7 @@ static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys,
{
DBUG_ENTER("write_index");
- qsort2((gptr) sort_keys,(size_t) count,sizeof(byte*),
+ qsort2((uchar*) sort_keys,(size_t) count,sizeof(uchar*),
(qsort2_cmp) info->key_cmp,info);
while (count--)
{
@@ -812,7 +812,7 @@ static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek,
if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count)))
{
- if (my_pread(fromfile->file,(byte*) buffpek->base,
+ if (my_pread(fromfile->file,(uchar*) buffpek->base,
(length= sort_length*count),buffpek->file_pos,MYF_RW))
return((uint) -1); /* purecov: inspected */
buffpek->key=buffpek->base;
@@ -837,11 +837,11 @@ static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek,
for (idx=1;idx<=count;idx++)
{
- if (my_pread(fromfile->file,(byte*)&length_of_key,sizeof(length_of_key),
+ if (my_pread(fromfile->file,(uchar*)&length_of_key,sizeof(length_of_key),
buffpek->file_pos,MYF_RW))
return((uint) -1);
buffpek->file_pos+=sizeof(length_of_key);
- if (my_pread(fromfile->file,(byte*) buffp,length_of_key,
+ if (my_pread(fromfile->file,(uchar*) buffp,length_of_key,
buffpek->file_pos,MYF_RW))
return((uint) -1);
buffpek->file_pos+=length_of_key;
@@ -865,7 +865,7 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
for (idx=1;idx<=count;idx++)
{
int err;
- if ((err= my_var_write(info,to_file, (byte*) bufs)))
+ if ((err= my_var_write(info,to_file, (uchar*) bufs)))
return (err);
bufs=bufs+sort_length;
}
@@ -877,7 +877,7 @@ static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)),
IO_CACHE *to_file, char* key,
uint sort_length, uint count)
{
- return my_b_write(to_file,(byte*) key,(uint) sort_length*count);
+ return my_b_write(to_file,(uchar*) key,(uint) sort_length*count);
}
/*
@@ -909,7 +909,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
sort_length=info->key_length;
if (init_queue(&queue,(uint) (Tb-Fb)+1,offsetof(BUFFPEK,key),0,
- (int (*)(void*, byte *,byte*)) info->key_cmp,
+ (int (*)(void*, uchar *,uchar*)) info->key_cmp,
(void*) info))
DBUG_RETURN(1); /* purecov: inspected */
@@ -936,7 +936,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
buffpek=(BUFFPEK*) queue_top(&queue);
if (to_file)
{
- if (info->write_key(info,to_file,(byte*) buffpek->key,
+ if (info->write_key(info,to_file,(uchar*) buffpek->key,
(uint) sort_length,1))
{
error=1; goto err; /* purecov: inspected */
@@ -992,7 +992,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
{
if (to_file)
{
- if (info->write_key(info,to_file,(byte*) buffpek->key,
+ if (info->write_key(info,to_file,(uchar*) buffpek->key,
sort_length,buffpek->mem_count))
{
error=1; goto err; /* purecov: inspected */
@@ -1045,7 +1045,7 @@ flush_ft_buf(MI_SORT_PARAM *info)
if (info->sort_info->ft_buf)
{
err=sort_ft_buf_flush(info);
- my_free((gptr)info->sort_info->ft_buf, MYF(0));
+ my_free((uchar*)info->sort_info->ft_buf, MYF(0));
info->sort_info->ft_buf=0;
}
return err;
diff --git a/storage/myisam/sp_defs.h b/storage/myisam/sp_defs.h
index 11254d16c97..187ec62b2a3 100644
--- a/storage/myisam/sp_defs.h
+++ b/storage/myisam/sp_defs.h
@@ -40,7 +40,7 @@ enum wkbByteOrder
};
uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
- const byte *record, my_off_t filepos);
+ const uchar *record, my_off_t filepos);
#endif /*HAVE_SPATIAL*/
#endif /* _SP_DEFS_H */
diff --git a/storage/myisam/sp_key.c b/storage/myisam/sp_key.c
index 34c96a219c7..be4021935c4 100644
--- a/storage/myisam/sp_key.c
+++ b/storage/myisam/sp_key.c
@@ -31,25 +31,25 @@ static int sp_get_geometry_mbr(uchar *(*wkb), uchar *end, uint n_dims,
double *mbr, int top);
static int sp_mbr_from_wkb(uchar (*wkb), uint size, uint n_dims, double *mbr);
-static void get_double(double *d, const byte *pos)
+static void get_double(double *d, const uchar *pos)
{
float8get(*d, pos);
}
uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
- const byte *record, my_off_t filepos)
+ const uchar *record, my_off_t filepos)
{
HA_KEYSEG *keyseg;
MI_KEYDEF *keyinfo = &info->s->keyinfo[keynr];
uint len = 0;
- byte *pos;
+ uchar *pos;
uint dlen;
uchar *dptr;
double mbr[SPDIMS * 2];
uint i;
keyseg = &keyinfo->seg[-1];
- pos = (byte*)record + keyseg->start;
+ pos = (uchar*)record + keyseg->start;
dlen = _mi_calc_blob_length(keyseg->bit_start, pos);
memcpy_fixed(&dptr, pos + keyseg->bit_start, sizeof(char*));
@@ -64,7 +64,7 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
{
uint length = keyseg->length;
- pos = ((byte*)mbr) + keyseg->start;
+ pos = ((uchar*)mbr) + keyseg->start;
if (keyseg->flag & HA_SWAP_KEY)
{
#ifdef HAVE_ISNAN
@@ -100,7 +100,7 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
}
else
{
- memcpy((byte*)key, pos, length);
+ memcpy((uchar*)key, pos, length);
key += keyseg->length;
}
len += keyseg->length;
@@ -141,7 +141,7 @@ static int sp_add_point_to_mbr(uchar *(*wkb), uchar *end, uint n_dims,
{
if ((*wkb) > end - 8)
return -1;
- get_double(&ord, (const byte*) *wkb);
+ get_double(&ord, (const uchar*) *wkb);
(*wkb)+= 8;
if (ord < *mbr)
float8store((char*) mbr, ord);
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 96f7db6e633..3399694ecc3 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -120,12 +120,12 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked)
u_table->table->s->base.keys,
u_table->table->s->base.fields, false))
{
- my_free((gptr) recinfo, MYF(0));
+ my_free((uchar*) recinfo, MYF(0));
error= HA_ERR_WRONG_MRG_TABLE_DEF;
goto err;
}
}
- my_free((gptr) recinfo, MYF(0));
+ my_free((uchar*) recinfo, MYF(0));
#if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4
/* Merge table has more than 2G rows */
if (table->s->crashed)
@@ -146,7 +146,7 @@ int ha_myisammrg::close(void)
return myrg_close(file);
}
-int ha_myisammrg::write_row(byte * buf)
+int ha_myisammrg::write_row(uchar * buf)
{
statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status);
@@ -164,7 +164,7 @@ int ha_myisammrg::write_row(byte * buf)
return myrg_write(file,buf);
}
-int ha_myisammrg::update_row(const byte * old_data, byte * new_data)
+int ha_myisammrg::update_row(const uchar * old_data, uchar * new_data)
{
statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
@@ -172,13 +172,13 @@ int ha_myisammrg::update_row(const byte * old_data, byte * new_data)
return myrg_update(file,old_data,new_data);
}
-int ha_myisammrg::delete_row(const byte * buf)
+int ha_myisammrg::delete_row(const uchar * buf)
{
statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status);
return myrg_delete(file,buf);
}
-int ha_myisammrg::index_read(byte * buf, const byte * key,
+int ha_myisammrg::index_read(uchar * buf, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -189,7 +189,7 @@ int ha_myisammrg::index_read(byte * buf, const byte * key,
return error;
}
-int ha_myisammrg::index_read_idx(byte * buf, uint index, const byte * key,
+int ha_myisammrg::index_read_idx(uchar * buf, uint index, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
@@ -200,7 +200,7 @@ int ha_myisammrg::index_read_idx(byte * buf, uint index, const byte * key,
return error;
}
-int ha_myisammrg::index_read_last(byte * buf, const byte * key,
+int ha_myisammrg::index_read_last(uchar * buf, const uchar * key,
key_part_map keypart_map)
{
statistic_increment(table->in_use->status_var.ha_read_key_count,
@@ -211,7 +211,7 @@ int ha_myisammrg::index_read_last(byte * buf, const byte * key,
return error;
}
-int ha_myisammrg::index_next(byte * buf)
+int ha_myisammrg::index_next(uchar * buf)
{
statistic_increment(table->in_use->status_var.ha_read_next_count,
&LOCK_status);
@@ -220,7 +220,7 @@ int ha_myisammrg::index_next(byte * buf)
return error;
}
-int ha_myisammrg::index_prev(byte * buf)
+int ha_myisammrg::index_prev(uchar * buf)
{
statistic_increment(table->in_use->status_var.ha_read_prev_count,
&LOCK_status);
@@ -229,7 +229,7 @@ int ha_myisammrg::index_prev(byte * buf)
return error;
}
-int ha_myisammrg::index_first(byte * buf)
+int ha_myisammrg::index_first(uchar * buf)
{
statistic_increment(table->in_use->status_var.ha_read_first_count,
&LOCK_status);
@@ -238,7 +238,7 @@ int ha_myisammrg::index_first(byte * buf)
return error;
}
-int ha_myisammrg::index_last(byte * buf)
+int ha_myisammrg::index_last(uchar * buf)
{
statistic_increment(table->in_use->status_var.ha_read_last_count,
&LOCK_status);
@@ -247,8 +247,8 @@ int ha_myisammrg::index_last(byte * buf)
return error;
}
-int ha_myisammrg::index_next_same(byte * buf,
- const byte *key __attribute__((unused)),
+int ha_myisammrg::index_next_same(uchar * buf,
+ const uchar *key __attribute__((unused)),
uint length __attribute__((unused)))
{
statistic_increment(table->in_use->status_var.ha_read_next_count,
@@ -265,7 +265,7 @@ int ha_myisammrg::rnd_init(bool scan)
}
-int ha_myisammrg::rnd_next(byte *buf)
+int ha_myisammrg::rnd_next(uchar *buf)
{
statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
&LOCK_status);
@@ -275,7 +275,7 @@ int ha_myisammrg::rnd_next(byte *buf)
}
-int ha_myisammrg::rnd_pos(byte * buf, byte *pos)
+int ha_myisammrg::rnd_pos(uchar * buf, uchar *pos)
{
statistic_increment(table->in_use->status_var.ha_read_rnd_count,
&LOCK_status);
@@ -284,7 +284,7 @@ int ha_myisammrg::rnd_pos(byte * buf, byte *pos)
return error;
}
-void ha_myisammrg::position(const byte *record)
+void ha_myisammrg::position(const uchar *record)
{
ulonglong row_position= myrg_position(file);
my_store_ptr(ref, ref_length, (my_off_t) row_position);
@@ -474,8 +474,8 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
goto err;
create_info->merge_list.elements++;
- (*create_info->merge_list.next) = (byte*) ptr;
- create_info->merge_list.next= (byte**) &ptr->next_local;
+ (*create_info->merge_list.next) = (uchar*) ptr;
+ create_info->merge_list.next= (uchar**) &ptr->next_local;
}
*create_info->merge_list.next=0;
}
diff --git a/storage/myisammrg/ha_myisammrg.h b/storage/myisammrg/ha_myisammrg.h
index 7bbe659d4b7..88bb5dd2e21 100644
--- a/storage/myisammrg/ha_myisammrg.h
+++ b/storage/myisammrg/ha_myisammrg.h
@@ -53,23 +53,23 @@ class ha_myisammrg: public handler
int open(const char *name, int mode, uint test_if_locked);
int close(void);
- int write_row(byte * buf);
- int update_row(const byte * old_data, byte * new_data);
- int delete_row(const byte * buf);
- int index_read(byte * buf, const byte * key, key_part_map keypart_map,
+ int write_row(uchar * buf);
+ int update_row(const uchar * old_data, uchar * new_data);
+ int delete_row(const uchar * buf);
+ int index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
enum ha_rkey_function find_flag);
- int index_read_idx(byte * buf, uint index, const byte * key,
+ int index_read_idx(uchar * buf, uint index, const uchar * key,
key_part_map keypart_map, enum ha_rkey_function find_flag);
- int index_read_last(byte * buf, const byte * key, key_part_map keypart_map);
- int index_next(byte * buf);
- int index_prev(byte * buf);
- int index_first(byte * buf);
- int index_last(byte * buf);
- int index_next_same(byte *buf, const byte *key, uint keylen);
+ int index_read_last(uchar * buf, const uchar * key, key_part_map keypart_map);
+ int index_next(uchar * buf);
+ int index_prev(uchar * buf);
+ int index_first(uchar * buf);
+ int index_last(uchar * buf);
+ int index_next_same(uchar *buf, const uchar *key, uint keylen);
int rnd_init(bool scan);
- int rnd_next(byte *buf);
- int rnd_pos(byte * buf, byte *pos);
- void position(const byte *record);
+ int rnd_next(uchar *buf);
+ int rnd_pos(uchar * buf, uchar *pos);
+ void position(const uchar *record);
ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
int info(uint);
int reset(void);
diff --git a/storage/myisammrg/myrg_close.c b/storage/myisammrg/myrg_close.c
index 971a83928b1..baae24634b3 100644
--- a/storage/myisammrg/myrg_close.c
+++ b/storage/myisammrg/myrg_close.c
@@ -30,7 +30,7 @@ int myrg_close(MYRG_INFO *info)
pthread_mutex_lock(&THR_LOCK_open);
myrg_open_list=list_delete(myrg_open_list,&info->open_list);
pthread_mutex_unlock(&THR_LOCK_open);
- my_free((gptr) info,MYF(0));
+ my_free((uchar*) info,MYF(0));
if (error)
{
DBUG_RETURN(my_errno=error);
diff --git a/storage/myisammrg/myrg_def.h b/storage/myisammrg/myrg_def.h
index 344bd4edd3c..ec33d2c0bb4 100644
--- a/storage/myisammrg/myrg_def.h
+++ b/storage/myisammrg/myrg_def.h
@@ -28,5 +28,5 @@ extern pthread_mutex_t THR_LOCK_open;
#endif
int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag);
-int _myrg_mi_read_record(MI_INFO *info, byte *buf);
+int _myrg_mi_read_record(MI_INFO *info, uchar *buf);
diff --git a/storage/myisammrg/myrg_delete.c b/storage/myisammrg/myrg_delete.c
index f9604f66885..93d45198b36 100644
--- a/storage/myisammrg/myrg_delete.c
+++ b/storage/myisammrg/myrg_delete.c
@@ -17,7 +17,7 @@
#include "myrg_def.h"
-int myrg_delete(MYRG_INFO *info, const byte *record)
+int myrg_delete(MYRG_INFO *info, const uchar *record)
{
if (!info->current_table)
return (my_errno= HA_ERR_NO_ACTIVE_RECORD);
diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c
index 3dbb605463e..cca81f0f605 100644
--- a/storage/myisammrg/myrg_open.c
+++ b/storage/myisammrg/myrg_open.c
@@ -40,6 +40,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
IO_CACHE file;
MI_INFO *isam=0;
uint found_merge_insert_method= 0;
+ size_t name_buff_length;
DBUG_ENTER("myrg_open");
LINT_INIT(key_parts);
@@ -48,13 +49,13 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
if ((fd=my_open(fn_format(name_buff,name,"",MYRG_NAME_EXT,
MY_UNPACK_FILENAME|MY_APPEND_EXT),
O_RDONLY | O_SHARE,MYF(0))) < 0)
- goto err;
- errpos=1;
- if (init_io_cache(&file, fd, 4*IO_SIZE, READ_CACHE, 0, 0,
+ goto err;
+ errpos=1;
+ if (init_io_cache(&file, fd, 4*IO_SIZE, READ_CACHE, 0, 0,
MYF(MY_WME | MY_NABP)))
- goto err;
- errpos=2;
- dir_length=dirname_part(name_buff,name);
+ goto err;
+ errpos=2;
+ dir_length=dirname_part(name_buff, name, &name_buff_length);
while ((length=my_b_gets(&file,buff,FN_REFLEN-1)))
{
if ((end=buff+length)[-1] == '\n')
diff --git a/storage/myisammrg/myrg_queue.c b/storage/myisammrg/myrg_queue.c
index 1d252207db1..d2579053784 100644
--- a/storage/myisammrg/myrg_queue.c
+++ b/storage/myisammrg/myrg_queue.c
@@ -15,7 +15,7 @@
#include "myrg_def.h"
-static int queue_key_cmp(void *keyseg, byte *a, byte *b)
+static int queue_key_cmp(void *keyseg, uchar *a, uchar *b)
{
MYRG_TABLE *ma= (MYRG_TABLE *)a;
MYRG_TABLE *mb= (MYRG_TABLE *)b;
@@ -69,7 +69,7 @@ int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag)
return error;
}
-int _myrg_mi_read_record(MI_INFO *info, byte *buf)
+int _myrg_mi_read_record(MI_INFO *info, uchar *buf)
{
if (!(*info->read_record)(info,info->lastpos,buf))
{
diff --git a/storage/myisammrg/myrg_rfirst.c b/storage/myisammrg/myrg_rfirst.c
index 80736537d02..9d7b0f9e83f 100644
--- a/storage/myisammrg/myrg_rfirst.c
+++ b/storage/myisammrg/myrg_rfirst.c
@@ -17,7 +17,7 @@
/* Read first row according to specific key */
-int myrg_rfirst(MYRG_INFO *info, byte *buf, int inx)
+int myrg_rfirst(MYRG_INFO *info, uchar *buf, int inx)
{
MYRG_TABLE *table;
MI_INFO *mi;
@@ -35,7 +35,7 @@ int myrg_rfirst(MYRG_INFO *info, byte *buf, int inx)
return err;
}
/* adding to queue */
- queue_insert(&(info->by_key),(byte *)table);
+ queue_insert(&(info->by_key),(uchar *)table);
}
/* We have done a read in all tables */
info->last_used_table=table;
diff --git a/storage/myisammrg/myrg_rkey.c b/storage/myisammrg/myrg_rkey.c
index 2d744ae31ec..8e7886f5a43 100644
--- a/storage/myisammrg/myrg_rkey.c
+++ b/storage/myisammrg/myrg_rkey.c
@@ -35,10 +35,10 @@
SerG
*/
-int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
+int myrg_rkey(MYRG_INFO *info,uchar *buf,int inx, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function search_flag)
{
- byte *key_buff;
+ uchar *key_buff;
uint pack_key_length;
uint16 last_used_keyseg;
MYRG_TABLE *table;
@@ -60,7 +60,7 @@ int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
{
err=mi_rkey(mi, 0, inx, key, keypart_map, search_flag);
/* Get the saved packed key and packed key length. */
- key_buff=(byte*) mi->lastkey+mi->s->base.max_key_length;
+ key_buff=(uchar*) mi->lastkey+mi->s->base.max_key_length;
pack_key_length=mi->pack_key_length;
last_used_keyseg= mi->last_used_keyseg;
}
@@ -80,7 +80,7 @@ int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
DBUG_RETURN(err);
}
/* adding to queue */
- queue_insert(&(info->by_key),(byte *)table);
+ queue_insert(&(info->by_key),(uchar *)table);
}
@@ -92,6 +92,6 @@ int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
mi->once_flags|= RRND_PRESERVE_LASTINX;
DBUG_PRINT("info", ("using table no: %d",
(int) (info->current_table - info->open_tables + 1)));
- DBUG_DUMP("result key", (byte*) mi->lastkey, mi->lastkey_length);
+ DBUG_DUMP("result key", (uchar*) mi->lastkey, mi->lastkey_length);
DBUG_RETURN(_myrg_mi_read_record(mi,buf));
}
diff --git a/storage/myisammrg/myrg_rlast.c b/storage/myisammrg/myrg_rlast.c
index f364bf9b32f..8086a2f8104 100644
--- a/storage/myisammrg/myrg_rlast.c
+++ b/storage/myisammrg/myrg_rlast.c
@@ -17,7 +17,7 @@
/* Read last row with the same key as the previous read. */
-int myrg_rlast(MYRG_INFO *info, byte *buf, int inx)
+int myrg_rlast(MYRG_INFO *info, uchar *buf, int inx)
{
MYRG_TABLE *table;
MI_INFO *mi;
@@ -35,7 +35,7 @@ int myrg_rlast(MYRG_INFO *info, byte *buf, int inx)
return err;
}
/* adding to queue */
- queue_insert(&(info->by_key),(byte *)table);
+ queue_insert(&(info->by_key),(uchar *)table);
}
/* We have done a read in all tables */
info->last_used_table=table;
diff --git a/storage/myisammrg/myrg_rnext.c b/storage/myisammrg/myrg_rnext.c
index de1aa4df4b6..82d5cbf38b1 100644
--- a/storage/myisammrg/myrg_rnext.c
+++ b/storage/myisammrg/myrg_rnext.c
@@ -19,7 +19,7 @@
Read next row with the same key as previous read
*/
-int myrg_rnext(MYRG_INFO *info, byte *buf, int inx)
+int myrg_rnext(MYRG_INFO *info, uchar *buf, int inx)
{
int err;
MI_INFO *mi;
@@ -42,7 +42,7 @@ int myrg_rnext(MYRG_INFO *info, byte *buf, int inx)
else
{
/* Found here, adding to queue */
- queue_top(&(info->by_key))=(byte *)(info->current_table);
+ queue_top(&(info->by_key))=(uchar *)(info->current_table);
queue_replaced(&(info->by_key));
}
diff --git a/storage/myisammrg/myrg_rnext_same.c b/storage/myisammrg/myrg_rnext_same.c
index 9c6b522ee8a..ad7bbfb0f6e 100644
--- a/storage/myisammrg/myrg_rnext_same.c
+++ b/storage/myisammrg/myrg_rnext_same.c
@@ -16,7 +16,7 @@
#include "myrg_def.h"
-int myrg_rnext_same(MYRG_INFO *info, byte *buf)
+int myrg_rnext_same(MYRG_INFO *info, uchar *buf)
{
int err;
MI_INFO *mi;
@@ -39,7 +39,7 @@ int myrg_rnext_same(MYRG_INFO *info, byte *buf)
else
{
/* Found here, adding to queue */
- queue_top(&(info->by_key))=(byte *)(info->current_table);
+ queue_top(&(info->by_key))=(uchar *)(info->current_table);
queue_replaced(&(info->by_key));
}
diff --git a/storage/myisammrg/myrg_rprev.c b/storage/myisammrg/myrg_rprev.c
index b1b86a93fad..66c94974940 100644
--- a/storage/myisammrg/myrg_rprev.c
+++ b/storage/myisammrg/myrg_rprev.c
@@ -19,7 +19,7 @@
Read previous row with the same key as previous read
*/
-int myrg_rprev(MYRG_INFO *info, byte *buf, int inx)
+int myrg_rprev(MYRG_INFO *info, uchar *buf, int inx)
{
int err;
MI_INFO *mi;
@@ -42,7 +42,7 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx)
else
{
/* Found here, adding to queue */
- queue_top(&(info->by_key))=(byte *)(info->current_table);
+ queue_top(&(info->by_key))=(uchar *)(info->current_table);
queue_replaced(&(info->by_key));
}
diff --git a/storage/myisammrg/myrg_rrnd.c b/storage/myisammrg/myrg_rrnd.c
index 55e72b2170d..b598563680c 100644
--- a/storage/myisammrg/myrg_rrnd.c
+++ b/storage/myisammrg/myrg_rrnd.c
@@ -30,7 +30,7 @@ static MYRG_TABLE *find_table(MYRG_TABLE *start,MYRG_TABLE *end,ulonglong pos);
HA_ERR_END_OF_FILE = EOF.
*/
-int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
+int myrg_rrnd(MYRG_INFO *info,uchar *buf,ulonglong filepos)
{
int error;
MI_INFO *isam_info;
@@ -47,7 +47,7 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
}
isam_info=(info->current_table=info->open_tables)->table;
if (info->cache_in_use)
- mi_extra(isam_info,HA_EXTRA_CACHE,(byte*) &info->cache_size);
+ mi_extra(isam_info,HA_EXTRA_CACHE,(uchar*) &info->cache_size);
filepos=isam_info->s->pack.header_length;
isam_info->lastinx= (uint) -1; /* Can't forward or backward */
}
@@ -60,20 +60,20 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
for (;;)
{
isam_info->update&= HA_STATE_CHANGED;
- if ((error=(*isam_info->s->read_rnd)(isam_info,(byte*) buf,
+ if ((error=(*isam_info->s->read_rnd)(isam_info,(uchar*) buf,
(my_off_t) filepos,1)) !=
HA_ERR_END_OF_FILE)
DBUG_RETURN(error);
if (info->cache_in_use)
mi_extra(info->current_table->table, HA_EXTRA_NO_CACHE,
- (byte*) &info->cache_size);
+ (uchar*) &info->cache_size);
if (info->current_table+1 == info->end_table)
DBUG_RETURN(HA_ERR_END_OF_FILE);
info->current_table++;
info->last_used_table=info->current_table;
if (info->cache_in_use)
mi_extra(info->current_table->table, HA_EXTRA_CACHE,
- (byte*) &info->cache_size);
+ (uchar*) &info->cache_size);
info->current_table->file_offset=
info->current_table[-1].file_offset+
info->current_table[-1].table->state->data_file_length;
@@ -88,7 +88,7 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
isam_info=info->current_table->table;
isam_info->update&= HA_STATE_CHANGED;
DBUG_RETURN((*isam_info->s->read_rnd)
- (isam_info, (byte*) buf,
+ (isam_info, (uchar*) buf,
(my_off_t) (filepos - info->current_table->file_offset),
0));
}
diff --git a/storage/myisammrg/myrg_rsame.c b/storage/myisammrg/myrg_rsame.c
index 56b16c0aa3c..2f7523759dc 100644
--- a/storage/myisammrg/myrg_rsame.c
+++ b/storage/myisammrg/myrg_rsame.c
@@ -15,7 +15,7 @@
#include "myrg_def.h"
-int myrg_rsame(MYRG_INFO *info,byte *record,int inx)
+int myrg_rsame(MYRG_INFO *info,uchar *record,int inx)
{
if (inx) /* not yet used, should be 0 */
return (my_errno=HA_ERR_WRONG_INDEX);
diff --git a/storage/myisammrg/myrg_update.c b/storage/myisammrg/myrg_update.c
index ba667d69f12..5d883be8484 100644
--- a/storage/myisammrg/myrg_update.c
+++ b/storage/myisammrg/myrg_update.c
@@ -17,7 +17,7 @@
#include "myrg_def.h"
-int myrg_update(register MYRG_INFO *info,const byte *oldrec, byte *newrec)
+int myrg_update(register MYRG_INFO *info,const uchar *oldrec, uchar *newrec)
{
if (!info->current_table)
return (my_errno=HA_ERR_NO_ACTIVE_RECORD);
diff --git a/storage/myisammrg/myrg_write.c b/storage/myisammrg/myrg_write.c
index ed0a4a7996a..27534df2821 100644
--- a/storage/myisammrg/myrg_write.c
+++ b/storage/myisammrg/myrg_write.c
@@ -17,7 +17,7 @@
#include "myrg_def.h"
-int myrg_write(register MYRG_INFO *info, byte *rec)
+int myrg_write(register MYRG_INFO *info, uchar *rec)
{
/* [phi] MERGE_WRITE_DISABLED is handled by the else case */
if (info->merge_insert_method == MERGE_INSERT_TO_FIRST)
diff --git a/storage/ndb/include/util/ndb_opts.h b/storage/ndb/include/util/ndb_opts.h
index 9cb65d4bc2e..f18bb9646cc 100644
--- a/storage/ndb/include/util/ndb_opts.h
+++ b/storage/ndb/include/util/ndb_opts.h
@@ -58,40 +58,40 @@ const char *opt_debug= 0;
"Set connect string for connecting to ndb_mgmd. " \
"Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". " \
"Overrides specifying entries in NDB_CONNECTSTRING and my.cnf", \
- (gptr*) &opt_ndb_connectstring, (gptr*) &opt_ndb_connectstring, \
+ (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
{ "ndb-mgmd-host", OPT_NDB_MGMD, \
"Set host and port for connecting to ndb_mgmd. " \
"Syntax: <hostname>[:<port>].", \
- (gptr*) &opt_ndb_mgmd, (gptr*) &opt_ndb_mgmd, 0, \
+ (uchar**) &opt_ndb_mgmd, (uchar**) &opt_ndb_mgmd, 0, \
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
{ "ndb-nodeid", OPT_NDB_NODEID, \
"Set node id for this node.", \
- (gptr*) &opt_ndb_nodeid, (gptr*) &opt_ndb_nodeid, 0, \
+ (uchar**) &opt_ndb_nodeid, (uchar**) &opt_ndb_nodeid, 0, \
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
{ "ndb-shm", OPT_NDB_SHM,\
"Allow optimizing using shared memory connections when available",\
- (gptr*) &opt_ndb_shm, (gptr*) &opt_ndb_shm, 0,\
+ (uchar**) &opt_ndb_shm, (uchar**) &opt_ndb_shm, 0,\
GET_BOOL, NO_ARG, OPT_NDB_SHM_DEFAULT, 0, 0, 0, 0, 0 },\
{"ndb-optimized-node-selection", OPT_NDB_OPTIMIZED_NODE_SELECTION,\
"Select nodes for transactions in a more optimal way",\
- (gptr*) &opt_ndb_optimized_node_selection,\
- (gptr*) &opt_ndb_optimized_node_selection, 0,\
+ (uchar**) &opt_ndb_optimized_node_selection,\
+ (uchar**) &opt_ndb_optimized_node_selection, 0,\
GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},\
{ "connect-string", OPT_NDB_CONNECTSTRING, "same as --ndb-connectstring",\
- (gptr*) &opt_ndb_connectstring, (gptr*) &opt_ndb_connectstring, \
+ (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
{ "core-file", OPT_WANT_CORE, "Write core on errors.",\
- (gptr*) &opt_core, (gptr*) &opt_core, 0,\
+ (uchar**) &opt_core, (uchar**) &opt_core, 0,\
GET_BOOL, NO_ARG, OPT_WANT_CORE_DEFAULT, 0, 0, 0, 0, 0},\
{"character-sets-dir", OPT_CHARSETS_DIR,\
- "Directory where character sets are.", (gptr*) &charsets_dir,\
- (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}\
+ "Directory where character sets are.", (uchar**) &charsets_dir,\
+ (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}\
#ifndef DBUG_OFF
#define NDB_STD_OPTS(prog_name) \
{ "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", \
- (gptr*) &opt_debug, (gptr*) &opt_debug, \
+ (uchar**) &opt_debug, (uchar**) &opt_debug, \
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, \
NDB_STD_OPTS_COMMON
#else
diff --git a/storage/ndb/src/cw/cpcd/main.cpp b/storage/ndb/src/cw/cpcd/main.cpp
index f23a92b8010..d5c31d610cb 100644
--- a/storage/ndb/src/cw/cpcd/main.cpp
+++ b/storage/ndb/src/cw/cpcd/main.cpp
@@ -39,22 +39,22 @@ static const char *user = 0;
static struct my_option my_long_options[] =
{
{ "work-dir", 'w', "Work directory",
- (gptr*) &work_dir, (gptr*) &work_dir, 0,
+ (uchar**) &work_dir, (uchar**) &work_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "port", 'p', "TCP port to listen on",
- (gptr*) &port, (gptr*) &port, 0,
+ (uchar**) &port, (uchar**) &port, 0,
GET_INT, REQUIRED_ARG, CPCD_DEFAULT_TCP_PORT, 0, 0, 0, 0, 0 },
{ "syslog", 'S', "Log events to syslog",
- (gptr*) &use_syslog, (gptr*) &use_syslog, 0,
+ (uchar**) &use_syslog, (uchar**) &use_syslog, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "logfile", 'L', "File to log events to",
- (gptr*) &logfile, (gptr*) &logfile, 0,
+ (uchar**) &logfile, (uchar**) &logfile, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "debug", 'D', "Enable debug mode",
- (gptr*) &debug, (gptr*) &debug, 0,
+ (uchar**) &debug, (uchar**) &debug, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "user", 'u', "Run as user",
- (gptr*) &user, (gptr*) &user, 0,
+ (uchar**) &user, (uchar**) &user, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/src/kernel/vm/Configuration.cpp b/storage/ndb/src/kernel/vm/Configuration.cpp
index e0b485eda59..ebdd4c97aab 100644
--- a/storage/ndb/src/kernel/vm/Configuration.cpp
+++ b/storage/ndb/src/kernel/vm/Configuration.cpp
@@ -74,35 +74,35 @@ static struct my_option my_long_options[] =
{ "initial", OPT_INITIAL,
"Perform initial start of ndbd, including cleaning the file system. "
"Consult documentation before using this",
- (gptr*) &_initial, (gptr*) &_initial, 0,
+ (uchar**) &_initial, (uchar**) &_initial, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "nostart", 'n',
"Don't start ndbd immediately. Ndbd will await command from ndb_mgmd",
- (gptr*) &_no_start, (gptr*) &_no_start, 0,
+ (uchar**) &_no_start, (uchar**) &_no_start, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "daemon", 'd', "Start ndbd as daemon (default)",
- (gptr*) &_daemon, (gptr*) &_daemon, 0,
+ (uchar**) &_daemon, (uchar**) &_daemon, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
{ "nodaemon", OPT_NODAEMON,
"Do not start ndbd as daemon, provided for testing purposes",
- (gptr*) &_no_daemon, (gptr*) &_no_daemon, 0,
+ (uchar**) &_no_daemon, (uchar**) &_no_daemon, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "foreground", OPT_FOREGROUND,
"Run real ndbd in foreground, provided for debugging purposes"
" (implies --nodaemon)",
- (gptr*) &_foreground, (gptr*) &_foreground, 0,
+ (uchar**) &_foreground, (uchar**) &_foreground, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "nowait-nodes", OPT_NOWAIT_NODES,
"Nodes that will not be waited for during start",
- (gptr*) &_nowait_nodes, (gptr*) &_nowait_nodes, 0,
+ (uchar**) &_nowait_nodes, (uchar**) &_nowait_nodes, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "initial-start", OPT_INITIAL_START,
"Perform initial start",
- (gptr*) &_initialstart, (gptr*) &_initialstart, 0,
+ (uchar**) &_initialstart, (uchar**) &_initialstart, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "bind-address", OPT_NOWAIT_NODES,
"Local bind address",
- (gptr*) &_bind_address, (gptr*) &_bind_address, 0,
+ (uchar**) &_bind_address, (uchar**) &_bind_address, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/src/mgmclient/main.cpp b/storage/ndb/src/mgmclient/main.cpp
index 44408362f09..d0c117f20d3 100644
--- a/storage/ndb/src/mgmclient/main.cpp
+++ b/storage/ndb/src/mgmclient/main.cpp
@@ -71,11 +71,11 @@ static struct my_option my_long_options[] =
NDB_STD_OPTS("ndb_mgm"),
{ "execute", 'e',
"execute command and exit",
- (gptr*) &opt_execute_str, (gptr*) &opt_execute_str, 0,
+ (uchar**) &opt_execute_str, (uchar**) &opt_execute_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "try-reconnect", 't',
"Specify number of tries for connecting to ndb_mgmd (0 = infinite)",
- (gptr*) &_try_reconnect, (gptr*) &_try_reconnect, 0,
+ (uchar**) &_try_reconnect, (uchar**) &_try_reconnect, 0,
GET_UINT, REQUIRED_ARG, 3, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
index 94768e6ae52..5c25d8f4f80 100644
--- a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
+++ b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
@@ -780,19 +780,19 @@ InitConfigFileParser::parse_mycnf()
const ConfigInfo::ParamInfo& param = ConfigInfo::m_ParamInfo[i];
switch(param._type){
case ConfigInfo::CI_BOOL:
- opt.value = (gptr*)malloc(sizeof(int));
+ opt.value = (uchar **)malloc(sizeof(int));
opt.var_type = GET_INT;
break;
case ConfigInfo::CI_INT:
- opt.value = (gptr*)malloc(sizeof(int));
+ opt.value = (uchar**)malloc(sizeof(int));
opt.var_type = GET_INT;
break;
case ConfigInfo::CI_INT64:
- opt.value = (gptr*)malloc(sizeof(Int64));
+ opt.value = (uchar**)malloc(sizeof(Int64));
opt.var_type = GET_LL;
break;
case ConfigInfo::CI_STRING:
- opt.value = (gptr*)malloc(sizeof(char *));
+ opt.value = (uchar**)malloc(sizeof(char *));
opt.var_type = GET_STR;
break;
default:
@@ -818,28 +818,28 @@ InitConfigFileParser::parse_mycnf()
bzero(&opt, sizeof(opt));
opt.name = "ndbd";
opt.id = 256;
- opt.value = (gptr*)malloc(sizeof(char*));
+ opt.value = (uchar**)malloc(sizeof(char*));
opt.var_type = GET_STR;
opt.arg_type = REQUIRED_ARG;
options.push_back(opt);
opt.name = "ndb_mgmd";
opt.id = 256;
- opt.value = (gptr*)malloc(sizeof(char*));
+ opt.value = (uchar**)malloc(sizeof(char*));
opt.var_type = GET_STR;
opt.arg_type = REQUIRED_ARG;
options.push_back(opt);
opt.name = "mysqld";
opt.id = 256;
- opt.value = (gptr*)malloc(sizeof(char*));
+ opt.value = (uchar**)malloc(sizeof(char*));
opt.var_type = GET_STR;
opt.arg_type = REQUIRED_ARG;
options.push_back(opt);
opt.name = "ndbapi";
opt.id = 256;
- opt.value = (gptr*)malloc(sizeof(char*));
+ opt.value = (uchar**)malloc(sizeof(char*));
opt.var_type = GET_STR;
opt.arg_type = REQUIRED_ARG;
options.push_back(opt);
@@ -947,23 +947,3 @@ end:
}
template class Vector<struct my_option>;
-
-#if 0
-struct my_option
-{
- const char *name; /* Name of the option */
- int id; /* unique id or short option */
- const char *comment; /* option comment, for autom. --help */
- gptr *value; /* The variable value */
- gptr *u_max_value; /* The user def. max variable value */
- const char **str_values; /* Pointer to possible values */
- ulong var_type;
- enum get_opt_arg_type arg_type;
- longlong def_value; /* Default value */
- longlong min_value; /* Min allowed value */
- longlong max_value; /* Max allowed value */
- longlong sub_size; /* Subtract this from given value */
- long block_size; /* Value should be a mult. of this */
- int app_type; /* To be used by an application */
-};
-#endif
diff --git a/storage/ndb/src/mgmsrv/main.cpp b/storage/ndb/src/mgmsrv/main.cpp
index b880657d89b..16c560868ef 100644
--- a/storage/ndb/src/mgmsrv/main.cpp
+++ b/storage/ndb/src/mgmsrv/main.cpp
@@ -142,29 +142,29 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_mgmd"),
{ "config-file", 'f', "Specify cluster configuration file",
- (gptr*) &opt_config_filename, (gptr*) &opt_config_filename, 0,
+ (uchar**) &opt_config_filename, (uchar**) &opt_config_filename, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "print-full-config", 'P', "Print full config and exit",
- (gptr*) &g_print_full_config, (gptr*) &g_print_full_config, 0,
+ (uchar**) &g_print_full_config, (uchar**) &g_print_full_config, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "daemon", 'd', "Run ndb_mgmd in daemon mode (default)",
- (gptr*) &opt_daemon, (gptr*) &opt_daemon, 0,
+ (uchar**) &opt_daemon, (uchar**) &opt_daemon, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
{ "interactive", OPT_INTERACTIVE,
"Run interactive. Not supported but provided for testing purposes",
- (gptr*) &opt_interactive, (gptr*) &opt_interactive, 0,
+ (uchar**) &opt_interactive, (uchar**) &opt_interactive, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "no-nodeid-checks", OPT_NO_NODEID_CHECKS,
"Do not provide any node id checks",
- (gptr*) &g_no_nodeid_checks, (gptr*) &g_no_nodeid_checks, 0,
+ (uchar**) &g_no_nodeid_checks, (uchar**) &g_no_nodeid_checks, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "nodaemon", OPT_NO_DAEMON,
"Don't run as daemon, but don't read from stdin",
- (gptr*) &opt_non_interactive, (gptr*) &opt_non_interactive, 0,
+ (uchar**) &opt_non_interactive, (uchar**) &opt_non_interactive, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "mycnf", 256,
"Read cluster config from my.cnf",
- (gptr*) &opt_mycnf, (gptr*) &opt_mycnf, 0,
+ (uchar**) &opt_mycnf, (uchar**) &opt_mycnf, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/src/ndbapi/NdbBlob.cpp b/storage/ndb/src/ndbapi/NdbBlob.cpp
index 25dcafdef53..e651a4c70b0 100644
--- a/storage/ndb/src/ndbapi/NdbBlob.cpp
+++ b/storage/ndb/src/ndbapi/NdbBlob.cpp
@@ -536,7 +536,7 @@ int
NdbBlob::setTableKeyValue(NdbOperation* anOp)
{
DBUG_ENTER("NdbBlob::setTableKeyValue");
- DBUG_DUMP("info", theKeyBuf.data, 4 * theTable->m_keyLenInWords);
+ DBUG_DUMP("info", (uchar*) theKeyBuf.data, 4 * theTable->m_keyLenInWords);
const Uint32* data = (const Uint32*)theKeyBuf.data;
const unsigned columns = theTable->m_columns.size();
unsigned pos = 0;
@@ -562,7 +562,8 @@ int
NdbBlob::setAccessKeyValue(NdbOperation* anOp)
{
DBUG_ENTER("NdbBlob::setAccessKeyValue");
- DBUG_DUMP("info", theAccessKeyBuf.data, 4 * theAccessTable->m_keyLenInWords);
+ DBUG_DUMP("info", (uchar*) theAccessKeyBuf.data,
+ 4 * theAccessTable->m_keyLenInWords);
const Uint32* data = (const Uint32*)theAccessKeyBuf.data;
const unsigned columns = theAccessTable->m_columns.size();
unsigned pos = 0;
@@ -587,7 +588,7 @@ NdbBlob::setPartKeyValue(NdbOperation* anOp, Uint32 part)
{
DBUG_ENTER("NdbBlob::setPartKeyValue");
DBUG_PRINT("info", ("dist=%u part=%u packkey=", getDistKey(part), part));
- DBUG_DUMP("info", thePackKeyBuf.data, 4 * thePackKeyBuf.size);
+ DBUG_DUMP("info", (uchar*) thePackKeyBuf.data, 4 * thePackKeyBuf.size);
// TODO use attr ids after compatibility with 4.1.7 not needed
if (anOp->equal("PK", thePackKeyBuf.data) == -1 ||
anOp->equal("DIST", getDistKey(part)) == -1 ||
diff --git a/storage/ndb/src/ndbapi/NdbOperationDefine.cpp b/storage/ndb/src/ndbapi/NdbOperationDefine.cpp
index ced9b18bd55..c9459ff911c 100644
--- a/storage/ndb/src/ndbapi/NdbOperationDefine.cpp
+++ b/storage/ndb/src/ndbapi/NdbOperationDefine.cpp
@@ -608,7 +608,6 @@ NdbOperation::setAnyValue(Uint32 any_value)
const NdbColumnImpl* impl =
&NdbColumnImpl::getImpl(* NdbDictionary::Column::ANY_VALUE);
OperationType tOpType = theOperationType;
- OperationStatus tStatus = theStatus;
switch(tOpType){
case DeleteRequest:{
diff --git a/storage/ndb/src/ndbapi/NdbOperationInt.cpp b/storage/ndb/src/ndbapi/NdbOperationInt.cpp
index 0df1dbfe2c8..f69211cb78b 100644
--- a/storage/ndb/src/ndbapi/NdbOperationInt.cpp
+++ b/storage/ndb/src/ndbapi/NdbOperationInt.cpp
@@ -1023,7 +1023,7 @@ NdbOperation::branch_col(Uint32 type,
DBUG_PRINT("enter", ("type: %u col:%u val: 0x%lx len: %u label: %u",
type, ColId, (long) val, len, Label));
if (val != NULL)
- DBUG_DUMP("value", (char*)val, len);
+ DBUG_DUMP("value", (uchar*)val, len);
if (initial_interpreterCheck() == -1)
DBUG_RETURN(-1);
diff --git a/storage/ndb/src/ndbapi/NdbScanOperation.cpp b/storage/ndb/src/ndbapi/NdbScanOperation.cpp
index dc9a74ae11c..fa94bf8d836 100644
--- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp
+++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp
@@ -1311,7 +1311,7 @@ NdbIndexScanOperation::getKeyFromSCANTABREQ(Uint32* data, Uint32 size)
}
pos += rem;
}
- DBUG_DUMP("key", (char*)data, size << 2);
+ DBUG_DUMP("key", (uchar*) data, size << 2);
DBUG_RETURN(size);
}
diff --git a/storage/ndb/tools/delete_all.cpp b/storage/ndb/tools/delete_all.cpp
index 4e3037f1941..1bf89f5a32f 100644
--- a/storage/ndb/tools/delete_all.cpp
+++ b/storage/ndb/tools/delete_all.cpp
@@ -36,16 +36,16 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_desc"),
{ "database", 'd', "Name of database table is in",
- (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ (uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "transactional", 't', "Single transaction (may run out of operations)",
- (gptr*) &_transactional, (gptr*) &_transactional, 0,
+ (uchar**) &_transactional, (uchar**) &_transactional, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "tupscan", 999, "Run tupscan",
- (gptr*) &_tupscan, (gptr*) &_tupscan, 0,
+ (uchar**) &_tupscan, (uchar**) &_tupscan, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "diskscan", 999, "Run diskcan",
- (gptr*) &_diskscan, (gptr*) &_diskscan, 0,
+ (uchar**) &_diskscan, (uchar**) &_diskscan, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/desc.cpp b/storage/ndb/tools/desc.cpp
index 9eb0cf67ceb..831005139de 100644
--- a/storage/ndb/tools/desc.cpp
+++ b/storage/ndb/tools/desc.cpp
@@ -39,16 +39,16 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_desc"),
{ "database", 'd', "Name of database table is in",
- (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ (uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "unqualified", 'u', "Use unqualified table names",
- (gptr*) &_unqualified, (gptr*) &_unqualified, 0,
+ (uchar**) &_unqualified, (uchar**) &_unqualified, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "extra-partition-info", 'p', "Print more info per partition",
- (gptr*) &_partinfo, (gptr*) &_partinfo, 0,
+ (uchar**) &_partinfo, (uchar**) &_partinfo, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "retries", 'r', "Retry every second for # retries",
- (gptr*) &_retries, (gptr*) &_retries, 0,
+ (uchar**) &_retries, (uchar**) &_retries, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/drop_index.cpp b/storage/ndb/tools/drop_index.cpp
index 256c40e1924..ec88f331a80 100644
--- a/storage/ndb/tools/drop_index.cpp
+++ b/storage/ndb/tools/drop_index.cpp
@@ -30,7 +30,7 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_desc"),
{ "database", 'd', "Name of database table is in",
- (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ (uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/drop_tab.cpp b/storage/ndb/tools/drop_tab.cpp
index a7accb904a4..8d07afbbf50 100644
--- a/storage/ndb/tools/drop_tab.cpp
+++ b/storage/ndb/tools/drop_tab.cpp
@@ -30,7 +30,7 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_desc"),
{ "database", 'd', "Name of database table is in",
- (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ (uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/listTables.cpp b/storage/ndb/tools/listTables.cpp
index 6a73bcc54f5..45129cb34af 100644
--- a/storage/ndb/tools/listTables.cpp
+++ b/storage/ndb/tools/listTables.cpp
@@ -256,22 +256,22 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_show_tables"),
{ "database", 'd', "Name of database table is in",
- (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ (uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "loops", 'l', "loops",
- (gptr*) &_loops, (gptr*) &_loops, 0,
+ (uchar**) &_loops, (uchar**) &_loops, 0,
GET_INT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0 },
{ "type", 't', "type",
- (gptr*) &_type, (gptr*) &_type, 0,
+ (uchar**) &_type, (uchar**) &_type, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "unqualified", 'u', "Use unqualified table names",
- (gptr*) &_unqualified, (gptr*) &_unqualified, 0,
+ (uchar**) &_unqualified, (uchar**) &_unqualified, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "parsable", 'p', "Return output suitable for mysql LOAD DATA INFILE",
- (gptr*) &_parsable, (gptr*) &_parsable, 0,
+ (uchar**) &_parsable, (uchar**) &_parsable, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "show-temp-status", OPT_SHOW_TMP_STATUS, "Show table temporary flag",
- (gptr*) &show_temp_status, (gptr*) &show_temp_status, 0,
+ (uchar**) &show_temp_status, (uchar**) &show_temp_status, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/ndb_config.cpp b/storage/ndb/tools/ndb_config.cpp
index 31fc59a8b83..af36103f947 100644
--- a/storage/ndb/tools/ndb_config.cpp
+++ b/storage/ndb/tools/ndb_config.cpp
@@ -58,37 +58,37 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_config"),
{ "nodes", 256, "Print nodes",
- (gptr*) &g_nodes, (gptr*) &g_nodes,
+ (uchar**) &g_nodes, (uchar**) &g_nodes,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ "connections", 256, "Print connections",
- (gptr*) &g_connections, (gptr*) &g_connections,
+ (uchar**) &g_connections, (uchar**) &g_connections,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ "query", 'q', "Query option(s)",
- (gptr*) &g_query, (gptr*) &g_query,
+ (uchar**) &g_query, (uchar**) &g_query,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "host", 256, "Host",
- (gptr*) &g_host, (gptr*) &g_host,
+ (uchar**) &g_host, (uchar**) &g_host,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "type", 258, "Type of node/connection",
- (gptr*) &g_type, (gptr*) &g_type,
+ (uchar**) &g_type, (uchar**) &g_type,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "id", 258, "Nodeid",
- (gptr*) &g_nodeid, (gptr*) &g_nodeid,
+ (uchar**) &g_nodeid, (uchar**) &g_nodeid,
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "nodeid", 258, "Nodeid",
- (gptr*) &g_nodeid, (gptr*) &g_nodeid,
+ (uchar**) &g_nodeid, (uchar**) &g_nodeid,
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "fields", 'f', "Field separator",
- (gptr*) &g_field_delimiter, (gptr*) &g_field_delimiter,
+ (uchar**) &g_field_delimiter, (uchar**) &g_field_delimiter,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "rows", 'r', "Row separator",
- (gptr*) &g_row_delimiter, (gptr*) &g_row_delimiter,
+ (uchar**) &g_row_delimiter, (uchar**) &g_row_delimiter,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "config-file", 256, "Path to config.ini",
- (gptr*) &g_config_file, (gptr*) &g_config_file,
+ (uchar**) &g_config_file, (uchar**) &g_config_file,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "mycnf", 256, "Read config from my.cnf",
- (gptr*) &g_mycnf, (gptr*) &g_mycnf,
+ (uchar**) &g_mycnf, (uchar**) &g_mycnf,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/restore/consumer_restore.cpp b/storage/ndb/tools/restore/consumer_restore.cpp
index 3dd4b072671..9b087a48ef4 100644
--- a/storage/ndb/tools/restore/consumer_restore.cpp
+++ b/storage/ndb/tools/restore/consumer_restore.cpp
@@ -424,13 +424,14 @@ error:
bool BackupRestore::translate_frm(NdbDictionary::Table *table)
{
- const void *pack_data, *data, *new_pack_data;
+ uchar *pack_data, *data, *new_pack_data;
char *new_data;
- uint data_len, new_data_len, new_pack_len;
+ uint new_data_len;
+ size_t data_len, new_pack_len;
uint no_parts, extra_growth;
DBUG_ENTER("translate_frm");
- pack_data = table->getFrmData();
+ pack_data = (uchar*) table->getFrmData();
no_parts = table->getFragmentCount();
/*
Add max 4 characters per partition to handle worst case
@@ -442,7 +443,7 @@ bool BackupRestore::translate_frm(NdbDictionary::Table *table)
{
DBUG_RETURN(TRUE);
}
- if ((new_data = my_malloc(data_len + extra_growth, MYF(0))))
+ if ((new_data = (char*) my_malloc(data_len + extra_growth, MYF(0))))
{
DBUG_RETURN(TRUE);
}
@@ -451,7 +452,7 @@ bool BackupRestore::translate_frm(NdbDictionary::Table *table)
my_free(new_data, MYF(0));
DBUG_RETURN(TRUE);
}
- if (packfrm((const void*)new_data, new_data_len,
+ if (packfrm((uchar*) new_data, new_data_len,
&new_pack_data, &new_pack_len))
{
my_free(new_data, MYF(0));
diff --git a/storage/ndb/tools/restore/restore_main.cpp b/storage/ndb/tools/restore/restore_main.cpp
index adccd024d88..4752f019a08 100644
--- a/storage/ndb/tools/restore/restore_main.cpp
+++ b/storage/ndb/tools/restore/restore_main.cpp
@@ -99,95 +99,95 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_restore"),
{ "connect", 'c', "same as --connect-string",
- (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0,
+ (uchar**) &opt_connect_str, (uchar**) &opt_connect_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "nodeid", 'n', "Backup files from node with id",
- (gptr*) &ga_nodeId, (gptr*) &ga_nodeId, 0,
+ (uchar**) &ga_nodeId, (uchar**) &ga_nodeId, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "backupid", 'b', "Backup id",
- (gptr*) &ga_backupId, (gptr*) &ga_backupId, 0,
+ (uchar**) &ga_backupId, (uchar**) &ga_backupId, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "restore_data", 'r',
"Restore table data/logs into NDB Cluster using NDBAPI",
- (gptr*) &_restore_data, (gptr*) &_restore_data, 0,
+ (uchar**) &_restore_data, (uchar**) &_restore_data, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "restore_meta", 'm',
"Restore meta data into NDB Cluster using NDBAPI",
- (gptr*) &_restore_meta, (gptr*) &_restore_meta, 0,
+ (uchar**) &_restore_meta, (uchar**) &_restore_meta, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "no-restore-disk-objects", 'd',
"Dont restore disk objects (tablespace/logfilegroups etc)",
- (gptr*) &_no_restore_disk, (gptr*) &_no_restore_disk, 0,
+ (uchar**) &_no_restore_disk, (uchar**) &_no_restore_disk, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "restore_epoch", 'e',
"Restore epoch info into the status table. Convenient on a MySQL Cluster "
"replication slave, for starting replication. The row in "
NDB_REP_DB "." NDB_APPLY_TABLE " with id 0 will be updated/inserted.",
- (gptr*) &ga_restore_epoch, (gptr*) &ga_restore_epoch, 0,
+ (uchar**) &ga_restore_epoch, (uchar**) &ga_restore_epoch, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "skip-table-check", 's', "Skip table structure check during restore of data",
- (gptr*) &ga_skip_table_check, (gptr*) &ga_skip_table_check, 0,
+ (uchar**) &ga_skip_table_check, (uchar**) &ga_skip_table_check, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "parallelism", 'p',
"No of parallel transactions during restore of data."
"(parallelism can be 1 to 1024)",
- (gptr*) &ga_nParallelism, (gptr*) &ga_nParallelism, 0,
+ (uchar**) &ga_nParallelism, (uchar**) &ga_nParallelism, 0,
GET_INT, REQUIRED_ARG, 128, 1, 1024, 0, 1, 0 },
{ "print", OPT_PRINT, "Print data and log to stdout",
- (gptr*) &_print, (gptr*) &_print, 0,
+ (uchar**) &_print, (uchar**) &_print, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "print_data", OPT_PRINT_DATA, "Print data to stdout",
- (gptr*) &_print_data, (gptr*) &_print_data, 0,
+ (uchar**) &_print_data, (uchar**) &_print_data, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "print_meta", OPT_PRINT_META, "Print meta data to stdout",
- (gptr*) &_print_meta, (gptr*) &_print_meta, 0,
+ (uchar**) &_print_meta, (uchar**) &_print_meta, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "print_log", OPT_PRINT_LOG, "Print log to stdout",
- (gptr*) &_print_log, (gptr*) &_print_log, 0,
+ (uchar**) &_print_log, (uchar**) &_print_log, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "backup_path", OPT_BACKUP_PATH, "Path to backup files",
- (gptr*) &ga_backupPath, (gptr*) &ga_backupPath, 0,
+ (uchar**) &ga_backupPath, (uchar**) &ga_backupPath, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "dont_ignore_systab_0", 'f',
"Experimental. Do not ignore system table during restore.",
- (gptr*) &ga_dont_ignore_systab_0, (gptr*) &ga_dont_ignore_systab_0, 0,
+ (uchar**) &ga_dont_ignore_systab_0, (uchar**) &ga_dont_ignore_systab_0, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "ndb-nodegroup-map", OPT_NDB_NODEGROUP_MAP,
"Nodegroup map for ndbcluster. Syntax: list of (source_ng, dest_ng)",
- (gptr*) &opt_nodegroup_map_str,
- (gptr*) &opt_nodegroup_map_str,
+ (uchar**) &opt_nodegroup_map_str,
+ (uchar**) &opt_nodegroup_map_str,
0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "fields-enclosed-by", OPT_FIELDS_ENCLOSED_BY,
"Fields are enclosed by ...",
- (gptr*) &opt_fields_enclosed_by, (gptr*) &opt_fields_enclosed_by, 0,
+ (uchar**) &opt_fields_enclosed_by, (uchar**) &opt_fields_enclosed_by, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "fields-terminated-by", OPT_FIELDS_TERMINATED_BY,
"Fields are terminated by ...",
- (gptr*) &opt_fields_terminated_by,
- (gptr*) &opt_fields_terminated_by, 0,
+ (uchar**) &opt_fields_terminated_by,
+ (uchar**) &opt_fields_terminated_by, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "fields-optionally-enclosed-by", OPT_FIELDS_OPTIONALLY_ENCLOSED_BY,
"Fields are optionally enclosed by ...",
- (gptr*) &opt_fields_optionally_enclosed_by,
- (gptr*) &opt_fields_optionally_enclosed_by, 0,
+ (uchar**) &opt_fields_optionally_enclosed_by,
+ (uchar**) &opt_fields_optionally_enclosed_by, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "hex", OPT_HEX_FORMAT, "print binary types in hex format",
- (gptr*) &opt_hex_format, (gptr*) &opt_hex_format, 0,
+ (uchar**) &opt_hex_format, (uchar**) &opt_hex_format, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "tab", 'T', "Creates tab separated textfile for each table to "
"given path. (creates .txt files)",
- (gptr*) &tab_path, (gptr*) &tab_path, 0,
+ (uchar**) &tab_path, (uchar**) &tab_path, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "append", OPT_APPEND, "for --tab append data to file",
- (gptr*) &opt_append, (gptr*) &opt_append, 0,
+ (uchar**) &opt_append, (uchar**) &opt_append, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "lines-terminated-by", OPT_LINES_TERMINATED_BY, "",
- (gptr*) &opt_lines_terminated_by, (gptr*) &opt_lines_terminated_by, 0,
+ (uchar**) &opt_lines_terminated_by, (uchar**) &opt_lines_terminated_by, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "verbose", OPT_VERBOSE,
"verbosity",
- (gptr*) &opt_verbose, (gptr*) &opt_verbose, 0,
+ (uchar**) &opt_verbose, (uchar**) &opt_verbose, 0,
GET_INT, REQUIRED_ARG, 1, 0, 255, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/select_all.cpp b/storage/ndb/tools/select_all.cpp
index e2072f30edf..23d5f95f3f7 100644
--- a/storage/ndb/tools/select_all.cpp
+++ b/storage/ndb/tools/select_all.cpp
@@ -54,43 +54,43 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_desc"),
{ "database", 'd', "Name of database table is in",
- (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ (uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "parallelism", 'p', "parallelism",
- (gptr*) &_parallelism, (gptr*) &_parallelism, 0,
+ (uchar**) &_parallelism, (uchar**) &_parallelism, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "lock", 'l', "Read(0), Read-hold(1), Exclusive(2)",
- (gptr*) &_lock, (gptr*) &_lock, 0,
+ (uchar**) &_lock, (uchar**) &_lock, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "order", 'o', "Sort resultset according to index",
- (gptr*) &_order, (gptr*) &_order, 0,
+ (uchar**) &_order, (uchar**) &_order, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "descending", 'z', "Sort descending (requires order flag)",
- (gptr*) &_descending, (gptr*) &_descending, 0,
+ (uchar**) &_descending, (uchar**) &_descending, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "header", 'h', "Print header",
- (gptr*) &_header, (gptr*) &_header, 0,
+ (uchar**) &_header, (uchar**) &_header, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
{ "useHexFormat", 'x', "Output numbers in hexadecimal format",
- (gptr*) &_useHexFormat, (gptr*) &_useHexFormat, 0,
+ (uchar**) &_useHexFormat, (uchar**) &_useHexFormat, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "delimiter", 'D', "Column delimiter",
- (gptr*) &_delimiter, (gptr*) &_delimiter, 0,
+ (uchar**) &_delimiter, (uchar**) &_delimiter, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "disk", 256, "Dump disk ref",
- (gptr*) &_dumpDisk, (gptr*) &_dumpDisk, 0,
+ (uchar**) &_dumpDisk, (uchar**) &_dumpDisk, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "rowid", 256, "Dump rowid",
- (gptr*) &use_rowid, (gptr*) &use_rowid, 0,
+ (uchar**) &use_rowid, (uchar**) &use_rowid, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "gci", 256, "Dump gci",
- (gptr*) &use_gci, (gptr*) &use_gci, 0,
+ (uchar**) &use_gci, (uchar**) &use_gci, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "tupscan", 't', "Scan in tup order",
- (gptr*) &_tup, (gptr*) &_tup, 0,
+ (uchar**) &_tup, (uchar**) &_tup, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "nodata", 256, "Dont print data",
- (gptr*) &nodata, (gptr*) &nodata, 0,
+ (uchar**) &nodata, (uchar**) &nodata, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/select_count.cpp b/storage/ndb/tools/select_count.cpp
index 552d156b665..73982e886b5 100644
--- a/storage/ndb/tools/select_count.cpp
+++ b/storage/ndb/tools/select_count.cpp
@@ -43,13 +43,13 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_desc"),
{ "database", 'd', "Name of database table is in",
- (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ (uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "parallelism", 'p', "parallelism",
- (gptr*) &_parallelism, (gptr*) &_parallelism, 0,
+ (uchar**) &_parallelism, (uchar**) &_parallelism, 0,
GET_INT, REQUIRED_ARG, 240, 0, 0, 0, 0, 0 },
{ "lock", 'l', "Read(0), Read-hold(1), Exclusive(2)",
- (gptr*) &_lock, (gptr*) &_lock, 0,
+ (uchar**) &_lock, (uchar**) &_lock, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/ndb/tools/waiter.cpp b/storage/ndb/tools/waiter.cpp
index de8d15ac17a..a292ab9140a 100644
--- a/storage/ndb/tools/waiter.cpp
+++ b/storage/ndb/tools/waiter.cpp
@@ -46,17 +46,17 @@ static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_desc"),
{ "no-contact", 'n', "Wait for cluster no contact",
- (gptr*) &_no_contact, (gptr*) &_no_contact, 0,
+ (uchar**) &_no_contact, (uchar**) &_no_contact, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "not-started", OPT_WAIT_STATUS_NOT_STARTED, "Wait for cluster not started",
- (gptr*) &_not_started, (gptr*) &_not_started, 0,
+ (uchar**) &_not_started, (uchar**) &_not_started, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "single-user", OPT_WAIT_STATUS_SINGLE_USER,
"Wait for cluster to enter single user mode",
- (gptr*) &_single_user, (gptr*) &_single_user, 0,
+ (uchar**) &_single_user, (uchar**) &_single_user, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "timeout", 't', "Timeout to wait",
- (gptr*) &_timeout, (gptr*) &_timeout, 0,
+ (uchar**) &_timeout, (uchar**) &_timeout, 0,
GET_INT, REQUIRED_ARG, 120, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
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)
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 0b3007dba06..b390d683bf2 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -13715,7 +13715,7 @@ static void test_bug11111()
for (i=0; i < 2; i++)
{
my_bind[i].buffer_type= MYSQL_TYPE_STRING;
- my_bind[i].buffer= (gptr *)&buf[i];
+ my_bind[i].buffer= (uchar* *)&buf[i];
my_bind[i].buffer_length= 20;
my_bind[i].length= &len[i];
}
@@ -14100,7 +14100,7 @@ static void test_bug11656()
for (i=0; i < 2; i++)
{
my_bind[i].buffer_type= MYSQL_TYPE_STRING;
- my_bind[i].buffer= (gptr *)&buf[i];
+ my_bind[i].buffer= (uchar* *)&buf[i];
my_bind[i].buffer_length= strlen(buf[i]);
}
mysql_stmt_bind_param(stmt, my_bind);
@@ -16082,23 +16082,23 @@ static char **defaults_argv;
static struct my_option client_test_long_options[] =
{
- {"basedir", 'b', "Basedir for tests.", (gptr*) &opt_basedir,
- (gptr*) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"count", 't', "Number of times test to be executed", (char **) &opt_count,
- (char **) &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
- {"database", 'D', "Database to use", (char **) &opt_db, (char **) &opt_db,
+ {"basedir", 'b', "Basedir for tests.", (uchar**) &opt_basedir,
+ (uchar**) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"count", 't', "Number of times test to be executed", (uchar **) &opt_count,
+ (uchar **) &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
+ {"database", 'D', "Database to use", (uchar **) &opt_db, (uchar **) &opt_db,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
- (gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
+ (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host", (char **) &opt_host, (char **) &opt_host,
+ {"host", 'h', "Connect to host", (uchar **) &opt_host, (uchar **) &opt_host,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"port", 'P', "Port number to use for connection", (char **) &opt_port,
- (char **) &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"port", 'P', "Port number to use for connection", (uchar **) &opt_port,
+ (uchar **) &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-arg", 'A', "Send embedded server this as a parameter.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"show-tests", 'T', "Show all tests' names", 0, 0, 0, GET_NO_ARG, NO_ARG,
@@ -16106,19 +16106,19 @@ static struct my_option client_test_long_options[] =
{"silent", 's', "Be more silent", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0,
0},
{"socket", 'S', "Socket file to use for connection",
- (char **) &opt_unix_socket, (char **) &opt_unix_socket, 0, GET_STR,
+ (uchar **) &opt_unix_socket, (uchar **) &opt_unix_socket, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"testcase", 'c',
"May disable some code when runs as mysql-test-run testcase.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user", (char **) &opt_user,
- (char **) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user", (uchar **) &opt_user,
+ (uchar **) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"vardir", 'v', "Data dir for tests.", (gptr*) &opt_vardir,
- (gptr*) &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"vardir", 'v', "Data dir for tests.", (uchar**) &opt_vardir,
+ (uchar**) &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"getopt-ll-test", 'g', "Option for testing bug in getopt library",
- (char **) &opt_getopt_ll_test, (char **) &opt_getopt_ll_test, 0,
+ (uchar **) &opt_getopt_ll_test, (uchar **) &opt_getopt_ll_test, 0,
GET_LL, REQUIRED_ARG, 0, 0, LONGLONG_MAX, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/tests/thread_test.c b/tests/thread_test.c
index 0ad446282c2..b3a34447271 100644
--- a/tests/thread_test.c
+++ b/tests/thread_test.c
@@ -88,30 +88,30 @@ static struct my_option my_long_options[] =
{
{"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
- {"database", 'D', "Database to use", (gptr*) &database, (gptr*) &database,
+ {"database", 'D', "Database to use", (uchar**) &database, (uchar**) &database,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host", (gptr*) &host, (gptr*) &host, 0, GET_STR,
+ {"host", 'h', "Connect to host", (uchar**) &host, (uchar**) &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"user", 'u', "User for login if not current user", (gptr*) &user,
- (gptr*) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user", (uchar**) &user,
+ (uchar**) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"verbose", 'v', "Write some progress indicators", (gptr*) &verbose,
- (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"query", 'Q', "Query to execute in each threads", (gptr*) &query,
- (gptr*) &query, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"port", 'P', "Port number to use for connection", (gptr*) &tcp_port,
- (gptr*) &tcp_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0},
- {"socket", 'S', "Socket file to use for connection", (gptr*) &unix_socket,
- (gptr*) &unix_socket, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"verbose", 'v', "Write some progress indicators", (uchar**) &verbose,
+ (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"query", 'Q', "Query to execute in each threads", (uchar**) &query,
+ (uchar**) &query, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"port", 'P', "Port number to use for connection", (uchar**) &tcp_port,
+ (uchar**) &tcp_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0},
+ {"socket", 'S', "Socket file to use for connection", (uchar**) &unix_socket,
+ (uchar**) &unix_socket, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"test-count", 'c', "Run test count times (default %d)",
- (gptr*) &number_of_tests, (gptr*) &number_of_tests, 0, GET_UINT,
+ (uchar**) &number_of_tests, (uchar**) &number_of_tests, 0, GET_UINT,
REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
{"thread-count", 't', "Number of threads to start",
- (gptr*) &number_of_threads, (gptr*) &number_of_threads, 0, GET_UINT,
+ (uchar**) &number_of_threads, (uchar**) &number_of_threads, 0, GET_UINT,
REQUIRED_ARG, 2, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/vio/test-ssl.c b/vio/test-ssl.c
index 76833e25949..855dc5fbb3e 100644
--- a/vio/test-ssl.c
+++ b/vio/test-ssl.c
@@ -106,8 +106,8 @@ main(int argc, char** argv)
child_pid = fork();
if (child_pid==-1) {
- my_free((gptr)ssl_acceptor,MYF(0));
- my_free((gptr)ssl_connector,MYF(0));
+ my_free((uchar*)ssl_acceptor,MYF(0));
+ my_free((uchar*)ssl_connector,MYF(0));
fatal_error("fork");
}
if (child_pid==0)
@@ -116,28 +116,28 @@ main(int argc, char** argv)
char xbuf[100];
int r = vio_read(client_vio,xbuf, sizeof(xbuf));
if (r<=0) {
- my_free((gptr)ssl_acceptor,MYF(0));
- my_free((gptr)ssl_connector,MYF(0));
+ my_free((uchar*)ssl_acceptor,MYF(0));
+ my_free((uchar*)ssl_connector,MYF(0));
fatal_error("client:SSL_read");
}
xbuf[r] = 0;
printf("client:got %s\n", xbuf);
- my_free((gptr)client_vio,MYF(0));
- my_free((gptr)ssl_acceptor,MYF(0));
- my_free((gptr)ssl_connector,MYF(0));
+ my_free((uchar*)client_vio,MYF(0));
+ my_free((uchar*)ssl_acceptor,MYF(0));
+ my_free((uchar*)ssl_connector,MYF(0));
}
else
{
const char* s = "Huhuhuh";
- int r = vio_write(server_vio,(gptr)s, strlen(s));
+ int r = vio_write(server_vio,(uchar*)s, strlen(s));
if (r<=0) {
- my_free((gptr)ssl_acceptor,MYF(0));
- my_free((gptr)ssl_connector,MYF(0));
+ my_free((uchar*)ssl_acceptor,MYF(0));
+ my_free((uchar*)ssl_connector,MYF(0));
fatal_error("server:SSL_write");
}
- my_free((gptr)server_vio,MYF(0));
- my_free((gptr)ssl_acceptor,MYF(0));
- my_free((gptr)ssl_connector,MYF(0));
+ my_free((uchar*)server_vio,MYF(0));
+ my_free((uchar*)ssl_acceptor,MYF(0));
+ my_free((uchar*)ssl_connector,MYF(0));
}
return 0;
}
diff --git a/vio/test-sslclient.c b/vio/test-sslclient.c
index c8e14721375..e1b8461397b 100644
--- a/vio/test-sslclient.c
+++ b/vio/test-sslclient.c
@@ -84,13 +84,13 @@ main( int argc __attribute__((unused)),
sslconnect(ssl_connector,client_vio,60L);
err = vio_read(client_vio,xbuf, sizeof(xbuf));
if (err<=0) {
- my_free((gptr)ssl_connector,MYF(0));
+ my_free((uchar*)ssl_connector,MYF(0));
fatal_error("client:SSL_read");
}
xbuf[err] = 0;
printf("client:got %s\n", xbuf);
- my_free((gptr)client_vio,MYF(0));
- my_free((gptr)ssl_connector,MYF(0));
+ my_free((uchar*)client_vio,MYF(0));
+ my_free((uchar*)ssl_connector,MYF(0));
return 0;
}
#else /* HAVE_OPENSSL */
diff --git a/vio/test-sslserver.c b/vio/test-sslserver.c
index 59456db1fd4..f55b5bae53a 100644
--- a/vio/test-sslserver.c
+++ b/vio/test-sslserver.c
@@ -59,9 +59,9 @@ do_ssl_stuff( TH_ARGS* args)
/* ----------------------------------------------- */
/* TCP connection is ready. Do server side SSL. */
- err = write(server_vio->sd,(gptr)s, strlen(s));
+ err = write(server_vio->sd,(uchar*)s, strlen(s));
sslaccept(args->ssl_acceptor,server_vio,60L);
- err = server_vio->write(server_vio,(gptr)s, strlen(s));
+ err = server_vio->write(server_vio,(uchar*)s, strlen(s));
DBUG_VOID_RETURN;
}
@@ -139,12 +139,12 @@ main(int argc __attribute__((unused)), char** argv)
#if 0
if (err<=0) {
- my_free((gptr)ssl_acceptor,MYF(0));
+ my_free((uchar*)ssl_acceptor,MYF(0));
fatal_error("server:SSL_write");
}
#endif /* 0 */
- my_free((gptr)ssl_acceptor,MYF(0));
+ my_free((uchar*)ssl_acceptor,MYF(0));
return 0;
}
#else /* HAVE_OPENSSL */
diff --git a/vio/vio.c b/vio/vio.c
index 5db54d58a79..e088687098b 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -228,8 +228,8 @@ void vio_delete(Vio* vio)
if (vio->type != VIO_CLOSED)
vio->vioclose(vio);
- my_free((gptr) vio->read_buffer, MYF(MY_ALLOW_ZERO_PTR));
- my_free((gptr) vio,MYF(0));
+ my_free((uchar*) vio->read_buffer, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) vio,MYF(0));
}
diff --git a/vio/vio_priv.h b/vio/vio_priv.h
index 4a272e519a3..0a91c134666 100644
--- a/vio/vio_priv.h
+++ b/vio/vio_priv.h
@@ -27,8 +27,8 @@ void vio_ignore_timeout(Vio *vio, uint which, uint timeout);
#ifdef HAVE_OPENSSL
#include "my_net.h" /* needed because of struct in_addr */
-int vio_ssl_read(Vio *vio,gptr buf, int size);
-int vio_ssl_write(Vio *vio,const gptr buf,int size);
+size_t vio_ssl_read(Vio *vio,uchar* buf, size_t size);
+size_t vio_ssl_write(Vio *vio,const uchar* buf, size_t size);
/* When the workday is over... */
int vio_ssl_close(Vio *vio);
diff --git a/vio/viosocket.c b/vio/viosocket.c
index d3a479edac3..9afb1ec4bbf 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -28,12 +28,12 @@ int vio_errno(Vio *vio __attribute__((unused)))
}
-int vio_read(Vio * vio, gptr buf, int size)
+size_t vio_read(Vio * vio, uchar* buf, size_t size)
{
- int r;
+ size_t r;
DBUG_ENTER("vio_read");
- DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf,
- size));
+ DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %u", vio->sd, (long) buf,
+ (uint) size));
/* Ensure nobody uses vio_read_buff and vio_read simultaneously */
DBUG_ASSERT(vio->read_end == vio->read_pos);
@@ -44,12 +44,12 @@ int vio_read(Vio * vio, gptr buf, int size)
r = read(vio->sd, buf, size);
#endif /* __WIN__ */
#ifndef DBUG_OFF
- if (r < 0)
+ if (r == (size_t) -1)
{
DBUG_PRINT("vio_error", ("Got error %d during read",errno));
}
#endif /* DBUG_OFF */
- DBUG_PRINT("exit", ("%d", r));
+ DBUG_PRINT("exit", ("%ld", (long) r));
DBUG_RETURN(r);
}
@@ -59,17 +59,17 @@ int vio_read(Vio * vio, gptr buf, int size)
reduce number of syscalls.
*/
-int vio_read_buff(Vio *vio, gptr buf, int size)
+size_t vio_read_buff(Vio *vio, uchar* buf, size_t size)
{
- int rc;
+ size_t rc;
#define VIO_UNBUFFERED_READ_MIN_SIZE 2048
DBUG_ENTER("vio_read_buff");
- DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf,
- size));
+ DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %u", vio->sd, (long) buf,
+ (uint) size));
if (vio->read_pos < vio->read_end)
{
- rc= min(vio->read_end - vio->read_pos, size);
+ rc= min((size_t) (vio->read_end - vio->read_pos), size);
memcpy(buf, vio->read_pos, rc);
vio->read_pos+= rc;
/*
@@ -81,7 +81,7 @@ int vio_read_buff(Vio *vio, gptr buf, int size)
else if (size < VIO_UNBUFFERED_READ_MIN_SIZE)
{
rc= vio_read(vio, vio->read_buffer, VIO_READ_BUFFER_SIZE);
- if (rc > 0)
+ if (rc != 0 && rc != (size_t) -1)
{
if (rc > size)
{
@@ -99,24 +99,24 @@ int vio_read_buff(Vio *vio, gptr buf, int size)
}
-int vio_write(Vio * vio, const gptr buf, int size)
+size_t vio_write(Vio * vio, const uchar* buf, size_t size)
{
- int r;
+ size_t r;
DBUG_ENTER("vio_write");
- DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf,
- size));
+ DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %u", vio->sd, (long) buf,
+ (uint) size));
#ifdef __WIN__
r = send(vio->sd, buf, size,0);
#else
r = write(vio->sd, buf, size);
#endif /* __WIN__ */
#ifndef DBUG_OFF
- if (r < 0)
+ if (r == (size_t) -1)
{
DBUG_PRINT("vio_error", ("Got error on write: %d",socket_errno));
}
#endif /* DBUG_OFF */
- DBUG_PRINT("exit", ("%d", r));
+ DBUG_PRINT("exit", ("%u", (uint) r));
DBUG_RETURN(r);
}
@@ -405,33 +405,33 @@ void vio_timeout(Vio *vio, uint which, uint timeout)
#ifdef __WIN__
-int vio_read_pipe(Vio * vio, gptr buf, int size)
+size_t vio_read_pipe(Vio * vio, uchar* buf, size_t size)
{
DWORD length;
DBUG_ENTER("vio_read_pipe");
- DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf,
- size));
+ DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %u", vio->sd, (long) buf,
+ (uint) size));
if (!ReadFile(vio->hPipe, buf, size, &length, NULL))
DBUG_RETURN(-1);
DBUG_PRINT("exit", ("%d", length));
- DBUG_RETURN(length);
+ DBUG_RETURN((size_t) length);
}
-int vio_write_pipe(Vio * vio, const gptr buf, int size)
+size_t vio_write_pipe(Vio * vio, const uchar* buf, size_t size)
{
DWORD length;
DBUG_ENTER("vio_write_pipe");
- DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf,
- size));
+ DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %u", vio->sd, (long) buf,
+ (uint) size));
if (!WriteFile(vio->hPipe, (char*) buf, size, &length, NULL))
DBUG_RETURN(-1);
DBUG_PRINT("exit", ("%d", length));
- DBUG_RETURN(length);
+ DBUG_RETURN((size_t) length);
}
int vio_close_pipe(Vio * vio)
@@ -463,12 +463,11 @@ void vio_ignore_timeout(Vio *vio __attribute__((unused)),
#ifdef HAVE_SMEM
-int vio_read_shared_memory(Vio * vio, gptr buf, int size)
+size_t vio_read_shared_memory(Vio * vio, uchar* buf, size_t size)
{
- int length;
- int remain_local;
+ size_t length;
+ size_t remain_local;
char *current_postion;
-
DBUG_ENTER("vio_read_shared_memory");
DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf,
size));
@@ -485,7 +484,8 @@ int vio_read_shared_memory(Vio * vio, gptr buf, int size)
/*
WaitForMultipleObjects can return next values:
WAIT_OBJECT_0+0 - event from vio->event_server_wrote
- WAIT_OBJECT_0+1 - event from vio->event_conn_closed. We can't read anything
+ WAIT_OBJECT_0+1 - event from vio->event_conn_closed. We can't read
+ anything
WAIT_ABANDONED_0 and WAIT_TIMEOUT - fail. We can't read anything
*/
if (WaitForMultipleObjects(2, (HANDLE*)&events,FALSE,
@@ -514,23 +514,23 @@ int vio_read_shared_memory(Vio * vio, gptr buf, int size)
remain_local-=length;
if (!vio->shared_memory_remain)
- if (!SetEvent(vio->event_client_read)) DBUG_RETURN(-1);
+ {
+ if (!SetEvent(vio->event_client_read))
+ DBUG_RETURN(-1);
+ }
} while (remain_local);
length = size;
- DBUG_PRINT("exit", ("%d", length));
+ DBUG_PRINT("exit", ("%lu", (ulong) length));
DBUG_RETURN(length);
}
-int vio_write_shared_memory(Vio * vio, const gptr buf, int size)
+size_t vio_write_shared_memory(Vio * vio, const uchar* buf, size_t size)
{
- int length;
- uint remain;
+ size_t length, remain, sz;
HANDLE pos;
- int sz;
- char *current_postion;
-
+ const uchar *current_postion;
DBUG_ENTER("vio_write_shared_memory");
DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf,
size));
@@ -539,24 +539,27 @@ int vio_write_shared_memory(Vio * vio, const gptr buf, int size)
current_postion = buf;
while (remain != 0)
{
- if (WaitForSingleObject(vio->event_server_read, vio->net->write_timeout*1000)
- != WAIT_OBJECT_0)
+ if (WaitForSingleObject(vio->event_server_read,
+ vio->net->write_timeout*1000) !=
+ WAIT_OBJECT_0)
{
- DBUG_RETURN(-1);
- };
+ DBUG_RETURN((size_t) -1);
+ }
- sz = remain > shared_memory_buffer_length ? shared_memory_buffer_length: remain;
+ sz= (remain > shared_memory_buffer_length ? shared_memory_buffer_length :
+ remain);
int4store(vio->handle_map,sz);
pos = vio->handle_map + 4;
memcpy(pos,current_postion,sz);
remain-=sz;
current_postion+=sz;
- if (!SetEvent(vio->event_client_wrote)) DBUG_RETURN(-1);
+ if (!SetEvent(vio->event_client_wrote))
+ DBUG_RETURN((size_t) -1);
}
length = size;
- DBUG_PRINT("exit", ("%d", length));
+ DBUG_PRINT("exit", ("%lu", (ulong) length));
DBUG_RETURN(length);
}
diff --git a/vio/viossl.c b/vio/viossl.c
index 5e4203a3fb5..32cfecdb9c8 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -82,35 +82,36 @@ report_errors(SSL* ssl)
}
-int vio_ssl_read(Vio *vio, gptr buf, int size)
+size_t vio_ssl_read(Vio *vio, uchar* buf, size_t size)
{
- int r;
+ size_t r;
DBUG_ENTER("vio_ssl_read");
- DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d ssl: 0x%lx",
- vio->sd, (long) buf, size, (long) vio->ssl_arg));
+ DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %u ssl: 0x%lx",
+ vio->sd, (long) buf, (uint) size, (long) vio->ssl_arg));
r= SSL_read((SSL*) vio->ssl_arg, buf, size);
#ifndef DBUG_OFF
- if (r < 0)
+ if (r == (size_t) -1)
report_errors((SSL*) vio->ssl_arg);
#endif
- DBUG_PRINT("exit", ("%d", r));
+ DBUG_PRINT("exit", ("%u", (uint) r));
DBUG_RETURN(r);
}
-int vio_ssl_write(Vio *vio, const gptr buf, int size)
+size_t vio_ssl_write(Vio *vio, const uchar* buf, size_t size)
{
- int r;
+ size_t r;
DBUG_ENTER("vio_ssl_write");
- DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, (long) buf, size));
+ DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %u", vio->sd,
+ (long) buf, (uint) size));
r= SSL_write((SSL*) vio->ssl_arg, buf, size);
#ifndef DBUG_OFF
- if (r < 0)
+ if (r == (size_t) -1)
report_errors((SSL*) vio->ssl_arg);
#endif
- DBUG_PRINT("exit", ("%d", r));
+ DBUG_PRINT("exit", ("%u", (uint) r));
DBUG_RETURN(r);
}
@@ -123,8 +124,7 @@ int vio_ssl_close(Vio *vio)
if (ssl)
{
- switch ((r= SSL_shutdown(ssl)))
- {
+ switch ((r= SSL_shutdown(ssl))) {
case 1:
/* Shutdown successful */
break;
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c
index d26d4147c9f..d7e4f380bc1 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -378,6 +378,6 @@ new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd)
{
SSL_CTX_free(fd->ssl_context);
- my_free((gptr) fd, MYF(0));
+ my_free((uchar*) fd, MYF(0));
}
#endif /* HAVE_OPENSSL */
diff --git a/vio/viotest-ssl.c b/vio/viotest-ssl.c
index 81d119ff207..b8abbac4ed6 100644
--- a/vio/viotest-ssl.c
+++ b/vio/viotest-ssl.c
@@ -106,8 +106,8 @@ int main(int argc, char **argv)
child_pid = fork();
if (child_pid==-1)
{
- my_free((gptr)ssl_acceptor,MYF(0));
- my_free((gptr)ssl_connector,MYF(0));
+ my_free((uchar*)ssl_acceptor,MYF(0));
+ my_free((uchar*)ssl_connector,MYF(0));
fatal_error("fork");
}
if (child_pid==0)
@@ -116,29 +116,29 @@ int main(int argc, char **argv)
char xbuf[100];
int r = vio_ssl_read(client_vio,xbuf, sizeof(xbuf));
if (r<=0) {
- my_free((gptr)ssl_acceptor,MYF(0));
- my_free((gptr)ssl_connector,MYF(0));
+ my_free((uchar*)ssl_acceptor,MYF(0));
+ my_free((uchar*)ssl_connector,MYF(0));
fatal_error("client:SSL_read");
}
xbuf[r] = 0;
printf("client:got %s\n", xbuf);
- my_free((gptr)client_vio,MYF(0));
- my_free((gptr)ssl_acceptor,MYF(0));
- my_free((gptr)ssl_connector,MYF(0));
+ my_free((uchar*)client_vio,MYF(0));
+ my_free((uchar*)ssl_acceptor,MYF(0));
+ my_free((uchar*)ssl_connector,MYF(0));
sleep(1);
}
else
{
const char* s = "Huhuhuh";
- int r = vio_ssl_write(server_vio,(gptr)s, strlen(s));
+ int r = vio_ssl_write(server_vio,(uchar*)s, strlen(s));
if (r<=0) {
- my_free((gptr)ssl_acceptor,MYF(0));
- my_free((gptr)ssl_connector,MYF(0));
+ my_free((uchar*)ssl_acceptor,MYF(0));
+ my_free((uchar*)ssl_connector,MYF(0));
fatal_error("server:SSL_write");
}
- my_free((gptr)server_vio,MYF(0));
- my_free((gptr)ssl_acceptor,MYF(0));
- my_free((gptr)ssl_connector,MYF(0));
+ my_free((uchar*)server_vio,MYF(0));
+ my_free((uchar*)ssl_acceptor,MYF(0));
+ my_free((uchar*)ssl_connector,MYF(0));
sleep(1);
}
return 0;
diff --git a/win/README b/win/README
index 1e45b92abb2..fbcdfd068b8 100644
--- a/win/README
+++ b/win/README
@@ -35,7 +35,7 @@ the link named "Complete package, excluding sources". This includes an
installer that will install bison. After the installer finishes, modify
your path so that you can execute bison.
-(Alternative you, can take the sql_yacc.yy and sql_yacc.h files from a
+(As an alternative you can take the sql_yacc.yy and sql_yacc.h files from a
matching mysql tar distribution and drop them into the sql directory just
before you start the build)
@@ -45,8 +45,11 @@ Clone your bk tree to any location you like.
Step 5
------
-From the root of your bk clone, execute the command: win\configure <options>.
-The options right now are
+From the root of your installation directory, execute the command:
+
+win\configure <options>
+
+The options right now are:
WITH_INNOBASE_STORAGE_ENGINE Enable particular storage engines
WITH_PARTITION_STORAGE_ENGINE
@@ -68,8 +71,9 @@ win\configure WITH_INNOBASE_STORAGE_ENGINE WITH_PARTITION_STORAGE_ENGINE MYSQL_S
Step 6
------
-From the root of your bk clone, execute one of the batch files to generate the type
-of project files you desire.
+
+From the root of your installation directory/bk clone, execute one of
+the batch files to generate the type of project files you desire.
For Visual Studio 8 (or Visual C++ 2005 express edition), do win\build-vs8.
For Visual Studio 7.1, do win\build-vs71.
@@ -80,8 +84,8 @@ Step 7
------
From the root of your bk clone, start your build.
-For Visual Studio, simply execute mysql.sln. This will start the IDE and you can
-click the build solution menu option.
+For Visual Studio, execute mysql.sln. This will start the IDE
+and you can click the build solution menu option.
Current issues
--------------