Merged with mysql-5.1 main tree.

BUILD/compile-pentium-debug-max:
  Added definition after macro was removed from main tree. This will
  be fixed back in main tree later.
This commit is contained in:
unknown 2007-07-02 20:45:15 +03:00
parent cfdd73369c
commit 631ecaabea
99 changed files with 1692 additions and 1691 deletions

View File

@ -4,7 +4,7 @@ path=`dirname $0`
set -- "$@" --with-debug=full set -- "$@" --with-debug=full
. "$path/SETUP.sh" . "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags" extra_flags="$pentium_cflags $debug_cflags -DSTACK_DIRECTION=-1"
extra_configs="$pentium_configs $debug_configs $max_configs $error_inject --with-experimental-collations" extra_configs="$pentium_configs $debug_configs $max_configs $error_inject --with-experimental-collations"
. "$path/FINISH.sh" . "$path/FINISH.sh"

View File

@ -206,7 +206,7 @@ uint lf_alloc_pool_count(LF_ALLOCATOR *allocator);
#define lf_alloc_get_pins(A, ST) lf_pinbox_get_pins(&(A)->pinbox, (ST)) #define lf_alloc_get_pins(A, ST) lf_pinbox_get_pins(&(A)->pinbox, (ST))
#define _lf_alloc_put_pins(PINS) _lf_pinbox_put_pins(PINS) #define _lf_alloc_put_pins(PINS) _lf_pinbox_put_pins(PINS)
#define lf_alloc_put_pins(PINS) lf_pinbox_put_pins(PINS) #define lf_alloc_put_pins(PINS) lf_pinbox_put_pins(PINS)
#define lf_alloc_direct_free(ALLOC, ADDR) my_free((gptr)(ADDR), MYF(0)) #define lf_alloc_direct_free(ALLOC, ADDR) my_free((uchar*)(ADDR), MYF(0))
lock_wrap(lf_alloc_new, void *, lock_wrap(lf_alloc_new, void *,
(LF_PINS *pins), (LF_PINS *pins),

View File

@ -179,18 +179,18 @@ typedef struct st_maria_keydef /* Key definition with open & info */
HA_KEYSEG *seg, *end; HA_KEYSEG *seg, *end;
struct st_mysql_ftparser *parser; /* Fulltext [pre]parser */ struct st_mysql_ftparser *parser; /* Fulltext [pre]parser */
int (*bin_search)(struct st_maria_info *info, int (*bin_search)(struct st_maria_info *info,
struct st_maria_keydef *keyinfo, byte *page, byte *key, struct st_maria_keydef *keyinfo, uchar *page, uchar *key,
uint key_len, uint comp_flag, byte **ret_pos, uint key_len, uint comp_flag, uchar **ret_pos,
byte *buff, my_bool *was_last_key); uchar *buff, my_bool *was_last_key);
uint(*get_key)(struct st_maria_keydef *keyinfo, uint nod_flag, uint(*get_key)(struct st_maria_keydef *keyinfo, uint nod_flag,
byte **page, byte *key); uchar **page, uchar *key);
int (*pack_key)(struct st_maria_keydef *keyinfo, uint nod_flag, int (*pack_key)(struct st_maria_keydef *keyinfo, uint nod_flag,
byte *next_key, byte *org_key, byte *prev_key, uchar *next_key, uchar *org_key, uchar *prev_key,
const byte *key, struct st_maria_s_param *s_temp); const uchar *key, struct st_maria_s_param *s_temp);
void (*store_key)(struct st_maria_keydef *keyinfo, byte *key_pos, void (*store_key)(struct st_maria_keydef *keyinfo, uchar *key_pos,
struct st_maria_s_param *s_temp); struct st_maria_s_param *s_temp);
int (*ck_insert)(struct st_maria_info *inf, uint k_nr, byte *k, uint klen); int (*ck_insert)(struct st_maria_info *inf, uint k_nr, uchar *k, uint klen);
int (*ck_delete)(struct st_maria_info *inf, uint k_nr, byte *k, uint klen); int (*ck_delete)(struct st_maria_info *inf, uint k_nr, uchar *k, uint klen);
} MARIA_KEYDEF; } MARIA_KEYDEF;
@ -208,7 +208,7 @@ typedef struct st_maria_decode_tree /* Decode huff-table */
{ {
uint16 *table; uint16 *table;
uint quick_table_bits; uint quick_table_bits;
byte *intervalls; uchar *intervalls;
} MARIA_DECODE_TREE; } MARIA_DECODE_TREE;
@ -236,7 +236,7 @@ typedef struct st_maria_columndef /* column information */
#ifndef NOT_PACKED_DATABASES #ifndef NOT_PACKED_DATABASES
void(*unpack)(struct st_maria_columndef *rec, void(*unpack)(struct st_maria_columndef *rec,
struct st_maria_bit_buff *buff, struct st_maria_bit_buff *buff,
byte *start, byte *end); uchar *start, uchar *end);
enum en_fieldtype base_type; enum en_fieldtype base_type;
uint space_length_bits, pack_type; uint space_length_bits, pack_type;
MARIA_DECODE_TREE *huff_tree; MARIA_DECODE_TREE *huff_tree;
@ -258,30 +258,30 @@ extern PAGECACHE maria_pagecache_var, *maria_pagecache;
extern int maria_init(void); extern int maria_init(void);
extern void maria_end(void); extern void maria_end(void);
extern int maria_close(struct st_maria_info *file); extern int maria_close(struct st_maria_info *file);
extern int maria_delete(struct st_maria_info *file, const byte *buff); extern int maria_delete(struct st_maria_info *file, const uchar *buff);
extern struct st_maria_info *maria_open(const char *name, int mode, extern struct st_maria_info *maria_open(const char *name, int mode,
uint wait_if_locked); uint wait_if_locked);
extern struct st_maria_info *maria_clone(struct st_maria_share *share, int mode); extern struct st_maria_info *maria_clone(struct st_maria_share *share, int mode);
extern int maria_panic(enum ha_panic_function function); extern int maria_panic(enum ha_panic_function function);
extern int maria_rfirst(struct st_maria_info *file, byte *buf, int inx); extern int maria_rfirst(struct st_maria_info *file, uchar *buf, int inx);
extern int maria_rkey(struct st_maria_info *file, byte *buf, int inx, extern int maria_rkey(struct st_maria_info *file, uchar *buf, int inx,
const byte *key, const uchar *key,
uint key_len, enum ha_rkey_function search_flag); uint key_len, enum ha_rkey_function search_flag);
extern int maria_rlast(struct st_maria_info *file, byte *buf, int inx); extern int maria_rlast(struct st_maria_info *file, uchar *buf, int inx);
extern int maria_rnext(struct st_maria_info *file, byte *buf, int inx); extern int maria_rnext(struct st_maria_info *file, uchar *buf, int inx);
extern int maria_rnext_same(struct st_maria_info *info, byte *buf); extern int maria_rnext_same(struct st_maria_info *info, uchar *buf);
extern int maria_rprev(struct st_maria_info *file, byte *buf, int inx); extern int maria_rprev(struct st_maria_info *file, uchar *buf, int inx);
extern int maria_rrnd(struct st_maria_info *file, byte *buf, extern int maria_rrnd(struct st_maria_info *file, uchar *buf,
MARIA_RECORD_POS pos); MARIA_RECORD_POS pos);
extern int maria_scan_init(struct st_maria_info *file); extern int maria_scan_init(struct st_maria_info *file);
extern int maria_scan(struct st_maria_info *file, byte *buf); extern int maria_scan(struct st_maria_info *file, uchar *buf);
extern void maria_scan_end(struct st_maria_info *file); extern void maria_scan_end(struct st_maria_info *file);
extern int maria_rsame(struct st_maria_info *file, byte *record, int inx); extern int maria_rsame(struct st_maria_info *file, uchar *record, int inx);
extern int maria_rsame_with_pos(struct st_maria_info *file, byte *record, extern int maria_rsame_with_pos(struct st_maria_info *file, uchar *record,
int inx, MARIA_RECORD_POS pos); int inx, MARIA_RECORD_POS pos);
extern int maria_update(struct st_maria_info *file, const byte *old, extern int maria_update(struct st_maria_info *file, const uchar *old,
byte *new_record); uchar *new_record);
extern int maria_write(struct st_maria_info *file, byte *buff); extern int maria_write(struct st_maria_info *file, uchar *buff);
extern MARIA_RECORD_POS maria_position(struct st_maria_info *file); extern MARIA_RECORD_POS maria_position(struct st_maria_info *file);
extern int maria_status(struct st_maria_info *info, MARIA_INFO *x, uint flag); extern int maria_status(struct st_maria_info *info, MARIA_INFO *x, uint flag);
extern int maria_lock_database(struct st_maria_info *file, int lock_type); extern int maria_lock_database(struct st_maria_info *file, int lock_type);
@ -348,8 +348,8 @@ typedef struct st_maria_sort_param
MARIA_KEYDEF *keyinfo; MARIA_KEYDEF *keyinfo;
MARIA_SORT_INFO *sort_info; MARIA_SORT_INFO *sort_info;
HA_KEYSEG *seg; HA_KEYSEG *seg;
byte **sort_keys; uchar **sort_keys;
byte *rec_buff; uchar *rec_buff;
void *wordlist, *wordptr; void *wordlist, *wordptr;
MEM_ROOT wordroot; MEM_ROOT wordroot;
char *record; char *record;
@ -367,13 +367,13 @@ typedef struct st_maria_sort_param
uint maxbuffers, keys, find_length, sort_keys_length; uint maxbuffers, keys, find_length, sort_keys_length;
my_bool fix_datafile, master; my_bool fix_datafile, master;
my_bool calc_checksum; /* calculate table checksum */ my_bool calc_checksum; /* calculate table checksum */
my_size_t rec_buff_size; size_t rec_buff_size;
int (*key_cmp)(struct st_maria_sort_param *, const void *, const void *); int (*key_cmp)(struct st_maria_sort_param *, const void *, const void *);
int (*key_read)(struct st_maria_sort_param *, byte *); int (*key_read)(struct st_maria_sort_param *, uchar *);
int (*key_write)(struct st_maria_sort_param *, const byte *); int (*key_write)(struct st_maria_sort_param *, const uchar *);
void (*lock_in_memory)(HA_CHECK *); void (*lock_in_memory)(HA_CHECK *);
NEAR int (*write_keys)(struct st_maria_sort_param *, register byte **, NEAR int (*write_keys)(struct st_maria_sort_param *, register uchar **,
uint , struct st_buffpek *, IO_CACHE *); uint , struct st_buffpek *, IO_CACHE *);
NEAR uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint); NEAR uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint);
NEAR int (*write_key)(struct st_maria_sort_param *, IO_CACHE *,char *, NEAR int (*write_key)(struct st_maria_sort_param *, IO_CACHE *,char *,
@ -389,9 +389,9 @@ int maria_chk_size(HA_CHECK *param, MARIA_HA *info);
int maria_chk_key(HA_CHECK *param, MARIA_HA *info); int maria_chk_key(HA_CHECK *param, MARIA_HA *info);
int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info, int extend); int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info, int extend);
int maria_repair(HA_CHECK *param, register MARIA_HA *info, int maria_repair(HA_CHECK *param, register MARIA_HA *info,
my_string name, int rep_quick); char * name, int rep_quick);
int maria_sort_index(HA_CHECK *param, register MARIA_HA *info, int maria_sort_index(HA_CHECK *param, register MARIA_HA *info,
my_string name); char * name);
int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info, int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info,
const char *name, int rep_quick); const char *name, int rep_quick);
int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info, int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
@ -405,7 +405,7 @@ void maria_update_key_parts(MARIA_KEYDEF *keyinfo, ulong *rec_per_key_part,
ulonglong records); ulonglong records);
int maria_filecopy(HA_CHECK *param, File to, File from, my_off_t start, int maria_filecopy(HA_CHECK *param, File to, File from, my_off_t start,
my_off_t length, const char *type); my_off_t length, const char *type);
int maria_movepoint(MARIA_HA *info, byte *record, my_off_t oldpos, int maria_movepoint(MARIA_HA *info, uchar *record, my_off_t oldpos,
my_off_t newpos, uint prot_key); my_off_t newpos, uint prot_key);
int maria_write_data_suffix(MARIA_SORT_INFO *sort_info, my_bool fix_datafile); int maria_write_data_suffix(MARIA_SORT_INFO *sort_info, my_bool fix_datafile);
int maria_test_if_almost_full(MARIA_HA *info); int maria_test_if_almost_full(MARIA_HA *info);
@ -427,8 +427,8 @@ void maria_change_pagecache(PAGECACHE *old_key_cache,
int maria_preload(MARIA_HA *info, ulonglong key_map, my_bool ignore_leaves); int maria_preload(MARIA_HA *info, ulonglong key_map, my_bool ignore_leaves);
/* fulltext functions */ /* fulltext functions */
FT_INFO *maria_ft_init_search(uint,void *, uint, byte *, uint, FT_INFO *maria_ft_init_search(uint,void *, uint, uchar *, uint,
CHARSET_INFO *, byte *); CHARSET_INFO *, uchar *);
/* 'Almost-internal' Maria functions */ /* 'Almost-internal' Maria functions */

View File

@ -717,12 +717,12 @@ extern void handle_recived_signals(void);
extern sig_handler my_set_alarm_variable(int signo); extern sig_handler my_set_alarm_variable(int signo);
extern void my_string_ptr_sort(uchar *base,uint items,size_t 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, 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, extern qsort_t qsort2(void *base_ptr, size_t total_elems, size_t size,
qsort2_cmp cmp, void *cmp_argument); qsort2_cmp cmp, void *cmp_argument);
extern qsort2_cmp get_ptr_compare(size_t); extern qsort2_cmp get_ptr_compare(size_t);
void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos); void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos);
my_off_t my_get_ptr(cuhar *ptr, size_t pack_length); 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, extern int init_io_cache(IO_CACHE *info,File file,size_t cachesize,
enum cache_type type,my_off_t seek_offset, enum cache_type type,my_off_t seek_offset,
pbool use_async_io, myf cache_myflags); pbool use_async_io, myf cache_myflags);
@ -840,11 +840,11 @@ extern void free_defaults(char **argv);
extern void my_print_default_files(const char *conf_file); extern void my_print_default_files(const char *conf_file);
extern void print_defaults(const char *conf_file, const char **groups); extern void print_defaults(const char *conf_file, const char **groups);
extern my_bool my_compress(uchar *, size_t *, size_t *); extern my_bool my_compress(uchar *, size_t *, size_t *);
extern my_bool my_uncompress(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, extern uchar *my_compress_alloc(const uchar *packet, size_t *len,
size_t *complen); size_t *complen);
extern int packfrm(const uchar *, size_t, uchar **, size_t *); extern int packfrm(const uchar *, size_t, uchar **, size_t *);
extern int unpackfrm(const uchar **, size_t *, const uchar *); extern int unpackfrm(uchar **, size_t *, const uchar *);
extern ha_checksum my_checksum(ha_checksum crc, const uchar *mem, extern ha_checksum my_checksum(ha_checksum crc, const uchar *mem,
size_t count); size_t count);

View File

@ -338,7 +338,7 @@ typedef struct st_mi_sort_param
MI_SORT_INFO *sort_info; MI_SORT_INFO *sort_info;
HA_KEYSEG *seg; HA_KEYSEG *seg;
uchar **sort_keys; uchar **sort_keys;
byte *rec_buff; uchar *rec_buff;
void *wordlist, *wordptr; void *wordlist, *wordptr;
MEM_ROOT wordroot; MEM_ROOT wordroot;
char *record; char *record;

View File

@ -76,8 +76,8 @@
typedef struct st_sort_key_blocks /* Used when sorting */ typedef struct st_sort_key_blocks /* Used when sorting */
{ {
byte *buff, *end_pos; uchar *buff, *end_pos;
byte lastkey[HA_MAX_POSSIBLE_KEY_BUFF]; uchar lastkey[HA_MAX_POSSIBLE_KEY_BUFF];
uint last_length; uint last_length;
int inited; int inited;
} SORT_KEY_BLOCKS; } SORT_KEY_BLOCKS;
@ -147,15 +147,15 @@ typedef struct st_handler_check_param
typedef struct st_sort_ftbuf typedef struct st_sort_ftbuf
{ {
byte *buf, *end; uchar *buf, *end;
int count; int count;
byte lastkey[HA_MAX_KEY_BUFF]; uchar lastkey[HA_MAX_KEY_BUFF];
} SORT_FT_BUF; } SORT_FT_BUF;
typedef struct st_buffpek { typedef struct st_buffpek {
my_off_t file_pos; /* Where we are in the sort file */ my_off_t file_pos; /* Where we are in the sort file */
byte *base, *key; /* Key pointers */ uchar *base, *key; /* Key pointers */
ha_rows count; /* Number of rows in table */ ha_rows count; /* Number of rows in table */
ulong mem_count; /* numbers of keys in memory */ ulong mem_count; /* numbers of keys in memory */
ulong max_keys; /* Max keys in buffert */ ulong max_keys; /* Max keys in buffert */

View File

@ -34,7 +34,7 @@ LF_REQUIRE_PINS(3);
typedef struct { typedef struct {
intptr volatile link; /* a pointer to the next element in a listand a flag */ intptr volatile link; /* a pointer to the next element in a listand a flag */
uint32 hashnr; /* reversed hash number, for sorting */ uint32 hashnr; /* reversed hash number, for sorting */
const byte *key; const uchar *key;
uint keylen; uint keylen;
/* /*
data is stored here, directly after the keylen. data is stored here, directly after the keylen.
@ -72,10 +72,10 @@ typedef struct {
pins[0..2] are used, they are NOT removed on return pins[0..2] are used, they are NOT removed on return
*/ */
static int lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, static int lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
const byte *key, uint keylen, CURSOR *cursor, LF_PINS *pins) const uchar *key, uint keylen, CURSOR *cursor, LF_PINS *pins)
{ {
uint32 cur_hashnr; uint32 cur_hashnr;
const byte *cur_key; const uchar *cur_key;
uint cur_keylen; uint cur_keylen;
intptr link; intptr link;
@ -201,7 +201,7 @@ static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
it uses pins[0..2], on return all pins are removed. it uses pins[0..2], on return all pins are removed.
*/ */
static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
const byte *key, uint keylen, LF_PINS *pins) const uchar *key, uint keylen, LF_PINS *pins)
{ {
CURSOR cursor; CURSOR cursor;
int res; int res;
@ -259,7 +259,7 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
all other pins are removed. all other pins are removed.
*/ */
static LF_SLIST *lsearch(LF_SLIST * volatile *head, CHARSET_INFO *cs, static LF_SLIST *lsearch(LF_SLIST * volatile *head, CHARSET_INFO *cs,
uint32 hashnr, const byte *key, uint keylen, uint32 hashnr, const uchar *key, uint keylen,
LF_PINS *pins) LF_PINS *pins)
{ {
CURSOR cursor; CURSOR cursor;
@ -271,8 +271,8 @@ static LF_SLIST *lsearch(LF_SLIST * volatile *head, CHARSET_INFO *cs,
return res ? cursor.curr : 0; return res ? cursor.curr : 0;
} }
static inline const byte* hash_key(const LF_HASH *hash, static inline const uchar* hash_key(const LF_HASH *hash,
const byte *record, uint *length) const uchar *record, uint *length)
{ {
if (hash->get_key) if (hash->get_key)
return (*hash->get_key)(record, length, 0); return (*hash->get_key)(record, length, 0);
@ -285,7 +285,7 @@ static inline const byte* hash_key(const LF_HASH *hash,
note, that the hash value is limited to 2^31, because we need one note, that the hash value is limited to 2^31, because we need one
bit to distinguish between normal and dummy nodes. bit to distinguish between normal and dummy nodes.
*/ */
static inline uint calc_hash(LF_HASH *hash, const byte *key, uint keylen) static inline uint calc_hash(LF_HASH *hash, const uchar *key, uint keylen)
{ {
ulong nr1= 1, nr2= 4; ulong nr1= 1, nr2= 4;
hash->charset->coll->hash_sort(hash->charset, (uchar*) key, keylen, hash->charset->coll->hash_sort(hash->charset, (uchar*) key, keylen,
@ -362,7 +362,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
if (unlikely(!node)) if (unlikely(!node))
return -1; return -1;
memcpy(node+1, data, hash->element_size); memcpy(node+1, data, hash->element_size);
node->key= hash_key(hash, (byte *)(node+1), &node->keylen); node->key= hash_key(hash, (uchar *)(node+1), &node->keylen);
hashnr= calc_hash(hash, node->key, node->keylen); hashnr= calc_hash(hash, node->key, node->keylen);
bucket= hashnr % hash->size; bucket= hashnr % hash->size;
el= _lf_dynarray_lvalue(&hash->array, bucket); el= _lf_dynarray_lvalue(&hash->array, bucket);
@ -399,7 +399,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
{ {
LF_SLIST * volatile *el; LF_SLIST * volatile *el;
uint bucket, hashnr= calc_hash(hash, (byte *)key, keylen); uint bucket, hashnr= calc_hash(hash, (uchar *)key, keylen);
bucket= hashnr % hash->size; bucket= hashnr % hash->size;
lf_rwlock_by_pins(pins); lf_rwlock_by_pins(pins);
@ -415,7 +415,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins))) if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins)))
return -1; return -1;
if (ldelete(el, hash->charset, my_reverse_bits(hashnr) | 1, if (ldelete(el, hash->charset, my_reverse_bits(hashnr) | 1,
(byte *)key, keylen, pins)) (uchar *)key, keylen, pins))
{ {
lf_rwunlock_by_pins(pins); lf_rwunlock_by_pins(pins);
return 1; return 1;
@ -438,7 +438,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
{ {
LF_SLIST * volatile *el, *found; LF_SLIST * volatile *el, *found;
uint bucket, hashnr= calc_hash(hash, (byte *)key, keylen); uint bucket, hashnr= calc_hash(hash, (uchar *)key, keylen);
bucket= hashnr % hash->size; bucket= hashnr % hash->size;
lf_rwlock_by_pins(pins); lf_rwlock_by_pins(pins);
@ -448,12 +448,12 @@ void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins))) if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins)))
return MY_ERRPTR; return MY_ERRPTR;
found= lsearch(el, hash->charset, my_reverse_bits(hashnr) | 1, found= lsearch(el, hash->charset, my_reverse_bits(hashnr) | 1,
(byte *)key, keylen, pins); (uchar *)key, keylen, pins);
lf_rwunlock_by_pins(pins); lf_rwunlock_by_pins(pins);
return found ? found+1 : 0; return found ? found+1 : 0;
} }
static const byte *dummy_key= ""; static const uchar *dummy_key= "";
/* /*
RETURN RETURN

View File

@ -178,7 +178,8 @@ int packfrm(const uchar *data, size_t len,
if (my_compress((uchar*)data, &org_len, &comp_len)) if (my_compress((uchar*)data, &org_len, &comp_len))
goto err; goto err;
DBUG_PRINT("info", ("org_len: %lu comp_len: %lu", org_len, comp_len)); DBUG_PRINT("info", ("org_len: %lu comp_len: %lu", (ulong) org_len,
(ulong) comp_len));
DBUG_DUMP("compressed", (char*)data, org_len); DBUG_DUMP("compressed", (char*)data, org_len);
error= 2; error= 2;

View File

@ -66,8 +66,9 @@ int my_rename(const char *from, const char *to, myf MyFlags)
#ifdef NEED_EXPLICIT_SYNC_DIR #ifdef NEED_EXPLICIT_SYNC_DIR
/* do only the needed amount of syncs: */ /* do only the needed amount of syncs: */
char dir_from[FN_REFLEN], dir_to[FN_REFLEN]; char dir_from[FN_REFLEN], dir_to[FN_REFLEN];
dirname_part(dir_from, from); size_t dir_from_length, dir_to_length;
dirname_part(dir_to, to); dirname_part(dir_from, from, &dir_from_length);
dirname_part(dir_to, to, &dir_to_length);
if (my_sync_dir(dir_from, MyFlags) || if (my_sync_dir(dir_from, MyFlags) ||
(strcmp(dir_from, dir_to) && (strcmp(dir_from, dir_to) &&
my_sync_dir(dir_to, MyFlags))) my_sync_dir(dir_to, MyFlags)))

View File

@ -53,7 +53,7 @@
static void safe_hash_entry_free(SAFE_HASH_ENTRY *entry) static void safe_hash_entry_free(SAFE_HASH_ENTRY *entry)
{ {
DBUG_ENTER("safe_hash_entry_free"); DBUG_ENTER("safe_hash_entry_free");
my_free((gptr) entry, MYF(0)); my_free((uchar*) entry, MYF(0));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -70,11 +70,11 @@ static void safe_hash_entry_free(SAFE_HASH_ENTRY *entry)
# reference on the key # reference on the key
*/ */
static byte *safe_hash_entry_get(SAFE_HASH_ENTRY *entry, uint *length, static uchar *safe_hash_entry_get(SAFE_HASH_ENTRY *entry, uint *length,
my_bool not_used __attribute__((unused))) my_bool not_used __attribute__((unused)))
{ {
*length= entry->length; *length= entry->length;
return (byte*) entry->key; return (uchar*) entry->key;
} }
@ -97,7 +97,7 @@ static byte *safe_hash_entry_get(SAFE_HASH_ENTRY *entry, uint *length,
*/ */
my_bool safe_hash_init(SAFE_HASH *hash, uint elements, my_bool safe_hash_init(SAFE_HASH *hash, uint elements,
byte *default_value) uchar *default_value)
{ {
DBUG_ENTER("safe_hash_init"); DBUG_ENTER("safe_hash_init");
if (hash_init(&hash->hash, &my_charset_bin, elements, if (hash_init(&hash->hash, &my_charset_bin, elements,
@ -154,10 +154,10 @@ void safe_hash_free(SAFE_HASH *hash)
# data associated with the key of default value if data was not found # data associated with the key of default value if data was not found
*/ */
byte *safe_hash_search(SAFE_HASH *hash, const byte *key, uint length, uchar *safe_hash_search(SAFE_HASH *hash, const uchar *key, uint length,
byte *def) uchar *def)
{ {
byte *result; uchar *result;
DBUG_ENTER("safe_hash_search"); DBUG_ENTER("safe_hash_search");
rw_rdlock(&hash->mutex); rw_rdlock(&hash->mutex);
result= hash_search(&hash->hash, key, length); result= hash_search(&hash->hash, key, length);
@ -191,8 +191,8 @@ byte *safe_hash_search(SAFE_HASH *hash, const byte *key, uint length,
1 error (Can only be EOM). In this case my_message() is called. 1 error (Can only be EOM). In this case my_message() is called.
*/ */
my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length, my_bool safe_hash_set(SAFE_HASH *hash, const uchar *key, uint length,
byte *data) uchar *data)
{ {
SAFE_HASH_ENTRY *entry; SAFE_HASH_ENTRY *entry;
my_bool error= 0; my_bool error= 0;
@ -214,7 +214,7 @@ my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length,
/* unlink entry from list */ /* unlink entry from list */
if ((*entry->prev= entry->next)) if ((*entry->prev= entry->next))
entry->next->prev= entry->prev; entry->next->prev= entry->prev;
hash_delete(&hash->hash, (byte*) entry); hash_delete(&hash->hash, (uchar*) entry);
goto end; goto end;
} }
if (entry) if (entry)
@ -230,7 +230,7 @@ my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length,
error= 1; error= 1;
goto end; goto end;
} }
entry->key= (byte*) (entry +1); entry->key= (uchar*) (entry +1);
memcpy((char*) entry->key, (char*) key, length); memcpy((char*) entry->key, (char*) key, length);
entry->length= length; entry->length= length;
entry->data= data; entry->data= data;
@ -239,7 +239,7 @@ my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length,
entry->next->prev= &entry->next; entry->next->prev= &entry->next;
entry->prev= &hash->root; entry->prev= &hash->root;
hash->root= entry; hash->root= entry;
if (my_hash_insert(&hash->hash, (byte*) entry)) if (my_hash_insert(&hash->hash, (uchar*) entry))
{ {
/* This can only happen if hash got out of memory */ /* This can only happen if hash got out of memory */
my_free((char*) entry, MYF(0)); my_free((char*) entry, MYF(0));
@ -269,7 +269,7 @@ end:
default value. default value.
*/ */
void safe_hash_change(SAFE_HASH *hash, byte *old_data, byte *new_data) void safe_hash_change(SAFE_HASH *hash, uchar *old_data, uchar *new_data)
{ {
SAFE_HASH_ENTRY *entry, *next; SAFE_HASH_ENTRY *entry, *next;
DBUG_ENTER("safe_hash_change"); DBUG_ENTER("safe_hash_change");
@ -285,7 +285,7 @@ void safe_hash_change(SAFE_HASH *hash, byte *old_data, byte *new_data)
{ {
if ((*entry->prev= entry->next)) if ((*entry->prev= entry->next))
entry->next->prev= entry->prev; entry->next->prev= entry->prev;
hash_delete(&hash->hash, (byte*) entry); hash_delete(&hash->hash, (uchar*) entry);
} }
else else
entry->data= new_data; entry->data= new_data;

View File

@ -30,9 +30,9 @@
typedef struct st_safe_hash_entry typedef struct st_safe_hash_entry
{ {
byte *key; uchar *key;
uint length; uint length;
byte *data; uchar *data;
struct st_safe_hash_entry *next, **prev; struct st_safe_hash_entry *next, **prev;
} SAFE_HASH_ENTRY; } SAFE_HASH_ENTRY;
@ -43,16 +43,16 @@ typedef struct st_safe_hash_with_default
rw_lock_t mutex; rw_lock_t mutex;
#endif #endif
HASH hash; HASH hash;
byte *default_value; uchar *default_value;
SAFE_HASH_ENTRY *root; SAFE_HASH_ENTRY *root;
} SAFE_HASH; } SAFE_HASH;
my_bool safe_hash_init(SAFE_HASH *hash, uint elements, my_bool safe_hash_init(SAFE_HASH *hash, uint elements,
byte *default_value); uchar *default_value);
void safe_hash_free(SAFE_HASH *hash); void safe_hash_free(SAFE_HASH *hash);
byte *safe_hash_search(SAFE_HASH *hash, const byte *key, uint length, uchar *safe_hash_search(SAFE_HASH *hash, const uchar *key, uint length,
byte *def); uchar *def);
my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length, my_bool safe_hash_set(SAFE_HASH *hash, const uchar *key, uint length,
byte *data); uchar *data);
void safe_hash_change(SAFE_HASH *hash, byte *old_data, byte *new_data); void safe_hash_change(SAFE_HASH *hash, uchar *old_data, uchar *new_data);

View File

@ -145,7 +145,8 @@ int my_sync_dir_by_file(const char *file_name, myf my_flags)
{ {
#ifdef NEED_EXPLICIT_SYNC_DIR #ifdef NEED_EXPLICIT_SYNC_DIR
char dir_name[FN_REFLEN]; char dir_name[FN_REFLEN];
dirname_part(dir_name, file_name); size_t dir_name_length;
dirname_part(dir_name, file_name, &dir_name_length);
return my_sync_dir(dir_name, my_flags); return my_sync_dir(dir_name, my_flags);
#else #else
return 0; return 0;

View File

@ -1076,7 +1076,7 @@ uint read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek,
void reuse_freed_buff(QUEUE *queue, BUFFPEK *reuse, uint key_length) void reuse_freed_buff(QUEUE *queue, BUFFPEK *reuse, uint key_length)
{ {
byte *reuse_end= reuse->base + reuse->max_keys * key_length; uchar *reuse_end= reuse->base + reuse->max_keys * key_length;
for (uint i= 0; i < queue->elements; ++i) for (uint i= 0; i < queue->elements; ++i)
{ {
BUFFPEK *bp= (BUFFPEK *) queue_element(queue, i); BUFFPEK *bp= (BUFFPEK *) queue_element(queue, i);
@ -1158,7 +1158,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
for (buffpek= Fb ; buffpek <= Tb ; buffpek++) for (buffpek= Fb ; buffpek <= Tb ; buffpek++)
{ {
buffpek->base= (byte*) strpos; buffpek->base= (uchar*) strpos;
buffpek->max_keys= maxcount; buffpek->max_keys= maxcount;
strpos+= (uint) (error= (int) read_to_buffer(from_file, buffpek, strpos+= (uint) (error= (int) read_to_buffer(from_file, buffpek,
rec_length)); rec_length));
@ -1250,7 +1250,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
} }
} }
buffpek= (BUFFPEK*) queue_top(&queue); buffpek= (BUFFPEK*) queue_top(&queue);
buffpek->base= (byte*) sort_buffer; buffpek->base= (uchar*) sort_buffer;
buffpek->max_keys= param->keys; buffpek->max_keys= param->keys;
/* /*

View File

@ -2767,7 +2767,7 @@ String *Item_xml_str_func::parse_xml(String *raw_xml, String *parsed_xml_buf)
if ((rc= my_xml_parse(&p, raw_xml->ptr(), raw_xml->length())) != MY_XML_OK) if ((rc= my_xml_parse(&p, raw_xml->ptr(), raw_xml->length())) != MY_XML_OK)
{ {
char buf[128]; char buf[128];
my_snprintf(buf, sizeof(buf)-1, "parse error at line %d pos %lu: %s", my_snprintf(buf, sizeof(buf)-1, "parse error at line %d pos %u: %s",
my_xml_error_lineno(&p) + 1, my_xml_error_lineno(&p) + 1,
my_xml_error_pos(&p) + 1, my_xml_error_pos(&p) + 1,
my_xml_error_string(&p)); my_xml_error_string(&p));

View File

@ -548,7 +548,7 @@ MY_LOCALE *my_default_lc_time_names;
SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache; SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache;
SHOW_COMP_OPTION have_geometry, have_rtree_keys; SHOW_COMP_OPTION have_geometry, have_rtree_keys;
SHOW_COMP_OPTION have_crypt, have_compress; SHOW_COMP_OPTION have_crypt, have_compress, have_maria_db;
/* Thread specific variables */ /* Thread specific variables */
@ -1210,7 +1210,7 @@ void clean_up(bool print_message)
xid_cache_free(); xid_cache_free();
delete_elements(&key_caches, (void (*)(const char*, uchar*)) free_key_cache); delete_elements(&key_caches, (void (*)(const char*, uchar*)) free_key_cache);
#ifdef WITH_MARIA_STORAGE_ENGINE #ifdef WITH_MARIA_STORAGE_ENGINE
delete_elements(&pagecaches, (void (*)(const char*, gptr)) free_pagecache); delete_elements(&pagecaches, (void (*)(const char*, uchar*)) free_pagecache);
#endif /* WITH_MARIA_STORAGE_ENGINE */ #endif /* WITH_MARIA_STORAGE_ENGINE */
multi_keycache_free(); multi_keycache_free();
#ifdef WITH_MARIA_STORAGE_ENGINE #ifdef WITH_MARIA_STORAGE_ENGINE
@ -6227,16 +6227,13 @@ The minimum value for this variable is 4096.",
{"pagecache_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD, {"pagecache_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD,
"This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache", "This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache",
(uchar**) &maria_pagecache_var.param_age_threshold, (uchar**) &maria_pagecache_var.param_age_threshold,
(uchar**) 0, (uchar**) 0, 0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
300, 100, ~0L, 0, 100, 0}, 300, 100, ~0L, 0, 100, 0},
{"pagecache_buffer_size", OPT_KEY_BUFFER_SIZE, {"pagecache_buffer_size", OPT_KEY_BUFFER_SIZE,
"The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.", "The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.",
(uchar**) &maria_pagecache_var.param_buff_size, (uchar**) &maria_pagecache_var.param_buff_size,
(uchar**) 0, (uchar**) 0, 0, (GET_ULL | GET_ASK_ADDR), REQUIRED_ARG,
0, (GET_ULL | GET_ASK_ADDR), KEY_CACHE_SIZE, MALLOC_OVERHEAD, ~(ulong) 0, MALLOC_OVERHEAD, IO_SIZE, 0},
REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, ~(ulong) 0, MALLOC_OVERHEAD,
IO_SIZE, KEY_CACHE_SIZE},
{"pagecache_division_limit", OPT_KEY_CACHE_DIVISION_LIMIT, {"pagecache_division_limit", OPT_KEY_CACHE_DIVISION_LIMIT,
"The minimum percentage of warm blocks in key cache", "The minimum percentage of warm blocks in key cache",
(uchar**) &maria_pagecache_var.param_division_limit, (uchar**) &maria_pagecache_var.param_division_limit,
@ -6252,11 +6249,12 @@ The minimum value for this variable is 4096.",
"Optional colon separated list of plugins to load, where each plugin is " "Optional colon separated list of plugins to load, where each plugin is "
"identified by name and path to library seperated by an equals.", "identified by name and path to library seperated by an equals.",
(uchar**) &opt_plugin_load, (uchar**) &opt_plugin_load, 0, (uchar**) &opt_plugin_load, (uchar**) &opt_plugin_load, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE, {"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE,
"The size of the buffer that is allocated when preloading indexes", "The size of the buffer that is allocated when preloading indexes",
(uchar**) &global_system_variables.preload_buff_size, (uchar**) &global_system_variables.preload_buff_size,
(uchar**) &max_system_variables.preload_buff_size, 0, GET_ULONG, (uchar**) &max_system_variables.preload_buff_size, 0, GET_ULONG,
REQUIRED_ARG, 32*1024L, 1024, 1024*1024*1024L, 0, 1, 0}, REQUIRED_ARG, 32*1024L, 1024, 1024*1024*1024L, 0, 1, 0},
{"query_alloc_block_size", OPT_QUERY_ALLOC_BLOCK_SIZE, {"query_alloc_block_size", OPT_QUERY_ALLOC_BLOCK_SIZE,
"Allocation block size for query parsing and execution", "Allocation block size for query parsing and execution",
(uchar**) &global_system_variables.query_alloc_block_size, (uchar**) &global_system_variables.query_alloc_block_size,

View File

@ -345,10 +345,10 @@ static sys_var_thd_enum sys_myisam_stats_method(&vars, "myisam_stats_met
&myisam_stats_method_typelib, &myisam_stats_method_typelib,
NULL); NULL);
sys_var_thd_ulonglong sys_maria_max_sort_file_size("maria_max_sort_file_size", &SV::maria_max_sort_file_size, fix_maria_max_sort_file_size, 1); static sys_var_thd_ulonglong sys_maria_max_sort_file_size(&vars, "maria_max_sort_file_size", &SV::maria_max_sort_file_size, fix_maria_max_sort_file_size, 1);
sys_var_thd_ulong sys_maria_repair_threads("maria_repair_threads", &SV::maria_repair_threads); static sys_var_thd_ulong sys_maria_repair_threads(&vars, "maria_repair_threads", &SV::maria_repair_threads);
sys_var_thd_ulong sys_maria_sort_buffer_size("maria_sort_buffer_size", &SV::maria_sort_buff_size); static sys_var_thd_ulong sys_maria_sort_buffer_size(&vars, "maria_sort_buffer_size", &SV::maria_sort_buff_size);
sys_var_thd_enum sys_maria_stats_method("maria_stats_method", static sys_var_thd_enum sys_maria_stats_method(&vars, "maria_stats_method",
&SV::maria_stats_method, &SV::maria_stats_method,
&myisam_stats_method_typelib, &myisam_stats_method_typelib,
NULL); NULL);
@ -1963,13 +1963,13 @@ uchar *sys_var_key_cache_param::value_ptr(THD *thd, enum_var_type type,
#ifdef WITH_MARIA_STORAGE_ENGINE #ifdef WITH_MARIA_STORAGE_ENGINE
byte *sys_var_pagecache_param::value_ptr(THD *thd, enum_var_type type, uchar *sys_var_pagecache_param::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base) LEX_STRING *base)
{ {
PAGECACHE *pagecache= get_pagecache(base); PAGECACHE *pagecache= get_pagecache(base);
if (!pagecache) if (!pagecache)
pagecache= &zero_pagecache; pagecache= &zero_pagecache;
return (byte*) pagecache + offset ; return (uchar*) pagecache + offset ;
} }
#endif /* WITH_MARIA_STORAGE_ENGINE */ #endif /* WITH_MARIA_STORAGE_ENGINE */
@ -3664,7 +3664,7 @@ static PAGECACHE *create_pagecache(const char *name, uint length)
if ((pagecache= (PAGECACHE*) my_malloc(sizeof(PAGECACHE), if ((pagecache= (PAGECACHE*) my_malloc(sizeof(PAGECACHE),
MYF(MY_ZEROFILL | MY_WME)))) MYF(MY_ZEROFILL | MY_WME))))
{ {
if (!new NAMED_LIST(&pagecaches, name, length, (gptr) pagecache)) if (!new NAMED_LIST(&pagecaches, name, length, (uchar*) pagecache))
{ {
my_free((char*) pagecache, MYF(0)); my_free((char*) pagecache, MYF(0));
pagecache= 0; pagecache= 0;

View File

@ -742,7 +742,7 @@ public:
sys_var_pagecache_param(const char *name_arg, size_t offset_arg) sys_var_pagecache_param(const char *name_arg, size_t offset_arg)
:sys_var(name_arg), offset(offset_arg) :sys_var(name_arg), offset(offset_arg)
{} {}
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check_default(enum_var_type type) { return 1; } bool check_default(enum_var_type type) { return 1; }
bool is_struct() { return 1; } bool is_struct() { return 1; }
}; };

View File

@ -448,7 +448,7 @@ static bool merge_walk(uchar *merge_buffer, ulong merge_buffer_size,
*/ */
for (top= begin; top != end; ++top) for (top= begin; top != end; ++top)
{ {
top->base= (byte*) (merge_buffer + (top - begin) * piece_size); top->base= (uchar*) (merge_buffer + (top - begin) * piece_size);
top->max_keys= max_key_count_per_piece; top->max_keys= max_key_count_per_piece;
bytes_read= read_to_buffer(file, top, key_length); bytes_read= read_to_buffer(file, top, key_length);
if (bytes_read == (uint) (-1)) if (bytes_read == (uint) (-1))

View File

@ -22,8 +22,8 @@
#include "ma_ftdefs.h" #include "ma_ftdefs.h"
FT_INFO *maria_ft_init_search(uint flags, void *info, uint keynr, FT_INFO *maria_ft_init_search(uint flags, void *info, uint keynr,
byte *query, uint query_len, CHARSET_INFO *cs, uchar *query, uint query_len, CHARSET_INFO *cs,
byte *record) uchar *record)
{ {
FT_INFO *res; FT_INFO *res;
if (flags & FT_BOOL) if (flags & FT_BOOL)

View File

@ -142,7 +142,7 @@ int table2maria(TABLE *table_arg, MARIA_KEYDEF **keydef_out,
{ {
uint i, j, recpos, minpos, fieldpos, temp_length, length; uint i, j, recpos, minpos, fieldpos, temp_length, length;
enum ha_base_keytype type= HA_KEYTYPE_BINARY; enum ha_base_keytype type= HA_KEYTYPE_BINARY;
byte *record; uchar *record;
KEY *pos; KEY *pos;
MARIA_KEYDEF *keydef; MARIA_KEYDEF *keydef;
MARIA_COLUMNDEF *recinfo, *recinfo_pos; MARIA_COLUMNDEF *recinfo, *recinfo_pos;
@ -559,7 +559,7 @@ int ha_maria::net_read_dump(NET * net)
error= -1; error= -1;
goto err; goto err;
} }
if (my_write(data_fd, (byte *) net->read_pos, (uint) packet_len, if (my_write(data_fd, (uchar *) net->read_pos, (uint) packet_len,
MYF(MY_WME | MY_FNABP))) MYF(MY_WME | MY_FNABP)))
{ {
error= errno; error= errno;
@ -578,7 +578,7 @@ int ha_maria::dump(THD * thd, int fd)
uint block_size= share->block_size; uint block_size= share->block_size;
my_off_t bytes_to_read= share->state.state.data_file_length; my_off_t bytes_to_read= share->state.state.data_file_length;
int data_fd= file->dfile.file; int data_fd= file->dfile.file;
byte *buf= (byte *) my_malloc(block_size, MYF(MY_WME)); uchar *buf= (uchar *) my_malloc(block_size, MYF(MY_WME));
if (!buf) if (!buf)
return ENOMEM; return ENOMEM;
@ -603,7 +603,7 @@ int ha_maria::dump(THD * thd, int fd)
} }
else else
{ {
if (my_net_write(net, (char*) buf, bytes)) if (my_net_write(net, buf, bytes))
{ {
error= errno ? errno : EPIPE; error= errno ? errno : EPIPE;
goto err; goto err;
@ -614,13 +614,13 @@ int ha_maria::dump(THD * thd, int fd)
if (fd < 0) if (fd < 0)
{ {
if (my_net_write(net, "", 0)) if (my_net_write(net, (uchar*) "", 0))
error= errno ? errno : EPIPE; error= errno ? errno : EPIPE;
net_flush(net); net_flush(net);
} }
err: err:
my_free((gptr) buf, MYF(0)); my_free((uchar*) buf, MYF(0));
return error; return error;
} }
#endif /* HAVE_REPLICATION */ #endif /* HAVE_REPLICATION */
@ -699,10 +699,10 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
for (i= 0; i < table->s->keys; i++) for (i= 0; i < table->s->keys; i++)
{ {
struct st_plugin_int *parser= table->key_info[i].parser; plugin_ref parser= table->key_info[i].parser;
if (table->key_info[i].flags & HA_USES_PARSER) if (table->key_info[i].flags & HA_USES_PARSER)
file->s->keyinfo[i].parser= file->s->keyinfo[i].parser=
(struct st_mysql_ftparser *) parser->plugin->info; (struct st_mysql_ftparser *)plugin_decl(parser)->info;
table->key_info[i].block_size= file->s->keyinfo[i].block_length; table->key_info[i].block_size= file->s->keyinfo[i].block_length;
} }
return (0); return (0);
@ -717,7 +717,7 @@ int ha_maria::close(void)
} }
int ha_maria::write_row(byte * buf) int ha_maria::write_row(uchar * buf)
{ {
statistic_increment(table->in_use->status_var.ha_write_count, &LOCK_status); statistic_increment(table->in_use->status_var.ha_write_count, &LOCK_status);
@ -1210,19 +1210,14 @@ int ha_maria::assign_to_keycache(THD * thd, HA_CHECK_OPT *check_opt)
TABLE_LIST *table_list= table->pos_in_table_list; TABLE_LIST *table_list= table->pos_in_table_list;
DBUG_ENTER("ha_maria::assign_to_keycache"); DBUG_ENTER("ha_maria::assign_to_keycache");
/* Check validity of the index references */ table->keys_in_use_for_query.clear_all();
if (table_list->use_index)
{ if (table_list->process_index_hints(table))
/* We only come here when the user did specify an index map */ DBUG_RETURN(HA_ADMIN_FAILED);
key_map kmap; map= ~(ulonglong) 0;
if (get_key_map_from_key_list(&kmap, table, table_list->use_index)) if (!table->keys_in_use_for_query.is_clear_all())
{ /* use all keys if there's no list specified by the user through hints */
errmsg= thd->net.last_error; map= table->keys_in_use_for_query.to_ulonglong();
error= HA_ADMIN_FAILED;
goto err;
}
map= kmap.to_ulonglong();
}
if ((error= maria_assign_to_pagecache(file, map, new_pagecache))) if ((error= maria_assign_to_pagecache(file, map, new_pagecache)))
{ {
@ -1233,7 +1228,6 @@ int ha_maria::assign_to_keycache(THD * thd, HA_CHECK_OPT *check_opt)
error= HA_ADMIN_CORRUPT; error= HA_ADMIN_CORRUPT;
} }
err:
if (error != HA_ADMIN_OK) if (error != HA_ADMIN_OK)
{ {
/* Send error to user */ /* Send error to user */
@ -1264,20 +1258,16 @@ int ha_maria::preload_keys(THD * thd, HA_CHECK_OPT *check_opt)
DBUG_ENTER("ha_maria::preload_keys"); DBUG_ENTER("ha_maria::preload_keys");
table->keys_in_use_for_query.clear_all();
if (table_list->process_index_hints(table))
DBUG_RETURN(HA_ADMIN_FAILED);
map= ~(ulonglong) 0;
/* Check validity of the index references */ /* Check validity of the index references */
if (table_list->use_index) if (!table->keys_in_use_for_query.is_clear_all())
{ /* use all keys if there's no list specified by the user through hints */
key_map kmap; map= table->keys_in_use_for_query.to_ulonglong();
get_key_map_from_key_list(&kmap, table, table_list->use_index);
if (kmap.is_set_all())
{
errmsg= thd->net.last_error;
error= HA_ADMIN_FAILED;
goto err;
}
if (!kmap.is_clear_all())
map= kmap.to_ulonglong();
}
maria_extra(file, HA_EXTRA_PRELOAD_BUFFER_SIZE, maria_extra(file, HA_EXTRA_PRELOAD_BUFFER_SIZE,
(void*) &thd->variables.preload_buff_size); (void*) &thd->variables.preload_buff_size);
@ -1599,7 +1589,7 @@ bool ha_maria::is_crashed() const
} }
int ha_maria::update_row(const byte * old_data, byte * new_data) int ha_maria::update_row(const uchar * old_data, uchar * new_data)
{ {
statistic_increment(table->in_use->status_var.ha_update_count, &LOCK_status); statistic_increment(table->in_use->status_var.ha_update_count, &LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
@ -1608,14 +1598,14 @@ int ha_maria::update_row(const byte * old_data, byte * new_data)
} }
int ha_maria::delete_row(const byte * buf) int ha_maria::delete_row(const uchar * buf)
{ {
statistic_increment(table->in_use->status_var.ha_delete_count, &LOCK_status); statistic_increment(table->in_use->status_var.ha_delete_count, &LOCK_status);
return maria_delete(file, buf); return maria_delete(file, buf);
} }
int ha_maria::index_read(byte * buf, const byte * key, int ha_maria::index_read(uchar * buf, const uchar * key,
uint key_len, enum ha_rkey_function find_flag) uint key_len, enum ha_rkey_function find_flag)
{ {
DBUG_ASSERT(inited == INDEX); DBUG_ASSERT(inited == INDEX);
@ -1627,7 +1617,7 @@ int ha_maria::index_read(byte * buf, const byte * key,
} }
int ha_maria::index_read_idx(byte * buf, uint index, const byte * key, int ha_maria::index_read_idx(uchar * buf, uint index, const uchar * key,
uint key_len, enum ha_rkey_function find_flag) uint key_len, enum ha_rkey_function find_flag)
{ {
statistic_increment(table->in_use->status_var.ha_read_key_count, statistic_increment(table->in_use->status_var.ha_read_key_count,
@ -1638,7 +1628,7 @@ int ha_maria::index_read_idx(byte * buf, uint index, const byte * key,
} }
int ha_maria::index_read_last(byte * buf, const byte * key, uint key_len) int ha_maria::index_read_last(uchar * buf, const uchar * key, uint key_len)
{ {
DBUG_ENTER("ha_maria::index_read_last"); DBUG_ENTER("ha_maria::index_read_last");
DBUG_ASSERT(inited == INDEX); DBUG_ASSERT(inited == INDEX);
@ -1651,7 +1641,7 @@ int ha_maria::index_read_last(byte * buf, const byte * key, uint key_len)
} }
int ha_maria::index_next(byte * buf) int ha_maria::index_next(uchar * buf)
{ {
DBUG_ASSERT(inited == INDEX); DBUG_ASSERT(inited == INDEX);
statistic_increment(table->in_use->status_var.ha_read_next_count, statistic_increment(table->in_use->status_var.ha_read_next_count,
@ -1662,7 +1652,7 @@ int ha_maria::index_next(byte * buf)
} }
int ha_maria::index_prev(byte * buf) int ha_maria::index_prev(uchar * buf)
{ {
DBUG_ASSERT(inited == INDEX); DBUG_ASSERT(inited == INDEX);
statistic_increment(table->in_use->status_var.ha_read_prev_count, statistic_increment(table->in_use->status_var.ha_read_prev_count,
@ -1673,7 +1663,7 @@ int ha_maria::index_prev(byte * buf)
} }
int ha_maria::index_first(byte * buf) int ha_maria::index_first(uchar * buf)
{ {
DBUG_ASSERT(inited == INDEX); DBUG_ASSERT(inited == INDEX);
statistic_increment(table->in_use->status_var.ha_read_first_count, statistic_increment(table->in_use->status_var.ha_read_first_count,
@ -1684,7 +1674,7 @@ int ha_maria::index_first(byte * buf)
} }
int ha_maria::index_last(byte * buf) int ha_maria::index_last(uchar * buf)
{ {
DBUG_ASSERT(inited == INDEX); DBUG_ASSERT(inited == INDEX);
statistic_increment(table->in_use->status_var.ha_read_last_count, statistic_increment(table->in_use->status_var.ha_read_last_count,
@ -1695,8 +1685,8 @@ int ha_maria::index_last(byte * buf)
} }
int ha_maria::index_next_same(byte * buf, int ha_maria::index_next_same(uchar * buf,
const byte *key __attribute__ ((unused)), const uchar *key __attribute__ ((unused)),
uint length __attribute__ ((unused))) uint length __attribute__ ((unused)))
{ {
DBUG_ASSERT(inited == INDEX); DBUG_ASSERT(inited == INDEX);
@ -1724,7 +1714,7 @@ int ha_maria::rnd_end()
} }
int ha_maria::rnd_next(byte *buf) int ha_maria::rnd_next(uchar *buf)
{ {
statistic_increment(table->in_use->status_var.ha_read_rnd_next_count, statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
&LOCK_status); &LOCK_status);
@ -1734,13 +1724,13 @@ int ha_maria::rnd_next(byte *buf)
} }
int ha_maria::restart_rnd_next(byte *buf, byte *pos) int ha_maria::restart_rnd_next(uchar *buf, uchar *pos)
{ {
return rnd_pos(buf, pos); return rnd_pos(buf, pos);
} }
int ha_maria::rnd_pos(byte * buf, byte *pos) int ha_maria::rnd_pos(uchar * buf, uchar *pos)
{ {
statistic_increment(table->in_use->status_var.ha_read_rnd_count, statistic_increment(table->in_use->status_var.ha_read_rnd_count,
&LOCK_status); &LOCK_status);
@ -1750,7 +1740,7 @@ int ha_maria::rnd_pos(byte * buf, byte *pos)
} }
void ha_maria::position(const byte * record) void ha_maria::position(const uchar * record)
{ {
my_off_t row_position= maria_position(file); my_off_t row_position= maria_position(file);
my_store_ptr(ref, ref_length, row_position); my_store_ptr(ref, ref_length, row_position);
@ -2052,7 +2042,7 @@ int ha_maria::create(const char *name, register TABLE *table_arg,
0, (MARIA_UNIQUEDEF *) 0, 0, (MARIA_UNIQUEDEF *) 0,
&create_info, create_flags); &create_info, create_flags);
my_free((gptr) recinfo, MYF(0)); my_free((uchar*) recinfo, MYF(0));
DBUG_RETURN(error); DBUG_RETURN(error);
} }
@ -2070,7 +2060,7 @@ void ha_maria::get_auto_increment(ulonglong offset, ulonglong increment,
{ {
ulonglong nr; ulonglong nr;
int error; int error;
byte key[HA_MAX_KEY_LENGTH]; uchar key[HA_MAX_KEY_LENGTH];
if (!table->s->next_number_key_offset) if (!table->s->next_number_key_offset)
{ // Autoincrement at key-start { // Autoincrement at key-start
@ -2142,7 +2132,7 @@ ha_rows ha_maria::records_in_range(uint inx, key_range *min_key,
} }
int ha_maria::ft_read(byte * buf) int ha_maria::ft_read(uchar * buf)
{ {
int error; int error;

View File

@ -77,19 +77,19 @@ public:
bool called_by_logger_thread); bool called_by_logger_thread);
int open(const char *name, int mode, uint test_if_locked); int open(const char *name, int mode, uint test_if_locked);
int close(void); int close(void);
int write_row(byte * buf); int write_row(uchar * buf);
int update_row(const byte * old_data, byte * new_data); int update_row(const uchar * old_data, uchar * new_data);
int delete_row(const byte * buf); int delete_row(const uchar * buf);
int index_read(byte * buf, const byte * key, int index_read(uchar * buf, const uchar * key,
uint key_len, enum ha_rkey_function find_flag); uint key_len, enum ha_rkey_function find_flag);
int index_read_idx(byte * buf, uint idx, const byte * key, int index_read_idx(uchar * buf, uint idx, const uchar * key,
uint key_len, enum ha_rkey_function find_flag); uint key_len, enum ha_rkey_function find_flag);
int index_read_last(byte * buf, const byte * key, uint key_len); int index_read_last(uchar * buf, const uchar * key, uint key_len);
int index_next(byte * buf); int index_next(uchar * buf);
int index_prev(byte * buf); int index_prev(uchar * buf);
int index_first(byte * buf); int index_first(uchar * buf);
int index_last(byte * buf); int index_last(uchar * buf);
int index_next_same(byte * buf, const byte * key, uint keylen); int index_next_same(uchar * buf, const uchar * key, uint keylen);
int ft_init() int ft_init()
{ {
if (!ft_handler) if (!ft_handler)
@ -100,16 +100,16 @@ public:
FT_INFO *ft_init_ext(uint flags, uint inx, String * key) FT_INFO *ft_init_ext(uint flags, uint inx, String * key)
{ {
return maria_ft_init_search(flags, file, inx, return maria_ft_init_search(flags, file, inx,
(byte *) key->ptr(), key->length(), (uchar *) key->ptr(), key->length(),
key->charset(), table->record[0]); key->charset(), table->record[0]);
} }
int ft_read(byte * buf); int ft_read(uchar * buf);
int rnd_init(bool scan); int rnd_init(bool scan);
int rnd_end(void); int rnd_end(void);
int rnd_next(byte * buf); int rnd_next(uchar * buf);
int rnd_pos(byte * buf, byte * pos); int rnd_pos(uchar * buf, uchar * pos);
int restart_rnd_next(byte * buf, byte * pos); int restart_rnd_next(uchar * buf, uchar * pos);
void position(const byte * record); void position(const uchar * record);
int info(uint); int info(uint);
int extra(enum ha_extra_function operation); int extra(enum ha_extra_function operation);
int extra_opt(enum ha_extra_function operation, ulong cache_size); int extra_opt(enum ha_extra_function operation, ulong cache_size);

View File

@ -132,7 +132,7 @@ static inline my_bool write_changed_bitmap(MARIA_SHARE *share,
DBUG_ASSERT(share->pagecache->block_size == bitmap->block_size); DBUG_ASSERT(share->pagecache->block_size == bitmap->block_size);
return (pagecache_write(share->pagecache, return (pagecache_write(share->pagecache,
&bitmap->file, bitmap->page, 0, &bitmap->file, bitmap->page, 0,
(byte*) bitmap->map, PAGECACHE_PLAIN_PAGE, (uchar*) bitmap->map, PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED, PAGECACHE_LOCK_LEFT_UNLOCKED,
PAGECACHE_PIN_LEFT_UNPINNED, PAGECACHE_PIN_LEFT_UNPINNED,
PAGECACHE_WRITE_DELAY, 0)); PAGECACHE_WRITE_DELAY, 0));
@ -224,7 +224,7 @@ my_bool _ma_bitmap_end(MARIA_SHARE *share)
{ {
my_bool res= _ma_flush_bitmap(share); my_bool res= _ma_flush_bitmap(share);
pthread_mutex_destroy(&share->bitmap.bitmap_lock); pthread_mutex_destroy(&share->bitmap.bitmap_lock);
my_free((byte*) share->bitmap.map, MYF(MY_ALLOW_ZERO_PTR)); my_free((uchar*) share->bitmap.map, MYF(MY_ALLOW_ZERO_PTR));
share->bitmap.map= 0; share->bitmap.map= 0;
return res; return res;
} }
@ -514,7 +514,7 @@ static my_bool _ma_read_bitmap_page(MARIA_SHARE *share,
DBUG_ASSERT(share->pagecache->block_size == bitmap->block_size); DBUG_ASSERT(share->pagecache->block_size == bitmap->block_size);
res= pagecache_read(share->pagecache, res= pagecache_read(share->pagecache,
(PAGECACHE_FILE*)&bitmap->file, page, 0, (PAGECACHE_FILE*)&bitmap->file, page, 0,
(byte*) bitmap->map, (uchar*) bitmap->map,
PAGECACHE_PLAIN_PAGE, PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED, 0) == 0; PAGECACHE_LOCK_LEFT_UNLOCKED, 0) == 0;
#ifndef DBUG_OFF #ifndef DBUG_OFF
@ -607,7 +607,7 @@ static my_bool move_to_next_bitmap(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap)
fill_block() fill_block()
bitmap Bitmap handle bitmap Bitmap handle
block Store data about what we found block Store data about what we found
best_data Pointer to best 6 byte aligned area in bitmap->map best_data Pointer to best 6 uchar aligned area in bitmap->map
best_pos Which bit in *best_data the area starts best_pos Which bit in *best_data the area starts
0 = first bit pattern, 1 second bit pattern etc 0 = first bit pattern, 1 second bit pattern etc
best_bits The original value of the bits at best_pos best_bits The original value of the bits at best_pos
@ -997,7 +997,7 @@ static ulong allocate_full_pages(MARIA_FILE_BITMAP *bitmap,
best_data+= size; best_data+= size;
if ((best_area_size-= size * 8)) if ((best_area_size-= size * 8))
{ {
/* fill last byte */ /* fill last uchar */
*best_data|= (uchar) ((1 << best_area_size) -1); *best_data|= (uchar) ((1 << best_area_size) -1);
best_data++; best_data++;
} }
@ -1857,7 +1857,7 @@ err:
1 error (Couldn't write or read bitmap page) 1 error (Couldn't write or read bitmap page)
*/ */
my_bool _ma_bitmap_free_full_pages(MARIA_HA *info, const byte *extents, my_bool _ma_bitmap_free_full_pages(MARIA_HA *info, const uchar *extents,
uint count) uint count)
{ {
DBUG_ENTER("_ma_bitmap_free_full_pages"); DBUG_ENTER("_ma_bitmap_free_full_pages");

View File

@ -53,8 +53,8 @@
Page header: Page header:
LSN 7 bytes Log position for last page change LSN 7 bytes Log position for last page change
PAGE_TYPE 1 byte 1 for head / 2 for tail / 3 for blob PAGE_TYPE 1 uchar 1 for head / 2 for tail / 3 for blob
NO 1 byte Number of row/tail entries on page NO 1 uchar Number of row/tail entries on page
empty space 2 bytes Empty space on page empty space 2 bytes Empty space on page
The most significant bit in PAGE_TYPE is set to 1 if the data on the page The most significant bit in PAGE_TYPE is set to 1 if the data on the page
@ -72,7 +72,7 @@
the 1 most significant bit of the length could be used for some states of the 1 most significant bit of the length could be used for some states of
the row (in other words, we should try to keep these reserved) the row (in other words, we should try to keep these reserved)
eof flag 1 byte Reserved for full page read testing. (Ie, did the eof flag 1 uchar Reserved for full page read testing. (Ie, did the
previous write get the whole block on disk. previous write get the whole block on disk.
---------------- ----------------
@ -80,7 +80,7 @@
Structure of blob pages: Structure of blob pages:
LSN 7 bytes Log position for last page change LSN 7 bytes Log position for last page change
PAGE_TYPE 1 byte 3 PAGE_TYPE 1 uchar 3
data data
@ -88,7 +88,7 @@
Row data structure: Row data structure:
Flag 1 byte Marker of which header field exists Flag 1 uchar Marker of which header field exists
TRANSID 6 bytes TRANSID of changing transaction TRANSID 6 bytes TRANSID of changing transaction
(optional, added on insert and first (optional, added on insert and first
update/delete) update/delete)
@ -98,17 +98,17 @@
update/delete) update/delete)
DELETE_TRANSID 6 bytes (optional). TRANSID of original row. DELETE_TRANSID 6 bytes (optional). TRANSID of original row.
Added on delete. Added on delete.
Nulls_extended 1 byte To allow us to add new DEFAULT NULL Nulls_extended 1 uchar To allow us to add new DEFAULT NULL
fields (optional, added after first fields (optional, added after first
change of row after alter table) change of row after alter table)
Number of ROW_EXTENT's 1-3 byte Length encoded, optional Number of ROW_EXTENT's 1-3 uchar Length encoded, optional
This is the number of extents the This is the number of extents the
row is split into row is split into
First row_extent 7 byte Pointer to first row extent (optional) First row_extent 7 uchar Pointer to first row extent (optional)
Total length of length array 1-3 byte Only used if we have Total length of length array 1-3 uchar Only used if we have
char/varchar/blob fields. char/varchar/blob fields.
Row checksum 1 byte Only if table created with checksums Row checksum 1 uchar Only if table created with checksums
Null_bits .. One bit for each NULL field (a field that may Null_bits .. One bit for each NULL field (a field that may
have the value NULL) have the value NULL)
Empty_bits .. One bit for each field that may be 'empty'. Empty_bits .. One bit for each field that may be 'empty'.
@ -137,7 +137,7 @@
Critical fixed length, not null, fields. (Note, these can't be dropped) Critical fixed length, not null, fields. (Note, these can't be dropped)
Fixed length, null fields Fixed length, null fields
Length array, 1-4 byte per field for all CHAR/VARCHAR/BLOB fields. Length array, 1-4 uchar per field for all CHAR/VARCHAR/BLOB fields.
Number of bytes used in length array per entry is depending on max length Number of bytes used in length array per entry is depending on max length
for field. for field.
@ -272,12 +272,12 @@
typedef struct st_maria_extent_cursor typedef struct st_maria_extent_cursor
{ {
/* /*
Pointer to packed byte array of extents for the row. Pointer to packed uchar array of extents for the row.
Format is described above in the header Format is described above in the header
*/ */
byte *extent; uchar *extent;
/* Where data starts on page; Only for debugging */ /* Where data starts on page; Only for debugging */
byte *data_start; uchar *data_start;
/* Position to all tails in the row. Updated when reading a row */ /* Position to all tails in the row. Updated when reading a row */
MARIA_RECORD_POS *tail_positions; MARIA_RECORD_POS *tail_positions;
/* Current page */ /* Current page */
@ -300,16 +300,16 @@ static my_bool delete_tails(MARIA_HA *info, MARIA_RECORD_POS *tails);
static my_bool delete_head_or_tail(MARIA_HA *info, static my_bool delete_head_or_tail(MARIA_HA *info,
ulonglong page, uint record_number, ulonglong page, uint record_number,
my_bool head); my_bool head);
static void _ma_print_directory(byte *buff, uint block_size); static void _ma_print_directory(uchar *buff, uint block_size);
static void compact_page(byte *buff, uint block_size, uint rownr, static void compact_page(uchar *buff, uint block_size, uint rownr,
my_bool extend_block); my_bool extend_block);
static uchar *store_page_range(uchar *to, MARIA_BITMAP_BLOCK *block, static uchar *store_page_range(uchar *to, MARIA_BITMAP_BLOCK *block,
uint block_size, ulong length); uint block_size, ulong length);
static size_t fill_insert_undo_parts(MARIA_HA *info, const byte *record, static size_t fill_insert_undo_parts(MARIA_HA *info, const uchar *record,
LEX_STRING *log_parts, LEX_STRING *log_parts,
uint *log_parts_count); uint *log_parts_count);
static size_t fill_update_undo_parts(MARIA_HA *info, const byte *oldrec, static size_t fill_update_undo_parts(MARIA_HA *info, const uchar *oldrec,
const byte *newrec, const uchar *newrec,
LEX_STRING *log_parts, LEX_STRING *log_parts,
uint *log_parts_count); uint *log_parts_count);
@ -358,7 +358,7 @@ void _ma_init_block_record_data(void)
{ {
uint i; uint i;
bzero(total_header_size, sizeof(total_header_size)); bzero(total_header_size, sizeof(total_header_size));
total_header_size[0]= FLAG_SIZE; /* Flag byte */ total_header_size[0]= FLAG_SIZE; /* Flag uchar */
for (i= 1; i < array_elements(total_header_size); i++) for (i= 1; i < array_elements(total_header_size); i++)
{ {
uint size= FLAG_SIZE, j, bit; uint size= FLAG_SIZE, j, bit;
@ -484,10 +484,10 @@ err:
void _ma_end_block_record(MARIA_HA *info) void _ma_end_block_record(MARIA_HA *info)
{ {
DBUG_ENTER("_ma_end_block_record"); DBUG_ENTER("_ma_end_block_record");
my_free((gptr) info->cur_row.empty_bits, MYF(MY_ALLOW_ZERO_PTR)); my_free((uchar*) info->cur_row.empty_bits, MYF(MY_ALLOW_ZERO_PTR));
delete_dynamic(&info->bitmap_blocks); delete_dynamic(&info->bitmap_blocks);
delete_dynamic(&info->pinned_pages); delete_dynamic(&info->pinned_pages);
my_free((gptr) info->cur_row.extents, MYF(MY_ALLOW_ZERO_PTR)); my_free((uchar*) info->cur_row.extents, MYF(MY_ALLOW_ZERO_PTR));
/* /*
The data file is closed, when needed, in ma_once_end_block_record(). The data file is closed, when needed, in ma_once_end_block_record().
The following protects us from doing an extra, not allowed, close The following protects us from doing an extra, not allowed, close
@ -503,7 +503,7 @@ void _ma_end_block_record(MARIA_HA *info)
****************************************************************************/ ****************************************************************************/
/* /*
Return the next used byte on the page after a directory entry. Return the next used uchar on the page after a directory entry.
SYNOPSIS SYNOPSIS
start_of_next_entry() start_of_next_entry()
@ -514,9 +514,9 @@ void _ma_end_block_record(MARIA_HA *info)
Everything between the '*dir' and this are free to be used. Everything between the '*dir' and this are free to be used.
*/ */
static inline uint start_of_next_entry(byte *dir) static inline uint start_of_next_entry(uchar *dir)
{ {
byte *prev; uchar *prev;
/* /*
Find previous used entry. (There is always a previous entry as Find previous used entry. (There is always a previous entry as
the directory never starts with a deleted entry) the directory never starts with a deleted entry)
@ -541,9 +541,9 @@ static inline uint start_of_next_entry(byte *dir)
Used mainly to detect rows with wrong extent information Used mainly to detect rows with wrong extent information
*/ */
static my_bool check_if_zero(byte *pos, uint length) static my_bool check_if_zero(uchar *pos, uint length)
{ {
byte *end; uchar *end;
for (end= pos+ length; pos != end ; pos++) for (end= pos+ length; pos != end ; pos++)
if (pos[0] != 0) if (pos[0] != 0)
return 1; return 1;
@ -636,12 +636,12 @@ void _ma_unpin_all_pages(MARIA_HA *info, LSN undo_lsn)
# Pointer to directory entry on page # Pointer to directory entry on page
*/ */
static byte *find_free_position(byte *buff, uint block_size, uint *res_rownr, static uchar *find_free_position(uchar *buff, uint block_size, uint *res_rownr,
uint *res_length, uint *empty_space) uint *res_length, uint *empty_space)
{ {
uint max_entry= (uint) ((uchar*) buff)[DIR_COUNT_OFFSET]; uint max_entry= (uint) ((uchar*) buff)[DIR_COUNT_OFFSET];
uint entry, length, first_pos; uint entry, length, first_pos;
byte *dir, *end; uchar *dir, *end;
DBUG_ENTER("find_free_position"); DBUG_ENTER("find_free_position");
DBUG_PRINT("info", ("max_entry: %u", max_entry)); DBUG_PRINT("info", ("max_entry: %u", max_entry));
@ -680,7 +680,7 @@ static byte *find_free_position(byte *buff, uint block_size, uint *res_rownr,
uint2korr(end + DIR_ENTRY_SIZE+ 2)); uint2korr(end + DIR_ENTRY_SIZE+ 2));
*empty_space= uint2korr(buff + EMPTY_SPACE_OFFSET); *empty_space= uint2korr(buff + EMPTY_SPACE_OFFSET);
} }
buff[DIR_COUNT_OFFSET]= (byte) (uchar) max_entry+1; buff[DIR_COUNT_OFFSET]= (uchar) (uchar) max_entry+1;
length= (uint) (dir - buff - first_pos); length= (uint) (dir - buff - first_pos);
DBUG_ASSERT(length <= *empty_space - DIR_ENTRY_SIZE); DBUG_ASSERT(length <= *empty_space - DIR_ENTRY_SIZE);
int2store(dir, first_pos); int2store(dir, first_pos);
@ -713,11 +713,11 @@ static byte *find_free_position(byte *buff, uint block_size, uint *res_rownr,
extents. extents.
*/ */
static void calc_record_size(MARIA_HA *info, const byte *record, static void calc_record_size(MARIA_HA *info, const uchar *record,
MARIA_ROW *row) MARIA_ROW *row)
{ {
MARIA_SHARE *share= info->s; MARIA_SHARE *share= info->s;
byte *field_length_data; uchar *field_length_data;
MARIA_COLUMNDEF *column, *end_column; MARIA_COLUMNDEF *column, *end_column;
uint *null_field_lengths= row->null_field_lengths; uint *null_field_lengths= row->null_field_lengths;
ulong *blob_lengths= row->blob_lengths; ulong *blob_lengths= row->blob_lengths;
@ -778,7 +778,7 @@ static void calc_record_size(MARIA_HA *info, const byte *record,
{ {
uint length= (end - pos); uint length= (end - pos);
if (column->length <= 255) if (column->length <= 255)
*field_length_data++= (byte) (uchar) length; *field_length_data++= (uchar) length;
else else
{ {
int2store(field_length_data, length); int2store(field_length_data, length);
@ -792,8 +792,8 @@ static void calc_record_size(MARIA_HA *info, const byte *record,
case FIELD_VARCHAR: case FIELD_VARCHAR:
{ {
uint length, field_length_data_length; uint length, field_length_data_length;
const byte *field_pos= record + column->offset; const uchar *field_pos= record + column->offset;
/* 256 is correct as this includes the length byte */ /* 256 is correct as this includes the length uchar */
field_length_data[0]= field_pos[0]; field_length_data[0]= field_pos[0];
if (column->length <= 256) if (column->length <= 256)
@ -820,7 +820,7 @@ static void calc_record_size(MARIA_HA *info, const byte *record,
} }
case FIELD_BLOB: case FIELD_BLOB:
{ {
const byte *field_pos= record + column->offset; const uchar *field_pos= record + column->offset;
uint size_length= column->length - portable_sizeof_char_ptr; uint size_length= column->length - portable_sizeof_char_ptr;
ulong blob_length= _ma_calc_blob_length(size_length, field_pos); ulong blob_length= _ma_calc_blob_length(size_length, field_pos);
@ -872,12 +872,12 @@ static void calc_record_size(MARIA_HA *info, const byte *record,
*/ */
static void compact_page(byte *buff, uint block_size, uint rownr, static void compact_page(uchar *buff, uint block_size, uint rownr,
my_bool extend_block) my_bool extend_block)
{ {
uint max_entry= (uint) ((uchar *) buff)[DIR_COUNT_OFFSET]; uint max_entry= (uint) ((uchar *) buff)[DIR_COUNT_OFFSET];
uint page_pos, next_free_pos, start_of_found_block, diff, end_of_found_block; uint page_pos, next_free_pos, start_of_found_block, diff, end_of_found_block;
byte *dir, *end; uchar *dir, *end;
DBUG_ENTER("compact_page"); DBUG_ENTER("compact_page");
DBUG_PRINT("enter", ("rownr: %u", rownr)); DBUG_PRINT("enter", ("rownr: %u", rownr));
DBUG_ASSERT(max_entry > 0 && DBUG_ASSERT(max_entry > 0 &&
@ -978,7 +978,7 @@ static void compact_page(byte *buff, uint block_size, uint rownr,
uint length= (uint) (dir - buff) - start_of_found_block; uint length= (uint) (dir - buff) - start_of_found_block;
int2store(dir+2, length); int2store(dir+2, length);
} }
buff[PAGE_TYPE_OFFSET]&= ~(byte) PAGE_CAN_BE_COMPACTED; buff[PAGE_TYPE_OFFSET]&= ~(uchar) PAGE_CAN_BE_COMPACTED;
} }
DBUG_EXECUTE("directory", _ma_print_directory(buff, block_size);); DBUG_EXECUTE("directory", _ma_print_directory(buff, block_size););
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -1009,9 +1009,9 @@ static void compact_page(byte *buff, uint block_size, uint rownr,
struct st_row_pos_info struct st_row_pos_info
{ {
byte *buff; /* page buffer */ uchar *buff; /* page buffer */
byte *data; /* Place for data */ uchar *data; /* Place for data */
byte *dir; /* Directory */ uchar *dir; /* Directory */
uint length; /* Length for data */ uint length; /* Length for data */
uint rownr; /* Offset in directory */ uint rownr; /* Offset in directory */
uint empty_space; /* Space left on page */ uint empty_space; /* Space left on page */
@ -1019,7 +1019,7 @@ struct st_row_pos_info
static my_bool get_head_or_tail_page(MARIA_HA *info, static my_bool get_head_or_tail_page(MARIA_HA *info,
MARIA_BITMAP_BLOCK *block, MARIA_BITMAP_BLOCK *block,
byte *buff, uint length, uint page_type, uchar *buff, uint length, uint page_type,
enum pagecache_page_lock lock, enum pagecache_page_lock lock,
struct st_row_pos_info *res) struct st_row_pos_info *res)
{ {
@ -1043,7 +1043,7 @@ static my_bool get_head_or_tail_page(MARIA_HA *info,
*/ */
bzero(buff+ PAGE_HEADER_SIZE, block_size - PAGE_HEADER_SIZE); bzero(buff+ PAGE_HEADER_SIZE, block_size - PAGE_HEADER_SIZE);
buff[PAGE_TYPE_OFFSET]= (byte) page_type; buff[PAGE_TYPE_OFFSET]= (uchar) page_type;
buff[DIR_COUNT_OFFSET]= 1; buff[DIR_COUNT_OFFSET]= 1;
res->buff= buff; res->buff= buff;
res->empty_space= res->length= (block_size - PAGE_OVERHEAD_SIZE); res->empty_space= res->length= (block_size - PAGE_OVERHEAD_SIZE);
@ -1056,7 +1056,7 @@ static my_bool get_head_or_tail_page(MARIA_HA *info,
} }
else else
{ {
byte *dir; uchar *dir;
/* Read old page */ /* Read old page */
DBUG_ASSERT(share->pagecache->block_size == block_size); DBUG_ASSERT(share->pagecache->block_size == block_size);
if (!(res->buff= pagecache_read(share->pagecache, if (!(res->buff= pagecache_read(share->pagecache,
@ -1120,7 +1120,7 @@ crashed:
static my_bool write_tail(MARIA_HA *info, static my_bool write_tail(MARIA_HA *info,
MARIA_BITMAP_BLOCK *block, MARIA_BITMAP_BLOCK *block,
byte *row_part, uint length) uchar *row_part, uint length)
{ {
MARIA_SHARE *share= share= info->s; MARIA_SHARE *share= share= info->s;
MARIA_PINNED_PAGE page_link; MARIA_PINNED_PAGE page_link;
@ -1237,13 +1237,13 @@ static my_bool write_tail(MARIA_HA *info,
static my_bool write_full_pages(MARIA_HA *info, static my_bool write_full_pages(MARIA_HA *info,
LSN lsn, LSN lsn,
MARIA_BITMAP_BLOCK *block, MARIA_BITMAP_BLOCK *block,
byte *data, ulong length) uchar *data, ulong length)
{ {
my_off_t page; my_off_t page;
MARIA_SHARE *share= share= info->s; MARIA_SHARE *share= share= info->s;
uint block_size= share->block_size; uint block_size= share->block_size;
uint data_size= FULL_PAGE_SIZE(block_size); uint data_size= FULL_PAGE_SIZE(block_size);
byte *buff= info->keyread_buff; uchar *buff= info->keyread_buff;
uint page_count; uint page_count;
my_off_t position; my_off_t position;
DBUG_ENTER("write_full_pages"); DBUG_ENTER("write_full_pages");
@ -1277,7 +1277,7 @@ static my_bool write_full_pages(MARIA_HA *info,
info->state->data_file_length= position; info->state->data_file_length= position;
} }
lsn_store(buff, lsn); lsn_store(buff, lsn);
buff[PAGE_TYPE_OFFSET]= (byte) BLOB_PAGE; buff[PAGE_TYPE_OFFSET]= (uchar) BLOB_PAGE;
copy_length= min(data_size, length); copy_length= min(data_size, length);
memcpy(buff + LSN_SIZE + PAGE_TYPE_SIZE, data, copy_length); memcpy(buff + LSN_SIZE + PAGE_TYPE_SIZE, data, copy_length);
length-= copy_length; length-= copy_length;
@ -1354,8 +1354,8 @@ static uchar *store_page_range(uchar *to, MARIA_BITMAP_BLOCK *block,
We don't have to store the position for the head block We don't have to store the position for the head block
*/ */
static void store_extent_info(byte *to, static void store_extent_info(uchar *to,
byte *row_extents_second_part, uchar *row_extents_second_part,
MARIA_BITMAP_BLOCK *first_block, MARIA_BITMAP_BLOCK *first_block,
uint count) uint count)
{ {
@ -1385,7 +1385,7 @@ static void store_extent_info(byte *to,
In some unlikely cases we have allocated to many blocks. Clear this In some unlikely cases we have allocated to many blocks. Clear this
data. data.
*/ */
bzero(to, (my_size_t) (row_extents_second_part + copy_length - to)); bzero(to, (size_t) (row_extents_second_part + copy_length - to));
} }
@ -1494,16 +1494,16 @@ static my_bool free_full_page_range(MARIA_HA *info, ulonglong page, uint count)
*/ */
static my_bool write_block_record(MARIA_HA *info, static my_bool write_block_record(MARIA_HA *info,
const byte *old_record, const byte *record, const uchar *old_record, const uchar *record,
MARIA_ROW *row, MARIA_ROW *row,
MARIA_BITMAP_BLOCKS *bitmap_blocks, MARIA_BITMAP_BLOCKS *bitmap_blocks,
my_bool head_block_is_read, my_bool head_block_is_read,
struct st_row_pos_info *row_pos) struct st_row_pos_info *row_pos)
{ {
byte *data, *end_of_data, *tmp_data_used, *tmp_data; uchar *data, *end_of_data, *tmp_data_used, *tmp_data;
byte *row_extents_first_part, *row_extents_second_part; uchar *row_extents_first_part, *row_extents_second_part;
byte *field_length_data; uchar *field_length_data;
byte *page_buff; uchar *page_buff;
MARIA_BITMAP_BLOCK *block, *head_block; MARIA_BITMAP_BLOCK *block, *head_block;
MARIA_SHARE *share= info->s; MARIA_SHARE *share= info->s;
MARIA_COLUMNDEF *column, *end_column; MARIA_COLUMNDEF *column, *end_column;
@ -1552,7 +1552,7 @@ static my_bool write_block_record(MARIA_HA *info,
if (share->base.pack_fields) if (share->base.pack_fields)
store_key_length_inc(data, row->field_lengths_length); store_key_length_inc(data, row->field_lengths_length);
if (share->calc_checksum) if (share->calc_checksum)
*(data++)= (byte) info->cur_row.checksum; *(data++)= (uchar) info->cur_row.checksum;
memcpy(data, record, share->base.null_bytes); memcpy(data, record, share->base.null_bytes);
data+= share->base.null_bytes; data+= share->base.null_bytes;
memcpy(data, row->empty_bits, share->base.pack_bytes); memcpy(data, row->empty_bits, share->base.pack_bytes);
@ -1572,7 +1572,7 @@ static my_bool write_block_record(MARIA_HA *info,
row->head_length)) row->head_length))
DBUG_RETURN(1); DBUG_RETURN(1);
tmp_data_used= 0; /* Either 0 or last used byte in 'data' */ tmp_data_used= 0; /* Either 0 or last used uchar in 'data' */
tmp_data= data; tmp_data= data;
if (row_extents_in_use) if (row_extents_in_use)
@ -1620,7 +1620,7 @@ static my_bool write_block_record(MARIA_HA *info,
column < end_column ; column < end_column ;
column++) column++)
{ {
const byte *field_pos; const uchar *field_pos;
ulong length; ulong length;
if ((record[column->null_pos] & column->null_bit) || if ((record[column->null_pos] & column->null_bit) ||
(row->empty_bits[column->empty_pos] & column->empty_bit)) (row->empty_bits[column->empty_pos] & column->empty_bit))
@ -1647,7 +1647,7 @@ static my_bool write_block_record(MARIA_HA *info,
if (column->length <= 256) if (column->length <= 256)
{ {
length= (uint) (uchar) *field_length_data++; length= (uint) (uchar) *field_length_data++;
field_pos++; /* Skip length byte */ field_pos++; /* Skip length uchar */
} }
else else
{ {
@ -1681,12 +1681,12 @@ static my_bool write_block_record(MARIA_HA *info,
for (; column < end_column && *blob_lengths < (ulong) (end_of_data - data); for (; column < end_column && *blob_lengths < (ulong) (end_of_data - data);
column++, blob_lengths++) column++, blob_lengths++)
{ {
byte *tmp_pos; uchar *tmp_pos;
uint length; uint length;
if (!*blob_lengths) /* Null or "" */ if (!*blob_lengths) /* Null or "" */
continue; continue;
length= column->length - portable_sizeof_char_ptr; length= column->length - portable_sizeof_char_ptr;
memcpy_fixed((byte*) &tmp_pos, record + column->offset + length, memcpy_fixed((uchar*) &tmp_pos, record + column->offset + length,
sizeof(char*)); sizeof(char*));
memcpy(data, tmp_pos, *blob_lengths); memcpy(data, tmp_pos, *blob_lengths);
data+= *blob_lengths; data+= *blob_lengths;
@ -1746,14 +1746,14 @@ static my_bool write_block_record(MARIA_HA *info,
for (; column < end_column; column++, blob_lengths++) for (; column < end_column; column++, blob_lengths++)
{ {
byte *blob_pos; uchar *blob_pos;
if (!*blob_lengths) /* Null or "" */ if (!*blob_lengths) /* Null or "" */
continue; continue;
if (block[block->sub_blocks - 1].used & BLOCKUSED_TAIL) if (block[block->sub_blocks - 1].used & BLOCKUSED_TAIL)
{ {
uint length; uint length;
length= column->length - portable_sizeof_char_ptr; length= column->length - portable_sizeof_char_ptr;
memcpy_fixed((byte *) &blob_pos, record + column->offset + length, memcpy_fixed((uchar *) &blob_pos, record + column->offset + length,
sizeof(char*)); sizeof(char*));
length= *blob_lengths % FULL_PAGE_SIZE(block_size); /* tail size */ length= *blob_lengths % FULL_PAGE_SIZE(block_size); /* tail size */
if (length != *blob_lengths) if (length != *blob_lengths)
@ -1912,7 +1912,7 @@ static my_bool write_block_record(MARIA_HA *info,
{ {
ulong data_length= (tmp_data - info->rec_buff); ulong data_length= (tmp_data - info->rec_buff);
uint length; uint length;
byte *extent_data; uchar *extent_data;
length= (uint) (data_length % FULL_PAGE_SIZE(block_size)); length= (uint) (data_length % FULL_PAGE_SIZE(block_size));
if (write_tail(info, head_tail_block, if (write_tail(info, head_tail_block,
@ -2062,9 +2062,9 @@ static my_bool write_block_record(MARIA_HA *info,
blob_length-= (blob_length % FULL_PAGE_SIZE(block_size)); blob_length-= (blob_length % FULL_PAGE_SIZE(block_size));
if (blob_length) if (blob_length)
{ {
memcpy_fixed((byte*) &log_array_pos->str, memcpy_fixed((uchar*) &log_array_pos->str,
record + column->offset + length, record + column->offset + length,
sizeof(byte*)); sizeof(uchar*));
log_array_pos->length= blob_length; log_array_pos->length= blob_length;
log_entry_length+= blob_length; log_entry_length+= blob_length;
log_array_pos++; log_array_pos++;
@ -2087,7 +2087,7 @@ static my_bool write_block_record(MARIA_HA *info,
(uint) (log_array_pos - log_array), (uint) (log_array_pos - log_array),
log_array, log_data); log_array, log_data);
if (log_array != tmp_log_array) if (log_array != tmp_log_array)
my_free((gptr) log_array, MYF(0)); my_free((uchar*) log_array, MYF(0));
if (error) if (error)
goto disk_err; goto disk_err;
} }
@ -2153,13 +2153,13 @@ static my_bool write_block_record(MARIA_HA *info,
/* Write rest of blobs (data, but no tails as they are already written) */ /* Write rest of blobs (data, but no tails as they are already written) */
for (; column < end_column; column++, blob_lengths++) for (; column < end_column; column++, blob_lengths++)
{ {
byte *blob_pos; uchar *blob_pos;
uint length; uint length;
ulong blob_length; ulong blob_length;
if (!*blob_lengths) /* Null or "" */ if (!*blob_lengths) /* Null or "" */
continue; continue;
length= column->length - portable_sizeof_char_ptr; length= column->length - portable_sizeof_char_ptr;
memcpy_fixed((byte*) &blob_pos, record + column->offset + length, memcpy_fixed((uchar*) &blob_pos, record + column->offset + length,
sizeof(char*)); sizeof(char*));
/* remove tail part */ /* remove tail part */
blob_length= *blob_lengths; blob_length= *blob_lengths;
@ -2214,7 +2214,7 @@ disk_err:
*/ */
MARIA_RECORD_POS _ma_write_init_block_record(MARIA_HA *info, MARIA_RECORD_POS _ma_write_init_block_record(MARIA_HA *info,
const byte *record) const uchar *record)
{ {
MARIA_BITMAP_BLOCKS *blocks= &info->cur_row.insert_blocks; MARIA_BITMAP_BLOCKS *blocks= &info->cur_row.insert_blocks;
struct st_row_pos_info row_pos; struct st_row_pos_info row_pos;
@ -2231,7 +2231,7 @@ MARIA_RECORD_POS _ma_write_init_block_record(MARIA_HA *info,
info->cur_row.lastpos= ma_recordpos(blocks->block->page, row_pos.rownr); info->cur_row.lastpos= ma_recordpos(blocks->block->page, row_pos.rownr);
if (info->s->calc_checksum) if (info->s->calc_checksum)
info->cur_row.checksum= (info->s->calc_checksum)(info,record); info->cur_row.checksum= (info->s->calc_checksum)(info,record);
if (write_block_record(info, (byte*) 0, record, &info->cur_row, if (write_block_record(info, (uchar*) 0, record, &info->cur_row,
blocks, blocks->block->org_bitmap_value != 0, blocks, blocks->block->org_bitmap_value != 0,
&row_pos)) &row_pos))
DBUG_RETURN(HA_OFFSET_ERROR); /* Error reading bitmap */ DBUG_RETURN(HA_OFFSET_ERROR); /* Error reading bitmap */
@ -2249,7 +2249,7 @@ MARIA_RECORD_POS _ma_write_init_block_record(MARIA_HA *info,
*/ */
my_bool _ma_write_block_record(MARIA_HA *info __attribute__ ((unused)), my_bool _ma_write_block_record(MARIA_HA *info __attribute__ ((unused)),
const byte *record __attribute__ ((unused))) const uchar *record __attribute__ ((unused)))
{ {
return 0; /* Row already written */ return 0; /* Row already written */
} }
@ -2342,15 +2342,15 @@ my_bool _ma_write_abort_block_record(MARIA_HA *info)
*/ */
my_bool _ma_update_block_record(MARIA_HA *info, MARIA_RECORD_POS record_pos, my_bool _ma_update_block_record(MARIA_HA *info, MARIA_RECORD_POS record_pos,
const byte *oldrec, const byte *record) const uchar *oldrec, const uchar *record)
{ {
MARIA_BITMAP_BLOCKS *blocks= &info->cur_row.insert_blocks; MARIA_BITMAP_BLOCKS *blocks= &info->cur_row.insert_blocks;
byte *buff; uchar *buff;
MARIA_ROW *cur_row= &info->cur_row, *new_row= &info->new_row; MARIA_ROW *cur_row= &info->cur_row, *new_row= &info->new_row;
MARIA_PINNED_PAGE page_link; MARIA_PINNED_PAGE page_link;
uint rownr, org_empty_size, head_length; uint rownr, org_empty_size, head_length;
uint block_size= info->s->block_size; uint block_size= info->s->block_size;
byte *dir; uchar *dir;
ulonglong page; ulonglong page;
struct st_row_pos_info row_pos; struct st_row_pos_info row_pos;
MARIA_SHARE *share= info->s; MARIA_SHARE *share= info->s;
@ -2483,7 +2483,7 @@ static my_bool delete_head_or_tail(MARIA_HA *info,
MARIA_SHARE *share= info->s; MARIA_SHARE *share= info->s;
uint number_of_records, empty_space, length; uint number_of_records, empty_space, length;
uint block_size= share->block_size; uint block_size= share->block_size;
byte *buff, *dir; uchar *buff, *dir;
LSN lsn; LSN lsn;
MARIA_PINNED_PAGE page_link; MARIA_PINNED_PAGE page_link;
DBUG_ENTER("delete_head_or_tail"); DBUG_ENTER("delete_head_or_tail");
@ -2520,14 +2520,14 @@ static my_bool delete_head_or_tail(MARIA_HA *info,
if (record_number == number_of_records - 1) if (record_number == number_of_records - 1)
{ {
/* Delete this entry and all following empty directory entries */ /* Delete this entry and all following empty directory entries */
byte *end= buff + block_size - PAGE_SUFFIX_SIZE; uchar *end= buff + block_size - PAGE_SUFFIX_SIZE;
do do
{ {
number_of_records--; number_of_records--;
dir+= DIR_ENTRY_SIZE; dir+= DIR_ENTRY_SIZE;
empty_space+= DIR_ENTRY_SIZE; empty_space+= DIR_ENTRY_SIZE;
} while (dir < end && dir[0] == 0 && dir[1] == 0); } while (dir < end && dir[0] == 0 && dir[1] == 0);
buff[DIR_COUNT_OFFSET]= (byte) (uchar) number_of_records; buff[DIR_COUNT_OFFSET]= (uchar) (uchar) number_of_records;
} }
empty_space+= length; empty_space+= length;
if (number_of_records != 0) if (number_of_records != 0)
@ -2537,7 +2537,7 @@ static my_bool delete_head_or_tail(MARIA_HA *info,
/* Update directory */ /* Update directory */
int2store(buff + EMPTY_SPACE_OFFSET, empty_space); int2store(buff + EMPTY_SPACE_OFFSET, empty_space);
buff[PAGE_TYPE_OFFSET]|= (byte) PAGE_CAN_BE_COMPACTED; buff[PAGE_TYPE_OFFSET]|= (uchar) PAGE_CAN_BE_COMPACTED;
DBUG_ASSERT(share->pagecache->block_size == block_size); DBUG_ASSERT(share->pagecache->block_size == block_size);
/* Log REDO data */ /* Log REDO data */
@ -2630,7 +2630,7 @@ static my_bool delete_tails(MARIA_HA *info, MARIA_RECORD_POS *tails)
for rows with many splits. for rows with many splits.
*/ */
my_bool _ma_delete_block_record(MARIA_HA *info, const byte *record) my_bool _ma_delete_block_record(MARIA_HA *info, const uchar *record)
{ {
ulonglong page; ulonglong page;
uint record_number; uint record_number;
@ -2705,12 +2705,12 @@ err:
In this case *end_of_data is set. In this case *end_of_data is set.
*/ */
static byte *get_record_position(byte *buff, uint block_size, static uchar *get_record_position(uchar *buff, uint block_size,
uint record_number, byte **end_of_data) uint record_number, uchar **end_of_data)
{ {
uint number_of_records= (uint) ((uchar *) buff)[DIR_COUNT_OFFSET]; uint number_of_records= (uint) ((uchar *) buff)[DIR_COUNT_OFFSET];
byte *dir; uchar *dir;
byte *data; uchar *data;
uint offset, length; uint offset, length;
#ifdef SANITY_CHECKS #ifdef SANITY_CHECKS
@ -2755,7 +2755,7 @@ static byte *get_record_position(byte *buff, uint block_size,
extent is a cursor over which pages to read extent is a cursor over which pages to read
*/ */
static void init_extent(MARIA_EXTENT_CURSOR *extent, byte *extent_info, static void init_extent(MARIA_EXTENT_CURSOR *extent, uchar *extent_info,
uint extents, MARIA_RECORD_POS *tail_positions) uint extents, MARIA_RECORD_POS *tail_positions)
{ {
uint page_count; uint page_count;
@ -2788,11 +2788,11 @@ static void init_extent(MARIA_EXTENT_CURSOR *extent, byte *extent_info,
In this case end_of_data is updated to point to end of data. In this case end_of_data is updated to point to end of data.
*/ */
static byte *read_next_extent(MARIA_HA *info, MARIA_EXTENT_CURSOR *extent, static uchar *read_next_extent(MARIA_HA *info, MARIA_EXTENT_CURSOR *extent,
byte **end_of_data) uchar **end_of_data)
{ {
MARIA_SHARE *share= info->s; MARIA_SHARE *share= info->s;
byte *buff, *data; uchar *buff, *data;
DBUG_ENTER("read_next_extent"); DBUG_ENTER("read_next_extent");
if (!extent->page_count) if (!extent->page_count)
@ -2879,9 +2879,9 @@ crashed:
1 error 1 error
*/ */
static my_bool read_long_data(MARIA_HA *info, byte *to, ulong length, static my_bool read_long_data(MARIA_HA *info, uchar *to, ulong length,
MARIA_EXTENT_CURSOR *extent, MARIA_EXTENT_CURSOR *extent,
byte **data, byte **end_of_data) uchar **data, uchar **end_of_data)
{ {
DBUG_ENTER("read_long_data"); DBUG_ENTER("read_long_data");
DBUG_PRINT("enter", ("length: %lu", length)); DBUG_PRINT("enter", ("length: %lu", length));
@ -2946,11 +2946,11 @@ static my_bool read_long_data(MARIA_HA *info, byte *to, ulong length,
# Error code # Error code
*/ */
int _ma_read_block_record2(MARIA_HA *info, byte *record, int _ma_read_block_record2(MARIA_HA *info, uchar *record,
byte *data, byte *end_of_data) uchar *data, uchar *end_of_data)
{ {
MARIA_SHARE *share= info->s; MARIA_SHARE *share= info->s;
byte *field_length_data, *blob_buffer, *start_of_data; uchar *field_length_data, *blob_buffer, *start_of_data;
uint flag, null_bytes, cur_null_bytes, row_extents, field_lengths; uint flag, null_bytes, cur_null_bytes, row_extents, field_lengths;
my_bool found_blob= 0; my_bool found_blob= 0;
MARIA_EXTENT_CURSOR extent; MARIA_EXTENT_CURSOR extent;
@ -3075,7 +3075,7 @@ int _ma_read_block_record2(MARIA_HA *info, byte *record,
column < end_column; column++) column < end_column; column++)
{ {
enum en_fieldtype type= (enum en_fieldtype) column->type; enum en_fieldtype type= (enum en_fieldtype) column->type;
byte *field_pos= record + column->offset; uchar *field_pos= record + column->offset;
/* First check if field is present in record */ /* First check if field is present in record */
if ((record[column->null_pos] & column->null_bit) || if ((record[column->null_pos] & column->null_bit) ||
(info->cur_row.empty_bits[column->empty_pos] & column->empty_bit)) (info->cur_row.empty_bits[column->empty_pos] & column->empty_bit))
@ -3146,7 +3146,7 @@ int _ma_read_block_record2(MARIA_HA *info, byte *record,
{ {
/* Calculate total length for all blobs */ /* Calculate total length for all blobs */
ulong blob_lengths= 0; ulong blob_lengths= 0;
byte *length_data= field_length_data; uchar *length_data= field_length_data;
MARIA_COLUMNDEF *blob_field= column; MARIA_COLUMNDEF *blob_field= column;
found_blob= 1; found_blob= 1;
@ -3169,7 +3169,7 @@ int _ma_read_block_record2(MARIA_HA *info, byte *record,
} }
memcpy(field_pos, field_length_data, size_length); memcpy(field_pos, field_length_data, size_length);
memcpy_fixed(field_pos + size_length, (byte *) & blob_buffer, memcpy_fixed(field_pos + size_length, (uchar *) & blob_buffer,
sizeof(char*)); sizeof(char*));
field_length_data+= size_length; field_length_data+= size_length;
@ -3239,10 +3239,10 @@ err:
record_pos Record position record_pos Record position
*/ */
int _ma_read_block_record(MARIA_HA *info, byte *record, int _ma_read_block_record(MARIA_HA *info, uchar *record,
MARIA_RECORD_POS record_pos) MARIA_RECORD_POS record_pos)
{ {
byte *data, *end_of_data, *buff; uchar *data, *end_of_data, *buff;
uint offset; uint offset;
uint block_size= info->s->block_size; uint block_size= info->s->block_size;
DBUG_ENTER("_ma_read_block_record"); DBUG_ENTER("_ma_read_block_record");
@ -3271,10 +3271,10 @@ int _ma_read_block_record(MARIA_HA *info, byte *record,
/* compare unique constraint between stored rows */ /* compare unique constraint between stored rows */
my_bool _ma_cmp_block_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, my_bool _ma_cmp_block_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
const byte *record, MARIA_RECORD_POS pos) const uchar *record, MARIA_RECORD_POS pos)
{ {
byte *org_rec_buff, *old_record; uchar *org_rec_buff, *old_record;
my_size_t org_rec_buff_size; size_t org_rec_buff_size;
int error; int error;
DBUG_ENTER("_ma_cmp_block_unique"); DBUG_ENTER("_ma_cmp_block_unique");
@ -3333,7 +3333,7 @@ my_bool _ma_scan_init_block_record(MARIA_HA *info)
*/ */
if (!(info->scan.bitmap_buff || if (!(info->scan.bitmap_buff ||
((info->scan.bitmap_buff= ((info->scan.bitmap_buff=
(byte *) my_malloc(info->s->block_size * 2, MYF(MY_WME)))))) (uchar *) my_malloc(info->s->block_size * 2, MYF(MY_WME))))))
DBUG_RETURN(1); DBUG_RETURN(1);
info->scan.page_buff= info->scan.bitmap_buff + info->s->block_size; info->scan.page_buff= info->scan.bitmap_buff + info->s->block_size;
info->scan.bitmap_end= info->scan.bitmap_buff + info->s->bitmap.total_size; info->scan.bitmap_end= info->scan.bitmap_buff + info->s->bitmap.total_size;
@ -3387,7 +3387,7 @@ void _ma_scan_end_block_record(MARIA_HA *info)
# Error code # Error code
*/ */
int _ma_scan_block_record(MARIA_HA *info, byte *record, int _ma_scan_block_record(MARIA_HA *info, uchar *record,
MARIA_RECORD_POS record_pos, MARIA_RECORD_POS record_pos,
my_bool skip_deleted __attribute__ ((unused))) my_bool skip_deleted __attribute__ ((unused)))
{ {
@ -3401,7 +3401,7 @@ restart_record_read:
if (likely(record_pos < info->scan.number_of_rows)) if (likely(record_pos < info->scan.number_of_rows))
{ {
uint length, offset; uint length, offset;
byte *data, *end_of_data; uchar *data, *end_of_data;
while (!(offset= uint2korr(info->scan.dir))) while (!(offset= uint2korr(info->scan.dir)))
{ {
@ -3433,7 +3433,7 @@ restart_bitmap_scan:
block_size= share->block_size; block_size= share->block_size;
if (likely(info->scan.bitmap_pos < info->scan.bitmap_end)) if (likely(info->scan.bitmap_pos < info->scan.bitmap_end))
{ {
byte *data= info->scan.bitmap_pos; uchar *data= info->scan.bitmap_pos;
longlong bits= info->scan.bits; longlong bits= info->scan.bits;
uint bit_pos= info->scan.bit_pos; uint bit_pos= info->scan.bit_pos;
@ -3520,7 +3520,7 @@ err:
*/ */
my_bool _ma_compare_block_record(MARIA_HA *info __attribute__ ((unused)), my_bool _ma_compare_block_record(MARIA_HA *info __attribute__ ((unused)),
const byte *record __attribute__ ((unused))) const uchar *record __attribute__ ((unused)))
{ {
return 0; return 0;
} }
@ -3528,11 +3528,11 @@ my_bool _ma_compare_block_record(MARIA_HA *info __attribute__ ((unused)),
#ifndef DBUG_OFF #ifndef DBUG_OFF
static void _ma_print_directory(byte *buff, uint block_size) static void _ma_print_directory(uchar *buff, uint block_size)
{ {
uint max_entry= (uint) ((uchar *) buff)[DIR_COUNT_OFFSET], row= 0; uint max_entry= (uint) ((uchar *) buff)[DIR_COUNT_OFFSET], row= 0;
uint end_of_prev_row= PAGE_HEADER_SIZE; uint end_of_prev_row= PAGE_HEADER_SIZE;
byte *dir, *end; uchar *dir, *end;
dir= buff + block_size - DIR_ENTRY_SIZE * max_entry - PAGE_SUFFIX_SIZE; dir= buff + block_size - DIR_ENTRY_SIZE * max_entry - PAGE_SUFFIX_SIZE;
end= buff + block_size - DIR_ENTRY_SIZE - PAGE_SUFFIX_SIZE; end= buff + block_size - DIR_ENTRY_SIZE - PAGE_SUFFIX_SIZE;
@ -3649,7 +3649,7 @@ uint ma_calc_length_for_store_length(ulong nr)
log_parts_count contains number of used log_parts log_parts_count contains number of used log_parts
*/ */
static size_t fill_insert_undo_parts(MARIA_HA *info, const byte *record, static size_t fill_insert_undo_parts(MARIA_HA *info, const uchar *record,
LEX_STRING *log_parts, LEX_STRING *log_parts,
uint *log_parts_count) uint *log_parts_count)
{ {
@ -3755,7 +3755,7 @@ static size_t fill_insert_undo_parts(MARIA_HA *info, const byte *record,
/* Add blobs */ /* Add blobs */
for (end_column+= share->base.blobs; column < end_column; column++) for (end_column+= share->base.blobs; column < end_column; column++)
{ {
const byte *field_pos= record + column->offset; const uchar *field_pos= record + column->offset;
uint size_length= column->length - portable_sizeof_char_ptr; uint size_length= column->length - portable_sizeof_char_ptr;
ulong blob_length= _ma_calc_blob_length(size_length, field_pos); ulong blob_length= _ma_calc_blob_length(size_length, field_pos);
@ -3766,7 +3766,7 @@ static size_t fill_insert_undo_parts(MARIA_HA *info, const byte *record,
if (blob_length) if (blob_length)
{ {
char *blob_pos; char *blob_pos;
memcpy_fixed((byte*) &blob_pos, record + column->offset + size_length, memcpy_fixed((uchar*) &blob_pos, record + column->offset + size_length,
sizeof(blob_pos)); sizeof(blob_pos));
log_parts->str= blob_pos; log_parts->str= blob_pos;
log_parts->length= blob_length; log_parts->length= blob_length;
@ -3818,8 +3818,8 @@ static size_t fill_insert_undo_parts(MARIA_HA *info, const byte *record,
log_parts_count contains number of used log_parts log_parts_count contains number of used log_parts
*/ */
static size_t fill_update_undo_parts(MARIA_HA *info, const byte *oldrec, static size_t fill_update_undo_parts(MARIA_HA *info, const uchar *oldrec,
const byte *newrec, const uchar *newrec,
LEX_STRING *log_parts, LEX_STRING *log_parts,
uint *log_parts_count) uint *log_parts_count)
{ {
@ -3950,13 +3950,13 @@ static size_t fill_update_undo_parts(MARIA_HA *info, const byte *oldrec,
{ {
uint size_length= column->length - portable_sizeof_char_ptr; uint size_length= column->length - portable_sizeof_char_ptr;
old_column_length= _ma_calc_blob_length(size_length, old_column_pos); old_column_length= _ma_calc_blob_length(size_length, old_column_pos);
memcpy_fixed((byte*) &old_column_pos, memcpy_fixed((uchar*) &old_column_pos,
oldrec + column->offset + size_length, oldrec + column->offset + size_length,
sizeof(old_column_pos)); sizeof(old_column_pos));
if (!new_column_is_empty) if (!new_column_is_empty)
{ {
new_column_length= _ma_calc_blob_length(size_length, new_column_pos); new_column_length= _ma_calc_blob_length(size_length, new_column_pos);
memcpy_fixed((byte*) &new_column_pos, memcpy_fixed((uchar*) &new_column_pos,
newrec + column->offset + size_length, newrec + column->offset + size_length,
sizeof(old_column_pos)); sizeof(old_column_pos));
} }

View File

@ -60,7 +60,7 @@ enum en_page_type { UNALLOCATED_PAGE, HEAD_PAGE, TAIL_PAGE, BLOB_PAGE, MAX_PAGE_
#define PAGE_CAN_BE_COMPACTED 128 /* Bit in PAGE_TYPE */ #define PAGE_CAN_BE_COMPACTED 128 /* Bit in PAGE_TYPE */
/* Bits used for flag byte (one byte, first in record) */ /* Bits used for flag uchar (one byte, first in record) */
#define ROW_FLAG_TRANSID 1 #define ROW_FLAG_TRANSID 1
#define ROW_FLAG_VER_PTR 2 #define ROW_FLAG_VER_PTR 2
#define ROW_FLAG_DELETE_TRANSID 4 #define ROW_FLAG_DELETE_TRANSID 4
@ -82,7 +82,7 @@ enum en_page_type { UNALLOCATED_PAGE, HEAD_PAGE, TAIL_PAGE, BLOB_PAGE, MAX_PAGE_
TRANSID_SIZE + VERPTR_SIZE + \ TRANSID_SIZE + VERPTR_SIZE + \
TRANSID_SIZE) TRANSID_SIZE)
/* We use 1 byte in record header to store number of directory entries */ /* We use 1 uchar in record header to store number of directory entries */
#define MAX_ROWS_PER_PAGE 255 #define MAX_ROWS_PER_PAGE 255
/* Bits for MARIA_BITMAP_BLOCKS->used */ /* Bits for MARIA_BITMAP_BLOCKS->used */
@ -133,25 +133,25 @@ my_bool _ma_init_block_record(MARIA_HA *info);
void _ma_end_block_record(MARIA_HA *info); void _ma_end_block_record(MARIA_HA *info);
my_bool _ma_update_block_record(MARIA_HA *info, MARIA_RECORD_POS pos, my_bool _ma_update_block_record(MARIA_HA *info, MARIA_RECORD_POS pos,
const byte *oldrec, const byte *newrec); const uchar *oldrec, const uchar *newrec);
my_bool _ma_delete_block_record(MARIA_HA *info, const byte *record); my_bool _ma_delete_block_record(MARIA_HA *info, const uchar *record);
int _ma_read_block_record(MARIA_HA *info, byte *record, int _ma_read_block_record(MARIA_HA *info, uchar *record,
MARIA_RECORD_POS record_pos); MARIA_RECORD_POS record_pos);
int _ma_read_block_record2(MARIA_HA *info, byte *record, int _ma_read_block_record2(MARIA_HA *info, uchar *record,
byte *data, byte *end_of_data); uchar *data, uchar *end_of_data);
int _ma_scan_block_record(MARIA_HA *info, byte *record, int _ma_scan_block_record(MARIA_HA *info, uchar *record,
MARIA_RECORD_POS, my_bool); MARIA_RECORD_POS, my_bool);
my_bool _ma_cmp_block_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, my_bool _ma_cmp_block_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
const byte *record, MARIA_RECORD_POS pos); const uchar *record, MARIA_RECORD_POS pos);
my_bool _ma_scan_init_block_record(MARIA_HA *info); my_bool _ma_scan_init_block_record(MARIA_HA *info);
void _ma_scan_end_block_record(MARIA_HA *info); void _ma_scan_end_block_record(MARIA_HA *info);
MARIA_RECORD_POS _ma_write_init_block_record(MARIA_HA *info, MARIA_RECORD_POS _ma_write_init_block_record(MARIA_HA *info,
const byte *record); const uchar *record);
my_bool _ma_write_block_record(MARIA_HA *info, const byte *record); my_bool _ma_write_block_record(MARIA_HA *info, const uchar *record);
my_bool _ma_write_abort_block_record(MARIA_HA *info); my_bool _ma_write_abort_block_record(MARIA_HA *info);
my_bool _ma_compare_block_record(register MARIA_HA *info, my_bool _ma_compare_block_record(register MARIA_HA *info,
register const byte *record); register const uchar *record);
/* ma_bitmap.c */ /* ma_bitmap.c */
my_bool _ma_bitmap_init(MARIA_SHARE *share, File file); my_bool _ma_bitmap_init(MARIA_SHARE *share, File file);
@ -160,7 +160,7 @@ my_bool _ma_flush_bitmap(MARIA_SHARE *share);
my_bool _ma_bitmap_find_place(MARIA_HA *info, MARIA_ROW *row, my_bool _ma_bitmap_find_place(MARIA_HA *info, MARIA_ROW *row,
MARIA_BITMAP_BLOCKS *result_blocks); MARIA_BITMAP_BLOCKS *result_blocks);
my_bool _ma_bitmap_release_unused(MARIA_HA *info, MARIA_BITMAP_BLOCKS *blocks); my_bool _ma_bitmap_release_unused(MARIA_HA *info, MARIA_BITMAP_BLOCKS *blocks);
my_bool _ma_bitmap_free_full_pages(MARIA_HA *info, const byte *extents, my_bool _ma_bitmap_free_full_pages(MARIA_HA *info, const uchar *extents,
uint count); uint count);
my_bool _ma_bitmap_set(MARIA_HA *info, ulonglong pos, my_bool head, my_bool _ma_bitmap_set(MARIA_HA *info, ulonglong pos, my_bool head,
uint empty_space); uint empty_space);

View File

@ -35,7 +35,7 @@
#include "maria_def.h" #include "maria_def.h"
int _ma_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length, int _ma_read_cache(IO_CACHE *info, uchar *buff, my_off_t pos, uint length,
int flag) int flag)
{ {
uint read_length,in_buff_length; uint read_length,in_buff_length;
@ -61,7 +61,7 @@ int _ma_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length,
(my_off_t) (info->read_end - info->request_pos)) (my_off_t) (info->read_end - info->request_pos))
{ {
in_buff_pos=info->request_pos+(uint) offset; in_buff_pos=info->request_pos+(uint) offset;
in_buff_length= min(length,(uint) (info->read_end-in_buff_pos)); in_buff_length= min(length,(uint) ((char*)(info->read_end)-in_buff_pos));
memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length); memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length);
if (!(length-=in_buff_length)) if (!(length-=in_buff_length))
DBUG_RETURN(0); DBUG_RETURN(0);

View File

@ -20,7 +20,7 @@
There are two types of checksums. Table checksum and row checksum. There are two types of checksums. Table checksum and row checksum.
Row checksum is an additional byte at the end of dynamic length Row checksum is an additional uchar at the end of dynamic length
records. It must be calculated if the table is configured for them. records. It must be calculated if the table is configured for them.
Otherwise they must not be used. The variable Otherwise they must not be used. The variable
MYISAM_SHARE::calc_checksum determines if row checksums are used. MYISAM_SHARE::calc_checksum determines if row checksums are used.
@ -31,7 +31,7 @@
wrong. But since all threads read through a common read buffer, it is wrong. But since all threads read through a common read buffer, it is
sufficient if only one thread checks it. sufficient if only one thread checks it.
Table checksum is an eight byte value in the header of the index file. Table checksum is an eight uchar value in the header of the index file.
It can be calculated even if row checksums are not used. The variable It can be calculated even if row checksums are not used. The variable
MI_CHECK::glob_crc is calculated over all records. MI_CHECK::glob_crc is calculated over all records.
MI_SORT_PARAM::calc_checksum determines if this should be done. This MI_SORT_PARAM::calc_checksum determines if this should be done. This
@ -59,7 +59,7 @@
static int check_k_link(HA_CHECK *param, MARIA_HA *info, my_off_t next_link); static int check_k_link(HA_CHECK *param, MARIA_HA *info, my_off_t next_link);
static int chk_index(HA_CHECK *param, MARIA_HA *info,MARIA_KEYDEF *keyinfo, static int chk_index(HA_CHECK *param, MARIA_HA *info,MARIA_KEYDEF *keyinfo,
my_off_t page, byte *buff, ha_rows *keys, my_off_t page, uchar *buff, ha_rows *keys,
ha_checksum *key_checksum, uint level); ha_checksum *key_checksum, uint level);
static uint isam_key_length(MARIA_HA *info,MARIA_KEYDEF *keyinfo); static uint isam_key_length(MARIA_HA *info,MARIA_KEYDEF *keyinfo);
static ha_checksum calc_checksum(ha_rows count); static ha_checksum calc_checksum(ha_rows count);
@ -67,30 +67,30 @@ static int writekeys(MARIA_SORT_PARAM *sort_param);
static int sort_one_index(HA_CHECK *param, MARIA_HA *info, static int sort_one_index(HA_CHECK *param, MARIA_HA *info,
MARIA_KEYDEF *keyinfo, MARIA_KEYDEF *keyinfo,
my_off_t pagepos, File new_file); my_off_t pagepos, File new_file);
static int sort_key_read(MARIA_SORT_PARAM *sort_param, byte *key); static int sort_key_read(MARIA_SORT_PARAM *sort_param, uchar *key);
static int sort_maria_ft_key_read(MARIA_SORT_PARAM *sort_param, byte *key); static int sort_maria_ft_key_read(MARIA_SORT_PARAM *sort_param, uchar *key);
static int sort_get_next_record(MARIA_SORT_PARAM *sort_param); static int sort_get_next_record(MARIA_SORT_PARAM *sort_param);
static int sort_key_cmp(MARIA_SORT_PARAM *sort_param, const void *a, static int sort_key_cmp(MARIA_SORT_PARAM *sort_param, const void *a,
const void *b); const void *b);
static int sort_maria_ft_key_write(MARIA_SORT_PARAM *sort_param, static int sort_maria_ft_key_write(MARIA_SORT_PARAM *sort_param,
const byte *a); const uchar *a);
static int sort_key_write(MARIA_SORT_PARAM *sort_param, const byte *a); static int sort_key_write(MARIA_SORT_PARAM *sort_param, const uchar *a);
static my_off_t get_record_for_key(MARIA_HA *info,MARIA_KEYDEF *keyinfo, static my_off_t get_record_for_key(MARIA_HA *info,MARIA_KEYDEF *keyinfo,
const byte *key); const uchar *key);
static int sort_insert_key(MARIA_SORT_PARAM *sort_param, static int sort_insert_key(MARIA_SORT_PARAM *sort_param,
reg1 SORT_KEY_BLOCKS *key_block, reg1 SORT_KEY_BLOCKS *key_block,
const byte *key, my_off_t prev_block); const uchar *key, my_off_t prev_block);
static int sort_delete_record(MARIA_SORT_PARAM *sort_param); static int sort_delete_record(MARIA_SORT_PARAM *sort_param);
/*static int _ma_flush_pending_blocks(HA_CHECK *param);*/ /*static int _ma_flush_pending_blocks(HA_CHECK *param);*/
static SORT_KEY_BLOCKS *alloc_key_blocks(HA_CHECK *param, uint blocks, static SORT_KEY_BLOCKS *alloc_key_blocks(HA_CHECK *param, uint blocks,
uint buffer_length); uint buffer_length);
static ha_checksum maria_byte_checksum(const byte *buf, uint length); static ha_checksum maria_byte_checksum(const uchar *buf, uint length);
static void set_data_file_type(MARIA_SORT_INFO *sort_info, MARIA_SHARE *share); static void set_data_file_type(MARIA_SORT_INFO *sort_info, MARIA_SHARE *share);
static void restore_data_file_type(MARIA_SHARE *share); static void restore_data_file_type(MARIA_SHARE *share);
void maria_chk_init(HA_CHECK *param) void maria_chk_init(HA_CHECK *param)
{ {
bzero((gptr) param,sizeof(*param)); bzero((uchar*) param,sizeof(*param));
param->opt_follow_links=1; param->opt_follow_links=1;
param->keys_in_use= ~(ulonglong) 0; param->keys_in_use= ~(ulonglong) 0;
param->search_after_block=HA_OFFSET_ERROR; param->search_after_block=HA_OFFSET_ERROR;
@ -297,7 +297,7 @@ static int check_k_link(HA_CHECK *param, register MARIA_HA *info,
if (!(buff= pagecache_read(info->s->pagecache, if (!(buff= pagecache_read(info->s->pagecache,
&info->s->kfile, next_link/block_size, &info->s->kfile, next_link/block_size,
DFLT_INIT_HITS, DFLT_INIT_HITS,
(byte*) info->buff, (uchar*) info->buff,
PAGECACHE_PLAIN_PAGE, PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED, 0))) PAGECACHE_LOCK_LEFT_UNLOCKED, 0)))
{ {
@ -532,7 +532,7 @@ int maria_chk_key(HA_CHECK *param, register MARIA_HA *info)
/* Check that there isn't a row with auto_increment = 0 in the table */ /* Check that there isn't a row with auto_increment = 0 in the table */
maria_extra(info,HA_EXTRA_KEYREAD,0); maria_extra(info,HA_EXTRA_KEYREAD,0);
bzero(info->lastkey,keyinfo->seg->length); bzero(info->lastkey,keyinfo->seg->length);
if (!maria_rkey(info, info->rec_buff, key, (const byte*) info->lastkey, if (!maria_rkey(info, info->rec_buff, key, (const uchar*) info->lastkey,
keyinfo->seg->length, HA_READ_KEY_EXACT)) keyinfo->seg->length, HA_READ_KEY_EXACT))
{ {
/* Don't count this as a real warning, as maria_chk can't correct it */ /* Don't count this as a real warning, as maria_chk can't correct it */
@ -586,7 +586,7 @@ do_stat:
static int chk_index_down(HA_CHECK *param, MARIA_HA *info, static int chk_index_down(HA_CHECK *param, MARIA_HA *info,
MARIA_KEYDEF *keyinfo, MARIA_KEYDEF *keyinfo,
my_off_t page, byte *buff, ha_rows *keys, my_off_t page, uchar *buff, ha_rows *keys,
ha_checksum *key_checksum, uint level) ha_checksum *key_checksum, uint level)
{ {
char llbuff[22],llbuff2[22]; char llbuff[22],llbuff2[22];
@ -657,7 +657,7 @@ err:
static static
void maria_collect_stats_nonulls_first(HA_KEYSEG *keyseg, ulonglong *notnull, void maria_collect_stats_nonulls_first(HA_KEYSEG *keyseg, ulonglong *notnull,
const byte *key) const uchar *key)
{ {
uint first_null, kp; uint first_null, kp;
first_null= ha_find_null(keyseg, (uchar*) key) - keyseg; first_null= ha_find_null(keyseg, (uchar*) key) - keyseg;
@ -697,8 +697,8 @@ void maria_collect_stats_nonulls_first(HA_KEYSEG *keyseg, ulonglong *notnull,
static static
int maria_collect_stats_nonulls_next(HA_KEYSEG *keyseg, ulonglong *notnull, int maria_collect_stats_nonulls_next(HA_KEYSEG *keyseg, ulonglong *notnull,
const byte *prev_key, const uchar *prev_key,
const byte *last_key) const uchar *last_key)
{ {
uint diffs[2]; uint diffs[2];
uint first_null_seg, kp; uint first_null_seg, kp;
@ -733,23 +733,23 @@ int maria_collect_stats_nonulls_next(HA_KEYSEG *keyseg, ulonglong *notnull,
/* Check if index is ok */ /* Check if index is ok */
static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo, static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
my_off_t page, byte *buff, ha_rows *keys, my_off_t page, uchar *buff, ha_rows *keys,
ha_checksum *key_checksum, uint level) ha_checksum *key_checksum, uint level)
{ {
int flag; int flag;
uint used_length,comp_flag,nod_flag,key_length=0; uint used_length,comp_flag,nod_flag,key_length=0;
byte key[HA_MAX_POSSIBLE_KEY_BUFF],*temp_buff,*keypos,*old_keypos,*endpos; uchar key[HA_MAX_POSSIBLE_KEY_BUFF],*temp_buff,*keypos,*old_keypos,*endpos;
my_off_t next_page,record; my_off_t next_page,record;
char llbuff[22]; char llbuff[22];
uint diff_pos[2]; uint diff_pos[2];
DBUG_ENTER("chk_index"); DBUG_ENTER("chk_index");
DBUG_DUMP("buff",(byte*) buff,maria_data_on_page(buff)); DBUG_DUMP("buff",(uchar*) buff,maria_data_on_page(buff));
/* TODO: implement appropriate check for RTree keys */ /* TODO: implement appropriate check for RTree keys */
if (keyinfo->flag & HA_SPATIAL) if (keyinfo->flag & HA_SPATIAL)
DBUG_RETURN(0); DBUG_RETURN(0);
if (!(temp_buff=(byte*) my_alloca((uint) keyinfo->block_length))) if (!(temp_buff=(uchar*) my_alloca((uint) keyinfo->block_length)))
{ {
_ma_check_print_error(param,"Not enough memory for keyblock"); _ma_check_print_error(param,"Not enough memory for keyblock");
DBUG_RETURN(-1); DBUG_RETURN(-1);
@ -837,7 +837,7 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
key); key);
} }
} }
(*key_checksum)+= maria_byte_checksum((byte*) key, (*key_checksum)+= maria_byte_checksum((uchar*) key,
key_length- info->s->rec_reflength); key_length- info->s->rec_reflength);
record= _ma_dpos(info,0,key+key_length); record= _ma_dpos(info,0,key+key_length);
if (keyinfo->flag & HA_FULLTEXT) /* special handling for ft2 */ if (keyinfo->flag & HA_FULLTEXT) /* special handling for ft2 */
@ -875,7 +875,7 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
DBUG_PRINT("test",("page: %s record: %s filelength: %s", DBUG_PRINT("test",("page: %s record: %s filelength: %s",
llstr(page,llbuff),llstr(record,llbuff2), llstr(page,llbuff),llstr(record,llbuff2),
llstr(info->state->data_file_length,llbuff3))); llstr(info->state->data_file_length,llbuff3)));
DBUG_DUMP("key",(byte*) key,key_length); DBUG_DUMP("key",(uchar*) key,key_length);
DBUG_DUMP("new_in_page",(char*) old_keypos,(uint) (keypos-old_keypos)); DBUG_DUMP("new_in_page",(char*) old_keypos,(uint) (keypos-old_keypos));
goto err; goto err;
} }
@ -887,10 +887,10 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
llstr(page,llbuff), used_length, (keypos - buff)); llstr(page,llbuff), used_length, (keypos - buff));
goto err; goto err;
} }
my_afree((byte*) temp_buff); my_afree((uchar*) temp_buff);
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
my_afree((byte*) temp_buff); my_afree((uchar*) temp_buff);
DBUG_RETURN(1); DBUG_RETURN(1);
} /* chk_index */ } /* chk_index */
@ -969,7 +969,7 @@ static void record_pos_to_txt(MARIA_HA *info, my_off_t recpos,
*/ */
static int check_keys_in_record(HA_CHECK *param, MARIA_HA *info, int extend, static int check_keys_in_record(HA_CHECK *param, MARIA_HA *info, int extend,
my_off_t start_recpos, byte *record) my_off_t start_recpos, uchar *record)
{ {
MARIA_KEYDEF *keyinfo; MARIA_KEYDEF *keyinfo;
char llbuff[22+4]; char llbuff[22+4];
@ -1019,7 +1019,7 @@ static int check_keys_in_record(HA_CHECK *param, MARIA_HA *info, int extend,
} }
else else
param->tmp_key_crc[key]+= param->tmp_key_crc[key]+=
maria_byte_checksum((byte*) info->lastkey, key_length); maria_byte_checksum((uchar*) info->lastkey, key_length);
} }
} }
} }
@ -1040,7 +1040,7 @@ static int check_keys_in_record(HA_CHECK *param, MARIA_HA *info, int extend,
*/ */
static int check_static_record(HA_CHECK *param, MARIA_HA *info, int extend, static int check_static_record(HA_CHECK *param, MARIA_HA *info, int extend,
byte *record) uchar *record)
{ {
my_off_t start_recpos, pos; my_off_t start_recpos, pos;
char llbuff[22]; char llbuff[22];
@ -1050,7 +1050,7 @@ static int check_static_record(HA_CHECK *param, MARIA_HA *info, int extend,
{ {
if (*_ma_killed_ptr(param)) if (*_ma_killed_ptr(param))
return -1; return -1;
if (my_b_read(&param->read_cache,(byte*) record, if (my_b_read(&param->read_cache,(uchar*) record,
info->s->base.pack_reclength)) info->s->base.pack_reclength))
{ {
_ma_check_print_error(param, _ma_check_print_error(param,
@ -1077,11 +1077,11 @@ static int check_static_record(HA_CHECK *param, MARIA_HA *info, int extend,
static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend,
byte *record) uchar *record)
{ {
MARIA_BLOCK_INFO block_info; MARIA_BLOCK_INFO block_info;
my_off_t start_recpos, start_block, pos; my_off_t start_recpos, start_block, pos;
byte *to; uchar *to;
ulong left_length; ulong left_length;
uint b_type; uint b_type;
char llbuff[22],llbuff2[22],llbuff3[22]; char llbuff[22],llbuff2[22],llbuff3[22];
@ -1103,7 +1103,7 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend,
block_info.next_filepos=pos; block_info.next_filepos=pos;
do do
{ {
if (_ma_read_cache(&param->read_cache,(byte*) block_info.header, if (_ma_read_cache(&param->read_cache,(uchar*) block_info.header,
(start_block=block_info.next_filepos), (start_block=block_info.next_filepos),
sizeof(block_info.header), sizeof(block_info.header),
(flag ? 0 : READING_NEXT) | READING_HEADER)) (flag ? 0 : READING_NEXT) | READING_HEADER))
@ -1215,7 +1215,7 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend,
got_error=1; got_error=1;
break; break;
} }
if (_ma_read_cache(&param->read_cache,(byte*) to,block_info.filepos, if (_ma_read_cache(&param->read_cache,(uchar*) to,block_info.filepos,
(uint) block_info.data_len, (uint) block_info.data_len,
flag == 1 ? READING_NEXT : 0)) flag == 1 ? READING_NEXT : 0))
{ {
@ -1297,7 +1297,7 @@ next:;
static int check_compressed_record(HA_CHECK *param, MARIA_HA *info, int extend, static int check_compressed_record(HA_CHECK *param, MARIA_HA *info, int extend,
byte *record) uchar *record)
{ {
my_off_t start_recpos, pos; my_off_t start_recpos, pos;
char llbuff[22]; char llbuff[22];
@ -1311,7 +1311,7 @@ static int check_compressed_record(HA_CHECK *param, MARIA_HA *info, int extend,
if (*_ma_killed_ptr(param)) if (*_ma_killed_ptr(param))
DBUG_RETURN(-1); DBUG_RETURN(-1);
if (_ma_read_cache(&param->read_cache,(byte*) block_info.header, pos, if (_ma_read_cache(&param->read_cache,(uchar*) block_info.header, pos,
info->s->pack.ref_length, READING_NEXT)) info->s->pack.ref_length, READING_NEXT))
{ {
_ma_check_print_error(param, _ma_check_print_error(param,
@ -1335,7 +1335,7 @@ static int check_compressed_record(HA_CHECK *param, MARIA_HA *info, int extend,
got_error=1; got_error=1;
goto end; goto end;
} }
if (_ma_read_cache(&param->read_cache,(byte*) info->rec_buff, if (_ma_read_cache(&param->read_cache,(uchar*) info->rec_buff,
block_info.filepos, block_info.rec_len, READING_NEXT)) block_info.filepos, block_info.rec_len, READING_NEXT))
{ {
_ma_check_print_error(param, _ma_check_print_error(param,
@ -1380,12 +1380,12 @@ end:
*/ */
static int check_page_layout(HA_CHECK *param, MARIA_HA *info, static int check_page_layout(HA_CHECK *param, MARIA_HA *info,
my_off_t page_pos, byte *page, my_off_t page_pos, uchar *page,
uint row_count, uint head_empty, uint row_count, uint head_empty,
uint *real_rows_found) uint *real_rows_found)
{ {
uint empty, last_row_end, row, first_dir_entry; uint empty, last_row_end, row, first_dir_entry;
byte *dir_entry; uchar *dir_entry;
char llbuff[22]; char llbuff[22];
DBUG_ENTER("check_page_layout"); DBUG_ENTER("check_page_layout");
@ -1460,11 +1460,11 @@ static int check_page_layout(HA_CHECK *param, MARIA_HA *info,
*/ */
static my_bool check_head_page(HA_CHECK *param, MARIA_HA *info, byte *record, static my_bool check_head_page(HA_CHECK *param, MARIA_HA *info, uchar *record,
int extend, my_off_t page_pos, byte *page_buff, int extend, my_off_t page_pos, uchar *page_buff,
uint row_count) uint row_count)
{ {
byte *dir_entry; uchar *dir_entry;
uint row; uint row;
char llbuff[22], llbuff2[22]; char llbuff[22], llbuff2[22];
DBUG_ENTER("check_head_page"); DBUG_ENTER("check_head_page");
@ -1512,7 +1512,7 @@ static my_bool check_head_page(HA_CHECK *param, MARIA_HA *info, byte *record,
} }
if (info->cur_row.extents_count) if (info->cur_row.extents_count)
{ {
byte *extents= info->cur_row.extents; uchar *extents= info->cur_row.extents;
uint i; uint i;
/* Check that bitmap has the right marker for the found extents */ /* Check that bitmap has the right marker for the found extents */
for (i= 0 ; i < info->cur_row.extents_count ; i++) for (i= 0 ; i < info->cur_row.extents_count ; i++)
@ -1562,10 +1562,10 @@ static my_bool check_head_page(HA_CHECK *param, MARIA_HA *info, byte *record,
*/ */
static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend, static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend,
byte *record) uchar *record)
{ {
my_off_t pos; my_off_t pos;
byte *page_buff, *bitmap_buff, *data; uchar *page_buff, *bitmap_buff, *data;
char llbuff[22], llbuff2[22]; char llbuff[22], llbuff2[22];
uint block_size= info->s->block_size; uint block_size= info->s->block_size;
ha_rows full_page_count, tail_count; ha_rows full_page_count, tail_count;
@ -1737,7 +1737,7 @@ err:
int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info,int extend) int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info,int extend)
{ {
int error; int error;
byte *record; uchar *record;
char llbuff[22],llbuff2[22],llbuff3[22]; char llbuff[22],llbuff2[22],llbuff3[22];
DBUG_ENTER("maria_chk_data_link"); DBUG_ENTER("maria_chk_data_link");
@ -1749,7 +1749,7 @@ int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info,int extend)
puts("- check record links"); puts("- check record links");
} }
if (!(record= (byte*) my_malloc(info->s->base.pack_reclength,MYF(0)))) if (!(record= (uchar*) my_malloc(info->s->base.pack_reclength,MYF(0))))
{ {
_ma_check_print_error(param,"Not enough memory for record"); _ma_check_print_error(param,"Not enough memory for record");
DBUG_RETURN(-1); DBUG_RETURN(-1);
@ -1898,11 +1898,11 @@ int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info,int extend)
printf("Lost space: %12s Linkdata: %10s\n", printf("Lost space: %12s Linkdata: %10s\n",
llstr(param->empty, llbuff),llstr(param->link_used, llbuff2)); llstr(param->empty, llbuff),llstr(param->link_used, llbuff2));
} }
my_free((gptr) record,MYF(0)); my_free((uchar*) record,MYF(0));
DBUG_RETURN (error); DBUG_RETURN (error);
err: err:
my_free((gptr) record,MYF(0)); my_free((uchar*) record,MYF(0));
param->testflag|=T_RETRY_WITHOUT_QUICK; param->testflag|=T_RETRY_WITHOUT_QUICK;
DBUG_RETURN(1); DBUG_RETURN(1);
} /* maria_chk_data_link */ } /* maria_chk_data_link */
@ -1912,7 +1912,7 @@ int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info,int extend)
/* Save new datafile-name in temp_filename */ /* Save new datafile-name in temp_filename */
int maria_repair(HA_CHECK *param, register MARIA_HA *info, int maria_repair(HA_CHECK *param, register MARIA_HA *info,
my_string name, int rep_quick) char *name, int rep_quick)
{ {
int error,got_error; int error,got_error;
uint i; uint i;
@ -1957,7 +1957,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info,
MYF(MY_WME | MY_WAIT_IF_FULL))) MYF(MY_WME | MY_WAIT_IF_FULL)))
goto err; goto err;
info->opt_flag|=WRITE_CACHE_USED; info->opt_flag|=WRITE_CACHE_USED;
if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength, if (!(sort_param.record=(uchar*) my_malloc((uint) share->base.pack_reclength,
MYF(0))) || MYF(0))) ||
_ma_alloc_buffer(&sort_param.rec_buff, &sort_param.rec_buff_size, _ma_alloc_buffer(&sort_param.rec_buff, &sort_param.rec_buff_size,
info->s->base.default_rec_buff_size)) info->s->base.default_rec_buff_size))
@ -2038,7 +2038,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info,
{ {
if (my_errno != HA_ERR_FOUND_DUPP_KEY) if (my_errno != HA_ERR_FOUND_DUPP_KEY)
goto err; goto err;
DBUG_DUMP("record",(byte*) sort_param.record,share->base.pack_reclength); DBUG_DUMP("record",(uchar*) sort_param.record,share->base.pack_reclength);
_ma_check_print_info(param,"Duplicate key %2d for record at %10s against new record at %10s", _ma_check_print_info(param,"Duplicate key %2d for record at %10s against new record at %10s",
info->errkey+1, info->errkey+1,
llstr(sort_param.start_recpos,llbuff), llstr(sort_param.start_recpos,llbuff),
@ -2180,9 +2180,9 @@ err:
static int writekeys(MARIA_SORT_PARAM *sort_param) static int writekeys(MARIA_SORT_PARAM *sort_param)
{ {
register uint i; register uint i;
byte *key; uchar *key;
MARIA_HA *info= sort_param->sort_info->info; MARIA_HA *info= sort_param->sort_info->info;
byte *buff= sort_param->record; uchar *buff= sort_param->record;
my_off_t filepos= sort_param->filepos; my_off_t filepos= sort_param->filepos;
DBUG_ENTER("writekeys"); DBUG_ENTER("writekeys");
@ -2246,12 +2246,12 @@ static int writekeys(MARIA_SORT_PARAM *sort_param)
/* Change all key-pointers that points to a records */ /* Change all key-pointers that points to a records */
int maria_movepoint(register MARIA_HA *info, byte *record, int maria_movepoint(register MARIA_HA *info, uchar *record,
MARIA_RECORD_POS oldpos, MARIA_RECORD_POS newpos, MARIA_RECORD_POS oldpos, MARIA_RECORD_POS newpos,
uint prot_key) uint prot_key)
{ {
register uint i; register uint i;
byte *key; uchar *key;
uint key_length; uint key_length;
DBUG_ENTER("maria_movepoint"); DBUG_ENTER("maria_movepoint");
@ -2323,7 +2323,7 @@ int _ma_flush_blocks(HA_CHECK *param, PAGECACHE *pagecache,
/* Sort index for more efficent reads */ /* Sort index for more efficent reads */
int maria_sort_index(HA_CHECK *param, register MARIA_HA *info, my_string name) int maria_sort_index(HA_CHECK *param, register MARIA_HA *info, char *name)
{ {
reg2 uint key; reg2 uint key;
reg1 MARIA_KEYDEF *keyinfo; reg1 MARIA_KEYDEF *keyinfo;
@ -2430,8 +2430,8 @@ static int sort_one_index(HA_CHECK *param, MARIA_HA *info,
my_off_t pagepos, File new_file) my_off_t pagepos, File new_file)
{ {
uint length,nod_flag,used_length, key_length; uint length,nod_flag,used_length, key_length;
byte *buff,*keypos,*endpos; uchar *buff,*keypos,*endpos;
byte key[HA_MAX_POSSIBLE_KEY_BUFF]; uchar key[HA_MAX_POSSIBLE_KEY_BUFF];
my_off_t new_page_pos,next_page; my_off_t new_page_pos,next_page;
char llbuff[22]; char llbuff[22];
DBUG_ENTER("sort_one_index"); DBUG_ENTER("sort_one_index");
@ -2441,7 +2441,7 @@ static int sort_one_index(HA_CHECK *param, MARIA_HA *info,
new_page_pos=param->new_file_pos; new_page_pos=param->new_file_pos;
param->new_file_pos+=keyinfo->block_length; param->new_file_pos+=keyinfo->block_length;
if (!(buff= (byte*) my_alloca((uint) keyinfo->block_length))) if (!(buff= (uchar*) my_alloca((uint) keyinfo->block_length)))
{ {
_ma_check_print_error(param,"Not enough memory for key block"); _ma_check_print_error(param,"Not enough memory for key block");
DBUG_RETURN(-1); DBUG_RETURN(-1);
@ -2470,7 +2470,7 @@ static int sort_one_index(HA_CHECK *param, MARIA_HA *info,
("From page: %ld, keyoffset: %lu used_length: %d", ("From page: %ld, keyoffset: %lu used_length: %d",
(ulong) pagepos, (ulong) (keypos - buff), (ulong) pagepos, (ulong) (keypos - buff),
(int) used_length)); (int) used_length));
DBUG_DUMP("buff",(byte*) buff,used_length); DBUG_DUMP("buff",(uchar*) buff,used_length);
goto err; goto err;
} }
} }
@ -2499,17 +2499,17 @@ static int sort_one_index(HA_CHECK *param, MARIA_HA *info,
/* Fill block with zero and write it to the new index file */ /* Fill block with zero and write it to the new index file */
length= maria_data_on_page(buff); length= maria_data_on_page(buff);
bzero((byte*) buff+length,keyinfo->block_length-length); bzero((uchar*) buff+length,keyinfo->block_length-length);
if (my_pwrite(new_file,(byte*) buff,(uint) keyinfo->block_length, if (my_pwrite(new_file,(uchar*) buff,(uint) keyinfo->block_length,
new_page_pos,MYF(MY_NABP | MY_WAIT_IF_FULL))) new_page_pos,MYF(MY_NABP | MY_WAIT_IF_FULL)))
{ {
_ma_check_print_error(param,"Can't write indexblock, error: %d",my_errno); _ma_check_print_error(param,"Can't write indexblock, error: %d",my_errno);
goto err; goto err;
} }
my_afree((gptr) buff); my_afree((uchar*) buff);
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
my_afree((gptr) buff); my_afree((uchar*) buff);
DBUG_RETURN(1); DBUG_RETURN(1);
} /* sort_one_index */ } /* sort_one_index */
@ -2560,13 +2560,13 @@ int maria_filecopy(HA_CHECK *param, File to,File from,my_off_t start,
VOID(my_seek(from,start,MY_SEEK_SET,MYF(0))); VOID(my_seek(from,start,MY_SEEK_SET,MYF(0)));
while (length > buff_length) while (length > buff_length)
{ {
if (my_read(from,(byte*) buff,buff_length,MYF(MY_NABP)) || if (my_read(from,(uchar*) buff,buff_length,MYF(MY_NABP)) ||
my_write(to,(byte*) buff,buff_length,param->myf_rw)) my_write(to,(uchar*) buff,buff_length,param->myf_rw))
goto err; goto err;
length-= buff_length; length-= buff_length;
} }
if (my_read(from,(byte*) buff,(uint) length,MYF(MY_NABP)) || if (my_read(from,(uchar*) buff,(uint) length,MYF(MY_NABP)) ||
my_write(to,(byte*) buff,(uint) length,param->myf_rw)) my_write(to,(uchar*) buff,(uint) length,param->myf_rw))
goto err; goto err;
if (buff != tmp_buff) if (buff != tmp_buff)
my_free(buff,MYF(0)); my_free(buff,MYF(0));
@ -2649,7 +2649,7 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info,
info->opt_flag|=WRITE_CACHE_USED; info->opt_flag|=WRITE_CACHE_USED;
info->rec_cache.file= info->dfile.file; /* for sort_delete_record */ info->rec_cache.file= info->dfile.file; /* for sort_delete_record */
if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength, if (!(sort_param.record=(uchar*) my_malloc((uint) share->base.pack_reclength,
MYF(0))) || MYF(0))) ||
_ma_alloc_buffer(&sort_param.rec_buff, &sort_param.rec_buff_size, _ma_alloc_buffer(&sort_param.rec_buff, &sort_param.rec_buff_size,
info->s->base.default_rec_buff_size)) info->s->base.default_rec_buff_size))
@ -2958,8 +2958,8 @@ err:
my_free(sort_param.rec_buff, MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_param.rec_buff, MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
my_free((gptr) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR)); my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
my_free((gptr) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR)); my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
VOID(end_io_cache(&param->read_cache)); VOID(end_io_cache(&param->read_cache));
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
@ -3485,9 +3485,9 @@ err:
pthread_cond_destroy (&sort_info.cond); pthread_cond_destroy (&sort_info.cond);
pthread_mutex_destroy(&sort_info.mutex); pthread_mutex_destroy(&sort_info.mutex);
my_free((gptr) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR)); my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
my_free((gptr) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR)); my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
my_free((gptr) sort_param,MYF(MY_ALLOW_ZERO_PTR)); my_free((uchar*) sort_param,MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
VOID(end_io_cache(&param->read_cache)); VOID(end_io_cache(&param->read_cache));
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
@ -3499,7 +3499,7 @@ err:
/* Read next record and return next key */ /* Read next record and return next key */
static int sort_key_read(MARIA_SORT_PARAM *sort_param, byte *key) static int sort_key_read(MARIA_SORT_PARAM *sort_param, uchar *key)
{ {
int error; int error;
MARIA_SORT_INFO *sort_info= sort_param->sort_info; MARIA_SORT_INFO *sort_info= sort_param->sort_info;
@ -3527,7 +3527,7 @@ static int sort_key_read(MARIA_SORT_PARAM *sort_param, byte *key)
} /* sort_key_read */ } /* sort_key_read */
static int sort_maria_ft_key_read(MARIA_SORT_PARAM *sort_param, byte *key) static int sort_maria_ft_key_read(MARIA_SORT_PARAM *sort_param, uchar *key)
{ {
int error; int error;
MARIA_SORT_INFO *sort_info=sort_param->sort_info; MARIA_SORT_INFO *sort_info=sort_param->sort_info;
@ -3667,7 +3667,7 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param)
} }
case DYNAMIC_RECORD: case DYNAMIC_RECORD:
{ {
byte *to; uchar *to;
LINT_INIT(to); LINT_INIT(to);
pos=sort_param->pos; pos=sort_param->pos;
searching=(sort_param->fix_datafile && (param->testflag & T_EXTEND)); searching=(sort_param->fix_datafile && (param->testflag & T_EXTEND));
@ -3699,7 +3699,7 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param)
llstr(param->search_after_block,llbuff), llstr(param->search_after_block,llbuff),
llstr(sort_param->start_recpos,llbuff2)); llstr(sort_param->start_recpos,llbuff2));
if (_ma_read_cache(&sort_param->read_cache, if (_ma_read_cache(&sort_param->read_cache,
(byte*) block_info.header,pos, (uchar*) block_info.header,pos,
MARIA_BLOCK_INFO_HEADER_LENGTH, MARIA_BLOCK_INFO_HEADER_LENGTH,
(! found_record ? READING_NEXT : 0) | (! found_record ? READING_NEXT : 0) |
parallel_flag | READING_HEADER)) parallel_flag | READING_HEADER))
@ -3968,7 +3968,7 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param)
case COMPRESSED_RECORD: case COMPRESSED_RECORD:
for (searching=0 ;; searching=1, sort_param->pos++) for (searching=0 ;; searching=1, sort_param->pos++)
{ {
if (_ma_read_cache(&sort_param->read_cache,(byte*) block_info.header, if (_ma_read_cache(&sort_param->read_cache,(uchar*) block_info.header,
sort_param->pos, sort_param->pos,
share->pack.ref_length,READING_NEXT)) share->pack.ref_length,READING_NEXT))
DBUG_RETURN(-1); DBUG_RETURN(-1);
@ -3998,7 +3998,7 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param)
llstr(sort_param->pos,llbuff)); llstr(sort_param->pos,llbuff));
continue; continue;
} }
if (_ma_read_cache(&sort_param->read_cache,(byte*) sort_param->rec_buff, if (_ma_read_cache(&sort_param->read_cache,(uchar*) sort_param->rec_buff,
block_info.filepos, block_info.rec_len, block_info.filepos, block_info.rec_len,
READING_NEXT)) READING_NEXT))
{ {
@ -4058,8 +4058,8 @@ int _ma_sort_write_record(MARIA_SORT_PARAM *sort_param)
int flag; int flag;
uint length; uint length;
ulong block_length,reclength; ulong block_length,reclength;
byte *from; uchar *from;
byte block_buff[8]; uchar block_buff[8];
MARIA_SORT_INFO *sort_info=sort_param->sort_info; MARIA_SORT_INFO *sort_info=sort_param->sort_info;
HA_CHECK *param=sort_info->param; HA_CHECK *param=sort_info->param;
MARIA_HA *info=sort_info->info; MARIA_HA *info=sort_info->info;
@ -4135,7 +4135,7 @@ int _ma_sort_write_record(MARIA_SORT_PARAM *sort_param)
length+= _ma_save_pack_length((uint) share->pack.version, length+= _ma_save_pack_length((uint) share->pack.version,
block_buff + length, info->blob_length); block_buff + length, info->blob_length);
if (my_b_write(&info->rec_cache,block_buff,length) || if (my_b_write(&info->rec_cache,block_buff,length) ||
my_b_write(&info->rec_cache,(byte*) sort_param->rec_buff,reclength)) my_b_write(&info->rec_cache,(uchar*) sort_param->rec_buff,reclength))
{ {
_ma_check_print_error(param,"%d when writing to datafile",my_errno); _ma_check_print_error(param,"%d when writing to datafile",my_errno);
DBUG_RETURN(1); DBUG_RETURN(1);
@ -4171,7 +4171,7 @@ static int sort_key_cmp(MARIA_SORT_PARAM *sort_param, const void *a,
} /* sort_key_cmp */ } /* sort_key_cmp */
static int sort_key_write(MARIA_SORT_PARAM *sort_param, const byte *a) static int sort_key_write(MARIA_SORT_PARAM *sort_param, const uchar *a)
{ {
uint diff_pos[2]; uint diff_pos[2];
char llbuff[22],llbuff2[22]; char llbuff[22],llbuff2[22];
@ -4244,7 +4244,7 @@ int _ma_sort_ft_buf_flush(MARIA_SORT_PARAM *sort_param)
uint val_off, val_len; uint val_off, val_len;
int error; int error;
SORT_FT_BUF *maria_ft_buf=sort_info->ft_buf; SORT_FT_BUF *maria_ft_buf=sort_info->ft_buf;
byte *from, *to; uchar *from, *to;
val_len=share->ft2_keyinfo.keylength; val_len=share->ft2_keyinfo.keylength;
get_key_full_length_rdonly(val_off, maria_ft_buf->lastkey); get_key_full_length_rdonly(val_off, maria_ft_buf->lastkey);
@ -4283,7 +4283,7 @@ int _ma_sort_ft_buf_flush(MARIA_SORT_PARAM *sort_param)
static int sort_maria_ft_key_write(MARIA_SORT_PARAM *sort_param, static int sort_maria_ft_key_write(MARIA_SORT_PARAM *sort_param,
const byte *a) const uchar *a)
{ {
uint a_len, val_off, val_len, error; uint a_len, val_off, val_len, error;
MARIA_SORT_INFO *sort_info= sort_param->sort_info; MARIA_SORT_INFO *sort_info= sort_param->sort_info;
@ -4320,7 +4320,7 @@ static int sort_maria_ft_key_write(MARIA_SORT_PARAM *sort_param,
((uchar *)a)+1,a_len-1, ((uchar *)a)+1,a_len-1,
(uchar*) ft_buf->lastkey+1,val_off-1, 0, 0)==0) (uchar*) ft_buf->lastkey+1,val_off-1, 0, 0)==0)
{ {
byte *p; uchar *p;
if (!ft_buf->buf) /* store in second-level tree */ if (!ft_buf->buf) /* store in second-level tree */
{ {
ft_buf->count++; ft_buf->count++;
@ -4374,7 +4374,7 @@ word_init_ft_buf:
/* get pointer to record from a key */ /* get pointer to record from a key */
static my_off_t get_record_for_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, static my_off_t get_record_for_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
const byte *key) const uchar *key)
{ {
return _ma_dpos(info,0, key + _ma_keylength(keyinfo, key)); return _ma_dpos(info,0, key + _ma_keylength(keyinfo, key));
} /* get_record_for_key */ } /* get_record_for_key */
@ -4384,12 +4384,12 @@ static my_off_t get_record_for_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
static int sort_insert_key(MARIA_SORT_PARAM *sort_param, static int sort_insert_key(MARIA_SORT_PARAM *sort_param,
register SORT_KEY_BLOCKS *key_block, register SORT_KEY_BLOCKS *key_block,
const byte *key, const uchar *key,
my_off_t prev_block) my_off_t prev_block)
{ {
uint a_length,t_length,nod_flag; uint a_length,t_length,nod_flag;
my_off_t filepos,key_file_length; my_off_t filepos,key_file_length;
byte *anc_buff,*lastkey; uchar *anc_buff,*lastkey;
MARIA_KEY_PARAM s_temp; MARIA_KEY_PARAM s_temp;
MARIA_HA *info; MARIA_HA *info;
MARIA_KEYDEF *keyinfo=sort_param->keyinfo; MARIA_KEYDEF *keyinfo=sort_param->keyinfo;
@ -4423,7 +4423,7 @@ static int sort_insert_key(MARIA_SORT_PARAM *sort_param,
_ma_kpointer(info,key_block->end_pos,prev_block); _ma_kpointer(info,key_block->end_pos,prev_block);
t_length=(*keyinfo->pack_key)(keyinfo,nod_flag, t_length=(*keyinfo->pack_key)(keyinfo,nod_flag,
(byte*) 0,lastkey,lastkey,key, (uchar*) 0,lastkey,lastkey,key,
&s_temp); &s_temp);
(*keyinfo->store_key)(keyinfo, key_block->end_pos+nod_flag,&s_temp); (*keyinfo->store_key)(keyinfo, key_block->end_pos+nod_flag,&s_temp);
a_length+=t_length; a_length+=t_length;
@ -4471,7 +4471,7 @@ static int sort_delete_record(MARIA_SORT_PARAM *sort_param)
{ {
uint i; uint i;
int old_file,error; int old_file,error;
byte *key; uchar *key;
MARIA_SORT_INFO *sort_info=sort_param->sort_info; MARIA_SORT_INFO *sort_info=sort_param->sort_info;
HA_CHECK *param=sort_info->param; HA_CHECK *param=sort_info->param;
MARIA_HA *info=sort_info->info; MARIA_HA *info=sort_info->info;
@ -4589,7 +4589,7 @@ static SORT_KEY_BLOCKS *alloc_key_blocks(HA_CHECK *param, uint blocks,
for (i=0 ; i < blocks ; i++) for (i=0 ; i < blocks ; i++)
{ {
block[i].inited=0; block[i].inited=0;
block[i].buff= (byte*) (block+blocks)+(buffer_length+IO_SIZE)*i; block[i].buff= (uchar*) (block+blocks)+(buffer_length+IO_SIZE)*i;
} }
DBUG_RETURN(block); DBUG_RETURN(block);
} /* alloc_key_blocks */ } /* alloc_key_blocks */
@ -4635,34 +4635,34 @@ int maria_recreate_table(HA_CHECK *param, MARIA_HA **org_info, char *filename)
if (!(keyinfo=(MARIA_KEYDEF*) my_alloca(sizeof(MARIA_KEYDEF) * if (!(keyinfo=(MARIA_KEYDEF*) my_alloca(sizeof(MARIA_KEYDEF) *
share.base.keys))) share.base.keys)))
DBUG_RETURN(0); DBUG_RETURN(0);
memcpy((byte*) keyinfo,(byte*) share.keyinfo, memcpy((uchar*) keyinfo,(uchar*) share.keyinfo,
(size_t) (sizeof(MARIA_KEYDEF)*share.base.keys)); (size_t) (sizeof(MARIA_KEYDEF)*share.base.keys));
key_parts= share.base.all_key_parts; key_parts= share.base.all_key_parts;
if (!(keysegs=(HA_KEYSEG*) my_alloca(sizeof(HA_KEYSEG)* if (!(keysegs=(HA_KEYSEG*) my_alloca(sizeof(HA_KEYSEG)*
(key_parts+share.base.keys)))) (key_parts+share.base.keys))))
{ {
my_afree((gptr) keyinfo); my_afree((uchar*) keyinfo);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (!(columndef=(MARIA_COLUMNDEF*) if (!(columndef=(MARIA_COLUMNDEF*)
my_alloca(sizeof(MARIA_COLUMNDEF)*(share.base.fields+1)))) my_alloca(sizeof(MARIA_COLUMNDEF)*(share.base.fields+1))))
{ {
my_afree((gptr) keyinfo); my_afree((uchar*) keyinfo);
my_afree((gptr) keysegs); my_afree((uchar*) keysegs);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (!(uniquedef=(MARIA_UNIQUEDEF*) if (!(uniquedef=(MARIA_UNIQUEDEF*)
my_alloca(sizeof(MARIA_UNIQUEDEF)*(share.state.header.uniques+1)))) my_alloca(sizeof(MARIA_UNIQUEDEF)*(share.state.header.uniques+1))))
{ {
my_afree((gptr) columndef); my_afree((uchar*) columndef);
my_afree((gptr) keyinfo); my_afree((uchar*) keyinfo);
my_afree((gptr) keysegs); my_afree((uchar*) keysegs);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
/* Copy the column definitions */ /* Copy the column definitions */
memcpy((byte*) columndef,(byte*) share.columndef, memcpy((uchar*) columndef,(uchar*) share.columndef,
(size_t) (sizeof(MARIA_COLUMNDEF)*(share.base.fields+1))); (size_t) (sizeof(MARIA_COLUMNDEF)*(share.base.fields+1)));
for (column=columndef, end= columndef+share.base.fields; for (column=columndef, end= columndef+share.base.fields;
column != end ; column != end ;
@ -4676,7 +4676,7 @@ int maria_recreate_table(HA_CHECK *param, MARIA_HA **org_info, char *filename)
} }
/* Change the new key to point at the saved key segments */ /* Change the new key to point at the saved key segments */
memcpy((byte*) keysegs,(byte*) share.keyparts, memcpy((uchar*) keysegs,(uchar*) share.keyparts,
(size_t) (sizeof(HA_KEYSEG)*(key_parts+share.base.keys+ (size_t) (sizeof(HA_KEYSEG)*(key_parts+share.base.keys+
share.state.header.uniques))); share.state.header.uniques)));
keyseg=keysegs; keyseg=keysegs;
@ -4695,7 +4695,7 @@ int maria_recreate_table(HA_CHECK *param, MARIA_HA **org_info, char *filename)
Copy the unique definitions and change them to point at the new key Copy the unique definitions and change them to point at the new key
segments segments
*/ */
memcpy((byte*) uniquedef,(byte*) share.uniqueinfo, memcpy((uchar*) uniquedef,(uchar*) share.uniqueinfo,
(size_t) (sizeof(MARIA_UNIQUEDEF)*(share.state.header.uniques))); (size_t) (sizeof(MARIA_UNIQUEDEF)*(share.state.header.uniques)));
for (u_ptr=uniquedef,u_end=uniquedef+share.state.header.uniques; for (u_ptr=uniquedef,u_end=uniquedef+share.state.header.uniques;
u_ptr != u_end ; u_ptr++) u_ptr != u_end ; u_ptr++)
@ -4787,10 +4787,10 @@ int maria_recreate_table(HA_CHECK *param, MARIA_HA **org_info, char *filename)
goto end; goto end;
error=0; error=0;
end: end:
my_afree((gptr) uniquedef); my_afree((uchar*) uniquedef);
my_afree((gptr) keyinfo); my_afree((uchar*) keyinfo);
my_afree((gptr) columndef); my_afree((uchar*) columndef);
my_afree((gptr) keysegs); my_afree((uchar*) keysegs);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
@ -4894,7 +4894,7 @@ err:
void _ma_update_auto_increment_key(HA_CHECK *param, MARIA_HA *info, void _ma_update_auto_increment_key(HA_CHECK *param, MARIA_HA *info,
my_bool repair_only) my_bool repair_only)
{ {
byte *record; uchar *record;
DBUG_ENTER("update_auto_increment_key"); DBUG_ENTER("update_auto_increment_key");
if (!info->s->base.auto_key || if (!info->s->base.auto_key ||
@ -4913,7 +4913,7 @@ void _ma_update_auto_increment_key(HA_CHECK *param, MARIA_HA *info,
We have to use an allocated buffer instead of info->rec_buff as We have to use an allocated buffer instead of info->rec_buff as
_ma_put_key_in_record() may use info->rec_buff _ma_put_key_in_record() may use info->rec_buff
*/ */
if (!(record= (byte*) my_malloc((uint) info->s->base.pack_reclength, if (!(record= (uchar*) my_malloc((uint) info->s->base.pack_reclength,
MYF(0)))) MYF(0))))
{ {
_ma_check_print_error(param,"Not enough memory for extra record"); _ma_check_print_error(param,"Not enough memory for extra record");
@ -5041,10 +5041,10 @@ void maria_update_key_parts(MARIA_KEYDEF *keyinfo, ulong *rec_per_key_part,
} }
static ha_checksum maria_byte_checksum(const byte *buf, uint length) static ha_checksum maria_byte_checksum(const uchar *buf, uint length)
{ {
ha_checksum crc; ha_checksum crc;
const byte *end=buf+length; const uchar *end=buf+length;
for (crc=0; buf != end; buf++) for (crc=0; buf != end; buf++)
crc=((crc << 1) + *((uchar*) buf)) + crc=((crc << 1) + *((uchar*) buf)) +
test(crc & (((ha_checksum) 1) << (8*sizeof(ha_checksum)-1))); test(crc & (((ha_checksum) 1) << (8*sizeof(ha_checksum)-1)));

View File

@ -182,7 +182,7 @@ my_bool execute_checkpoint_indirect()
LSN candidate_max_rec_lsn_at_last_checkpoint; LSN candidate_max_rec_lsn_at_last_checkpoint;
DBUG_ENTER("execute_checkpoint_indirect"); DBUG_ENTER("execute_checkpoint_indirect");
DBUG_ASSERT(sizeof(byte *) <= 8); DBUG_ASSERT(sizeof(uchar *) <= 8);
DBUG_ASSERT(sizeof(LSN) <= 8); DBUG_ASSERT(sizeof(LSN) <= 8);
safemutex_assert_owner(log_mutex); safemutex_assert_owner(log_mutex);

View File

@ -17,7 +17,7 @@
#include "maria_def.h" #include "maria_def.h"
ha_checksum _ma_checksum(MARIA_HA *info, const byte *record) ha_checksum _ma_checksum(MARIA_HA *info, const uchar *record)
{ {
ha_checksum crc=0; ha_checksum crc=0;
MARIA_COLUMNDEF *column= info->s->columndef; MARIA_COLUMNDEF *column= info->s->columndef;
@ -28,7 +28,7 @@ ha_checksum _ma_checksum(MARIA_HA *info, const byte *record)
for ( ; column != column_end ; column++) for ( ; column != column_end ; column++)
{ {
const byte *pos= record + column->offset; const uchar *pos= record + column->offset;
ulong length; ulong length;
switch (column->type) { switch (column->type) {
@ -63,7 +63,7 @@ ha_checksum _ma_checksum(MARIA_HA *info, const byte *record)
} }
ha_checksum _ma_static_checksum(MARIA_HA *info, const byte *pos) ha_checksum _ma_static_checksum(MARIA_HA *info, const uchar *pos)
{ {
return my_checksum(0, pos, info->s->base.reclength); return my_checksum(0, pos, info->s->base.reclength);
} }

View File

@ -107,18 +107,18 @@ int maria_close(register MARIA_HA *info)
} }
} }
#endif #endif
my_free((gptr) info->s,MYF(0)); my_free((uchar*) info->s,MYF(0));
} }
pthread_mutex_unlock(&THR_LOCK_maria); pthread_mutex_unlock(&THR_LOCK_maria);
if (info->ftparser_param) if (info->ftparser_param)
{ {
my_free((gptr)info->ftparser_param, MYF(0)); my_free((uchar*)info->ftparser_param, MYF(0));
info->ftparser_param= 0; info->ftparser_param= 0;
} }
if (info->dfile.file >= 0 && my_close(info->dfile.file, MYF(0))) if (info->dfile.file >= 0 && my_close(info->dfile.file, MYF(0)))
error = my_errno; error = my_errno;
my_free((gptr) info,MYF(0)); my_free((uchar*) info,MYF(0));
if (error) if (error)
{ {

View File

@ -90,7 +90,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
} }
errpos=0; errpos=0;
options=0; options=0;
bzero((byte*) &share,sizeof(share)); bzero((uchar*) &share,sizeof(share));
if (flags & HA_DONT_TOUCH_DATA) if (flags & HA_DONT_TOUCH_DATA)
{ {
@ -232,7 +232,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
if ((packed & 7) == 1) if ((packed & 7) == 1)
{ {
/* /*
Not optimal packing, try to remove a 1 byte length zero-field as Not optimal packing, try to remove a 1 uchar length zero-field as
this will get same record length, but smaller pack overhead this will get same record length, but smaller pack overhead
*/ */
while (column != columndef) while (column != columndef)
@ -401,7 +401,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
} }
keydef->keysegs+=sp_segs; keydef->keysegs+=sp_segs;
key_length+=SPLEN*sp_segs; key_length+=SPLEN*sp_segs;
length++; /* At least one length byte */ length++; /* At least one length uchar */
min_key_length_skip+=SPLEN*2*SPDIMS; min_key_length_skip+=SPLEN*2*SPDIMS;
#else #else
my_errno= HA_ERR_UNSUPPORTED; my_errno= HA_ERR_UNSUPPORTED;
@ -437,7 +437,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
fulltext_keys++; fulltext_keys++;
key_length+= HA_FT_MAXBYTELEN+HA_FT_WLEN; key_length+= HA_FT_MAXBYTELEN+HA_FT_WLEN;
length++; /* At least one length byte */ length++; /* At least one length uchar */
min_key_length_skip+=HA_FT_MAXBYTELEN; min_key_length_skip+=HA_FT_MAXBYTELEN;
real_length_diff=HA_FT_MAXBYTELEN-FT_MAX_WORD_LEN_FOR_SORT; real_length_diff=HA_FT_MAXBYTELEN-FT_MAX_WORD_LEN_FOR_SORT;
} }
@ -510,7 +510,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
DBUG_ASSERT(!(keyseg->flag & HA_VAR_LENGTH_PART)); DBUG_ASSERT(!(keyseg->flag & HA_VAR_LENGTH_PART));
keydef->flag |= HA_SPACE_PACK_USED | HA_VAR_LENGTH_KEY; keydef->flag |= HA_SPACE_PACK_USED | HA_VAR_LENGTH_KEY;
options|=HA_OPTION_PACK_KEYS; /* Using packed keys */ options|=HA_OPTION_PACK_KEYS; /* Using packed keys */
length++; /* At least one length byte */ length++; /* At least one length uchar */
min_key_length_skip+=keyseg->length; min_key_length_skip+=keyseg->length;
if (keyseg->length >= 255) if (keyseg->length >= 255)
{ /* prefix may be 3 bytes */ { /* prefix may be 3 bytes */
@ -523,7 +523,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
DBUG_ASSERT(!test_all_bits(keyseg->flag, DBUG_ASSERT(!test_all_bits(keyseg->flag,
(HA_VAR_LENGTH_PART | HA_BLOB_PART))); (HA_VAR_LENGTH_PART | HA_BLOB_PART)));
keydef->flag|=HA_VAR_LENGTH_KEY; keydef->flag|=HA_VAR_LENGTH_KEY;
length++; /* At least one length byte */ length++; /* At least one length uchar */
options|=HA_OPTION_PACK_KEYS; /* Using packed keys */ options|=HA_OPTION_PACK_KEYS; /* Using packed keys */
min_key_length_skip+=keyseg->length; min_key_length_skip+=keyseg->length;
if (keyseg->length >= 255) if (keyseg->length >= 255)
@ -612,7 +612,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
goto err_no_lock; goto err_no_lock;
} }
bmove(share.state.header.file_version,(byte*) maria_file_magic,4); bmove(share.state.header.file_version,(uchar*) maria_file_magic,4);
ci->old_options=options| (ci->old_options & HA_OPTION_TEMP_COMPRESS_RECORD ? ci->old_options=options| (ci->old_options & HA_OPTION_TEMP_COMPRESS_RECORD ?
HA_OPTION_COMPRESS_RECORD | HA_OPTION_COMPRESS_RECORD |
HA_OPTION_TEMP_COMPRESS_RECORD: 0); HA_OPTION_TEMP_COMPRESS_RECORD: 0);
@ -920,11 +920,11 @@ int maria_create(const char *name, enum data_file_type datafile_type,
{ {
if (_ma_columndef_write(file, col_order[i])) if (_ma_columndef_write(file, col_order[i]))
{ {
my_free((gptr) col_order, MYF(0)); my_free((uchar*) col_order, MYF(0));
goto err; goto err;
} }
} }
my_free((gptr) col_order, MYF(0)); my_free((uchar*) col_order, MYF(0));
} }
else else
{ {

View File

@ -20,15 +20,15 @@
/* Print a key in user understandable format */ /* Print a key in user understandable format */
void _ma_print_key(FILE *stream, register HA_KEYSEG *keyseg, void _ma_print_key(FILE *stream, register HA_KEYSEG *keyseg,
const byte *key, uint length) const uchar *key, uint length)
{ {
int flag; int flag;
short int s_1; short int s_1;
long int l_1; long int l_1;
float f_1; float f_1;
double d_1; double d_1;
const byte *end; const uchar *end;
const byte *key_end= key + length; const uchar *key_end= key + length;
VOID(fputs("Key: \"",stream)); VOID(fputs("Key: \"",stream));
flag=0; flag=0;

View File

@ -19,23 +19,23 @@
#include "ma_rt_index.h" #include "ma_rt_index.h"
static int d_search(MARIA_HA *info,MARIA_KEYDEF *keyinfo,uint comp_flag, static int d_search(MARIA_HA *info,MARIA_KEYDEF *keyinfo,uint comp_flag,
byte *key,uint key_length,my_off_t page,byte *anc_buff); uchar *key,uint key_length,my_off_t page,uchar *anc_buff);
static int del(MARIA_HA *info,MARIA_KEYDEF *keyinfo,byte *key,byte *anc_buff, static int del(MARIA_HA *info,MARIA_KEYDEF *keyinfo,uchar *key,uchar *anc_buff,
my_off_t leaf_page,byte *leaf_buff,byte *keypos, my_off_t leaf_page,uchar *leaf_buff,uchar *keypos,
my_off_t next_block,byte *ret_key); my_off_t next_block,uchar *ret_key);
static int underflow(MARIA_HA *info,MARIA_KEYDEF *keyinfo,byte *anc_buff, static int underflow(MARIA_HA *info,MARIA_KEYDEF *keyinfo,uchar *anc_buff,
my_off_t leaf_page,byte *leaf_buff,byte *keypos); my_off_t leaf_page,uchar *leaf_buff,uchar *keypos);
static uint remove_key(MARIA_KEYDEF *keyinfo,uint nod_flag,byte *keypos, static uint remove_key(MARIA_KEYDEF *keyinfo,uint nod_flag,uchar *keypos,
byte *lastkey,byte *page_end, uchar *lastkey,uchar *page_end,
my_off_t *next_block); my_off_t *next_block);
static int _ma_ck_real_delete(register MARIA_HA *info,MARIA_KEYDEF *keyinfo, static int _ma_ck_real_delete(register MARIA_HA *info,MARIA_KEYDEF *keyinfo,
byte *key, uint key_length, my_off_t *root); uchar *key, uint key_length, my_off_t *root);
int maria_delete(MARIA_HA *info,const byte *record) int maria_delete(MARIA_HA *info,const uchar *record)
{ {
uint i; uint i;
byte *old_key; uchar *old_key;
int save_errno; int save_errno;
char lastpos[8]; char lastpos[8];
MARIA_SHARE *share=info->s; MARIA_SHARE *share=info->s;
@ -141,7 +141,7 @@ err:
/* Remove a key from the btree index */ /* Remove a key from the btree index */
int _ma_ck_delete(register MARIA_HA *info, uint keynr, byte *key, int _ma_ck_delete(register MARIA_HA *info, uint keynr, uchar *key,
uint key_length) uint key_length)
{ {
return _ma_ck_real_delete(info, info->s->keyinfo+keynr, key, key_length, return _ma_ck_real_delete(info, info->s->keyinfo+keynr, key, key_length,
@ -150,12 +150,12 @@ int _ma_ck_delete(register MARIA_HA *info, uint keynr, byte *key,
static int _ma_ck_real_delete(register MARIA_HA *info, MARIA_KEYDEF *keyinfo, static int _ma_ck_real_delete(register MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *key, uint key_length, my_off_t *root) uchar *key, uint key_length, my_off_t *root)
{ {
int error; int error;
uint nod_flag; uint nod_flag;
my_off_t old_root; my_off_t old_root;
byte *root_buff; uchar *root_buff;
DBUG_ENTER("_ma_ck_real_delete"); DBUG_ENTER("_ma_ck_real_delete");
if ((old_root=*root) == HA_OFFSET_ERROR) if ((old_root=*root) == HA_OFFSET_ERROR)
@ -163,7 +163,7 @@ static int _ma_ck_real_delete(register MARIA_HA *info, MARIA_KEYDEF *keyinfo,
maria_print_error(info->s, HA_ERR_CRASHED); maria_print_error(info->s, HA_ERR_CRASHED);
DBUG_RETURN(my_errno=HA_ERR_CRASHED); DBUG_RETURN(my_errno=HA_ERR_CRASHED);
} }
if (!(root_buff= (byte*) my_alloca((uint) keyinfo->block_length+ if (!(root_buff= (uchar*) my_alloca((uint) keyinfo->block_length+
HA_MAX_KEY_BUFF*2))) HA_MAX_KEY_BUFF*2)))
{ {
DBUG_PRINT("error",("Couldn't allocate memory")); DBUG_PRINT("error",("Couldn't allocate memory"));
@ -203,7 +203,7 @@ static int _ma_ck_real_delete(register MARIA_HA *info, MARIA_KEYDEF *keyinfo,
} }
} }
err: err:
my_afree((gptr) root_buff); my_afree((uchar*) root_buff);
DBUG_PRINT("exit",("Return: %d",error)); DBUG_PRINT("exit",("Return: %d",error));
DBUG_RETURN(error); DBUG_RETURN(error);
} /* _ma_ck_real_delete */ } /* _ma_ck_real_delete */
@ -218,15 +218,15 @@ err:
*/ */
static int d_search(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo, static int d_search(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
uint comp_flag, byte *key, uint key_length, uint comp_flag, uchar *key, uint key_length,
my_off_t page, byte *anc_buff) my_off_t page, uchar *anc_buff)
{ {
int flag,ret_value,save_flag; int flag,ret_value,save_flag;
uint length,nod_flag,search_key_length; uint length,nod_flag,search_key_length;
my_bool last_key; my_bool last_key;
byte *leaf_buff,*keypos; uchar *leaf_buff,*keypos;
my_off_t leaf_page,next_block; my_off_t leaf_page,next_block;
byte lastkey[HA_MAX_KEY_BUFF]; uchar lastkey[HA_MAX_KEY_BUFF];
DBUG_ENTER("d_search"); DBUG_ENTER("d_search");
DBUG_DUMP("page",anc_buff,maria_data_on_page(anc_buff)); DBUG_DUMP("page",anc_buff,maria_data_on_page(anc_buff));
@ -270,7 +270,7 @@ static int d_search(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
/* popular word. two-level tree. going down */ /* popular word. two-level tree. going down */
uint tmp_key_length; uint tmp_key_length;
my_off_t root; my_off_t root;
byte *kpos=keypos; uchar *kpos=keypos;
if (!(tmp_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&kpos,lastkey))) if (!(tmp_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&kpos,lastkey)))
{ {
@ -310,7 +310,7 @@ static int d_search(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
if (nod_flag) if (nod_flag)
{ {
leaf_page= _ma_kpos(nod_flag,keypos); leaf_page= _ma_kpos(nod_flag,keypos);
if (!(leaf_buff= (byte*) my_alloca((uint) keyinfo->block_length+ if (!(leaf_buff= (uchar*) my_alloca((uint) keyinfo->block_length+
HA_MAX_KEY_BUFF*2))) HA_MAX_KEY_BUFF*2)))
{ {
DBUG_PRINT("error",("Couldn't allocate memory")); DBUG_PRINT("error",("Couldn't allocate memory"));
@ -372,7 +372,7 @@ static int d_search(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
if (!_ma_get_last_key(info,keyinfo,anc_buff,lastkey,keypos,&length)) if (!_ma_get_last_key(info,keyinfo,anc_buff,lastkey,keypos,&length))
goto err; goto err;
ret_value= _ma_insert(info,keyinfo,key,anc_buff,keypos,lastkey, ret_value= _ma_insert(info,keyinfo,key,anc_buff,keypos,lastkey,
(byte*) 0,(byte*) 0,(my_off_t) 0,(my_bool) 0); (uchar*) 0,(uchar*) 0,(my_off_t) 0,(my_bool) 0);
} }
} }
if (ret_value == 0 && maria_data_on_page(anc_buff) > keyinfo->block_length) if (ret_value == 0 && maria_data_on_page(anc_buff) > keyinfo->block_length)
@ -400,16 +400,16 @@ err:
/* Remove a key that has a page-reference */ /* Remove a key that has a page-reference */
static int del(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo, static int del(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
byte *key, byte *anc_buff, my_off_t leaf_page, uchar *key, uchar *anc_buff, my_off_t leaf_page,
byte *leaf_buff, uchar *leaf_buff,
byte *keypos, /* Pos to where deleted key was */ uchar *keypos, /* Pos to where deleted key was */
my_off_t next_block, my_off_t next_block,
byte *ret_key) /* key before keypos in anc_buff */ uchar *ret_key) /* key before keypos in anc_buff */
{ {
int ret_value,length; int ret_value,length;
uint a_length,nod_flag,tmp; uint a_length,nod_flag,tmp;
my_off_t next_page; my_off_t next_page;
byte keybuff[HA_MAX_KEY_BUFF],*endpos,*next_buff,*key_start, *prev_key; uchar keybuff[HA_MAX_KEY_BUFF],*endpos,*next_buff,*key_start, *prev_key;
MARIA_SHARE *share=info->s; MARIA_SHARE *share=info->s;
MARIA_KEY_PARAM s_temp; MARIA_KEY_PARAM s_temp;
DBUG_ENTER("del"); DBUG_ENTER("del");
@ -425,7 +425,7 @@ static int del(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
if ((nod_flag=_ma_test_if_nod(leaf_buff))) if ((nod_flag=_ma_test_if_nod(leaf_buff)))
{ {
next_page= _ma_kpos(nod_flag,endpos); next_page= _ma_kpos(nod_flag,endpos);
if (!(next_buff= (byte*) my_alloca((uint) keyinfo->block_length+ if (!(next_buff= (uchar*) my_alloca((uint) keyinfo->block_length+
HA_MAX_KEY_BUFF*2))) HA_MAX_KEY_BUFF*2)))
DBUG_RETURN(-1); DBUG_RETURN(-1);
if (!_ma_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,next_buff,0)) if (!_ma_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,next_buff,0))
@ -453,7 +453,7 @@ static int del(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
&tmp)) &tmp))
goto err; goto err;
ret_value= _ma_insert(info,keyinfo,key,leaf_buff,endpos,keybuff, ret_value= _ma_insert(info,keyinfo,key,leaf_buff,endpos,keybuff,
(byte*) 0,(byte*) 0,(my_off_t) 0,0); (uchar*) 0,(uchar*) 0,(my_off_t) 0,0);
} }
} }
if (_ma_write_keypage(info,keyinfo,leaf_page,DFLT_INIT_HITS,leaf_buff)) if (_ma_write_keypage(info,keyinfo,leaf_page,DFLT_INIT_HITS,leaf_buff))
@ -479,7 +479,7 @@ static int del(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
prev_key=(keypos == anc_buff+2+share->base.key_reflength ? prev_key=(keypos == anc_buff+2+share->base.key_reflength ?
0 : ret_key); 0 : ret_key);
length=(*keyinfo->pack_key)(keyinfo,share->base.key_reflength, length=(*keyinfo->pack_key)(keyinfo,share->base.key_reflength,
keypos == endpos ? (byte*) 0 : keypos, keypos == endpos ? (uchar*) 0 : keypos,
prev_key, prev_key, prev_key, prev_key,
keybuff,&s_temp); keybuff,&s_temp);
if (length > 0) if (length > 0)
@ -504,18 +504,18 @@ err:
/* Balances adjacent pages if underflow occours */ /* Balances adjacent pages if underflow occours */
static int underflow(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo, static int underflow(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
byte *anc_buff, uchar *anc_buff,
my_off_t leaf_page,/* Ancestor page and underflow page */ my_off_t leaf_page,/* Ancestor page and underflow page */
byte *leaf_buff, uchar *leaf_buff,
byte *keypos) /* Position to pos after key */ uchar *keypos) /* Position to pos after key */
{ {
int t_length; int t_length;
uint length,anc_length,buff_length,leaf_length,p_length,s_length,nod_flag, uint length,anc_length,buff_length,leaf_length,p_length,s_length,nod_flag,
key_reflength,key_length; key_reflength,key_length;
my_off_t next_page; my_off_t next_page;
byte anc_key[HA_MAX_KEY_BUFF],leaf_key[HA_MAX_KEY_BUFF]; uchar anc_key[HA_MAX_KEY_BUFF],leaf_key[HA_MAX_KEY_BUFF];
byte *buff,*endpos,*next_keypos,*anc_pos,*half_pos,*temp_pos,*prev_key; uchar *buff,*endpos,*next_keypos,*anc_pos,*half_pos,*temp_pos,*prev_key;
byte *after_key; uchar *after_key;
MARIA_KEY_PARAM s_temp; MARIA_KEY_PARAM s_temp;
MARIA_SHARE *share=info->s; MARIA_SHARE *share=info->s;
DBUG_ENTER("underflow"); DBUG_ENTER("underflow");
@ -568,7 +568,7 @@ static int underflow(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
goto err; goto err;
/* merge pages and put parting key from anc_buff between */ /* merge pages and put parting key from anc_buff between */
prev_key=(leaf_length == p_length ? (byte*) 0 : leaf_key); prev_key=(leaf_length == p_length ? (uchar*) 0 : leaf_key);
t_length=(*keyinfo->pack_key)(keyinfo,nod_flag,buff+p_length, t_length=(*keyinfo->pack_key)(keyinfo,nod_flag,buff+p_length,
prev_key, prev_key, prev_key, prev_key,
anc_key, &s_temp); anc_key, &s_temp);
@ -615,9 +615,9 @@ static int underflow(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
half_pos=after_key; half_pos=after_key;
_ma_kpointer(info,leaf_key+key_length,next_page); _ma_kpointer(info,leaf_key+key_length,next_page);
/* Save key in anc_buff */ /* Save key in anc_buff */
prev_key=(keypos == anc_buff+2+key_reflength ? (byte*) 0 : anc_key), prev_key=(keypos == anc_buff+2+key_reflength ? (uchar*) 0 : anc_key),
t_length=(*keyinfo->pack_key)(keyinfo,key_reflength, t_length=(*keyinfo->pack_key)(keyinfo,key_reflength,
(keypos == endpos ? (byte*) 0 : (keypos == endpos ? (uchar*) 0 :
keypos), keypos),
prev_key, prev_key, prev_key, prev_key,
leaf_key, &s_temp); leaf_key, &s_temp);
@ -633,8 +633,8 @@ static int underflow(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
bmove(buff+2,half_pos-nod_flag,(size_t) nod_flag); bmove(buff+2,half_pos-nod_flag,(size_t) nod_flag);
if (!(*keyinfo->get_key)(keyinfo,nod_flag,&half_pos,leaf_key)) if (!(*keyinfo->get_key)(keyinfo,nod_flag,&half_pos,leaf_key))
goto err; goto err;
t_length=(int) (*keyinfo->pack_key)(keyinfo, nod_flag, (byte*) 0, t_length=(int) (*keyinfo->pack_key)(keyinfo, nod_flag, (uchar*) 0,
(byte*) 0, (byte*) 0, (uchar*) 0, (uchar*) 0,
leaf_key, &s_temp); leaf_key, &s_temp);
/* t_length will always be > 0 for a new page !*/ /* t_length will always be > 0 for a new page !*/
length=(uint) ((buff+maria_data_on_page(buff))-half_pos); length=(uint) ((buff+maria_data_on_page(buff))-half_pos);
@ -673,10 +673,10 @@ static int underflow(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
goto err; goto err;
/* merge pages and put parting key from anc_buff between */ /* merge pages and put parting key from anc_buff between */
prev_key=(leaf_length == p_length ? (byte*) 0 : leaf_key); prev_key=(leaf_length == p_length ? (uchar*) 0 : leaf_key);
t_length=(*keyinfo->pack_key)(keyinfo,nod_flag, t_length=(*keyinfo->pack_key)(keyinfo,nod_flag,
(leaf_length == p_length ? (leaf_length == p_length ?
(byte*) 0 : leaf_buff+p_length), (uchar*) 0 : leaf_buff+p_length),
prev_key, prev_key, prev_key, prev_key,
anc_key, &s_temp); anc_key, &s_temp);
if (t_length >= 0) if (t_length >= 0)
@ -721,7 +721,7 @@ static int underflow(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
temp_pos=anc_buff+anc_length; temp_pos=anc_buff+anc_length;
t_length=(*keyinfo->pack_key)(keyinfo,key_reflength, t_length=(*keyinfo->pack_key)(keyinfo,key_reflength,
keypos == temp_pos ? (byte*) 0 keypos == temp_pos ? (uchar*) 0
: keypos, : keypos,
anc_pos, anc_pos, anc_pos, anc_pos,
leaf_key,&s_temp); leaf_key,&s_temp);
@ -738,8 +738,8 @@ static int underflow(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
if (!(length=(*keyinfo->get_key)(keyinfo,nod_flag,&half_pos,leaf_key))) if (!(length=(*keyinfo->get_key)(keyinfo,nod_flag,&half_pos,leaf_key)))
goto err; goto err;
DBUG_DUMP("key_to_leaf",leaf_key,length); DBUG_DUMP("key_to_leaf",leaf_key,length);
t_length=(*keyinfo->pack_key)(keyinfo,nod_flag, (byte*) 0, t_length=(*keyinfo->pack_key)(keyinfo,nod_flag, (uchar*) 0,
(byte*) 0, (byte*) 0, leaf_key, &s_temp); (uchar*) 0, (uchar*) 0, leaf_key, &s_temp);
length=(uint) ((buff+buff_length)-half_pos); length=(uint) ((buff+buff_length)-half_pos);
DBUG_PRINT("info",("t_length: %d length: %d",t_length,(int) length)); DBUG_PRINT("info",("t_length: %d length: %d",t_length,(int) length));
bmove(leaf_buff+p_length+t_length,half_pos, bmove(leaf_buff+p_length+t_length,half_pos,
@ -767,13 +767,13 @@ err:
*/ */
static uint remove_key(MARIA_KEYDEF *keyinfo, uint nod_flag, static uint remove_key(MARIA_KEYDEF *keyinfo, uint nod_flag,
byte *keypos, /* Where key starts */ uchar *keypos, /* Where key starts */
byte *lastkey, /* key to be removed */ uchar *lastkey, /* key to be removed */
byte *page_end, /* End of page */ uchar *page_end, /* End of page */
my_off_t *next_block) /* ptr to next block */ my_off_t *next_block) /* ptr to next block */
{ {
int s_length; int s_length;
byte *start; uchar *start;
DBUG_ENTER("remove_key"); DBUG_ENTER("remove_key");
DBUG_PRINT("enter",("keypos: 0x%lx page_end: 0x%lx",(long) keypos, (long) page_end)); DBUG_PRINT("enter",("keypos: 0x%lx page_end: 0x%lx",(long) keypos, (long) page_end));
@ -799,7 +799,7 @@ static uint remove_key(MARIA_KEYDEF *keyinfo, uint nod_flag,
{ {
if (keyinfo->flag & HA_BINARY_PACK_KEY) if (keyinfo->flag & HA_BINARY_PACK_KEY)
{ {
byte *old_key=start; uchar *old_key=start;
uint next_length,prev_length,prev_pack_length; uint next_length,prev_length,prev_pack_length;
get_key_length(next_length,keypos); get_key_length(next_length,keypos);
get_key_pack_length(prev_length,prev_pack_length,old_key); get_key_pack_length(prev_length,prev_pack_length,old_key);

View File

@ -25,15 +25,15 @@
#include "maria_def.h" #include "maria_def.h"
static my_bool write_dynamic_record(MARIA_HA *info,const byte *record, static my_bool write_dynamic_record(MARIA_HA *info,const uchar *record,
ulong reclength); ulong reclength);
static int _ma_find_writepos(MARIA_HA *info,ulong reclength,my_off_t *filepos, static int _ma_find_writepos(MARIA_HA *info,ulong reclength,my_off_t *filepos,
ulong *length); ulong *length);
static my_bool update_dynamic_record(MARIA_HA *info, MARIA_RECORD_POS filepos, static my_bool update_dynamic_record(MARIA_HA *info, MARIA_RECORD_POS filepos,
byte *record, ulong reclength); uchar *record, ulong reclength);
static my_bool delete_dynamic_record(MARIA_HA *info,MARIA_RECORD_POS filepos, static my_bool delete_dynamic_record(MARIA_HA *info,MARIA_RECORD_POS filepos,
uint second_read); uint second_read);
static my_bool _ma_cmp_buffer(File file, const byte *buff, my_off_t filepos, static my_bool _ma_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
uint length); uint length);
#ifdef THREAD #ifdef THREAD
@ -76,13 +76,13 @@ my_bool _ma_dynmap_file(MARIA_HA *info, my_off_t size)
mapping. When swap space is not reserved one might get SIGSEGV mapping. When swap space is not reserved one might get SIGSEGV
upon a write if no physical memory is available. upon a write if no physical memory is available.
*/ */
info->s->file_map= (byte*) info->s->file_map= (uchar*)
my_mmap(0, (size_t)(size + MEMMAP_EXTRA_MARGIN), my_mmap(0, (size_t)(size + MEMMAP_EXTRA_MARGIN),
info->s->mode==O_RDONLY ? PROT_READ : info->s->mode==O_RDONLY ? PROT_READ :
PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_NORESERVE, MAP_SHARED | MAP_NORESERVE,
info->dfile.file, 0L); info->dfile.file, 0L);
if (info->s->file_map == (byte*) MAP_FAILED) if (info->s->file_map == (uchar*) MAP_FAILED)
{ {
info->s->file_map= NULL; info->s->file_map= NULL;
DBUG_RETURN(1); DBUG_RETURN(1);
@ -132,7 +132,7 @@ void _ma_remap_file(MARIA_HA *info, my_off_t size)
0 ok 0 ok
*/ */
uint _ma_mmap_pread(MARIA_HA *info, byte *Buffer, uint _ma_mmap_pread(MARIA_HA *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags) uint Count, my_off_t offset, myf MyFlags)
{ {
DBUG_PRINT("info", ("maria_read with mmap %d\n", info->dfile.file)); DBUG_PRINT("info", ("maria_read with mmap %d\n", info->dfile.file));
@ -164,7 +164,7 @@ uint _ma_mmap_pread(MARIA_HA *info, byte *Buffer,
/* wrapper for my_pread in case if mmap isn't used */ /* wrapper for my_pread in case if mmap isn't used */
uint _ma_nommap_pread(MARIA_HA *info, byte *Buffer, uint _ma_nommap_pread(MARIA_HA *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags) uint Count, my_off_t offset, myf MyFlags)
{ {
return my_pread(info->dfile.file, Buffer, Count, offset, MyFlags); return my_pread(info->dfile.file, Buffer, Count, offset, MyFlags);
@ -187,7 +187,7 @@ uint _ma_nommap_pread(MARIA_HA *info, byte *Buffer,
!=0 error. In this case return error from pwrite !=0 error. In this case return error from pwrite
*/ */
uint _ma_mmap_pwrite(MARIA_HA *info, byte *Buffer, uint _ma_mmap_pwrite(MARIA_HA *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags) uint Count, my_off_t offset, myf MyFlags)
{ {
DBUG_PRINT("info", ("maria_write with mmap %d\n", info->dfile.file)); DBUG_PRINT("info", ("maria_write with mmap %d\n", info->dfile.file));
@ -221,14 +221,14 @@ uint _ma_mmap_pwrite(MARIA_HA *info, byte *Buffer,
/* wrapper for my_pwrite in case if mmap isn't used */ /* wrapper for my_pwrite in case if mmap isn't used */
uint _ma_nommap_pwrite(MARIA_HA *info, byte *Buffer, uint _ma_nommap_pwrite(MARIA_HA *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags) uint Count, my_off_t offset, myf MyFlags)
{ {
return my_pwrite(info->dfile.file, Buffer, Count, offset, MyFlags); return my_pwrite(info->dfile.file, Buffer, Count, offset, MyFlags);
} }
my_bool _ma_write_dynamic_record(MARIA_HA *info, const byte *record) my_bool _ma_write_dynamic_record(MARIA_HA *info, const uchar *record)
{ {
ulong reclength= _ma_rec_pack(info,info->rec_buff + MARIA_REC_BUFF_OFFSET, ulong reclength= _ma_rec_pack(info,info->rec_buff + MARIA_REC_BUFF_OFFSET,
record); record);
@ -237,8 +237,8 @@ my_bool _ma_write_dynamic_record(MARIA_HA *info, const byte *record)
} }
my_bool _ma_update_dynamic_record(MARIA_HA *info, MARIA_RECORD_POS pos, my_bool _ma_update_dynamic_record(MARIA_HA *info, MARIA_RECORD_POS pos,
const byte *oldrec __attribute__ ((unused)), const uchar *oldrec __attribute__ ((unused)),
const byte *record) const uchar *record)
{ {
uint length= _ma_rec_pack(info, info->rec_buff + MARIA_REC_BUFF_OFFSET, uint length= _ma_rec_pack(info, info->rec_buff + MARIA_REC_BUFF_OFFSET,
record); record);
@ -248,9 +248,9 @@ my_bool _ma_update_dynamic_record(MARIA_HA *info, MARIA_RECORD_POS pos,
} }
my_bool _ma_write_blob_record(MARIA_HA *info, const byte *record) my_bool _ma_write_blob_record(MARIA_HA *info, const uchar *record)
{ {
byte *rec_buff; uchar *rec_buff;
int error; int error;
ulong reclength,reclength2,extra; ulong reclength,reclength2,extra;
@ -258,7 +258,7 @@ my_bool _ma_write_blob_record(MARIA_HA *info, const byte *record)
MARIA_DYN_DELETE_BLOCK_HEADER+1); MARIA_DYN_DELETE_BLOCK_HEADER+1);
reclength= (info->s->base.pack_reclength + reclength= (info->s->base.pack_reclength +
_ma_calc_total_blob_length(info,record)+ extra); _ma_calc_total_blob_length(info,record)+ extra);
if (!(rec_buff=(byte*) my_alloca(reclength))) if (!(rec_buff=(uchar*) my_alloca(reclength)))
{ {
my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */ my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
return(1); return(1);
@ -278,10 +278,10 @@ my_bool _ma_write_blob_record(MARIA_HA *info, const byte *record)
my_bool _ma_update_blob_record(MARIA_HA *info, MARIA_RECORD_POS pos, my_bool _ma_update_blob_record(MARIA_HA *info, MARIA_RECORD_POS pos,
const byte *oldrec __attribute__ ((unused)), const uchar *oldrec __attribute__ ((unused)),
const byte *record) const uchar *record)
{ {
byte *rec_buff; uchar *rec_buff;
int error; int error;
ulong reclength,extra; ulong reclength,extra;
@ -296,7 +296,7 @@ my_bool _ma_update_blob_record(MARIA_HA *info, MARIA_RECORD_POS pos,
return 1; return 1;
} }
#endif #endif
if (!(rec_buff=(byte*) my_alloca(reclength))) if (!(rec_buff=(uchar*) my_alloca(reclength)))
{ {
my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */ my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
return(1); return(1);
@ -312,7 +312,7 @@ my_bool _ma_update_blob_record(MARIA_HA *info, MARIA_RECORD_POS pos,
my_bool _ma_delete_dynamic_record(MARIA_HA *info, my_bool _ma_delete_dynamic_record(MARIA_HA *info,
const byte *record __attribute__ ((unused))) const uchar *record __attribute__ ((unused)))
{ {
return delete_dynamic_record(info, info->cur_row.lastpos, 0); return delete_dynamic_record(info, info->cur_row.lastpos, 0);
} }
@ -320,7 +320,7 @@ my_bool _ma_delete_dynamic_record(MARIA_HA *info,
/* Write record to data-file */ /* Write record to data-file */
static my_bool write_dynamic_record(MARIA_HA *info, const byte *record, static my_bool write_dynamic_record(MARIA_HA *info, const uchar *record,
ulong reclength) ulong reclength)
{ {
int flag; int flag;
@ -336,7 +336,7 @@ static my_bool write_dynamic_record(MARIA_HA *info, const byte *record,
if (_ma_write_part_record(info,filepos,length, if (_ma_write_part_record(info,filepos,length,
(info->append_insert_at_end ? (info->append_insert_at_end ?
HA_OFFSET_ERROR : info->s->state.dellink), HA_OFFSET_ERROR : info->s->state.dellink),
(byte**) &record,&reclength,&flag)) (uchar**) &record,&reclength,&flag))
goto err; goto err;
} while (reclength); } while (reclength);
@ -550,7 +550,7 @@ static my_bool delete_dynamic_record(MARIA_HA *info, MARIA_RECORD_POS filepos,
bfill(block_info.header+12,8,255); bfill(block_info.header+12,8,255);
else else
mi_sizestore(block_info.header+12,block_info.next_filepos); mi_sizestore(block_info.header+12,block_info.next_filepos);
if (info->s->file_write(info,(byte*) block_info.header,20,filepos, if (info->s->file_write(info,(uchar*) block_info.header,20,filepos,
MYF(MY_NABP))) MYF(MY_NABP)))
DBUG_RETURN(1); DBUG_RETURN(1);
info->s->state.dellink = filepos; info->s->state.dellink = filepos;
@ -573,12 +573,12 @@ int _ma_write_part_record(MARIA_HA *info,
my_off_t filepos, /* points at empty block */ my_off_t filepos, /* points at empty block */
ulong length, /* length of block */ ulong length, /* length of block */
my_off_t next_filepos,/* Next empty block */ my_off_t next_filepos,/* Next empty block */
byte **record, /* pointer to record ptr */ uchar **record, /* pointer to record ptr */
ulong *reclength, /* length of *record */ ulong *reclength, /* length of *record */
int *flag) /* *flag == 0 if header */ int *flag) /* *flag == 0 if header */
{ {
ulong head_length,res_length,extra_length,long_block,del_length; ulong head_length,res_length,extra_length,long_block,del_length;
byte *pos,*record_end; uchar *pos,*record_end;
my_off_t next_delete_block; my_off_t next_delete_block;
uchar temp[MARIA_SPLIT_LENGTH+MARIA_DYN_DELETE_BLOCK_HEADER]; uchar temp[MARIA_SPLIT_LENGTH+MARIA_DYN_DELETE_BLOCK_HEADER];
DBUG_ENTER("_ma_write_part_record"); DBUG_ENTER("_ma_write_part_record");
@ -622,7 +622,7 @@ int _ma_write_part_record(MARIA_HA *info,
temp[0]=13; temp[0]=13;
mi_int4store(temp+1,*reclength); mi_int4store(temp+1,*reclength);
mi_int3store(temp+5,length-head_length); mi_int3store(temp+5,length-head_length);
mi_sizestore((byte*) temp+8,next_filepos); mi_sizestore((uchar*) temp+8,next_filepos);
} }
else else
{ {
@ -632,13 +632,13 @@ int _ma_write_part_record(MARIA_HA *info,
{ {
mi_int3store(temp+1,*reclength); mi_int3store(temp+1,*reclength);
mi_int3store(temp+4,length-head_length); mi_int3store(temp+4,length-head_length);
mi_sizestore((byte*) temp+7,next_filepos); mi_sizestore((uchar*) temp+7,next_filepos);
} }
else else
{ {
mi_int2store(temp+1,*reclength); mi_int2store(temp+1,*reclength);
mi_int2store(temp+3,length-head_length); mi_int2store(temp+3,length-head_length);
mi_sizestore((byte*) temp+5,next_filepos); mi_sizestore((uchar*) temp+5,next_filepos);
} }
} }
} }
@ -649,12 +649,12 @@ int _ma_write_part_record(MARIA_HA *info,
if (long_block) if (long_block)
{ {
mi_int3store(temp+1,length-head_length); mi_int3store(temp+1,length-head_length);
mi_sizestore((byte*) temp+4,next_filepos); mi_sizestore((uchar*) temp+4,next_filepos);
} }
else else
{ {
mi_int2store(temp+1,length-head_length); mi_int2store(temp+1,length-head_length);
mi_sizestore((byte*) temp+3,next_filepos); mi_sizestore((uchar*) temp+3,next_filepos);
} }
} }
} }
@ -675,14 +675,14 @@ int _ma_write_part_record(MARIA_HA *info,
} }
length= *reclength+head_length; /* Write only what is needed */ length= *reclength+head_length; /* Write only what is needed */
} }
DBUG_DUMP("header",(byte*) temp,head_length); DBUG_DUMP("header",(uchar*) temp,head_length);
/* Make a long block for one write */ /* Make a long block for one write */
record_end= *record+length-head_length; record_end= *record+length-head_length;
del_length=(res_length ? MARIA_DYN_DELETE_BLOCK_HEADER : 0); del_length=(res_length ? MARIA_DYN_DELETE_BLOCK_HEADER : 0);
bmove((byte*) (*record-head_length),(byte*) temp,head_length); bmove((uchar*) (*record-head_length),(uchar*) temp,head_length);
memcpy(temp,record_end,(size_t) (extra_length+del_length)); memcpy(temp,record_end,(size_t) (extra_length+del_length));
bzero((byte*) record_end,extra_length); bzero((uchar*) record_end,extra_length);
if (res_length) if (res_length)
{ {
@ -722,18 +722,18 @@ int _ma_write_part_record(MARIA_HA *info,
if (info->update & HA_STATE_EXTEND_BLOCK) if (info->update & HA_STATE_EXTEND_BLOCK)
{ {
info->update&= ~HA_STATE_EXTEND_BLOCK; info->update&= ~HA_STATE_EXTEND_BLOCK;
if (my_block_write(&info->rec_cache,(byte*) *record-head_length, if (my_block_write(&info->rec_cache,(uchar*) *record-head_length,
length+extra_length+del_length,filepos)) length+extra_length+del_length,filepos))
goto err; goto err;
} }
else if (my_b_write(&info->rec_cache,(byte*) *record-head_length, else if (my_b_write(&info->rec_cache,(uchar*) *record-head_length,
length+extra_length+del_length)) length+extra_length+del_length))
goto err; goto err;
} }
else else
{ {
info->rec_cache.seek_not_done=1; info->rec_cache.seek_not_done=1;
if (info->s->file_write(info,(byte*) *record-head_length, if (info->s->file_write(info,(uchar*) *record-head_length,
length+extra_length+ length+extra_length+
del_length,filepos,info->s->write_flag)) del_length,filepos,info->s->write_flag))
goto err; goto err;
@ -761,7 +761,7 @@ err:
/* update record from datafile */ /* update record from datafile */
static my_bool update_dynamic_record(MARIA_HA *info, MARIA_RECORD_POS filepos, static my_bool update_dynamic_record(MARIA_HA *info, MARIA_RECORD_POS filepos,
byte *record, ulong reclength) uchar *record, ulong reclength)
{ {
int flag; int flag;
uint error; uint error;
@ -844,7 +844,7 @@ static my_bool update_dynamic_record(MARIA_HA *info, MARIA_RECORD_POS filepos,
mi_int3store(del_block.header+1, rest_length); mi_int3store(del_block.header+1, rest_length);
mi_sizestore(del_block.header+4,info->s->state.dellink); mi_sizestore(del_block.header+4,info->s->state.dellink);
bfill(del_block.header+12,8,255); bfill(del_block.header+12,8,255);
if (info->s->file_write(info,(byte*) del_block.header, 20, if (info->s->file_write(info,(uchar*) del_block.header, 20,
next_pos, MYF(MY_NABP))) next_pos, MYF(MY_NABP)))
DBUG_RETURN(1); DBUG_RETURN(1);
info->s->state.dellink= next_pos; info->s->state.dellink= next_pos;
@ -883,7 +883,8 @@ err:
/* Pack a record. Return new reclength */ /* Pack a record. Return new reclength */
uint _ma_rec_pack(MARIA_HA *info, register byte *to, register const byte *from) uint _ma_rec_pack(MARIA_HA *info, register uchar *to,
register const uchar *from)
{ {
uint length,new_length,flag,bit,i; uint length,new_length,flag,bit,i;
char *pos,*end,*startpos,*packpos; char *pos,*end,*startpos,*packpos;
@ -918,7 +919,7 @@ uint _ma_rec_pack(MARIA_HA *info, register byte *to, register const byte *from)
{ {
char *temp_pos; char *temp_pos;
size_t tmp_length=length-portable_sizeof_char_ptr; size_t tmp_length=length-portable_sizeof_char_ptr;
memcpy((byte*) to,from,tmp_length); memcpy((uchar*) to,from,tmp_length);
memcpy_fixed(&temp_pos,from+tmp_length,sizeof(char*)); memcpy_fixed(&temp_pos,from+tmp_length,sizeof(char*));
memcpy(to+tmp_length,temp_pos,(size_t) blob->length); memcpy(to+tmp_length,temp_pos,(size_t) blob->length);
to+=tmp_length+blob->length; to+=tmp_length+blob->length;
@ -927,20 +928,20 @@ uint _ma_rec_pack(MARIA_HA *info, register byte *to, register const byte *from)
} }
else if (type == FIELD_SKIP_ZERO) else if (type == FIELD_SKIP_ZERO)
{ {
if (memcmp((byte*) from, maria_zero_string, length) == 0) if (memcmp((uchar*) from, maria_zero_string, length) == 0)
flag|=bit; flag|=bit;
else else
{ {
memcpy((byte*) to,from,(size_t) length); to+=length; memcpy((uchar*) to,from,(size_t) length); to+=length;
} }
} }
else if (type == FIELD_SKIP_ENDSPACE || else if (type == FIELD_SKIP_ENDSPACE ||
type == FIELD_SKIP_PRESPACE) type == FIELD_SKIP_PRESPACE)
{ {
pos= (byte*) from; end= (byte*) from + length; pos= (uchar*) from; end= (uchar*) from + length;
if (type == FIELD_SKIP_ENDSPACE) if (type == FIELD_SKIP_ENDSPACE)
{ /* Pack trailing spaces */ { /* Pack trailing spaces */
while (end > from && *(end-1) == ' ') while (end > (char*) from && *(end-1) == ' ')
end--; end--;
} }
else else
@ -960,7 +961,7 @@ uint _ma_rec_pack(MARIA_HA *info, register byte *to, register const byte *from)
} }
else else
*to++= (char) new_length; *to++= (char) new_length;
memcpy((byte*) to,pos,(size_t) new_length); to+=new_length; memcpy((uchar*) to,pos,(size_t) new_length); to+=new_length;
flag|=bit; flag|=bit;
} }
else else
@ -1005,9 +1006,9 @@ uint _ma_rec_pack(MARIA_HA *info, register byte *to, register const byte *from)
if (bit != 1) if (bit != 1)
*packpos= (char) (uchar) flag; *packpos= (char) (uchar) flag;
if (info->s->calc_checksum) if (info->s->calc_checksum)
*to++= (byte) info->cur_row.checksum; *to++= (uchar) info->cur_row.checksum;
DBUG_PRINT("exit",("packed length: %d",(int) (to-startpos))); DBUG_PRINT("exit",("packed length: %d",(int) ((char*)to-startpos)));
DBUG_RETURN((uint) (to-startpos)); DBUG_RETURN((uint) ((char*)to-startpos));
} /* _ma_rec_pack */ } /* _ma_rec_pack */
@ -1017,7 +1018,7 @@ uint _ma_rec_pack(MARIA_HA *info, register byte *to, register const byte *from)
Returns 0 if record is ok. Returns 0 if record is ok.
*/ */
my_bool _ma_rec_check(MARIA_HA *info,const char *record, byte *rec_buff, my_bool _ma_rec_check(MARIA_HA *info,const char *record, uchar *rec_buff,
ulong packed_length, my_bool with_checksum) ulong packed_length, my_bool with_checksum)
{ {
uint length,new_length,flag,bit,i; uint length,new_length,flag,bit,i;
@ -1048,7 +1049,7 @@ my_bool _ma_rec_check(MARIA_HA *info,const char *record, byte *rec_buff,
} }
else if (type == FIELD_SKIP_ZERO) else if (type == FIELD_SKIP_ZERO)
{ {
if (memcmp((byte*) record, maria_zero_string, length) == 0) if (memcmp((uchar*) record, maria_zero_string, length) == 0)
{ {
if (!(flag & bit)) if (!(flag & bit))
goto err; goto err;
@ -1059,7 +1060,7 @@ my_bool _ma_rec_check(MARIA_HA *info,const char *record, byte *rec_buff,
else if (type == FIELD_SKIP_ENDSPACE || else if (type == FIELD_SKIP_ENDSPACE ||
type == FIELD_SKIP_PRESPACE) type == FIELD_SKIP_PRESPACE)
{ {
pos= (byte*) record; end= (byte*) record + length; pos= (uchar*) record; end= (uchar*) record + length;
if (type == FIELD_SKIP_ENDSPACE) if (type == FIELD_SKIP_ENDSPACE)
{ /* Pack trailing spaces */ { /* Pack trailing spaces */
while (end > record && *(end-1) == ' ') while (end > record && *(end-1) == ' ')
@ -1121,8 +1122,8 @@ my_bool _ma_rec_check(MARIA_HA *info,const char *record, byte *rec_buff,
else else
to+= length; to+= length;
} }
if (packed_length != (uint) (to - rec_buff) + test(info->s->calc_checksum) || if (packed_length != (uint) (to - (char*) rec_buff) +
(bit != 1 && (flag & ~(bit - 1)))) test(info->s->calc_checksum) || (bit != 1 && (flag & ~(bit - 1))))
goto err; goto err;
if (with_checksum && ((uchar) info->cur_row.checksum != (uchar) *to)) if (with_checksum && ((uchar) info->cur_row.checksum != (uchar) *to))
{ {
@ -1141,12 +1142,12 @@ err:
/* Returns -1 and my_errno =HA_ERR_RECORD_DELETED if reclength isn't */ /* Returns -1 and my_errno =HA_ERR_RECORD_DELETED if reclength isn't */
/* right. Returns reclength (>0) if ok */ /* right. Returns reclength (>0) if ok */
ulong _ma_rec_unpack(register MARIA_HA *info, register byte *to, byte *from, ulong _ma_rec_unpack(register MARIA_HA *info, register uchar *to, uchar *from,
ulong found_length) ulong found_length)
{ {
uint flag,bit,length,min_pack_length, column_length; uint flag,bit,length,min_pack_length, column_length;
enum en_fieldtype type; enum en_fieldtype type;
byte *from_end,*to_end,*packpos; uchar *from_end,*to_end,*packpos;
reg3 MARIA_COLUMNDEF *column, *end_column; reg3 MARIA_COLUMNDEF *column, *end_column;
DBUG_ENTER("_ma_rec_unpack"); DBUG_ENTER("_ma_rec_unpack");
@ -1200,7 +1201,7 @@ ulong _ma_rec_unpack(register MARIA_HA *info, register byte *to, byte *from,
if (flag & bit) if (flag & bit)
{ {
if (type == FIELD_BLOB || type == FIELD_SKIP_ZERO) if (type == FIELD_BLOB || type == FIELD_SKIP_ZERO)
bzero((byte*) to,column_length); bzero((uchar*) to,column_length);
else if (type == FIELD_SKIP_ENDSPACE || else if (type == FIELD_SKIP_ENDSPACE ||
type == FIELD_SKIP_PRESPACE) type == FIELD_SKIP_PRESPACE)
{ {
@ -1222,13 +1223,13 @@ ulong _ma_rec_unpack(register MARIA_HA *info, register byte *to, byte *from,
goto err; goto err;
if (type == FIELD_SKIP_ENDSPACE) if (type == FIELD_SKIP_ENDSPACE)
{ {
memcpy(to,(byte*) from,(size_t) length); memcpy(to,(uchar*) from,(size_t) length);
bfill((byte*) to+length,column_length-length,' '); bfill((uchar*) to+length,column_length-length,' ');
} }
else else
{ {
bfill((byte*) to,column_length-length,' '); bfill((uchar*) to,column_length-length,' ');
memcpy(to+column_length-length,(byte*) from,(size_t) length); memcpy(to+column_length-length,(uchar*) from,(size_t) length);
} }
from+=length; from+=length;
} }
@ -1242,9 +1243,9 @@ ulong _ma_rec_unpack(register MARIA_HA *info, register byte *to, byte *from,
from_left - size_length < blob_length || from_left - size_length < blob_length ||
from_left - size_length - blob_length < min_pack_length) from_left - size_length - blob_length < min_pack_length)
goto err; goto err;
memcpy((byte*) to,(byte*) from,(size_t) size_length); memcpy((uchar*) to,(uchar*) from,(size_t) size_length);
from+=size_length; from+=size_length;
memcpy_fixed((byte*) to+size_length,(byte*) &from,sizeof(char*)); memcpy_fixed((uchar*) to+size_length,(uchar*) &from,sizeof(char*));
from+=blob_length; from+=blob_length;
} }
else else
@ -1253,7 +1254,7 @@ ulong _ma_rec_unpack(register MARIA_HA *info, register byte *to, byte *from,
min_pack_length--; min_pack_length--;
if (min_pack_length + column_length > (uint) (from_end - from)) if (min_pack_length + column_length > (uint) (from_end - from))
goto err; goto err;
memcpy(to,(byte*) from,(size_t) column_length); from+=column_length; memcpy(to,(uchar*) from,(size_t) column_length); from+=column_length;
} }
if ((bit= bit << 1) >= 256) if ((bit= bit << 1) >= 256)
{ {
@ -1265,7 +1266,7 @@ ulong _ma_rec_unpack(register MARIA_HA *info, register byte *to, byte *from,
if (min_pack_length > (uint) (from_end - from)) if (min_pack_length > (uint) (from_end - from))
goto err; goto err;
min_pack_length-=column_length; min_pack_length-=column_length;
memcpy(to, (byte*) from, (size_t) column_length); memcpy(to, (uchar*) from, (size_t) column_length);
from+=column_length; from+=column_length;
} }
} }
@ -1278,14 +1279,14 @@ err:
my_errno= HA_ERR_WRONG_IN_RECORD; my_errno= HA_ERR_WRONG_IN_RECORD;
DBUG_PRINT("error",("to_end: 0x%lx -> 0x%lx from_end: 0x%lx -> 0x%lx", DBUG_PRINT("error",("to_end: 0x%lx -> 0x%lx from_end: 0x%lx -> 0x%lx",
(long) to, (long) to_end, (long) from, (long) from_end)); (long) to, (long) to_end, (long) from, (long) from_end));
DBUG_DUMP("from",(byte*) info->rec_buff,info->s->base.min_pack_length); DBUG_DUMP("from",(uchar*) info->rec_buff,info->s->base.min_pack_length);
DBUG_RETURN(MY_FILE_ERROR); DBUG_RETURN(MY_FILE_ERROR);
} /* _ma_rec_unpack */ } /* _ma_rec_unpack */
/* Calc length of blob. Update info in blobs->length */ /* Calc length of blob. Update info in blobs->length */
ulong _ma_calc_total_blob_length(MARIA_HA *info, const byte *record) ulong _ma_calc_total_blob_length(MARIA_HA *info, const uchar *record)
{ {
ulong length; ulong length;
MARIA_BLOB *blob,*end; MARIA_BLOB *blob,*end;
@ -1301,7 +1302,7 @@ ulong _ma_calc_total_blob_length(MARIA_HA *info, const byte *record)
} }
ulong _ma_calc_blob_length(uint length, const byte *pos) ulong _ma_calc_blob_length(uint length, const uchar *pos)
{ {
switch (length) { switch (length) {
case 1: case 1:
@ -1319,7 +1320,7 @@ ulong _ma_calc_blob_length(uint length, const byte *pos)
} }
void _ma_store_blob_length(byte *pos,uint pack_length,uint length) void _ma_store_blob_length(uchar *pos,uint pack_length,uint length)
{ {
switch (pack_length) { switch (pack_length) {
case 1: case 1:
@ -1352,11 +1353,11 @@ void _ma_store_blob_length(byte *pos,uint pack_length,uint length)
NOTE NOTE
If a write buffer is active, it needs to be flushed if its contents If a write buffer is active, it needs to be flushed if its contents
intersects with the record to read. We always check if the position intersects with the record to read. We always check if the position
of the first byte of the write buffer is lower than the position of the first uchar of the write buffer is lower than the position
past the last byte to read. In theory this is also true if the write past the last uchar to read. In theory this is also true if the write
buffer is completely below the read segment. That is, if there is no buffer is completely below the read segment. That is, if there is no
intersection. But this case is unusual. We flush anyway. Only if the intersection. But this case is unusual. We flush anyway. Only if the
first byte in the write buffer is above the last byte to read, we do first uchar in the write buffer is above the last uchar to read, we do
not flush. not flush.
A dynamic record may need several reads. So this check must be done A dynamic record may need several reads. So this check must be done
@ -1370,7 +1371,7 @@ void _ma_store_blob_length(byte *pos,uint pack_length,uint length)
0 OK 0 OK
1 Error 1 Error
*/ */
int _ma_read_dynamic_record(MARIA_HA *info, byte *buf, int _ma_read_dynamic_record(MARIA_HA *info, uchar *buf,
MARIA_RECORD_POS filepos) MARIA_RECORD_POS filepos)
{ {
int block_of_record; int block_of_record;
@ -1381,7 +1382,7 @@ int _ma_read_dynamic_record(MARIA_HA *info, byte *buf,
if (filepos != HA_OFFSET_ERROR) if (filepos != HA_OFFSET_ERROR)
{ {
byte *to; uchar *to;
uint left_length; uint left_length;
LINT_INIT(to); LINT_INIT(to);
@ -1434,7 +1435,7 @@ int _ma_read_dynamic_record(MARIA_HA *info, byte *buf,
prefetch_len= block_info.data_len; prefetch_len= block_info.data_len;
if (prefetch_len) if (prefetch_len)
{ {
memcpy((byte*) to, block_info.header + offset, prefetch_len); memcpy((uchar*) to, block_info.header + offset, prefetch_len);
block_info.data_len-= prefetch_len; block_info.data_len-= prefetch_len;
left_length-= prefetch_len; left_length-= prefetch_len;
to+= prefetch_len; to+= prefetch_len;
@ -1452,7 +1453,7 @@ int _ma_read_dynamic_record(MARIA_HA *info, byte *buf,
there is no equivalent without seeking. We are at the right there is no equivalent without seeking. We are at the right
position already. :( position already. :(
*/ */
if (info->s->file_read(info, (byte*) to, block_info.data_len, if (info->s->file_read(info, (uchar*) to, block_info.data_len,
filepos, MYF(MY_NABP))) filepos, MYF(MY_NABP)))
goto panic; goto panic;
left_length-=block_info.data_len; left_length-=block_info.data_len;
@ -1479,9 +1480,9 @@ err:
/* compare unique constraint between stored rows */ /* compare unique constraint between stored rows */
my_bool _ma_cmp_dynamic_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, my_bool _ma_cmp_dynamic_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
const byte *record, MARIA_RECORD_POS pos) const uchar *record, MARIA_RECORD_POS pos)
{ {
byte *old_rec_buff,*old_record; uchar *old_rec_buff,*old_record;
my_off_t old_rec_buff_size; my_off_t old_rec_buff_size;
my_bool error; my_bool error;
DBUG_ENTER("_ma_cmp_dynamic_unique"); DBUG_ENTER("_ma_cmp_dynamic_unique");
@ -1512,11 +1513,11 @@ my_bool _ma_cmp_dynamic_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
/* Compare of record on disk with packed record in memory */ /* Compare of record on disk with packed record in memory */
my_bool _ma_cmp_dynamic_record(register MARIA_HA *info, my_bool _ma_cmp_dynamic_record(register MARIA_HA *info,
register const byte *record) register const uchar *record)
{ {
uint flag, reclength, b_type,cmp_length; uint flag, reclength, b_type,cmp_length;
my_off_t filepos; my_off_t filepos;
byte *buffer; uchar *buffer;
MARIA_BLOCK_INFO block_info; MARIA_BLOCK_INFO block_info;
my_bool error= 1; my_bool error= 1;
DBUG_ENTER("_ma_cmp_dynamic_record"); DBUG_ENTER("_ma_cmp_dynamic_record");
@ -1539,7 +1540,7 @@ my_bool _ma_cmp_dynamic_record(register MARIA_HA *info,
{ /* If check isn't disabled */ { /* If check isn't disabled */
if (info->s->base.blobs) if (info->s->base.blobs)
{ {
if (!(buffer=(byte*) my_alloca(info->s->base.pack_reclength+ if (!(buffer=(uchar*) my_alloca(info->s->base.pack_reclength+
_ma_calc_total_blob_length(info,record)))) _ma_calc_total_blob_length(info,record))))
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -1592,7 +1593,7 @@ my_bool _ma_cmp_dynamic_record(register MARIA_HA *info,
error= 0; error= 0;
err: err:
if (buffer != info->rec_buff) if (buffer != info->rec_buff)
my_afree((gptr) buffer); my_afree((uchar*) buffer);
DBUG_PRINT("exit", ("result: %d", error)); DBUG_PRINT("exit", ("result: %d", error));
DBUG_RETURN(error); DBUG_RETURN(error);
} }
@ -1600,7 +1601,7 @@ err:
/* Compare file to buffert */ /* Compare file to buffert */
static my_bool _ma_cmp_buffer(File file, const byte *buff, my_off_t filepos, static my_bool _ma_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
uint length) uint length)
{ {
uint next_length; uint next_length;
@ -1612,7 +1613,7 @@ static my_bool _ma_cmp_buffer(File file, const byte *buff, my_off_t filepos,
while (length > IO_SIZE*2) while (length > IO_SIZE*2)
{ {
if (my_pread(file,temp_buff,next_length,filepos, MYF(MY_NABP)) || if (my_pread(file,temp_buff,next_length,filepos, MYF(MY_NABP)) ||
memcmp((byte*) buff,temp_buff,next_length)) memcmp((uchar*) buff,temp_buff,next_length))
goto err; goto err;
filepos+=next_length; filepos+=next_length;
buff+=next_length; buff+=next_length;
@ -1621,7 +1622,7 @@ static my_bool _ma_cmp_buffer(File file, const byte *buff, my_off_t filepos,
} }
if (my_pread(file,temp_buff,length,filepos,MYF(MY_NABP))) if (my_pread(file,temp_buff,length,filepos,MYF(MY_NABP)))
goto err; goto err;
DBUG_RETURN(memcmp((byte*) buff,temp_buff,length) != 0); DBUG_RETURN(memcmp((uchar*) buff,temp_buff,length) != 0);
err: err:
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -1657,13 +1658,13 @@ err:
*/ */
int _ma_read_rnd_dynamic_record(MARIA_HA *info, int _ma_read_rnd_dynamic_record(MARIA_HA *info,
byte *buf, uchar *buf,
MARIA_RECORD_POS filepos, MARIA_RECORD_POS filepos,
my_bool skip_deleted_blocks) my_bool skip_deleted_blocks)
{ {
int block_of_record, info_read, save_errno; int block_of_record, info_read, save_errno;
uint left_len,b_type; uint left_len,b_type;
byte *to; uchar *to;
MARIA_BLOCK_INFO block_info; MARIA_BLOCK_INFO block_info;
MARIA_SHARE *share=info->s; MARIA_SHARE *share=info->s;
DBUG_ENTER("_ma_read_rnd_dynamic_record"); DBUG_ENTER("_ma_read_rnd_dynamic_record");
@ -1703,7 +1704,7 @@ int _ma_read_rnd_dynamic_record(MARIA_HA *info,
} }
if (info->opt_flag & READ_CACHE_USED) if (info->opt_flag & READ_CACHE_USED)
{ {
if (_ma_read_cache(&info->rec_cache,(byte*) block_info.header,filepos, if (_ma_read_cache(&info->rec_cache,(uchar*) block_info.header,filepos,
sizeof(block_info.header), sizeof(block_info.header),
(!block_of_record && skip_deleted_blocks ? (!block_of_record && skip_deleted_blocks ?
READING_NEXT : 0) | READING_HEADER)) READING_NEXT : 0) | READING_HEADER))
@ -1766,7 +1767,7 @@ int _ma_read_rnd_dynamic_record(MARIA_HA *info,
tmp_length= block_info.data_len; tmp_length= block_info.data_len;
if (tmp_length) if (tmp_length)
{ {
memcpy((byte*) to, block_info.header+offset,tmp_length); memcpy((uchar*) to, block_info.header+offset,tmp_length);
block_info.data_len-=tmp_length; block_info.data_len-=tmp_length;
left_len-=tmp_length; left_len-=tmp_length;
to+=tmp_length; to+=tmp_length;
@ -1778,7 +1779,7 @@ int _ma_read_rnd_dynamic_record(MARIA_HA *info,
{ {
if (info->opt_flag & READ_CACHE_USED) if (info->opt_flag & READ_CACHE_USED)
{ {
if (_ma_read_cache(&info->rec_cache,(byte*) to,filepos, if (_ma_read_cache(&info->rec_cache,(uchar*) to,filepos,
block_info.data_len, block_info.data_len,
(!block_of_record && skip_deleted_blocks) ? (!block_of_record && skip_deleted_blocks) ?
READING_NEXT : 0)) READING_NEXT : 0))
@ -1792,7 +1793,7 @@ int _ma_read_rnd_dynamic_record(MARIA_HA *info,
flush_io_cache(&info->rec_cache)) flush_io_cache(&info->rec_cache))
goto err; goto err;
/* VOID(my_seek(info->dfile.file, filepos, MY_SEEK_SET, MYF(0))); */ /* VOID(my_seek(info->dfile.file, filepos, MY_SEEK_SET, MYF(0))); */
if (my_read(info->dfile.file, (byte*)to, block_info.data_len, if (my_read(info->dfile.file, (uchar*)to, block_info.data_len,
MYF(MY_NABP))) MYF(MY_NABP)))
{ {
if (my_errno == -1) if (my_errno == -1)
@ -1850,7 +1851,7 @@ uint _ma_get_block_info(MARIA_BLOCK_INFO *info, File file, my_off_t filepos)
sizeof(info->header)) sizeof(info->header))
goto err; goto err;
} }
DBUG_DUMP("header",(byte*) header,MARIA_BLOCK_INFO_HEADER_LENGTH); DBUG_DUMP("header",(uchar*) header,MARIA_BLOCK_INFO_HEADER_LENGTH);
if (info->second_read) if (info->second_read)
{ {
if (info->header[0] <= 6 || info->header[0] == 13) if (info->header[0] <= 6 || info->header[0] == 13)

View File

@ -188,8 +188,8 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
case HA_EXTRA_KEYREAD: /* Read only keys to record */ case HA_EXTRA_KEYREAD: /* Read only keys to record */
case HA_EXTRA_REMEMBER_POS: case HA_EXTRA_REMEMBER_POS:
info->opt_flag |= REMEMBER_OLD_POS; info->opt_flag |= REMEMBER_OLD_POS;
bmove((byte*) info->lastkey+share->base.max_key_length*2, bmove((uchar*) info->lastkey+share->base.max_key_length*2,
(byte*) info->lastkey,info->lastkey_length); (uchar*) info->lastkey,info->lastkey_length);
info->save_update= info->update; info->save_update= info->update;
info->save_lastinx= info->lastinx; info->save_lastinx= info->lastinx;
info->save_lastpos= info->cur_row.lastpos; info->save_lastpos= info->cur_row.lastpos;
@ -205,8 +205,8 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
case HA_EXTRA_RESTORE_POS: case HA_EXTRA_RESTORE_POS:
if (info->opt_flag & REMEMBER_OLD_POS) if (info->opt_flag & REMEMBER_OLD_POS)
{ {
bmove((byte*) info->lastkey, bmove((uchar*) info->lastkey,
(byte*) info->lastkey+share->base.max_key_length*2, (uchar*) info->lastkey+share->base.max_key_length*2,
info->save_lastkey_length); info->save_lastkey_length);
info->update= info->save_update | HA_STATE_WRITTEN; info->update= info->save_update | HA_STATE_WRITTEN;
info->lastinx= info->save_lastinx; info->lastinx= info->save_lastinx;

View File

@ -111,7 +111,7 @@ typedef struct st_ftb_word
uint ndepth; uint ndepth;
uint len; uint len;
uchar off; uchar off;
byte word[1]; uchar word[1];
} FTB_WORD; } FTB_WORD;
typedef struct st_ft_info typedef struct st_ft_info
@ -161,7 +161,7 @@ typedef struct st_my_ftb_param
{ {
FTB *ftb; FTB *ftb;
FTB_EXPR *ftbe; FTB_EXPR *ftbe;
byte *up_quot; uchar *up_quot;
uint depth; uint depth;
} MY_FTB_PARAM; } MY_FTB_PARAM;
@ -274,7 +274,7 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
MY_FTB_PARAM *ftb_param= param->mysql_ftparam; MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info; MYSQL_FTPARSER_BOOLEAN_INFO info;
CHARSET_INFO *cs= ftb_param->ftb->charset; CHARSET_INFO *cs= ftb_param->ftb->charset;
char **start= &query; uchar **start= (uchar**) &query;
char *end= query + len; char *end= query + len;
FT_WORD w; FT_WORD w;
@ -286,7 +286,7 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
} }
static void _ftb_parse_query(FTB *ftb, byte *query, uint len, static void _ftb_parse_query(FTB *ftb, uchar *query, uint len,
struct st_mysql_ftparser *parser) struct st_mysql_ftparser *parser)
{ {
MYSQL_FTPARSER_PARAM *param; MYSQL_FTPARSER_PARAM *param;
@ -331,7 +331,7 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
my_bool can_go_down; my_bool can_go_down;
MARIA_HA *info=ftb->info; MARIA_HA *info=ftb->info;
uint off= 0, extra=HA_FT_WLEN+info->s->base.rec_reflength; uint off= 0, extra=HA_FT_WLEN+info->s->base.rec_reflength;
byte *lastkey_buf= ftbw->word+ftbw->off; uchar *lastkey_buf= ftbw->word+ftbw->off;
if (ftbw->flags & FTB_FLAG_TRUNC) if (ftbw->flags & FTB_FLAG_TRUNC)
lastkey_buf+=ftbw->len; lastkey_buf+=ftbw->len;
@ -504,7 +504,7 @@ static void _ftb_init_index_search(FT_INFO *ftb)
} }
FT_INFO * maria_ft_init_boolean_search(MARIA_HA *info, uint keynr, byte *query, FT_INFO * maria_ft_init_boolean_search(MARIA_HA *info, uint keynr, uchar *query,
uint query_len, CHARSET_INFO *cs) uint query_len, CHARSET_INFO *cs)
{ {
FTB *ftb; FTB *ftb;
@ -544,14 +544,14 @@ FT_INFO * maria_ft_init_boolean_search(MARIA_HA *info, uint keynr, byte *query,
Hack: instead of init_queue, we'll use reinit queue to be able Hack: instead of init_queue, we'll use reinit queue to be able
to alloc queue with alloc_root() to alloc queue with alloc_root()
*/ */
if (! (ftb->queue.root= (byte **)alloc_root(&ftb->mem_root, if (! (ftb->queue.root= (uchar **)alloc_root(&ftb->mem_root,
(ftb->queue.max_elements + 1) * (ftb->queue.max_elements + 1) *
sizeof(void *)))) sizeof(void *))))
goto err; goto err;
reinit_queue(&ftb->queue, ftb->queue.max_elements, 0, 0, reinit_queue(&ftb->queue, ftb->queue.max_elements, 0, 0,
(int (*)(void*, byte*, byte*))FTB_WORD_cmp, 0); (int (*)(void*, uchar*, uchar*))FTB_WORD_cmp, 0);
for (ftbw= ftb->last_word; ftbw; ftbw= ftbw->prev) for (ftbw= ftb->last_word; ftbw; ftbw= ftbw->prev)
queue_insert(&ftb->queue, (byte *)ftbw); queue_insert(&ftb->queue, (uchar *)ftbw);
ftb->list=(FTB_WORD **)alloc_root(&ftb->mem_root, ftb->list=(FTB_WORD **)alloc_root(&ftb->mem_root,
sizeof(FTB_WORD *)*ftb->queue.elements); sizeof(FTB_WORD *)*ftb->queue.elements);
memcpy(ftb->list, ftb->queue.root+1, sizeof(FTB_WORD *)*ftb->queue.elements); memcpy(ftb->list, ftb->queue.root+1, sizeof(FTB_WORD *)*ftb->queue.elements);
@ -562,7 +562,7 @@ FT_INFO * maria_ft_init_boolean_search(MARIA_HA *info, uint keynr, byte *query,
return ftb; return ftb;
err: err:
free_root(& ftb->mem_root, MYF(0)); free_root(& ftb->mem_root, MYF(0));
my_free((gptr)ftb,MYF(0)); my_free((uchar*)ftb,MYF(0));
return 0; return 0;
} }
@ -616,7 +616,8 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
FT_WORD word; FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam; MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
const char *docend= document + len; const char *docend= document + len;
while (maria_ft_simple_get_word(phrase_param->cs, &document, docend, &word, FALSE)) while (maria_ft_simple_get_word(phrase_param->cs, (uchar**) &document,
docend, &word, FALSE))
{ {
param->mysql_add_word(param, word.pos, word.len, 0); param->mysql_add_word(param, word.pos, word.len, 0);
if (phrase_param->match) if (phrase_param->match)
@ -640,7 +641,7 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
1 is returned if phrase found, 0 else. 1 is returned if phrase found, 0 else.
*/ */
static int _ftb_check_phrase(FTB *ftb, const byte *document, uint len, static int _ftb_check_phrase(FTB *ftb, const uchar *document, uint len,
FTB_EXPR *ftbe, struct st_mysql_ftparser *parser) FTB_EXPR *ftbe, struct st_mysql_ftparser *parser)
{ {
MY_FTB_PHRASE_PARAM ftb_param; MY_FTB_PHRASE_PARAM ftb_param;
@ -661,7 +662,7 @@ static int _ftb_check_phrase(FTB *ftb, const byte *document, uint len,
param->mysql_add_word= ftb_phrase_add_word; param->mysql_add_word= ftb_phrase_add_word;
param->mysql_ftparam= (void *)&ftb_param; param->mysql_ftparam= (void *)&ftb_param;
param->cs= ftb->charset; param->cs= ftb->charset;
param->doc= (byte *)document; param->doc= (uchar *)document;
param->length= len; param->length= len;
param->flags= 0; param->flags= 0;
param->mode= MYSQL_FTPARSER_WITH_STOPWORDS; param->mode= MYSQL_FTPARSER_WITH_STOPWORDS;
@ -865,13 +866,13 @@ static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
FT_INFO *ftb= ftb_param->ftb; FT_INFO *ftb= ftb_param->ftb;
char *end= doc + len; char *end= doc + len;
FT_WORD w; FT_WORD w;
while (maria_ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE)) while (maria_ft_simple_get_word(ftb->charset, (uchar**) &doc, end, &w, TRUE))
param->mysql_add_word(param, w.pos, w.len, 0); param->mysql_add_word(param, w.pos, w.len, 0);
return(0); return(0);
} }
float maria_ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) float maria_ft_boolean_find_relevance(FT_INFO *ftb, uchar *record, uint length)
{ {
FTB_EXPR *ftbe; FTB_EXPR *ftbe;
FT_SEG_ITERATOR ftsi, ftsi2; FT_SEG_ITERATOR ftsi, ftsi2;
@ -923,7 +924,7 @@ float maria_ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
{ {
if (!ftsi.pos) if (!ftsi.pos)
continue; continue;
param->doc= (byte *)ftsi.pos; param->doc= (uchar *)ftsi.pos;
param->length= ftsi.len; param->length= ftsi.len;
parser->parse(param); parser->parse(param);
} }
@ -947,7 +948,7 @@ void maria_ft_boolean_close_search(FT_INFO *ftb)
delete_tree(& ftb->no_dupes); delete_tree(& ftb->no_dupes);
} }
free_root(& ftb->mem_root, MYF(0)); free_root(& ftb->mem_root, MYF(0));
my_free((gptr)ftb,MYF(0)); my_free((uchar*)ftb,MYF(0));
} }

View File

@ -69,7 +69,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
TREE_ELEMENT *selem; TREE_ELEMENT *selem;
double gweight=1; double gweight=1;
MARIA_HA *info= aio->info; MARIA_HA *info= aio->info;
byte *keybuff= (byte*) aio->keybuff; uchar *keybuff= (uchar*) aio->keybuff;
MARIA_KEYDEF *keyinfo=info->s->keyinfo+aio->keynr; MARIA_KEYDEF *keyinfo=info->s->keyinfo+aio->keynr;
my_off_t key_root=info->s->state.key_root[aio->keynr]; my_off_t key_root=info->s->state.key_root[aio->keynr];
uint extra=HA_FT_WLEN+info->s->base.rec_reflength; uint extra=HA_FT_WLEN+info->s->base.rec_reflength;
@ -190,7 +190,7 @@ static int walk_and_push(FT_SUPERDOC *from,
DBUG_ENTER("walk_and_copy"); DBUG_ENTER("walk_and_copy");
from->doc.weight+=from->tmp_weight*from->word_ptr->weight; from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
set_if_smaller(best->elements, ft_query_expansion_limit-1); set_if_smaller(best->elements, ft_query_expansion_limit-1);
queue_insert(best, (byte *)& from->doc); queue_insert(best, (uchar *)& from->doc);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -202,8 +202,8 @@ static int FT_DOC_cmp(void *unused __attribute__((unused)),
} }
FT_INFO *maria_ft_init_nlq_search(MARIA_HA *info, uint keynr, byte *query, FT_INFO *maria_ft_init_nlq_search(MARIA_HA *info, uint keynr, uchar *query,
uint query_len, uint flags, byte *record) uint query_len, uint flags, uchar *record)
{ {
TREE wtree; TREE wtree;
ALL_IN_ONE aio; ALL_IN_ONE aio;
@ -324,7 +324,7 @@ int maria_ft_nlq_read_next(FT_INFO *handler, char *record)
float maria_ft_nlq_find_relevance(FT_INFO *handler, float maria_ft_nlq_find_relevance(FT_INFO *handler,
byte *record __attribute__((unused)), uchar *record __attribute__((unused)),
uint length __attribute__((unused))) uint length __attribute__((unused)))
{ {
int a,b,c; int a,b,c;
@ -353,7 +353,7 @@ float maria_ft_nlq_find_relevance(FT_INFO *handler,
void maria_ft_nlq_close_search(FT_INFO *handler) void maria_ft_nlq_close_search(FT_INFO *handler)
{ {
my_free((gptr)handler,MYF(0)); my_free((uchar*)handler,MYF(0));
} }

View File

@ -80,7 +80,7 @@ FT_WORD * maria_ft_linearize(TREE *wtree, MEM_ROOT *mem_root)
DBUG_RETURN(wlist); DBUG_RETURN(wlist);
} }
my_bool maria_ft_boolean_check_syntax_string(const byte *str) my_bool maria_ft_boolean_check_syntax_string(const uchar *str)
{ {
uint i, j; uint i, j;
@ -109,10 +109,10 @@ my_bool maria_ft_boolean_check_syntax_string(const byte *str)
3 - right bracket 3 - right bracket
4 - stopword found 4 - stopword found
*/ */
byte maria_ft_get_word(CHARSET_INFO *cs, byte **start, byte *end, uchar maria_ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param) FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
{ {
byte *doc=*start; uchar *doc=*start;
int ctype; int ctype;
uint mwc, length, mbl; uint mwc, length, mbl;
@ -199,10 +199,11 @@ ret:
return param->type; return param->type;
} }
byte maria_ft_simple_get_word(CHARSET_INFO *cs, byte **start, const byte *end, uchar maria_ft_simple_get_word(CHARSET_INFO *cs, uchar **start,
FT_WORD *word, my_bool skip_stopwords) const uchar *end, FT_WORD *word,
my_bool skip_stopwords)
{ {
byte *doc= *start; uchar *doc= *start;
uint mwc, length, mbl; uint mwc, length, mbl;
int ctype; int ctype;
DBUG_ENTER("maria_ft_simple_get_word"); DBUG_ENTER("maria_ft_simple_get_word");
@ -263,9 +264,9 @@ static int maria_ft_add_word(MYSQL_FTPARSER_PARAM *param,
wtree= ft_param->wtree; wtree= ft_param->wtree;
if (param->flags & MYSQL_FTFLAGS_NEED_COPY) if (param->flags & MYSQL_FTFLAGS_NEED_COPY)
{ {
byte *ptr; uchar *ptr;
DBUG_ASSERT(wtree->with_delete == 0); DBUG_ASSERT(wtree->with_delete == 0);
ptr= (byte *)alloc_root(ft_param->mem_root, word_len); ptr= (uchar *)alloc_root(ft_param->mem_root, word_len);
memcpy(ptr, word, word_len); memcpy(ptr, word, word_len);
w.pos= ptr; w.pos= ptr;
} }
@ -282,9 +283,10 @@ static int maria_ft_add_word(MYSQL_FTPARSER_PARAM *param,
static int maria_ft_parse_internal(MYSQL_FTPARSER_PARAM *param, static int maria_ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
char *doc, int doc_len) char *doc_arg, int doc_len)
{ {
byte *end=doc+doc_len; uchar *doc= (uchar*) doc_arg;
uchar *end= doc + doc_len;
MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam; MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam;
TREE *wtree= ft_param->wtree; TREE *wtree= ft_param->wtree;
FT_WORD w; FT_WORD w;
@ -297,7 +299,7 @@ static int maria_ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
} }
int maria_ft_parse(TREE *wtree, byte *doc, int doclen, int maria_ft_parse(TREE *wtree, uchar *doc, int doclen,
struct st_mysql_ftparser *parser, struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root) MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{ {

View File

@ -20,7 +20,7 @@
#include "ma_ftdefs.h" #include "ma_ftdefs.h"
#include <math.h> #include <math.h>
void _ma_ft_segiterator_init(MARIA_HA *info, uint keynr, const byte *record, void _ma_ft_segiterator_init(MARIA_HA *info, uint keynr, const uchar *record,
FT_SEG_ITERATOR *ftsi) FT_SEG_ITERATOR *ftsi)
{ {
DBUG_ENTER("_ma_ft_segiterator_init"); DBUG_ENTER("_ma_ft_segiterator_init");
@ -31,7 +31,7 @@ void _ma_ft_segiterator_init(MARIA_HA *info, uint keynr, const byte *record,
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
void _ma_ft_segiterator_dummy_init(const byte *record, uint len, void _ma_ft_segiterator_dummy_init(const uchar *record, uint len,
FT_SEG_ITERATOR *ftsi) FT_SEG_ITERATOR *ftsi)
{ {
DBUG_ENTER("_ma_ft_segiterator_dummy_init"); DBUG_ENTER("_ma_ft_segiterator_dummy_init");
@ -94,7 +94,7 @@ uint _ma_ft_segiterator(register FT_SEG_ITERATOR *ftsi)
/* parses a document i.e. calls maria_ft_parse for every keyseg */ /* parses a document i.e. calls maria_ft_parse for every keyseg */
uint _ma_ft_parse(TREE *parsed, MARIA_HA *info, uint keynr, const byte *record, uint _ma_ft_parse(TREE *parsed, MARIA_HA *info, uint keynr, const uchar *record,
MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root) MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{ {
FT_SEG_ITERATOR ftsi; FT_SEG_ITERATOR ftsi;
@ -108,14 +108,14 @@ uint _ma_ft_parse(TREE *parsed, MARIA_HA *info, uint keynr, const byte *record,
while (_ma_ft_segiterator(&ftsi)) while (_ma_ft_segiterator(&ftsi))
{ {
if (ftsi.pos) if (ftsi.pos)
if (maria_ft_parse(parsed, (byte *)ftsi.pos, ftsi.len, parser, param, if (maria_ft_parse(parsed, (uchar *)ftsi.pos, ftsi.len, parser, param,
mem_root)) mem_root))
DBUG_RETURN(1); DBUG_RETURN(1);
} }
DBUG_RETURN(0); DBUG_RETURN(0);
} }
FT_WORD * _ma_ft_parserecord(MARIA_HA *info, uint keynr, const byte *record, FT_WORD * _ma_ft_parserecord(MARIA_HA *info, uint keynr, const uchar *record,
MEM_ROOT *mem_root) MEM_ROOT *mem_root)
{ {
TREE ptree; TREE ptree;
@ -131,7 +131,7 @@ FT_WORD * _ma_ft_parserecord(MARIA_HA *info, uint keynr, const byte *record,
DBUG_RETURN(maria_ft_linearize(&ptree, mem_root)); DBUG_RETURN(maria_ft_linearize(&ptree, mem_root));
} }
static int _ma_ft_store(MARIA_HA *info, uint keynr, byte *keybuf, static int _ma_ft_store(MARIA_HA *info, uint keynr, uchar *keybuf,
FT_WORD *wlist, my_off_t filepos) FT_WORD *wlist, my_off_t filepos)
{ {
uint key_length; uint key_length;
@ -146,7 +146,7 @@ static int _ma_ft_store(MARIA_HA *info, uint keynr, byte *keybuf,
DBUG_RETURN(0); DBUG_RETURN(0);
} }
static int _ma_ft_erase(MARIA_HA *info, uint keynr, byte *keybuf, static int _ma_ft_erase(MARIA_HA *info, uint keynr, uchar *keybuf,
FT_WORD *wlist, my_off_t filepos) FT_WORD *wlist, my_off_t filepos)
{ {
uint key_length, err=0; uint key_length, err=0;
@ -169,7 +169,7 @@ static int _ma_ft_erase(MARIA_HA *info, uint keynr, byte *keybuf,
#define THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT 1 #define THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT 1
#define GEE_THEY_ARE_ABSOLUTELY_IDENTICAL 0 #define GEE_THEY_ARE_ABSOLUTELY_IDENTICAL 0
int _ma_ft_cmp(MARIA_HA *info, uint keynr, const byte *rec1, const byte *rec2) int _ma_ft_cmp(MARIA_HA *info, uint keynr, const uchar *rec1, const uchar *rec2)
{ {
FT_SEG_ITERATOR ftsi1, ftsi2; FT_SEG_ITERATOR ftsi1, ftsi2;
CHARSET_INFO *cs=info->s->keyinfo[keynr].seg->charset; CHARSET_INFO *cs=info->s->keyinfo[keynr].seg->charset;
@ -192,8 +192,8 @@ int _ma_ft_cmp(MARIA_HA *info, uint keynr, const byte *rec1, const byte *rec2)
/* update a document entry */ /* update a document entry */
int _ma_ft_update(MARIA_HA *info, uint keynr, byte *keybuf, int _ma_ft_update(MARIA_HA *info, uint keynr, uchar *keybuf,
const byte *oldrec, const byte *newrec, my_off_t pos) const uchar *oldrec, const uchar *newrec, my_off_t pos)
{ {
int error= -1; int error= -1;
FT_WORD *oldlist,*newlist, *old_word, *new_word; FT_WORD *oldlist,*newlist, *old_word, *new_word;
@ -243,7 +243,7 @@ err:
/* adds a document to the collection */ /* adds a document to the collection */
int _ma_ft_add(MARIA_HA *info, uint keynr, byte *keybuf, const byte *record, int _ma_ft_add(MARIA_HA *info, uint keynr, uchar *keybuf, const uchar *record,
my_off_t pos) my_off_t pos)
{ {
int error= -1; int error= -1;
@ -261,7 +261,7 @@ int _ma_ft_add(MARIA_HA *info, uint keynr, byte *keybuf, const byte *record,
/* removes a document from the collection */ /* removes a document from the collection */
int _ma_ft_del(MARIA_HA *info, uint keynr, byte *keybuf, const byte *record, int _ma_ft_del(MARIA_HA *info, uint keynr, uchar *keybuf, const uchar *record,
my_off_t pos) my_off_t pos)
{ {
int error= -1; int error= -1;
@ -277,10 +277,10 @@ int _ma_ft_del(MARIA_HA *info, uint keynr, byte *keybuf, const byte *record,
} }
uint _ma_ft_make_key(MARIA_HA *info, uint keynr, byte *keybuf, FT_WORD *wptr, uint _ma_ft_make_key(MARIA_HA *info, uint keynr, uchar *keybuf, FT_WORD *wptr,
my_off_t filepos) my_off_t filepos)
{ {
byte buf[HA_FT_MAXBYTELEN+16]; uchar buf[HA_FT_MAXBYTELEN+16];
DBUG_ENTER("_ma_ft_make_key"); DBUG_ENTER("_ma_ft_make_key");
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
@ -302,12 +302,12 @@ uint _ma_ft_make_key(MARIA_HA *info, uint keynr, byte *keybuf, FT_WORD *wptr,
convert key value to ft2 convert key value to ft2
*/ */
uint _ma_ft_convert_to_ft2(MARIA_HA *info, uint keynr, byte *key) uint _ma_ft_convert_to_ft2(MARIA_HA *info, uint keynr, uchar *key)
{ {
my_off_t root; my_off_t root;
DYNAMIC_ARRAY *da=info->ft1_to_ft2; DYNAMIC_ARRAY *da=info->ft1_to_ft2;
MARIA_KEYDEF *keyinfo=&info->s->ft2_keyinfo; MARIA_KEYDEF *keyinfo=&info->s->ft2_keyinfo;
byte *key_ptr= (byte*) dynamic_array_ptr(da, 0), *end; uchar *key_ptr= (uchar*) dynamic_array_ptr(da, 0), *end;
uint length, key_length; uint length, key_length;
DBUG_ENTER("_ma_ft_convert_to_ft2"); DBUG_ENTER("_ma_ft_convert_to_ft2");
@ -335,7 +335,7 @@ uint _ma_ft_convert_to_ft2(MARIA_HA *info, uint keynr, byte *key)
DBUG_RETURN(-1); DBUG_RETURN(-1);
/* inserting the rest of key values */ /* inserting the rest of key values */
end= (byte*) dynamic_array_ptr(da, da->elements); end= (uchar*) dynamic_array_ptr(da, da->elements);
for (key_ptr+=length; key_ptr < end; key_ptr+=keyinfo->keylength) for (key_ptr+=length; key_ptr < end; key_ptr+=keyinfo->keylength)
if(_ma_ck_real_write_btree(info, keyinfo, key_ptr, 0, &root, SEARCH_SAME)) if(_ma_ck_real_write_btree(info, keyinfo, key_ptr, 0, &root, SEARCH_SAME))
DBUG_RETURN(-1); DBUG_RETURN(-1);

View File

@ -96,44 +96,44 @@
#define FTB_RQUOT (ft_boolean_syntax[11]) #define FTB_RQUOT (ft_boolean_syntax[11])
typedef struct st_maria_ft_word { typedef struct st_maria_ft_word {
byte * pos; uchar * pos;
uint len; uint len;
double weight; double weight;
} FT_WORD; } FT_WORD;
int is_stopword(char *word, uint len); int is_stopword(char *word, uint len);
uint _ma_ft_make_key(MARIA_HA *, uint , byte *, FT_WORD *, my_off_t); uint _ma_ft_make_key(MARIA_HA *, uint , uchar *, FT_WORD *, my_off_t);
byte maria_ft_get_word(CHARSET_INFO *, byte **, byte *, FT_WORD *, uchar maria_ft_get_word(CHARSET_INFO *, uchar **, uchar *, FT_WORD *,
MYSQL_FTPARSER_BOOLEAN_INFO *); MYSQL_FTPARSER_BOOLEAN_INFO *);
byte maria_ft_simple_get_word(CHARSET_INFO *, byte **, const byte *, uchar maria_ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *,
FT_WORD *, my_bool); FT_WORD *, my_bool);
typedef struct _st_maria_ft_seg_iterator { typedef struct _st_maria_ft_seg_iterator {
uint num, len; uint num, len;
HA_KEYSEG *seg; HA_KEYSEG *seg;
const byte *rec, *pos; const uchar *rec, *pos;
} FT_SEG_ITERATOR; } FT_SEG_ITERATOR;
void _ma_ft_segiterator_init(MARIA_HA *, uint, const byte *, FT_SEG_ITERATOR *); void _ma_ft_segiterator_init(MARIA_HA *, uint, const uchar *, FT_SEG_ITERATOR *);
void _ma_ft_segiterator_dummy_init(const byte *, uint, FT_SEG_ITERATOR *); void _ma_ft_segiterator_dummy_init(const uchar *, uint, FT_SEG_ITERATOR *);
uint _ma_ft_segiterator(FT_SEG_ITERATOR *); uint _ma_ft_segiterator(FT_SEG_ITERATOR *);
void maria_ft_parse_init(TREE *, CHARSET_INFO *); void maria_ft_parse_init(TREE *, CHARSET_INFO *);
int maria_ft_parse(TREE *, byte *, int, struct st_mysql_ftparser *parser, int maria_ft_parse(TREE *, uchar *, int, struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *); MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
FT_WORD * maria_ft_linearize(TREE *, MEM_ROOT *); FT_WORD * maria_ft_linearize(TREE *, MEM_ROOT *);
FT_WORD * _ma_ft_parserecord(MARIA_HA *, uint, const byte *, MEM_ROOT *); FT_WORD * _ma_ft_parserecord(MARIA_HA *, uint, const uchar *, MEM_ROOT *);
uint _ma_ft_parse(TREE *, MARIA_HA *, uint, const byte *, uint _ma_ft_parse(TREE *, MARIA_HA *, uint, const uchar *,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *); MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
FT_INFO *maria_ft_init_nlq_search(MARIA_HA *, uint, byte *, uint, uint, byte *); FT_INFO *maria_ft_init_nlq_search(MARIA_HA *, uint, uchar *, uint, uint, uchar *);
FT_INFO *maria_ft_init_boolean_search(MARIA_HA *, uint, byte *, uint, CHARSET_INFO *); FT_INFO *maria_ft_init_boolean_search(MARIA_HA *, uint, uchar *, uint, CHARSET_INFO *);
extern const struct _ft_vft _ma_ft_vft_nlq; extern const struct _ft_vft _ma_ft_vft_nlq;
int maria_ft_nlq_read_next(FT_INFO *, char *); int maria_ft_nlq_read_next(FT_INFO *, char *);
float maria_ft_nlq_find_relevance(FT_INFO *, byte *, uint); float maria_ft_nlq_find_relevance(FT_INFO *, uchar *, uint);
void maria_ft_nlq_close_search(FT_INFO *); void maria_ft_nlq_close_search(FT_INFO *);
float maria_ft_nlq_get_relevance(FT_INFO *); float maria_ft_nlq_get_relevance(FT_INFO *);
my_off_t maria_ft_nlq_get_docid(FT_INFO *); my_off_t maria_ft_nlq_get_docid(FT_INFO *);
@ -141,7 +141,7 @@ void maria_ft_nlq_reinit_search(FT_INFO *);
extern const struct _ft_vft _ma_ft_vft_boolean; extern const struct _ft_vft _ma_ft_vft_boolean;
int maria_ft_boolean_read_next(FT_INFO *, char *); int maria_ft_boolean_read_next(FT_INFO *, char *);
float maria_ft_boolean_find_relevance(FT_INFO *, byte *, uint); float maria_ft_boolean_find_relevance(FT_INFO *, uchar *, uint);
void maria_ft_boolean_close_search(FT_INFO *); void maria_ft_boolean_close_search(FT_INFO *);
float maria_ft_boolean_get_relevance(FT_INFO *); float maria_ft_boolean_get_relevance(FT_INFO *);
my_off_t maria_ft_boolean_get_docid(FT_INFO *); my_off_t maria_ft_boolean_get_docid(FT_INFO *);

View File

@ -20,8 +20,8 @@
#include "maria_def.h" #include "maria_def.h"
#include "ft_global.h" #include "ft_global.h"
int _ma_ft_cmp(MARIA_HA *, uint, const byte *, const byte *); int _ma_ft_cmp(MARIA_HA *, uint, const uchar *, const uchar *);
int _ma_ft_add(MARIA_HA *, uint, byte *, const byte *, my_off_t); int _ma_ft_add(MARIA_HA *, uint, uchar *, const uchar *, my_off_t);
int _ma_ft_del(MARIA_HA *, uint, byte *, const byte *, my_off_t); int _ma_ft_del(MARIA_HA *, uint, uchar *, const uchar *, my_off_t);
uint _ma_ft_convert_to_ft2(MARIA_HA *, uint, byte *); uint _ma_ft_convert_to_ft2(MARIA_HA *, uint, uchar *);

View File

@ -31,7 +31,7 @@
set_if_smaller(char_length,length); \ set_if_smaller(char_length,length); \
} while(0) } while(0)
static int _ma_put_key_in_record(MARIA_HA *info,uint keynr,byte *record); static int _ma_put_key_in_record(MARIA_HA *info,uint keynr,uchar *record);
/* /*
Make a intern key from a record Make a intern key from a record
@ -48,11 +48,11 @@ static int _ma_put_key_in_record(MARIA_HA *info,uint keynr,byte *record);
Length of key Length of key
*/ */
uint _ma_make_key(register MARIA_HA *info, uint keynr, byte *key, uint _ma_make_key(register MARIA_HA *info, uint keynr, uchar *key,
const byte *record, MARIA_RECORD_POS filepos) const uchar *record, MARIA_RECORD_POS filepos)
{ {
const byte *pos; const uchar *pos;
byte *start; uchar *start;
reg1 HA_KEYSEG *keyseg; reg1 HA_KEYSEG *keyseg;
my_bool is_ft= info->s->keyinfo[keynr].flag & HA_FULLTEXT; my_bool is_ft= info->s->keyinfo[keynr].flag & HA_FULLTEXT;
DBUG_ENTER("_ma_make_key"); DBUG_ENTER("_ma_make_key");
@ -112,7 +112,7 @@ uint _ma_make_key(register MARIA_HA *info, uint keynr, byte *key,
} }
else else
{ {
const byte *end= pos + length; const uchar *end= pos + length;
while (pos < end && pos[0] == ' ') while (pos < end && pos[0] == ' ')
pos++; pos++;
length= (uint) (end-pos); length= (uint) (end-pos);
@ -215,10 +215,10 @@ uint _ma_make_key(register MARIA_HA *info, uint keynr, byte *key,
last_use_keyseg Store pointer to the keyseg after the last used one last_use_keyseg Store pointer to the keyseg after the last used one
*/ */
uint _ma_pack_key(register MARIA_HA *info, uint keynr, byte *key, uint _ma_pack_key(register MARIA_HA *info, uint keynr, uchar *key,
const byte *old, uint k_length, HA_KEYSEG **last_used_keyseg) const uchar *old, uint k_length, HA_KEYSEG **last_used_keyseg)
{ {
byte *start_key=key; uchar *start_key=key;
HA_KEYSEG *keyseg; HA_KEYSEG *keyseg;
my_bool is_ft= info->s->keyinfo[keynr].flag & HA_FULLTEXT; my_bool is_ft= info->s->keyinfo[keynr].flag & HA_FULLTEXT;
DBUG_ENTER("_ma_pack_key"); DBUG_ENTER("_ma_pack_key");
@ -230,7 +230,7 @@ uint _ma_pack_key(register MARIA_HA *info, uint keynr, byte *key,
enum ha_base_keytype type=(enum ha_base_keytype) keyseg->type; enum ha_base_keytype type=(enum ha_base_keytype) keyseg->type;
uint length=min((uint) keyseg->length,(uint) k_length); uint length=min((uint) keyseg->length,(uint) k_length);
uint char_length; uint char_length;
const byte *pos; const uchar *pos;
CHARSET_INFO *cs=keyseg->charset; CHARSET_INFO *cs=keyseg->charset;
if (keyseg->null_bit) if (keyseg->null_bit)
@ -252,7 +252,7 @@ uint _ma_pack_key(register MARIA_HA *info, uint keynr, byte *key,
pos= old; pos= old;
if (keyseg->flag & HA_SPACE_PACK) if (keyseg->flag & HA_SPACE_PACK)
{ {
const byte *end= pos + length; const uchar *end= pos + length;
if (type != HA_KEYTYPE_NUM) if (type != HA_KEYTYPE_NUM)
{ {
while (end > pos && end[-1] == ' ') while (end > pos && end[-1] == ' ')
@ -350,12 +350,12 @@ uint _ma_pack_key(register MARIA_HA *info, uint keynr, byte *key,
*/ */
static int _ma_put_key_in_record(register MARIA_HA *info, uint keynr, static int _ma_put_key_in_record(register MARIA_HA *info, uint keynr,
byte *record) uchar *record)
{ {
reg2 byte *key; reg2 uchar *key;
byte *pos,*key_end; uchar *pos,*key_end;
reg1 HA_KEYSEG *keyseg; reg1 HA_KEYSEG *keyseg;
byte *blob_ptr; uchar *blob_ptr;
DBUG_ENTER("_ma_put_key_in_record"); DBUG_ENTER("_ma_put_key_in_record");
blob_ptr= info->lastkey2; /* Place to put blob parts */ blob_ptr= info->lastkey2; /* Place to put blob parts */
@ -378,7 +378,7 @@ static int _ma_put_key_in_record(register MARIA_HA *info, uint keynr,
if (keyseg->bit_length) if (keyseg->bit_length)
{ {
byte bits= *key++; uchar bits= *key++;
set_rec_bits(bits, record + keyseg->bit_pos, keyseg->bit_start, set_rec_bits(bits, record + keyseg->bit_pos, keyseg->bit_start,
keyseg->bit_length); keyseg->bit_length);
length--; length--;
@ -456,8 +456,8 @@ static int _ma_put_key_in_record(register MARIA_HA *info, uint keynr,
} }
else if (keyseg->flag & HA_SWAP_KEY) else if (keyseg->flag & HA_SWAP_KEY)
{ {
byte *to= record+keyseg->start+keyseg->length; uchar *to= record+keyseg->start+keyseg->length;
byte *end= key+keyseg->length; uchar *end= key+keyseg->length;
#ifdef CHECK_KEYS #ifdef CHECK_KEYS
if (end > key_end) if (end > key_end)
goto err; goto err;
@ -487,7 +487,7 @@ err:
/* Here when key reads are used */ /* Here when key reads are used */
int _ma_read_key_record(MARIA_HA *info, byte *buf, MARIA_RECORD_POS filepos) int _ma_read_key_record(MARIA_HA *info, uchar *buf, MARIA_RECORD_POS filepos)
{ {
fast_ma_writeinfo(info); fast_ma_writeinfo(info);
if (filepos != HA_OFFSET_ERROR) if (filepos != HA_OFFSET_ERROR)
@ -522,12 +522,12 @@ int _ma_read_key_record(MARIA_HA *info, byte *buf, MARIA_RECORD_POS filepos)
less than zero. less than zero.
*/ */
ulonglong ma_retrieve_auto_increment(MARIA_HA *info,const byte *record) ulonglong ma_retrieve_auto_increment(MARIA_HA *info,const uchar *record)
{ {
ulonglong value= 0; /* Store unsigned values here */ ulonglong value= 0; /* Store unsigned values here */
longlong s_value= 0; /* Store signed values here */ longlong s_value= 0; /* Store signed values here */
HA_KEYSEG *keyseg= info->s->keyinfo[info->s->base.auto_key-1].seg; HA_KEYSEG *keyseg= info->s->keyinfo[info->s->base.auto_key-1].seg;
const byte *key= record + keyseg->start; const uchar *key= record + keyseg->start;
switch (keyseg->type) { switch (keyseg->type) {
case HA_KEYTYPE_INT8: case HA_KEYTYPE_INT8:

View File

@ -102,14 +102,14 @@ struct st_translog_buffer
/* lock for the buffer. Current buffer also lock the handler */ /* lock for the buffer. Current buffer also lock the handler */
pthread_mutex_t mutex; pthread_mutex_t mutex;
/* IO cache for current log */ /* IO cache for current log */
byte buffer[TRANSLOG_WRITE_BUFFER]; uchar buffer[TRANSLOG_WRITE_BUFFER];
}; };
struct st_buffer_cursor struct st_buffer_cursor
{ {
/* pointer on the buffer */ /* pointer on the buffer */
byte *ptr; uchar *ptr;
/* current buffer */ /* current buffer */
struct st_translog_buffer *buffer; struct st_translog_buffer *buffer;
/* current page fill */ /* current page fill */
@ -172,7 +172,7 @@ struct st_translog_descriptor
static struct st_translog_descriptor log_descriptor; static struct st_translog_descriptor log_descriptor;
/* Marker for end of log */ /* Marker for end of log */
static byte end_of_log= 0; static uchar end_of_log= 0;
my_bool translog_inited= 0; my_bool translog_inited= 0;
@ -207,7 +207,7 @@ typedef my_bool(*inwrite_rec_hook) (enum translog_record_type type,
typedef uint16(*read_rec_hook) (enum translog_record_type type, typedef uint16(*read_rec_hook) (enum translog_record_type type,
uint16 read_length, uchar *read_buff, uint16 read_length, uchar *read_buff,
byte *decoded_buff); uchar *decoded_buff);
/* /*
Descriptor of log record type Descriptor of log record type
@ -603,7 +603,7 @@ uchar NEAR maria_trans_file_magic[]=
static my_bool translog_write_file_header() static my_bool translog_write_file_header()
{ {
ulonglong timestamp; ulonglong timestamp;
byte page_buff[TRANSLOG_PAGE_SIZE], *page= page_buff; uchar page_buff[TRANSLOG_PAGE_SIZE], *page= page_buff;
DBUG_ENTER("translog_write_file_header"); DBUG_ENTER("translog_write_file_header");
/* file tag */ /* file tag */
@ -816,7 +816,7 @@ static my_bool translog_buffer_unlock(struct st_translog_buffer *buffer)
static void translog_new_page_header(TRANSLOG_ADDRESS *horizon, static void translog_new_page_header(TRANSLOG_ADDRESS *horizon,
struct st_buffer_cursor *cursor) struct st_buffer_cursor *cursor)
{ {
byte *ptr; uchar *ptr;
DBUG_ENTER("translog_new_page_header"); DBUG_ENTER("translog_new_page_header");
DBUG_ASSERT(cursor->ptr); DBUG_ASSERT(cursor->ptr);
@ -830,7 +830,7 @@ static void translog_new_page_header(TRANSLOG_ADDRESS *horizon,
/* File number */ /* File number */
int3store(ptr, LSN_FILE_NO(*horizon)); int3store(ptr, LSN_FILE_NO(*horizon));
ptr+= 3; ptr+= 3;
*(ptr++)= (byte) log_descriptor.flags; *(ptr++)= (uchar) log_descriptor.flags;
if (log_descriptor.flags & TRANSLOG_PAGE_CRC) if (log_descriptor.flags & TRANSLOG_PAGE_CRC)
{ {
#ifndef DBUG_OFF #ifndef DBUG_OFF
@ -880,10 +880,10 @@ static void translog_new_page_header(TRANSLOG_ADDRESS *horizon,
except the first sector that is protected by page header. except the first sector that is protected by page header.
*/ */
static void translog_put_sector_protection(byte *page, static void translog_put_sector_protection(uchar *page,
struct st_buffer_cursor *cursor) struct st_buffer_cursor *cursor)
{ {
byte *table= page + log_descriptor.page_overhead - uchar *table= page + log_descriptor.page_overhead -
(TRANSLOG_PAGE_SIZE / DISK_DRIVE_SECTOR_SIZE) * 2; (TRANSLOG_PAGE_SIZE / DISK_DRIVE_SECTOR_SIZE) * 2;
uint16 value= uint2korr(table) + cursor->write_counter; uint16 value= uint2korr(table) + cursor->write_counter;
uint16 last_protected_sector= ((cursor->previous_offset - 1) / uint16 last_protected_sector= ((cursor->previous_offset - 1) /
@ -942,7 +942,7 @@ static void translog_put_sector_protection(byte *page,
CRC32 CRC32
*/ */
static uint32 translog_crc(byte *area, uint length) static uint32 translog_crc(uchar *area, uint length)
{ {
return crc32(0L, (unsigned char*) area, length); return crc32(0L, (unsigned char*) area, length);
} }
@ -961,7 +961,7 @@ static void translog_finish_page(TRANSLOG_ADDRESS *horizon,
struct st_buffer_cursor *cursor) struct st_buffer_cursor *cursor)
{ {
uint16 left= TRANSLOG_PAGE_SIZE - cursor->current_page_fill; uint16 left= TRANSLOG_PAGE_SIZE - cursor->current_page_fill;
byte *page= cursor->ptr -cursor->current_page_fill; uchar *page= cursor->ptr -cursor->current_page_fill;
DBUG_ENTER("translog_finish_page"); DBUG_ENTER("translog_finish_page");
DBUG_PRINT("enter", ("Buffer: #%u 0x%lx " DBUG_PRINT("enter", ("Buffer: #%u 0x%lx "
"Buffer addr: (%lu,0x%lx) " "Buffer addr: (%lu,0x%lx) "
@ -1285,7 +1285,7 @@ static void translog_get_sent_to_file(LSN *lsn)
first chunk offset first chunk offset
*/ */
static my_bool translog_get_first_chunk_offset(byte *page) static my_bool translog_get_first_chunk_offset(uchar *page)
{ {
uint16 page_header= 7; uint16 page_header= 7;
DBUG_ENTER("translog_get_first_chunk_offset"); DBUG_ENTER("translog_get_first_chunk_offset");
@ -1309,7 +1309,7 @@ static my_bool translog_get_first_chunk_offset(byte *page)
*/ */
static void static void
translog_write_variable_record_1group_code_len(byte *dst, translog_write_variable_record_1group_code_len(uchar *dst,
translog_size_t length, translog_size_t length,
uint16 header_len) uint16 header_len)
{ {
@ -1350,7 +1350,7 @@ translog_write_variable_record_1group_code_len(byte *dst,
decoded length decoded length
*/ */
static translog_size_t translog_variable_record_1group_decode_len(byte **src) static translog_size_t translog_variable_record_1group_decode_len(uchar **src)
{ {
uint8 first= (uint8) (**src); uint8 first= (uint8) (**src);
switch (first) { switch (first) {
@ -1386,7 +1386,7 @@ static translog_size_t translog_variable_record_1group_decode_len(byte **src)
total length of the chunk total length of the chunk
*/ */
static uint16 translog_get_total_chunk_length(byte *page, uint16 offset) static uint16 translog_get_total_chunk_length(uchar *page, uint16 offset)
{ {
DBUG_ENTER("translog_get_total_chunk_length"); DBUG_ENTER("translog_get_total_chunk_length");
switch (page[offset] & TRANSLOG_CHUNK_TYPE) { switch (page[offset] & TRANSLOG_CHUNK_TYPE) {
@ -1394,8 +1394,8 @@ static uint16 translog_get_total_chunk_length(byte *page, uint16 offset)
{ {
/* 0 chunk referred as LSN (head or tail) */ /* 0 chunk referred as LSN (head or tail) */
translog_size_t rec_len; translog_size_t rec_len;
byte *start= page + offset; uchar *start= page + offset;
byte *ptr= start + 1 + 2; uchar *ptr= start + 1 + 2;
uint16 chunk_len, header_len, page_rest; uint16 chunk_len, header_len, page_rest;
DBUG_PRINT("info", ("TRANSLOG_CHUNK_LSN")); DBUG_PRINT("info", ("TRANSLOG_CHUNK_LSN"));
rec_len= translog_variable_record_1group_decode_len(&ptr); rec_len= translog_variable_record_1group_decode_len(&ptr);
@ -1418,7 +1418,7 @@ static uint16 translog_get_total_chunk_length(byte *page, uint16 offset)
} }
case TRANSLOG_CHUNK_FIXED: case TRANSLOG_CHUNK_FIXED:
{ {
byte *ptr; uchar *ptr;
uint type= page[offset] & TRANSLOG_REC_TYPE; uint type= page[offset] & TRANSLOG_REC_TYPE;
uint length; uint length;
int i; int i;
@ -1564,7 +1564,7 @@ static my_bool translog_buffer_flush(struct st_translog_buffer *buffer)
1 Error 1 Error
*/ */
static my_bool translog_recover_page_up_to_sector(byte *page, uint16 offset) static my_bool translog_recover_page_up_to_sector(uchar *page, uint16 offset)
{ {
uint16 chunk_offset= translog_get_first_chunk_offset(page), valid_chunk_end; uint16 chunk_offset= translog_get_first_chunk_offset(page), valid_chunk_end;
DBUG_ENTER("translog_recover_page_up_to_sector"); DBUG_ENTER("translog_recover_page_up_to_sector");
@ -1630,11 +1630,11 @@ static my_bool translog_recover_page_up_to_sector(byte *page, uint16 offset)
0 OK 0 OK
1 Error 1 Error
*/ */
static my_bool translog_page_validator(byte *page_addr, gptr data_ptr) static my_bool translog_page_validator(uchar *page_addr, uchar* data_ptr)
{ {
uint this_page_page_overhead; uint this_page_page_overhead;
uint flags; uint flags;
byte *page= (byte*) page_addr, *page_pos; uchar *page= (uchar*) page_addr, *page_pos;
TRANSLOG_VALIDATOR_DATA *data= (TRANSLOG_VALIDATOR_DATA *) data_ptr; TRANSLOG_VALIDATOR_DATA *data= (TRANSLOG_VALIDATOR_DATA *) data_ptr;
TRANSLOG_ADDRESS addr= *(data->addr); TRANSLOG_ADDRESS addr= *(data->addr);
DBUG_ENTER("translog_page_validator"); DBUG_ENTER("translog_page_validator");
@ -1683,7 +1683,7 @@ static my_bool translog_page_validator(byte *page_addr, gptr data_ptr)
if (flags & TRANSLOG_SECTOR_PROTECTION) if (flags & TRANSLOG_SECTOR_PROTECTION)
{ {
uint i, offset; uint i, offset;
byte *table= page_pos; uchar *table= page_pos;
uint16 current= uint2korr(table); uint16 current= uint2korr(table);
for (i= 2, offset= DISK_DRIVE_SECTOR_SIZE; for (i= 2, offset= DISK_DRIVE_SECTOR_SIZE;
i < (TRANSLOG_PAGE_SIZE / DISK_DRIVE_SECTOR_SIZE) * 2; i < (TRANSLOG_PAGE_SIZE / DISK_DRIVE_SECTOR_SIZE) * 2;
@ -1739,7 +1739,7 @@ static my_bool translog_page_validator(byte *page_addr, gptr data_ptr)
# pointer to the page cache which should be used to read this page # pointer to the page cache which should be used to read this page
*/ */
static byte *translog_get_page(TRANSLOG_VALIDATOR_DATA *data, byte *buffer) static uchar *translog_get_page(TRANSLOG_VALIDATOR_DATA *data, uchar *buffer)
{ {
TRANSLOG_ADDRESS addr= *(data->addr); TRANSLOG_ADDRESS addr= *(data->addr);
uint cache_index; uint cache_index;
@ -1766,13 +1766,13 @@ static byte *translog_get_page(TRANSLOG_VALIDATOR_DATA *data, byte *buffer)
} }
file.file= log_descriptor.log_file_num[cache_index]; file.file= log_descriptor.log_file_num[cache_index];
buffer= (byte*) buffer= (uchar*)
pagecache_valid_read(log_descriptor.pagecache, &file, pagecache_valid_read(log_descriptor.pagecache, &file,
LSN_OFFSET(addr) / TRANSLOG_PAGE_SIZE, LSN_OFFSET(addr) / TRANSLOG_PAGE_SIZE,
3, (char*) buffer, 3, (char*) buffer,
PAGECACHE_PLAIN_PAGE, PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED, 0, PAGECACHE_LOCK_LEFT_UNLOCKED, 0,
&translog_page_validator, (gptr) data); &translog_page_validator, (uchar*) data);
} }
else else
{ {
@ -1790,7 +1790,7 @@ static byte *translog_get_page(TRANSLOG_VALIDATOR_DATA *data, byte *buffer)
if (my_pread(file, (char*) buffer, TRANSLOG_PAGE_SIZE, if (my_pread(file, (char*) buffer, TRANSLOG_PAGE_SIZE,
LSN_OFFSET(addr), MYF(MY_FNABP | MY_WME))) LSN_OFFSET(addr), MYF(MY_FNABP | MY_WME)))
buffer= NULL; buffer= NULL;
else if (translog_page_validator((byte*) buffer, (gptr) data)) else if (translog_page_validator((uchar*) buffer, (uchar*) data))
buffer= NULL; buffer= NULL;
my_close(file, MYF(MY_WME)); my_close(file, MYF(MY_WME));
} }
@ -1879,7 +1879,7 @@ static uint translog_variable_record_length_bytes(translog_size_t length)
0 Error 0 Error
*/ */
static uint16 translog_get_chunk_header_length(byte *page, uint16 offset) static uint16 translog_get_chunk_header_length(uchar *page, uint16 offset)
{ {
DBUG_ENTER("translog_get_chunk_header_length"); DBUG_ENTER("translog_get_chunk_header_length");
page+= offset; page+= offset;
@ -1888,8 +1888,8 @@ static uint16 translog_get_chunk_header_length(byte *page, uint16 offset)
{ {
/* 0 chunk referred as LSN (head or tail) */ /* 0 chunk referred as LSN (head or tail) */
translog_size_t rec_len; translog_size_t rec_len;
byte *start= page; uchar *start= page;
byte *ptr= start + 1 + 2; uchar *ptr= start + 1 + 2;
uint16 chunk_len, header_len; uint16 chunk_len, header_len;
DBUG_PRINT("info", ("TRANSLOG_CHUNK_LSN")); DBUG_PRINT("info", ("TRANSLOG_CHUNK_LSN"));
rec_len= translog_variable_record_1group_decode_len(&ptr); rec_len= translog_variable_record_1group_decode_len(&ptr);
@ -2107,7 +2107,7 @@ my_bool translog_init(const char *directory,
do do
{ {
TRANSLOG_VALIDATOR_DATA data; TRANSLOG_VALIDATOR_DATA data;
byte buffer[TRANSLOG_PAGE_SIZE], *page; uchar buffer[TRANSLOG_PAGE_SIZE], *page;
data.addr= &current_page; data.addr= &current_page;
if ((page= translog_get_page(&data, buffer)) == NULL) if ((page= translog_get_page(&data, buffer)) == NULL)
DBUG_RETURN(1); DBUG_RETURN(1);
@ -2155,7 +2155,7 @@ my_bool translog_init(const char *directory,
if (logs_found && !old_log_was_recovered && old_flags == flags) if (logs_found && !old_log_was_recovered && old_flags == flags)
{ {
TRANSLOG_VALIDATOR_DATA data; TRANSLOG_VALIDATOR_DATA data;
byte buffer[TRANSLOG_PAGE_SIZE], *page; uchar buffer[TRANSLOG_PAGE_SIZE], *page;
uint16 chunk_offset; uint16 chunk_offset;
data.addr= &last_valid_page; data.addr= &last_valid_page;
/* continue old log */ /* continue old log */
@ -2169,7 +2169,7 @@ my_bool translog_init(const char *directory,
log_descriptor.horizon= last_valid_page; log_descriptor.horizon= last_valid_page;
translog_start_buffer(log_descriptor.buffers, &log_descriptor.bc, 0); translog_start_buffer(log_descriptor.buffers, &log_descriptor.bc, 0);
/* /*
Free space if filled with 0 and first byte of Free space if filled with 0 and first uchar of
real chunk can't be 0 real chunk can't be 0
*/ */
while (chunk_offset < TRANSLOG_PAGE_SIZE && page[chunk_offset] != '\0') while (chunk_offset < TRANSLOG_PAGE_SIZE && page[chunk_offset] != '\0')
@ -2329,7 +2329,7 @@ void translog_destroy()
pthread_mutex_destroy(&log_descriptor.sent_to_file_lock); pthread_mutex_destroy(&log_descriptor.sent_to_file_lock);
my_close(log_descriptor.directory_fd, MYF(MY_WME)); my_close(log_descriptor.directory_fd, MYF(MY_WME));
my_atomic_rwlock_destroy(&LOCK_id_to_share); my_atomic_rwlock_destroy(&LOCK_id_to_share);
my_free((gptr)(id_to_share + 1), MYF(MY_ALLOW_ZERO_PTR)); my_free((uchar*)(id_to_share + 1), MYF(MY_ALLOW_ZERO_PTR));
translog_inited= 0; translog_inited= 0;
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -2481,7 +2481,7 @@ static my_bool translog_page_next(TRANSLOG_ADDRESS *horizon,
static my_bool translog_write_data_on_page(TRANSLOG_ADDRESS *horizon, static my_bool translog_write_data_on_page(TRANSLOG_ADDRESS *horizon,
struct st_buffer_cursor *cursor, struct st_buffer_cursor *cursor,
translog_size_t length, translog_size_t length,
byte *buffer) uchar *buffer)
{ {
DBUG_ENTER("translog_write_data_on_page"); DBUG_ENTER("translog_write_data_on_page");
DBUG_PRINT("enter", ("Chunk length: %lu Page size %u", DBUG_PRINT("enter", ("Chunk length: %lu Page size %u",
@ -2547,11 +2547,11 @@ static my_bool translog_write_parts_on_page(TRANSLOG_ADDRESS *horizon,
{ {
translog_size_t len; translog_size_t len;
LEX_STRING *part; LEX_STRING *part;
byte *buff; uchar *buff;
DBUG_ASSERT(cur < parts->elements); DBUG_ASSERT(cur < parts->elements);
part= parts->parts + cur; part= parts->parts + cur;
buff= (byte*) part->str; buff= (uchar*) part->str;
DBUG_PRINT("info", ("Part: %u Length: %lu left: %lu buff: 0x%lx", DBUG_PRINT("info", ("Part: %u Length: %lu left: %lu buff: 0x%lx",
(uint) (cur + 1), (ulong) part->length, (ulong) left, (uint) (cur + 1), (ulong) part->length, (ulong) left,
(ulong) buff)); (ulong) buff));
@ -2623,7 +2623,7 @@ translog_write_variable_record_1group_header(struct st_translog_parts *parts,
enum translog_record_type type, enum translog_record_type type,
SHORT_TRANSACTION_ID short_trid, SHORT_TRANSACTION_ID short_trid,
uint16 header_length, uint16 header_length,
byte *chunk0_header) uchar *chunk0_header)
{ {
LEX_STRING *part; LEX_STRING *part;
DBUG_ASSERT(parts->current != 0); /* first part is left for header */ DBUG_ASSERT(parts->current != 0); /* first part is left for header */
@ -2631,7 +2631,7 @@ translog_write_variable_record_1group_header(struct st_translog_parts *parts,
parts->total_record_length+= (part->length= header_length); parts->total_record_length+= (part->length= header_length);
part->str= (char*)chunk0_header; part->str= (char*)chunk0_header;
/* puts chunk type */ /* puts chunk type */
*chunk0_header= (byte) (type | TRANSLOG_CHUNK_LSN); *chunk0_header= (uchar) (type | TRANSLOG_CHUNK_LSN);
int2store(chunk0_header + 1, short_trid); int2store(chunk0_header + 1, short_trid);
/* puts record length */ /* puts record length */
translog_write_variable_record_1group_code_len(chunk0_header + 3, translog_write_variable_record_1group_code_len(chunk0_header + 3,
@ -2706,7 +2706,7 @@ translog_write_variable_record_chunk2_page(struct st_translog_parts *parts,
{ {
struct st_translog_buffer *buffer_to_flush; struct st_translog_buffer *buffer_to_flush;
int rc; int rc;
byte chunk2_header[1]; uchar chunk2_header[1];
DBUG_ENTER("translog_write_variable_record_chunk2_page"); DBUG_ENTER("translog_write_variable_record_chunk2_page");
chunk2_header[0]= TRANSLOG_CHUNK_NOHDR; chunk2_header[0]= TRANSLOG_CHUNK_NOHDR;
@ -2756,7 +2756,7 @@ translog_write_variable_record_chunk3_page(struct st_translog_parts *parts,
struct st_translog_buffer *buffer_to_flush; struct st_translog_buffer *buffer_to_flush;
LEX_STRING *part; LEX_STRING *part;
int rc; int rc;
byte chunk3_header[1 + 2]; uchar chunk3_header[1 + 2];
DBUG_ENTER("translog_write_variable_record_chunk3_page"); DBUG_ENTER("translog_write_variable_record_chunk3_page");
LINT_INIT(buffer_to_flush); LINT_INIT(buffer_to_flush);
@ -2783,7 +2783,7 @@ translog_write_variable_record_chunk3_page(struct st_translog_parts *parts,
parts->total_record_length+= (part->length= 1 + 2); parts->total_record_length+= (part->length= 1 + 2);
part->str= (char*)chunk3_header; part->str= (char*)chunk3_header;
/* Puts chunk type */ /* Puts chunk type */
*chunk3_header= (byte) (TRANSLOG_CHUNK_LNGTH); *chunk3_header= (uchar) (TRANSLOG_CHUNK_LNGTH);
/* Puts chunk length */ /* Puts chunk length */
int2store(chunk3_header + 1, length); int2store(chunk3_header + 1, length);
@ -3027,7 +3027,7 @@ translog_write_variable_record_1group(LSN *lsn,
uint i; uint i;
translog_size_t record_rest, full_pages, first_page; translog_size_t record_rest, full_pages, first_page;
uint additional_chunk3_page= 0; uint additional_chunk3_page= 0;
byte chunk0_header[1 + 2 + 5 + 2]; uchar chunk0_header[1 + 2 + 5 + 2];
DBUG_ENTER("translog_write_variable_record_1group"); DBUG_ENTER("translog_write_variable_record_1group");
*lsn= horizon= log_descriptor.horizon; *lsn= horizon= log_descriptor.horizon;
@ -3176,7 +3176,7 @@ translog_write_variable_record_1chunk(LSN *lsn,
TRN *trn) TRN *trn)
{ {
int rc; int rc;
byte chunk0_header[1 + 2 + 5 + 2]; uchar chunk0_header[1 + 2 + 5 + 2];
DBUG_ENTER("translog_write_variable_record_1chunk"); DBUG_ENTER("translog_write_variable_record_1chunk");
translog_write_variable_record_1group_header(parts, type, short_trid, translog_write_variable_record_1group_header(parts, type, short_trid,
@ -3239,7 +3239,7 @@ translog_write_variable_record_1chunk(LSN *lsn,
NULL Error NULL Error
*/ */
static byte *translog_put_LSN_diff(LSN base_lsn, LSN lsn, byte *dst) static uchar *translog_put_LSN_diff(LSN base_lsn, LSN lsn, uchar *dst)
{ {
DBUG_ENTER("translog_put_LSN_diff"); DBUG_ENTER("translog_put_LSN_diff");
DBUG_PRINT("enter", ("Base: (0x%lu,0x%lx) val: (0x%lu,0x%lx) dst: 0x%lx", DBUG_PRINT("enter", ("Base: (0x%lu,0x%lx) val: (0x%lu,0x%lx) dst: 0x%lx",
@ -3257,7 +3257,7 @@ static byte *translog_put_LSN_diff(LSN base_lsn, LSN lsn, byte *dst)
{ {
dst-= 2; dst-= 2;
/* /*
Note we store this high byte first to ensure that first byte has Note we store this high uchar first to ensure that first uchar has
0 in the 3 upper bits. 0 in the 3 upper bits.
*/ */
dst[0]= diff >> 8; dst[0]= diff >> 8;
@ -3347,7 +3347,7 @@ static byte *translog_put_LSN_diff(LSN base_lsn, LSN lsn, byte *dst)
pointer to buffer after decoded LSN pointer to buffer after decoded LSN
*/ */
static byte *translog_get_LSN_from_diff(LSN base_lsn, byte *src, byte *dst) static uchar *translog_get_LSN_from_diff(LSN base_lsn, uchar *src, uchar *dst)
{ {
LSN lsn; LSN lsn;
uint32 diff; uint32 diff;
@ -3432,7 +3432,7 @@ static byte *translog_get_LSN_from_diff(LSN base_lsn, byte *src, byte *dst)
static my_bool translog_relative_LSN_encode(struct st_translog_parts *parts, static my_bool translog_relative_LSN_encode(struct st_translog_parts *parts,
LSN base_lsn, LSN base_lsn,
uint lsns, byte *compressed_LSNs) uint lsns, uchar *compressed_LSNs)
{ {
LEX_STRING *part; LEX_STRING *part;
uint lsns_len= lsns * LSN_STORE_SIZE; uint lsns_len= lsns * LSN_STORE_SIZE;
@ -3450,14 +3450,14 @@ static my_bool translog_relative_LSN_encode(struct st_translog_parts *parts,
uint copied= part->length; uint copied= part->length;
LEX_STRING *next_part; LEX_STRING *next_part;
DBUG_PRINT("info", ("Using buffer: 0x%lx", (ulong) compressed_LSNs)); DBUG_PRINT("info", ("Using buffer: 0x%lx", (ulong) compressed_LSNs));
memcpy(buffer, (byte*)part->str, part->length); memcpy(buffer, (uchar*)part->str, part->length);
next_part= parts->parts + parts->current + 1; next_part= parts->parts + parts->current + 1;
do do
{ {
DBUG_ASSERT(next_part < parts->parts + parts->elements); DBUG_ASSERT(next_part < parts->parts + parts->elements);
if ((next_part->length + copied) < lsns_len) if ((next_part->length + copied) < lsns_len)
{ {
memcpy(buffer + copied, (byte*)next_part->str, memcpy(buffer + copied, (uchar*)next_part->str,
next_part->length); next_part->length);
copied+= next_part->length; copied+= next_part->length;
next_part->length= 0; next_part->str= 0; next_part->length= 0; next_part->str= 0;
@ -3469,7 +3469,7 @@ static my_bool translog_relative_LSN_encode(struct st_translog_parts *parts,
else else
{ {
uint len= lsns_len - copied; uint len= lsns_len - copied;
memcpy(buffer + copied, (byte*)next_part->str, len); memcpy(buffer + copied, (uchar*)next_part->str, len);
copied= lsns_len; copied= lsns_len;
next_part->str+= len; next_part->str+= len;
next_part->length-= len; next_part->length-= len;
@ -3489,8 +3489,8 @@ static my_bool translog_relative_LSN_encode(struct st_translog_parts *parts,
/* Compress */ /* Compress */
LSN ref; LSN ref;
int economy; int economy;
byte *src_ptr; uchar *src_ptr;
byte *dst_ptr= compressed_LSNs + (MAX_NUMBER_OF_LSNS_PER_RECORD * uchar *dst_ptr= compressed_LSNs + (MAX_NUMBER_OF_LSNS_PER_RECORD *
COMPRESSED_LSN_MAX_STORE_SIZE); COMPRESSED_LSN_MAX_STORE_SIZE);
for (src_ptr= buffer + lsns_len - LSN_STORE_SIZE; for (src_ptr= buffer + lsns_len - LSN_STORE_SIZE;
src_ptr >= buffer; src_ptr >= buffer;
@ -3558,8 +3558,8 @@ translog_write_variable_record_mgroup(LSN *lsn,
uint16 page_capacity= log_descriptor.page_capacity_chunk_2 + 1; uint16 page_capacity= log_descriptor.page_capacity_chunk_2 + 1;
uint16 last_page_capacity; uint16 last_page_capacity;
my_bool new_page_before_chunk0= 1, first_chunk0= 1; my_bool new_page_before_chunk0= 1, first_chunk0= 1;
byte chunk0_header[1 + 2 + 5 + 2 + 2], group_desc[7 + 1]; uchar chunk0_header[1 + 2 + 5 + 2 + 2], group_desc[7 + 1];
byte chunk2_header[1]; uchar chunk2_header[1];
uint header_fixed_part= header_length + 2; uint header_fixed_part= header_length + 2;
uint groups_per_page= (page_capacity - header_fixed_part) / (7 + 1); uint groups_per_page= (page_capacity - header_fixed_part) / (7 + 1);
DBUG_ENTER("translog_write_variable_record_mgroup"); DBUG_ENTER("translog_write_variable_record_mgroup");
@ -3602,7 +3602,7 @@ translog_write_variable_record_mgroup(LSN *lsn,
But here we assign number of chunks - 1 But here we assign number of chunks - 1
*/ */
group.num= full_pages; group.num= full_pages;
if (insert_dynamic(&groups, (gptr) &group)) if (insert_dynamic(&groups, (uchar*) &group))
{ {
UNRECOVERABLE_ERROR(("insert into array failed")); UNRECOVERABLE_ERROR(("insert into array failed"));
goto err_unlock; goto err_unlock;
@ -3701,7 +3701,7 @@ translog_write_variable_record_mgroup(LSN *lsn,
cursor= log_descriptor.bc; cursor= log_descriptor.bc;
cursor.chaser= 1; cursor.chaser= 1;
group.num= 0; /* 0 because it does not matter */ group.num= 0; /* 0 because it does not matter */
if (insert_dynamic(&groups, (gptr) &group)) if (insert_dynamic(&groups, (uchar*) &group))
{ {
UNRECOVERABLE_ERROR(("insert into array failed")); UNRECOVERABLE_ERROR(("insert into array failed"));
goto err_unlock; goto err_unlock;
@ -3797,7 +3797,7 @@ translog_write_variable_record_mgroup(LSN *lsn,
{ {
DBUG_PRINT("info", ("chunk 3")); DBUG_PRINT("info", ("chunk 3"));
DBUG_ASSERT(full_pages == 0); DBUG_ASSERT(full_pages == 0);
byte chunk3_header[3]; uchar chunk3_header[3];
chunk3_pages= 0; chunk3_pages= 0;
chunk3_header[0]= TRANSLOG_CHUNK_LNGTH; chunk3_header[0]= TRANSLOG_CHUNK_LNGTH;
int2store(chunk3_header + 1, chunk3_size); int2store(chunk3_header + 1, chunk3_size);
@ -3846,7 +3846,7 @@ translog_write_variable_record_mgroup(LSN *lsn,
(ulong) LSN_OFFSET(horizon))); (ulong) LSN_OFFSET(horizon)));
*chunk0_header= (byte) (type |TRANSLOG_CHUNK_LSN); *chunk0_header= (uchar) (type |TRANSLOG_CHUNK_LSN);
int2store(chunk0_header + 1, short_trid); int2store(chunk0_header + 1, short_trid);
translog_write_variable_record_1group_code_len(chunk0_header + 3, translog_write_variable_record_1group_code_len(chunk0_header + 3,
parts->record_length, parts->record_length,
@ -3975,7 +3975,7 @@ static my_bool translog_write_variable_record(LSN *lsn,
ulong buffer_rest; ulong buffer_rest;
uint page_rest; uint page_rest;
/* Max number of such LSNs per record is 2 */ /* Max number of such LSNs per record is 2 */
byte compressed_LSNs[MAX_NUMBER_OF_LSNS_PER_RECORD * uchar compressed_LSNs[MAX_NUMBER_OF_LSNS_PER_RECORD *
COMPRESSED_LSN_MAX_STORE_SIZE]; COMPRESSED_LSN_MAX_STORE_SIZE];
DBUG_ENTER("translog_write_variable_record"); DBUG_ENTER("translog_write_variable_record");
@ -4001,7 +4001,7 @@ static my_bool translog_write_variable_record(LSN *lsn,
log_record_type_descriptor[type].read_header_len)); log_record_type_descriptor[type].read_header_len));
translog_page_next(&log_descriptor.horizon, &log_descriptor.bc, translog_page_next(&log_descriptor.horizon, &log_descriptor.bc,
&buffer_to_flush); &buffer_to_flush);
/* Chunk 2 header is 1 byte, so full page capacity will be one byte more */ /* Chunk 2 header is 1 byte, so full page capacity will be one uchar more */
page_rest= log_descriptor.page_capacity_chunk_2 + 1; page_rest= log_descriptor.page_capacity_chunk_2 + 1;
DBUG_PRINT("info", ("page_rest: %u", page_rest)); DBUG_PRINT("info", ("page_rest: %u", page_rest));
} }
@ -4087,9 +4087,9 @@ static my_bool translog_write_fixed_record(LSN *lsn,
TRN *trn) TRN *trn)
{ {
struct st_translog_buffer *buffer_to_flush= NULL; struct st_translog_buffer *buffer_to_flush= NULL;
byte chunk1_header[1 + 2]; uchar chunk1_header[1 + 2];
/* Max number of such LSNs per record is 2 */ /* Max number of such LSNs per record is 2 */
byte compressed_LSNs[MAX_NUMBER_OF_LSNS_PER_RECORD * uchar compressed_LSNs[MAX_NUMBER_OF_LSNS_PER_RECORD *
COMPRESSED_LSN_MAX_STORE_SIZE]; COMPRESSED_LSN_MAX_STORE_SIZE];
LEX_STRING *part; LEX_STRING *part;
int rc; int rc;
@ -4162,7 +4162,7 @@ static my_bool translog_write_fixed_record(LSN *lsn,
part= parts->parts + (--parts->current); part= parts->parts + (--parts->current);
parts->total_record_length+= (part->length= 1 + 2); parts->total_record_length+= (part->length= 1 + 2);
part->str= (char*)chunk1_header; part->str= (char*)chunk1_header;
*chunk1_header= (byte) (type | TRANSLOG_CHUNK_FIXED); *chunk1_header= (uchar) (type | TRANSLOG_CHUNK_FIXED);
int2store(chunk1_header + 1, short_trid); int2store(chunk1_header + 1, short_trid);
rc= translog_write_parts_on_page(&log_descriptor.horizon, rc= translog_write_parts_on_page(&log_descriptor.horizon,
@ -4364,8 +4364,8 @@ my_bool translog_write_record(LSN *lsn,
position in sources after decoded LSN(s) position in sources after decoded LSN(s)
*/ */
static byte *translog_relative_LSN_decode(LSN base_lsn, static uchar *translog_relative_LSN_decode(LSN base_lsn,
byte *src, byte *dst, uint lsns) uchar *src, uchar *dst, uint lsns)
{ {
uint i; uint i;
for (i= 0; i < lsns; i++, dst+= LSN_STORE_SIZE) for (i= 0; i < lsns; i++, dst+= LSN_STORE_SIZE)
@ -4391,15 +4391,15 @@ static byte *translog_relative_LSN_decode(LSN base_lsn,
part of the header part of the header
*/ */
translog_size_t translog_fixed_length_header(byte *page, translog_size_t translog_fixed_length_header(uchar *page,
translog_size_t page_offset, translog_size_t page_offset,
TRANSLOG_HEADER_BUFFER *buff) TRANSLOG_HEADER_BUFFER *buff)
{ {
struct st_log_record_type_descriptor *desc= struct st_log_record_type_descriptor *desc=
log_record_type_descriptor + buff->type; log_record_type_descriptor + buff->type;
byte *src= page + page_offset + 3; uchar *src= page + page_offset + 3;
byte *dst= buff->header; uchar *dst= buff->header;
byte *start= src; uchar *start= src;
uint lsns= desc->compressed_LSN; uint lsns= desc->compressed_LSN;
uint length= desc->fixed_length; uint length= desc->fixed_length;
@ -4439,7 +4439,7 @@ void translog_free_record_header(TRANSLOG_HEADER_BUFFER *buff)
DBUG_ENTER("translog_free_record_header"); DBUG_ENTER("translog_free_record_header");
if (buff->groups_no != 0) if (buff->groups_no != 0)
{ {
my_free((gptr) buff->groups, MYF(0)); my_free((uchar*) buff->groups, MYF(0));
buff->groups_no= 0; buff->groups_no= 0;
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -4719,7 +4719,7 @@ translog_get_next_chunk(TRANSLOG_SCANNER_DATA *scanner)
part of the header part of the header
*/ */
translog_size_t translog_variable_length_header(byte *page, translog_size_t translog_variable_length_header(uchar *page,
translog_size_t page_offset, translog_size_t page_offset,
TRANSLOG_HEADER_BUFFER *buff, TRANSLOG_HEADER_BUFFER *buff,
TRANSLOG_SCANNER_DATA TRANSLOG_SCANNER_DATA
@ -4727,8 +4727,8 @@ translog_size_t translog_variable_length_header(byte *page,
{ {
struct st_log_record_type_descriptor *desc= (log_record_type_descriptor + struct st_log_record_type_descriptor *desc= (log_record_type_descriptor +
buff->type); buff->type);
byte *src= page + page_offset + 1 + 2; uchar *src= page + page_offset + 1 + 2;
byte *dst= buff->header; uchar *dst= buff->header;
LSN base_lsn; LSN base_lsn;
uint lsns= desc->compressed_LSN; uint lsns= desc->compressed_LSN;
uint16 chunk_len; uint16 chunk_len;
@ -4848,7 +4848,7 @@ translog_size_t translog_variable_length_header(byte *page,
} }
if (lsns) if (lsns)
{ {
byte *start= src; uchar *start= src;
src= translog_relative_LSN_decode(base_lsn, src, dst, lsns); src= translog_relative_LSN_decode(base_lsn, src, dst, lsns);
lsns*= LSN_STORE_SIZE; lsns*= LSN_STORE_SIZE;
dst+= lsns; dst+= lsns;
@ -4890,7 +4890,7 @@ translog_size_t translog_variable_length_header(byte *page,
*/ */
translog_size_t translog_size_t
translog_read_record_header_from_buffer(byte *page, translog_read_record_header_from_buffer(uchar *page,
uint16 page_offset, uint16 page_offset,
TRANSLOG_HEADER_BUFFER *buff, TRANSLOG_HEADER_BUFFER *buff,
TRANSLOG_SCANNER_DATA *scanner) TRANSLOG_SCANNER_DATA *scanner)
@ -4946,7 +4946,7 @@ translog_read_record_header_from_buffer(byte *page,
translog_size_t translog_read_record_header(LSN lsn, translog_size_t translog_read_record_header(LSN lsn,
TRANSLOG_HEADER_BUFFER *buff) TRANSLOG_HEADER_BUFFER *buff)
{ {
byte buffer[TRANSLOG_PAGE_SIZE], *page; uchar buffer[TRANSLOG_PAGE_SIZE], *page;
translog_size_t page_offset= LSN_OFFSET(lsn) % TRANSLOG_PAGE_SIZE; translog_size_t page_offset= LSN_OFFSET(lsn) % TRANSLOG_PAGE_SIZE;
TRANSLOG_ADDRESS addr; TRANSLOG_ADDRESS addr;
TRANSLOG_VALIDATOR_DATA data; TRANSLOG_VALIDATOR_DATA data;
@ -5232,7 +5232,7 @@ static my_bool translog_init_reader_data(LSN lsn,
translog_size_t translog_read_record(LSN lsn, translog_size_t translog_read_record(LSN lsn,
translog_size_t offset, translog_size_t offset,
translog_size_t length, translog_size_t length,
byte *buffer, uchar *buffer,
struct st_translog_reader_data *data) struct st_translog_reader_data *data)
{ {
translog_size_t requested_length= length; translog_size_t requested_length= length;
@ -5331,7 +5331,7 @@ static void translog_force_current_buffer_to_finish()
struct st_translog_buffer *new_buffer= (log_descriptor.buffers + struct st_translog_buffer *new_buffer= (log_descriptor.buffers +
new_buffer_no); new_buffer_no);
struct st_translog_buffer *old_buffer= log_descriptor.bc.buffer; struct st_translog_buffer *old_buffer= log_descriptor.bc.buffer;
byte *data= log_descriptor.bc.ptr -log_descriptor.bc.current_page_fill; uchar *data= log_descriptor.bc.ptr -log_descriptor.bc.current_page_fill;
uint16 left= TRANSLOG_PAGE_SIZE - log_descriptor.bc.current_page_fill; uint16 left= TRANSLOG_PAGE_SIZE - log_descriptor.bc.current_page_fill;
uint16 current_page_fill, write_counter, previous_offset; uint16 current_page_fill, write_counter, previous_offset;
DBUG_ENTER("translog_force_current_buffer_to_finish"); DBUG_ENTER("translog_force_current_buffer_to_finish");

View File

@ -127,7 +127,7 @@ typedef struct st_translog_header_buffer
Buffer for write decoded header of the record (depend on the record Buffer for write decoded header of the record (depend on the record
type) type)
*/ */
byte header[TRANSLOG_RECORD_HEADER_MAX_SIZE]; uchar header[TRANSLOG_RECORD_HEADER_MAX_SIZE];
/* number of groups listed in */ /* number of groups listed in */
uint groups_no; uint groups_no;
/* in multi-group number of chunk0 pages (valid only if groups_no > 0) */ /* in multi-group number of chunk0 pages (valid only if groups_no > 0) */
@ -151,12 +151,12 @@ typedef struct st_translog_header_buffer
typedef struct st_translog_scanner_data typedef struct st_translog_scanner_data
{ {
byte buffer[TRANSLOG_PAGE_SIZE]; /* buffer for page content */ uchar buffer[TRANSLOG_PAGE_SIZE]; /* buffer for page content */
TRANSLOG_ADDRESS page_addr; /* current page address */ TRANSLOG_ADDRESS page_addr; /* current page address */
/* end of the log which we saw last time */ /* end of the log which we saw last time */
TRANSLOG_ADDRESS horizon; TRANSLOG_ADDRESS horizon;
TRANSLOG_ADDRESS last_file_page; /* Last page on in this file */ TRANSLOG_ADDRESS last_file_page; /* Last page on in this file */
byte *page; /* page content pointer */ uchar *page; /* page content pointer */
/* offset of the chunk in the page */ /* offset of the chunk in the page */
translog_size_t page_offset; translog_size_t page_offset;
/* set horizon only once at init */ /* set horizon only once at init */
@ -214,7 +214,7 @@ extern void translog_free_record_header(TRANSLOG_HEADER_BUFFER *buff);
extern translog_size_t translog_read_record(LSN lsn, extern translog_size_t translog_read_record(LSN lsn,
translog_size_t offset, translog_size_t offset,
translog_size_t length, translog_size_t length,
byte *buffer, uchar *buffer,
struct st_translog_reader_data struct st_translog_reader_data
*data); *data);

View File

@ -54,7 +54,7 @@ typedef TRANSLOG_ADDRESS LSN;
#define LSN_REPLACE_OFFSET(L, S) (LSN_FINE_NO_PART(L) | (S)) #define LSN_REPLACE_OFFSET(L, S) (LSN_FINE_NO_PART(L) | (S))
/* /*
an 8-byte type whose most significant byte is used for "flags"; 7 an 8-byte type whose most significant uchar is used for "flags"; 7
other bytes are a LSN. other bytes are a LSN.
*/ */
typedef LSN LSN_WITH_FLAGS; typedef LSN LSN_WITH_FLAGS;

View File

@ -38,7 +38,7 @@ static my_bool maria_scan_init_dummy(MARIA_HA *info);
static void maria_scan_end_dummy(MARIA_HA *info); static void maria_scan_end_dummy(MARIA_HA *info);
static my_bool maria_once_init_dummy(MARIA_SHARE *, File); static my_bool maria_once_init_dummy(MARIA_SHARE *, File);
static my_bool maria_once_end_dummy(MARIA_SHARE *); static my_bool maria_once_end_dummy(MARIA_SHARE *);
static byte *_ma_base_info_read(byte *ptr, MARIA_BASE_INFO *base); static uchar *_ma_base_info_read(uchar *ptr, MARIA_BASE_INFO *base);
#define get_next_element(to,pos,size) { memcpy((char*) to,pos,(size_t) size); \ #define get_next_element(to,pos,size) { memcpy((char*) to,pos,(size_t) size); \
pos+=size;} pos+=size;}
@ -97,7 +97,7 @@ static MARIA_HA *maria_clone_internal(MARIA_SHARE *share, int mode,
DBUG_ENTER("maria_clone_internal"); DBUG_ENTER("maria_clone_internal");
errpos= 0; errpos= 0;
bzero((byte*) &info,sizeof(info)); bzero((uchar*) &info,sizeof(info));
if (mode == O_RDWR && share->mode == O_RDONLY) if (mode == O_RDWR && share->mode == O_RDONLY)
{ {
@ -200,7 +200,7 @@ err:
switch (errpos) { switch (errpos) {
case 6: case 6:
(*share->end)(&info); (*share->end)(&info);
my_free((gptr) m_info,MYF(0)); my_free((uchar*) m_info,MYF(0));
/* fall through */ /* fall through */
case 5: case 5:
if (data_file < 0) if (data_file < 0)
@ -255,7 +255,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
kfile= -1; kfile= -1;
errpos= 0; errpos= 0;
head_length=sizeof(share_buff.state.header); head_length=sizeof(share_buff.state.header);
bzero((byte*) &info,sizeof(info)); bzero((uchar*) &info,sizeof(info));
my_realpath(name_buff, fn_format(org_name,name,"",MARIA_NAME_IEXT, my_realpath(name_buff, fn_format(org_name,name,"",MARIA_NAME_IEXT,
MY_UNPACK_FILENAME),MYF(0)); MY_UNPACK_FILENAME),MYF(0));
@ -263,7 +263,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
if (!(old_info=_ma_test_if_reopen(name_buff))) if (!(old_info=_ma_test_if_reopen(name_buff)))
{ {
share= &share_buff; share= &share_buff;
bzero((gptr) &share_buff,sizeof(share_buff)); bzero((uchar*) &share_buff,sizeof(share_buff));
share_buff.state.rec_per_key_part=rec_per_key_part; share_buff.state.rec_per_key_part=rec_per_key_part;
share_buff.state.key_root=key_root; share_buff.state.key_root=key_root;
share_buff.pagecache= multi_pagecache_search(name_buff, strlen(name_buff), share_buff.pagecache= multi_pagecache_search(name_buff, strlen(name_buff),
@ -290,8 +290,8 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
my_errno= HA_ERR_NOT_A_TABLE; my_errno= HA_ERR_NOT_A_TABLE;
goto err; goto err;
} }
if (memcmp((byte*) share->state.header.file_version, if (memcmp((uchar*) share->state.header.file_version,
(byte*) maria_file_magic, 4)) (uchar*) maria_file_magic, 4))
{ {
DBUG_PRINT("error",("Wrong header in %s",name_buff)); DBUG_PRINT("error",("Wrong header in %s",name_buff));
DBUG_DUMP("error_dump",(char*) share->state.header.file_version, DBUG_DUMP("error_dump",(char*) share->state.header.file_version,
@ -638,7 +638,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
(keys ? MARIA_INDEX_BLOCK_MARGIN * (keys ? MARIA_INDEX_BLOCK_MARGIN *
share->block_size * keys : 0)); share->block_size * keys : 0));
share->block_size= share->base.block_size; share->block_size= share->base.block_size;
my_afree((gptr) disk_cache); my_afree((uchar*) disk_cache);
_ma_setup_functions(share); _ma_setup_functions(share);
if ((*share->once_init)(share, info.dfile.file)) if ((*share->once_init)(share, info.dfile.file))
goto err; goto err;
@ -724,12 +724,12 @@ err:
(*share->once_end)(share); (*share->once_end)(share);
/* fall through */ /* fall through */
case 4: case 4:
my_free((gptr) share,MYF(0)); my_free((uchar*) share,MYF(0));
/* fall through */ /* fall through */
case 3: case 3:
/* fall through */ /* fall through */
case 2: case 2:
my_afree((gptr) disk_cache); my_afree((uchar*) disk_cache);
/* fall through */ /* fall through */
case 1: case 1:
VOID(my_close(kfile,MYF(0))); VOID(my_close(kfile,MYF(0)));
@ -748,13 +748,13 @@ err:
Reallocate a buffer, if the current buffer is not large enough Reallocate a buffer, if the current buffer is not large enough
*/ */
my_bool _ma_alloc_buffer(byte **old_addr, my_size_t *old_size, my_bool _ma_alloc_buffer(uchar **old_addr, size_t *old_size,
my_size_t new_size) size_t new_size)
{ {
if (*old_size < new_size) if (*old_size < new_size)
{ {
byte *addr; uchar *addr;
if (!(addr= (byte*) my_realloc((gptr) *old_addr, new_size, if (!(addr= (uchar*) my_realloc((uchar*) *old_addr, new_size,
MYF(MY_ALLOW_ZERO_PTR)))) MYF(MY_ALLOW_ZERO_PTR))))
return 1; return 1;
*old_addr= addr; *old_addr= addr;
@ -1002,7 +1002,7 @@ uint _ma_state_info_write(File file, MARIA_STATE_INFO *state, uint pWrite)
} }
byte *_ma_state_info_read(byte *ptr, MARIA_STATE_INFO *state) uchar *_ma_state_info_read(uchar *ptr, MARIA_STATE_INFO *state)
{ {
uint i,keys,key_parts; uint i,keys,key_parts;
memcpy_fixed(&state->header,ptr, sizeof(state->header)); memcpy_fixed(&state->header,ptr, sizeof(state->header));
@ -1120,7 +1120,7 @@ uint _ma_base_info_write(File file, MARIA_BASE_INFO *base)
} }
static byte *_ma_base_info_read(byte *ptr, MARIA_BASE_INFO *base) static uchar *_ma_base_info_read(uchar *ptr, MARIA_BASE_INFO *base)
{ {
base->keystart= mi_sizekorr(ptr); ptr+= 8; base->keystart= mi_sizekorr(ptr); ptr+= 8;
base->max_data_file_length= mi_sizekorr(ptr); ptr+= 8; base->max_data_file_length= mi_sizekorr(ptr); ptr+= 8;
@ -1268,7 +1268,7 @@ char *_ma_uniquedef_read(char *ptr, MARIA_UNIQUEDEF *def)
def->keysegs = mi_uint2korr(ptr); def->keysegs = mi_uint2korr(ptr);
def->key = ptr[2]; def->key = ptr[2];
def->null_are_equal=ptr[3]; def->null_are_equal=ptr[3];
return ptr+4; /* 1 extra byte */ return ptr+4; /* 1 extra uchar */
} }
/*************************************************************************** /***************************************************************************

View File

@ -44,14 +44,14 @@
{ bits-=(bit+1); break; } \ { bits-=(bit+1); break; } \
pos+= *pos pos+= *pos
/* Size in uint16 of a Huffman tree for byte compression of 256 byte values. */ /* Size in uint16 of a Huffman tree for uchar compression of 256 uchar values. */
#define OFFSET_TABLE_SIZE 512 #define OFFSET_TABLE_SIZE 512
static my_bool _ma_read_pack_info(MARIA_SHARE *share, File file, static my_bool _ma_read_pack_info(MARIA_SHARE *share, File file,
pbool fix_keys); pbool fix_keys);
static uint read_huff_table(MARIA_BIT_BUFF *bit_buff, static uint read_huff_table(MARIA_BIT_BUFF *bit_buff,
MARIA_DECODE_TREE *decode_tree, MARIA_DECODE_TREE *decode_tree,
uint16 **decode_table,byte **intervall_buff, uint16 **decode_table,uchar **intervall_buff,
uint16 *tmp_buff); uint16 *tmp_buff);
static void make_quick_table(uint16 *to_table,uint16 *decode_table, static void make_quick_table(uint16 *to_table,uint16 *decode_table,
uint *next_free,uint value,uint bits, uint *next_free,uint value,uint bits,
@ -63,49 +63,49 @@ static uint copy_decode_table(uint16 *to_pos,uint offset,
static uint find_longest_bitstream(uint16 *table, uint16 *end); static uint find_longest_bitstream(uint16 *table, uint16 *end);
static void (*get_unpack_function(MARIA_COLUMNDEF *rec))(MARIA_COLUMNDEF *field, static void (*get_unpack_function(MARIA_COLUMNDEF *rec))(MARIA_COLUMNDEF *field,
MARIA_BIT_BUFF *buff, MARIA_BIT_BUFF *buff,
byte *to, uchar *to,
byte *end); uchar *end);
static void uf_zerofill_skip_zero(MARIA_COLUMNDEF *rec, static void uf_zerofill_skip_zero(MARIA_COLUMNDEF *rec,
MARIA_BIT_BUFF *bit_buff, MARIA_BIT_BUFF *bit_buff,
byte *to,byte *end); uchar *to,uchar *end);
static void uf_skip_zero(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, static void uf_skip_zero(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
byte *to,byte *end); uchar *to,uchar *end);
static void uf_space_normal(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, static void uf_space_normal(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
byte *to,byte *end); uchar *to,uchar *end);
static void uf_space_endspace_selected(MARIA_COLUMNDEF *rec, static void uf_space_endspace_selected(MARIA_COLUMNDEF *rec,
MARIA_BIT_BUFF *bit_buff, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end); uchar *to, uchar *end);
static void uf_endspace_selected(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, static void uf_endspace_selected(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
byte *to,byte *end); uchar *to,uchar *end);
static void uf_space_endspace(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, static void uf_space_endspace(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
byte *to,byte *end); uchar *to,uchar *end);
static void uf_endspace(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, static void uf_endspace(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
byte *to,byte *end); uchar *to,uchar *end);
static void uf_space_prespace_selected(MARIA_COLUMNDEF *rec, static void uf_space_prespace_selected(MARIA_COLUMNDEF *rec,
MARIA_BIT_BUFF *bit_buff, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end); uchar *to, uchar *end);
static void uf_prespace_selected(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, static void uf_prespace_selected(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
byte *to,byte *end); uchar *to,uchar *end);
static void uf_space_prespace(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, static void uf_space_prespace(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
byte *to,byte *end); uchar *to,uchar *end);
static void uf_prespace(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, static void uf_prespace(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
byte *to,byte *end); uchar *to,uchar *end);
static void uf_zerofill_normal(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, static void uf_zerofill_normal(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
byte *to,byte *end); uchar *to,uchar *end);
static void uf_constant(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, static void uf_constant(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
byte *to,byte *end); uchar *to,uchar *end);
static void uf_intervall(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, static void uf_intervall(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
byte *to,byte *end); uchar *to,uchar *end);
static void uf_zero(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, static void uf_zero(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
byte *to,byte *end); uchar *to,uchar *end);
static void uf_blob(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, static void uf_blob(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end); uchar *to, uchar *end);
static void uf_varchar1(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, static void uf_varchar1(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end); uchar *to, uchar *end);
static void uf_varchar2(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, static void uf_varchar2(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end); uchar *to, uchar *end);
static void decode_bytes(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, static void decode_bytes(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
byte *to,byte *end); uchar *to,uchar *end);
static uint decode_pos(MARIA_BIT_BUFF *bit_buff, static uint decode_pos(MARIA_BIT_BUFF *bit_buff,
MARIA_DECODE_TREE *decode_tree); MARIA_DECODE_TREE *decode_tree);
static void init_bit_buffer(MARIA_BIT_BUFF *bit_buff,uchar *buffer, static void init_bit_buffer(MARIA_BIT_BUFF *bit_buff,uchar *buffer,
@ -118,8 +118,8 @@ static uint read_pack_length(uint version, const uchar *buf, ulong *length);
static uchar *_ma_mempack_get_block_info(MARIA_HA *maria, static uchar *_ma_mempack_get_block_info(MARIA_HA *maria,
MARIA_BIT_BUFF *bit_buff, MARIA_BIT_BUFF *bit_buff,
MARIA_BLOCK_INFO *info, MARIA_BLOCK_INFO *info,
byte **rec_buff_p, uchar **rec_buff_p,
my_size_t *rec_buff_size_p, size_t *rec_buff_size_p,
uchar *header); uchar *header);
#endif #endif
@ -154,8 +154,8 @@ my_bool _ma_once_end_pack_row(MARIA_SHARE *share)
{ {
if (share->decode_trees) if (share->decode_trees)
{ {
my_free((gptr) share->decode_trees,MYF(0)); my_free((uchar*) share->decode_trees,MYF(0));
my_free((gptr) share->decode_tables,MYF(0)); my_free((uchar*) share->decode_tables,MYF(0));
} }
return 0; return 0;
} }
@ -181,19 +181,19 @@ static my_bool _ma_read_pack_info(MARIA_SHARE *share, File file,
maria_quick_table_bits=MAX_QUICK_TABLE_BITS; maria_quick_table_bits=MAX_QUICK_TABLE_BITS;
my_errno=0; my_errno=0;
if (my_read(file,(byte*) header,sizeof(header),MYF(MY_NABP))) if (my_read(file,(uchar*) header,sizeof(header),MYF(MY_NABP)))
{ {
if (!my_errno) if (!my_errno)
my_errno=HA_ERR_END_OF_FILE; my_errno=HA_ERR_END_OF_FILE;
goto err0; goto err0;
} }
/* Only the first three bytes of magic number are independent of version. */ /* Only the first three bytes of magic number are independent of version. */
if (memcmp((byte*) header, (byte*) maria_pack_file_magic, 3)) if (memcmp((uchar*) header, (uchar*) maria_pack_file_magic, 3))
{ {
my_errno=HA_ERR_WRONG_IN_RECORD; my_errno=HA_ERR_WRONG_IN_RECORD;
goto err0; goto err0;
} }
share->pack.version= header[3]; /* fourth byte of magic number */ share->pack.version= header[3]; /* fourth uchar of magic number */
share->pack.header_length= uint4korr(header+4); share->pack.header_length= uint4korr(header+4);
share->min_pack_length=(uint) uint4korr(header+8); share->min_pack_length=(uint) uint4korr(header+8);
share->max_pack_length=(uint) uint4korr(header+12); share->max_pack_length=(uint) uint4korr(header+12);
@ -228,10 +228,10 @@ static my_bool _ma_read_pack_info(MARIA_SHARE *share, File file,
*/ */
if (!(share->decode_trees=(MARIA_DECODE_TREE*) if (!(share->decode_trees=(MARIA_DECODE_TREE*)
my_malloc((uint) (trees*sizeof(MARIA_DECODE_TREE)+ my_malloc((uint) (trees*sizeof(MARIA_DECODE_TREE)+
intervall_length*sizeof(byte)), intervall_length*sizeof(uchar)),
MYF(MY_WME)))) MYF(MY_WME))))
goto err0; goto err0;
intervall_buff=(byte*) (share->decode_trees+trees); intervall_buff=(uchar*) (share->decode_trees+trees);
/* /*
Memory segment #2: Memory segment #2:
@ -248,7 +248,7 @@ static my_bool _ma_read_pack_info(MARIA_SHARE *share, File file,
MYF(MY_WME | MY_ZEROFILL)))) MYF(MY_WME | MY_ZEROFILL))))
goto err1; goto err1;
tmp_buff=share->decode_tables+length; tmp_buff=share->decode_tables+length;
disk_cache=(byte*) (tmp_buff+OFFSET_TABLE_SIZE); disk_cache=(uchar*) (tmp_buff+OFFSET_TABLE_SIZE);
if (my_read(file,disk_cache, if (my_read(file,disk_cache,
(uint) (share->pack.header_length-sizeof(header)), (uint) (share->pack.header_length-sizeof(header)),
@ -284,8 +284,8 @@ static my_bool _ma_read_pack_info(MARIA_SHARE *share, File file,
goto err3; goto err3;
/* Reallocate the decoding tables to the used size. */ /* Reallocate the decoding tables to the used size. */
decode_table=(uint16*) decode_table=(uint16*)
my_realloc((gptr) share->decode_tables, my_realloc((uchar*) share->decode_tables,
(uint) ((byte*) decode_table - (byte*) share->decode_tables), (uint) ((uchar*) decode_table - (uchar*) share->decode_tables),
MYF(MY_HOLD_ON_ERROR)); MYF(MY_HOLD_ON_ERROR));
/* Fix the table addresses in the tree heads. */ /* Fix the table addresses in the tree heads. */
{ {
@ -325,9 +325,9 @@ static my_bool _ma_read_pack_info(MARIA_SHARE *share, File file,
err3: err3:
my_errno=HA_ERR_WRONG_IN_RECORD; my_errno=HA_ERR_WRONG_IN_RECORD;
err2: err2:
my_free((gptr) share->decode_tables,MYF(0)); my_free((uchar*) share->decode_tables,MYF(0));
err1: err1:
my_free((gptr) share->decode_trees,MYF(0)); my_free((uchar*) share->decode_trees,MYF(0));
err0: err0:
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -352,7 +352,7 @@ err0:
*/ */
static uint read_huff_table(MARIA_BIT_BUFF *bit_buff, static uint read_huff_table(MARIA_BIT_BUFF *bit_buff,
MARIA_DECODE_TREE *decode_tree, MARIA_DECODE_TREE *decode_tree,
uint16 **decode_table, byte **intervall_buff, uint16 **decode_table, uchar **intervall_buff,
uint16 *tmp_buff) uint16 *tmp_buff)
{ {
uint min_chr,elements,char_bits,offset_bits,size,intervall_length,table_bits, uint min_chr,elements,char_bits,offset_bits,size,intervall_length,table_bits,
@ -371,7 +371,7 @@ static uint read_huff_table(MARIA_BIT_BUFF *bit_buff,
ptr=tmp_buff; ptr=tmp_buff;
ptr=tmp_buff; ptr=tmp_buff;
DBUG_PRINT("info", ("byte value compression")); DBUG_PRINT("info", ("byte value compression"));
DBUG_PRINT("info", ("minimum byte value: %u", min_chr)); DBUG_PRINT("info", ("minimum uchar value: %u", min_chr));
DBUG_PRINT("info", ("number of tree nodes: %u", elements)); DBUG_PRINT("info", ("number of tree nodes: %u", elements));
DBUG_PRINT("info", ("bits for values: %u", char_bits)); DBUG_PRINT("info", ("bits for values: %u", char_bits));
DBUG_PRINT("info", ("bits for tree offsets: %u", offset_bits)); DBUG_PRINT("info", ("bits for tree offsets: %u", offset_bits));
@ -477,13 +477,13 @@ static uint read_huff_table(MARIA_BIT_BUFF *bit_buff,
In most cases table_bits is 9. So there are 512 16-bit values. In most cases table_bits is 9. So there are 512 16-bit values.
If the high-order bit (16) is set (IS_CHAR) then the array slot for If the high-order bit (16) is set (IS_CHAR) then the array slot for
this value is a valid Huffman code for a resulting byte value. this value is a valid Huffman code for a resulting uchar value.
The low-order 8 bits (1..8) are the resulting byte value. The low-order 8 bits (1..8) are the resulting uchar value.
Bits 9..14 are the length of the Huffman code for this byte value. Bits 9..14 are the length of the Huffman code for this uchar value.
This means so many bits from the input stream were needed to This means so many bits from the input stream were needed to
represent this byte value. The remaining bits belong to later represent this uchar value. The remaining bits belong to later
Huffman codes. This also means that for every Huffman code shorter Huffman codes. This also means that for every Huffman code shorter
than table_bits there are multiple entires in the array, which than table_bits there are multiple entires in the array, which
differ just in the unused bits. differ just in the unused bits.
@ -570,7 +570,7 @@ static void make_quick_table(uint16 *to_table, uint16 *decode_table,
table Target quick_table position. table Target quick_table position.
bits Unused bits from max_bits. bits Unused bits from max_bits.
max_bits Total number of bits to collect (table_bits). max_bits Total number of bits to collect (table_bits).
value The byte encoded by the found Huffman code. value The uchar encoded by the found Huffman code.
DESCRIPTION DESCRIPTION
@ -593,8 +593,8 @@ static void fill_quick_table(uint16 *table, uint bits, uint max_bits,
DBUG_ENTER("fill_quick_table"); DBUG_ENTER("fill_quick_table");
/* /*
Bits 1..8 of value represent the decoded byte value. Bits 1..8 of value represent the decoded uchar value.
Bits 9..14 become the length of the Huffman code for this byte value. Bits 9..14 become the length of the Huffman code for this uchar value.
Bit 16 flags a valid code (IS_CHAR). Bit 16 flags a valid code (IS_CHAR).
*/ */
value|= (max_bits - bits) << 8 | IS_CHAR; value|= (max_bits - bits) << 8 | IS_CHAR;
@ -639,7 +639,7 @@ static uint copy_decode_table(uint16 *to_pos, uint offset,
} }
else else
{ {
/* Copy the byte value. */ /* Copy the uchar value. */
to_pos[offset]= *decode_table; to_pos[offset]= *decode_table;
/* Step behind this node. */ /* Step behind this node. */
offset+=2; offset+=2;
@ -656,7 +656,7 @@ static uint copy_decode_table(uint16 *to_pos, uint offset,
} }
else else
{ {
/* Copy the byte value. */ /* Copy the uchar value. */
to_pos[prev_offset+1]= *decode_table; to_pos[prev_offset+1]= *decode_table;
} }
DBUG_RETURN(offset); DBUG_RETURN(offset);
@ -674,7 +674,7 @@ static uint copy_decode_table(uint16 *to_pos, uint offset,
IMPLEMENTATION IMPLEMENTATION
Recursively follow the branch(es) of the code pair on every level of Recursively follow the branch(es) of the code pair on every level of
the tree until two byte values (and no branch) are found. Add one to the tree until two uchar values (and no branch) are found. Add one to
each level when returning back from each recursion stage. each level when returning back from each recursion stage.
'end' is used for error checking only. A clean tree terminates 'end' is used for error checking only. A clean tree terminates
@ -731,7 +731,7 @@ static uint find_longest_bitstream(uint16 *table, uint16 *end)
HA_ERR_WRONG_IN_RECORD or -1 on error HA_ERR_WRONG_IN_RECORD or -1 on error
*/ */
int _ma_read_pack_record(MARIA_HA *info, byte *buf, MARIA_RECORD_POS filepos) int _ma_read_pack_record(MARIA_HA *info, uchar *buf, MARIA_RECORD_POS filepos)
{ {
MARIA_BLOCK_INFO block_info; MARIA_BLOCK_INFO block_info;
File file; File file;
@ -745,7 +745,7 @@ int _ma_read_pack_record(MARIA_HA *info, byte *buf, MARIA_RECORD_POS filepos)
&info->rec_buff, &info->rec_buff_size, file, &info->rec_buff, &info->rec_buff_size, file,
filepos)) filepos))
goto err; goto err;
if (my_read(file,(byte*) info->rec_buff + block_info.offset , if (my_read(file,(uchar*) info->rec_buff + block_info.offset ,
block_info.rec_len - block_info.offset, MYF(MY_NABP))) block_info.rec_len - block_info.offset, MYF(MY_NABP)))
goto panic; goto panic;
info->update|= HA_STATE_AKTIV; info->update|= HA_STATE_AKTIV;
@ -760,9 +760,9 @@ err:
int _ma_pack_rec_unpack(register MARIA_HA *info, MARIA_BIT_BUFF *bit_buff, int _ma_pack_rec_unpack(register MARIA_HA *info, MARIA_BIT_BUFF *bit_buff,
register byte *to, byte *from, ulong reclength) register uchar *to, uchar *from, ulong reclength)
{ {
byte *end_field; uchar *end_field;
reg3 MARIA_COLUMNDEF *end; reg3 MARIA_COLUMNDEF *end;
MARIA_COLUMNDEF *current_field; MARIA_COLUMNDEF *current_field;
MARIA_SHARE *share=info->s; MARIA_SHARE *share=info->s;
@ -794,7 +794,7 @@ int _ma_pack_rec_unpack(register MARIA_HA *info, MARIA_BIT_BUFF *bit_buff,
/* Return function to unpack field */ /* Return function to unpack field */
static void (*get_unpack_function(MARIA_COLUMNDEF *rec)) static void (*get_unpack_function(MARIA_COLUMNDEF *rec))
(MARIA_COLUMNDEF *, MARIA_BIT_BUFF *, byte *, byte *) (MARIA_COLUMNDEF *, MARIA_BIT_BUFF *, uchar *, uchar *)
{ {
switch (rec->base_type) { switch (rec->base_type) {
case FIELD_SKIP_ZERO: case FIELD_SKIP_ZERO:
@ -837,7 +837,7 @@ static void (*get_unpack_function(MARIA_COLUMNDEF *rec))
case FIELD_BLOB: case FIELD_BLOB:
return &uf_blob; return &uf_blob;
case FIELD_VARCHAR: case FIELD_VARCHAR:
if (rec->length <= 256) /* 255 + 1 byte length */ if (rec->length <= 256) /* 255 + 1 uchar length */
return &uf_varchar1; return &uf_varchar1;
return &uf_varchar2; return &uf_varchar2;
case FIELD_LAST: case FIELD_LAST:
@ -850,7 +850,7 @@ static void (*get_unpack_function(MARIA_COLUMNDEF *rec))
static void uf_zerofill_skip_zero(MARIA_COLUMNDEF *rec, static void uf_zerofill_skip_zero(MARIA_COLUMNDEF *rec,
MARIA_BIT_BUFF *bit_buff, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end) uchar *to, uchar *end)
{ {
if (get_bit(bit_buff)) if (get_bit(bit_buff))
bzero((char*) to,(uint) (end-to)); bzero((char*) to,(uint) (end-to));
@ -863,7 +863,7 @@ static void uf_zerofill_skip_zero(MARIA_COLUMNDEF *rec,
} }
static void uf_skip_zero(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, static void uf_skip_zero(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end) uchar *to, uchar *end)
{ {
if (get_bit(bit_buff)) if (get_bit(bit_buff))
bzero((char*) to,(uint) (end-to)); bzero((char*) to,(uint) (end-to));
@ -872,21 +872,21 @@ static void uf_skip_zero(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
} }
static void uf_space_normal(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, static void uf_space_normal(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end) uchar *to, uchar *end)
{ {
if (get_bit(bit_buff)) if (get_bit(bit_buff))
bfill((byte*) to,(end-to),' '); bfill((uchar*) to,(end-to),' ');
else else
decode_bytes(rec,bit_buff,to,end); decode_bytes(rec,bit_buff,to,end);
} }
static void uf_space_endspace_selected(MARIA_COLUMNDEF *rec, static void uf_space_endspace_selected(MARIA_COLUMNDEF *rec,
MARIA_BIT_BUFF *bit_buff, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end) uchar *to, uchar *end)
{ {
uint spaces; uint spaces;
if (get_bit(bit_buff)) if (get_bit(bit_buff))
bfill((byte*) to,(end-to),' '); bfill((uchar*) to,(end-to),' ');
else else
{ {
if (get_bit(bit_buff)) if (get_bit(bit_buff))
@ -898,7 +898,7 @@ static void uf_space_endspace_selected(MARIA_COLUMNDEF *rec,
} }
if (to+spaces != end) if (to+spaces != end)
decode_bytes(rec,bit_buff,to,end-spaces); decode_bytes(rec,bit_buff,to,end-spaces);
bfill((byte*) end-spaces,spaces,' '); bfill((uchar*) end-spaces,spaces,' ');
} }
else else
decode_bytes(rec,bit_buff,to,end); decode_bytes(rec,bit_buff,to,end);
@ -907,7 +907,7 @@ static void uf_space_endspace_selected(MARIA_COLUMNDEF *rec,
static void uf_endspace_selected(MARIA_COLUMNDEF *rec, static void uf_endspace_selected(MARIA_COLUMNDEF *rec,
MARIA_BIT_BUFF *bit_buff, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end) uchar *to, uchar *end)
{ {
uint spaces; uint spaces;
if (get_bit(bit_buff)) if (get_bit(bit_buff))
@ -919,18 +919,18 @@ static void uf_endspace_selected(MARIA_COLUMNDEF *rec,
} }
if (to+spaces != end) if (to+spaces != end)
decode_bytes(rec,bit_buff,to,end-spaces); decode_bytes(rec,bit_buff,to,end-spaces);
bfill((byte*) end-spaces,spaces,' '); bfill((uchar*) end-spaces,spaces,' ');
} }
else else
decode_bytes(rec,bit_buff,to,end); decode_bytes(rec,bit_buff,to,end);
} }
static void uf_space_endspace(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, static void uf_space_endspace(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end) uchar *to, uchar *end)
{ {
uint spaces; uint spaces;
if (get_bit(bit_buff)) if (get_bit(bit_buff))
bfill((byte*) to,(end-to),' '); bfill((uchar*) to,(end-to),' ');
else else
{ {
if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end) if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end)
@ -940,12 +940,12 @@ static void uf_space_endspace(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
} }
if (to+spaces != end) if (to+spaces != end)
decode_bytes(rec,bit_buff,to,end-spaces); decode_bytes(rec,bit_buff,to,end-spaces);
bfill((byte*) end-spaces,spaces,' '); bfill((uchar*) end-spaces,spaces,' ');
} }
} }
static void uf_endspace(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, static void uf_endspace(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end) uchar *to, uchar *end)
{ {
uint spaces; uint spaces;
if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end) if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end)
@ -955,16 +955,16 @@ static void uf_endspace(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
} }
if (to+spaces != end) if (to+spaces != end)
decode_bytes(rec,bit_buff,to,end-spaces); decode_bytes(rec,bit_buff,to,end-spaces);
bfill((byte*) end-spaces,spaces,' '); bfill((uchar*) end-spaces,spaces,' ');
} }
static void uf_space_prespace_selected(MARIA_COLUMNDEF *rec, static void uf_space_prespace_selected(MARIA_COLUMNDEF *rec,
MARIA_BIT_BUFF *bit_buff, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end) uchar *to, uchar *end)
{ {
uint spaces; uint spaces;
if (get_bit(bit_buff)) if (get_bit(bit_buff))
bfill((byte*) to,(end-to),' '); bfill((uchar*) to,(end-to),' ');
else else
{ {
if (get_bit(bit_buff)) if (get_bit(bit_buff))
@ -974,7 +974,7 @@ static void uf_space_prespace_selected(MARIA_COLUMNDEF *rec,
bit_buff->error=1; bit_buff->error=1;
return; return;
} }
bfill((byte*) to,spaces,' '); bfill((uchar*) to,spaces,' ');
if (to+spaces != end) if (to+spaces != end)
decode_bytes(rec,bit_buff,to+spaces,end); decode_bytes(rec,bit_buff,to+spaces,end);
} }
@ -986,7 +986,7 @@ static void uf_space_prespace_selected(MARIA_COLUMNDEF *rec,
static void uf_prespace_selected(MARIA_COLUMNDEF *rec, static void uf_prespace_selected(MARIA_COLUMNDEF *rec,
MARIA_BIT_BUFF *bit_buff, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end) uchar *to, uchar *end)
{ {
uint spaces; uint spaces;
if (get_bit(bit_buff)) if (get_bit(bit_buff))
@ -996,7 +996,7 @@ static void uf_prespace_selected(MARIA_COLUMNDEF *rec,
bit_buff->error=1; bit_buff->error=1;
return; return;
} }
bfill((byte*) to,spaces,' '); bfill((uchar*) to,spaces,' ');
if (to+spaces != end) if (to+spaces != end)
decode_bytes(rec,bit_buff,to+spaces,end); decode_bytes(rec,bit_buff,to+spaces,end);
} }
@ -1006,11 +1006,11 @@ static void uf_prespace_selected(MARIA_COLUMNDEF *rec,
static void uf_space_prespace(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, static void uf_space_prespace(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end) uchar *to, uchar *end)
{ {
uint spaces; uint spaces;
if (get_bit(bit_buff)) if (get_bit(bit_buff))
bfill((byte*) to,(end-to),' '); bfill((uchar*) to,(end-to),' ');
else else
{ {
if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end) if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end)
@ -1018,14 +1018,14 @@ static void uf_space_prespace(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
bit_buff->error=1; bit_buff->error=1;
return; return;
} }
bfill((byte*) to,spaces,' '); bfill((uchar*) to,spaces,' ');
if (to+spaces != end) if (to+spaces != end)
decode_bytes(rec,bit_buff,to+spaces,end); decode_bytes(rec,bit_buff,to+spaces,end);
} }
} }
static void uf_prespace(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, static void uf_prespace(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end) uchar *to, uchar *end)
{ {
uint spaces; uint spaces;
if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end) if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end)
@ -1033,13 +1033,13 @@ static void uf_prespace(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
bit_buff->error=1; bit_buff->error=1;
return; return;
} }
bfill((byte*) to,spaces,' '); bfill((uchar*) to,spaces,' ');
if (to+spaces != end) if (to+spaces != end)
decode_bytes(rec,bit_buff,to+spaces,end); decode_bytes(rec,bit_buff,to+spaces,end);
} }
static void uf_zerofill_normal(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, static void uf_zerofill_normal(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end) uchar *to, uchar *end)
{ {
end-=rec->space_length_bits; end-=rec->space_length_bits;
decode_bytes(rec,bit_buff, to, end); decode_bytes(rec,bit_buff, to, end);
@ -1048,14 +1048,14 @@ static void uf_zerofill_normal(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
static void uf_constant(MARIA_COLUMNDEF *rec, static void uf_constant(MARIA_COLUMNDEF *rec,
MARIA_BIT_BUFF *bit_buff __attribute__((unused)), MARIA_BIT_BUFF *bit_buff __attribute__((unused)),
byte *to, byte *end) uchar *to, uchar *end)
{ {
memcpy(to,rec->huff_tree->intervalls,(size_t) (end-to)); memcpy(to,rec->huff_tree->intervalls,(size_t) (end-to));
} }
static void uf_intervall(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, static void uf_intervall(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
byte *to, uchar *to,
byte *end) uchar *end)
{ {
reg1 uint field_length=(uint) (end-to); reg1 uint field_length=(uint) (end-to);
memcpy(to,rec->huff_tree->intervalls+field_length*decode_pos(bit_buff, memcpy(to,rec->huff_tree->intervalls+field_length*decode_pos(bit_buff,
@ -1067,13 +1067,13 @@ static void uf_intervall(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
/*ARGSUSED*/ /*ARGSUSED*/
static void uf_zero(MARIA_COLUMNDEF *rec __attribute__((unused)), static void uf_zero(MARIA_COLUMNDEF *rec __attribute__((unused)),
MARIA_BIT_BUFF *bit_buff __attribute__((unused)), MARIA_BIT_BUFF *bit_buff __attribute__((unused)),
byte *to, byte *end) uchar *to, uchar *end)
{ {
bzero(to, (uint) (end-to)); bzero(to, (uint) (end-to));
} }
static void uf_blob(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, static void uf_blob(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end) uchar *to, uchar *end)
{ {
if (get_bit(bit_buff)) if (get_bit(bit_buff))
bzero(to, (uint) (end-to)); bzero(to, (uint) (end-to));
@ -1084,12 +1084,12 @@ static void uf_blob(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
if (bit_buff->blob_pos+length > bit_buff->blob_end) if (bit_buff->blob_pos+length > bit_buff->blob_end)
{ {
bit_buff->error=1; bit_buff->error=1;
bzero((byte*) to,(end-to)); bzero((uchar*) to,(end-to));
return; return;
} }
decode_bytes(rec,bit_buff,(byte*) bit_buff->blob_pos, decode_bytes(rec,bit_buff,(uchar*) bit_buff->blob_pos,
(byte*) bit_buff->blob_pos+length); (uchar*) bit_buff->blob_pos+length);
_ma_store_blob_length((byte*) to,pack_length,length); _ma_store_blob_length((uchar*) to,pack_length,length);
memcpy_fixed((char*) to+pack_length,(char*) &bit_buff->blob_pos, memcpy_fixed((char*) to+pack_length,(char*) &bit_buff->blob_pos,
sizeof(char*)); sizeof(char*));
bit_buff->blob_pos+=length; bit_buff->blob_pos+=length;
@ -1098,7 +1098,7 @@ static void uf_blob(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
static void uf_varchar1(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, static void uf_varchar1(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end __attribute__((unused))) uchar *to, uchar *end __attribute__((unused)))
{ {
if (get_bit(bit_buff)) if (get_bit(bit_buff))
to[0]= 0; /* Zero lengths */ to[0]= 0; /* Zero lengths */
@ -1112,7 +1112,7 @@ static void uf_varchar1(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
static void uf_varchar2(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, static void uf_varchar2(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end __attribute__((unused))) uchar *to, uchar *end __attribute__((unused)))
{ {
if (get_bit(bit_buff)) if (get_bit(bit_buff))
to[0]=to[1]=0; /* Zero lengths */ to[0]=to[1]=0; /* Zero lengths */
@ -1129,7 +1129,7 @@ static void uf_varchar2(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
#if BITS_SAVED == 64 #if BITS_SAVED == 64
static void decode_bytes(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, static void decode_bytes(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end) uchar *to, uchar *end)
{ {
reg1 uint bits,low_byte; reg1 uint bits,low_byte;
reg3 uint16 *pos; reg3 uint16 *pos;
@ -1166,13 +1166,13 @@ static void decode_bytes(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
In most cases table_bits is 9. So there are 512 16-bit values. In most cases table_bits is 9. So there are 512 16-bit values.
If the high-order bit (16) is set (IS_CHAR) then the array slot If the high-order bit (16) is set (IS_CHAR) then the array slot
for this value is a valid Huffman code for a resulting byte value. for this value is a valid Huffman code for a resulting uchar value.
The low-order 8 bits (1..8) are the resulting byte value. The low-order 8 bits (1..8) are the resulting uchar value.
Bits 9..14 are the length of the Huffman code for this byte value. Bits 9..14 are the length of the Huffman code for this uchar value.
This means so many bits from the input stream were needed to This means so many bits from the input stream were needed to
represent this byte value. The remaining bits belong to later represent this uchar value. The remaining bits belong to later
Huffman codes. This also means that for every Huffman code shorter Huffman codes. This also means that for every Huffman code shorter
than table_bits there are multiple entires in the array, which than table_bits there are multiple entires in the array, which
differ just in the unused bits. differ just in the unused bits.
@ -1222,7 +1222,7 @@ static void decode_bytes(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
#else #else
static void decode_bytes(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, static void decode_bytes(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *end) uchar *to, uchar *end)
{ {
reg1 uint bits,low_byte; reg1 uint bits,low_byte;
reg3 uint16 *pos; reg3 uint16 *pos;
@ -1334,7 +1334,7 @@ static uint decode_pos(MARIA_BIT_BUFF *bit_buff,
int _ma_read_rnd_pack_record(MARIA_HA *info, int _ma_read_rnd_pack_record(MARIA_HA *info,
byte *buf, uchar *buf,
register MARIA_RECORD_POS filepos, register MARIA_RECORD_POS filepos,
my_bool skip_deleted_blocks) my_bool skip_deleted_blocks)
{ {
@ -1352,7 +1352,7 @@ int _ma_read_rnd_pack_record(MARIA_HA *info,
file= info->dfile.file; file= info->dfile.file;
if (info->opt_flag & READ_CACHE_USED) if (info->opt_flag & READ_CACHE_USED)
{ {
if (_ma_read_cache(&info->rec_cache, (byte*) block_info.header, if (_ma_read_cache(&info->rec_cache, (uchar*) block_info.header,
filepos, share->pack.ref_length, filepos, share->pack.ref_length,
skip_deleted_blocks ? READING_NEXT : 0)) skip_deleted_blocks ? READING_NEXT : 0))
goto err; goto err;
@ -1372,14 +1372,14 @@ int _ma_read_rnd_pack_record(MARIA_HA *info,
if (info->opt_flag & READ_CACHE_USED) if (info->opt_flag & READ_CACHE_USED)
{ {
if (_ma_read_cache(&info->rec_cache, (byte*) info->rec_buff, if (_ma_read_cache(&info->rec_cache, (uchar*) info->rec_buff,
block_info.filepos, block_info.rec_len, block_info.filepos, block_info.rec_len,
skip_deleted_blocks ? READING_NEXT : 0)) skip_deleted_blocks ? READING_NEXT : 0))
goto err; goto err;
} }
else else
{ {
if (my_read(info->dfile.file, (byte*)info->rec_buff + block_info.offset, if (my_read(info->dfile.file, (uchar*)info->rec_buff + block_info.offset,
block_info.rec_len-block_info.offset, block_info.rec_len-block_info.offset,
MYF(MY_NABP))) MYF(MY_NABP)))
goto err; goto err;
@ -1400,7 +1400,7 @@ int _ma_read_rnd_pack_record(MARIA_HA *info,
uint _ma_pack_get_block_info(MARIA_HA *maria, MARIA_BIT_BUFF *bit_buff, uint _ma_pack_get_block_info(MARIA_HA *maria, MARIA_BIT_BUFF *bit_buff,
MARIA_BLOCK_INFO *info, MARIA_BLOCK_INFO *info,
byte **rec_buff_p, my_size_t *rec_buff_size_p, uchar **rec_buff_p, size_t *rec_buff_size_p,
File file, my_off_t filepos) File file, my_off_t filepos)
{ {
uchar *header= info->header; uchar *header= info->header;
@ -1417,7 +1417,7 @@ uint _ma_pack_get_block_info(MARIA_HA *maria, MARIA_BIT_BUFF *bit_buff,
VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0))); VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
if (my_read(file,(char*) header,ref_length,MYF(MY_NABP))) if (my_read(file,(char*) header,ref_length,MYF(MY_NABP)))
return BLOCK_FATAL_ERROR; return BLOCK_FATAL_ERROR;
DBUG_DUMP("header",(byte*) header,ref_length); DBUG_DUMP("header",(uchar*) header,ref_length);
} }
head_length= read_pack_length((uint) maria->s->pack.version, header, head_length= read_pack_length((uint) maria->s->pack.version, header,
&info->rec_len); &info->rec_len);
@ -1449,7 +1449,7 @@ uint _ma_pack_get_block_info(MARIA_HA *maria, MARIA_BIT_BUFF *bit_buff,
/* rutines for bit buffer */ /* rutines for bit buffer */
/* Note buffer must be 6 byte bigger than longest row */ /* Note buffer must be 6 uchar bigger than longest row */
static void init_bit_buffer(MARIA_BIT_BUFF *bit_buff, uchar *buffer, static void init_bit_buffer(MARIA_BIT_BUFF *bit_buff, uchar *buffer,
uint length) uint length)
@ -1528,9 +1528,9 @@ static uint max_bit(register uint value)
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
static int _ma_read_mempack_record(MARIA_HA *info, byte *buf, static int _ma_read_mempack_record(MARIA_HA *info, uchar *buf,
MARIA_RECORD_POS filepos); MARIA_RECORD_POS filepos);
static int _ma_read_rnd_mempack_record(MARIA_HA*, byte *, MARIA_RECORD_POS, static int _ma_read_rnd_mempack_record(MARIA_HA*, uchar *, MARIA_RECORD_POS,
my_bool); my_bool);
my_bool _ma_memmap_file(MARIA_HA *info) my_bool _ma_memmap_file(MARIA_HA *info)
@ -1567,8 +1567,8 @@ static uchar *
_ma_mempack_get_block_info(MARIA_HA *maria, _ma_mempack_get_block_info(MARIA_HA *maria,
MARIA_BIT_BUFF *bit_buff, MARIA_BIT_BUFF *bit_buff,
MARIA_BLOCK_INFO *info, MARIA_BLOCK_INFO *info,
byte **rec_buff_p, uchar **rec_buff_p,
my_size_t *rec_buff_size_p, size_t *rec_buff_size_p,
uchar *header) uchar *header)
{ {
header+= read_pack_length((uint) maria->s->pack.version, header, header+= read_pack_length((uint) maria->s->pack.version, header,
@ -1588,18 +1588,18 @@ _ma_mempack_get_block_info(MARIA_HA *maria,
} }
static int _ma_read_mempack_record(MARIA_HA *info, byte *buf, static int _ma_read_mempack_record(MARIA_HA *info, uchar *buf,
MARIA_RECORD_POS filepos) MARIA_RECORD_POS filepos)
{ {
MARIA_BLOCK_INFO block_info; MARIA_BLOCK_INFO block_info;
MARIA_SHARE *share=info->s; MARIA_SHARE *share=info->s;
byte *pos; uchar *pos;
DBUG_ENTER("maria_read_mempack_record"); DBUG_ENTER("maria_read_mempack_record");
if (filepos == HA_OFFSET_ERROR) if (filepos == HA_OFFSET_ERROR)
DBUG_RETURN(-1); /* _search() didn't find record */ DBUG_RETURN(-1); /* _search() didn't find record */
if (!(pos= (byte*) _ma_mempack_get_block_info(info, &info->bit_buff, if (!(pos= (uchar*) _ma_mempack_get_block_info(info, &info->bit_buff,
&block_info, &info->rec_buff, &block_info, &info->rec_buff,
&info->rec_buff_size, &info->rec_buff_size,
(uchar*) share->file_map+ (uchar*) share->file_map+
@ -1612,14 +1612,14 @@ static int _ma_read_mempack_record(MARIA_HA *info, byte *buf,
/*ARGSUSED*/ /*ARGSUSED*/
static int _ma_read_rnd_mempack_record(MARIA_HA *info, static int _ma_read_rnd_mempack_record(MARIA_HA *info,
byte *buf, uchar *buf,
register MARIA_RECORD_POS filepos, register MARIA_RECORD_POS filepos,
my_bool skip_deleted_blocks my_bool skip_deleted_blocks
__attribute__((unused))) __attribute__((unused)))
{ {
MARIA_BLOCK_INFO block_info; MARIA_BLOCK_INFO block_info;
MARIA_SHARE *share=info->s; MARIA_SHARE *share=info->s;
byte *pos,*start; uchar *pos,*start;
DBUG_ENTER("_ma_read_rnd_mempack_record"); DBUG_ENTER("_ma_read_rnd_mempack_record");
if (filepos >= share->state.state.data_file_length) if (filepos >= share->state.state.data_file_length)
@ -1627,7 +1627,7 @@ static int _ma_read_rnd_mempack_record(MARIA_HA *info,
my_errno=HA_ERR_END_OF_FILE; my_errno=HA_ERR_END_OF_FILE;
goto err; goto err;
} }
if (!(pos= (byte*) _ma_mempack_get_block_info(info, &info->bit_buff, if (!(pos= (uchar*) _ma_mempack_get_block_info(info, &info->bit_buff,
&block_info, &block_info,
&info->rec_buff, &info->rec_buff,
&info->rec_buff_size, &info->rec_buff_size,
@ -1657,7 +1657,7 @@ static int _ma_read_rnd_mempack_record(MARIA_HA *info,
/* Save length of row */ /* Save length of row */
uint _ma_save_pack_length(uint version, byte *block_buff, ulong length) uint _ma_save_pack_length(uint version, uchar *block_buff, ulong length)
{ {
if (length < 254) if (length < 254)
{ {

View File

@ -19,12 +19,12 @@
/* Fetch a key-page in memory */ /* Fetch a key-page in memory */
byte *_ma_fetch_keypage(register MARIA_HA *info, MARIA_KEYDEF *keyinfo, uchar *_ma_fetch_keypage(register MARIA_HA *info, MARIA_KEYDEF *keyinfo,
my_off_t page, int level, my_off_t page, int level,
byte *buff, uchar *buff,
int return_buffer __attribute__ ((unused))) int return_buffer __attribute__ ((unused)))
{ {
byte *tmp; uchar *tmp;
uint page_size; uint page_size;
DBUG_ENTER("_ma_fetch_keypage"); DBUG_ENTER("_ma_fetch_keypage");
DBUG_PRINT("enter",("page: %ld", (long) page)); DBUG_PRINT("enter",("page: %ld", (long) page));
@ -66,7 +66,7 @@ byte *_ma_fetch_keypage(register MARIA_HA *info, MARIA_KEYDEF *keyinfo,
/* Write a key-page on disk */ /* Write a key-page on disk */
int _ma_write_keypage(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo, int _ma_write_keypage(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
my_off_t page, int level, byte *buff) my_off_t page, int level, uchar *buff)
{ {
DBUG_ENTER("_ma_write_keypage"); DBUG_ENTER("_ma_write_keypage");
@ -84,14 +84,14 @@ int _ma_write_keypage(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
DBUG_RETURN((-1)); DBUG_RETURN((-1));
} }
DBUG_PRINT("page",("write page at: %lu",(long) page)); DBUG_PRINT("page",("write page at: %lu",(long) page));
DBUG_DUMP("buff",(byte*) buff,maria_data_on_page(buff)); DBUG_DUMP("buff",(uchar*) buff,maria_data_on_page(buff));
#endif #endif
#ifdef HAVE_purify #ifdef HAVE_purify
{ {
/* Clear unitialized part of page to avoid valgrind/purify warnings */ /* Clear unitialized part of page to avoid valgrind/purify warnings */
uint length= maria_data_on_page(buff); uint length= maria_data_on_page(buff);
bzero((byte*) buff+length,keyinfo->block_length-length); bzero((uchar*) buff+length,keyinfo->block_length-length);
length=keyinfo->block_length; length=keyinfo->block_length;
} }
#endif #endif
@ -150,7 +150,7 @@ int _ma_dispose(register MARIA_HA *info, MARIA_KEYDEF *keyinfo, my_off_t pos,
my_off_t _ma_new(register MARIA_HA *info, MARIA_KEYDEF *keyinfo, int level) my_off_t _ma_new(register MARIA_HA *info, MARIA_KEYDEF *keyinfo, int level)
{ {
my_off_t pos; my_off_t pos;
byte *buff; uchar *buff;
DBUG_ENTER("_ma_new"); DBUG_ENTER("_ma_new");
if ((pos= info->s->state.key_del) == HA_OFFSET_ERROR) if ((pos= info->s->state.key_del) == HA_OFFSET_ERROR)

View File

@ -302,7 +302,7 @@ struct st_pagecache_block_link
WQUEUE WQUEUE
wqueue[COND_SIZE]; /* queues on waiting requests for new/old pages */ wqueue[COND_SIZE]; /* queues on waiting requests for new/old pages */
uint requests; /* number of requests for the block */ uint requests; /* number of requests for the block */
byte *buffer; /* buffer for the block page */ uchar *buffer; /* buffer for the block page */
uint status; /* state of the block */ uint status; /* state of the block */
uint pins; /* pin counter */ uint pins; /* pin counter */
#ifndef DBUG_OFF #ifndef DBUG_OFF
@ -575,7 +575,7 @@ extern my_bool translog_flush(LSN lsn);
static uint pagecache_fwrite(PAGECACHE *pagecache, static uint pagecache_fwrite(PAGECACHE *pagecache,
PAGECACHE_FILE *filedesc, PAGECACHE_FILE *filedesc,
byte *buffer, uchar *buffer,
pgcache_page_no_t pageno, pgcache_page_no_t pageno,
enum pagecache_page_type type, enum pagecache_page_type type,
myf flags) myf flags)
@ -651,7 +651,7 @@ static inline uint next_power(uint value)
*/ */
int init_pagecache(PAGECACHE *pagecache, my_size_t use_mem, int init_pagecache(PAGECACHE *pagecache, size_t use_mem,
uint division_limit, uint age_threshold, uint division_limit, uint age_threshold,
uint block_size) uint block_size)
{ {
@ -745,11 +745,11 @@ int init_pagecache(PAGECACHE *pagecache, my_size_t use_mem,
(PAGECACHE_HASH_LINK*) ((char*) pagecache->hash_root + (PAGECACHE_HASH_LINK*) ((char*) pagecache->hash_root +
ALIGN_SIZE((sizeof(PAGECACHE_HASH_LINK*) * ALIGN_SIZE((sizeof(PAGECACHE_HASH_LINK*) *
pagecache->hash_entries))); pagecache->hash_entries)));
bzero((byte*) pagecache->block_root, bzero((uchar*) pagecache->block_root,
pagecache->disk_blocks * sizeof(PAGECACHE_BLOCK_LINK)); pagecache->disk_blocks * sizeof(PAGECACHE_BLOCK_LINK));
bzero((byte*) pagecache->hash_root, bzero((uchar*) pagecache->hash_root,
pagecache->hash_entries * sizeof(PAGECACHE_HASH_LINK*)); pagecache->hash_entries * sizeof(PAGECACHE_HASH_LINK*));
bzero((byte*) pagecache->hash_link_root, bzero((uchar*) pagecache->hash_link_root,
pagecache->hash_links * sizeof(PAGECACHE_HASH_LINK)); pagecache->hash_links * sizeof(PAGECACHE_HASH_LINK));
pagecache->hash_links_used= 0; pagecache->hash_links_used= 0;
pagecache->free_hash_list= NULL; pagecache->free_hash_list= NULL;
@ -783,10 +783,10 @@ int init_pagecache(PAGECACHE *pagecache, my_size_t use_mem,
pagecache->disk_blocks, (long) pagecache->block_root, pagecache->disk_blocks, (long) pagecache->block_root,
pagecache->hash_entries, (long) pagecache->hash_root, pagecache->hash_entries, (long) pagecache->hash_root,
pagecache->hash_links, (long) pagecache->hash_link_root)); pagecache->hash_links, (long) pagecache->hash_link_root));
bzero((gptr) pagecache->changed_blocks, bzero((uchar*) pagecache->changed_blocks,
sizeof(pagecache->changed_blocks[0]) * sizeof(pagecache->changed_blocks[0]) *
PAGECACHE_CHANGED_BLOCKS_HASH); PAGECACHE_CHANGED_BLOCKS_HASH);
bzero((gptr) pagecache->file_blocks, bzero((uchar*) pagecache->file_blocks,
sizeof(pagecache->file_blocks[0]) * sizeof(pagecache->file_blocks[0]) *
PAGECACHE_CHANGED_BLOCKS_HASH); PAGECACHE_CHANGED_BLOCKS_HASH);
} }
@ -800,12 +800,12 @@ err:
pagecache->blocks= 0; pagecache->blocks= 0;
if (pagecache->block_mem) if (pagecache->block_mem)
{ {
my_large_free((gptr) pagecache->block_mem, MYF(0)); my_large_free((uchar*) pagecache->block_mem, MYF(0));
pagecache->block_mem= NULL; pagecache->block_mem= NULL;
} }
if (pagecache->block_root) if (pagecache->block_root)
{ {
my_free((gptr) pagecache->block_root, MYF(0)); my_free((uchar*) pagecache->block_root, MYF(0));
pagecache->block_root= NULL; pagecache->block_root= NULL;
} }
my_errno= error; my_errno= error;
@ -884,7 +884,7 @@ static int flush_all_key_blocks(PAGECACHE *pagecache)
*/ */
#if NOT_USED /* keep disabled until code is fixed see above !! */ #if NOT_USED /* keep disabled until code is fixed see above !! */
int resize_pagecache(PAGECACHE *pagecache, int resize_pagecache(PAGECACHE *pagecache,
my_size_t use_mem, uint division_limit, size_t use_mem, uint division_limit,
uint age_threshold) uint age_threshold)
{ {
int blocks; int blocks;
@ -1049,9 +1049,9 @@ void end_pagecache(PAGECACHE *pagecache, my_bool cleanup)
{ {
if (pagecache->block_mem) if (pagecache->block_mem)
{ {
my_large_free((gptr) pagecache->block_mem, MYF(0)); my_large_free((uchar*) pagecache->block_mem, MYF(0));
pagecache->block_mem= NULL; pagecache->block_mem= NULL;
my_free((gptr) pagecache->block_root, MYF(0)); my_free((uchar*) pagecache->block_root, MYF(0));
pagecache->block_root= NULL; pagecache->block_root= NULL;
} }
pagecache->disk_blocks= -1; pagecache->disk_blocks= -1;
@ -1876,7 +1876,7 @@ restart:
block->buffer= ADD_TO_PTR(pagecache->block_mem, block->buffer= ADD_TO_PTR(pagecache->block_mem,
((ulong) pagecache->blocks_used* ((ulong) pagecache->blocks_used*
pagecache->block_size), pagecache->block_size),
byte*); uchar*);
pagecache->blocks_used++; pagecache->blocks_used++;
} }
pagecache->blocks_unused--; pagecache->blocks_unused--;
@ -2097,7 +2097,7 @@ static void remove_pin(PAGECACHE_BLOCK_LINK *block)
PAGECACHE_PIN_INFO *info= info_find(block->pin_list, my_thread_var); PAGECACHE_PIN_INFO *info= info_find(block->pin_list, my_thread_var);
DBUG_ASSERT(info != 0); DBUG_ASSERT(info != 0);
info_unlink(info); info_unlink(info);
my_free((gptr) info, MYF(0)); my_free((uchar*) info, MYF(0));
} }
#endif #endif
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -2119,7 +2119,7 @@ static void info_remove_lock(PAGECACHE_BLOCK_LINK *block)
my_thread_var); my_thread_var);
DBUG_ASSERT(info != 0); DBUG_ASSERT(info != 0);
info_unlink((PAGECACHE_PIN_INFO *)info); info_unlink((PAGECACHE_PIN_INFO *)info);
my_free((gptr)info, MYF(0)); my_free((uchar*)info, MYF(0));
} }
static void info_change_lock(PAGECACHE_BLOCK_LINK *block, my_bool wl) static void info_change_lock(PAGECACHE_BLOCK_LINK *block, my_bool wl)
{ {
@ -2362,7 +2362,7 @@ static void read_block(PAGECACHE *pagecache,
PAGECACHE_BLOCK_LINK *block, PAGECACHE_BLOCK_LINK *block,
my_bool primary, my_bool primary,
pagecache_disk_read_validator validator, pagecache_disk_read_validator validator,
gptr validator_data) uchar* validator_data)
{ {
uint got_length; uint got_length;
@ -2814,16 +2814,16 @@ static enum pagecache_page_pin lock_to_pin[]=
PAGECACHE_UNPIN /*PAGECACHE_LOCK_WRITE_TO_READ*/ PAGECACHE_UNPIN /*PAGECACHE_LOCK_WRITE_TO_READ*/
}; };
byte *pagecache_valid_read(PAGECACHE *pagecache, uchar *pagecache_valid_read(PAGECACHE *pagecache,
PAGECACHE_FILE *file, PAGECACHE_FILE *file,
pgcache_page_no_t pageno, pgcache_page_no_t pageno,
uint level, uint level,
byte *buff, uchar *buff,
enum pagecache_page_type type, enum pagecache_page_type type,
enum pagecache_page_lock lock, enum pagecache_page_lock lock,
PAGECACHE_PAGE_LINK *link, PAGECACHE_PAGE_LINK *link,
pagecache_disk_read_validator validator, pagecache_disk_read_validator validator,
gptr validator_data) uchar* validator_data)
{ {
int error= 0; int error= 0;
enum pagecache_page_pin pin= lock_to_pin[lock]; enum pagecache_page_pin pin= lock_to_pin[lock];
@ -2918,7 +2918,7 @@ restart:
pagecache_pthread_mutex_unlock(&pagecache->cache_lock); pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
if (status & PCBLOCK_ERROR) if (status & PCBLOCK_ERROR)
DBUG_RETURN((byte *) 0); DBUG_RETURN((uchar *) 0);
DBUG_RETURN(buff); DBUG_RETURN(buff);
} }
@ -2928,9 +2928,9 @@ no_key_cache: /* Key cache is not used */
/* We can't use mutex here as the key cache may not be initialized */ /* We can't use mutex here as the key cache may not be initialized */
pagecache->global_cache_r_requests++; pagecache->global_cache_r_requests++;
pagecache->global_cache_read++; pagecache->global_cache_read++;
if (pagecache_fread(pagecache, file, (byte*) buff, pageno, MYF(MY_NABP))) if (pagecache_fread(pagecache, file, (uchar*) buff, pageno, MYF(MY_NABP)))
error= 1; error= 1;
DBUG_RETURN(error ? (byte*) 0 : buff); DBUG_RETURN(error ? (uchar*) 0 : buff);
} }
@ -3160,7 +3160,7 @@ my_bool pagecache_write_part(PAGECACHE *pagecache,
PAGECACHE_FILE *file, PAGECACHE_FILE *file,
pgcache_page_no_t pageno, pgcache_page_no_t pageno,
uint level, uint level,
byte *buff, uchar *buff,
enum pagecache_page_type type, enum pagecache_page_type type,
enum pagecache_page_lock lock, enum pagecache_page_lock lock,
enum pagecache_page_pin pin, enum pagecache_page_pin pin,
@ -3320,7 +3320,7 @@ no_key_cache:
{ {
pagecache->global_cache_w_requests++; pagecache->global_cache_w_requests++;
pagecache->global_cache_write++; pagecache->global_cache_write++;
if (pagecache_fwrite(pagecache, file, (byte*) buff, pageno, type, if (pagecache_fwrite(pagecache, file, (uchar*) buff, pageno, type,
MYF(MY_NABP | MY_WAIT_IF_FULL))) MYF(MY_NABP | MY_WAIT_IF_FULL)))
error=1; error=1;
} }
@ -3426,7 +3426,7 @@ static int flush_cached_blocks(PAGECACHE *pagecache,
As all blocks referred in 'cache' are marked by PCBLOCK_IN_FLUSH As all blocks referred in 'cache' are marked by PCBLOCK_IN_FLUSH
we are guarunteed no thread will change them we are guarunteed no thread will change them
*/ */
qsort((byte*) cache, count, sizeof(*cache), (qsort_cmp) cmp_sec_link); qsort((uchar*) cache, count, sizeof(*cache), (qsort_cmp) cmp_sec_link);
pagecache_pthread_mutex_lock(&pagecache->cache_lock); pagecache_pthread_mutex_lock(&pagecache->cache_lock);
for (; cache != end; cache++) for (; cache != end; cache++)
@ -3730,7 +3730,7 @@ restart:
test_key_cache(pagecache, "end of flush_pagecache_blocks", 0);); test_key_cache(pagecache, "end of flush_pagecache_blocks", 0););
#endif #endif
if (cache != cache_buff) if (cache != cache_buff)
my_free((gptr) cache, MYF(0)); my_free((uchar*) cache, MYF(0));
if (last_errno) if (last_errno)
errno=last_errno; /* Return first error */ errno=last_errno; /* Return first error */
DBUG_RETURN(last_errno != 0); DBUG_RETURN(last_errno != 0);

View File

@ -93,7 +93,7 @@ typedef struct st_pagecache_hash_link PAGECACHE_HASH_LINK;
#include <wqueue.h> #include <wqueue.h>
typedef my_bool (*pagecache_disk_read_validator)(byte *page, gptr data); typedef my_bool (*pagecache_disk_read_validator)(uchar *page, uchar** data);
#define PAGECACHE_CHANGED_BLOCKS_HASH 128 /* must be power of 2 */ #define PAGECACHE_CHANGED_BLOCKS_HASH 128 /* must be power of 2 */
@ -108,7 +108,7 @@ typedef struct st_pagecache
my_bool resize_in_flush; /* true during flush of resize operation */ my_bool resize_in_flush; /* true during flush of resize operation */
my_bool can_be_used; /* usage of cache for read/write is allowed */ my_bool can_be_used; /* usage of cache for read/write is allowed */
uint shift; /* block size = 2 ^ shift */ uint shift; /* block size = 2 ^ shift */
my_size_t mem_size; /* specified size of the cache memory */ size_t mem_size; /* specified size of the cache memory */
uint32 block_size; /* size of the page buffer of a cache block */ uint32 block_size; /* size of the page buffer of a cache block */
ulong min_warm_blocks; /* min number of warm blocks; */ ulong min_warm_blocks; /* min number of warm blocks; */
ulong age_threshold; /* age threshold for hot blocks */ ulong age_threshold; /* age threshold for hot blocks */
@ -128,7 +128,7 @@ typedef struct st_pagecache
PAGECACHE_HASH_LINK *free_hash_list;/* list of free hash links */ PAGECACHE_HASH_LINK *free_hash_list;/* list of free hash links */
PAGECACHE_BLOCK_LINK *free_block_list;/* list of free blocks */ PAGECACHE_BLOCK_LINK *free_block_list;/* list of free blocks */
PAGECACHE_BLOCK_LINK *block_root;/* memory for block links */ PAGECACHE_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 */
PAGECACHE_BLOCK_LINK *used_last;/* ptr to the last block of the LRU chain */ PAGECACHE_BLOCK_LINK *used_last;/* ptr to the last block of the LRU chain */
PAGECACHE_BLOCK_LINK *used_ins;/* ptr to the insertion block in LRU chain */ PAGECACHE_BLOCK_LINK *used_ins;/* ptr to the insertion block in LRU chain */
pthread_mutex_t cache_lock; /* to lock access to the cache structure */ pthread_mutex_t cache_lock; /* to lock access to the cache structure */
@ -164,11 +164,11 @@ typedef struct st_pagecache
/* The default key cache */ /* The default key cache */
extern PAGECACHE dflt_pagecache_var, *dflt_pagecache; extern PAGECACHE dflt_pagecache_var, *dflt_pagecache;
extern int init_pagecache(PAGECACHE *pagecache, my_size_t use_mem, extern int init_pagecache(PAGECACHE *pagecache, size_t use_mem,
uint division_limit, uint age_threshold, uint division_limit, uint age_threshold,
uint block_size); uint block_size);
extern int resize_pagecache(PAGECACHE *pagecache, extern int resize_pagecache(PAGECACHE *pagecache,
my_size_t use_mem, uint division_limit, size_t use_mem, uint division_limit,
uint age_threshold); uint age_threshold);
extern void change_pagecache_param(PAGECACHE *pagecache, uint division_limit, extern void change_pagecache_param(PAGECACHE *pagecache, uint division_limit,
uint age_threshold); uint age_threshold);
@ -176,16 +176,16 @@ extern void change_pagecache_param(PAGECACHE *pagecache, uint division_limit,
#define pagecache_read(P,F,N,L,B,T,K,I) \ #define pagecache_read(P,F,N,L,B,T,K,I) \
pagecache_valid_read(P,F,N,L,B,T,K,I,0,0) pagecache_valid_read(P,F,N,L,B,T,K,I,0,0)
extern byte *pagecache_valid_read(PAGECACHE *pagecache, extern uchar *pagecache_valid_read(PAGECACHE *pagecache,
PAGECACHE_FILE *file, PAGECACHE_FILE *file,
pgcache_page_no_t pageno, pgcache_page_no_t pageno,
uint level, uint level,
byte *buff, uchar *buff,
enum pagecache_page_type type, enum pagecache_page_type type,
enum pagecache_page_lock lock, enum pagecache_page_lock lock,
PAGECACHE_PAGE_LINK *link, PAGECACHE_PAGE_LINK *link,
pagecache_disk_read_validator validator, pagecache_disk_read_validator validator,
gptr validator_data); uchar* validator_data);
#define pagecache_write(P,F,N,L,B,T,O,I,M,K) \ #define pagecache_write(P,F,N,L,B,T,O,I,M,K) \
pagecache_write_part(P,F,N,L,B,T,O,I,M,K,0,(P)->block_size) pagecache_write_part(P,F,N,L,B,T,O,I,M,K,0,(P)->block_size)
@ -194,7 +194,7 @@ extern my_bool pagecache_write_part(PAGECACHE *pagecache,
PAGECACHE_FILE *file, PAGECACHE_FILE *file,
pgcache_page_no_t pageno, pgcache_page_no_t pageno,
uint level, uint level,
byte *buff, uchar *buff,
enum pagecache_page_type type, enum pagecache_page_type type,
enum pagecache_page_lock lock, enum pagecache_page_lock lock,
enum pagecache_page_pin pin, enum pagecache_page_pin pin,
@ -247,9 +247,9 @@ extern int reset_pagecache_counters(const char *name, PAGECACHE *pagecache);
/* Functions to handle multiple key caches */ /* Functions to handle multiple key caches */
extern my_bool multi_pagecache_init(void); extern my_bool multi_pagecache_init(void);
extern void multi_pagecache_free(void); extern void multi_pagecache_free(void);
extern PAGECACHE *multi_pagecache_search(byte *key, uint length, extern PAGECACHE *multi_pagecache_search(uchar *key, uint length,
PAGECACHE *def); PAGECACHE *def);
extern my_bool multi_pagecache_set(const byte *key, uint length, extern my_bool multi_pagecache_set(const uchar *key, uint length,
PAGECACHE *pagecache); PAGECACHE *pagecache);
extern void multi_pagecache_change(PAGECACHE *old_data, extern void multi_pagecache_change(PAGECACHE *old_data,
PAGECACHE *new_data); PAGECACHE *new_data);

View File

@ -38,7 +38,7 @@ static SAFE_HASH pagecache_hash;
my_bool multi_pagecache_init(void) my_bool multi_pagecache_init(void)
{ {
return safe_hash_init(&pagecache_hash, 16, (byte*) maria_pagecache); return safe_hash_init(&pagecache_hash, 16, (uchar*) maria_pagecache);
} }
@ -65,7 +65,7 @@ void multi_pagecache_free(void)
key cache to use key cache to use
*/ */
PAGECACHE *multi_pagecache_search(byte *key, uint length, PAGECACHE *multi_pagecache_search(uchar *key, uint length,
PAGECACHE *def) PAGECACHE *def)
{ {
if (!pagecache_hash.hash.records) if (!pagecache_hash.hash.records)
@ -91,15 +91,15 @@ PAGECACHE *multi_pagecache_search(byte *key, uint length,
*/ */
my_bool multi_pagecache_set(const byte *key, uint length, my_bool multi_pagecache_set(const uchar *key, uint length,
PAGECACHE *pagecache) PAGECACHE *pagecache)
{ {
return safe_hash_set(&pagecache_hash, key, length, (byte*) pagecache); return safe_hash_set(&pagecache_hash, key, length, (uchar*) pagecache);
} }
void multi_pagecache_change(PAGECACHE *old_data, void multi_pagecache_change(PAGECACHE *old_data,
PAGECACHE *new_data) PAGECACHE *new_data)
{ {
safe_hash_change(&pagecache_hash, (byte*) old_data, (byte*) new_data); safe_hash_change(&pagecache_hash, (uchar*) old_data, (uchar*) new_data);
} }

View File

@ -76,7 +76,7 @@ int maria_preload(MARIA_HA *info, ulonglong key_map, my_bool ignore_leaves)
/* Read the next block of index file into the preload buffer */ /* Read the next block of index file into the preload buffer */
if ((my_off_t) length > (key_file_length-pos)) if ((my_off_t) length > (key_file_length-pos))
length= (ulong) (key_file_length-pos); length= (ulong) (key_file_length-pos);
if (my_pread(share->kfile.file, (byte*) buff, length, pos, if (my_pread(share->kfile.file, (uchar*) buff, length, pos,
MYF(MY_FAE|MY_FNABP))) MYF(MY_FAE|MY_FNABP)))
goto err; goto err;
@ -91,7 +91,7 @@ int maria_preload(MARIA_HA *info, ulonglong key_map, my_bool ignore_leaves)
if (pagecache_write(share->pagecache, if (pagecache_write(share->pagecache,
&share->kfile, pos / block_length, &share->kfile, pos / block_length,
DFLT_INIT_HITS, DFLT_INIT_HITS,
(byte*) buff, (uchar*) buff,
PAGECACHE_PLAIN_PAGE, PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED, PAGECACHE_LOCK_LEFT_UNLOCKED,
PAGECACHE_PIN_LEFT_UNPINNED, PAGECACHE_PIN_LEFT_UNPINNED,
@ -108,7 +108,7 @@ int maria_preload(MARIA_HA *info, ulonglong key_map, my_bool ignore_leaves)
if (pagecache_write(share->pagecache, if (pagecache_write(share->pagecache,
&share->kfile, pos / block_length, &share->kfile, pos / block_length,
DFLT_INIT_HITS, DFLT_INIT_HITS,
(byte*) buff, (uchar*) buff,
PAGECACHE_PLAIN_PAGE, PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED, PAGECACHE_LOCK_LEFT_UNLOCKED,
PAGECACHE_PIN_LEFT_UNPINNED, PAGECACHE_PIN_LEFT_UNPINNED,

View File

@ -21,12 +21,12 @@
#include "maria_def.h" #include "maria_def.h"
#include "ma_rt_index.h" #include "ma_rt_index.h"
static ha_rows _ma_record_pos(MARIA_HA *info,const byte *key,uint key_len, static ha_rows _ma_record_pos(MARIA_HA *info,const uchar *key,uint key_len,
enum ha_rkey_function search_flag); enum ha_rkey_function search_flag);
static double _ma_search_pos(MARIA_HA *info,MARIA_KEYDEF *keyinfo, byte *key, static double _ma_search_pos(MARIA_HA *info,MARIA_KEYDEF *keyinfo, uchar *key,
uint key_len,uint nextflag, my_off_t pos); uint key_len,uint nextflag, my_off_t pos);
static uint _ma_keynr(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *page, static uint _ma_keynr(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uchar *page,
byte *keypos, uint *ret_max_key); uchar *keypos, uint *ret_max_key);
/** /**
@ -64,7 +64,7 @@ ha_rows maria_records_in_range(MARIA_HA *info, int inx, key_range *min_key,
#ifdef HAVE_RTREE_KEYS #ifdef HAVE_RTREE_KEYS
case HA_KEY_ALG_RTREE: case HA_KEY_ALG_RTREE:
{ {
byte *key_buff; uchar *key_buff;
uint start_key_len; uint start_key_len;
/* /*
@ -126,12 +126,12 @@ ha_rows maria_records_in_range(MARIA_HA *info, int inx, key_range *min_key,
/* Find relative position (in records) for key in index-tree */ /* Find relative position (in records) for key in index-tree */
static ha_rows _ma_record_pos(MARIA_HA *info, const byte *key, uint key_len, static ha_rows _ma_record_pos(MARIA_HA *info, const uchar *key, uint key_len,
enum ha_rkey_function search_flag) enum ha_rkey_function search_flag)
{ {
uint inx=(uint) info->lastinx, nextflag; uint inx=(uint) info->lastinx, nextflag;
MARIA_KEYDEF *keyinfo=info->s->keyinfo+inx; MARIA_KEYDEF *keyinfo=info->s->keyinfo+inx;
byte *key_buff; uchar *key_buff;
double pos; double pos;
DBUG_ENTER("_ma_record_pos"); DBUG_ENTER("_ma_record_pos");
DBUG_PRINT("enter",("search_flag: %d",search_flag)); DBUG_PRINT("enter",("search_flag: %d",search_flag));
@ -164,13 +164,13 @@ static ha_rows _ma_record_pos(MARIA_HA *info, const byte *key, uint key_len,
static double _ma_search_pos(register MARIA_HA *info, static double _ma_search_pos(register MARIA_HA *info,
register MARIA_KEYDEF *keyinfo, register MARIA_KEYDEF *keyinfo,
byte *key, uint key_len, uint nextflag, uchar *key, uint key_len, uint nextflag,
register my_off_t pos) register my_off_t pos)
{ {
int flag; int flag;
uint nod_flag,keynr,max_keynr; uint nod_flag,keynr,max_keynr;
my_bool after_key; my_bool after_key;
byte *keypos, *buff; uchar *keypos, *buff;
double offset; double offset;
DBUG_ENTER("_ma_search_pos"); DBUG_ENTER("_ma_search_pos");
LINT_INIT(max_keynr); LINT_INIT(max_keynr);
@ -232,10 +232,10 @@ err:
/* Get keynummer of current key and max number of keys in nod */ /* Get keynummer of current key and max number of keys in nod */
static uint _ma_keynr(MARIA_HA *info, register MARIA_KEYDEF *keyinfo, static uint _ma_keynr(MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
byte *page, byte *keypos, uint *ret_max_key) uchar *page, uchar *keypos, uint *ret_max_key)
{ {
uint nod_flag,keynr,max_key; uint nod_flag,keynr,max_key;
byte t_buff[HA_MAX_KEY_BUFF],*end; uchar t_buff[HA_MAX_KEY_BUFF],*end;
end= page+maria_data_on_page(page); end= page+maria_data_on_page(page);
nod_flag=_ma_test_if_nod(page); nod_flag=_ma_test_if_nod(page);

View File

@ -17,7 +17,7 @@
/* Read first row through a specfic key */ /* Read first row through a specfic key */
int maria_rfirst(MARIA_HA *info, byte *buf, int inx) int maria_rfirst(MARIA_HA *info, uchar *buf, int inx)
{ {
DBUG_ENTER("maria_rfirst"); DBUG_ENTER("maria_rfirst");
info->cur_row.lastpos= HA_OFFSET_ERROR; info->cur_row.lastpos= HA_OFFSET_ERROR;

View File

@ -21,10 +21,10 @@
/* Read a record using key */ /* Read a record using key */
/* Ordinary search_flag is 0 ; Give error if no record with key */ /* Ordinary search_flag is 0 ; Give error if no record with key */
int maria_rkey(MARIA_HA *info, byte *buf, int inx, const byte *key, int maria_rkey(MARIA_HA *info, uchar *buf, int inx, const uchar *key,
uint key_len, enum ha_rkey_function search_flag) uint key_len, enum ha_rkey_function search_flag)
{ {
byte *key_buff; uchar *key_buff;
MARIA_SHARE *share=info->s; MARIA_SHARE *share=info->s;
MARIA_KEYDEF *keyinfo; MARIA_KEYDEF *keyinfo;
HA_KEYSEG *last_used_keyseg; HA_KEYSEG *last_used_keyseg;

View File

@ -17,7 +17,7 @@
/* Read last row with the same key as the previous read. */ /* Read last row with the same key as the previous read. */
int maria_rlast(MARIA_HA *info, byte *buf, int inx) int maria_rlast(MARIA_HA *info, uchar *buf, int inx)
{ {
DBUG_ENTER("maria_rlast"); DBUG_ENTER("maria_rlast");
info->cur_row.lastpos= HA_OFFSET_ERROR; info->cur_row.lastpos= HA_OFFSET_ERROR;

View File

@ -24,7 +24,7 @@
based on the position of the last used key! based on the position of the last used key!
*/ */
int maria_rnext(MARIA_HA *info, byte *buf, int inx) int maria_rnext(MARIA_HA *info, uchar *buf, int inx)
{ {
int error,changed; int error,changed;
uint flag; uint flag;

View File

@ -25,7 +25,7 @@
based on the position of the last used key! based on the position of the last used key!
*/ */
int maria_rnext_same(MARIA_HA *info, byte *buf) int maria_rnext_same(MARIA_HA *info, uchar *buf)
{ {
int error; int error;
uint inx,not_used[2]; uint inx,not_used[2];

View File

@ -22,7 +22,7 @@
based on the position of the last used key! based on the position of the last used key!
*/ */
int maria_rprev(MARIA_HA *info, byte *buf, int inx) int maria_rprev(MARIA_HA *info, uchar *buf, int inx)
{ {
int error,changed; int error,changed;
register uint flag; register uint flag;

View File

@ -28,7 +28,7 @@
HA_ERR_END_OF_FILE EOF. HA_ERR_END_OF_FILE EOF.
*/ */
int maria_rrnd(MARIA_HA *info, byte *buf, MARIA_RECORD_POS filepos) int maria_rrnd(MARIA_HA *info, uchar *buf, MARIA_RECORD_POS filepos)
{ {
DBUG_ENTER("maria_rrnd"); DBUG_ENTER("maria_rrnd");

View File

@ -28,7 +28,7 @@
*/ */
int maria_rsame(MARIA_HA *info, byte *record, int inx) int maria_rsame(MARIA_HA *info, uchar *record, int inx)
{ {
DBUG_ENTER("maria_rsame"); DBUG_ENTER("maria_rsame");

View File

@ -27,7 +27,7 @@
** HA_ERR_END_OF_FILE = End of file ** HA_ERR_END_OF_FILE = End of file
*/ */
int maria_rsame_with_pos(MARIA_HA *info, byte *record, int inx, int maria_rsame_with_pos(MARIA_HA *info, uchar *record, int inx,
MARIA_RECORD_POS filepos) MARIA_RECORD_POS filepos)
{ {
DBUG_ENTER("maria_rsame_with_pos"); DBUG_ENTER("maria_rsame_with_pos");

View File

@ -58,11 +58,11 @@ static int maria_rtree_find_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
{ {
uint nod_flag; uint nod_flag;
int res; int res;
byte *page_buf, *k, *last; uchar *page_buf, *k, *last;
int k_len; int k_len;
uint *saved_key = (uint*) (info->maria_rtree_recursion_state) + level; uint *saved_key = (uint*) (info->maria_rtree_recursion_state) + level;
if (!(page_buf = (byte*) my_alloca((uint)keyinfo->block_length))) if (!(page_buf = (uchar*) my_alloca((uint)keyinfo->block_length)))
{ {
my_errno = HA_ERR_OUT_OF_MEM; my_errno = HA_ERR_OUT_OF_MEM;
return -1; return -1;
@ -115,7 +115,7 @@ static int maria_rtree_find_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
if (!maria_rtree_key_cmp(keyinfo->seg, info->first_mbr_key, if (!maria_rtree_key_cmp(keyinfo->seg, info->first_mbr_key,
k, info->last_rkey_length, search_flag)) k, info->last_rkey_length, search_flag))
{ {
byte *after_key = (byte*) rt_PAGE_NEXT_KEY(k, k_len, nod_flag); uchar *after_key = (uchar*) rt_PAGE_NEXT_KEY(k, k_len, nod_flag);
info->cur_row.lastpos = _ma_dpos(info, 0, after_key); info->cur_row.lastpos = _ma_dpos(info, 0, after_key);
info->lastkey_length = k_len + info->s->base.rec_reflength; info->lastkey_length = k_len + info->s->base.rec_reflength;
memcpy(info->lastkey, k, info->lastkey_length); memcpy(info->lastkey, k, info->lastkey_length);
@ -144,11 +144,11 @@ static int maria_rtree_find_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
res = 1; res = 1;
ok: ok:
my_afree((byte*)page_buf); my_afree((uchar*)page_buf);
return res; return res;
err1: err1:
my_afree((byte*)page_buf); my_afree((uchar*)page_buf);
info->cur_row.lastpos = HA_OFFSET_ERROR; info->cur_row.lastpos = HA_OFFSET_ERROR;
return -1; return -1;
} }
@ -171,7 +171,7 @@ err1:
1 Not found 1 Not found
*/ */
int maria_rtree_find_first(MARIA_HA *info, uint keynr, byte *key, int maria_rtree_find_first(MARIA_HA *info, uint keynr, uchar *key,
uint key_length, uint search_flag) uint key_length, uint search_flag)
{ {
my_off_t root; my_off_t root;
@ -229,7 +229,7 @@ int maria_rtree_find_next(MARIA_HA *info, uint keynr, uint search_flag)
if (!info->keyread_buff_used) if (!info->keyread_buff_used)
{ {
byte *key= info->int_keypos; uchar *key= info->int_keypos;
while (key < info->int_maxpos) while (key < info->int_maxpos)
{ {
@ -237,7 +237,7 @@ int maria_rtree_find_next(MARIA_HA *info, uint keynr, uint search_flag)
info->first_mbr_key, key, info->first_mbr_key, key,
info->last_rkey_length, search_flag)) info->last_rkey_length, search_flag))
{ {
byte *after_key= key + keyinfo->keylength; uchar *after_key= key + keyinfo->keylength;
info->cur_row.lastpos= _ma_dpos(info, 0, after_key); info->cur_row.lastpos= _ma_dpos(info, 0, after_key);
memcpy(info->lastkey, key, info->lastkey_length); memcpy(info->lastkey, key, info->lastkey_length);
@ -278,12 +278,12 @@ int maria_rtree_find_next(MARIA_HA *info, uint keynr, uint search_flag)
static int maria_rtree_get_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uint key_length, static int maria_rtree_get_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uint key_length,
my_off_t page, int level) my_off_t page, int level)
{ {
byte *page_buf, *last, *k; uchar *page_buf, *last, *k;
uint nod_flag, k_len; uint nod_flag, k_len;
int res; int res;
uint *saved_key= (uint*) (info->maria_rtree_recursion_state) + level; uint *saved_key= (uint*) (info->maria_rtree_recursion_state) + level;
if (!(page_buf= (byte*) my_alloca((uint)keyinfo->block_length))) if (!(page_buf= (uchar*) my_alloca((uint)keyinfo->block_length)))
return -1; return -1;
if (!_ma_fetch_keypage(info, keyinfo, page, DFLT_INIT_HITS, page_buf, 0)) if (!_ma_fetch_keypage(info, keyinfo, page, DFLT_INIT_HITS, page_buf, 0))
goto err1; goto err1;
@ -329,7 +329,7 @@ static int maria_rtree_get_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uint key_l
else else
{ {
/* this is a leaf */ /* this is a leaf */
byte *after_key = rt_PAGE_NEXT_KEY(k, k_len, nod_flag); uchar *after_key = rt_PAGE_NEXT_KEY(k, k_len, nod_flag);
info->cur_row.lastpos = _ma_dpos(info, 0, after_key); info->cur_row.lastpos = _ma_dpos(info, 0, after_key);
info->lastkey_length = k_len + info->s->base.rec_reflength; info->lastkey_length = k_len + info->s->base.rec_reflength;
memcpy(info->lastkey, k, info->lastkey_length); memcpy(info->lastkey, k, info->lastkey_length);
@ -339,7 +339,7 @@ static int maria_rtree_get_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uint key_l
if (after_key < last) if (after_key < last)
{ {
info->int_keypos = (byte*) saved_key; info->int_keypos = (uchar*) saved_key;
memcpy(info->buff, page_buf, keyinfo->block_length); memcpy(info->buff, page_buf, keyinfo->block_length);
info->int_maxpos = rt_PAGE_END(info->buff); info->int_maxpos = rt_PAGE_END(info->buff);
info->keyread_buff_used = 0; info->keyread_buff_used = 0;
@ -358,11 +358,11 @@ static int maria_rtree_get_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uint key_l
res = 1; res = 1;
ok: ok:
my_afree((byte*)page_buf); my_afree((uchar*)page_buf);
return res; return res;
err1: err1:
my_afree((byte*)page_buf); my_afree((uchar*)page_buf);
info->cur_row.lastpos = HA_OFFSET_ERROR; info->cur_row.lastpos = HA_OFFSET_ERROR;
return -1; return -1;
} }
@ -413,10 +413,10 @@ int maria_rtree_get_next(MARIA_HA *info, uint keynr, uint key_length)
{ {
uint k_len = keyinfo->keylength - info->s->base.rec_reflength; uint k_len = keyinfo->keylength - info->s->base.rec_reflength;
/* rt_PAGE_NEXT_KEY(info->int_keypos) */ /* rt_PAGE_NEXT_KEY(info->int_keypos) */
byte *key = info->buff + *(int*)info->int_keypos + k_len + uchar *key = info->buff + *(int*)info->int_keypos + k_len +
info->s->base.rec_reflength; info->s->base.rec_reflength;
/* rt_PAGE_NEXT_KEY(key) */ /* rt_PAGE_NEXT_KEY(key) */
byte *after_key = key + k_len + info->s->base.rec_reflength; uchar *after_key = key + k_len + info->s->base.rec_reflength;
info->cur_row.lastpos = _ma_dpos(info, 0, after_key); info->cur_row.lastpos = _ma_dpos(info, 0, after_key);
info->lastkey_length = k_len + info->s->base.rec_reflength; info->lastkey_length = k_len + info->s->base.rec_reflength;
@ -450,7 +450,7 @@ int maria_rtree_get_next(MARIA_HA *info, uint keynr, uint key_length)
#ifdef PICK_BY_PERIMETER #ifdef PICK_BY_PERIMETER
static uchar *maria_rtree_pick_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, static uchar *maria_rtree_pick_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
uchar *key, uchar *key,
uint key_length, byte *page_buf, uint key_length, uchar *page_buf,
uint nod_flag) uint nod_flag)
{ {
double increase; double increase;
@ -483,18 +483,18 @@ static uchar *maria_rtree_pick_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
#endif /*PICK_BY_PERIMETER*/ #endif /*PICK_BY_PERIMETER*/
#ifdef PICK_BY_AREA #ifdef PICK_BY_AREA
static byte *maria_rtree_pick_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, static uchar *maria_rtree_pick_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *key, uchar *key,
uint key_length, byte *page_buf, uint key_length, uchar *page_buf,
uint nod_flag) uint nod_flag)
{ {
double increase; double increase;
double best_incr = DBL_MAX; double best_incr = DBL_MAX;
double area; double area;
double best_area; double best_area;
byte *best_key; uchar *best_key;
byte *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag); uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
byte *last = rt_PAGE_END(page_buf); uchar *last = rt_PAGE_END(page_buf);
LINT_INIT(best_area); LINT_INIT(best_area);
LINT_INIT(best_key); LINT_INIT(best_key);
@ -538,16 +538,16 @@ static byte *maria_rtree_pick_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
*/ */
static int maria_rtree_insert_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo, static int maria_rtree_insert_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *key, uchar *key,
uint key_length, my_off_t page, uint key_length, my_off_t page,
my_off_t *new_page, my_off_t *new_page,
int ins_level, int level) int ins_level, int level)
{ {
uint nod_flag; uint nod_flag;
int res; int res;
byte *page_buf, *k; uchar *page_buf, *k;
if (!(page_buf= (byte*) my_alloca((uint)keyinfo->block_length + if (!(page_buf= (uchar*) my_alloca((uint)keyinfo->block_length +
HA_MAX_KEY_BUFF))) HA_MAX_KEY_BUFF)))
{ {
my_errno = HA_ERR_OUT_OF_MEM; my_errno = HA_ERR_OUT_OF_MEM;
@ -576,7 +576,7 @@ static int maria_rtree_insert_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
} }
case 1: /* child was split */ case 1: /* child was split */
{ {
byte *new_key = page_buf + keyinfo->block_length + nod_flag; uchar *new_key = page_buf + keyinfo->block_length + nod_flag;
/* set proper MBR for key */ /* set proper MBR for key */
if (maria_rtree_set_key_mbr(info, keyinfo, k, key_length, if (maria_rtree_set_key_mbr(info, keyinfo, k, key_length,
_ma_kpos(nod_flag, k))) _ma_kpos(nod_flag, k)))
@ -626,7 +626,7 @@ err1:
1 Root was split 1 Root was split
*/ */
static int maria_rtree_insert_level(MARIA_HA *info, uint keynr, byte *key, static int maria_rtree_insert_level(MARIA_HA *info, uint keynr, uchar *key,
uint key_length, int ins_level) uint key_length, int ins_level)
{ {
my_off_t old_root; my_off_t old_root;
@ -656,11 +656,11 @@ static int maria_rtree_insert_level(MARIA_HA *info, uint keynr, byte *key,
} }
case 1: /* root was split, grow a new root */ case 1: /* root was split, grow a new root */
{ {
byte *new_root_buf, *new_key; uchar *new_root_buf, *new_key;
my_off_t new_root; my_off_t new_root;
uint nod_flag = info->s->base.key_reflength; uint nod_flag = info->s->base.key_reflength;
if (!(new_root_buf= (byte*) my_alloca((uint)keyinfo->block_length + if (!(new_root_buf= (uchar*) my_alloca((uint)keyinfo->block_length +
HA_MAX_KEY_BUFF))) HA_MAX_KEY_BUFF)))
{ {
my_errno = HA_ERR_OUT_OF_MEM; my_errno = HA_ERR_OUT_OF_MEM;
@ -695,10 +695,10 @@ static int maria_rtree_insert_level(MARIA_HA *info, uint keynr, byte *key,
goto err1; goto err1;
info->s->state.key_root[keynr] = new_root; info->s->state.key_root[keynr] = new_root;
my_afree((byte*)new_root_buf); my_afree((uchar*)new_root_buf);
break; break;
err1: err1:
my_afree((byte*)new_root_buf); my_afree((uchar*)new_root_buf);
return -1; return -1;
} }
default: default:
@ -719,7 +719,7 @@ err1:
0 OK 0 OK
*/ */
int maria_rtree_insert(MARIA_HA *info, uint keynr, byte *key, uint key_length) int maria_rtree_insert(MARIA_HA *info, uint keynr, uchar *key, uint key_length)
{ {
return (!key_length || return (!key_length ||
(maria_rtree_insert_level(info, keynr, key, key_length, -1) == -1)) ? (maria_rtree_insert_level(info, keynr, key, key_length, -1) == -1)) ?
@ -741,7 +741,7 @@ static int maria_rtree_fill_reinsert_list(stPageList *ReinsertList, my_off_t pag
if (ReinsertList->n_pages == ReinsertList->m_pages) if (ReinsertList->n_pages == ReinsertList->m_pages)
{ {
ReinsertList->m_pages += REINSERT_BUFFER_INC; ReinsertList->m_pages += REINSERT_BUFFER_INC;
if (!(ReinsertList->pages = (stPageLevel*)my_realloc((gptr)ReinsertList->pages, if (!(ReinsertList->pages = (stPageLevel*)my_realloc((uchar*)ReinsertList->pages,
ReinsertList->m_pages * sizeof(stPageLevel), MYF(MY_ALLOW_ZERO_PTR)))) ReinsertList->m_pages * sizeof(stPageLevel), MYF(MY_ALLOW_ZERO_PTR))))
goto err1; goto err1;
} }
@ -767,7 +767,7 @@ err1:
*/ */
static int maria_rtree_delete_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo, static int maria_rtree_delete_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *key, uchar *key,
uint key_length, my_off_t page, uint key_length, my_off_t page,
uint *page_size, uint *page_size,
stPageList *ReinsertList, int level) stPageList *ReinsertList, int level)
@ -775,9 +775,9 @@ static int maria_rtree_delete_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
ulong i; ulong i;
uint nod_flag; uint nod_flag;
int res; int res;
byte *page_buf, *last, *k; uchar *page_buf, *last, *k;
if (!(page_buf = (byte*) my_alloca((uint)keyinfo->block_length))) if (!(page_buf = (uchar*) my_alloca((uint)keyinfo->block_length)))
{ {
my_errno = HA_ERR_OUT_OF_MEM; my_errno = HA_ERR_OUT_OF_MEM;
return -1; return -1;
@ -878,11 +878,11 @@ static int maria_rtree_delete_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
res = 1; res = 1;
ok: ok:
my_afree((byte*)page_buf); my_afree((uchar*)page_buf);
return res; return res;
err1: err1:
my_afree((byte*)page_buf); my_afree((uchar*)page_buf);
return -1; return -1;
} }
@ -895,7 +895,7 @@ err1:
0 Deleted 0 Deleted
*/ */
int maria_rtree_delete(MARIA_HA *info, uint keynr, byte *key, uint key_length) int maria_rtree_delete(MARIA_HA *info, uint keynr, uchar *key, uint key_length)
{ {
uint page_size; uint page_size;
stPageList ReinsertList; stPageList ReinsertList;
@ -926,9 +926,9 @@ int maria_rtree_delete(MARIA_HA *info, uint keynr, byte *key, uint key_length)
ulong i; ulong i;
for (i = 0; i < ReinsertList.n_pages; ++i) for (i = 0; i < ReinsertList.n_pages; ++i)
{ {
byte *page_buf, *k, *last; uchar *page_buf, *k, *last;
if (!(page_buf = (byte*) my_alloca((uint)keyinfo->block_length))) if (!(page_buf = (uchar*) my_alloca((uint)keyinfo->block_length)))
{ {
my_errno = HA_ERR_OUT_OF_MEM; my_errno = HA_ERR_OUT_OF_MEM;
goto err1; goto err1;
@ -954,7 +954,7 @@ int maria_rtree_delete(MARIA_HA *info, uint keynr, byte *key, uint key_length)
goto err1; goto err1;
} }
if (ReinsertList.pages) if (ReinsertList.pages)
my_free((byte*) ReinsertList.pages, MYF(0)); my_free((uchar*) ReinsertList.pages, MYF(0));
/* check for redundant root (not leaf, 1 child) and eliminate */ /* check for redundant root (not leaf, 1 child) and eliminate */
if ((old_root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR) if ((old_root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR)
@ -997,14 +997,14 @@ err1:
estimated value estimated value
*/ */
ha_rows maria_rtree_estimate(MARIA_HA *info, uint keynr, byte *key, ha_rows maria_rtree_estimate(MARIA_HA *info, uint keynr, uchar *key,
uint key_length, uint flag) uint key_length, uint flag)
{ {
MARIA_KEYDEF *keyinfo = info->s->keyinfo + keynr; MARIA_KEYDEF *keyinfo = info->s->keyinfo + keynr;
my_off_t root; my_off_t root;
uint i = 0; uint i = 0;
uint nod_flag, k_len; uint nod_flag, k_len;
byte *page_buf, *k, *last; uchar *page_buf, *k, *last;
double area = 0; double area = 0;
ha_rows res = 0; ha_rows res = 0;
@ -1013,7 +1013,7 @@ ha_rows maria_rtree_estimate(MARIA_HA *info, uint keynr, byte *key,
if ((root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR) if ((root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR)
return HA_POS_ERROR; return HA_POS_ERROR;
if (!(page_buf= (byte*) my_alloca((uint)keyinfo->block_length))) if (!(page_buf= (uchar*) my_alloca((uint)keyinfo->block_length)))
return HA_POS_ERROR; return HA_POS_ERROR;
if (!_ma_fetch_keypage(info, keyinfo, root, DFLT_INIT_HITS, page_buf, 0)) if (!_ma_fetch_keypage(info, keyinfo, root, DFLT_INIT_HITS, page_buf, 0))
goto err1; goto err1;
@ -1078,7 +1078,7 @@ ha_rows maria_rtree_estimate(MARIA_HA *info, uint keynr, byte *key,
res = HA_POS_ERROR; res = HA_POS_ERROR;
} }
my_afree((byte*)page_buf); my_afree((uchar*)page_buf);
return res; return res;
err1: err1:

View File

@ -26,21 +26,23 @@
#define rt_PAGE_MIN_SIZE(block_length) ((uint)(block_length) / 3) #define rt_PAGE_MIN_SIZE(block_length) ((uint)(block_length) / 3)
int maria_rtree_insert(MARIA_HA *info, uint keynr, byte *key, uint key_length); int maria_rtree_insert(MARIA_HA *info, uint keynr, uchar *key,
int maria_rtree_delete(MARIA_HA *info, uint keynr, byte *key, uint key_length); uint key_length);
int maria_rtree_delete(MARIA_HA *info, uint keynr, uchar *key,
uint key_length);
int maria_rtree_find_first(MARIA_HA *info, uint keynr, byte *key, int maria_rtree_find_first(MARIA_HA *info, uint keynr, uchar *key,
uint key_length, uint search_flag); uint key_length, uint search_flag);
int maria_rtree_find_next(MARIA_HA *info, uint keynr, uint search_flag); int maria_rtree_find_next(MARIA_HA *info, uint keynr, uint search_flag);
int maria_rtree_get_first(MARIA_HA *info, uint keynr, uint key_length); int maria_rtree_get_first(MARIA_HA *info, uint keynr, uint key_length);
int maria_rtree_get_next(MARIA_HA *info, uint keynr, uint key_length); int maria_rtree_get_next(MARIA_HA *info, uint keynr, uint key_length);
ha_rows maria_rtree_estimate(MARIA_HA *info, uint keynr, byte *key, ha_rows maria_rtree_estimate(MARIA_HA *info, uint keynr, uchar *key,
uint key_length, uint flag); uint key_length, uint flag);
int maria_rtree_split_page(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *page, int maria_rtree_split_page(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uchar *page,
byte *key, uint key_length, uchar *key, uint key_length,
my_off_t *new_page_offs); my_off_t *new_page_offs);
#endif /*HAVE_RTREE_KEYS*/ #endif /*HAVE_RTREE_KEYS*/

View File

@ -29,8 +29,8 @@
1 Split 1 Split
*/ */
int maria_rtree_add_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *key, int maria_rtree_add_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uchar *key,
uint key_length, byte *page_buf, my_off_t *new_page) uint key_length, uchar *page_buf, my_off_t *new_page)
{ {
uint page_size = maria_data_on_page(page_buf); uint page_size = maria_data_on_page(page_buf);
uint nod_flag = _ma_test_if_nod(page_buf); uint nod_flag = _ma_test_if_nod(page_buf);
@ -65,11 +65,11 @@ int maria_rtree_add_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *key,
Delete key from the page Delete key from the page
*/ */
int maria_rtree_delete_key(MARIA_HA *info, byte *page_buf, byte *key, int maria_rtree_delete_key(MARIA_HA *info, uchar *page_buf, uchar *key,
uint key_length, uint nod_flag) uint key_length, uint nod_flag)
{ {
uint16 page_size = maria_data_on_page(page_buf); uint16 page_size = maria_data_on_page(page_buf);
byte *key_start; uchar *key_start;
key_start= key - nod_flag; key_start= key - nod_flag;
if (!nod_flag) if (!nod_flag)
@ -88,7 +88,7 @@ int maria_rtree_delete_key(MARIA_HA *info, byte *page_buf, byte *key,
Calculate and store key MBR Calculate and store key MBR
*/ */
int maria_rtree_set_key_mbr(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *key, int maria_rtree_set_key_mbr(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uchar *key,
uint key_length, my_off_t child_page) uint key_length, my_off_t child_page)
{ {
if (!_ma_fetch_keypage(info, keyinfo, child_page, if (!_ma_fetch_keypage(info, keyinfo, child_page,

View File

@ -21,11 +21,11 @@
#ifdef HAVE_RTREE_KEYS #ifdef HAVE_RTREE_KEYS
int maria_rtree_add_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *key, int maria_rtree_add_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uchar *key,
uint key_length, byte *page_buf, my_off_t *new_page); uint key_length, uchar *page_buf, my_off_t *new_page);
int maria_rtree_delete_key(MARIA_HA *info, byte *page, byte *key, int maria_rtree_delete_key(MARIA_HA *info, uchar *page, uchar *key,
uint key_length, uint nod_flag); uint key_length, uint nod_flag);
int maria_rtree_set_key_mbr(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *key, int maria_rtree_set_key_mbr(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uchar *key,
uint key_length, my_off_t child_page); uint key_length, my_off_t child_page);
#endif /*HAVE_RTREE_KEYS*/ #endif /*HAVE_RTREE_KEYS*/

View File

@ -93,7 +93,7 @@
Returns 0 on success. Returns 0 on success.
*/ */
int maria_rtree_key_cmp(HA_KEYSEG *keyseg, byte *b, byte *a, uint key_length, int maria_rtree_key_cmp(HA_KEYSEG *keyseg, uchar *b, uchar *a, uint key_length,
uint nextflag) uint nextflag)
{ {
for (; (int) key_length > 0; keyseg += 2 ) for (; (int) key_length > 0; keyseg += 2 )
@ -153,7 +153,7 @@ int maria_rtree_key_cmp(HA_KEYSEG *keyseg, byte *b, byte *a, uint key_length,
end: end:
if (nextflag & MBR_DATA) if (nextflag & MBR_DATA)
{ {
byte *end = a + keyseg->length; uchar *end = a + keyseg->length;
do do
{ {
if (*a++ != *b++) if (*a++ != *b++)
@ -182,7 +182,7 @@ end:
/* /*
Calculates rectangle volume Calculates rectangle volume
*/ */
double maria_rtree_rect_volume(HA_KEYSEG *keyseg, byte *a, uint key_length) double maria_rtree_rect_volume(HA_KEYSEG *keyseg, uchar *a, uint key_length)
{ {
double res = 1; double res = 1;
for (; (int)key_length > 0; keyseg += 2) for (; (int)key_length > 0; keyseg += 2)
@ -263,7 +263,7 @@ double maria_rtree_rect_volume(HA_KEYSEG *keyseg, byte *a, uint key_length)
Creates an MBR as an array of doubles. Creates an MBR as an array of doubles.
*/ */
int maria_rtree_d_mbr(HA_KEYSEG *keyseg, byte *a, uint key_length, double *res) int maria_rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res)
{ {
for (; (int)key_length > 0; keyseg += 2) for (; (int)key_length > 0; keyseg += 2)
{ {
@ -352,7 +352,7 @@ int maria_rtree_d_mbr(HA_KEYSEG *keyseg, byte *a, uint key_length, double *res)
Result is written to c Result is written to c
*/ */
int maria_rtree_combine_rect(HA_KEYSEG *keyseg, byte* a, byte* b, byte* c, int maria_rtree_combine_rect(HA_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c,
uint key_length) uint key_length)
{ {
for ( ; (int) key_length > 0 ; keyseg += 2) for ( ; (int) key_length > 0 ; keyseg += 2)
@ -443,7 +443,7 @@ int maria_rtree_combine_rect(HA_KEYSEG *keyseg, byte* a, byte* b, byte* c,
/* /*
Calculates overlapping area of two MBRs a & b Calculates overlapping area of two MBRs a & b
*/ */
double maria_rtree_overlapping_area(HA_KEYSEG *keyseg, byte* a, byte* b, double maria_rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b,
uint key_length) uint key_length)
{ {
double res = 1; double res = 1;
@ -528,7 +528,7 @@ double maria_rtree_overlapping_area(HA_KEYSEG *keyseg, byte* a, byte* b,
Calculates MBR_AREA(a+b) - MBR_AREA(a) Calculates MBR_AREA(a+b) - MBR_AREA(a)
*/ */
double maria_rtree_area_increase(HA_KEYSEG *keyseg, byte *a, byte *b, double maria_rtree_area_increase(HA_KEYSEG *keyseg, uchar *a, uchar *b,
uint key_length, double *ab_area) uint key_length, double *ab_area)
{ {
double a_area= 1.0; double a_area= 1.0;
@ -621,7 +621,7 @@ safe_end:
/* /*
Calculates MBR_PERIMETER(a+b) - MBR_PERIMETER(a) Calculates MBR_PERIMETER(a+b) - MBR_PERIMETER(a)
*/ */
double maria_rtree_perimeter_increase(HA_KEYSEG *keyseg, byte* a, byte* b, double maria_rtree_perimeter_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
uint key_length, double *ab_perim) uint key_length, double *ab_perim)
{ {
double a_perim = 0.0; double a_perim = 0.0;
@ -734,14 +734,14 @@ double maria_rtree_perimeter_increase(HA_KEYSEG *keyseg, byte* a, byte* b,
/* /*
Calculates key page total MBR = MBR(key1) + MBR(key2) + ... Calculates key page total MBR = MBR(key1) + MBR(key2) + ...
*/ */
int maria_rtree_page_mbr(MARIA_HA *info, HA_KEYSEG *keyseg, byte *page_buf, int maria_rtree_page_mbr(MARIA_HA *info, HA_KEYSEG *keyseg, uchar *page_buf,
byte *c, uint key_length) uchar *c, uint key_length)
{ {
uint inc = 0; uint inc = 0;
uint k_len = key_length; uint k_len = key_length;
uint nod_flag = _ma_test_if_nod(page_buf); uint nod_flag = _ma_test_if_nod(page_buf);
byte *k; uchar *k;
byte *last = rt_PAGE_END(page_buf); uchar *last = rt_PAGE_END(page_buf);
for (; (int)key_length > 0; keyseg += 2) for (; (int)key_length > 0; keyseg += 2)
{ {

View File

@ -19,20 +19,20 @@
#ifdef HAVE_RTREE_KEYS #ifdef HAVE_RTREE_KEYS
int maria_rtree_key_cmp(HA_KEYSEG *keyseg, byte *a, byte *b, uint key_length, int maria_rtree_key_cmp(HA_KEYSEG *keyseg, uchar *a, uchar *b, uint key_length,
uint nextflag); uint nextflag);
int maria_rtree_combine_rect(HA_KEYSEG *keyseg,byte *, byte *, byte*, int maria_rtree_combine_rect(HA_KEYSEG *keyseg,uchar *, uchar *, uchar*,
uint key_length); uint key_length);
double maria_rtree_rect_volume(HA_KEYSEG *keyseg, byte*, uint key_length); double maria_rtree_rect_volume(HA_KEYSEG *keyseg, uchar*, uint key_length);
int maria_rtree_d_mbr(HA_KEYSEG *keyseg, byte *a, uint key_length, int maria_rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length,
double *res); double *res);
double maria_rtree_overlapping_area(HA_KEYSEG *keyseg, byte *a, byte *b, double maria_rtree_overlapping_area(HA_KEYSEG *keyseg, uchar *a, uchar *b,
uint key_length); uint key_length);
double maria_rtree_area_increase(HA_KEYSEG *keyseg, byte *a, byte *b, double maria_rtree_area_increase(HA_KEYSEG *keyseg, uchar *a, uchar *b,
uint key_length, double *ab_area); uint key_length, double *ab_area);
double maria_rtree_perimeter_increase(HA_KEYSEG *keyseg, byte* a, byte* b, double maria_rtree_perimeter_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
uint key_length, double *ab_perim); uint key_length, double *ab_perim);
int maria_rtree_page_mbr(MARIA_HA *info, HA_KEYSEG *keyseg, byte *page_buf, int maria_rtree_page_mbr(MARIA_HA *info, HA_KEYSEG *keyseg, uchar *page_buf,
byte* c, uint key_length); uchar* c, uint key_length);
#endif /*HAVE_RTREE_KEYS*/ #endif /*HAVE_RTREE_KEYS*/
#endif /* _rt_mbr_h */ #endif /* _rt_mbr_h */

View File

@ -26,7 +26,7 @@ typedef struct
{ {
double square; double square;
int n_node; int n_node;
byte *key; uchar *key;
double *coords; double *coords;
} SplitStruct; } SplitStruct;
@ -247,7 +247,7 @@ static int split_maria_rtree_node(SplitStruct *node, int n_entries,
} }
int maria_rtree_split_page(MARIA_HA *info, MARIA_KEYDEF *keyinfo, int maria_rtree_split_page(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *page, byte *key, uchar *page, uchar *key,
uint key_length, my_off_t *new_page_offs) uint key_length, my_off_t *new_page_offs)
{ {
int n1, n2; /* Number of items in groups */ int n1, n2; /* Number of items in groups */
@ -259,8 +259,8 @@ int maria_rtree_split_page(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
double *next_coord; double *next_coord;
double *old_coord; double *old_coord;
int n_dim; int n_dim;
byte *source_cur, *cur1, *cur2; uchar *source_cur, *cur1, *cur2;
byte *new_page; uchar *new_page;
int err_code= 0; int err_code= 0;
uint nod_flag= _ma_test_if_nod(page); uint nod_flag= _ma_test_if_nod(page);
uint full_length= key_length + (nod_flag ? nod_flag : uint full_length= key_length + (nod_flag ? nod_flag :
@ -304,7 +304,7 @@ int maria_rtree_split_page(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
goto split_err; goto split_err;
} }
if (!(new_page = (byte*) my_alloca((uint)keyinfo->block_length))) if (!(new_page = (uchar*) my_alloca((uint)keyinfo->block_length)))
{ {
err_code= -1; err_code= -1;
goto split_err; goto split_err;
@ -317,7 +317,7 @@ int maria_rtree_split_page(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
n1= n2 = 0; n1= n2 = 0;
for (cur = task; cur < stop; ++cur) for (cur = task; cur < stop; ++cur)
{ {
byte *to; uchar *to;
if (cur->n_node == 1) if (cur->n_node == 1)
{ {
to = cur1; to = cur1;
@ -344,10 +344,10 @@ int maria_rtree_split_page(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
err_code= _ma_write_keypage(info, keyinfo, *new_page_offs, err_code= _ma_write_keypage(info, keyinfo, *new_page_offs,
DFLT_INIT_HITS, new_page); DFLT_INIT_HITS, new_page);
my_afree((byte*)new_page); my_afree((uchar*)new_page);
split_err: split_err:
my_afree((byte*) coord_buf); my_afree((uchar*) coord_buf);
return err_code; return err_code;
} }

View File

@ -45,7 +45,7 @@ int maria_scan_init(register MARIA_HA *info)
# Error code # Error code
*/ */
int maria_scan(MARIA_HA *info, byte *record) int maria_scan(MARIA_HA *info, uchar *record)
{ {
DBUG_ENTER("maria_scan"); DBUG_ENTER("maria_scan");
/* Init all but update-flag */ /* Init all but update-flag */

View File

@ -19,8 +19,8 @@
#include "m_ctype.h" #include "m_ctype.h"
static my_bool _ma_get_prev_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, static my_bool _ma_get_prev_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *page, uchar *page,
byte *key, byte *keypos, uchar *key, uchar *keypos,
uint *return_key_length); uint *return_key_length);
/* Check index */ /* Check index */
@ -55,13 +55,13 @@ int _ma_check_index(MARIA_HA *info, int inx)
*/ */
int _ma_search(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo, int _ma_search(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
byte *key, uint key_len, uint nextflag, register my_off_t pos) uchar *key, uint key_len, uint nextflag, register my_off_t pos)
{ {
my_bool last_key; my_bool last_key;
int error,flag; int error,flag;
uint nod_flag; uint nod_flag;
byte *keypos,*maxpos; uchar *keypos,*maxpos;
byte lastkey[HA_MAX_KEY_BUFF],*buff; uchar lastkey[HA_MAX_KEY_BUFF],*buff;
DBUG_ENTER("_ma_search"); DBUG_ENTER("_ma_search");
DBUG_PRINT("enter",("pos: %lu nextflag: %u lastpos: %lu", DBUG_PRINT("enter",("pos: %lu nextflag: %u lastpos: %lu",
(ulong) pos, nextflag, (ulong) info->cur_row.lastpos)); (ulong) pos, nextflag, (ulong) info->cur_row.lastpos));
@ -119,7 +119,7 @@ int _ma_search(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
} }
if (pos != info->last_keypage) if (pos != info->last_keypage)
{ {
byte *old_buff=buff; uchar *old_buff=buff;
if (!(buff= _ma_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS, if (!(buff= _ma_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,
info->keyread_buff, info->keyread_buff,
test(!(nextflag & SEARCH_SAVE_BUFF))))) test(!(nextflag & SEARCH_SAVE_BUFF)))))
@ -175,9 +175,9 @@ err:
/* ret_pos point to where find or bigger key starts */ /* ret_pos point to where find or bigger key starts */
/* ARGSUSED */ /* ARGSUSED */
int _ma_bin_search(MARIA_HA *info, register MARIA_KEYDEF *keyinfo, byte *page, int _ma_bin_search(MARIA_HA *info, register MARIA_KEYDEF *keyinfo, uchar *page,
byte *key, uint key_len, uint comp_flag, byte **ret_pos, uchar *key, uint key_len, uint comp_flag, uchar **ret_pos,
byte *buff __attribute__((unused)), my_bool *last_key) uchar *buff __attribute__((unused)), my_bool *last_key)
{ {
reg4 int start,mid,end,save_end; reg4 int start,mid,end,save_end;
int flag; int flag;
@ -239,13 +239,13 @@ int _ma_bin_search(MARIA_HA *info, register MARIA_KEYDEF *keyinfo, byte *page,
< 0 Not found. < 0 Not found.
*/ */
int _ma_seq_search(MARIA_HA *info, register MARIA_KEYDEF *keyinfo, byte *page, int _ma_seq_search(MARIA_HA *info, register MARIA_KEYDEF *keyinfo, uchar *page,
byte *key, uint key_len, uint comp_flag, byte **ret_pos, uchar *key, uint key_len, uint comp_flag, uchar **ret_pos,
byte *buff, my_bool *last_key) uchar *buff, my_bool *last_key)
{ {
int flag; int flag;
uint nod_flag,length,not_used[2]; uint nod_flag,length,not_used[2];
byte t_buff[HA_MAX_KEY_BUFF],*end; uchar t_buff[HA_MAX_KEY_BUFF],*end;
DBUG_ENTER("_ma_seq_search"); DBUG_ENTER("_ma_seq_search");
LINT_INIT(flag); LINT_INIT(length); LINT_INIT(flag); LINT_INIT(length);
@ -285,8 +285,8 @@ int _ma_seq_search(MARIA_HA *info, register MARIA_KEYDEF *keyinfo, byte *page,
int _ma_prefix_search(MARIA_HA *info, register MARIA_KEYDEF *keyinfo, int _ma_prefix_search(MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
byte *page, byte *key, uint key_len, uint nextflag, uchar *page, uchar *key, uint key_len, uint nextflag,
byte **ret_pos, byte *buff, my_bool *last_key) uchar **ret_pos, uchar *buff, my_bool *last_key)
{ {
/* /*
my_flag is raw comparison result to be changed according to my_flag is raw comparison result to be changed according to
@ -297,11 +297,11 @@ int _ma_prefix_search(MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
uint nod_flag, length, len, matched, cmplen, kseg_len; uint nod_flag, length, len, matched, cmplen, kseg_len;
uint prefix_len,suffix_len; uint prefix_len,suffix_len;
int key_len_skip, seg_len_pack, key_len_left; int key_len_skip, seg_len_pack, key_len_left;
byte *end; uchar *end;
uchar *kseg, *vseg, *saved_vseg, *saved_from; uchar *kseg, *vseg, *saved_vseg, *saved_from;
uchar *sort_order= keyinfo->seg->charset->sort_order; uchar *sort_order= keyinfo->seg->charset->sort_order;
byte tt_buff[HA_MAX_KEY_BUFF+2], *t_buff=tt_buff+2; uchar tt_buff[HA_MAX_KEY_BUFF+2], *t_buff=tt_buff+2;
byte *saved_to; uchar *saved_to;
uint saved_length=0, saved_prefix_len=0; uint saved_length=0, saved_prefix_len=0;
uint length_pack; uint length_pack;
DBUG_ENTER("_ma_prefix_search"); DBUG_ENTER("_ma_prefix_search");
@ -331,7 +331,7 @@ int _ma_prefix_search(MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
Keys are compressed the following way: Keys are compressed the following way:
If the max length of first key segment <= 127 bytes the prefix is If the max length of first key segment <= 127 bytes the prefix is
1 byte else it's 2 byte 1 uchar else it's 2 byte
(prefix) length The high bit is set if this is a prefix for the prev key. (prefix) length The high bit is set if this is a prefix for the prev key.
[suffix length] Packed length of suffix if the previous was a prefix. [suffix length] Packed length of suffix if the previous was a prefix.
@ -412,7 +412,7 @@ int _ma_prefix_search(MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
from+=l; from+=l;
} }
from+= keyseg->length; from+= keyseg->length;
page= (byte*) from+nod_flag; page= (uchar*) from+nod_flag;
length= (uint) (from-vseg); length= (uint) (from-vseg);
} }
@ -496,7 +496,7 @@ int _ma_prefix_search(MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
/* We have to compare k and vseg as if they were space extended */ /* We have to compare k and vseg as if they were space extended */
for (vseg_end= vseg + (len-cmplen) ; for (vseg_end= vseg + (len-cmplen) ;
vseg < vseg_end && *vseg == (byte) ' '; vseg < vseg_end && *vseg == (uchar) ' ';
vseg++, matched++) ; vseg++, matched++) ;
DBUG_ASSERT(vseg < vseg_end); DBUG_ASSERT(vseg < vseg_end);
@ -552,7 +552,7 @@ int _ma_prefix_search(MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
saved_length=length; saved_length=length;
} }
if (saved_length) if (saved_length)
memcpy(saved_to, (byte*) saved_from, saved_length); memcpy(saved_to, (uchar*) saved_from, saved_length);
*last_key= page == end; *last_key= page == end;
@ -563,7 +563,7 @@ int _ma_prefix_search(MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
/* Get pos to a key_block */ /* Get pos to a key_block */
my_off_t _ma_kpos(uint nod_flag, byte *after_key) my_off_t _ma_kpos(uint nod_flag, uchar *after_key)
{ {
after_key-=nod_flag; after_key-=nod_flag;
switch (nod_flag) { switch (nod_flag) {
@ -599,7 +599,7 @@ my_off_t _ma_kpos(uint nod_flag, byte *after_key)
/* Save pos to a key_block */ /* Save pos to a key_block */
void _ma_kpointer(register MARIA_HA *info, register byte *buff, my_off_t pos) void _ma_kpointer(register MARIA_HA *info, register uchar *buff, my_off_t pos)
{ {
pos/=MARIA_MIN_KEY_BLOCK_LENGTH; pos/=MARIA_MIN_KEY_BLOCK_LENGTH;
switch (info->s->base.key_reflength) { switch (info->s->base.key_reflength) {
@ -618,7 +618,7 @@ void _ma_kpointer(register MARIA_HA *info, register byte *buff, my_off_t pos)
case 4: mi_int4store(buff,pos); break; case 4: mi_int4store(buff,pos); break;
case 3: mi_int3store(buff,pos); break; case 3: mi_int3store(buff,pos); break;
case 2: mi_int2store(buff,(uint) pos); break; case 2: mi_int2store(buff,(uint) pos); break;
case 1: buff[0]= (byte) pos; break; case 1: buff[0]= (uchar) pos; break;
default: abort(); /* impossible */ default: abort(); /* impossible */
} }
} /* _ma_kpointer */ } /* _ma_kpointer */
@ -627,7 +627,7 @@ void _ma_kpointer(register MARIA_HA *info, register byte *buff, my_off_t pos)
/* Calc pos to a data-record from a key */ /* Calc pos to a data-record from a key */
my_off_t _ma_dpos(MARIA_HA *info, uint nod_flag, const byte *after_key) my_off_t _ma_dpos(MARIA_HA *info, uint nod_flag, const uchar *after_key)
{ {
my_off_t pos; my_off_t pos;
after_key-=(nod_flag + info->s->rec_reflength); after_key-=(nod_flag + info->s->rec_reflength);
@ -656,7 +656,7 @@ my_off_t _ma_dpos(MARIA_HA *info, uint nod_flag, const byte *after_key)
/* Calc position from a record pointer ( in delete link chain ) */ /* Calc position from a record pointer ( in delete link chain ) */
my_off_t _ma_rec_pos(MARIA_SHARE *s, byte *ptr) my_off_t _ma_rec_pos(MARIA_SHARE *s, uchar *ptr)
{ {
my_off_t pos; my_off_t pos;
switch (s->rec_reflength) { switch (s->rec_reflength) {
@ -713,7 +713,7 @@ my_off_t _ma_rec_pos(MARIA_SHARE *s, byte *ptr)
/* save position to record */ /* save position to record */
void _ma_dpointer(MARIA_HA *info, byte *buff, my_off_t pos) void _ma_dpointer(MARIA_HA *info, uchar *buff, my_off_t pos)
{ {
if (info->s->data_file_type == STATIC_RECORD && if (info->s->data_file_type == STATIC_RECORD &&
pos != HA_OFFSET_ERROR) pos != HA_OFFSET_ERROR)
@ -752,9 +752,9 @@ void _ma_dpointer(MARIA_HA *info, byte *buff, my_off_t pos)
/* same as _ma_get_key but used with fixed length keys */ /* same as _ma_get_key but used with fixed length keys */
uint _ma_get_static_key(register MARIA_KEYDEF *keyinfo, uint nod_flag, uint _ma_get_static_key(register MARIA_KEYDEF *keyinfo, uint nod_flag,
register byte **page, register byte *key) register uchar **page, register uchar *key)
{ {
memcpy((byte*) key,(byte*) *page, memcpy((uchar*) key,(uchar*) *page,
(size_t) (keyinfo->keylength+nod_flag)); (size_t) (keyinfo->keylength+nod_flag));
*page+=keyinfo->keylength+nod_flag; *page+=keyinfo->keylength+nod_flag;
return(keyinfo->keylength); return(keyinfo->keylength);
@ -776,10 +776,10 @@ uint _ma_get_static_key(register MARIA_KEYDEF *keyinfo, uint nod_flag,
*/ */
uint _ma_get_pack_key(register MARIA_KEYDEF *keyinfo, uint nod_flag, uint _ma_get_pack_key(register MARIA_KEYDEF *keyinfo, uint nod_flag,
register byte **page_pos, register byte *key) register uchar **page_pos, register uchar *key)
{ {
reg1 HA_KEYSEG *keyseg; reg1 HA_KEYSEG *keyseg;
byte *start_key,*page=*page_pos; uchar *start_key,*page=*page_pos;
uint length; uint length;
start_key=key; start_key=key;
@ -788,7 +788,7 @@ uint _ma_get_pack_key(register MARIA_KEYDEF *keyinfo, uint nod_flag,
if (keyseg->flag & HA_PACK_KEY) if (keyseg->flag & HA_PACK_KEY)
{ {
/* key with length, packed to previous key */ /* key with length, packed to previous key */
byte *start= key; uchar *start= key;
uint packed= *page & 128,tot_length,rest_length; uint packed= *page & 128,tot_length,rest_length;
if (keyseg->length >= 127) if (keyseg->length >= 127)
{ {
@ -891,19 +891,19 @@ uint _ma_get_pack_key(register MARIA_KEYDEF *keyinfo, uint nod_flag,
if (keyseg->flag & if (keyseg->flag &
(HA_VAR_LENGTH_PART | HA_BLOB_PART | HA_SPACE_PACK)) (HA_VAR_LENGTH_PART | HA_BLOB_PART | HA_SPACE_PACK))
{ {
byte *tmp=page; uchar *tmp=page;
get_key_length(length,tmp); get_key_length(length,tmp);
length+=(uint) (tmp-page); length+=(uint) (tmp-page);
} }
else else
length=keyseg->length; length=keyseg->length;
} }
memcpy((byte*) key,(byte*) page,(size_t) length); memcpy((uchar*) key,(uchar*) page,(size_t) length);
key+=length; key+=length;
page+=length; page+=length;
} }
length=keyseg->length+nod_flag; length=keyseg->length+nod_flag;
bmove((byte*) key,(byte*) page,length); bmove((uchar*) key,(uchar*) page,length);
*page_pos= page+length; *page_pos= page+length;
return ((uint) (key-start_key)+keyseg->length); return ((uint) (key-start_key)+keyseg->length);
} /* _ma_get_pack_key */ } /* _ma_get_pack_key */
@ -913,10 +913,10 @@ uint _ma_get_pack_key(register MARIA_KEYDEF *keyinfo, uint nod_flag,
/* key that is packed relatively to previous */ /* key that is packed relatively to previous */
uint _ma_get_binary_pack_key(register MARIA_KEYDEF *keyinfo, uint nod_flag, uint _ma_get_binary_pack_key(register MARIA_KEYDEF *keyinfo, uint nod_flag,
register byte **page_pos, register byte *key) register uchar **page_pos, register uchar *key)
{ {
reg1 HA_KEYSEG *keyseg; reg1 HA_KEYSEG *keyseg;
byte *start_key,*page,*page_end,*from,*from_end; uchar *start_key,*page,*page_end,*from,*from_end;
uint length,tmp; uint length,tmp;
DBUG_ENTER("_ma_get_binary_pack_key"); DBUG_ENTER("_ma_get_binary_pack_key");
@ -990,7 +990,7 @@ uint _ma_get_binary_pack_key(register MARIA_KEYDEF *keyinfo, uint nod_flag,
DBUG_ASSERT((int) length >= 0); DBUG_ASSERT((int) length >= 0);
DBUG_PRINT("info",("key: 0x%lx from: 0x%lx length: %u", DBUG_PRINT("info",("key: 0x%lx from: 0x%lx length: %u",
(long) key, (long) from, length)); (long) key, (long) from, length));
memmove((byte*) key, (byte*) from, (size_t) length); memmove((uchar*) key, (uchar*) from, (size_t) length);
key+=length; key+=length;
from+=length; from+=length;
} }
@ -1009,7 +1009,7 @@ uint _ma_get_binary_pack_key(register MARIA_KEYDEF *keyinfo, uint nod_flag,
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
DBUG_RETURN(0); /* Error */ DBUG_RETURN(0); /* Error */
} }
memcpy((byte*) key,(byte*) from,(size_t) length); memcpy((uchar*) key,(uchar*) from,(size_t) length);
*page_pos= from+length; *page_pos= from+length;
} }
DBUG_RETURN((uint) (key-start_key)+keyseg->length); DBUG_RETURN((uint) (key-start_key)+keyseg->length);
@ -1019,8 +1019,8 @@ uint _ma_get_binary_pack_key(register MARIA_KEYDEF *keyinfo, uint nod_flag,
/* Get key at position without knowledge of previous key */ /* Get key at position without knowledge of previous key */
/* Returns pointer to next key */ /* Returns pointer to next key */
byte *_ma_get_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *page, uchar *_ma_get_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uchar *page,
byte *key, byte *keypos, uint *return_key_length) uchar *key, uchar *keypos, uint *return_key_length)
{ {
uint nod_flag; uint nod_flag;
DBUG_ENTER("_ma_get_key"); DBUG_ENTER("_ma_get_key");
@ -1028,7 +1028,7 @@ byte *_ma_get_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *page,
nod_flag=_ma_test_if_nod(page); nod_flag=_ma_test_if_nod(page);
if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY))) if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY)))
{ {
bmove((byte*) key,(byte*) keypos,keyinfo->keylength+nod_flag); bmove((uchar*) key,(uchar*) keypos,keyinfo->keylength+nod_flag);
DBUG_RETURN(keypos+keyinfo->keylength+nod_flag); DBUG_RETURN(keypos+keyinfo->keylength+nod_flag);
} }
else else
@ -1056,7 +1056,7 @@ byte *_ma_get_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *page,
/* Returns 0 if ok */ /* Returns 0 if ok */
static my_bool _ma_get_prev_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, static my_bool _ma_get_prev_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *page, byte *key, byte *keypos, uchar *page, uchar *key, uchar *keypos,
uint *return_key_length) uint *return_key_length)
{ {
uint nod_flag; uint nod_flag;
@ -1066,7 +1066,7 @@ static my_bool _ma_get_prev_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY))) if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY)))
{ {
*return_key_length=keyinfo->keylength; *return_key_length=keyinfo->keylength;
bmove((byte*) key,(byte*) keypos- *return_key_length-nod_flag, bmove((uchar*) key,(uchar*) keypos- *return_key_length-nod_flag,
*return_key_length); *return_key_length);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -1093,11 +1093,11 @@ static my_bool _ma_get_prev_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
/* Get last key from key-page */ /* Get last key from key-page */
/* Return pointer to where key starts */ /* Return pointer to where key starts */
byte *_ma_get_last_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *page, uchar *_ma_get_last_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uchar *page,
byte *lastkey, byte *endpos, uint *return_key_length) uchar *lastkey, uchar *endpos, uint *return_key_length)
{ {
uint nod_flag; uint nod_flag;
byte *lastpos; uchar *lastpos;
DBUG_ENTER("_ma_get_last_key"); DBUG_ENTER("_ma_get_last_key");
DBUG_PRINT("enter",("page: 0x%lx endpos: 0x%lx", (long) page, DBUG_PRINT("enter",("page: 0x%lx endpos: 0x%lx", (long) page,
(long) endpos)); (long) endpos));
@ -1108,7 +1108,7 @@ byte *_ma_get_last_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *page,
lastpos=endpos-keyinfo->keylength-nod_flag; lastpos=endpos-keyinfo->keylength-nod_flag;
*return_key_length=keyinfo->keylength; *return_key_length=keyinfo->keylength;
if (lastpos > page) if (lastpos > page)
bmove((byte*) lastkey,(byte*) lastpos,keyinfo->keylength+nod_flag); bmove((uchar*) lastkey,(uchar*) lastpos,keyinfo->keylength+nod_flag);
} }
else else
{ {
@ -1136,10 +1136,10 @@ byte *_ma_get_last_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *page,
/* Calculate length of key */ /* Calculate length of key */
uint _ma_keylength(MARIA_KEYDEF *keyinfo, register const byte *key) uint _ma_keylength(MARIA_KEYDEF *keyinfo, register const uchar *key)
{ {
reg1 HA_KEYSEG *keyseg; reg1 HA_KEYSEG *keyseg;
const byte *start; const uchar *start;
if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY))) if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY)))
return (keyinfo->keylength); return (keyinfo->keylength);
@ -1171,11 +1171,11 @@ uint _ma_keylength(MARIA_KEYDEF *keyinfo, register const byte *key)
after '0xDF' but find 'ss' after '0xDF' but find 'ss'
*/ */
uint _ma_keylength_part(MARIA_KEYDEF *keyinfo, register const byte *key, uint _ma_keylength_part(MARIA_KEYDEF *keyinfo, register const uchar *key,
HA_KEYSEG *end) HA_KEYSEG *end)
{ {
reg1 HA_KEYSEG *keyseg; reg1 HA_KEYSEG *keyseg;
const byte *start= key; const uchar *start= key;
for (keyseg=keyinfo->seg ; keyseg != end ; keyseg++) for (keyseg=keyinfo->seg ; keyseg != end ; keyseg++)
{ {
@ -1197,7 +1197,7 @@ uint _ma_keylength_part(MARIA_KEYDEF *keyinfo, register const byte *key,
/* Move a key */ /* Move a key */
byte *_ma_move_key(MARIA_KEYDEF *keyinfo, byte *to, const byte *from) uchar *_ma_move_key(MARIA_KEYDEF *keyinfo, uchar *to, const uchar *from)
{ {
reg1 uint length; reg1 uint length;
memcpy(to, from, (size_t) (length= _ma_keylength(keyinfo, from))); memcpy(to, from, (size_t) (length= _ma_keylength(keyinfo, from)));
@ -1213,11 +1213,11 @@ byte *_ma_move_key(MARIA_KEYDEF *keyinfo, byte *to, const byte *from)
*/ */
int _ma_search_next(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo, int _ma_search_next(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
byte *key, uint key_length, uint nextflag, my_off_t pos) uchar *key, uint key_length, uint nextflag, my_off_t pos)
{ {
int error; int error;
uint nod_flag; uint nod_flag;
byte lastkey[HA_MAX_KEY_BUFF]; uchar lastkey[HA_MAX_KEY_BUFF];
DBUG_ENTER("_ma_search_next"); DBUG_ENTER("_ma_search_next");
DBUG_PRINT("enter",("nextflag: %u lastpos: %lu int_keypos: %lu page_changed %d keyread_buff_used: %d", DBUG_PRINT("enter",("nextflag: %u lastpos: %lu int_keypos: %lu page_changed %d keyread_buff_used: %d",
nextflag, (ulong) info->cur_row.lastpos, nextflag, (ulong) info->cur_row.lastpos,
@ -1299,7 +1299,7 @@ int _ma_search_first(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
register my_off_t pos) register my_off_t pos)
{ {
uint nod_flag; uint nod_flag;
byte *page; uchar *page;
DBUG_ENTER("_ma_search_first"); DBUG_ENTER("_ma_search_first");
if (pos == HA_OFFSET_ERROR) if (pos == HA_OFFSET_ERROR)
@ -1343,7 +1343,7 @@ int _ma_search_last(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
register my_off_t pos) register my_off_t pos)
{ {
uint nod_flag; uint nod_flag;
byte *buff,*page; uchar *buff,*page;
DBUG_ENTER("_ma_search_last"); DBUG_ENTER("_ma_search_last");
if (pos == HA_OFFSET_ERROR) if (pos == HA_OFFSET_ERROR)
@ -1398,10 +1398,10 @@ int _ma_search_last(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
int int
_ma_calc_static_key_length(MARIA_KEYDEF *keyinfo,uint nod_flag, _ma_calc_static_key_length(MARIA_KEYDEF *keyinfo,uint nod_flag,
byte *next_pos __attribute__((unused)), uchar *next_pos __attribute__((unused)),
byte *org_key __attribute__((unused)), uchar *org_key __attribute__((unused)),
byte *prev_key __attribute__((unused)), uchar *prev_key __attribute__((unused)),
const byte *key, MARIA_KEY_PARAM *s_temp) const uchar *key, MARIA_KEY_PARAM *s_temp)
{ {
s_temp->key= key; s_temp->key= key;
return (int) (s_temp->totlength=keyinfo->keylength+nod_flag); return (int) (s_temp->totlength=keyinfo->keylength+nod_flag);
@ -1411,10 +1411,10 @@ _ma_calc_static_key_length(MARIA_KEYDEF *keyinfo,uint nod_flag,
int int
_ma_calc_var_key_length(MARIA_KEYDEF *keyinfo,uint nod_flag, _ma_calc_var_key_length(MARIA_KEYDEF *keyinfo,uint nod_flag,
byte *next_pos __attribute__((unused)), uchar *next_pos __attribute__((unused)),
byte *org_key __attribute__((unused)), uchar *org_key __attribute__((unused)),
byte *prev_key __attribute__((unused)), uchar *prev_key __attribute__((unused)),
const byte *key, MARIA_KEY_PARAM *s_temp) const uchar *key, MARIA_KEY_PARAM *s_temp)
{ {
s_temp->key= key; s_temp->key= key;
return (int) (s_temp->totlength= _ma_keylength(keyinfo,key)+nod_flag); return (int) (s_temp->totlength= _ma_keylength(keyinfo,key)+nod_flag);
@ -1427,7 +1427,7 @@ _ma_calc_var_key_length(MARIA_KEYDEF *keyinfo,uint nod_flag,
Keys are compressed the following way: Keys are compressed the following way:
If the max length of first key segment <= 127 bytes the prefix is If the max length of first key segment <= 127 bytes the prefix is
1 byte else it's 2 byte 1 uchar else it's 2 byte
prefix byte(s) The high bit is set if this is a prefix for the prev key prefix byte(s) The high bit is set if this is a prefix for the prev key
length Packed length if the previous was a prefix byte length Packed length if the previous was a prefix byte
@ -1441,15 +1441,15 @@ _ma_calc_var_key_length(MARIA_KEYDEF *keyinfo,uint nod_flag,
int int
_ma_calc_var_pack_key_length(MARIA_KEYDEF *keyinfo, uint nod_flag, _ma_calc_var_pack_key_length(MARIA_KEYDEF *keyinfo, uint nod_flag,
byte *next_key, uchar *next_key,
byte *org_key, byte *prev_key, const byte *key, uchar *org_key, uchar *prev_key, const uchar *key,
MARIA_KEY_PARAM *s_temp) MARIA_KEY_PARAM *s_temp)
{ {
reg1 HA_KEYSEG *keyseg; reg1 HA_KEYSEG *keyseg;
int length; int length;
uint key_length,ref_length,org_key_length=0, uint key_length,ref_length,org_key_length=0,
length_pack,new_key_length,diff_flag,pack_marker; length_pack,new_key_length,diff_flag,pack_marker;
const byte *start,*end,*key_end; const uchar *start,*end,*key_end;
uchar *sort_order; uchar *sort_order;
bool same_length; bool same_length;
@ -1726,9 +1726,9 @@ _ma_calc_var_pack_key_length(MARIA_KEYDEF *keyinfo, uint nod_flag,
/* Length of key which is prefix compressed */ /* Length of key which is prefix compressed */
int _ma_calc_bin_pack_key_length(MARIA_KEYDEF *keyinfo, uint nod_flag, int _ma_calc_bin_pack_key_length(MARIA_KEYDEF *keyinfo, uint nod_flag,
byte *next_key, uchar *next_key,
byte *org_key, byte *prev_key, uchar *org_key, uchar *prev_key,
const byte *key, const uchar *key,
MARIA_KEY_PARAM *s_temp) MARIA_KEY_PARAM *s_temp)
{ {
uint length,key_length,ref_length; uint length,key_length,ref_length;
@ -1746,7 +1746,7 @@ int _ma_calc_bin_pack_key_length(MARIA_KEYDEF *keyinfo, uint nod_flag,
As keys may be identical when running a sort in maria_chk, we As keys may be identical when running a sort in maria_chk, we
have to guard against the case where keys may be identical have to guard against the case where keys may be identical
*/ */
const byte *end; const uchar *end;
end=key+key_length; end=key+key_length;
for ( ; *key == *prev_key && key < end; key++,prev_key++) ; for ( ; *key == *prev_key && key < end; key++,prev_key++) ;
s_temp->ref_length= ref_length=(uint) (key-s_temp->key); s_temp->ref_length= ref_length=(uint) (key-s_temp->key);
@ -1767,7 +1767,7 @@ int _ma_calc_bin_pack_key_length(MARIA_KEYDEF *keyinfo, uint nod_flag,
/* If first key and next key is packed (only on delete) */ /* If first key and next key is packed (only on delete) */
if (!prev_key && org_key && next_length) if (!prev_key && org_key && next_length)
{ {
const byte *end; const uchar *end;
for (key= s_temp->key, end=key+next_length ; for (key= s_temp->key, end=key+next_length ;
*key == *org_key && key < end; *key == *org_key && key < end;
key++,org_key++) ; key++,org_key++) ;
@ -1809,10 +1809,10 @@ int _ma_calc_bin_pack_key_length(MARIA_KEYDEF *keyinfo, uint nod_flag,
/* store key without compression */ /* store key without compression */
void _ma_store_static_key(MARIA_KEYDEF *keyinfo __attribute__((unused)), void _ma_store_static_key(MARIA_KEYDEF *keyinfo __attribute__((unused)),
register byte *key_pos, register uchar *key_pos,
register MARIA_KEY_PARAM *s_temp) register MARIA_KEY_PARAM *s_temp)
{ {
memcpy((byte*) key_pos,(byte*) s_temp->key,(size_t) s_temp->totlength); memcpy((uchar*) key_pos,(uchar*) s_temp->key,(size_t) s_temp->totlength);
} }
@ -1824,11 +1824,11 @@ void _ma_store_static_key(MARIA_KEYDEF *keyinfo __attribute__((unused)),
void _ma_store_var_pack_key(MARIA_KEYDEF *keyinfo __attribute__((unused)), void _ma_store_var_pack_key(MARIA_KEYDEF *keyinfo __attribute__((unused)),
register byte *key_pos, register uchar *key_pos,
register MARIA_KEY_PARAM *s_temp) register MARIA_KEY_PARAM *s_temp)
{ {
uint length; uint length;
byte *start; uchar *start;
start=key_pos; start=key_pos;
@ -1845,7 +1845,7 @@ void _ma_store_var_pack_key(MARIA_KEYDEF *keyinfo __attribute__((unused)),
/* Not packed against previous key */ /* Not packed against previous key */
store_pack_length(s_temp->pack_marker == 128,key_pos,s_temp->key_length); store_pack_length(s_temp->pack_marker == 128,key_pos,s_temp->key_length);
} }
bmove((byte*) key_pos,(byte*) s_temp->key, bmove((uchar*) key_pos,(uchar*) s_temp->key,
(length=s_temp->totlength-(uint) (key_pos-start))); (length=s_temp->totlength-(uint) (key_pos-start)));
if (!s_temp->next_key_pos) /* No following key */ if (!s_temp->next_key_pos) /* No following key */
@ -1887,7 +1887,7 @@ void _ma_store_var_pack_key(MARIA_KEYDEF *keyinfo __attribute__((unused)),
/* variable length key with prefix compression */ /* variable length key with prefix compression */
void _ma_store_bin_pack_key(MARIA_KEYDEF *keyinfo __attribute__((unused)), void _ma_store_bin_pack_key(MARIA_KEYDEF *keyinfo __attribute__((unused)),
register byte *key_pos, register uchar *key_pos,
register MARIA_KEY_PARAM *s_temp) register MARIA_KEY_PARAM *s_temp)
{ {
store_key_length_inc(key_pos,s_temp->ref_length); store_key_length_inc(key_pos,s_temp->ref_length);

View File

@ -48,31 +48,31 @@ extern void print_error _VARARGS((const char *fmt,...));
/* Functions defined in this file */ /* Functions defined in this file */
static ha_rows NEAR_F find_all_keys(MARIA_SORT_PARAM *info,uint keys, static ha_rows NEAR_F find_all_keys(MARIA_SORT_PARAM *info,uint keys,
byte **sort_keys, uchar **sort_keys,
DYNAMIC_ARRAY *buffpek,int *maxbuffer, DYNAMIC_ARRAY *buffpek,int *maxbuffer,
IO_CACHE *tempfile, IO_CACHE *tempfile,
IO_CACHE *tempfile_for_exceptions); IO_CACHE *tempfile_for_exceptions);
static int NEAR_F write_keys(MARIA_SORT_PARAM *info, byte **sort_keys, static int NEAR_F write_keys(MARIA_SORT_PARAM *info, uchar **sort_keys,
uint count, BUFFPEK *buffpek,IO_CACHE *tempfile); uint count, BUFFPEK *buffpek,IO_CACHE *tempfile);
static int NEAR_F write_key(MARIA_SORT_PARAM *info, byte *key, static int NEAR_F write_key(MARIA_SORT_PARAM *info, uchar *key,
IO_CACHE *tempfile); IO_CACHE *tempfile);
static int NEAR_F write_index(MARIA_SORT_PARAM *info, byte **sort_keys, static int NEAR_F write_index(MARIA_SORT_PARAM *info, uchar **sort_keys,
uint count); uint count);
static int NEAR_F merge_many_buff(MARIA_SORT_PARAM *info,uint keys, static int NEAR_F merge_many_buff(MARIA_SORT_PARAM *info,uint keys,
byte **sort_keys, uchar **sort_keys,
BUFFPEK *buffpek,int *maxbuffer, BUFFPEK *buffpek,int *maxbuffer,
IO_CACHE *t_file); IO_CACHE *t_file);
static uint NEAR_F read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek, static uint NEAR_F read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek,
uint sort_length); uint sort_length);
static int NEAR_F merge_buffers(MARIA_SORT_PARAM *info,uint keys, static int NEAR_F merge_buffers(MARIA_SORT_PARAM *info,uint keys,
IO_CACHE *from_file, IO_CACHE *to_file, IO_CACHE *from_file, IO_CACHE *to_file,
byte **sort_keys, BUFFPEK *lastbuff, uchar **sort_keys, BUFFPEK *lastbuff,
BUFFPEK *Fb, BUFFPEK *Tb); BUFFPEK *Fb, BUFFPEK *Tb);
static int NEAR_F merge_index(MARIA_SORT_PARAM *,uint, byte **,BUFFPEK *, int, static int NEAR_F merge_index(MARIA_SORT_PARAM *,uint, uchar **,BUFFPEK *, int,
IO_CACHE *); IO_CACHE *);
static int flush_maria_ft_buf(MARIA_SORT_PARAM *info); static int flush_maria_ft_buf(MARIA_SORT_PARAM *info);
static int NEAR_F write_keys_varlen(MARIA_SORT_PARAM *info, byte **sort_keys, static int NEAR_F write_keys_varlen(MARIA_SORT_PARAM *info, uchar **sort_keys,
uint count, BUFFPEK *buffpek, uint count, BUFFPEK *buffpek,
IO_CACHE *tempfile); IO_CACHE *tempfile);
static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile,BUFFPEK *buffpek, static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile,BUFFPEK *buffpek,
@ -84,7 +84,7 @@ static int NEAR_F write_merge_key_varlen(MARIA_SORT_PARAM *info,
char* key, uint sort_length, char* key, uint sort_length,
uint count); uint count);
static inline int static inline int
my_var_write(MARIA_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs); my_var_write(MARIA_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs);
/* /*
Creates a index of sorted keys Creates a index of sorted keys
@ -107,7 +107,7 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
uint memavl,old_memavl,keys,sort_length; uint memavl,old_memavl,keys,sort_length;
DYNAMIC_ARRAY buffpek; DYNAMIC_ARRAY buffpek;
ha_rows records; ha_rows records;
byte **sort_keys; uchar **sort_keys;
IO_CACHE tempfile, tempfile_for_exceptions; IO_CACHE tempfile, tempfile_for_exceptions;
DBUG_ENTER("_ma_create_index_by_sort"); DBUG_ENTER("_ma_create_index_by_sort");
DBUG_PRINT("enter",("sort_length: %d", info->key_length)); DBUG_PRINT("enter",("sort_length: %d", info->key_length));
@ -128,7 +128,7 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
my_b_clear(&tempfile); my_b_clear(&tempfile);
my_b_clear(&tempfile_for_exceptions); my_b_clear(&tempfile_for_exceptions);
bzero((char*) &buffpek,sizeof(buffpek)); bzero((char*) &buffpek,sizeof(buffpek));
sort_keys= (byte **) NULL; error= 1; sort_keys= (uchar **) NULL; error= 1;
maxbuffer=1; maxbuffer=1;
memavl=max(sortbuff_size,MIN_SORT_MEMORY); memavl=max(sortbuff_size,MIN_SORT_MEMORY);
@ -157,13 +157,13 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
} }
while ((maxbuffer= (int) (records/(keys-1)+1)) != skr); while ((maxbuffer= (int) (records/(keys-1)+1)) != skr);
if ((sort_keys=(byte**) my_malloc(keys*(sort_length+sizeof(char*))+ if ((sort_keys=(uchar**) my_malloc(keys*(sort_length+sizeof(char*))+
HA_FT_MAXBYTELEN, MYF(0)))) HA_FT_MAXBYTELEN, MYF(0))))
{ {
if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer, if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer,
maxbuffer/2)) maxbuffer/2))
{ {
my_free((gptr) sort_keys,MYF(0)); my_free((uchar*) sort_keys,MYF(0));
sort_keys= 0; sort_keys= 0;
} }
else else
@ -230,12 +230,12 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
reinit_io_cache(&tempfile_for_exceptions,READ_CACHE,0L,0,0)) reinit_io_cache(&tempfile_for_exceptions,READ_CACHE,0L,0,0))
goto err; goto err;
while (!my_b_read(&tempfile_for_exceptions,(byte*)&key_length, while (!my_b_read(&tempfile_for_exceptions,(uchar*)&key_length,
sizeof(key_length)) sizeof(key_length))
&& !my_b_read(&tempfile_for_exceptions,(byte*)sort_keys, && !my_b_read(&tempfile_for_exceptions,(uchar*)sort_keys,
(uint) key_length)) (uint) key_length))
{ {
if (_ma_ck_write(idx,keyno,(byte*) sort_keys,key_length-ref_length)) if (_ma_ck_write(idx,keyno,(uchar*) sort_keys,key_length-ref_length))
goto err; goto err;
} }
} }
@ -244,7 +244,7 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
err: err:
if (sort_keys) if (sort_keys)
my_free((gptr) sort_keys,MYF(0)); my_free((uchar*) sort_keys,MYF(0));
delete_dynamic(&buffpek); delete_dynamic(&buffpek);
close_cached_file(&tempfile); close_cached_file(&tempfile);
close_cached_file(&tempfile_for_exceptions); close_cached_file(&tempfile_for_exceptions);
@ -256,7 +256,7 @@ err:
/* Search after all keys and place them in a temp. file */ /* Search after all keys and place them in a temp. file */
static ha_rows NEAR_F find_all_keys(MARIA_SORT_PARAM *info, uint keys, static ha_rows NEAR_F find_all_keys(MARIA_SORT_PARAM *info, uint keys,
byte **sort_keys, DYNAMIC_ARRAY *buffpek, uchar **sort_keys, DYNAMIC_ARRAY *buffpek,
int *maxbuffer, IO_CACHE *tempfile, int *maxbuffer, IO_CACHE *tempfile,
IO_CACHE *tempfile_for_exceptions) IO_CACHE *tempfile_for_exceptions)
{ {
@ -265,7 +265,7 @@ static ha_rows NEAR_F find_all_keys(MARIA_SORT_PARAM *info, uint keys,
DBUG_ENTER("find_all_keys"); DBUG_ENTER("find_all_keys");
idx=error=0; idx=error=0;
sort_keys[0]= (byte*) (sort_keys+keys); sort_keys[0]= (uchar*) (sort_keys+keys);
while (!(error=(*info->key_read)(info,sort_keys[idx]))) while (!(error=(*info->key_read)(info,sort_keys[idx])))
{ {
@ -283,7 +283,7 @@ static ha_rows NEAR_F find_all_keys(MARIA_SORT_PARAM *info, uint keys,
tempfile)) tempfile))
DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */ DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */
sort_keys[0]=(byte*) (sort_keys+keys); sort_keys[0]=(uchar*) (sort_keys+keys);
memcpy(sort_keys[0],sort_keys[idx-1],(size_t) info->key_length); memcpy(sort_keys[0],sort_keys[idx-1],(size_t) info->key_length);
idx=1; idx=1;
} }
@ -314,7 +314,7 @@ pthread_handler_t _ma_thr_find_all_keys(void *arg)
int error; int error;
uint memavl,old_memavl,keys,sort_length; uint memavl,old_memavl,keys,sort_length;
uint idx, maxbuffer; uint idx, maxbuffer;
byte **sort_keys=0; uchar **sort_keys=0;
LINT_INIT(keys); LINT_INIT(keys);
@ -375,7 +375,7 @@ pthread_handler_t _ma_thr_find_all_keys(void *arg)
} }
while ((maxbuffer= (int) (idx/(keys-1)+1)) != skr); while ((maxbuffer= (int) (idx/(keys-1)+1)) != skr);
} }
if ((sort_keys= (byte **) if ((sort_keys= (uchar **)
my_malloc(keys*(sort_length+sizeof(char*))+ my_malloc(keys*(sort_length+sizeof(char*))+
((sort_param->keyinfo->flag & HA_FULLTEXT) ? ((sort_param->keyinfo->flag & HA_FULLTEXT) ?
HA_FT_MAXBYTELEN : 0), MYF(0)))) HA_FT_MAXBYTELEN : 0), MYF(0))))
@ -383,8 +383,8 @@ pthread_handler_t _ma_thr_find_all_keys(void *arg)
if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK), if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK),
maxbuffer, maxbuffer/2)) maxbuffer, maxbuffer/2))
{ {
my_free((gptr) sort_keys,MYF(0)); my_free((uchar*) sort_keys,MYF(0));
sort_keys= (byte **) NULL; /* for err: label */ sort_keys= (uchar **) NULL; /* for err: label */
} }
else else
break; break;
@ -407,7 +407,7 @@ pthread_handler_t _ma_thr_find_all_keys(void *arg)
sort_param->sort_keys= sort_keys; sort_param->sort_keys= sort_keys;
idx= error= 0; idx= error= 0;
sort_keys[0]= (byte*) (sort_keys+keys); sort_keys[0]= (uchar*) (sort_keys+keys);
DBUG_PRINT("info", ("reading keys")); DBUG_PRINT("info", ("reading keys"));
while (!(error= sort_param->sort_info->got_error) && while (!(error= sort_param->sort_info->got_error) &&
@ -428,7 +428,7 @@ pthread_handler_t _ma_thr_find_all_keys(void *arg)
buffpek), buffpek),
&sort_param->tempfile)) &sort_param->tempfile))
goto err; goto err;
sort_keys[0]= (byte*) (sort_keys+keys); sort_keys[0]= (uchar*) (sort_keys+keys);
memcpy(sort_keys[0], sort_keys[idx - 1], memcpy(sort_keys[0], sort_keys[idx - 1],
(size_t) sort_param->key_length); (size_t) sort_param->key_length);
idx= 1; idx= 1;
@ -455,7 +455,7 @@ pthread_handler_t _ma_thr_find_all_keys(void *arg)
err: err:
DBUG_PRINT("error", ("got some error")); DBUG_PRINT("error", ("got some error"));
sort_param->sort_info->got_error= 1; /* no need to protect with a mutex */ sort_param->sort_info->got_error= 1; /* no need to protect with a mutex */
my_free((gptr) sort_keys,MYF(MY_ALLOW_ZERO_PTR)); my_free((uchar*) sort_keys,MYF(MY_ALLOW_ZERO_PTR));
sort_param->sort_keys=0; sort_param->sort_keys=0;
delete_dynamic(& sort_param->buffpek); delete_dynamic(& sort_param->buffpek);
close_cached_file(&sort_param->tempfile); close_cached_file(&sort_param->tempfile);
@ -497,7 +497,7 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param)
MARIA_HA *info=sort_info->info; MARIA_HA *info=sort_info->info;
MARIA_SHARE *share=info->s; MARIA_SHARE *share=info->s;
MARIA_SORT_PARAM *sinfo; MARIA_SORT_PARAM *sinfo;
byte *mergebuf=0; uchar *mergebuf=0;
DBUG_ENTER("_ma_thr_write_keys"); DBUG_ENTER("_ma_thr_write_keys");
LINT_INIT(length); LINT_INIT(length);
@ -532,7 +532,7 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param)
sinfo->notnull: NULL, sinfo->notnull: NULL,
(ulonglong) info->state->records); (ulonglong) info->state->records);
} }
my_free((gptr) sinfo->sort_keys,MYF(0)); my_free((uchar*) sinfo->sort_keys,MYF(0));
my_free(sinfo->rec_buff, MYF(MY_ALLOW_ZERO_PTR)); my_free(sinfo->rec_buff, MYF(MY_ALLOW_ZERO_PTR));
sinfo->sort_keys=0; sinfo->sort_keys=0;
} }
@ -581,7 +581,7 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param)
{ {
if (param->testflag & T_VERBOSE) if (param->testflag & T_VERBOSE)
printf("Key %d - Merging %u keys\n",sinfo->key+1, sinfo->keys); printf("Key %d - Merging %u keys\n",sinfo->key+1, sinfo->keys);
if (merge_many_buff(sinfo, keys, (byte **) mergebuf, if (merge_many_buff(sinfo, keys, (uchar **) mergebuf,
dynamic_element(&sinfo->buffpek, 0, BUFFPEK *), dynamic_element(&sinfo->buffpek, 0, BUFFPEK *),
(int*) &maxbuffer, &sinfo->tempfile)) (int*) &maxbuffer, &sinfo->tempfile))
{ {
@ -597,7 +597,7 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param)
} }
if (param->testflag & T_VERBOSE) if (param->testflag & T_VERBOSE)
printf("Key %d - Last merge and dumping keys\n", sinfo->key+1); printf("Key %d - Last merge and dumping keys\n", sinfo->key+1);
if (merge_index(sinfo, keys, (byte**) mergebuf, if (merge_index(sinfo, keys, (uchar**) mergebuf,
dynamic_element(&sinfo->buffpek,0,BUFFPEK *), dynamic_element(&sinfo->buffpek,0,BUFFPEK *),
maxbuffer,&sinfo->tempfile) || maxbuffer,&sinfo->tempfile) ||
flush_maria_ft_buf(sinfo) || flush_maria_ft_buf(sinfo) ||
@ -622,12 +622,12 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param)
} }
while (!got_error && while (!got_error &&
!my_b_read(&sinfo->tempfile_for_exceptions,(byte*)&key_length, !my_b_read(&sinfo->tempfile_for_exceptions,(uchar*)&key_length,
sizeof(key_length))) sizeof(key_length)))
{ {
byte maria_ft_buf[HA_FT_MAXBYTELEN + HA_FT_WLEN + 10]; uchar maria_ft_buf[HA_FT_MAXBYTELEN + HA_FT_WLEN + 10];
if (key_length > sizeof(maria_ft_buf) || if (key_length > sizeof(maria_ft_buf) ||
my_b_read(&sinfo->tempfile_for_exceptions, (byte*)maria_ft_buf, my_b_read(&sinfo->tempfile_for_exceptions, (uchar*)maria_ft_buf,
(uint)key_length) || (uint)key_length) ||
_ma_ck_write(info, sinfo->key, maria_ft_buf, _ma_ck_write(info, sinfo->key, maria_ft_buf,
key_length - info->s->rec_reflength)) key_length - info->s->rec_reflength))
@ -635,21 +635,21 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param)
} }
} }
} }
my_free((gptr) mergebuf,MYF(MY_ALLOW_ZERO_PTR)); my_free((uchar*) mergebuf,MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN(got_error); DBUG_RETURN(got_error);
} }
#endif /* THREAD */ #endif /* THREAD */
/* Write all keys in memory to file for later merge */ /* Write all keys in memory to file for later merge */
static int write_keys(MARIA_SORT_PARAM *info, register byte **sort_keys, static int write_keys(MARIA_SORT_PARAM *info, register uchar **sort_keys,
uint count, BUFFPEK *buffpek, IO_CACHE *tempfile) uint count, BUFFPEK *buffpek, IO_CACHE *tempfile)
{ {
byte **end; uchar **end;
uint sort_length=info->key_length; uint sort_length=info->key_length;
DBUG_ENTER("write_keys"); DBUG_ENTER("write_keys");
qsort2((byte*) sort_keys,count,sizeof(byte*),(qsort2_cmp) info->key_cmp, qsort2((uchar*) sort_keys,count,sizeof(uchar*),(qsort2_cmp) info->key_cmp,
info); info);
if (!my_b_inited(tempfile) && if (!my_b_inited(tempfile) &&
open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST", open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST",
@ -669,13 +669,13 @@ static int write_keys(MARIA_SORT_PARAM *info, register byte **sort_keys,
static inline int static inline int
my_var_write(MARIA_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs) my_var_write(MARIA_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs)
{ {
int err; int err;
uint16 len= _ma_keylength(info->keyinfo, bufs); uint16 len= _ma_keylength(info->keyinfo, bufs);
/* The following is safe as this is a local file */ /* The following is safe as this is a local file */
if ((err= my_b_write(to_file, (byte*)&len, sizeof(len)))) if ((err= my_b_write(to_file, (uchar*)&len, sizeof(len))))
return (err); return (err);
if ((err= my_b_write(to_file,bufs, (uint) len))) if ((err= my_b_write(to_file,bufs, (uint) len)))
return (err); return (err);
@ -684,15 +684,15 @@ my_var_write(MARIA_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs)
static int NEAR_F write_keys_varlen(MARIA_SORT_PARAM *info, static int NEAR_F write_keys_varlen(MARIA_SORT_PARAM *info,
register byte **sort_keys, register uchar **sort_keys,
uint count, BUFFPEK *buffpek, uint count, BUFFPEK *buffpek,
IO_CACHE *tempfile) IO_CACHE *tempfile)
{ {
byte **end; uchar **end;
int err; int err;
DBUG_ENTER("write_keys_varlen"); DBUG_ENTER("write_keys_varlen");
qsort2((byte*) sort_keys,count,sizeof(byte*),(qsort2_cmp) info->key_cmp, qsort2((uchar*) sort_keys,count,sizeof(uchar*),(qsort2_cmp) info->key_cmp,
info); info);
if (!my_b_inited(tempfile) && if (!my_b_inited(tempfile) &&
open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST", open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST",
@ -710,7 +710,7 @@ static int NEAR_F write_keys_varlen(MARIA_SORT_PARAM *info,
} /* write_keys_varlen */ } /* write_keys_varlen */
static int NEAR_F write_key(MARIA_SORT_PARAM *info, byte *key, static int NEAR_F write_key(MARIA_SORT_PARAM *info, uchar *key,
IO_CACHE *tempfile) IO_CACHE *tempfile)
{ {
uint key_length=info->real_key_length; uint key_length=info->real_key_length;
@ -721,7 +721,7 @@ static int NEAR_F write_key(MARIA_SORT_PARAM *info, byte *key,
DISK_BUFFER_SIZE, info->sort_info->param->myf_rw)) DISK_BUFFER_SIZE, info->sort_info->param->myf_rw))
DBUG_RETURN(1); DBUG_RETURN(1);
if (my_b_write(tempfile, (byte*)&key_length,sizeof(key_length)) || if (my_b_write(tempfile, (uchar*)&key_length,sizeof(key_length)) ||
my_b_write(tempfile, key, (uint) key_length)) my_b_write(tempfile, key, (uint) key_length))
DBUG_RETURN(1); DBUG_RETURN(1);
DBUG_RETURN(0); DBUG_RETURN(0);
@ -731,12 +731,12 @@ static int NEAR_F write_key(MARIA_SORT_PARAM *info, byte *key,
/* Write index */ /* Write index */
static int NEAR_F write_index(MARIA_SORT_PARAM *info, static int NEAR_F write_index(MARIA_SORT_PARAM *info,
register byte **sort_keys, register uchar **sort_keys,
register uint count) register uint count)
{ {
DBUG_ENTER("write_index"); DBUG_ENTER("write_index");
qsort2((gptr) sort_keys,(size_t) count,sizeof(byte*), qsort2((uchar*) sort_keys,(size_t) count,sizeof(uchar*),
(qsort2_cmp) info->key_cmp,info); (qsort2_cmp) info->key_cmp,info);
while (count--) while (count--)
{ {
@ -750,7 +750,7 @@ static int NEAR_F write_index(MARIA_SORT_PARAM *info,
/* Merge buffers to make < MERGEBUFF2 buffers */ /* Merge buffers to make < MERGEBUFF2 buffers */
static int NEAR_F merge_many_buff(MARIA_SORT_PARAM *info, uint keys, static int NEAR_F merge_many_buff(MARIA_SORT_PARAM *info, uint keys,
byte **sort_keys, BUFFPEK *buffpek, uchar **sort_keys, BUFFPEK *buffpek,
int *maxbuffer, IO_CACHE *t_file) int *maxbuffer, IO_CACHE *t_file)
{ {
register int i; register int i;
@ -814,7 +814,7 @@ static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek,
if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count))) if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count)))
{ {
if (my_pread(fromfile->file,(byte*) buffpek->base, if (my_pread(fromfile->file,(uchar*) buffpek->base,
(length= sort_length*count),buffpek->file_pos,MYF_RW)) (length= sort_length*count),buffpek->file_pos,MYF_RW))
return((uint) -1); /* purecov: inspected */ return((uint) -1); /* purecov: inspected */
buffpek->key=buffpek->base; buffpek->key=buffpek->base;
@ -831,7 +831,7 @@ static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek,
register uint count; register uint count;
uint16 length_of_key = 0; uint16 length_of_key = 0;
uint idx; uint idx;
byte *buffp; uchar *buffp;
if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count))) if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count)))
{ {
@ -839,11 +839,11 @@ static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek,
for (idx=1;idx<=count;idx++) for (idx=1;idx<=count;idx++)
{ {
if (my_pread(fromfile->file,(byte*)&length_of_key,sizeof(length_of_key), if (my_pread(fromfile->file,(uchar*)&length_of_key,sizeof(length_of_key),
buffpek->file_pos,MYF_RW)) buffpek->file_pos,MYF_RW))
return((uint) -1); return((uint) -1);
buffpek->file_pos+=sizeof(length_of_key); buffpek->file_pos+=sizeof(length_of_key);
if (my_pread(fromfile->file,(byte*) buffp,length_of_key, if (my_pread(fromfile->file,(uchar*) buffp,length_of_key,
buffpek->file_pos,MYF_RW)) buffpek->file_pos,MYF_RW))
return((uint) -1); return((uint) -1);
buffpek->file_pos+=length_of_key; buffpek->file_pos+=length_of_key;
@ -867,7 +867,7 @@ static int NEAR_F write_merge_key_varlen(MARIA_SORT_PARAM *info,
for (idx=1;idx<=count;idx++) for (idx=1;idx<=count;idx++)
{ {
int err; int err;
if ((err= my_var_write(info,to_file, (byte*) bufs))) if ((err= my_var_write(info,to_file, (uchar*) bufs)))
return (err); return (err);
bufs=bufs+sort_length; bufs=bufs+sort_length;
} }
@ -879,7 +879,7 @@ static int NEAR_F write_merge_key(MARIA_SORT_PARAM *info __attribute__((unused))
IO_CACHE *to_file, char* key, IO_CACHE *to_file, char* key,
uint sort_length, uint count) uint sort_length, uint count)
{ {
return my_b_write(to_file,(byte*) key,(uint) sort_length*count); return my_b_write(to_file,(uchar*) key,(uint) sort_length*count);
} }
/* /*
@ -889,14 +889,14 @@ static int NEAR_F write_merge_key(MARIA_SORT_PARAM *info __attribute__((unused))
static int NEAR_F static int NEAR_F
merge_buffers(MARIA_SORT_PARAM *info, uint keys, IO_CACHE *from_file, merge_buffers(MARIA_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
IO_CACHE *to_file, byte **sort_keys, BUFFPEK *lastbuff, IO_CACHE *to_file, uchar **sort_keys, BUFFPEK *lastbuff,
BUFFPEK *Fb, BUFFPEK *Tb) BUFFPEK *Fb, BUFFPEK *Tb)
{ {
int error; int error;
uint sort_length,maxcount; uint sort_length,maxcount;
ha_rows count; ha_rows count;
my_off_t to_start_filepos; my_off_t to_start_filepos;
byte *strpos; uchar *strpos;
BUFFPEK *buffpek,**refpek; BUFFPEK *buffpek,**refpek;
QUEUE queue; QUEUE queue;
volatile int *killed= _ma_killed_ptr(info->sort_info->param); volatile int *killed= _ma_killed_ptr(info->sort_info->param);
@ -907,11 +907,11 @@ merge_buffers(MARIA_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
LINT_INIT(to_start_filepos); LINT_INIT(to_start_filepos);
if (to_file) if (to_file)
to_start_filepos=my_b_tell(to_file); to_start_filepos=my_b_tell(to_file);
strpos= (byte*) sort_keys; strpos= (uchar*) sort_keys;
sort_length=info->key_length; sort_length=info->key_length;
if (init_queue(&queue,(uint) (Tb-Fb)+1,offsetof(BUFFPEK,key),0, if (init_queue(&queue,(uint) (Tb-Fb)+1,offsetof(BUFFPEK,key),0,
(int (*)(void*, byte *,byte*)) info->key_cmp, (int (*)(void*, uchar *,uchar*)) info->key_cmp,
(void*) info)) (void*) info))
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
@ -938,7 +938,7 @@ merge_buffers(MARIA_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
buffpek=(BUFFPEK*) queue_top(&queue); buffpek=(BUFFPEK*) queue_top(&queue);
if (to_file) if (to_file)
{ {
if (info->write_key(info,to_file,(byte*) buffpek->key, if (info->write_key(info,to_file,(uchar*) buffpek->key,
(uint) sort_length,1)) (uint) sort_length,1))
{ {
error=1; goto err; /* purecov: inspected */ error=1; goto err; /* purecov: inspected */
@ -956,7 +956,7 @@ merge_buffers(MARIA_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
{ {
if (!(error=(int) info->read_to_buffer(from_file,buffpek,sort_length))) if (!(error=(int) info->read_to_buffer(from_file,buffpek,sort_length)))
{ {
byte *base= buffpek->base; uchar *base= buffpek->base;
uint max_keys=buffpek->max_keys; uint max_keys=buffpek->max_keys;
VOID(queue_remove(&queue,0)); VOID(queue_remove(&queue,0));
@ -988,13 +988,13 @@ merge_buffers(MARIA_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
} }
} }
buffpek=(BUFFPEK*) queue_top(&queue); buffpek=(BUFFPEK*) queue_top(&queue);
buffpek->base= (byte*) sort_keys; buffpek->base= (uchar*) sort_keys;
buffpek->max_keys=keys; buffpek->max_keys=keys;
do do
{ {
if (to_file) if (to_file)
{ {
if (info->write_key(info,to_file,(byte*) buffpek->key, if (info->write_key(info,to_file,(uchar*) buffpek->key,
sort_length,buffpek->mem_count)) sort_length,buffpek->mem_count))
{ {
error=1; goto err; /* purecov: inspected */ error=1; goto err; /* purecov: inspected */
@ -1002,13 +1002,13 @@ merge_buffers(MARIA_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
} }
else else
{ {
register byte *end; register uchar *end;
strpos= buffpek->key; strpos= buffpek->key;
for (end= strpos+buffpek->mem_count*sort_length; for (end= strpos+buffpek->mem_count*sort_length;
strpos != end ; strpos != end ;
strpos+=sort_length) strpos+=sort_length)
{ {
if ((*info->key_write)(info, (byte*) strpos)) if ((*info->key_write)(info, (uchar*) strpos))
{ {
error=1; goto err; /* purecov: inspected */ error=1; goto err; /* purecov: inspected */
} }
@ -1030,7 +1030,7 @@ err:
/* Do a merge to output-file (save only positions) */ /* Do a merge to output-file (save only positions) */
static int NEAR_F static int NEAR_F
merge_index(MARIA_SORT_PARAM *info, uint keys, byte **sort_keys, merge_index(MARIA_SORT_PARAM *info, uint keys, uchar **sort_keys,
BUFFPEK *buffpek, int maxbuffer, IO_CACHE *tempfile) BUFFPEK *buffpek, int maxbuffer, IO_CACHE *tempfile)
{ {
DBUG_ENTER("merge_index"); DBUG_ENTER("merge_index");
@ -1047,7 +1047,7 @@ static int flush_maria_ft_buf(MARIA_SORT_PARAM *info)
if (info->sort_info->ft_buf) if (info->sort_info->ft_buf)
{ {
err=_ma_sort_ft_buf_flush(info); err=_ma_sort_ft_buf_flush(info);
my_free((gptr)info->sort_info->ft_buf, MYF(0)); my_free((uchar*)info->sort_info->ft_buf, MYF(0));
info->sort_info->ft_buf=0; info->sort_info->ft_buf=0;
} }
return err; return err;

View File

@ -40,8 +40,8 @@ enum wkbByteOrder
wkbNDR = 1 /* Little Endian */ wkbNDR = 1 /* Little Endian */
}; };
uint _ma_sp_make_key(register MARIA_HA *info, uint keynr, byte *key, uint _ma_sp_make_key(register MARIA_HA *info, uint keynr, uchar *key,
const byte *record, my_off_t filepos); const uchar *record, my_off_t filepos);
#endif /*HAVE_SPATIAL*/ #endif /*HAVE_SPATIAL*/
#endif /* _SP_DEFS_H */ #endif /* _SP_DEFS_H */

View File

@ -31,25 +31,25 @@ static int sp_get_geometry_mbr(uchar *(*wkb), uchar *end, uint n_dims,
double *mbr, int top); double *mbr, int top);
static int sp_mbr_from_wkb(uchar (*wkb), uint size, uint n_dims, double *mbr); static int sp_mbr_from_wkb(uchar (*wkb), uint size, uint n_dims, double *mbr);
static void get_double(double *d, const byte *pos) static void get_double(double *d, const uchar *pos)
{ {
float8get(*d, pos); float8get(*d, pos);
} }
uint _ma_sp_make_key(register MARIA_HA *info, uint keynr, byte *key, uint _ma_sp_make_key(register MARIA_HA *info, uint keynr, uchar *key,
const byte *record, my_off_t filepos) const uchar *record, my_off_t filepos)
{ {
HA_KEYSEG *keyseg; HA_KEYSEG *keyseg;
MARIA_KEYDEF *keyinfo = &info->s->keyinfo[keynr]; MARIA_KEYDEF *keyinfo = &info->s->keyinfo[keynr];
uint len = 0; uint len = 0;
byte *pos; uchar *pos;
uint dlen; uint dlen;
uchar *dptr; uchar *dptr;
double mbr[SPDIMS * 2]; double mbr[SPDIMS * 2];
uint i; uint i;
keyseg = &keyinfo->seg[-1]; keyseg = &keyinfo->seg[-1];
pos = (byte*)record + keyseg->start; pos = (uchar*)record + keyseg->start;
dlen = _ma_calc_blob_length(keyseg->bit_start, pos); dlen = _ma_calc_blob_length(keyseg->bit_start, pos);
memcpy_fixed(&dptr, pos + keyseg->bit_start, sizeof(char*)); memcpy_fixed(&dptr, pos + keyseg->bit_start, sizeof(char*));
@ -64,7 +64,7 @@ uint _ma_sp_make_key(register MARIA_HA *info, uint keynr, byte *key,
{ {
uint length = keyseg->length; uint length = keyseg->length;
pos = ((byte*)mbr) + keyseg->start; pos = ((uchar*)mbr) + keyseg->start;
if (keyseg->flag & HA_SWAP_KEY) if (keyseg->flag & HA_SWAP_KEY)
{ {
#ifdef HAVE_ISNAN #ifdef HAVE_ISNAN
@ -100,7 +100,7 @@ uint _ma_sp_make_key(register MARIA_HA *info, uint keynr, byte *key,
} }
else else
{ {
memcpy((byte*)key, pos, length); memcpy((uchar*)key, pos, length);
key += keyseg->length; key += keyseg->length;
} }
len += keyseg->length; len += keyseg->length;
@ -141,7 +141,7 @@ static int sp_add_point_to_mbr(uchar *(*wkb), uchar *end, uint n_dims,
{ {
if ((*wkb) > end - 8) if ((*wkb) > end - 8)
return -1; return -1;
get_double(&ord, (const byte*) *wkb); get_double(&ord, (const uchar*) *wkb);
(*wkb)+= 8; (*wkb)+= 8;
if (ord < *mbr) if (ord < *mbr)
float8store((char*) mbr, ord); float8store((char*) mbr, ord);

View File

@ -57,7 +57,7 @@ PAGECACHE *maria_log_pagecache= &maria_log_pagecache_var;
TRN dummy_transaction_object; TRN dummy_transaction_object;
/* Enough for comparing if number is zero */ /* Enough for comparing if number is zero */
byte maria_zero_string[]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; uchar maria_zero_string[]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
/* /*
read_vec[] is used for converting between P_READ_KEY.. and SEARCH_ read_vec[] is used for converting between P_READ_KEY.. and SEARCH_

View File

@ -18,9 +18,9 @@
#include "maria_def.h" #include "maria_def.h"
my_bool _ma_write_static_record(MARIA_HA *info, const byte *record) my_bool _ma_write_static_record(MARIA_HA *info, const uchar *record)
{ {
byte temp[8]; /* max pointer length */ uchar temp[8]; /* max pointer length */
if (info->s->state.dellink != HA_OFFSET_ERROR && if (info->s->state.dellink != HA_OFFSET_ERROR &&
!info->append_insert_at_end) !info->append_insert_at_end)
{ {
@ -48,14 +48,14 @@ my_bool _ma_write_static_record(MARIA_HA *info, const byte *record)
} }
if (info->opt_flag & WRITE_CACHE_USED) if (info->opt_flag & WRITE_CACHE_USED)
{ /* Cash in use */ { /* Cash in use */
if (my_b_write(&info->rec_cache, (byte*) record, if (my_b_write(&info->rec_cache, (uchar*) record,
info->s->base.reclength)) info->s->base.reclength))
goto err; goto err;
if (info->s->base.pack_reclength != info->s->base.reclength) if (info->s->base.pack_reclength != info->s->base.reclength)
{ {
uint length=info->s->base.pack_reclength - info->s->base.reclength; uint length=info->s->base.pack_reclength - info->s->base.reclength;
bzero((char*) temp,length); bzero((char*) temp,length);
if (my_b_write(&info->rec_cache, (byte*) temp,length)) if (my_b_write(&info->rec_cache, (uchar*) temp,length))
goto err; goto err;
} }
} }
@ -70,7 +70,7 @@ my_bool _ma_write_static_record(MARIA_HA *info, const byte *record)
{ {
uint length=info->s->base.pack_reclength - info->s->base.reclength; uint length=info->s->base.pack_reclength - info->s->base.reclength;
bzero((char*) temp,length); bzero((char*) temp,length);
if (info->s->file_write(info, (byte*) temp,length, if (info->s->file_write(info, (uchar*) temp,length,
info->state->data_file_length+ info->state->data_file_length+
info->s->base.reclength, info->s->base.reclength,
info->s->write_flag)) info->s->write_flag))
@ -86,8 +86,8 @@ my_bool _ma_write_static_record(MARIA_HA *info, const byte *record)
} }
my_bool _ma_update_static_record(MARIA_HA *info, MARIA_RECORD_POS pos, my_bool _ma_update_static_record(MARIA_HA *info, MARIA_RECORD_POS pos,
const byte *oldrec __attribute__ ((unused)), const uchar *oldrec __attribute__ ((unused)),
const byte *record) const uchar *record)
{ {
info->rec_cache.seek_not_done=1; /* We have done a seek */ info->rec_cache.seek_not_done=1; /* We have done a seek */
return (info->s->file_write(info, return (info->s->file_write(info,
@ -98,9 +98,9 @@ my_bool _ma_update_static_record(MARIA_HA *info, MARIA_RECORD_POS pos,
my_bool _ma_delete_static_record(MARIA_HA *info, my_bool _ma_delete_static_record(MARIA_HA *info,
const byte *record __attribute__ ((unused))) const uchar *record __attribute__ ((unused)))
{ {
byte temp[9]; /* 1+sizeof(uint32) */ uchar temp[9]; /* 1+sizeof(uint32) */
info->state->del++; info->state->del++;
info->state->empty+=info->s->base.pack_reclength; info->state->empty+=info->s->base.pack_reclength;
temp[0]= '\0'; /* Mark that record is deleted */ temp[0]= '\0'; /* Mark that record is deleted */
@ -113,7 +113,7 @@ my_bool _ma_delete_static_record(MARIA_HA *info,
my_bool _ma_cmp_static_record(register MARIA_HA *info, my_bool _ma_cmp_static_record(register MARIA_HA *info,
register const byte *old) register const uchar *old)
{ {
DBUG_ENTER("_ma_cmp_static_record"); DBUG_ENTER("_ma_cmp_static_record");
@ -137,7 +137,7 @@ my_bool _ma_cmp_static_record(register MARIA_HA *info,
info->cur_row.lastpos, info->cur_row.lastpos,
MYF(MY_NABP))) MYF(MY_NABP)))
DBUG_RETURN(1); DBUG_RETURN(1);
if (memcmp((byte*) info->rec_buff, (byte*) old, if (memcmp((uchar*) info->rec_buff, (uchar*) old,
(uint) info->s->base.reclength)) (uint) info->s->base.reclength))
{ {
DBUG_DUMP("read",old,info->s->base.reclength); DBUG_DUMP("read",old,info->s->base.reclength);
@ -151,7 +151,7 @@ my_bool _ma_cmp_static_record(register MARIA_HA *info,
my_bool _ma_cmp_static_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, my_bool _ma_cmp_static_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
const byte *record, MARIA_RECORD_POS pos) const uchar *record, MARIA_RECORD_POS pos)
{ {
DBUG_ENTER("_ma_cmp_static_unique"); DBUG_ENTER("_ma_cmp_static_unique");
@ -159,7 +159,7 @@ my_bool _ma_cmp_static_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
if (info->s->file_read(info, (char*) info->rec_buff, info->s->base.reclength, if (info->s->file_read(info, (char*) info->rec_buff, info->s->base.reclength,
pos, MYF(MY_NABP))) pos, MYF(MY_NABP)))
DBUG_RETURN(1); DBUG_RETURN(1);
DBUG_RETURN(_ma_unique_comp(def, record, (byte*) info->rec_buff, DBUG_RETURN(_ma_unique_comp(def, record, (uchar*) info->rec_buff,
def->null_are_equal)); def->null_are_equal));
} }
@ -173,7 +173,7 @@ my_bool _ma_cmp_static_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
-1 on read-error or locking-error -1 on read-error or locking-error
*/ */
int _ma_read_static_record(register MARIA_HA *info, register byte *record, int _ma_read_static_record(register MARIA_HA *info, register uchar *record,
MARIA_RECORD_POS pos) MARIA_RECORD_POS pos)
{ {
int error; int error;
@ -207,7 +207,7 @@ int _ma_read_static_record(register MARIA_HA *info, register byte *record,
int _ma_read_rnd_static_record(MARIA_HA *info, byte *buf, int _ma_read_rnd_static_record(MARIA_HA *info, uchar *buf,
MARIA_RECORD_POS filepos, MARIA_RECORD_POS filepos,
my_bool skip_deleted_blocks) my_bool skip_deleted_blocks)
{ {
@ -275,11 +275,11 @@ int _ma_read_rnd_static_record(MARIA_HA *info, byte *buf,
} }
/* Read record with cacheing */ /* Read record with cacheing */
error=my_b_read(&info->rec_cache,(byte*) buf,share->base.reclength); error=my_b_read(&info->rec_cache,(uchar*) buf,share->base.reclength);
if (info->s->base.pack_reclength != info->s->base.reclength && !error) if (info->s->base.pack_reclength != info->s->base.reclength && !error)
{ {
char tmp[8]; /* Skill fill bytes */ char tmp[8]; /* Skill fill bytes */
error=my_b_read(&info->rec_cache,(byte*) tmp, error=my_b_read(&info->rec_cache,(uchar*) tmp,
info->s->base.pack_reclength - info->s->base.reclength); info->s->base.pack_reclength - info->s->base.reclength);
} }
if (locked) if (locked)

View File

@ -128,7 +128,7 @@ static int run_test(const char *filename)
} }
keyinfo[0].flag = (uint8) (pack_keys | unique_key); keyinfo[0].flag = (uint8) (pack_keys | unique_key);
bzero((byte*) flags,sizeof(flags)); bzero((uchar*) flags,sizeof(flags));
if (opt_unique) if (opt_unique)
{ {
uint start; uint start;
@ -575,22 +575,22 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
{"delete-rows", 'd', "Abort after this many rows has been deleted", {"delete-rows", 'd', "Abort after this many rows has been deleted",
(gptr*) &remove_count, (gptr*) &remove_count, 0, GET_UINT, REQUIRED_ARG, (uchar**) &remove_count, (uchar**) &remove_count, 0, GET_UINT, REQUIRED_ARG,
1000, 0, 0, 0, 0, 0}, 1000, 0, 0, 0, 0, 0},
{"help", '?', "Display help and exit", {"help", '?', "Display help and exit",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"insert-rows", 'i', "Undocumented", (gptr*) &insert_count, {"insert-rows", 'i', "Undocumented", (uchar**) &insert_count,
(gptr*) &insert_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, (uchar**) &insert_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
{"key-alpha", 'a', "Use a key of type HA_KEYTYPE_TEXT", {"key-alpha", 'a', "Use a key of type HA_KEYTYPE_TEXT",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"key-binary-pack", 'B', "Undocumented", {"key-binary-pack", 'B', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"key-blob", 'b', "Undocumented", {"key-blob", 'b', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"key-cache", 'K', "Undocumented", (gptr*) &pagecacheing, {"key-cache", 'K', "Undocumented", (uchar**) &pagecacheing,
(gptr*) &pagecacheing, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, (uchar**) &pagecacheing, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"key-length", 'k', "Undocumented", (gptr*) &key_length, (gptr*) &key_length, {"key-length", 'k', "Undocumented", (uchar**) &key_length,
0, GET_UINT, REQUIRED_ARG, 6, 0, 0, 0, 0, 0}, (uchar**) &key_length, 0, GET_UINT, REQUIRED_ARG, 6, 0, 0, 0, 0, 0},
{"key-multiple", 'm', "Undocumented", {"key-multiple", 'm', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"key-prefix_pack", 'P', "Undocumented", {"key-prefix_pack", 'P', "Undocumented",
@ -600,29 +600,31 @@ static struct my_option my_long_options[] =
{"key-varchar", 'w', "Test VARCHAR keys", {"key-varchar", 'w', "Test VARCHAR keys",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"null-fields", 'N', "Define fields with NULL", {"null-fields", 'N', "Define fields with NULL",
(gptr*) &null_fields, (gptr*) &null_fields, 0, GET_BOOL, NO_ARG, (uchar**) &null_fields, (uchar**) &null_fields, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"row-fixed-size", 'S', "Fixed size records", {"row-fixed-size", 'S', "Fixed size records",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"rows-in-block", 'M', "Store rows in block format", {"rows-in-block", 'M', "Store rows in block format",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"row-pointer-size", 'R', "Undocumented", (gptr*) &rec_pointer_size, {"row-pointer-size", 'R', "Undocumented", (uchar**) &rec_pointer_size,
(gptr*) &rec_pointer_size, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (uchar**) &rec_pointer_size, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Undocumented", {"silent", 's', "Undocumented",
(gptr*) &silent, (gptr*) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, (uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
{"skip-delete", 'U', "Don't test deletes", (gptr*) &skip_delete, 0, 0},
(gptr*) &skip_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip-delete", 'U', "Don't test deletes", (uchar**) &skip_delete,
{"skip-update", 'D', "Don't test updates", (gptr*) &skip_update, (uchar**) &skip_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
(gptr*) &skip_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip-update", 'D', "Don't test updates", (uchar**) &skip_update,
{"transactional", 'T', "Test in transactional mode. (Only works with block format)", (uchar**) &skip_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
(gptr*) &transactional, (gptr*) &transactional, 0, GET_BOOL, NO_ARG, {"transactional", 'T',
"Test in transactional mode. (Only works with block format)",
(uchar**) &transactional, (uchar**) &transactional, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"unique", 'C', "Undocumented", (gptr*) &opt_unique, (gptr*) &opt_unique, 0, {"unique", 'C', "Undocumented", (uchar**) &opt_unique,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, (uchar**) &opt_unique, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"update-rows", 'u', "Undocumented", (gptr*) &update_count, {"update-rows", 'u', "Undocumented", (uchar**) &update_count,
(gptr*) &update_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, (uchar**) &update_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
{"verbose", 'v', "Be more verbose", (gptr*) &verbose, (gptr*) &verbose, 0, {"verbose", 'v', "Be more verbose", (uchar**) &verbose,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Print version number and exit", {"version", 'V', "Print version number and exit",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}

View File

@ -38,7 +38,7 @@
static void get_options(int argc, char *argv[]); static void get_options(int argc, char *argv[]);
static uint rnd(uint max_value); static uint rnd(uint max_value);
static void fix_length(byte *record,uint length); static void fix_length(uchar *record,uint length);
static void put_blob_in_record(char *blob_pos,char **blob_buffer, static void put_blob_in_record(char *blob_pos,char **blob_buffer,
ulong *length); ulong *length);
static void copy_key(struct st_maria_info *info,uint inx, static void copy_key(struct st_maria_info *info,uint inx,
@ -496,8 +496,8 @@ int main(int argc, char *argv[])
bcmp(read_record2,read_record3,reclength)) bcmp(read_record2,read_record3,reclength))
{ {
printf("Can't find last record\n"); printf("Can't find last record\n");
DBUG_DUMP("record2",(byte*) read_record2,reclength); DBUG_DUMP("record2",(uchar*) read_record2,reclength);
DBUG_DUMP("record3",(byte*) read_record3,reclength); DBUG_DUMP("record3",(uchar*) read_record3,reclength);
goto end; goto end;
} }
ant=1; ant=1;
@ -1050,7 +1050,7 @@ static uint rnd(uint max_value)
/* Create a variable length record */ /* Create a variable length record */
static void fix_length(byte *rec, uint length) static void fix_length(uchar *rec, uint length)
{ {
bmove(rec+STANDARD_LENGTH, bmove(rec+STANDARD_LENGTH,
"0123456789012345678901234567890123456789012345678901234567890", "0123456789012345678901234567890123456789012345678901234567890",

View File

@ -242,7 +242,7 @@ int test_read(MARIA_HA *file,int id)
for (i=0 ; i < 100 ; i++) for (i=0 ; i < 100 ; i++)
{ {
find=rnd(100000); find=rnd(100000);
if (!maria_rkey(file,record.id,1,(byte*) &find, if (!maria_rkey(file,record.id,1,(uchar*) &find,
sizeof(find),HA_READ_KEY_EXACT)) sizeof(find),HA_READ_KEY_EXACT))
found++; found++;
else else
@ -425,7 +425,7 @@ int test_update(MARIA_HA *file,int id,int lock_type)
{ {
tmp=rnd(100000); tmp=rnd(100000);
int4store(find,tmp); int4store(find,tmp);
if (!maria_rkey(file,record.id,1,(byte*) find, if (!maria_rkey(file,record.id,1,(uchar*) find,
sizeof(find),HA_READ_KEY_EXACT)) sizeof(find),HA_READ_KEY_EXACT))
found++; found++;
else else

View File

@ -18,12 +18,12 @@
#include "maria_def.h" #include "maria_def.h"
#include <m_ctype.h> #include <m_ctype.h>
my_bool _ma_check_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, byte *record, my_bool _ma_check_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, uchar *record,
ha_checksum unique_hash, my_off_t disk_pos) ha_checksum unique_hash, my_off_t disk_pos)
{ {
my_off_t lastpos=info->cur_row.lastpos; my_off_t lastpos=info->cur_row.lastpos;
MARIA_KEYDEF *key= &info->s->keyinfo[def->key]; MARIA_KEYDEF *key= &info->s->keyinfo[def->key];
byte *key_buff= info->lastkey2; uchar *key_buff= info->lastkey2;
DBUG_ENTER("_ma_check_unique"); DBUG_ENTER("_ma_check_unique");
DBUG_PRINT("enter",("unique_hash: %lu", (ulong) unique_hash)); DBUG_PRINT("enter",("unique_hash: %lu", (ulong) unique_hash));
@ -76,9 +76,9 @@ my_bool _ma_check_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, byte *record,
Add support for bit fields Add support for bit fields
*/ */
ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const byte *record) ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const uchar *record)
{ {
const byte *pos, *end; const uchar *pos, *end;
ha_checksum crc= 0; ha_checksum crc= 0;
ulong seed1=0, seed2= 4; ulong seed1=0, seed2= 4;
HA_KEYSEG *keyseg; HA_KEYSEG *keyseg;
@ -114,7 +114,7 @@ ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const byte *record)
else if (keyseg->flag & HA_BLOB_PART) else if (keyseg->flag & HA_BLOB_PART)
{ {
uint tmp_length= _ma_calc_blob_length(keyseg->bit_start,pos); uint tmp_length= _ma_calc_blob_length(keyseg->bit_start,pos);
memcpy_fixed((byte*) &pos,pos+keyseg->bit_start,sizeof(char*)); memcpy_fixed((uchar*) &pos,pos+keyseg->bit_start,sizeof(char*));
if (!length || length > tmp_length) if (!length || length > tmp_length)
length=tmp_length; /* The whole blob */ length=tmp_length; /* The whole blob */
} }
@ -148,10 +148,10 @@ ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const byte *record)
1 Rows are different 1 Rows are different
*/ */
my_bool _ma_unique_comp(MARIA_UNIQUEDEF *def, const byte *a, const byte *b, my_bool _ma_unique_comp(MARIA_UNIQUEDEF *def, const uchar *a, const uchar *b,
my_bool null_are_equal) my_bool null_are_equal)
{ {
const byte *pos_a, *pos_b, *end; const uchar *pos_a, *pos_b, *end;
HA_KEYSEG *keyseg; HA_KEYSEG *keyseg;
for (keyseg=def->seg ; keyseg < def->end ; keyseg++) for (keyseg=def->seg ; keyseg < def->end ; keyseg++)
@ -209,8 +209,8 @@ my_bool _ma_unique_comp(MARIA_UNIQUEDEF *def, const byte *a, const byte *b,
set_if_smaller(a_length, keyseg->length); set_if_smaller(a_length, keyseg->length);
set_if_smaller(b_length, keyseg->length); set_if_smaller(b_length, keyseg->length);
} }
memcpy_fixed((byte*) &pos_a,pos_a+keyseg->bit_start,sizeof(char*)); memcpy_fixed((uchar*) &pos_a,pos_a+keyseg->bit_start,sizeof(char*));
memcpy_fixed((byte*) &pos_b,pos_b+keyseg->bit_start,sizeof(char*)); memcpy_fixed((uchar*) &pos_b,pos_b+keyseg->bit_start,sizeof(char*));
} }
if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT1 || if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT1 ||
type == HA_KEYTYPE_VARTEXT2) type == HA_KEYTYPE_VARTEXT2)

View File

@ -18,12 +18,12 @@
#include "ma_fulltext.h" #include "ma_fulltext.h"
#include "ma_rt_index.h" #include "ma_rt_index.h"
int maria_update(register MARIA_HA *info, const byte *oldrec, byte *newrec) int maria_update(register MARIA_HA *info, const uchar *oldrec, uchar *newrec)
{ {
int flag,key_changed,save_errno; int flag,key_changed,save_errno;
reg3 my_off_t pos; reg3 my_off_t pos;
uint i; uint i;
byte old_key[HA_MAX_KEY_BUFF],*new_key; uchar old_key[HA_MAX_KEY_BUFF],*new_key;
bool auto_key_changed=0; bool auto_key_changed=0;
ulonglong changed; ulonglong changed;
MARIA_SHARE *share=info->s; MARIA_SHARE *share=info->s;

View File

@ -23,24 +23,24 @@
/* Functions declared in this file */ /* Functions declared in this file */
static int w_search(MARIA_HA *info,MARIA_KEYDEF *keyinfo, static int w_search(MARIA_HA *info,MARIA_KEYDEF *keyinfo,
uint comp_flag, byte *key, uint comp_flag, uchar *key,
uint key_length, my_off_t pos, byte *father_buff, uint key_length, my_off_t pos, uchar *father_buff,
byte *father_keypos, my_off_t father_page, uchar *father_keypos, my_off_t father_page,
my_bool insert_last); my_bool insert_last);
static int _ma_balance_page(MARIA_HA *info,MARIA_KEYDEF *keyinfo,byte *key, static int _ma_balance_page(MARIA_HA *info,MARIA_KEYDEF *keyinfo,uchar *key,
byte *curr_buff,byte *father_buff, uchar *curr_buff,uchar *father_buff,
byte *father_keypos,my_off_t father_page); uchar *father_keypos,my_off_t father_page);
static byte *_ma_find_last_pos(MARIA_KEYDEF *keyinfo, byte *page, static uchar *_ma_find_last_pos(MARIA_KEYDEF *keyinfo, uchar *page,
byte *key, uint *return_key_length, uchar *key, uint *return_key_length,
byte **after_key); uchar **after_key);
int _ma_ck_write_tree(register MARIA_HA *info, uint keynr,byte *key, int _ma_ck_write_tree(register MARIA_HA *info, uint keynr,uchar *key,
uint key_length); uint key_length);
int _ma_ck_write_btree(register MARIA_HA *info, uint keynr,byte *key, int _ma_ck_write_btree(register MARIA_HA *info, uint keynr,uchar *key,
uint key_length); uint key_length);
MARIA_RECORD_POS _ma_write_init_default(MARIA_HA *info, MARIA_RECORD_POS _ma_write_init_default(MARIA_HA *info,
const byte *record const uchar *record
__attribute__((unused))) __attribute__((unused)))
{ {
return ((info->s->state.dellink != HA_OFFSET_ERROR && return ((info->s->state.dellink != HA_OFFSET_ERROR &&
@ -57,13 +57,13 @@ my_bool _ma_write_abort_default(MARIA_HA *info __attribute__((unused)))
/* Write new record to a table */ /* Write new record to a table */
int maria_write(MARIA_HA *info, byte *record) int maria_write(MARIA_HA *info, uchar *record)
{ {
MARIA_SHARE *share=info->s; MARIA_SHARE *share=info->s;
uint i; uint i;
int save_errno; int save_errno;
MARIA_RECORD_POS filepos; MARIA_RECORD_POS filepos;
byte *buff; uchar *buff;
my_bool lock_tree= share->concurrent_insert; my_bool lock_tree= share->concurrent_insert;
my_bool fatal_error; my_bool fatal_error;
DBUG_ENTER("maria_write"); DBUG_ENTER("maria_write");
@ -271,7 +271,7 @@ err2:
/* Write one key to btree */ /* Write one key to btree */
int _ma_ck_write(MARIA_HA *info, uint keynr, byte *key, uint key_length) int _ma_ck_write(MARIA_HA *info, uint keynr, uchar *key, uint key_length)
{ {
DBUG_ENTER("_ma_ck_write"); DBUG_ENTER("_ma_ck_write");
@ -290,7 +290,7 @@ int _ma_ck_write(MARIA_HA *info, uint keynr, byte *key, uint key_length)
* Normal insert code * * Normal insert code *
**********************************************************************/ **********************************************************************/
int _ma_ck_write_btree(register MARIA_HA *info, uint keynr, byte *key, int _ma_ck_write_btree(register MARIA_HA *info, uint keynr, uchar *key,
uint key_length) uint key_length)
{ {
int error; int error;
@ -317,7 +317,7 @@ int _ma_ck_write_btree(register MARIA_HA *info, uint keynr, byte *key,
if (!error) if (!error)
error= _ma_ft_convert_to_ft2(info, keynr, key); error= _ma_ft_convert_to_ft2(info, keynr, key);
delete_dynamic(info->ft1_to_ft2); delete_dynamic(info->ft1_to_ft2);
my_free((gptr)info->ft1_to_ft2, MYF(0)); my_free((uchar*)info->ft1_to_ft2, MYF(0));
info->ft1_to_ft2=0; info->ft1_to_ft2=0;
} }
DBUG_RETURN(error); DBUG_RETURN(error);
@ -325,7 +325,7 @@ int _ma_ck_write_btree(register MARIA_HA *info, uint keynr, byte *key,
int _ma_ck_real_write_btree(MARIA_HA *info, MARIA_KEYDEF *keyinfo, int _ma_ck_real_write_btree(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *key, uint key_length, my_off_t *root, uchar *key, uint key_length, my_off_t *root,
uint comp_flag) uint comp_flag)
{ {
int error; int error;
@ -333,7 +333,7 @@ int _ma_ck_real_write_btree(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
/* key_length parameter is used only if comp_flag is SEARCH_FIND */ /* key_length parameter is used only if comp_flag is SEARCH_FIND */
if (*root == HA_OFFSET_ERROR || if (*root == HA_OFFSET_ERROR ||
(error=w_search(info, keyinfo, comp_flag, key, key_length, (error=w_search(info, keyinfo, comp_flag, key, key_length,
*root, (byte*) 0, (byte*) 0, *root, (uchar*) 0, (uchar*) 0,
(my_off_t) 0, 1)) > 0) (my_off_t) 0, 1)) > 0)
error= _ma_enlarge_root(info,keyinfo,key,root); error= _ma_enlarge_root(info,keyinfo,key,root);
DBUG_RETURN(error); DBUG_RETURN(error);
@ -342,7 +342,7 @@ int _ma_ck_real_write_btree(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
/* Make a new root with key as only pointer */ /* Make a new root with key as only pointer */
int _ma_enlarge_root(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *key, int _ma_enlarge_root(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uchar *key,
my_off_t *root) my_off_t *root)
{ {
uint t_length,nod_flag; uint t_length,nod_flag;
@ -352,8 +352,8 @@ int _ma_enlarge_root(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *key,
nod_flag= (*root != HA_OFFSET_ERROR) ? share->base.key_reflength : 0; nod_flag= (*root != HA_OFFSET_ERROR) ? share->base.key_reflength : 0;
_ma_kpointer(info,info->buff+2,*root); /* if nod */ _ma_kpointer(info,info->buff+2,*root); /* if nod */
t_length=(*keyinfo->pack_key)(keyinfo,nod_flag,(byte*) 0, t_length=(*keyinfo->pack_key)(keyinfo,nod_flag,(uchar*) 0,
(byte*) 0, (byte*) 0, key,&s_temp); (uchar*) 0, (uchar*) 0, key,&s_temp);
maria_putint(info->buff,t_length+2+nod_flag,nod_flag); maria_putint(info->buff,t_length+2+nod_flag,nod_flag);
(*keyinfo->store_key)(keyinfo,info->buff+2+nod_flag,&s_temp); (*keyinfo->store_key)(keyinfo,info->buff+2+nod_flag,&s_temp);
info->keyread_buff_used=info->page_changed=1; /* info->buff is used */ info->keyread_buff_used=info->page_changed=1; /* info->buff is used */
@ -372,21 +372,21 @@ int _ma_enlarge_root(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *key,
*/ */
static int w_search(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo, static int w_search(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
uint comp_flag, byte *key, uint key_length, my_off_t page, uint comp_flag, uchar *key, uint key_length, my_off_t page,
byte *father_buff, byte *father_keypos, uchar *father_buff, uchar *father_keypos,
my_off_t father_page, my_bool insert_last) my_off_t father_page, my_bool insert_last)
{ {
int error,flag; int error,flag;
uint nod_flag, search_key_length; uint nod_flag, search_key_length;
byte *temp_buff,*keypos; uchar *temp_buff,*keypos;
byte keybuff[HA_MAX_KEY_BUFF]; uchar keybuff[HA_MAX_KEY_BUFF];
my_bool was_last_key; my_bool was_last_key;
my_off_t next_page, dup_key_pos; my_off_t next_page, dup_key_pos;
DBUG_ENTER("w_search"); DBUG_ENTER("w_search");
DBUG_PRINT("enter",("page: %ld", (long) page)); DBUG_PRINT("enter",("page: %ld", (long) page));
search_key_length= (comp_flag & SEARCH_FIND) ? key_length : USE_WHOLE_KEY; search_key_length= (comp_flag & SEARCH_FIND) ? key_length : USE_WHOLE_KEY;
if (!(temp_buff= (byte*) my_alloca((uint) keyinfo->block_length+ if (!(temp_buff= (uchar*) my_alloca((uint) keyinfo->block_length+
HA_MAX_KEY_BUFF*2))) HA_MAX_KEY_BUFF*2)))
DBUG_RETURN(-1); DBUG_RETURN(-1);
if (!_ma_fetch_keypage(info,keyinfo,page,DFLT_INIT_HITS,temp_buff,0)) if (!_ma_fetch_keypage(info,keyinfo,page,DFLT_INIT_HITS,temp_buff,0))
@ -436,14 +436,14 @@ static int w_search(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
ft_intXstore(keypos, subkeys); ft_intXstore(keypos, subkeys);
if (!error) if (!error)
error= _ma_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,temp_buff); error= _ma_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,temp_buff);
my_afree((byte*) temp_buff); my_afree((uchar*) temp_buff);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
} }
else /* not HA_FULLTEXT, normal HA_NOSAME key */ else /* not HA_FULLTEXT, normal HA_NOSAME key */
{ {
info->dup_key_pos= dup_key_pos; info->dup_key_pos= dup_key_pos;
my_afree((byte*) temp_buff); my_afree((uchar*) temp_buff);
my_errno=HA_ERR_FOUND_DUPP_KEY; my_errno=HA_ERR_FOUND_DUPP_KEY;
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -462,10 +462,10 @@ static int w_search(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
if (_ma_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,temp_buff)) if (_ma_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,temp_buff))
goto err; goto err;
} }
my_afree((byte*) temp_buff); my_afree((uchar*) temp_buff);
DBUG_RETURN(error); DBUG_RETURN(error);
err: err:
my_afree((byte*) temp_buff); my_afree((uchar*) temp_buff);
DBUG_PRINT("exit",("Error: %d",my_errno)); DBUG_PRINT("exit",("Error: %d",my_errno));
DBUG_RETURN (-1); DBUG_RETURN (-1);
} /* w_search */ } /* w_search */
@ -497,13 +497,13 @@ err:
*/ */
int _ma_insert(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo, int _ma_insert(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
byte *key, byte *anc_buff, byte *key_pos, byte *key_buff, uchar *key, uchar *anc_buff, uchar *key_pos, uchar *key_buff,
byte *father_buff, byte *father_key_pos, my_off_t father_page, uchar *father_buff, uchar *father_key_pos, my_off_t father_page,
my_bool insert_last) my_bool insert_last)
{ {
uint a_length,nod_flag; uint a_length,nod_flag;
int t_length; int t_length;
byte *endpos, *prev_key; uchar *endpos, *prev_key;
MARIA_KEY_PARAM s_temp; MARIA_KEY_PARAM s_temp;
DBUG_ENTER("_ma_insert"); DBUG_ENTER("_ma_insert");
DBUG_PRINT("enter",("key_pos: 0x%lx", (ulong) key_pos)); DBUG_PRINT("enter",("key_pos: 0x%lx", (ulong) key_pos));
@ -513,16 +513,16 @@ int _ma_insert(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
nod_flag=_ma_test_if_nod(anc_buff); nod_flag=_ma_test_if_nod(anc_buff);
a_length= maria_data_on_page(anc_buff); a_length= maria_data_on_page(anc_buff);
endpos= anc_buff+ a_length; endpos= anc_buff+ a_length;
prev_key=(key_pos == anc_buff+2+nod_flag ? (byte*) 0 : key_buff); prev_key=(key_pos == anc_buff+2+nod_flag ? (uchar*) 0 : key_buff);
t_length=(*keyinfo->pack_key)(keyinfo,nod_flag, t_length=(*keyinfo->pack_key)(keyinfo,nod_flag,
(key_pos == endpos ? (byte*) 0 : key_pos), (key_pos == endpos ? (uchar*) 0 : key_pos),
prev_key, prev_key, prev_key, prev_key,
key,&s_temp); key,&s_temp);
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (key_pos != anc_buff+2+nod_flag && (keyinfo->flag & if (key_pos != anc_buff+2+nod_flag && (keyinfo->flag &
(HA_BINARY_PACK_KEY | HA_PACK_KEY))) (HA_BINARY_PACK_KEY | HA_PACK_KEY)))
{ {
DBUG_DUMP("prev_key",(byte*) key_buff, _ma_keylength(keyinfo,key_buff)); DBUG_DUMP("prev_key",(uchar*) key_buff, _ma_keylength(keyinfo,key_buff));
} }
if (keyinfo->flag & HA_PACK_KEY) if (keyinfo->flag & HA_PACK_KEY)
{ {
@ -540,7 +540,7 @@ int _ma_insert(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
bmove_upp((byte*) endpos+t_length,(byte*) endpos,(uint) (endpos-key_pos)); bmove_upp((uchar*) endpos+t_length,(uchar*) endpos,(uint) (endpos-key_pos));
} }
else else
{ {
@ -567,7 +567,7 @@ int _ma_insert(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
Let's consider converting. Let's consider converting.
We'll compare 'key' and the first key at anc_buff We'll compare 'key' and the first key at anc_buff
*/ */
byte *a=key, *b=anc_buff+2+nod_flag; uchar *a=key, *b=anc_buff+2+nod_flag;
uint alen, blen, ft2len=info->s->ft2_keyinfo.keylength; uint alen, blen, ft2len=info->s->ft2_keyinfo.keylength;
/* the very first key on the page is always unpacked */ /* the very first key on the page is always unpacked */
DBUG_ASSERT((*b & 128) == 0); DBUG_ASSERT((*b & 128) == 0);
@ -621,16 +621,16 @@ int _ma_insert(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
/* split a full page in two and assign emerging item to key */ /* split a full page in two and assign emerging item to key */
int _ma_split_page(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo, int _ma_split_page(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
byte *key, byte *buff, byte *key_buff, uchar *key, uchar *buff, uchar *key_buff,
my_bool insert_last_key) my_bool insert_last_key)
{ {
uint length,a_length,key_ref_length,t_length,nod_flag,key_length; uint length,a_length,key_ref_length,t_length,nod_flag,key_length;
byte *key_pos,*pos, *after_key; uchar *key_pos,*pos, *after_key;
my_off_t new_pos; my_off_t new_pos;
MARIA_KEY_PARAM s_temp; MARIA_KEY_PARAM s_temp;
DBUG_ENTER("maria_split_page"); DBUG_ENTER("maria_split_page");
LINT_INIT(after_key); LINT_INIT(after_key);
DBUG_DUMP("buff",(byte*) buff,maria_data_on_page(buff)); DBUG_DUMP("buff",(uchar*) buff,maria_data_on_page(buff));
if (info->s->keyinfo+info->lastinx == keyinfo) if (info->s->keyinfo+info->lastinx == keyinfo)
info->page_changed=1; /* Info->buff is used */ info->page_changed=1; /* Info->buff is used */
@ -654,7 +654,7 @@ int _ma_split_page(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
{ {
DBUG_PRINT("test",("Splitting nod")); DBUG_PRINT("test",("Splitting nod"));
pos=key_pos-nod_flag; pos=key_pos-nod_flag;
memcpy((byte*) info->buff+2,(byte*) pos,(size_t) nod_flag); memcpy((uchar*) info->buff+2,(uchar*) pos,(size_t) nod_flag);
} }
/* Move middle item to key and pointer to new page */ /* Move middle item to key and pointer to new page */
@ -666,18 +666,18 @@ int _ma_split_page(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
if (!(*keyinfo->get_key)(keyinfo,nod_flag,&key_pos,key_buff)) if (!(*keyinfo->get_key)(keyinfo,nod_flag,&key_pos,key_buff))
DBUG_RETURN(-1); DBUG_RETURN(-1);
t_length=(*keyinfo->pack_key)(keyinfo,nod_flag,(byte *) 0, t_length=(*keyinfo->pack_key)(keyinfo,nod_flag,(uchar *) 0,
(byte*) 0, (byte*) 0, (uchar*) 0, (uchar*) 0,
key_buff, &s_temp); key_buff, &s_temp);
length=(uint) ((buff+a_length)-key_pos); length=(uint) ((buff+a_length)-key_pos);
memcpy((byte*) info->buff+key_ref_length+t_length,(byte*) key_pos, memcpy((uchar*) info->buff+key_ref_length+t_length,(uchar*) key_pos,
(size_t) length); (size_t) length);
(*keyinfo->store_key)(keyinfo,info->buff+key_ref_length,&s_temp); (*keyinfo->store_key)(keyinfo,info->buff+key_ref_length,&s_temp);
maria_putint(info->buff,length+t_length+key_ref_length,nod_flag); maria_putint(info->buff,length+t_length+key_ref_length,nod_flag);
if (_ma_write_keypage(info,keyinfo,new_pos,DFLT_INIT_HITS,info->buff)) if (_ma_write_keypage(info,keyinfo,new_pos,DFLT_INIT_HITS,info->buff))
DBUG_RETURN(-1); DBUG_RETURN(-1);
DBUG_DUMP("key",(byte*) key, _ma_keylength(keyinfo,key)); DBUG_DUMP("key",(uchar*) key, _ma_keylength(keyinfo,key));
DBUG_RETURN(2); /* Middle key up */ DBUG_RETURN(2); /* Middle key up */
} /* _ma_split_page */ } /* _ma_split_page */
@ -690,12 +690,12 @@ int _ma_split_page(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
after_key will contain the position to where the next key starts after_key will contain the position to where the next key starts
*/ */
byte *_ma_find_half_pos(uint nod_flag, MARIA_KEYDEF *keyinfo, byte *page, uchar *_ma_find_half_pos(uint nod_flag, MARIA_KEYDEF *keyinfo, uchar *page,
byte *key, uint *return_key_length, uchar *key, uint *return_key_length,
byte **after_key) uchar **after_key)
{ {
uint keys,length,key_ref_length; uint keys,length,key_ref_length;
byte *end,*lastpos; uchar *end,*lastpos;
DBUG_ENTER("_ma_find_half_pos"); DBUG_ENTER("_ma_find_half_pos");
key_ref_length=2+nod_flag; key_ref_length=2+nod_flag;
@ -736,13 +736,13 @@ byte *_ma_find_half_pos(uint nod_flag, MARIA_KEYDEF *keyinfo, byte *page,
key will contain the last key key will contain the last key
*/ */
static byte *_ma_find_last_pos(MARIA_KEYDEF *keyinfo, byte *page, static uchar *_ma_find_last_pos(MARIA_KEYDEF *keyinfo, uchar *page,
byte *key, uint *return_key_length, uchar *key, uint *return_key_length,
byte **after_key) uchar **after_key)
{ {
uint keys,length,last_length,key_ref_length; uint keys,length,last_length,key_ref_length;
byte *end,*lastpos,*prevpos; uchar *end,*lastpos,*prevpos;
byte key_buff[HA_MAX_KEY_BUFF]; uchar key_buff[HA_MAX_KEY_BUFF];
DBUG_ENTER("_ma_find_last_pos"); DBUG_ENTER("_ma_find_last_pos");
key_ref_length=2; key_ref_length=2;
@ -790,16 +790,16 @@ static byte *_ma_find_last_pos(MARIA_KEYDEF *keyinfo, byte *page,
/* returns 0 if balance was done */ /* returns 0 if balance was done */
static int _ma_balance_page(register MARIA_HA *info, MARIA_KEYDEF *keyinfo, static int _ma_balance_page(register MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *key, byte *curr_buff, byte *father_buff, uchar *key, uchar *curr_buff, uchar *father_buff,
byte *father_key_pos, my_off_t father_page) uchar *father_key_pos, my_off_t father_page)
{ {
my_bool right; my_bool right;
uint k_length,father_length,father_keylength,nod_flag,curr_keylength, uint k_length,father_length,father_keylength,nod_flag,curr_keylength,
right_length,left_length,new_right_length,new_left_length,extra_length, right_length,left_length,new_right_length,new_left_length,extra_length,
length,keys; length,keys;
byte *pos,*buff,*extra_buff; uchar *pos,*buff,*extra_buff;
my_off_t next_page,new_pos; my_off_t next_page,new_pos;
byte tmp_part_key[HA_MAX_KEY_BUFF]; uchar tmp_part_key[HA_MAX_KEY_BUFF];
DBUG_ENTER("_ma_balance_page"); DBUG_ENTER("_ma_balance_page");
k_length=keyinfo->keylength; k_length=keyinfo->keylength;
@ -831,7 +831,7 @@ static int _ma_balance_page(register MARIA_HA *info, MARIA_KEYDEF *keyinfo,
if (!_ma_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,info->buff,0)) if (!_ma_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,info->buff,0))
goto err; goto err;
DBUG_DUMP("next",(byte*) info->buff,maria_data_on_page(info->buff)); DBUG_DUMP("next",(uchar*) info->buff,maria_data_on_page(info->buff));
/* Test if there is room to share keys */ /* Test if there is room to share keys */
@ -850,23 +850,23 @@ static int _ma_balance_page(register MARIA_HA *info, MARIA_KEYDEF *keyinfo,
if (left_length < new_left_length) if (left_length < new_left_length)
{ /* Move keys buff -> leaf */ { /* Move keys buff -> leaf */
pos=curr_buff+left_length; pos=curr_buff+left_length;
memcpy((byte*) pos,(byte*) father_key_pos, (size_t) k_length); memcpy((uchar*) pos,(uchar*) father_key_pos, (size_t) k_length);
memcpy((byte*) pos+k_length, (byte*) buff+2, memcpy((uchar*) pos+k_length, (uchar*) buff+2,
(size_t) (length=new_left_length - left_length - k_length)); (size_t) (length=new_left_length - left_length - k_length));
pos=buff+2+length; pos=buff+2+length;
memcpy((byte*) father_key_pos,(byte*) pos,(size_t) k_length); memcpy((uchar*) father_key_pos,(uchar*) pos,(size_t) k_length);
bmove((byte*) buff+2,(byte*) pos+k_length,new_right_length); bmove((uchar*) buff+2,(uchar*) pos+k_length,new_right_length);
} }
else else
{ /* Move keys -> buff */ { /* Move keys -> buff */
bmove_upp((byte*) buff+new_right_length,(byte*) buff+right_length, bmove_upp((uchar*) buff+new_right_length,(uchar*) buff+right_length,
right_length-2); right_length-2);
length=new_right_length-right_length-k_length; length=new_right_length-right_length-k_length;
memcpy((byte*) buff+2+length,father_key_pos,(size_t) k_length); memcpy((uchar*) buff+2+length,father_key_pos,(size_t) k_length);
pos=curr_buff+new_left_length; pos=curr_buff+new_left_length;
memcpy((byte*) father_key_pos,(byte*) pos,(size_t) k_length); memcpy((uchar*) father_key_pos,(uchar*) pos,(size_t) k_length);
memcpy((byte*) buff+2,(byte*) pos+k_length,(size_t) length); memcpy((uchar*) buff+2,(uchar*) pos+k_length,(size_t) length);
} }
if (_ma_write_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,info->buff) || if (_ma_write_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,info->buff) ||
@ -893,22 +893,22 @@ static int _ma_balance_page(register MARIA_HA *info, MARIA_KEYDEF *keyinfo,
/* move first largest keys to new page */ /* move first largest keys to new page */
pos=buff+right_length-extra_length; pos=buff+right_length-extra_length;
memcpy((byte*) extra_buff+2,pos,(size_t) extra_length); memcpy((uchar*) extra_buff+2,pos,(size_t) extra_length);
/* Save new parting key */ /* Save new parting key */
memcpy(tmp_part_key, pos-k_length,k_length); memcpy(tmp_part_key, pos-k_length,k_length);
/* Make place for new keys */ /* Make place for new keys */
bmove_upp((byte*) buff+new_right_length,(byte*) pos-k_length, bmove_upp((uchar*) buff+new_right_length,(uchar*) pos-k_length,
right_length-extra_length-k_length-2); right_length-extra_length-k_length-2);
/* Copy keys from left page */ /* Copy keys from left page */
pos= curr_buff+new_left_length; pos= curr_buff+new_left_length;
memcpy((byte*) buff+2,(byte*) pos+k_length, memcpy((uchar*) buff+2,(uchar*) pos+k_length,
(size_t) (length=left_length-new_left_length-k_length)); (size_t) (length=left_length-new_left_length-k_length));
/* Copy old parting key */ /* Copy old parting key */
memcpy((byte*) buff+2+length,father_key_pos,(size_t) k_length); memcpy((uchar*) buff+2+length,father_key_pos,(size_t) k_length);
/* Move new parting keys up to caller */ /* Move new parting keys up to caller */
memcpy((byte*) (right ? key : father_key_pos),pos,(size_t) k_length); memcpy((uchar*) (right ? key : father_key_pos),pos,(size_t) k_length);
memcpy((byte*) (right ? father_key_pos : key),tmp_part_key, k_length); memcpy((uchar*) (right ? father_key_pos : key),tmp_part_key, k_length);
if ((new_pos= _ma_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR) if ((new_pos= _ma_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR)
goto err; goto err;
@ -935,7 +935,7 @@ typedef struct {
} bulk_insert_param; } bulk_insert_param;
int _ma_ck_write_tree(register MARIA_HA *info, uint keynr, byte *key, int _ma_ck_write_tree(register MARIA_HA *info, uint keynr, uchar *key,
uint key_length) uint key_length)
{ {
int error; int error;
@ -951,7 +951,7 @@ int _ma_ck_write_tree(register MARIA_HA *info, uint keynr, byte *key,
/* typeof(_ma_keys_compare)=qsort_cmp2 */ /* typeof(_ma_keys_compare)=qsort_cmp2 */
static int keys_compare(bulk_insert_param *param, byte *key1, byte *key2) static int keys_compare(bulk_insert_param *param, uchar *key1, uchar *key2)
{ {
uint not_used[2]; uint not_used[2];
return ha_key_cmp(param->info->s->keyinfo[param->keynr].seg, return ha_key_cmp(param->info->s->keyinfo[param->keynr].seg,
@ -960,13 +960,13 @@ static int keys_compare(bulk_insert_param *param, byte *key1, byte *key2)
} }
static int keys_free(byte *key, TREE_FREE mode, bulk_insert_param *param) static int keys_free(uchar *key, TREE_FREE mode, bulk_insert_param *param)
{ {
/* /*
Probably I can use info->lastkey here, but I'm not sure, Probably I can use info->lastkey here, but I'm not sure,
and to be safe I'd better use local lastkey. and to be safe I'd better use local lastkey.
*/ */
byte lastkey[HA_MAX_KEY_BUFF]; uchar lastkey[HA_MAX_KEY_BUFF];
uint keylen; uint keylen;
MARIA_KEYDEF *keyinfo; MARIA_KEYDEF *keyinfo;

View File

@ -76,13 +76,13 @@ static void get_options(int *argc,char * * *argv);
static void print_version(void); static void print_version(void);
static void usage(void); static void usage(void);
static int maria_chk(HA_CHECK *param, char *filename); static int maria_chk(HA_CHECK *param, char *filename);
static void descript(HA_CHECK *param, register MARIA_HA *info, my_string name); static void descript(HA_CHECK *param, register MARIA_HA *info, char *name);
static int maria_sort_records(HA_CHECK *param, register MARIA_HA *info, static int maria_sort_records(HA_CHECK *param, register MARIA_HA *info,
my_string name, uint sort_key, char *name, uint sort_key,
my_bool write_info, my_bool update_index); my_bool write_info, my_bool update_index);
static int sort_record_index(MARIA_SORT_PARAM *sort_param, MARIA_HA *info, static int sort_record_index(MARIA_SORT_PARAM *sort_param, MARIA_HA *info,
MARIA_KEYDEF *keyinfo, MARIA_KEYDEF *keyinfo,
my_off_t page, byte *buff,uint sortkey, my_off_t page, uchar *buff,uint sortkey,
File new_file, my_bool update_index); File new_file, my_bool update_index);
HA_CHECK check_param; HA_CHECK check_param;
@ -178,7 +178,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR, {"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", "Directory where character sets are.",
(gptr*) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (uchar**) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"check", 'c', {"check", 'c',
"Check table for errors.", "Check table for errors.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -198,8 +198,8 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"data-file-length", 'D', {"data-file-length", 'D',
"Max length of data file (when recreating data-file when it's full).", "Max length of data file (when recreating data-file when it's full).",
(gptr*) &check_param.max_data_file_length, (uchar**) &check_param.max_data_file_length,
(gptr*) &check_param.max_data_file_length, (uchar**) &check_param.max_data_file_length,
0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extend-check", 'e', {"extend-check", 'e',
"If used when checking a table, ensure that the table is 100 percent consistent, which will take a long time. If used when repairing a table, try to recover every possible row from the data file. Normally this will also find a lot of garbage rows; Don't use this option with repair if you are not totally desperate.", "If used when checking a table, ensure that the table is 100 percent consistent, which will take a long time. If used when repairing a table, try to recover every possible row from the data file. Normally this will also find a lot of garbage rows; Don't use this option with repair if you are not totally desperate.",
@ -221,13 +221,13 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"keys-used", 'k', {"keys-used", 'k',
"Tell MARIA to update only some specific keys. # is a bit mask of which keys to use. This can be used to get faster inserts.", "Tell MARIA to update only some specific keys. # is a bit mask of which keys to use. This can be used to get faster inserts.",
(gptr*) &check_param.keys_in_use, (uchar**) &check_param.keys_in_use,
(gptr*) &check_param.keys_in_use, (uchar**) &check_param.keys_in_use,
0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0}, 0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0},
{"max-record-length", OPT_MAX_RECORD_LENGTH, {"max-record-length", OPT_MAX_RECORD_LENGTH,
"Skip rows bigger than this if maria_chk can't allocate memory to hold it", "Skip rows bigger than this if maria_chk can't allocate memory to hold it",
(gptr*) &check_param.max_record_length, (uchar**) &check_param.max_record_length,
(gptr*) &check_param.max_record_length, (uchar**) &check_param.max_record_length,
0, GET_ULL, REQUIRED_ARG, LONGLONG_MAX, 0, LONGLONG_MAX, 0, 0, 0}, 0, GET_ULL, REQUIRED_ARG, LONGLONG_MAX, 0, LONGLONG_MAX, 0, 0, 0},
{"medium-check", 'm', {"medium-check", 'm',
"Faster than extend-check, but only finds 99.99% of all errors. Should be good enough for most cases.", "Faster than extend-check, but only finds 99.99% of all errors. Should be good enough for most cases.",
@ -256,12 +256,12 @@ static struct my_option my_long_options[] =
#endif #endif
{"set-auto-increment", 'A', {"set-auto-increment", 'A',
"Force auto_increment to start at this or higher value. If no value is given, then sets the next auto_increment value to the highest used value for the auto key + 1.", "Force auto_increment to start at this or higher value. If no value is given, then sets the next auto_increment value to the highest used value for the auto key + 1.",
(gptr*) &check_param.auto_increment_value, (uchar**) &check_param.auto_increment_value,
(gptr*) &check_param.auto_increment_value, (uchar**) &check_param.auto_increment_value,
0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"set-collation", OPT_SET_COLLATION, {"set-collation", OPT_SET_COLLATION,
"Change the collation used by the index", "Change the collation used by the index",
(gptr*) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (uchar**) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"set-variable", 'O', {"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.", "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -273,12 +273,12 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"sort-records", 'R', {"sort-records", 'R',
"Sort records according to an index. This makes your data much more localized and may speed up things. (It may be VERY slow to do a sort the first time!)", "Sort records according to an index. This makes your data much more localized and may speed up things. (It may be VERY slow to do a sort the first time!)",
(gptr*) &check_param.opt_sort_key, (uchar**) &check_param.opt_sort_key,
(gptr*) &check_param.opt_sort_key, (uchar**) &check_param.opt_sort_key,
0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't', {"tmpdir", 't',
"Path for temporary files.", "Path for temporary files.",
(gptr*) &opt_tmpdir, (uchar**) &opt_tmpdir,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"update-state", 'U', {"update-state", 'U',
"Mark tables as crashed if any errors were found.", "Mark tables as crashed if any errors were found.",
@ -296,45 +296,45 @@ static struct my_option my_long_options[] =
"Wait if table is locked.", "Wait if table is locked.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{ "key_buffer_size", OPT_KEY_BUFFER_SIZE, "", { "key_buffer_size", OPT_KEY_BUFFER_SIZE, "",
(gptr*) &check_param.use_buffers, (gptr*) &check_param.use_buffers, 0, (uchar**) &check_param.use_buffers, (uchar**) &check_param.use_buffers, 0,
GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT, (long) MALLOC_OVERHEAD, GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT, (long) MALLOC_OVERHEAD,
(long) ~0L, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0}, (long) ~0L, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0},
{ "read_buffer_size", OPT_READ_BUFFER_SIZE, "", { "read_buffer_size", OPT_READ_BUFFER_SIZE, "",
(gptr*) &check_param.read_buffer_length, (uchar**) &check_param.read_buffer_length,
(gptr*) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (uchar**) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
(long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "", { "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "",
(gptr*) &check_param.write_buffer_length, (uchar**) &check_param.write_buffer_length,
(gptr*) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (uchar**) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
(long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "", { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "",
(gptr*) &check_param.sort_buffer_length, (uchar**) &check_param.sort_buffer_length,
(gptr*) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (uchar**) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
(long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "", { "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "",
(gptr*) &check_param.sort_key_blocks, (uchar**) &check_param.sort_key_blocks,
(gptr*) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG, (uchar**) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
BUFFERS_WHEN_SORTING, 4L, 100L, 0L, 1L, 0}, BUFFERS_WHEN_SORTING, 4L, 100L, 0L, 1L, 0},
{ "decode_bits", OPT_DECODE_BITS, "", (gptr*) &decode_bits, { "decode_bits", OPT_DECODE_BITS, "", (uchar**) &decode_bits,
(gptr*) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0}, (uchar**) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0},
{ "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (gptr*) &ft_min_word_len, { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (uchar**) &ft_min_word_len,
(gptr*) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN, (uchar**) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN,
0, 1, 0}, 0, 1, 0},
{ "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (gptr*) &ft_max_word_len, { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (uchar**) &ft_max_word_len,
(gptr*) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10, (uchar**) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10,
HA_FT_MAXCHARLEN, 0, 1, 0}, HA_FT_MAXCHARLEN, 0, 1, 0},
{ "maria_ft_stopword_file", OPT_FT_STOPWORD_FILE, { "maria_ft_stopword_file", OPT_FT_STOPWORD_FILE,
"Use stopwords from this file instead of built-in list.", "Use stopwords from this file instead of built-in list.",
(gptr*) &ft_stopword_file, (gptr*) &ft_stopword_file, 0, GET_STR, (uchar**) &ft_stopword_file, (uchar**) &ft_stopword_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"stats_method", OPT_STATS_METHOD, {"stats_method", OPT_STATS_METHOD,
"Specifies how index statistics collection code should threat NULLs. " "Specifies how index statistics collection code should threat NULLs. "
"Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), " "Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), "
"\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".", "\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".",
(gptr*) &maria_stats_method_str, (gptr*) &maria_stats_method_str, 0, (uchar**) &maria_stats_method_str, (uchar**) &maria_stats_method_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}; };
@ -794,7 +794,7 @@ static void get_options(register int *argc,register char ***argv)
/* Check table */ /* Check table */
static int maria_chk(HA_CHECK *param, my_string filename) static int maria_chk(HA_CHECK *param, char *filename)
{ {
int error,lock_type,recreate; int error,lock_type,recreate;
int rep_quick= param->testflag & (T_QUICK | T_FORCE_UNIQUENESS); int rep_quick= param->testflag & (T_QUICK | T_FORCE_UNIQUENESS);
@ -1215,7 +1215,7 @@ end2:
/* Write info about table */ /* Write info about table */
static void descript(HA_CHECK *param, register MARIA_HA *info, my_string name) static void descript(HA_CHECK *param, register MARIA_HA *info, char *name)
{ {
uint key,keyseg_nr,field; uint key,keyseg_nr,field;
reg3 MARIA_KEYDEF *keyinfo; reg3 MARIA_KEYDEF *keyinfo;
@ -1468,7 +1468,7 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, my_string name)
/* Sort records according to one key */ /* Sort records according to one key */
static int maria_sort_records(HA_CHECK *param, static int maria_sort_records(HA_CHECK *param,
register MARIA_HA *info, my_string name, register MARIA_HA *info, char *name,
uint sort_key, uint sort_key,
my_bool write_info, my_bool write_info,
my_bool update_index) my_bool update_index)
@ -1477,7 +1477,7 @@ static int maria_sort_records(HA_CHECK *param,
uint key; uint key;
MARIA_KEYDEF *keyinfo; MARIA_KEYDEF *keyinfo;
File new_file; File new_file;
byte *temp_buff; uchar *temp_buff;
ha_rows old_record_count; ha_rows old_record_count;
MARIA_SHARE *share=info->s; MARIA_SHARE *share=info->s;
char llbuff[22],llbuff2[22]; char llbuff[22],llbuff2[22];
@ -1532,12 +1532,12 @@ static int maria_sort_records(HA_CHECK *param,
goto err; goto err;
info->opt_flag|=WRITE_CACHE_USED; info->opt_flag|=WRITE_CACHE_USED;
if (!(temp_buff=(byte*) my_alloca((uint) keyinfo->block_length))) if (!(temp_buff=(uchar*) my_alloca((uint) keyinfo->block_length)))
{ {
_ma_check_print_error(param,"Not enough memory for key block"); _ma_check_print_error(param,"Not enough memory for key block");
goto err; goto err;
} }
if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength, if (!(sort_param.record=(uchar*) my_malloc((uint) share->base.pack_reclength,
MYF(0)))) MYF(0))))
{ {
_ma_check_print_error(param,"Not enough memory for record"); _ma_check_print_error(param,"Not enough memory for record");
@ -1630,7 +1630,7 @@ err:
} }
if (temp_buff) if (temp_buff)
{ {
my_afree((gptr) temp_buff); my_afree((uchar*) temp_buff);
} }
my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
@ -1647,13 +1647,13 @@ err:
static int sort_record_index(MARIA_SORT_PARAM *sort_param,MARIA_HA *info, static int sort_record_index(MARIA_SORT_PARAM *sort_param,MARIA_HA *info,
MARIA_KEYDEF *keyinfo, MARIA_KEYDEF *keyinfo,
my_off_t page, byte *buff, uint sort_key, my_off_t page, uchar *buff, uint sort_key,
File new_file,my_bool update_index) File new_file,my_bool update_index)
{ {
uint nod_flag,used_length,key_length; uint nod_flag,used_length,key_length;
byte *temp_buff,*keypos,*endpos; uchar *temp_buff,*keypos,*endpos;
my_off_t next_page,rec_pos; my_off_t next_page,rec_pos;
byte lastkey[HA_MAX_KEY_BUFF]; uchar lastkey[HA_MAX_KEY_BUFF];
char llbuff[22]; char llbuff[22];
MARIA_SORT_INFO *sort_info= sort_param->sort_info; MARIA_SORT_INFO *sort_info= sort_param->sort_info;
HA_CHECK *param=sort_info->param; HA_CHECK *param=sort_info->param;
@ -1664,7 +1664,7 @@ static int sort_record_index(MARIA_SORT_PARAM *sort_param,MARIA_HA *info,
if (nod_flag) if (nod_flag)
{ {
if (!(temp_buff= (byte*) my_alloca((uint) keyinfo->block_length))) if (!(temp_buff= (uchar*) my_alloca((uint) keyinfo->block_length)))
{ {
_ma_check_print_error(param,"Not Enough memory"); _ma_check_print_error(param,"Not Enough memory");
DBUG_RETURN(-1); DBUG_RETURN(-1);
@ -1679,7 +1679,7 @@ static int sort_record_index(MARIA_SORT_PARAM *sort_param,MARIA_HA *info,
if (nod_flag) if (nod_flag)
{ {
next_page= _ma_kpos(nod_flag, keypos); next_page= _ma_kpos(nod_flag, keypos);
if (my_pread(info->s->kfile.file, (byte*)temp_buff, if (my_pread(info->s->kfile.file, (uchar*)temp_buff,
(uint) keyinfo->block_length, next_page, (uint) keyinfo->block_length, next_page,
MYF(MY_NABP+MY_WME))) MYF(MY_NABP+MY_WME)))
{ {
@ -1719,19 +1719,19 @@ static int sort_record_index(MARIA_SORT_PARAM *sort_param,MARIA_HA *info,
goto err; goto err;
} }
/* Clear end of block to get better compression if the table is backuped */ /* Clear end of block to get better compression if the table is backuped */
bzero((byte*) buff+used_length,keyinfo->block_length-used_length); bzero((uchar*) buff+used_length,keyinfo->block_length-used_length);
if (my_pwrite(info->s->kfile.file, (byte*)buff, (uint)keyinfo->block_length, if (my_pwrite(info->s->kfile.file, (uchar*)buff, (uint)keyinfo->block_length,
page,param->myf_rw)) page,param->myf_rw))
{ {
_ma_check_print_error(param,"%d when updating keyblock",my_errno); _ma_check_print_error(param,"%d when updating keyblock",my_errno);
goto err; goto err;
} }
if (temp_buff) if (temp_buff)
my_afree((gptr) temp_buff); my_afree((uchar*) temp_buff);
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
if (temp_buff) if (temp_buff)
my_afree((gptr) temp_buff); my_afree((uchar*) temp_buff);
DBUG_RETURN(1); DBUG_RETURN(1);
} /* sort_record_index */ } /* sort_record_index */

View File

@ -227,7 +227,7 @@ typedef struct st_maria_share
char *data_file_name; /* Resolved path names from symlinks */ char *data_file_name; /* Resolved path names from symlinks */
char *index_file_name; char *index_file_name;
char *open_file_name; /* parameter to open filename */ char *open_file_name; /* parameter to open filename */
byte *file_map; /* mem-map of file if possible */ uchar *file_map; /* mem-map of file if possible */
PAGECACHE *pagecache; /* ref to the current key cache */ PAGECACHE *pagecache; /* ref to the current key cache */
MARIA_DECODE_TREE *decode_trees; MARIA_DECODE_TREE *decode_trees;
uint16 *decode_tables; uint16 *decode_tables;
@ -241,36 +241,36 @@ typedef struct st_maria_share
/* Is called for every close of the table */ /* Is called for every close of the table */
void (*end)(struct st_maria_info *); void (*end)(struct st_maria_info *);
/* Called when we want to read a record from a specific position */ /* Called when we want to read a record from a specific position */
int (*read_record)(struct st_maria_info *, byte *, MARIA_RECORD_POS); int (*read_record)(struct st_maria_info *, uchar *, MARIA_RECORD_POS);
/* Initialize a scan */ /* Initialize a scan */
my_bool (*scan_init)(struct st_maria_info *); my_bool (*scan_init)(struct st_maria_info *);
/* Read next record while scanning */ /* Read next record while scanning */
int (*scan)(struct st_maria_info *, byte *, MARIA_RECORD_POS, my_bool); int (*scan)(struct st_maria_info *, uchar *, MARIA_RECORD_POS, my_bool);
/* End scan */ /* End scan */
void (*scan_end)(struct st_maria_info *); void (*scan_end)(struct st_maria_info *);
/* Pre-write of row (some handlers may do the actual write here) */ /* Pre-write of row (some handlers may do the actual write here) */
MARIA_RECORD_POS (*write_record_init)(struct st_maria_info *, const byte *); MARIA_RECORD_POS (*write_record_init)(struct st_maria_info *, const uchar *);
/* Write record (or accept write_record_init) */ /* Write record (or accept write_record_init) */
my_bool (*write_record)(struct st_maria_info *, const byte *); my_bool (*write_record)(struct st_maria_info *, const uchar *);
/* Called when write failed */ /* Called when write failed */
my_bool (*write_record_abort)(struct st_maria_info *); my_bool (*write_record_abort)(struct st_maria_info *);
my_bool (*update_record)(struct st_maria_info *, MARIA_RECORD_POS, my_bool (*update_record)(struct st_maria_info *, MARIA_RECORD_POS,
const byte *, const byte *); const uchar *, const uchar *);
my_bool (*delete_record)(struct st_maria_info *, const byte *record); my_bool (*delete_record)(struct st_maria_info *, const uchar *record);
my_bool (*compare_record)(struct st_maria_info *, const byte *); my_bool (*compare_record)(struct st_maria_info *, const uchar *);
/* calculate checksum for a row */ /* calculate checksum for a row */
ha_checksum(*calc_checksum)(struct st_maria_info *, const byte *); ha_checksum(*calc_checksum)(struct st_maria_info *, const uchar *);
/* /*
Calculate checksum for a row during write. May be 0 if we calculate Calculate checksum for a row during write. May be 0 if we calculate
the checksum in write_record_init() the checksum in write_record_init()
*/ */
ha_checksum(*calc_write_checksum) (struct st_maria_info *, const byte *); ha_checksum(*calc_write_checksum) (struct st_maria_info *, const uchar *);
/* Compare a row in memory with a row on disk */ /* Compare a row in memory with a row on disk */
my_bool (*compare_unique)(struct st_maria_info *, MARIA_UNIQUEDEF *, my_bool (*compare_unique)(struct st_maria_info *, MARIA_UNIQUEDEF *,
const byte *record, MARIA_RECORD_POS pos); const uchar *record, MARIA_RECORD_POS pos);
/* Mapings to read/write the data file */ /* Mapings to read/write the data file */
uint (*file_read)(MARIA_HA *, byte *, uint, my_off_t, myf); uint (*file_read)(MARIA_HA *, uchar *, uint, my_off_t, myf);
uint (*file_write)(MARIA_HA *, byte *, uint, my_off_t, myf); uint (*file_write)(MARIA_HA *, uchar *, uint, my_off_t, myf);
invalidator_by_filename invalidator; /* query cache invalidator */ invalidator_by_filename invalidator; /* query cache invalidator */
ulong this_process; /* processid */ ulong this_process; /* processid */
ulong last_process; /* For table-change-check */ ulong last_process; /* For table-change-check */
@ -316,7 +316,7 @@ typedef struct st_maria_share
} MARIA_SHARE; } MARIA_SHARE;
typedef byte MARIA_BITMAP_BUFFER; typedef uchar MARIA_BITMAP_BUFFER;
typedef struct st_maria_bitmap_block typedef struct st_maria_bitmap_block
{ {
@ -351,12 +351,12 @@ typedef struct st_maria_row
MARIA_RECORD_POS lastpos, nextpos; MARIA_RECORD_POS lastpos, nextpos;
MARIA_RECORD_POS *tail_positions; MARIA_RECORD_POS *tail_positions;
ha_checksum checksum; ha_checksum checksum;
byte *empty_bits, *field_lengths; uchar *empty_bits, *field_lengths;
uint *null_field_lengths; /* All null field lengths */ uint *null_field_lengths; /* All null field lengths */
ulong *blob_lengths; /* Length for each blob */ ulong *blob_lengths; /* Length for each blob */
ulong base_length, normal_length, char_length, varchar_length, blob_length; ulong base_length, normal_length, char_length, varchar_length, blob_length;
ulong head_length, total_length; ulong head_length, total_length;
my_size_t extents_buffer_length; /* Size of 'extents' buffer */ size_t extents_buffer_length; /* Size of 'extents' buffer */
uint field_lengths_length; /* Length of data in field_lengths */ uint field_lengths_length; /* Length of data in field_lengths */
uint extents_count; /* number of extents in 'extents' */ uint extents_count; /* number of extents in 'extents' */
uint full_page_count, tail_count; /* For maria_chk */ uint full_page_count, tail_count; /* For maria_chk */
@ -365,8 +365,8 @@ typedef struct st_maria_row
/* Data to scan row in blocked format */ /* Data to scan row in blocked format */
typedef struct st_maria_block_scan typedef struct st_maria_block_scan
{ {
byte *bitmap_buff, *bitmap_pos, *bitmap_end, *page_buff; uchar *bitmap_buff, *bitmap_pos, *bitmap_end, *page_buff;
byte *dir, *dir_end; uchar *dir, *dir_end;
ulong bitmap_page; ulong bitmap_page;
ulonglong bits; ulonglong bits;
uint number_of_rows, bit_pos; uint number_of_rows, bit_pos;
@ -392,17 +392,17 @@ struct st_maria_info
DYNAMIC_ARRAY *ft1_to_ft2; /* used only in ft1->ft2 conversion */ DYNAMIC_ARRAY *ft1_to_ft2; /* used only in ft1->ft2 conversion */
MEM_ROOT ft_memroot; /* used by the parser */ MEM_ROOT ft_memroot; /* used by the parser */
MYSQL_FTPARSER_PARAM *ftparser_param; /* share info between init/deinit */ MYSQL_FTPARSER_PARAM *ftparser_param; /* share info between init/deinit */
byte *buff; /* page buffer */ uchar *buff; /* page buffer */
byte *keyread_buff; /* Buffer for last key read */ uchar *keyread_buff; /* Buffer for last key read */
byte *lastkey, *lastkey2; /* Last used search key */ uchar *lastkey, *lastkey2; /* Last used search key */
byte *first_mbr_key; /* Searhed spatial key */ uchar *first_mbr_key; /* Searhed spatial key */
byte *rec_buff; /* Temp buffer for recordpack */ uchar *rec_buff; /* Temp buffer for recordpack */
byte *int_keypos, /* Save position for next/previous */ uchar *int_keypos, /* Save position for next/previous */
*int_maxpos; /* -""- */ *int_maxpos; /* -""- */
byte *update_field_data; /* Used by update in rows-in-block */ uchar *update_field_data; /* Used by update in rows-in-block */
uint int_nod_flag; /* -""- */ uint int_nod_flag; /* -""- */
uint32 int_keytree_version; /* -""- */ uint32 int_keytree_version; /* -""- */
int (*read_record) (struct st_maria_info *, byte*, MARIA_RECORD_POS); int (*read_record) (struct st_maria_info *, uchar*, MARIA_RECORD_POS);
invalidator_by_filename invalidator; /* query cache invalidator */ invalidator_by_filename invalidator; /* query cache invalidator */
ulong this_unique; /* uniq filenumber or thread */ ulong this_unique; /* uniq filenumber or thread */
ulong last_unique; /* last unique number */ ulong last_unique; /* last unique number */
@ -419,7 +419,7 @@ struct st_maria_info
as they are not compatible with parallel repair as they are not compatible with parallel repair
*/ */
ulong packed_length, blob_length; /* Length of found, packed record */ ulong packed_length, blob_length; /* Length of found, packed record */
my_size_t rec_buff_size; size_t rec_buff_size;
PAGECACHE_FILE dfile; /* The datafile */ PAGECACHE_FILE dfile; /* The datafile */
uint opt_flag; /* Optim. for space/speed */ uint opt_flag; /* Optim. for space/speed */
uint update; /* If file changed since open */ uint update; /* If file changed since open */
@ -543,7 +543,7 @@ struct st_maria_info
#define MARIA_DYN_MAX_BLOCK_LENGTH ((1L << 24)-4L) #define MARIA_DYN_MAX_BLOCK_LENGTH ((1L << 24)-4L)
#define MARIA_DYN_MAX_ROW_LENGTH (MARIA_DYN_MAX_BLOCK_LENGTH - MARIA_SPLIT_LENGTH) #define MARIA_DYN_MAX_ROW_LENGTH (MARIA_DYN_MAX_BLOCK_LENGTH - MARIA_SPLIT_LENGTH)
#define MARIA_DYN_ALIGN_SIZE 4 /* Align blocks on this */ #define MARIA_DYN_ALIGN_SIZE 4 /* Align blocks on this */
#define MARIA_MAX_DYN_HEADER_BYTE 13 /* max header byte for dynamic rows */ #define MARIA_MAX_DYN_HEADER_BYTE 13 /* max header uchar for dynamic rows */
#define MARIA_MAX_BLOCK_LENGTH ((((ulong) 1 << 24)-1) & (~ (ulong) (MARIA_DYN_ALIGN_SIZE-1))) #define MARIA_MAX_BLOCK_LENGTH ((((ulong) 1 << 24)-1) & (~ (ulong) (MARIA_DYN_ALIGN_SIZE-1)))
#define MARIA_REC_BUFF_OFFSET ALIGN_SIZE(MARIA_DYN_DELETE_BLOCK_HEADER+sizeof(uint32)) #define MARIA_REC_BUFF_OFFSET ALIGN_SIZE(MARIA_DYN_DELETE_BLOCK_HEADER+sizeof(uint32))
@ -584,7 +584,7 @@ extern uchar NEAR maria_file_magic[], NEAR maria_pack_file_magic[];
extern uint NEAR maria_read_vec[], NEAR maria_readnext_vec[]; extern uint NEAR maria_read_vec[], NEAR maria_readnext_vec[];
extern uint maria_quick_table_bits; extern uint maria_quick_table_bits;
extern const char *maria_data_root; extern const char *maria_data_root;
extern byte maria_zero_string[]; extern uchar maria_zero_string[];
extern my_bool maria_inited; extern my_bool maria_inited;
@ -593,8 +593,8 @@ typedef struct st_maria_s_param
{ {
uint ref_length, key_length, n_ref_length; uint ref_length, key_length, n_ref_length;
uint n_length, totlength, part_of_prev_key, prev_length, pack_marker; uint n_length, totlength, part_of_prev_key, prev_length, pack_marker;
const byte *key; const uchar *key;
byte *prev_key, *next_key_pos; uchar *prev_key, *next_key_pos;
bool store_not_null; bool store_not_null;
} MARIA_KEY_PARAM; } MARIA_KEY_PARAM;
@ -608,73 +608,73 @@ typedef struct st_pinned_page
/* Prototypes for intern functions */ /* Prototypes for intern functions */
extern int _ma_read_dynamic_record(MARIA_HA *, byte *, MARIA_RECORD_POS); extern int _ma_read_dynamic_record(MARIA_HA *, uchar *, MARIA_RECORD_POS);
extern int _ma_read_rnd_dynamic_record(MARIA_HA *, byte *, MARIA_RECORD_POS, extern int _ma_read_rnd_dynamic_record(MARIA_HA *, uchar *, MARIA_RECORD_POS,
my_bool); my_bool);
extern my_bool _ma_write_dynamic_record(MARIA_HA *, const byte *); extern my_bool _ma_write_dynamic_record(MARIA_HA *, const uchar *);
extern my_bool _ma_update_dynamic_record(MARIA_HA *, MARIA_RECORD_POS, extern my_bool _ma_update_dynamic_record(MARIA_HA *, MARIA_RECORD_POS,
const byte *, const byte *); const uchar *, const uchar *);
extern my_bool _ma_delete_dynamic_record(MARIA_HA *info, const byte *record); extern my_bool _ma_delete_dynamic_record(MARIA_HA *info, const uchar *record);
extern my_bool _ma_cmp_dynamic_record(MARIA_HA *info, const byte *record); extern my_bool _ma_cmp_dynamic_record(MARIA_HA *info, const uchar *record);
extern my_bool _ma_write_blob_record(MARIA_HA *, const byte *); extern my_bool _ma_write_blob_record(MARIA_HA *, const uchar *);
extern my_bool _ma_update_blob_record(MARIA_HA *, MARIA_RECORD_POS, extern my_bool _ma_update_blob_record(MARIA_HA *, MARIA_RECORD_POS,
const byte *, const byte *); const uchar *, const uchar *);
extern int _ma_read_static_record(MARIA_HA *info, byte *, MARIA_RECORD_POS); extern int _ma_read_static_record(MARIA_HA *info, uchar *, MARIA_RECORD_POS);
extern int _ma_read_rnd_static_record(MARIA_HA *, byte *, MARIA_RECORD_POS, extern int _ma_read_rnd_static_record(MARIA_HA *, uchar *, MARIA_RECORD_POS,
my_bool); my_bool);
extern my_bool _ma_write_static_record(MARIA_HA *, const byte *); extern my_bool _ma_write_static_record(MARIA_HA *, const uchar *);
extern my_bool _ma_update_static_record(MARIA_HA *, MARIA_RECORD_POS, extern my_bool _ma_update_static_record(MARIA_HA *, MARIA_RECORD_POS,
const byte *, const byte *); const uchar *, const uchar *);
extern my_bool _ma_delete_static_record(MARIA_HA *info, const byte *record); extern my_bool _ma_delete_static_record(MARIA_HA *info, const uchar *record);
extern my_bool _ma_cmp_static_record(MARIA_HA *info, const byte *record); extern my_bool _ma_cmp_static_record(MARIA_HA *info, const uchar *record);
extern int _ma_ck_write(MARIA_HA *info, uint keynr, byte *key, extern int _ma_ck_write(MARIA_HA *info, uint keynr, uchar *key,
uint length); uint length);
extern int _ma_ck_real_write_btree(MARIA_HA *info, MARIA_KEYDEF *keyinfo, extern int _ma_ck_real_write_btree(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *key, uint key_length, uchar *key, uint key_length,
MARIA_RECORD_POS *root, uint comp_flag); MARIA_RECORD_POS *root, uint comp_flag);
extern int _ma_enlarge_root(MARIA_HA *info, MARIA_KEYDEF *keyinfo, extern int _ma_enlarge_root(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *key, MARIA_RECORD_POS *root); uchar *key, MARIA_RECORD_POS *root);
extern int _ma_insert(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *key, extern int _ma_insert(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uchar *key,
byte *anc_buff, byte *key_pos, byte *key_buff, uchar *anc_buff, uchar *key_pos, uchar *key_buff,
byte *father_buff, byte *father_keypos, uchar *father_buff, uchar *father_keypos,
my_off_t father_page, my_bool insert_last); my_off_t father_page, my_bool insert_last);
extern int _ma_split_page(MARIA_HA *info, MARIA_KEYDEF *keyinfo, extern int _ma_split_page(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *key, byte *buff, byte *key_buff, uchar *key, uchar *buff, uchar *key_buff,
my_bool insert_last); my_bool insert_last);
extern byte *_ma_find_half_pos(uint nod_flag, MARIA_KEYDEF *keyinfo, extern uchar *_ma_find_half_pos(uint nod_flag, MARIA_KEYDEF *keyinfo,
byte *page, byte *key, uchar *page, uchar *key,
uint *return_key_length, uint *return_key_length,
byte ** after_key); uchar ** after_key);
extern int _ma_calc_static_key_length(MARIA_KEYDEF *keyinfo, uint nod_flag, extern int _ma_calc_static_key_length(MARIA_KEYDEF *keyinfo, uint nod_flag,
byte *key_pos, byte *org_key, uchar *key_pos, uchar *org_key,
byte *key_buff, const byte *key, uchar *key_buff, const uchar *key,
MARIA_KEY_PARAM *s_temp); MARIA_KEY_PARAM *s_temp);
extern int _ma_calc_var_key_length(MARIA_KEYDEF *keyinfo, uint nod_flag, extern int _ma_calc_var_key_length(MARIA_KEYDEF *keyinfo, uint nod_flag,
byte *key_pos, byte *org_key, uchar *key_pos, uchar *org_key,
byte *key_buff, const byte *key, uchar *key_buff, const uchar *key,
MARIA_KEY_PARAM *s_temp); MARIA_KEY_PARAM *s_temp);
extern int _ma_calc_var_pack_key_length(MARIA_KEYDEF *keyinfo, extern int _ma_calc_var_pack_key_length(MARIA_KEYDEF *keyinfo,
uint nod_flag, byte *key_pos, uint nod_flag, uchar *key_pos,
byte *org_key, byte *prev_key, uchar *org_key, uchar *prev_key,
const byte *key, const uchar *key,
MARIA_KEY_PARAM *s_temp); MARIA_KEY_PARAM *s_temp);
extern int _ma_calc_bin_pack_key_length(MARIA_KEYDEF *keyinfo, extern int _ma_calc_bin_pack_key_length(MARIA_KEYDEF *keyinfo,
uint nod_flag, byte *key_pos, uint nod_flag, uchar *key_pos,
byte *org_key, byte *prev_key, uchar *org_key, uchar *prev_key,
const byte *key, const uchar *key,
MARIA_KEY_PARAM *s_temp); MARIA_KEY_PARAM *s_temp);
void _ma_store_static_key(MARIA_KEYDEF *keyinfo, byte *key_pos, void _ma_store_static_key(MARIA_KEYDEF *keyinfo, uchar *key_pos,
MARIA_KEY_PARAM *s_temp); MARIA_KEY_PARAM *s_temp);
void _ma_store_var_pack_key(MARIA_KEYDEF *keyinfo, byte *key_pos, void _ma_store_var_pack_key(MARIA_KEYDEF *keyinfo, uchar *key_pos,
MARIA_KEY_PARAM *s_temp); MARIA_KEY_PARAM *s_temp);
#ifdef NOT_USED #ifdef NOT_USED
void _ma_store_pack_key(MARIA_KEYDEF *keyinfo, byte *key_pos, void _ma_store_pack_key(MARIA_KEYDEF *keyinfo, uchar *key_pos,
MARIA_KEY_PARAM *s_temp); MARIA_KEY_PARAM *s_temp);
#endif #endif
void _ma_store_bin_pack_key(MARIA_KEYDEF *keyinfo, byte *key_pos, void _ma_store_bin_pack_key(MARIA_KEYDEF *keyinfo, uchar *key_pos,
MARIA_KEY_PARAM *s_temp); MARIA_KEY_PARAM *s_temp);
extern int _ma_ck_delete(MARIA_HA *info, uint keynr, byte *key, extern int _ma_ck_delete(MARIA_HA *info, uint keynr, uchar *key,
uint key_length); uint key_length);
extern int _ma_readinfo(MARIA_HA *info, int lock_flag, int check_keybuffer); extern int _ma_readinfo(MARIA_HA *info, int lock_flag, int check_keybuffer);
extern int _ma_writeinfo(MARIA_HA *info, uint options); extern int _ma_writeinfo(MARIA_HA *info, uint options);
@ -682,91 +682,91 @@ extern int _ma_test_if_changed(MARIA_HA *info);
extern int _ma_mark_file_changed(MARIA_HA *info); extern int _ma_mark_file_changed(MARIA_HA *info);
extern int _ma_decrement_open_count(MARIA_HA *info); extern int _ma_decrement_open_count(MARIA_HA *info);
extern int _ma_check_index(MARIA_HA *info, int inx); extern int _ma_check_index(MARIA_HA *info, int inx);
extern int _ma_search(MARIA_HA *info, MARIA_KEYDEF *keyinfo, byte *key, extern int _ma_search(MARIA_HA *info, MARIA_KEYDEF *keyinfo, uchar *key,
uint key_len, uint nextflag, my_off_t pos); uint key_len, uint nextflag, my_off_t pos);
extern int _ma_bin_search(struct st_maria_info *info, MARIA_KEYDEF *keyinfo, extern int _ma_bin_search(struct st_maria_info *info, MARIA_KEYDEF *keyinfo,
byte *page, byte *key, uint key_len, uchar *page, uchar *key, uint key_len,
uint comp_flag, byte **ret_pos, byte *buff, uint comp_flag, uchar **ret_pos, uchar *buff,
my_bool *was_last_key); my_bool *was_last_key);
extern int _ma_seq_search(MARIA_HA *info, MARIA_KEYDEF *keyinfo, extern int _ma_seq_search(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *page, byte *key, uint key_len, uchar *page, uchar *key, uint key_len,
uint comp_flag, byte ** ret_pos, byte *buff, uint comp_flag, uchar ** ret_pos, uchar *buff,
my_bool *was_last_key); my_bool *was_last_key);
extern int _ma_prefix_search(MARIA_HA *info, MARIA_KEYDEF *keyinfo, extern int _ma_prefix_search(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *page, byte *key, uint key_len, uchar *page, uchar *key, uint key_len,
uint comp_flag, byte ** ret_pos, byte *buff, uint comp_flag, uchar ** ret_pos, uchar *buff,
my_bool *was_last_key); my_bool *was_last_key);
extern my_off_t _ma_kpos(uint nod_flag, byte *after_key); extern my_off_t _ma_kpos(uint nod_flag, uchar *after_key);
extern void _ma_kpointer(MARIA_HA *info, byte *buff, my_off_t pos); extern void _ma_kpointer(MARIA_HA *info, uchar *buff, my_off_t pos);
extern MARIA_RECORD_POS _ma_dpos(MARIA_HA *info, uint nod_flag, extern MARIA_RECORD_POS _ma_dpos(MARIA_HA *info, uint nod_flag,
const byte *after_key); const uchar *after_key);
extern MARIA_RECORD_POS _ma_rec_pos(MARIA_SHARE *info, byte *ptr); extern MARIA_RECORD_POS _ma_rec_pos(MARIA_SHARE *info, uchar *ptr);
extern void _ma_dpointer(MARIA_HA *info, byte *buff, MARIA_RECORD_POS pos); extern void _ma_dpointer(MARIA_HA *info, uchar *buff, MARIA_RECORD_POS pos);
extern uint _ma_get_static_key(MARIA_KEYDEF *keyinfo, uint nod_flag, extern uint _ma_get_static_key(MARIA_KEYDEF *keyinfo, uint nod_flag,
byte **page, byte *key); uchar **page, uchar *key);
extern uint _ma_get_pack_key(MARIA_KEYDEF *keyinfo, uint nod_flag, extern uint _ma_get_pack_key(MARIA_KEYDEF *keyinfo, uint nod_flag,
byte **page, byte *key); uchar **page, uchar *key);
extern uint _ma_get_binary_pack_key(MARIA_KEYDEF *keyinfo, uint nod_flag, extern uint _ma_get_binary_pack_key(MARIA_KEYDEF *keyinfo, uint nod_flag,
byte ** page_pos, byte *key); uchar ** page_pos, uchar *key);
extern byte *_ma_get_last_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, extern uchar *_ma_get_last_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *keypos, byte *lastkey, uchar *keypos, uchar *lastkey,
byte *endpos, uint *return_key_length); uchar *endpos, uint *return_key_length);
extern byte *_ma_get_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo, extern uchar *_ma_get_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *page, byte *key, byte *keypos, uchar *page, uchar *key, uchar *keypos,
uint *return_key_length); uint *return_key_length);
extern uint _ma_keylength(MARIA_KEYDEF *keyinfo, const byte *key); extern uint _ma_keylength(MARIA_KEYDEF *keyinfo, const uchar *key);
extern uint _ma_keylength_part(MARIA_KEYDEF *keyinfo, register const byte *key, extern uint _ma_keylength_part(MARIA_KEYDEF *keyinfo, register const uchar *key,
HA_KEYSEG *end); HA_KEYSEG *end);
extern byte *_ma_move_key(MARIA_KEYDEF *keyinfo, byte *to, const byte *from); extern uchar *_ma_move_key(MARIA_KEYDEF *keyinfo, uchar *to, const uchar *from);
extern int _ma_search_next(MARIA_HA *info, MARIA_KEYDEF *keyinfo, extern int _ma_search_next(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
byte *key, uint key_length, uint nextflag, uchar *key, uint key_length, uint nextflag,
my_off_t pos); my_off_t pos);
extern int _ma_search_first(MARIA_HA *info, MARIA_KEYDEF *keyinfo, extern int _ma_search_first(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
my_off_t pos); my_off_t pos);
extern int _ma_search_last(MARIA_HA *info, MARIA_KEYDEF *keyinfo, extern int _ma_search_last(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
my_off_t pos); my_off_t pos);
extern byte *_ma_fetch_keypage(MARIA_HA *info, MARIA_KEYDEF *keyinfo, extern uchar *_ma_fetch_keypage(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
my_off_t page, int level, byte *buff, my_off_t page, int level, uchar *buff,
int return_buffer); int return_buffer);
extern int _ma_write_keypage(MARIA_HA *info, MARIA_KEYDEF *keyinfo, extern int _ma_write_keypage(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
my_off_t page, int level, byte *buff); my_off_t page, int level, uchar *buff);
extern int _ma_dispose(MARIA_HA *info, MARIA_KEYDEF *keyinfo, my_off_t pos, extern int _ma_dispose(MARIA_HA *info, MARIA_KEYDEF *keyinfo, my_off_t pos,
int level); int level);
extern my_off_t _ma_new(MARIA_HA *info, MARIA_KEYDEF *keyinfo, int level); extern my_off_t _ma_new(MARIA_HA *info, MARIA_KEYDEF *keyinfo, int level);
extern uint _ma_make_key(MARIA_HA *info, uint keynr, byte *key, extern uint _ma_make_key(MARIA_HA *info, uint keynr, uchar *key,
const byte *record, MARIA_RECORD_POS filepos); const uchar *record, MARIA_RECORD_POS filepos);
extern uint _ma_pack_key(MARIA_HA *info, uint keynr, byte *key, extern uint _ma_pack_key(MARIA_HA *info, uint keynr, uchar *key,
const byte *old, uint key_length, const uchar *old, uint key_length,
HA_KEYSEG ** last_used_keyseg); HA_KEYSEG ** last_used_keyseg);
extern int _ma_read_key_record(MARIA_HA *info, byte *buf, MARIA_RECORD_POS); extern int _ma_read_key_record(MARIA_HA *info, uchar *buf, MARIA_RECORD_POS);
extern int _ma_read_cache(IO_CACHE *info, byte *buff, MARIA_RECORD_POS pos, extern int _ma_read_cache(IO_CACHE *info, uchar *buff, MARIA_RECORD_POS pos,
uint length, int re_read_if_possibly); uint length, int re_read_if_possibly);
extern ulonglong ma_retrieve_auto_increment(MARIA_HA *info, const byte *record); extern ulonglong ma_retrieve_auto_increment(MARIA_HA *info, const uchar *record);
extern my_bool _ma_alloc_buffer(byte **old_addr, my_size_t *old_size, extern my_bool _ma_alloc_buffer(uchar **old_addr, size_t *old_size,
my_size_t new_size); size_t new_size);
extern ulong _ma_rec_unpack(MARIA_HA *info, byte *to, byte *from, extern ulong _ma_rec_unpack(MARIA_HA *info, uchar *to, uchar *from,
ulong reclength); ulong reclength);
extern my_bool _ma_rec_check(MARIA_HA *info, const char *record, extern my_bool _ma_rec_check(MARIA_HA *info, const char *record,
byte *packpos, ulong packed_length, uchar *packpos, ulong packed_length,
my_bool with_checkum); my_bool with_checkum);
extern int _ma_write_part_record(MARIA_HA *info, my_off_t filepos, extern int _ma_write_part_record(MARIA_HA *info, my_off_t filepos,
ulong length, my_off_t next_filepos, ulong length, my_off_t next_filepos,
byte ** record, ulong *reclength, uchar ** record, ulong *reclength,
int *flag); int *flag);
extern void _ma_print_key(FILE *stream, HA_KEYSEG *keyseg, extern void _ma_print_key(FILE *stream, HA_KEYSEG *keyseg,
const byte *key, uint length); const uchar *key, uint length);
extern my_bool _ma_once_init_pack_row(MARIA_SHARE *share, File dfile); extern my_bool _ma_once_init_pack_row(MARIA_SHARE *share, File dfile);
extern my_bool _ma_once_end_pack_row(MARIA_SHARE *share); extern my_bool _ma_once_end_pack_row(MARIA_SHARE *share);
extern int _ma_read_pack_record(MARIA_HA *info, byte *buf, extern int _ma_read_pack_record(MARIA_HA *info, uchar *buf,
MARIA_RECORD_POS filepos); MARIA_RECORD_POS filepos);
extern int _ma_read_rnd_pack_record(MARIA_HA *, byte *, MARIA_RECORD_POS, extern int _ma_read_rnd_pack_record(MARIA_HA *, uchar *, MARIA_RECORD_POS,
my_bool); my_bool);
extern int _ma_pack_rec_unpack(MARIA_HA *info, MARIA_BIT_BUFF *bit_buff, extern int _ma_pack_rec_unpack(MARIA_HA *info, MARIA_BIT_BUFF *bit_buff,
byte *to, byte *from, ulong reclength); uchar *to, uchar *from, ulong reclength);
extern ulonglong _ma_safe_mul(ulonglong a, ulonglong b); extern ulonglong _ma_safe_mul(ulonglong a, ulonglong b);
extern int _ma_ft_update(MARIA_HA *info, uint keynr, byte *keybuf, extern int _ma_ft_update(MARIA_HA *info, uint keynr, uchar *keybuf,
const byte *oldrec, const byte *newrec, const uchar *oldrec, const uchar *newrec,
my_off_t pos); my_off_t pos);
/* /*
@ -821,30 +821,30 @@ typedef struct st_maria_block_info
#define fast_ma_readinfo(INFO) ((INFO)->lock_type == F_UNLCK) && _ma_readinfo((INFO),F_RDLCK,1) #define fast_ma_readinfo(INFO) ((INFO)->lock_type == F_UNLCK) && _ma_readinfo((INFO),F_RDLCK,1)
extern uint _ma_get_block_info(MARIA_BLOCK_INFO *, File, my_off_t); extern uint _ma_get_block_info(MARIA_BLOCK_INFO *, File, my_off_t);
extern uint _ma_rec_pack(MARIA_HA *info, byte *to, const byte *from); extern uint _ma_rec_pack(MARIA_HA *info, uchar *to, const uchar *from);
extern uint _ma_pack_get_block_info(MARIA_HA *maria, MARIA_BIT_BUFF *bit_buff, extern uint _ma_pack_get_block_info(MARIA_HA *maria, MARIA_BIT_BUFF *bit_buff,
MARIA_BLOCK_INFO *info, byte **rec_buff_p, MARIA_BLOCK_INFO *info, uchar **rec_buff_p,
my_size_t *rec_buff_size, size_t *rec_buff_size,
File file, my_off_t filepos); File file, my_off_t filepos);
extern void _ma_store_blob_length(byte *pos, uint pack_length, uint length); extern void _ma_store_blob_length(uchar *pos, uint pack_length, uint length);
extern void _ma_report_error(int errcode, const char *file_name); extern void _ma_report_error(int errcode, const char *file_name);
extern my_bool _ma_memmap_file(MARIA_HA *info); extern my_bool _ma_memmap_file(MARIA_HA *info);
extern void _ma_unmap_file(MARIA_HA *info); extern void _ma_unmap_file(MARIA_HA *info);
extern uint _ma_save_pack_length(uint version, byte * block_buff, extern uint _ma_save_pack_length(uint version, uchar * block_buff,
ulong length); ulong length);
extern uint _ma_calc_pack_length(uint version, ulong length); extern uint _ma_calc_pack_length(uint version, ulong length);
extern ulong _ma_calc_blob_length(uint length, const byte *pos); extern ulong _ma_calc_blob_length(uint length, const uchar *pos);
extern uint _ma_mmap_pread(MARIA_HA *info, byte *Buffer, extern uint _ma_mmap_pread(MARIA_HA *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags); uint Count, my_off_t offset, myf MyFlags);
extern uint _ma_mmap_pwrite(MARIA_HA *info, byte *Buffer, extern uint _ma_mmap_pwrite(MARIA_HA *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags); uint Count, my_off_t offset, myf MyFlags);
extern uint _ma_nommap_pread(MARIA_HA *info, byte *Buffer, extern uint _ma_nommap_pread(MARIA_HA *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags); uint Count, my_off_t offset, myf MyFlags);
extern uint _ma_nommap_pwrite(MARIA_HA *info, byte *Buffer, extern uint _ma_nommap_pwrite(MARIA_HA *info, uchar *Buffer,
uint Count, my_off_t offset, myf MyFlags); uint Count, my_off_t offset, myf MyFlags);
uint _ma_state_info_write(File file, MARIA_STATE_INFO *state, uint pWrite); uint _ma_state_info_write(File file, MARIA_STATE_INFO *state, uint pWrite);
byte *_ma_state_info_read(byte *ptr, MARIA_STATE_INFO *state); uchar *_ma_state_info_read(uchar *ptr, MARIA_STATE_INFO *state);
uint _ma_state_info_read_dsk(File file, MARIA_STATE_INFO *state, uint _ma_state_info_read_dsk(File file, MARIA_STATE_INFO *state,
my_bool pRead); my_bool pRead);
uint _ma_base_info_write(File file, MARIA_BASE_INFO *base); uint _ma_base_info_write(File file, MARIA_BASE_INFO *base);
@ -856,18 +856,18 @@ uint _ma_uniquedef_write(File file, MARIA_UNIQUEDEF *keydef);
char *_ma_uniquedef_read(char *ptr, MARIA_UNIQUEDEF *keydef); char *_ma_uniquedef_read(char *ptr, MARIA_UNIQUEDEF *keydef);
uint _ma_columndef_write(File file, MARIA_COLUMNDEF *columndef); uint _ma_columndef_write(File file, MARIA_COLUMNDEF *columndef);
char *_ma_columndef_read(char *ptr, MARIA_COLUMNDEF *columndef); char *_ma_columndef_read(char *ptr, MARIA_COLUMNDEF *columndef);
ulong _ma_calc_total_blob_length(MARIA_HA *info, const byte *record); ulong _ma_calc_total_blob_length(MARIA_HA *info, const uchar *record);
ha_checksum _ma_checksum(MARIA_HA *info, const byte *buf); ha_checksum _ma_checksum(MARIA_HA *info, const uchar *buf);
ha_checksum _ma_static_checksum(MARIA_HA *info, const byte *buf); ha_checksum _ma_static_checksum(MARIA_HA *info, const uchar *buf);
my_bool _ma_check_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, my_bool _ma_check_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
byte *record, ha_checksum unique_hash, uchar *record, ha_checksum unique_hash,
MARIA_RECORD_POS pos); MARIA_RECORD_POS pos);
ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const byte *buf); ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const uchar *buf);
my_bool _ma_cmp_static_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, my_bool _ma_cmp_static_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
const byte *record, MARIA_RECORD_POS pos); const uchar *record, MARIA_RECORD_POS pos);
my_bool _ma_cmp_dynamic_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, my_bool _ma_cmp_dynamic_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
const byte *record, MARIA_RECORD_POS pos); const uchar *record, MARIA_RECORD_POS pos);
my_bool _ma_unique_comp(MARIA_UNIQUEDEF *def, const byte *a, const byte *b, my_bool _ma_unique_comp(MARIA_UNIQUEDEF *def, const uchar *a, const uchar *b,
my_bool null_are_equal); my_bool null_are_equal);
void _ma_get_status(void *param, int concurrent_insert); void _ma_get_status(void *param, int concurrent_insert);
void _ma_update_status(void *param); void _ma_update_status(void *param);
@ -883,7 +883,7 @@ void _ma_setup_functions(register MARIA_SHARE *share);
my_bool _ma_dynmap_file(MARIA_HA *info, my_off_t size); my_bool _ma_dynmap_file(MARIA_HA *info, my_off_t size);
void _ma_remap_file(MARIA_HA *info, my_off_t size); void _ma_remap_file(MARIA_HA *info, my_off_t size);
MARIA_RECORD_POS _ma_write_init_default(MARIA_HA *info, const byte *record); MARIA_RECORD_POS _ma_write_init_default(MARIA_HA *info, const uchar *record);
my_bool _ma_write_abort_default(MARIA_HA *info); my_bool _ma_write_abort_default(MARIA_HA *info);
/* Functions needed by _ma_check (are overrided in MySQL) */ /* Functions needed by _ma_check (are overrided in MySQL) */

View File

@ -46,7 +46,7 @@ static struct my_option my_long_options[] =
{"stats", 's', "Report global stats.", {"stats", 's', "Report global stats.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Be verbose.", {"verbose", 'v', "Be verbose.",
(gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}; };

View File

@ -69,8 +69,8 @@ typedef struct st_huff_counts {
my_off_t pre_space[8]; my_off_t pre_space[8];
my_off_t tot_end_space,tot_pre_space,zero_fields,empty_fields,bytes_packed; my_off_t tot_end_space,tot_pre_space,zero_fields,empty_fields,bytes_packed;
TREE int_tree; /* Tree for detecting distinct column values. */ TREE int_tree; /* Tree for detecting distinct column values. */
byte *tree_buff; /* Column values, 'field_length' each. */ uchar *tree_buff; /* Column values, 'field_length' each. */
byte *tree_pos; /* Points to end of column values in 'tree_buff'. */ uchar *tree_pos; /* Points to end of column values in 'tree_buff'. */
} HUFF_COUNTS; } HUFF_COUNTS;
typedef struct st_huff_element HUFF_ELEMENT; typedef struct st_huff_element HUFF_ELEMENT;
@ -141,8 +141,8 @@ static int test_space_compress(HUFF_COUNTS *huff_counts,my_off_t records,
enum en_fieldtype field_type); enum en_fieldtype field_type);
static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts,uint trees); static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts,uint trees);
static int make_huff_tree(HUFF_TREE *tree,HUFF_COUNTS *huff_counts); static int make_huff_tree(HUFF_TREE *tree,HUFF_COUNTS *huff_counts);
static int compare_huff_elements(void *not_used, byte *a,byte *b); static int compare_huff_elements(void *not_used, uchar *a,uchar *b);
static int save_counts_in_queue(byte *key,element_count count, static int save_counts_in_queue(uchar *key,element_count count,
HUFF_TREE *tree); HUFF_TREE *tree);
static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,uint flag); static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,uint flag);
static uint join_same_trees(HUFF_COUNTS *huff_counts,uint trees); static uint join_same_trees(HUFF_COUNTS *huff_counts,uint trees);
@ -171,7 +171,7 @@ static int save_state(MARIA_HA *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length
static int save_state_mrg(File file,PACK_MRG_INFO *isam_file,my_off_t new_length, static int save_state_mrg(File file,PACK_MRG_INFO *isam_file,my_off_t new_length,
ha_checksum crc); ha_checksum crc);
static int mrg_close(PACK_MRG_INFO *mrg); static int mrg_close(PACK_MRG_INFO *mrg);
static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf); static int mrg_rrnd(PACK_MRG_INFO *info,uchar *buf);
static void mrg_reset(PACK_MRG_INFO *mrg); static void mrg_reset(PACK_MRG_INFO *mrg);
#if !defined(DBUG_OFF) #if !defined(DBUG_OFF)
static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count); static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count);
@ -259,10 +259,10 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
{"backup", 'b', "Make a backup of the table as table_name.OLD.", {"backup", 'b', "Make a backup of the table as table_name.OLD.",
(gptr*) &backup, (gptr*) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, (uchar**) &backup, (uchar**) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR_MP, {"character-sets-dir", OPT_CHARSETS_DIR_MP,
"Directory where character sets are.", (gptr*) &charsets_dir, "Directory where character sets are.", (uchar**) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f', {"force", 'f',
@ -270,7 +270,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"join", 'j', {"join", 'j',
"Join all given tables into 'new_table_name'. All tables MUST have identical layouts.", "Join all given tables into 'new_table_name'. All tables MUST have identical layouts.",
(gptr*) &join_table, (gptr*) &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, (uchar**) &join_table, (uchar**) &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0}, 0, 0, 0},
{"help", '?', "Display this help and exit.", {"help", '?', "Display this help and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -284,8 +284,8 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", {"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"wait", 'w', "Wait and retry if table is in use.", (gptr*) &opt_wait, {"wait", 'w', "Wait and retry if table is in use.", (uchar**) &opt_wait,
(gptr*) &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, (uchar**) &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}; };
@ -481,7 +481,7 @@ static bool open_isam_files(PACK_MRG_INFO *mrg,char **names,uint count)
error: error:
while (i--) while (i--)
maria_close(mrg->file[i]); maria_close(mrg->file[i]);
my_free((gptr) mrg->file,MYF(0)); my_free((uchar*) mrg->file,MYF(0));
return 1; return 1;
} }
@ -606,14 +606,14 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
/* /*
If the packed lengths of combined columns is less then the sum of If the packed lengths of combined columns is less then the sum of
the non-combined columns, then create common Huffman trees for them. the non-combined columns, then create common Huffman trees for them.
We do this only for byte compressed columns, not for distinct values We do this only for uchar compressed columns, not for distinct values
compressed columns. compressed columns.
*/ */
if ((int) (used_trees=join_same_trees(huff_counts,trees)) < 0) if ((int) (used_trees=join_same_trees(huff_counts,trees)) < 0)
goto err; goto err;
/* /*
Assign codes to all byte or column values. Assign codes to all uchar or column values.
*/ */
if (make_huff_decode_table(huff_trees,fields)) if (make_huff_decode_table(huff_trees,fields))
goto err; goto err;
@ -827,11 +827,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees,
for (i=0 ; i < trees ; i++) for (i=0 ; i < trees ; i++)
{ {
if (huff_trees[i].element_buffer) if (huff_trees[i].element_buffer)
my_free((gptr) huff_trees[i].element_buffer,MYF(0)); my_free((uchar*) huff_trees[i].element_buffer,MYF(0));
if (huff_trees[i].code) if (huff_trees[i].code)
my_free((gptr) huff_trees[i].code,MYF(0)); my_free((uchar*) huff_trees[i].code,MYF(0));
} }
my_free((gptr) huff_trees,MYF(0)); my_free((uchar*) huff_trees,MYF(0));
} }
if (huff_counts) if (huff_counts)
{ {
@ -839,11 +839,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees,
{ {
if (huff_counts[i].tree_buff) if (huff_counts[i].tree_buff)
{ {
my_free((gptr) huff_counts[i].tree_buff,MYF(0)); my_free((uchar*) huff_counts[i].tree_buff,MYF(0));
delete_tree(&huff_counts[i].int_tree); delete_tree(&huff_counts[i].int_tree);
} }
} }
my_free((gptr) huff_counts,MYF(0)); my_free((uchar*) huff_counts,MYF(0));
} }
delete_queue(&queue); /* This is safe to free */ delete_queue(&queue); /* This is safe to free */
return; return;
@ -856,16 +856,16 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
int error; int error;
uint length, null_bytes; uint length, null_bytes;
ulong reclength,max_blob_length; ulong reclength,max_blob_length;
byte *record,*pos,*next_pos,*end_pos,*start_pos; uchar *record,*pos,*next_pos,*end_pos,*start_pos;
ha_rows record_count; ha_rows record_count;
HUFF_COUNTS *count,*end_count; HUFF_COUNTS *count,*end_count;
TREE_ELEMENT *element; TREE_ELEMENT *element;
ha_checksum(*calc_checksum) (struct st_maria_info *, const byte *); ha_checksum(*calc_checksum) (struct st_maria_info *, const uchar *);
DBUG_ENTER("get_statistic"); DBUG_ENTER("get_statistic");
reclength= mrg->file[0]->s->base.reclength; reclength= mrg->file[0]->s->base.reclength;
null_bytes= mrg->file[0]->s->base.null_bytes; null_bytes= mrg->file[0]->s->base.null_bytes;
record=(byte*) my_alloca(reclength); record=(uchar*) my_alloca(reclength);
end_count=huff_counts+mrg->file[0]->s->base.fields; end_count=huff_counts+mrg->file[0]->s->base.fields;
record_count=0; glob_crc=0; record_count=0; glob_crc=0;
max_blob_length=0; max_blob_length=0;
@ -1040,7 +1040,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
{ {
uint i; uint i;
/* Zero fields are just counted. Go to the next record. */ /* Zero fields are just counted. Go to the next record. */
if (!memcmp((byte*) start_pos,zero_string,count->field_length)) if (!memcmp((uchar*) start_pos,zero_string,count->field_length))
{ {
count->zero_fields++; count->zero_fields++;
continue; continue;
@ -1063,7 +1063,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
continue; continue;
/* /*
Count the incidence of every byte value in the Count the incidence of every uchar value in the
significant field value. significant field value.
*/ */
for ( ; pos < end_pos ; pos++) for ( ; pos < end_pos ; pos++)
@ -1102,10 +1102,10 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
DBUG_EXECUTE_IF("fakebigcodes", fakebigcodes(huff_counts, end_count);); DBUG_EXECUTE_IF("fakebigcodes", fakebigcodes(huff_counts, end_count););
DBUG_PRINT("info", ("Found the following number of incidents " DBUG_PRINT("info", ("Found the following number of incidents "
"of the byte codes:")); "of the uchar codes:"));
if (verbose >= 2) if (verbose >= 2)
VOID(printf("Found the following number of incidents " VOID(printf("Found the following number of incidents "
"of the byte codes:\n")); "of the uchar codes:\n"));
for (count= huff_counts ; count < end_count; count++) for (count= huff_counts ; count < end_count; count++)
{ {
uint idx; uint idx;
@ -1149,12 +1149,12 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
mrg->records=record_count; mrg->records=record_count;
mrg->max_blob_length=max_blob_length; mrg->max_blob_length=max_blob_length;
my_afree((gptr) record); my_afree((uchar*) record);
DBUG_RETURN(error != HA_ERR_END_OF_FILE); DBUG_RETURN(error != HA_ERR_END_OF_FILE);
} }
static int compare_huff_elements(void *not_used __attribute__((unused)), static int compare_huff_elements(void *not_used __attribute__((unused)),
byte *a, byte *b) uchar *a, uchar *b)
{ {
return *((my_off_t*) a) < *((my_off_t*) b) ? -1 : return *((my_off_t*) a) < *((my_off_t*) b) ? -1 :
(*((my_off_t*) a) == *((my_off_t*) b) ? 0 : 1); (*((my_off_t*) a) == *((my_off_t*) b) ? 0 : 1);
@ -1170,7 +1170,7 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees,
my_off_t old_length,new_length,length; my_off_t old_length,new_length,length;
DBUG_ENTER("check_counts"); DBUG_ENTER("check_counts");
bzero((gptr) field_count,sizeof(field_count)); bzero((uchar*) field_count,sizeof(field_count));
space_fields=fill_zero_fields=0; space_fields=fill_zero_fields=0;
for (; trees-- ; huff_counts++) for (; trees-- ; huff_counts++)
@ -1336,12 +1336,12 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees,
} }
else else
{ {
my_free((gptr) huff_counts->tree_buff,MYF(0)); my_free((uchar*) huff_counts->tree_buff,MYF(0));
delete_tree(&huff_counts->int_tree); delete_tree(&huff_counts->int_tree);
huff_counts->tree_buff=0; huff_counts->tree_buff=0;
} }
if (tree.element_buffer) if (tree.element_buffer)
my_free((gptr) tree.element_buffer,MYF(0)); my_free((uchar*) tree.element_buffer,MYF(0));
} }
if (huff_counts->pack_type & PACK_TYPE_SPACE_FIELDS) if (huff_counts->pack_type & PACK_TYPE_SPACE_FIELDS)
space_fields++; space_fields++;
@ -1459,8 +1459,8 @@ static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts, uint trees)
if (make_huff_tree(huff_tree+tree,huff_counts+tree)) if (make_huff_tree(huff_tree+tree,huff_counts+tree))
{ {
while (tree--) while (tree--)
my_free((gptr) huff_tree[tree].element_buffer,MYF(0)); my_free((uchar*) huff_tree[tree].element_buffer,MYF(0));
my_free((gptr) huff_tree,MYF(0)); my_free((uchar*) huff_tree,MYF(0));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
} }
@ -1502,7 +1502,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
} }
else else
{ {
/* Count the number of byte codes found in the column. */ /* Count the number of uchar codes found in the column. */
for (i=found=0 ; i < 256 ; i++) for (i=found=0 ; i < 256 ; i++)
{ {
if (huff_counts->counts[i]) if (huff_counts->counts[i])
@ -1535,7 +1535,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
{ {
HUFF_ELEMENT *temp; HUFF_ELEMENT *temp;
if (!(temp= if (!(temp=
(HUFF_ELEMENT*) my_realloc((gptr) huff_tree->element_buffer, (HUFF_ELEMENT*) my_realloc((uchar*) huff_tree->element_buffer,
found*2*sizeof(HUFF_ELEMENT), found*2*sizeof(HUFF_ELEMENT),
MYF(MY_WME)))) MYF(MY_WME))))
return 1; return 1;
@ -1570,7 +1570,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
*/ */
tree_walk(&huff_counts->int_tree, tree_walk(&huff_counts->int_tree,
(int (*)(void*, element_count,void*)) save_counts_in_queue, (int (*)(void*, element_count,void*)) save_counts_in_queue,
(gptr) huff_tree, left_root_right); (uchar*) huff_tree, left_root_right);
} }
else else
{ {
@ -1580,7 +1580,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
(huff_tree->offset_bits+1)* (huff_tree->offset_bits+1)*
(found-2)+7)/8; (found-2)+7)/8;
/* /*
Put a HUFF_ELEMENT into the queue for every byte code found in the column. Put a HUFF_ELEMENT into the queue for every uchar code found in the column.
The elements are taken from the target trees element buffer. The elements are taken from the target trees element buffer.
Instead of using queue_insert(), we just place references to the Instead of using queue_insert(), we just place references to the
@ -1596,11 +1596,11 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
new_huff_el->count=huff_counts->counts[i]; new_huff_el->count=huff_counts->counts[i];
new_huff_el->a.leaf.null=0; new_huff_el->a.leaf.null=0;
new_huff_el->a.leaf.element_nr=i; new_huff_el->a.leaf.element_nr=i;
queue.root[found]=(byte*) new_huff_el; queue.root[found]=(uchar*) new_huff_el;
} }
} }
/* /*
If there is only a single byte value in this field in all records, If there is only a single uchar value in this field in all records,
add a second element with zero incidence. This is required to enter add a second element with zero incidence. This is required to enter
the loop, which builds the Huffman tree. the loop, which builds the Huffman tree.
*/ */
@ -1613,7 +1613,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
new_huff_el->a.leaf.element_nr=huff_tree->min_chr=last-1; new_huff_el->a.leaf.element_nr=huff_tree->min_chr=last-1;
else else
new_huff_el->a.leaf.element_nr=huff_tree->max_chr=last+1; new_huff_el->a.leaf.element_nr=huff_tree->max_chr=last+1;
queue.root[found]=(byte*) new_huff_el; queue.root[found]=(uchar*) new_huff_el;
} }
} }
@ -1650,7 +1650,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
The Huffman algorithm assigns another bit to the code for a byte The Huffman algorithm assigns another bit to the code for a byte
every time that bytes incidence is combined (directly or indirectly) every time that bytes incidence is combined (directly or indirectly)
to a new element as one of the two least incidence elements. to a new element as one of the two least incidence elements.
This means that one more bit per incidence of that byte is required This means that one more bit per incidence of that uchar is required
in the resulting file. So we add the new combined incidence as the in the resulting file. So we add the new combined incidence as the
number of bits by which the result grows. number of bits by which the result grows.
*/ */
@ -1663,7 +1663,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
Replace the copied top element by the new element and re-order the Replace the copied top element by the new element and re-order the
queue. queue.
*/ */
queue.root[1]=(byte*) new_huff_el; queue.root[1]=(uchar*) new_huff_el;
queue_replaced(&queue); queue_replaced(&queue);
} }
huff_tree->root=(HUFF_ELEMENT*) queue.root[1]; huff_tree->root=(HUFF_ELEMENT*) queue.root[1];
@ -1702,7 +1702,7 @@ static int compare_tree(void* cmp_arg __attribute__((unused)),
0 0
*/ */
static int save_counts_in_queue(byte *key, element_count count, static int save_counts_in_queue(uchar *key, element_count count,
HUFF_TREE *tree) HUFF_TREE *tree)
{ {
HUFF_ELEMENT *new_huff_el; HUFF_ELEMENT *new_huff_el;
@ -1712,7 +1712,7 @@ static int save_counts_in_queue(byte *key, element_count count,
new_huff_el->a.leaf.null=0; new_huff_el->a.leaf.null=0;
new_huff_el->a.leaf.element_nr= (uint) (key- tree->counts->tree_buff) / new_huff_el->a.leaf.element_nr= (uint) (key- tree->counts->tree_buff) /
tree->counts->field_length; tree->counts->field_length;
queue.root[tree->elements]=(byte*) new_huff_el; queue.root[tree->elements]=(uchar*) new_huff_el;
return 0; return 0;
} }
@ -1727,7 +1727,7 @@ static int save_counts_in_queue(byte *key, element_count count,
DESCRIPTION DESCRIPTION
We need to follow the Huffman algorithm until we know, how many bits We need to follow the Huffman algorithm until we know, how many bits
are required for each byte code. But we do not need the resulting are required for each uchar code. But we do not need the resulting
Huffman tree. Hence, we can leave out some steps which are essential Huffman tree. Hence, we can leave out some steps which are essential
in make_huff_tree(). in make_huff_tree().
@ -1746,7 +1746,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,
/* /*
WARNING: We use a small hack for efficiency: Instead of placing WARNING: We use a small hack for efficiency: Instead of placing
references to HUFF_ELEMENTs into the queue, we just insert references to HUFF_ELEMENTs into the queue, we just insert
references to the counts of the byte codes which appeared in this references to the counts of the uchar codes which appeared in this
table column. During the Huffman algorithm they are successively table column. During the Huffman algorithm they are successively
replaced by references to HUFF_ELEMENTs. This works, because replaced by references to HUFF_ELEMENTs. This works, because
HUFF_ELEMENTs have the incidence count at their beginning. HUFF_ELEMENTs have the incidence count at their beginning.
@ -1756,7 +1756,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,
same type. same type.
Instead of using queue_insert(), we just copy the references into Instead of using queue_insert(), we just copy the references into
the buffer of the priority queue. We insert in byte value order, but the buffer of the priority queue. We insert in uchar value order, but
the order is in fact irrelevant here. We will establish the correct the order is in fact irrelevant here. We will establish the correct
order later. order later.
*/ */
@ -1769,18 +1769,18 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,
first=i; first=i;
last=i; last=i;
/* We start with root[1], which is the queues top element. */ /* We start with root[1], which is the queues top element. */
queue.root[found]=(byte*) &huff_counts->counts[i]; queue.root[found]=(uchar*) &huff_counts->counts[i];
} }
} }
if (!found) if (!found)
DBUG_RETURN(0); /* Empty tree */ DBUG_RETURN(0); /* Empty tree */
/* /*
If there is only a single byte value in this field in all records, If there is only a single uchar value in this field in all records,
add a second element with zero incidence. This is required to enter add a second element with zero incidence. This is required to enter
the loop, which follows the Huffman algorithm. the loop, which follows the Huffman algorithm.
*/ */
if (found < 2) if (found < 2)
queue.root[++found]=(byte*) &huff_counts->counts[last ? 0 : 1]; queue.root[++found]=(uchar*) &huff_counts->counts[last ? 0 : 1];
/* Make a queue from the queue buffer. */ /* Make a queue from the queue buffer. */
queue.elements=found; queue.elements=found;
@ -1824,7 +1824,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,
The Huffman algorithm assigns another bit to the code for a byte The Huffman algorithm assigns another bit to the code for a byte
every time that bytes incidence is combined (directly or indirectly) every time that bytes incidence is combined (directly or indirectly)
to a new element as one of the two least incidence elements. to a new element as one of the two least incidence elements.
This means that one more bit per incidence of that byte is required This means that one more bit per incidence of that uchar is required
in the resulting file. So we add the new combined incidence as the in the resulting file. So we add the new combined incidence as the
number of bits by which the result grows. number of bits by which the result grows.
*/ */
@ -1835,7 +1835,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,
queue. This successively replaces the references to counts by queue. This successively replaces the references to counts by
references to HUFF_ELEMENTs. references to HUFF_ELEMENTs.
*/ */
queue.root[1]=(byte*) new_huff_el; queue.root[1]=(uchar*) new_huff_el;
queue_replaced(&queue); queue_replaced(&queue);
} }
DBUG_RETURN(bytes_packed+(bits_packed+7)/8); DBUG_RETURN(bytes_packed+(bits_packed+7)/8);
@ -1868,12 +1868,12 @@ static uint join_same_trees(HUFF_COUNTS *huff_counts, uint trees)
i->tree->tree_pack_length+j->tree->tree_pack_length+ i->tree->tree_pack_length+j->tree->tree_pack_length+
ALLOWED_JOIN_DIFF) ALLOWED_JOIN_DIFF)
{ {
memcpy_fixed((byte*) i->counts,(byte*) count.counts, memcpy_fixed((uchar*) i->counts,(uchar*) count.counts,
sizeof(count.counts[0])*256); sizeof(count.counts[0])*256);
my_free((gptr) j->tree->element_buffer,MYF(0)); my_free((uchar*) j->tree->element_buffer,MYF(0));
j->tree->element_buffer=0; j->tree->element_buffer=0;
j->tree=i->tree; j->tree=i->tree;
bmove((byte*) i->counts,(byte*) count.counts, bmove((uchar*) i->counts,(uchar*) count.counts,
sizeof(count.counts[0])*256); sizeof(count.counts[0])*256);
if (make_huff_tree(i->tree,i)) if (make_huff_tree(i->tree,i))
return (uint) -1; return (uint) -1;
@ -2016,7 +2016,7 @@ static char *hexdigits(ulonglong value)
static int write_header(PACK_MRG_INFO *mrg,uint head_length,uint trees, static int write_header(PACK_MRG_INFO *mrg,uint head_length,uint trees,
my_off_t tot_elements,my_off_t filelength) my_off_t tot_elements,my_off_t filelength)
{ {
byte *buff= (byte*) file_buffer.pos; uchar *buff= (uchar*) file_buffer.pos;
bzero(buff,HEAD_LENGTH); bzero(buff,HEAD_LENGTH);
memcpy_fixed(buff,maria_pack_file_magic,4); memcpy_fixed(buff,maria_pack_file_magic,4);
@ -2032,7 +2032,7 @@ static int write_header(PACK_MRG_INFO *mrg,uint head_length,uint trees,
if (test_only) if (test_only)
return 0; return 0;
VOID(my_seek(file_buffer.file,0L,MY_SEEK_SET,MYF(0))); VOID(my_seek(file_buffer.file,0L,MY_SEEK_SET,MYF(0)));
return my_write(file_buffer.file,(const byte *) file_buffer.pos,HEAD_LENGTH, return my_write(file_buffer.file,(const uchar *) file_buffer.pos,HEAD_LENGTH,
MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)) != 0; MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)) != 0;
} }
@ -2168,7 +2168,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
{ /* This should be impossible */ { /* This should be impossible */
VOID(fprintf(stderr, "Tree offset got too big: %d, aborted\n", VOID(fprintf(stderr, "Tree offset got too big: %d, aborted\n",
huff_tree->max_offset)); huff_tree->max_offset));
my_afree((gptr) packed_tree); my_afree((uchar*) packed_tree);
return 0; return 0;
} }
@ -2179,7 +2179,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
huff_tree->char_bits)); huff_tree->char_bits));
if (!huff_tree->counts->tree_buff) if (!huff_tree->counts->tree_buff)
{ {
/* We do a byte compression on this column. Mark with bit 0. */ /* We do a uchar compression on this column. Mark with bit 0. */
write_bits(0,1); write_bits(0,1);
write_bits(huff_tree->min_chr,8); write_bits(huff_tree->min_chr,8);
write_bits(huff_tree->elements,9); write_bits(huff_tree->elements,9);
@ -2340,7 +2340,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
DBUG_PRINT("info", (" ")); DBUG_PRINT("info", (" "));
if (verbose >= 2) if (verbose >= 2)
VOID(printf("\n")); VOID(printf("\n"));
my_afree((gptr) packed_tree); my_afree((uchar*) packed_tree);
if (errors) if (errors)
{ {
VOID(fprintf(stderr, "Error: Generated decode trees are corrupt. Stop.\n")); VOID(fprintf(stderr, "Error: Generated decode trees are corrupt. Stop.\n"));
@ -2366,7 +2366,7 @@ static uint *make_offset_code_tree(HUFF_TREE *huff_tree, HUFF_ELEMENT *element,
*/ */
if (!element->a.nod.left->a.leaf.null) if (!element->a.nod.left->a.leaf.null)
{ {
/* Store the byte code or the index of the column value. */ /* Store the uchar code or the index of the column value. */
prev_offset[0] =(uint) element->a.nod.left->a.leaf.element_nr; prev_offset[0] =(uint) element->a.nod.left->a.leaf.element_nr;
offset+=2; offset+=2;
} }
@ -2374,7 +2374,7 @@ static uint *make_offset_code_tree(HUFF_TREE *huff_tree, HUFF_ELEMENT *element,
{ {
/* /*
Recursively traverse the tree to the left. Mark it as an offset to Recursively traverse the tree to the left. Mark it as an offset to
another tree node (in contrast to a byte code or column value index). another tree node (in contrast to a uchar code or column value index).
*/ */
prev_offset[0]= IS_OFFSET+2; prev_offset[0]= IS_OFFSET+2;
offset=make_offset_code_tree(huff_tree,element->a.nod.left,offset+2); offset=make_offset_code_tree(huff_tree,element->a.nod.left,offset+2);
@ -2383,7 +2383,7 @@ static uint *make_offset_code_tree(HUFF_TREE *huff_tree, HUFF_ELEMENT *element,
/* Now, check the right child. */ /* Now, check the right child. */
if (!element->a.nod.right->a.leaf.null) if (!element->a.nod.right->a.leaf.null)
{ {
/* Store the byte code or the index of the column value. */ /* Store the uchar code or the index of the column value. */
prev_offset[1]=element->a.nod.right->a.leaf.element_nr; prev_offset[1]=element->a.nod.right->a.leaf.element_nr;
return offset; return offset;
} }
@ -2391,7 +2391,7 @@ static uint *make_offset_code_tree(HUFF_TREE *huff_tree, HUFF_ELEMENT *element,
{ {
/* /*
Recursively traverse the tree to the right. Mark it as an offset to Recursively traverse the tree to the right. Mark it as an offset to
another tree node (in contrast to a byte code or column value index). another tree node (in contrast to a uchar code or column value index).
*/ */
uint temp=(uint) (offset-prev_offset-1); uint temp=(uint) (offset-prev_offset-1);
prev_offset[1]= IS_OFFSET+ temp; prev_offset[1]= IS_OFFSET+ temp;
@ -2421,7 +2421,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
my_off_t record_count; my_off_t record_count;
char llbuf[32]; char llbuf[32];
ulong length,pack_length; ulong length,pack_length;
byte *record,*pos,*end_pos,*record_pos,*start_pos; uchar *record,*pos,*end_pos,*record_pos,*start_pos;
HUFF_COUNTS *count,*end_count; HUFF_COUNTS *count,*end_count;
HUFF_TREE *tree; HUFF_TREE *tree;
MARIA_HA *isam_file=mrg->file[0]; MARIA_HA *isam_file=mrg->file[0];
@ -2429,7 +2429,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
DBUG_ENTER("compress_isam_file"); DBUG_ENTER("compress_isam_file");
/* Allocate a buffer for the records (excluding blobs). */ /* Allocate a buffer for the records (excluding blobs). */
if (!(record=(byte*) my_alloca(isam_file->s->base.reclength))) if (!(record=(uchar*) my_alloca(isam_file->s->base.reclength)))
return -1; return -1;
end_count=huff_counts+isam_file->s->base.fields; end_count=huff_counts+isam_file->s->base.fields;
@ -2482,7 +2482,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
{ {
if (flush_buffer((ulong) max_calc_length + (ulong) max_pack_length)) if (flush_buffer((ulong) max_calc_length + (ulong) max_pack_length))
break; break;
record_pos= (byte*) file_buffer.pos; record_pos= (uchar*) file_buffer.pos;
file_buffer.pos+= max_pack_length; file_buffer.pos+= max_pack_length;
if (null_bytes) if (null_bytes)
{ {
@ -2527,7 +2527,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
switch (count->field_type) { switch (count->field_type) {
case FIELD_SKIP_ZERO: case FIELD_SKIP_ZERO:
if (!memcmp((byte*) start_pos,zero_string,field_length)) if (!memcmp((uchar*) start_pos,zero_string,field_length))
{ {
DBUG_PRINT("fields", ("FIELD_SKIP_ZERO zeroes only, bits: 1")); DBUG_PRINT("fields", ("FIELD_SKIP_ZERO zeroes only, bits: 1"));
write_bits(1,1); write_bits(1,1);
@ -2656,7 +2656,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
break; break;
case FIELD_INTERVALL: case FIELD_INTERVALL:
global_count=count; global_count=count;
pos=(byte*) tree_search(&count->int_tree, start_pos, pos=(uchar*) tree_search(&count->int_tree, start_pos,
count->int_tree.custom_arg); count->int_tree.custom_arg);
intervall=(uint) (pos - count->tree_buff)/field_length; intervall=(uint) (pos - count->tree_buff)/field_length;
DBUG_PRINT("fields", ("FIELD_INTERVALL")); DBUG_PRINT("fields", ("FIELD_INTERVALL"));
@ -2679,7 +2679,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
} }
else else
{ {
byte *blob,*blob_end; uchar *blob,*blob_end;
DBUG_PRINT("fields", ("FIELD_BLOB not empty, bits: 1")); DBUG_PRINT("fields", ("FIELD_BLOB not empty, bits: 1"));
write_bits(0,1); write_bits(0,1);
/* Write the blob length. */ /* Write the blob length. */
@ -2720,7 +2720,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
} }
else else
{ {
byte *end= start_pos + var_pack_length + col_length; uchar *end= start_pos + var_pack_length + col_length;
DBUG_PRINT("fields", ("FIELD_VARCHAR not empty, bits: 1")); DBUG_PRINT("fields", ("FIELD_VARCHAR not empty, bits: 1"));
write_bits(0,1); write_bits(0,1);
/* Write the varchar length. */ /* Write the varchar length. */
@ -2752,7 +2752,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
DBUG_PRINT("fields", ("---")); DBUG_PRINT("fields", ("---"));
} }
flush_bits(); flush_bits();
length=(ulong) ((byte*) file_buffer.pos - record_pos) - max_pack_length; length=(ulong) ((uchar*) file_buffer.pos - record_pos) - max_pack_length;
pack_length= _ma_save_pack_length(pack_version, record_pos, length); pack_length= _ma_save_pack_length(pack_version, record_pos, length);
if (pack_blob_length) if (pack_blob_length)
pack_length+= _ma_save_pack_length(pack_version, pack_length+= _ma_save_pack_length(pack_version,
@ -2793,7 +2793,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
if (verbose >= 2) if (verbose >= 2)
VOID(printf("wrote %s records.\n", llstr((longlong) record_count, llbuf))); VOID(printf("wrote %s records.\n", llstr((longlong) record_count, llbuf)));
my_afree((gptr) record); my_afree((uchar*) record);
mrg->ref_length=max_pack_length; mrg->ref_length=max_pack_length;
mrg->min_pack_length=max_record_length ? min_record_length : 0; mrg->min_pack_length=max_record_length ? min_record_length : 0;
mrg->max_pack_length=max_record_length; mrg->max_pack_length=max_record_length;
@ -2843,7 +2843,7 @@ static int flush_buffer(ulong neaded_length)
/* /*
file_buffer.end is 8 bytes lower than the real end of the buffer. file_buffer.end is 8 bytes lower than the real end of the buffer.
This is done so that the end-of-buffer condition does not need to be This is done so that the end-of-buffer condition does not need to be
checked for every byte (see write_bits()). Consequently, checked for every uchar (see write_bits()). Consequently,
file_buffer.pos can become greater than file_buffer.end. The file_buffer.pos can become greater than file_buffer.end. The
algorithms in the other functions ensure that there will never be algorithms in the other functions ensure that there will never be
more than 8 bytes written to the buffer without an end-of-buffer more than 8 bytes written to the buffer without an end-of-buffer
@ -2860,7 +2860,7 @@ static int flush_buffer(ulong neaded_length)
if (test_only) if (test_only)
return 0; return 0;
if (error_on_write|| my_write(file_buffer.file, if (error_on_write|| my_write(file_buffer.file,
(const byte*) file_buffer.buffer, (const uchar*) file_buffer.buffer,
length, length,
MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL))) MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)))
{ {
@ -2887,7 +2887,7 @@ static int flush_buffer(ulong neaded_length)
static void end_file_buffer(void) static void end_file_buffer(void)
{ {
my_free((gptr) file_buffer.buffer,MYF(0)); my_free((uchar*) file_buffer.buffer,MYF(0));
} }
/* output `bits` low bits of `value' */ /* output `bits` low bits of `value' */
@ -3048,7 +3048,7 @@ static void mrg_reset(PACK_MRG_INFO *mrg)
} }
} }
static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf) static int mrg_rrnd(PACK_MRG_INFO *info,uchar *buf)
{ {
int error; int error;
MARIA_HA *isam_info; MARIA_HA *isam_info;
@ -3095,7 +3095,7 @@ static int mrg_close(PACK_MRG_INFO *mrg)
for (i=0 ; i < mrg->count ; i++) for (i=0 ; i < mrg->count ; i++)
error|=maria_close(mrg->file[i]); error|=maria_close(mrg->file[i]);
if (mrg->free_file) if (mrg->free_file)
my_free((gptr) mrg->file,MYF(0)); my_free((uchar*) mrg->file,MYF(0));
DBUG_RETURN(error); DBUG_RETURN(error);
} }
@ -3127,8 +3127,8 @@ static int mrg_close(PACK_MRG_INFO *mrg)
To get 64(32)-bit codes, I sort the counts by decreasing incidence. To get 64(32)-bit codes, I sort the counts by decreasing incidence.
I assign counts of 1 to the two most frequent values, a count of 2 I assign counts of 1 to the two most frequent values, a count of 2
for the next one, then 4, 8, and so on until 2**64-1(2**30-1). All for the next one, then 4, 8, and so on until 2**64-1(2**30-1). All
the remaining values get 1. That way every possible byte has an the remaining values get 1. That way every possible uchar has an
assigned code, though not all codes are used if not all byte values assigned code, though not all codes are used if not all uchar values
are present in the column. are present in the column.
This strategy would work with distinct column values too, but This strategy would work with distinct column values too, but
@ -3158,7 +3158,7 @@ static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count)
*/ */
if (huff_counts->tree_buff) if (huff_counts->tree_buff)
{ {
my_free((gptr) huff_counts->tree_buff, MYF(0)); my_free((uchar*) huff_counts->tree_buff, MYF(0));
delete_tree(&huff_counts->int_tree); delete_tree(&huff_counts->int_tree);
huff_counts->tree_buff= NULL; huff_counts->tree_buff= NULL;
DBUG_PRINT("fakebigcodes", ("freed distinct column values")); DBUG_PRINT("fakebigcodes", ("freed distinct column values"));

View File

@ -231,7 +231,7 @@ static inline
TABLE_LOCK *find_by_loid(LOCKED_TABLE *table, uint16 loid) TABLE_LOCK *find_by_loid(LOCKED_TABLE *table, uint16 loid)
{ {
return (TABLE_LOCK *)hash_search(& table->latest_locks, return (TABLE_LOCK *)hash_search(& table->latest_locks,
(byte *)& loid, sizeof(loid)); (uchar *)& loid, sizeof(loid));
} }
static inline static inline
@ -487,8 +487,8 @@ tablockman_getlock(TABLOCKMAN *lm, TABLE_LOCK_OWNER *lo,
/* update the latest_locks hash */ /* update the latest_locks hash */
if (old) if (old)
hash_delete(& table->latest_locks, (byte *)old); hash_delete(& table->latest_locks, (uchar *)old);
hash_insert(& table->latest_locks, (byte *)new); hash_insert(& table->latest_locks, (uchar *)new);
new->upgraded_from= old; new->upgraded_from= old;
@ -571,7 +571,7 @@ void tablockman_release_locks(TABLOCKMAN *lm, TABLE_LOCK_OWNER *lo)
/* TODO ? group locks by table to reduce the number of mutex locks */ /* TODO ? group locks by table to reduce the number of mutex locks */
pthread_mutex_lock(mutex); pthread_mutex_lock(mutex);
hash_delete(& cur->table->latest_locks, (byte *)cur); hash_delete(& cur->table->latest_locks, (uchar *)cur);
if (cur->prev) if (cur->prev)
cur->prev->next= cur->next; cur->prev->next= cur->next;

View File

@ -94,11 +94,11 @@ static TRN *short_trid_to_TRN(uint16 short_trid)
} }
#endif #endif
static byte *trn_get_hash_key(const byte *trn, uint* len, static uchar *trn_get_hash_key(const uchar *trn, uint* len,
my_bool unused __attribute__ ((unused))) my_bool unused __attribute__ ((unused)))
{ {
*len= sizeof(TrID); *len= sizeof(TrID);
return (byte *) & ((*((TRN **)trn))->trid); return (uchar *) & ((*((TRN **)trn))->trid);
} }
int trnman_init() int trnman_init()

View File

@ -24,7 +24,7 @@ C_MODE_START
#include "ma_loghandler_lsn.h" #include "ma_loghandler_lsn.h"
/* /*
trid - 6 byte transaction identifier. Assigned when a transaction trid - 6 uchar transaction identifier. Assigned when a transaction
is created. Transaction can always be identified by its trid, is created. Transaction can always be identified by its trid,
even after transaction has ended. even after transaction has ended.

View File

@ -125,7 +125,7 @@ uint check_page(uchar *buff, ulong offset, int page_locked, int page_no,
(page_locked ? "locked" : "unlocked"), (page_locked ? "locked" : "unlocked"),
end, num, tag); end, num, tag);
h= my_open("wrong_page", O_CREAT | O_TRUNC | O_RDWR, MYF(0)); h= my_open("wrong_page", O_CREAT | O_TRUNC | O_RDWR, MYF(0));
my_pwrite(h, (byte*) buff, PAGE_SIZE, 0, MYF(0)); my_pwrite(h, (uchar*) buff, PAGE_SIZE, 0, MYF(0));
my_close(h, MYF(0)); my_close(h, MYF(0));
goto err; goto err;
} }
@ -264,7 +264,7 @@ static void *test_thread_reader(void *arg)
thread_count--; thread_count--;
VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */ VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
pthread_mutex_unlock(&LOCK_thread_count); pthread_mutex_unlock(&LOCK_thread_count);
free((gptr) arg); free((uchar*) arg);
my_thread_end(); my_thread_end();
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -284,7 +284,7 @@ static void *test_thread_writer(void *arg)
thread_count--; thread_count--;
VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */ VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
pthread_mutex_unlock(&LOCK_thread_count); pthread_mutex_unlock(&LOCK_thread_count);
free((gptr) arg); free((uchar*) arg);
my_thread_end(); my_thread_end();
DBUG_RETURN(0); DBUG_RETURN(0);
} }

View File

@ -448,7 +448,7 @@ static void *test_thread(void *arg)
thread_count--; thread_count--;
VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */ VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
pthread_mutex_unlock(&LOCK_thread_count); pthread_mutex_unlock(&LOCK_thread_count);
free((gptr) arg); free((uchar*) arg);
my_thread_end(); my_thread_end();
DBUG_RETURN(0); DBUG_RETURN(0);
} }

View File

@ -56,10 +56,10 @@ static TRN *trn= &dummy_transaction_object;
1 - Error 1 - Error
*/ */
static my_bool check_content(byte *ptr, ulong length) static my_bool check_content(uchar *ptr, ulong length)
{ {
ulong i; ulong i;
byte buff[2]; uchar buff[2];
for (i= 0; i < length; i++) for (i= 0; i < length; i++)
{ {
if (i % 2 == 0) if (i % 2 == 0)
@ -107,7 +107,7 @@ void read_ok(TRANSLOG_HEADER_BUFFER *rec)
*/ */
static my_bool read_and_check_content(TRANSLOG_HEADER_BUFFER *rec, static my_bool read_and_check_content(TRANSLOG_HEADER_BUFFER *rec,
byte *buffer, uint skip) uchar *buffer, uint skip)
{ {
DBUG_ASSERT(rec->record_length < LONG_BUFFER_SIZE * 2 + 7 * 2 + 2); DBUG_ASSERT(rec->record_length < LONG_BUFFER_SIZE * 2 + 7 * 2 + 2);
if (translog_read_record(rec->lsn, 0, rec->record_length, buffer, NULL) != if (translog_read_record(rec->lsn, 0, rec->record_length, buffer, NULL) !=
@ -122,14 +122,14 @@ int main(int argc __attribute__((unused)), char *argv[])
uint32 i; uint32 i;
uint32 rec_len; uint32 rec_len;
uint pagen; uint pagen;
byte long_tr_id[6]; uchar long_tr_id[6];
byte lsn_buff[23]= uchar lsn_buff[23]=
{ {
0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,
0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,
0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55
}; };
byte long_buffer[LONG_BUFFER_SIZE * 2 + LSN_STORE_SIZE * 2 + 2]; uchar long_buffer[LONG_BUFFER_SIZE * 2 + LSN_STORE_SIZE * 2 + 2];
PAGECACHE pagecache; PAGECACHE pagecache;
LSN lsn, lsn_base, first_lsn; LSN lsn, lsn_base, first_lsn;
TRANSLOG_HEADER_BUFFER rec; TRANSLOG_HEADER_BUFFER rec;

View File

@ -44,10 +44,10 @@ static TRN *trn= &dummy_transaction_object;
1 - Error 1 - Error
*/ */
static my_bool check_content(byte *ptr, ulong length) static my_bool check_content(uchar *ptr, ulong length)
{ {
ulong i; ulong i;
byte buff[4]; uchar buff[4];
DBUG_ENTER("check_content"); DBUG_ENTER("check_content");
for (i= 0; i < length; i++) for (i= 0; i < length; i++)
{ {
@ -81,7 +81,7 @@ static my_bool check_content(byte *ptr, ulong length)
*/ */
static my_bool read_and_check_content(TRANSLOG_HEADER_BUFFER *rec, static my_bool read_and_check_content(TRANSLOG_HEADER_BUFFER *rec,
byte *buffer, uint skip) uchar *buffer, uint skip)
{ {
int res= 0; int res= 0;
translog_size_t len; translog_size_t len;
@ -115,14 +115,14 @@ int main(int argc __attribute__((unused)), char *argv[])
uint32 i; uint32 i;
uint32 rec_len; uint32 rec_len;
uint pagen; uint pagen;
byte long_tr_id[6]; uchar long_tr_id[6];
byte lsn_buff[23]= uchar lsn_buff[23]=
{ {
0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,
0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,
0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55
}; };
byte *long_buffer= malloc(LONG_BUFFER_SIZE + LSN_STORE_SIZE * 2 + 2); uchar *long_buffer= malloc(LONG_BUFFER_SIZE + LSN_STORE_SIZE * 2 + 2);
PAGECACHE pagecache; PAGECACHE pagecache;
LSN lsn, lsn_base, first_lsn; LSN lsn, lsn_base, first_lsn;
TRANSLOG_HEADER_BUFFER rec; TRANSLOG_HEADER_BUFFER rec;
@ -138,7 +138,7 @@ int main(int argc __attribute__((unused)), char *argv[])
exit(1); exit(1);
{ {
byte buff[4]; uchar buff[4];
for (i= 0; i < (LONG_BUFFER_SIZE + LSN_STORE_SIZE * 2 + 2); i++) for (i= 0; i < (LONG_BUFFER_SIZE + LSN_STORE_SIZE * 2 + 2); i++)
{ {
if (i % 4 == 0) if (i % 4 == 0)

View File

@ -30,7 +30,7 @@ static uint thread_count;
static ulong lens[WRITERS][ITERATIONS]; static ulong lens[WRITERS][ITERATIONS];
static LSN lsns1[WRITERS][ITERATIONS]; static LSN lsns1[WRITERS][ITERATIONS];
static LSN lsns2[WRITERS][ITERATIONS]; static LSN lsns2[WRITERS][ITERATIONS];
static byte *long_buffer; static uchar *long_buffer;
/* /*
Get pseudo-random length of the field in Get pseudo-random length of the field in
@ -68,7 +68,7 @@ static uint32 get_len()
1 - Error 1 - Error
*/ */
static my_bool check_content(byte *ptr, ulong length) static my_bool check_content(uchar *ptr, ulong length)
{ {
ulong i; ulong i;
for (i= 0; i < length; i++) for (i= 0; i < length; i++)
@ -100,7 +100,7 @@ static my_bool check_content(byte *ptr, ulong length)
static my_bool read_and_check_content(TRANSLOG_HEADER_BUFFER *rec, static my_bool read_and_check_content(TRANSLOG_HEADER_BUFFER *rec,
byte *buffer, uint skip) uchar *buffer, uint skip)
{ {
int res= 0; int res= 0;
translog_size_t len; translog_size_t len;
@ -120,7 +120,7 @@ void writer(int num)
{ {
LSN lsn; LSN lsn;
TRN trn; TRN trn;
byte long_tr_id[6]; uchar long_tr_id[6];
uint i; uint i;
trn.short_id= num; trn.short_id= num;
@ -186,7 +186,7 @@ static void *test_thread_writer(void *arg)
VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are
ready */ ready */
pthread_mutex_unlock(&LOCK_thread_count); pthread_mutex_unlock(&LOCK_thread_count);
free((gptr) arg); free((uchar*) arg);
my_thread_end(); my_thread_end();
return(0); return(0);
} }
@ -292,7 +292,7 @@ int main(int argc __attribute__((unused)),
srandom(122334817L); srandom(122334817L);
{ {
LEX_STRING parts[TRANSLOG_INTERNAL_PARTS + 1]; LEX_STRING parts[TRANSLOG_INTERNAL_PARTS + 1];
byte long_tr_id[6]= uchar long_tr_id[6]=
{ {
0x11, 0x22, 0x33, 0x44, 0x55, 0x66 0x11, 0x22, 0x33, 0x44, 0x55, 0x66
}; };

View File

@ -22,7 +22,7 @@ static PAGECACHE_FILE file1;
int main(int argc __attribute__((unused)), char *argv[]) int main(int argc __attribute__((unused)), char *argv[])
{ {
uint pagen; uint pagen;
byte long_tr_id[6]; uchar long_tr_id[6];
PAGECACHE pagecache; PAGECACHE pagecache;
LSN lsn; LSN lsn;
MY_STAT st, *stat; MY_STAT st, *stat;

View File

@ -23,8 +23,8 @@
#include "ftdefs.h" #include "ftdefs.h"
FT_INFO *ft_init_search(uint flags, void *info, uint keynr, FT_INFO *ft_init_search(uint flags, void *info, uint keynr,
byte *query, uint query_len, CHARSET_INFO *cs, uchar *query, uint query_len, CHARSET_INFO *cs,
byte *record) uchar *record)
{ {
FT_INFO *res; FT_INFO *res;
if (flags & FT_BOOL) if (flags & FT_BOOL)

View File

@ -1244,7 +1244,7 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt)
if (error != HA_ADMIN_OK) if (error != HA_ADMIN_OK)
{ {
/* Send error to user */ /* Send error to user */
MI_CHECK param; HA_CHECK param;
myisamchk_init(&param); myisamchk_init(&param);
param.thd= thd; param.thd= thd;
param.op_name= "assign_to_keycache"; param.op_name= "assign_to_keycache";
@ -1415,7 +1415,7 @@ int ha_myisam::enable_indexes(uint mode)
else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE) else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE)
{ {
THD *thd=current_thd; THD *thd=current_thd;
MI_CHECK param; HA_CHECK param;
const char *save_proc_info=thd->proc_info; const char *save_proc_info=thd->proc_info;
thd->proc_info="Creating index"; thd->proc_info="Creating index";
myisamchk_init(&param); myisamchk_init(&param);
@ -1424,7 +1424,8 @@ int ha_myisam::enable_indexes(uint mode)
T_CREATE_MISSING_KEYS); T_CREATE_MISSING_KEYS);
param.myf_rw&= ~MY_WAIT_IF_FULL; param.myf_rw&= ~MY_WAIT_IF_FULL;
param.sort_buffer_length= thd->variables.myisam_sort_buff_size; param.sort_buffer_length= thd->variables.myisam_sort_buff_size;
param.stats_method= (enum_mi_stats_method)thd->variables.myisam_stats_method; param.stats_method=
(enum_handler_stats_method)thd->variables.myisam_stats_method;
param.tmpdir=&mysql_tmpdir_list; param.tmpdir=&mysql_tmpdir_list;
if ((error= (repair(thd,param,0) != HA_ADMIN_OK)) && param.retry_repair) if ((error= (repair(thd,param,0) != HA_ADMIN_OK)) && param.retry_repair)
{ {
@ -1922,7 +1923,7 @@ void ha_myisam::get_auto_increment(ulonglong offset, ulonglong increment,
{ {
ulonglong nr; ulonglong nr;
int error; int error;
uchar key[MI_MAX_KEY_LENGTH]; uchar key[HA_MAX_KEY_LENGTH];
if (!table->s->next_number_key_offset) if (!table->s->next_number_key_offset)
{ // Autoincrement at key-start { // Autoincrement at key-start

View File

@ -550,8 +550,9 @@ extern int _mi_dispose(MI_INFO *info, MI_KEYDEF *keyinfo, my_off_t pos,
extern my_off_t _mi_new(MI_INFO *info, MI_KEYDEF *keyinfo, int level); extern my_off_t _mi_new(MI_INFO *info, MI_KEYDEF *keyinfo, int level);
extern uint _mi_make_key(MI_INFO *info, uint keynr, uchar *key, extern uint _mi_make_key(MI_INFO *info, uint keynr, uchar *key,
const uchar *record, my_off_t filepos); const uchar *record, my_off_t filepos);
extern uint _mi_pack_key(MI_INFO *info, uint keynr, uchar *key, uchar *old, extern uint _mi_pack_key(MI_INFO *info, uint keynr, uchar *key,
uint key_length, HA_KEYSEG ** last_used_keyseg); uchar *old, key_part_map keypart_map,
HA_KEYSEG ** last_used_keyseg);
extern int _mi_read_key_record(MI_INFO *info, my_off_t filepos, uchar *buf); extern int _mi_read_key_record(MI_INFO *info, my_off_t filepos, uchar *buf);
extern int _mi_read_cache(IO_CACHE *info, uchar *buff, my_off_t pos, extern int _mi_read_cache(IO_CACHE *info, uchar *buff, my_off_t pos,
uint length, int re_read_if_possibly); uint length, int re_read_if_possibly);
@ -566,7 +567,7 @@ extern uchar *mi_alloc_rec_buff(MI_INFO *, ulong, uchar **);
extern ulong _mi_rec_unpack(MI_INFO *info, uchar *to, uchar *from, extern ulong _mi_rec_unpack(MI_INFO *info, uchar *to, uchar *from,
ulong reclength); ulong reclength);
extern my_bool _mi_rec_check(MI_INFO *info, const char *record, uchar *packpos, extern my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *packpos,
ulong packed_length, my_bool with_checkum); ulong packed_length, my_bool with_checkum);
extern int _mi_write_part_record(MI_INFO *info, my_off_t filepos, ulong length, extern int _mi_write_part_record(MI_INFO *info, my_off_t filepos, ulong length,
my_off_t next_filepos, uchar ** record, my_off_t next_filepos, uchar ** record,

View File

@ -831,7 +831,7 @@ static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek,
register uint count; register uint count;
uint16 length_of_key = 0; uint16 length_of_key = 0;
uint idx; uint idx;
byte *buffp; uchar *buffp;
if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count))) if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count)))
{ {
@ -918,7 +918,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
for (buffpek= Fb ; buffpek <= Tb ; buffpek++) for (buffpek= Fb ; buffpek <= Tb ; buffpek++)
{ {
count+= buffpek->count; count+= buffpek->count;
buffpek->base= (byte*) strpos; buffpek->base= (uchar*) strpos;
buffpek->max_keys=maxcount; buffpek->max_keys=maxcount;
strpos+= (uint) (error=(int) info->read_to_buffer(from_file,buffpek, strpos+= (uint) (error=(int) info->read_to_buffer(from_file,buffpek,
sort_length)); sort_length));
@ -956,7 +956,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
{ {
if (!(error=(int) info->read_to_buffer(from_file,buffpek,sort_length))) if (!(error=(int) info->read_to_buffer(from_file,buffpek,sort_length)))
{ {
byte *base= buffpek->base; uchar *base= buffpek->base;
uint max_keys=buffpek->max_keys; uint max_keys=buffpek->max_keys;
VOID(queue_remove(&queue,0)); VOID(queue_remove(&queue,0));
@ -988,7 +988,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
} }
} }
buffpek=(BUFFPEK*) queue_top(&queue); buffpek=(BUFFPEK*) queue_top(&queue);
buffpek->base= (byte*) sort_keys; buffpek->base= (uchar*) sort_keys;
buffpek->max_keys=keys; buffpek->max_keys=keys;
do do
{ {

View File

@ -48,12 +48,12 @@ static const char *ha_myisammrg_exts[] = {
}; };
extern int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out, extern int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out,
MI_COLUMNDEF **recinfo_out, uint *records_out); MI_COLUMNDEF **recinfo_out, uint *records_out);
extern int myisam_check_definition(MI_KEYDEF *t1_keyinfo, extern int check_definition(MI_KEYDEF *t1_keyinfo,
MI_COLUMNDEF *t1_recinfo, MI_COLUMNDEF *t1_recinfo,
uint t1_keys, uint t1_recs, uint t1_keys, uint t1_recs,
MI_KEYDEF *t2_keyinfo, MI_KEYDEF *t2_keyinfo,
MI_COLUMNDEF *t2_recinfo, MI_COLUMNDEF *t2_recinfo,
uint t2_keys, uint t2_recs, bool strict); uint t2_keys, uint t2_recs, bool strict);
static void split_file_name(const char *file_name, static void split_file_name(const char *file_name,
LEX_STRING *db, LEX_STRING *name); LEX_STRING *db, LEX_STRING *name);
@ -137,10 +137,10 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked)
} }
for (u_table= file->open_tables; u_table < file->end_table; u_table++) for (u_table= file->open_tables; u_table < file->end_table; u_table++)
{ {
if (myisam_check_definition(keyinfo, recinfo, keys, recs, if (check_definition(keyinfo, recinfo, keys, recs,
u_table->table->s->keyinfo, u_table->table->s->rec, u_table->table->s->keyinfo, u_table->table->s->rec,
u_table->table->s->base.keys, u_table->table->s->base.keys,
u_table->table->s->base.fields, false)) u_table->table->s->base.fields, false))
{ {
error= HA_ERR_WRONG_MRG_TABLE_DEF; error= HA_ERR_WRONG_MRG_TABLE_DEF;
if (test_if_locked & HA_OPEN_FOR_REPAIR) if (test_if_locked & HA_OPEN_FOR_REPAIR)