diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/config-win.h | 6 | ||||
-rw-r--r-- | include/decimal.h | 4 | ||||
-rw-r--r-- | include/ft_global.h | 6 | ||||
-rw-r--r-- | include/hash.h | 29 | ||||
-rw-r--r-- | include/heap.h | 54 | ||||
-rw-r--r-- | include/keycache.h | 16 | ||||
-rw-r--r-- | include/m_ctype.h | 233 | ||||
-rw-r--r-- | include/m_string.h | 55 | ||||
-rw-r--r-- | include/my_alloc.h | 4 | ||||
-rw-r--r-- | include/my_base.h | 2 | ||||
-rw-r--r-- | include/my_dbug.h | 8 | ||||
-rw-r--r-- | include/my_getopt.h | 6 | ||||
-rw-r--r-- | include/my_global.h | 151 | ||||
-rw-r--r-- | include/my_list.h | 4 | ||||
-rw-r--r-- | include/my_nosys.h | 5 | ||||
-rw-r--r-- | include/my_pthread.h | 2 | ||||
-rw-r--r-- | include/my_sys.h | 277 | ||||
-rw-r--r-- | include/my_tree.h | 4 | ||||
-rw-r--r-- | include/my_trie.h | 16 | ||||
-rw-r--r-- | include/my_user.h | 6 | ||||
-rw-r--r-- | include/my_vle.h | 4 | ||||
-rw-r--r-- | include/my_xml.h | 16 | ||||
-rw-r--r-- | include/myisam.h | 40 | ||||
-rw-r--r-- | include/myisammrg.h | 22 | ||||
-rw-r--r-- | include/mysql.h | 15 | ||||
-rw-r--r-- | include/mysql_com.h | 14 | ||||
-rw-r--r-- | include/queues.h | 12 | ||||
-rw-r--r-- | include/sql_common.h | 6 | ||||
-rw-r--r-- | include/sslopt-longopts.h | 14 | ||||
-rw-r--r-- | include/violite.h | 20 |
30 files changed, 520 insertions, 531 deletions
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 */ |