diff options
Diffstat (limited to 'storage/myisam')
56 files changed, 796 insertions, 788 deletions
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index 68076d7e401..bf4c29f5b4e 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -111,7 +111,7 @@ typedef struct st_ftb_word uint ndepth; uint len; uchar off; - byte word[1]; + uchar word[1]; } FTB_WORD; typedef struct st_ft_info @@ -161,7 +161,7 @@ typedef struct st_my_ftb_param { FTB *ftb; FTB_EXPR *ftbe; - byte *up_quot; + uchar *up_quot; uint depth; } MY_FTB_PARAM; @@ -274,7 +274,7 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param, MY_FTB_PARAM *ftb_param= param->mysql_ftparam; MYSQL_FTPARSER_BOOLEAN_INFO info; CHARSET_INFO *cs= ftb_param->ftb->charset; - char **start= &query; + uchar **start= (uchar**) &query; char *end= query + len; FT_WORD w; @@ -286,7 +286,7 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param, } -static void _ftb_parse_query(FTB *ftb, byte *query, uint len, +static void _ftb_parse_query(FTB *ftb, uchar *query, uint len, struct st_mysql_ftparser *parser) { MYSQL_FTPARSER_PARAM *param; @@ -331,7 +331,7 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) my_bool can_go_down; MI_INFO *info=ftb->info; uint off, extra=HA_FT_WLEN+info->s->base.rec_reflength; - byte *lastkey_buf=ftbw->word+ftbw->off; + uchar *lastkey_buf=ftbw->word+ftbw->off; LINT_INIT(off); if (ftbw->flags & FTB_FLAG_TRUNC) @@ -505,7 +505,7 @@ static void _ftb_init_index_search(FT_INFO *ftb) } -FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, +FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, uchar *query, uint query_len, CHARSET_INFO *cs) { FTB *ftb; @@ -545,14 +545,14 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, Hack: instead of init_queue, we'll use reinit queue to be able to alloc queue with alloc_root() */ - if (! (ftb->queue.root= (byte **)alloc_root(&ftb->mem_root, + if (! (ftb->queue.root= (uchar **)alloc_root(&ftb->mem_root, (ftb->queue.max_elements + 1) * sizeof(void *)))) goto err; reinit_queue(&ftb->queue, ftb->queue.max_elements, 0, 0, - (int (*)(void*, byte*, byte*))FTB_WORD_cmp, 0); + (int (*)(void*, uchar*, uchar*))FTB_WORD_cmp, 0); for (ftbw= ftb->last_word; ftbw; ftbw= ftbw->prev) - queue_insert(&ftb->queue, (byte *)ftbw); + queue_insert(&ftb->queue, (uchar *)ftbw); ftb->list=(FTB_WORD **)alloc_root(&ftb->mem_root, sizeof(FTB_WORD *)*ftb->queue.elements); memcpy(ftb->list, ftb->queue.root+1, sizeof(FTB_WORD *)*ftb->queue.elements); @@ -563,7 +563,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, return ftb; err: free_root(& ftb->mem_root, MYF(0)); - my_free((gptr)ftb,MYF(0)); + my_free((uchar*)ftb,MYF(0)); return 0; } @@ -617,7 +617,8 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param, FT_WORD word; MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam; const char *docend= document + len; - while (ft_simple_get_word(phrase_param->cs, &document, docend, &word, FALSE)) + while (ft_simple_get_word(phrase_param->cs, (uchar**) &document, docend, + &word, FALSE)) { param->mysql_add_word(param, word.pos, word.len, 0); if (phrase_param->match) @@ -641,7 +642,7 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param, 1 is returned if phrase found, 0 else. */ -static int _ftb_check_phrase(FTB *ftb, const byte *document, uint len, +static int _ftb_check_phrase(FTB *ftb, const uchar *document, uint len, FTB_EXPR *ftbe, struct st_mysql_ftparser *parser) { MY_FTB_PHRASE_PARAM ftb_param; @@ -663,7 +664,7 @@ static int _ftb_check_phrase(FTB *ftb, const byte *document, uint len, param->mysql_add_word= ftb_phrase_add_word; param->mysql_ftparam= (void *)&ftb_param; param->cs= ftb->charset; - param->doc= (byte *)document; + param->doc= (uchar *)document; param->length= len; param->flags= 0; param->mode= MYSQL_FTPARSER_WITH_STOPWORDS; @@ -867,13 +868,13 @@ static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param, FT_INFO *ftb= ftb_param->ftb; char *end= doc + len; FT_WORD w; - while (ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE)) + while (ft_simple_get_word(ftb->charset, (uchar**) &doc, end, &w, TRUE)) param->mysql_add_word(param, w.pos, w.len, 0); return(0); } -float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) +float ft_boolean_find_relevance(FT_INFO *ftb, uchar *record, uint length) { FTB_EXPR *ftbe; FT_SEG_ITERATOR ftsi, ftsi2; @@ -924,7 +925,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) { if (!ftsi.pos) continue; - param->doc= (byte *)ftsi.pos; + param->doc= (uchar *)ftsi.pos; param->length= ftsi.len; parser->parse(param); } @@ -948,7 +949,7 @@ void ft_boolean_close_search(FT_INFO *ftb) delete_tree(& ftb->no_dupes); } free_root(& ftb->mem_root, MYF(0)); - my_free((gptr)ftb,MYF(0)); + my_free((uchar*)ftb,MYF(0)); } diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c index 5c6f66897ee..bcf6c46d41f 100644 --- a/storage/myisam/ft_nlq_search.c +++ b/storage/myisam/ft_nlq_search.c @@ -189,7 +189,7 @@ static int walk_and_push(FT_SUPERDOC *from, DBUG_ENTER("walk_and_copy"); from->doc.weight+=from->tmp_weight*from->word_ptr->weight; set_if_smaller(best->elements, ft_query_expansion_limit-1); - queue_insert(best, (byte *)& from->doc); + queue_insert(best, (uchar *)& from->doc); DBUG_RETURN(0); } @@ -201,8 +201,8 @@ static int FT_DOC_cmp(void *unused __attribute__((unused)), } -FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query, - uint query_len, uint flags, byte *record) +FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, uchar *query, + uint query_len, uint flags, uchar *record) { TREE wtree; ALL_IN_ONE aio; @@ -323,7 +323,7 @@ int ft_nlq_read_next(FT_INFO *handler, char *record) float ft_nlq_find_relevance(FT_INFO *handler, - byte *record __attribute__((unused)), + uchar *record __attribute__((unused)), uint length __attribute__((unused))) { int a,b,c; @@ -352,7 +352,7 @@ float ft_nlq_find_relevance(FT_INFO *handler, void ft_nlq_close_search(FT_INFO *handler) { - my_free((gptr)handler,MYF(0)); + my_free((uchar*)handler,MYF(0)); } diff --git a/storage/myisam/ft_parser.c b/storage/myisam/ft_parser.c index 5992d9c118e..ba858c37aee 100644 --- a/storage/myisam/ft_parser.c +++ b/storage/myisam/ft_parser.c @@ -78,7 +78,7 @@ FT_WORD * ft_linearize(TREE *wtree, MEM_ROOT *mem_root) DBUG_RETURN(wlist); } -my_bool ft_boolean_check_syntax_string(const byte *str) +my_bool ft_boolean_check_syntax_string(const uchar *str) { uint i, j; @@ -106,10 +106,10 @@ my_bool ft_boolean_check_syntax_string(const byte *str) 3 - right bracket 4 - stopword found */ -byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end, - FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param) +uchar ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end, + FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param) { - byte *doc=*start; + uchar *doc=*start; int ctype; uint mwc, length, mbl; @@ -196,10 +196,10 @@ ret: return param->type; } -byte ft_simple_get_word(CHARSET_INFO *cs, byte **start, const byte *end, - FT_WORD *word, my_bool skip_stopwords) +uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end, + FT_WORD *word, my_bool skip_stopwords) { - byte *doc= *start; + uchar *doc= *start; uint mwc, length, mbl; int ctype; DBUG_ENTER("ft_simple_get_word"); @@ -260,9 +260,9 @@ static int ft_add_word(MYSQL_FTPARSER_PARAM *param, wtree= ft_param->wtree; if (param->flags & MYSQL_FTFLAGS_NEED_COPY) { - byte *ptr; + uchar *ptr; DBUG_ASSERT(wtree->with_delete == 0); - ptr= (byte *)alloc_root(ft_param->mem_root, word_len); + ptr= (uchar *)alloc_root(ft_param->mem_root, word_len); memcpy(ptr, word, word_len); w.pos= ptr; } @@ -279,9 +279,10 @@ static int ft_add_word(MYSQL_FTPARSER_PARAM *param, static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param, - char *doc, int doc_len) + char *doc_arg, int doc_len) { - byte *end=doc+doc_len; + uchar *doc= (uchar*) doc_arg; + uchar *end= doc + doc_len; MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam; TREE *wtree= ft_param->wtree; FT_WORD w; @@ -294,9 +295,9 @@ static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param, } -int ft_parse(TREE *wtree, byte *doc, int doclen, - struct st_mysql_ftparser *parser, - MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root) +int ft_parse(TREE *wtree, uchar *doc, int doclen, + struct st_mysql_ftparser *parser, + MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root) { MY_FT_PARSER_PARAM my_param; DBUG_ENTER("ft_parse"); diff --git a/storage/myisam/ft_static.c b/storage/myisam/ft_static.c index 34608be1721..610c20eede6 100644 --- a/storage/myisam/ft_static.c +++ b/storage/myisam/ft_static.c @@ -56,8 +56,8 @@ const struct _ft_vft _ft_vft_boolean = { FT_INFO *ft_init_search(uint flags, void *info, uint keynr, - byte *query, uint query_len, CHARSET_INFO *cs, - byte *record) + uchar *query, uint query_len, CHARSET_INFO *cs, + uchar *record) { FT_INFO *res; if (flags & FT_BOOL) diff --git a/storage/myisam/ft_stopwords.c b/storage/myisam/ft_stopwords.c index 63732ebadc9..e6a90bc927a 100644 --- a/storage/myisam/ft_stopwords.c +++ b/storage/myisam/ft_stopwords.c @@ -38,7 +38,7 @@ static void FT_STOPWORD_free(FT_STOPWORD *w, TREE_FREE action, void *arg __attribute__((unused))) { if (action == free_free) - my_free((gptr) w->pos, MYF(0)); + my_free((uchar*) w->pos, MYF(0)); } static int ft_add_stopword(const char *w) @@ -65,7 +65,7 @@ int ft_init_stopwords() { File fd; uint len; - byte *buffer, *start, *end; + uchar *buffer, *start, *end; FT_WORD w; int error=-1; diff --git a/storage/myisam/ft_update.c b/storage/myisam/ft_update.c index e176d550b1d..e3e4c62158f 100644 --- a/storage/myisam/ft_update.c +++ b/storage/myisam/ft_update.c @@ -20,7 +20,7 @@ #include "ftdefs.h" #include <math.h> -void _mi_ft_segiterator_init(MI_INFO *info, uint keynr, const byte *record, +void _mi_ft_segiterator_init(MI_INFO *info, uint keynr, const uchar *record, FT_SEG_ITERATOR *ftsi) { DBUG_ENTER("_mi_ft_segiterator_init"); @@ -31,7 +31,7 @@ void _mi_ft_segiterator_init(MI_INFO *info, uint keynr, const byte *record, DBUG_VOID_RETURN; } -void _mi_ft_segiterator_dummy_init(const byte *record, uint len, +void _mi_ft_segiterator_dummy_init(const uchar *record, uint len, FT_SEG_ITERATOR *ftsi) { DBUG_ENTER("_mi_ft_segiterator_dummy_init"); @@ -94,7 +94,7 @@ uint _mi_ft_segiterator(register FT_SEG_ITERATOR *ftsi) /* parses a document i.e. calls ft_parse for every keyseg */ -uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record, +uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const uchar *record, MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root) { FT_SEG_ITERATOR ftsi; @@ -108,13 +108,13 @@ uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record, while (_mi_ft_segiterator(&ftsi)) { if (ftsi.pos) - if (ft_parse(parsed, (byte *)ftsi.pos, ftsi.len, parser, param, mem_root)) + if (ft_parse(parsed, (uchar *)ftsi.pos, ftsi.len, parser, param, mem_root)) DBUG_RETURN(1); } DBUG_RETURN(0); } -FT_WORD *_mi_ft_parserecord(MI_INFO *info, uint keynr, const byte *record, +FT_WORD *_mi_ft_parserecord(MI_INFO *info, uint keynr, const uchar *record, MEM_ROOT *mem_root) { TREE ptree; @@ -130,7 +130,7 @@ FT_WORD *_mi_ft_parserecord(MI_INFO *info, uint keynr, const byte *record, DBUG_RETURN(ft_linearize(&ptree, mem_root)); } -static int _mi_ft_store(MI_INFO *info, uint keynr, byte *keybuf, +static int _mi_ft_store(MI_INFO *info, uint keynr, uchar *keybuf, FT_WORD *wlist, my_off_t filepos) { uint key_length; @@ -145,7 +145,7 @@ static int _mi_ft_store(MI_INFO *info, uint keynr, byte *keybuf, DBUG_RETURN(0); } -static int _mi_ft_erase(MI_INFO *info, uint keynr, byte *keybuf, +static int _mi_ft_erase(MI_INFO *info, uint keynr, uchar *keybuf, FT_WORD *wlist, my_off_t filepos) { uint key_length, err=0; @@ -168,7 +168,7 @@ static int _mi_ft_erase(MI_INFO *info, uint keynr, byte *keybuf, #define THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT 1 #define GEE_THEY_ARE_ABSOLUTELY_IDENTICAL 0 -int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2) +int _mi_ft_cmp(MI_INFO *info, uint keynr, const uchar *rec1, const uchar *rec2) { FT_SEG_ITERATOR ftsi1, ftsi2; CHARSET_INFO *cs=info->s->keyinfo[keynr].seg->charset; @@ -190,8 +190,8 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2) /* update a document entry */ -int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf, - const byte *oldrec, const byte *newrec, my_off_t pos) +int _mi_ft_update(MI_INFO *info, uint keynr, uchar *keybuf, + const uchar *oldrec, const uchar *newrec, my_off_t pos) { int error= -1; FT_WORD *oldlist,*newlist, *old_word, *new_word; @@ -241,7 +241,7 @@ err: /* adds a document to the collection */ -int _mi_ft_add(MI_INFO *info, uint keynr, byte *keybuf, const byte *record, +int _mi_ft_add(MI_INFO *info, uint keynr, uchar *keybuf, const uchar *record, my_off_t pos) { int error= -1; @@ -260,7 +260,7 @@ int _mi_ft_add(MI_INFO *info, uint keynr, byte *keybuf, const byte *record, /* removes a document from the collection */ -int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record, +int _mi_ft_del(MI_INFO *info, uint keynr, uchar *keybuf, const uchar *record, my_off_t pos) { int error= -1; @@ -276,10 +276,10 @@ int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record, DBUG_RETURN(error); } -uint _ft_make_key(MI_INFO *info, uint keynr, byte *keybuf, FT_WORD *wptr, +uint _ft_make_key(MI_INFO *info, uint keynr, uchar *keybuf, FT_WORD *wptr, my_off_t filepos) { - byte buf[HA_FT_MAXBYTELEN+16]; + uchar buf[HA_FT_MAXBYTELEN+16]; DBUG_ENTER("_ft_make_key"); #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT diff --git a/storage/myisam/ftdefs.h b/storage/myisam/ftdefs.h index 26f5e4f266e..22443807b87 100644 --- a/storage/myisam/ftdefs.h +++ b/storage/myisam/ftdefs.h @@ -96,44 +96,44 @@ #define FTB_RQUOT (ft_boolean_syntax[11]) typedef struct st_ft_word { - byte * pos; + uchar * pos; uint len; double weight; } FT_WORD; int is_stopword(char *word, uint len); -uint _ft_make_key(MI_INFO *, uint , byte *, FT_WORD *, my_off_t); +uint _ft_make_key(MI_INFO *, uint , uchar *, FT_WORD *, my_off_t); -byte ft_get_word(CHARSET_INFO *, byte **, byte *, FT_WORD *, - MYSQL_FTPARSER_BOOLEAN_INFO *); -byte ft_simple_get_word(CHARSET_INFO *, byte **, const byte *, - FT_WORD *, my_bool); +uchar ft_get_word(CHARSET_INFO *, uchar **, uchar *, FT_WORD *, + MYSQL_FTPARSER_BOOLEAN_INFO *); +uchar ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *, + FT_WORD *, my_bool); typedef struct _st_ft_seg_iterator { uint num, len; HA_KEYSEG *seg; - const byte *rec, *pos; + const uchar *rec, *pos; } FT_SEG_ITERATOR; -void _mi_ft_segiterator_init(MI_INFO *, uint, const byte *, FT_SEG_ITERATOR *); -void _mi_ft_segiterator_dummy_init(const byte *, uint, FT_SEG_ITERATOR *); +void _mi_ft_segiterator_init(MI_INFO *, uint, const uchar *, FT_SEG_ITERATOR *); +void _mi_ft_segiterator_dummy_init(const uchar *, uint, FT_SEG_ITERATOR *); uint _mi_ft_segiterator(FT_SEG_ITERATOR *); void ft_parse_init(TREE *, CHARSET_INFO *); -int ft_parse(TREE *, byte *, int, struct st_mysql_ftparser *parser, +int ft_parse(TREE *, uchar *, int, struct st_mysql_ftparser *parser, MYSQL_FTPARSER_PARAM *, MEM_ROOT *); FT_WORD * ft_linearize(TREE *, MEM_ROOT *); -FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, const byte *, MEM_ROOT *); -uint _mi_ft_parse(TREE *, MI_INFO *, uint, const byte *, +FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, const uchar *, MEM_ROOT *); +uint _mi_ft_parse(TREE *, MI_INFO *, uint, const uchar *, MYSQL_FTPARSER_PARAM *, MEM_ROOT *); -FT_INFO *ft_init_nlq_search(MI_INFO *, uint, byte *, uint, uint, byte *); -FT_INFO *ft_init_boolean_search(MI_INFO *, uint, byte *, uint, CHARSET_INFO *); +FT_INFO *ft_init_nlq_search(MI_INFO *, uint, uchar *, uint, uint, uchar *); +FT_INFO *ft_init_boolean_search(MI_INFO *, uint, uchar *, uint, CHARSET_INFO *); extern const struct _ft_vft _ft_vft_nlq; int ft_nlq_read_next(FT_INFO *, char *); -float ft_nlq_find_relevance(FT_INFO *, byte *, uint); +float ft_nlq_find_relevance(FT_INFO *, uchar *, uint); void ft_nlq_close_search(FT_INFO *); float ft_nlq_get_relevance(FT_INFO *); my_off_t ft_nlq_get_docid(FT_INFO *); @@ -141,7 +141,7 @@ void ft_nlq_reinit_search(FT_INFO *); extern const struct _ft_vft _ft_vft_boolean; int ft_boolean_read_next(FT_INFO *, char *); -float ft_boolean_find_relevance(FT_INFO *, byte *, uint); +float ft_boolean_find_relevance(FT_INFO *, uchar *, uint); void ft_boolean_close_search(FT_INFO *); float ft_boolean_get_relevance(FT_INFO *); my_off_t ft_boolean_get_docid(FT_INFO *); diff --git a/storage/myisam/fulltext.h b/storage/myisam/fulltext.h index bea2fa96969..856e93e034d 100644 --- a/storage/myisam/fulltext.h +++ b/storage/myisam/fulltext.h @@ -29,9 +29,9 @@ extern const HA_KEYSEG ft_keysegs[FT_SEGS]; -int _mi_ft_cmp(MI_INFO *, uint, const byte *, const byte *); -int _mi_ft_add(MI_INFO *, uint, byte *, const byte *, my_off_t); -int _mi_ft_del(MI_INFO *, uint, byte *, const byte *, my_off_t); +int _mi_ft_cmp(MI_INFO *, uint, const uchar *, const uchar *); +int _mi_ft_add(MI_INFO *, uint, uchar *, const uchar *, my_off_t); +int _mi_ft_del(MI_INFO *, uint, uchar *, const uchar *, my_off_t); uint _mi_ft_convert_to_ft2(MI_INFO *, uint, uchar *); diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 56e428b1bc1..8b95cdb30fd 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -121,7 +121,7 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out, { uint i, j, recpos, minpos, fieldpos, temp_length, length; enum ha_base_keytype type= HA_KEYTYPE_BINARY; - byte *record; + uchar *record; KEY *pos; MI_KEYDEF *keydef; MI_COLUMNDEF *recinfo, *recinfo_pos; @@ -531,7 +531,7 @@ int ha_myisam::net_read_dump(NET* net) error= -1; goto err; } - if (my_write(data_fd, (byte*)net->read_pos, (uint) packet_len, + if (my_write(data_fd, (uchar*)net->read_pos, (uint) packet_len, MYF(MY_WME|MY_FNABP))) { error = errno; @@ -550,7 +550,7 @@ int ha_myisam::dump(THD* thd, int fd) uint blocksize = share->blocksize; my_off_t bytes_to_read = share->state.state.data_file_length; int data_fd = file->dfile; - byte * buf = (byte*) my_malloc(blocksize, MYF(MY_WME)); + uchar *buf = (uchar*) my_malloc(blocksize, MYF(MY_WME)); if (!buf) return ENOMEM; @@ -558,7 +558,7 @@ int ha_myisam::dump(THD* thd, int fd) my_seek(data_fd, 0L, MY_SEEK_SET, MYF(MY_WME)); for (; bytes_to_read > 0;) { - uint bytes = my_read(data_fd, buf, blocksize, MYF(MY_WME)); + size_t bytes = my_read(data_fd, buf, blocksize, MYF(MY_WME)); if (bytes == MY_FILE_ERROR) { error = errno; @@ -575,7 +575,7 @@ int ha_myisam::dump(THD* thd, int fd) } else { - if (my_net_write(net, (char*) buf, bytes)) + if (my_net_write(net, buf, bytes)) { error = errno ? errno : EPIPE; goto err; @@ -586,13 +586,13 @@ int ha_myisam::dump(THD* thd, int fd) if (fd < 0) { - if (my_net_write(net, "", 0)) + if (my_net_write(net, (uchar*) "", 0)) error = errno ? errno : EPIPE; net_flush(net); } err: - my_free((gptr) buf, MYF(0)); + my_free((uchar*) buf, MYF(0)); return error; } #endif /* HAVE_REPLICATION */ @@ -710,7 +710,7 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked) recinfo must be freed. */ if (recinfo) - my_free((gptr) recinfo, MYF(0)); + my_free((uchar*) recinfo, MYF(0)); return my_errno; } @@ -721,7 +721,7 @@ int ha_myisam::close(void) return mi_close(tmp); } -int ha_myisam::write_row(byte * buf) +int ha_myisam::write_row(uchar *buf) { ha_statistic_increment(&SSV::ha_write_count); @@ -1594,7 +1594,7 @@ bool ha_myisam::is_crashed() const (my_disable_locking && file->s->state.open_count)); } -int ha_myisam::update_row(const byte * old_data, byte * new_data) +int ha_myisam::update_row(const uchar *old_data, uchar *new_data) { ha_statistic_increment(&SSV::ha_update_count); if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) @@ -1602,13 +1602,13 @@ int ha_myisam::update_row(const byte * old_data, byte * new_data) return mi_update(file,old_data,new_data); } -int ha_myisam::delete_row(const byte * buf) +int ha_myisam::delete_row(const uchar *buf) { ha_statistic_increment(&SSV::ha_delete_count); return mi_delete(file,buf); } -int ha_myisam::index_read(byte *buf, const byte *key, key_part_map keypart_map, +int ha_myisam::index_read(uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) { DBUG_ASSERT(inited==INDEX); @@ -1618,7 +1618,7 @@ int ha_myisam::index_read(byte *buf, const byte *key, key_part_map keypart_map, return error; } -int ha_myisam::index_read_idx(byte *buf, uint index, const byte *key, +int ha_myisam::index_read_idx(uchar *buf, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) { @@ -1628,7 +1628,7 @@ int ha_myisam::index_read_idx(byte *buf, uint index, const byte *key, return error; } -int ha_myisam::index_read_last(byte *buf, const byte *key, +int ha_myisam::index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map) { DBUG_ENTER("ha_myisam::index_read_last"); @@ -1640,7 +1640,7 @@ int ha_myisam::index_read_last(byte *buf, const byte *key, DBUG_RETURN(error); } -int ha_myisam::index_next(byte * buf) +int ha_myisam::index_next(uchar *buf) { DBUG_ASSERT(inited==INDEX); ha_statistic_increment(&SSV::ha_read_next_count); @@ -1649,7 +1649,7 @@ int ha_myisam::index_next(byte * buf) return error; } -int ha_myisam::index_prev(byte * buf) +int ha_myisam::index_prev(uchar *buf) { DBUG_ASSERT(inited==INDEX); ha_statistic_increment(&SSV::ha_read_prev_count); @@ -1658,7 +1658,7 @@ int ha_myisam::index_prev(byte * buf) return error; } -int ha_myisam::index_first(byte * buf) +int ha_myisam::index_first(uchar *buf) { DBUG_ASSERT(inited==INDEX); ha_statistic_increment(&SSV::ha_read_first_count); @@ -1667,7 +1667,7 @@ int ha_myisam::index_first(byte * buf) return error; } -int ha_myisam::index_last(byte * buf) +int ha_myisam::index_last(uchar *buf) { DBUG_ASSERT(inited==INDEX); ha_statistic_increment(&SSV::ha_read_last_count); @@ -1676,8 +1676,8 @@ int ha_myisam::index_last(byte * buf) return error; } -int ha_myisam::index_next_same(byte * buf, - const byte *key __attribute__((unused)), +int ha_myisam::index_next_same(uchar *buf, + const uchar *key __attribute__((unused)), uint length __attribute__((unused))) { DBUG_ASSERT(inited==INDEX); @@ -1695,7 +1695,7 @@ int ha_myisam::rnd_init(bool scan) return mi_reset(file); // Free buffers } -int ha_myisam::rnd_next(byte *buf) +int ha_myisam::rnd_next(uchar *buf) { ha_statistic_increment(&SSV::ha_read_rnd_next_count); int error=mi_scan(file, buf); @@ -1703,12 +1703,12 @@ int ha_myisam::rnd_next(byte *buf) return error; } -int ha_myisam::restart_rnd_next(byte *buf, byte *pos) +int ha_myisam::restart_rnd_next(uchar *buf, uchar *pos) { return rnd_pos(buf,pos); } -int ha_myisam::rnd_pos(byte * buf, byte *pos) +int ha_myisam::rnd_pos(uchar *buf, uchar *pos) { ha_statistic_increment(&SSV::ha_read_rnd_count); int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length)); @@ -1716,7 +1716,7 @@ int ha_myisam::rnd_pos(byte * buf, byte *pos) return error; } -void ha_myisam::position(const byte* record) +void ha_myisam::position(const uchar *record) { my_off_t row_position= mi_position(file); my_store_ptr(ref, ref_length, row_position); @@ -1901,7 +1901,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg, records, recinfo, 0, (MI_UNIQUEDEF*) 0, &create_info, create_flags); - my_free((gptr) recinfo, MYF(0)); + my_free((uchar*) recinfo, MYF(0)); DBUG_RETURN(error); } @@ -1919,7 +1919,7 @@ void ha_myisam::get_auto_increment(ulonglong offset, ulonglong increment, { ulonglong nr; int error; - byte key[MI_MAX_KEY_LENGTH]; + uchar key[MI_MAX_KEY_LENGTH]; if (!table->s->next_number_key_offset) { // Autoincrement at key-start @@ -1992,7 +1992,7 @@ ha_rows ha_myisam::records_in_range(uint inx, key_range *min_key, } -int ha_myisam::ft_read(byte * buf) +int ha_myisam::ft_read(uchar *buf) { int error; diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index bb439e9914d..6cc9f4811b0 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -67,19 +67,19 @@ class ha_myisam: public handler bool called_by_logger_thread); int open(const char *name, int mode, uint test_if_locked); int close(void); - int write_row(byte * buf); - int update_row(const byte * old_data, byte * new_data); - int delete_row(const byte * buf); - int index_read(byte *buf, const byte *key, key_part_map keypart_map, + int write_row(uchar * buf); + int update_row(const uchar * old_data, uchar * new_data); + int delete_row(const uchar * buf); + int index_read(uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag); - int index_read_idx(byte *buf, uint index, const byte *key, + int index_read_idx(uchar *buf, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag); - int index_read_last(byte *buf, const byte *key, key_part_map keypart_map); - int index_next(byte * buf); - int index_prev(byte * buf); - int index_first(byte * buf); - int index_last(byte * buf); - int index_next_same(byte *buf, const byte *key, uint keylen); + int index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map); + int index_next(uchar * buf); + int index_prev(uchar * buf); + int index_first(uchar * buf); + int index_last(uchar * buf); + int index_next_same(uchar *buf, const uchar *key, uint keylen); int ft_init() { if (!ft_handler) @@ -90,15 +90,15 @@ class ha_myisam: public handler FT_INFO *ft_init_ext(uint flags, uint inx,String *key) { return ft_init_search(flags,file,inx, - (byte *)key->ptr(), key->length(), key->charset(), + (uchar *)key->ptr(), key->length(), key->charset(), table->record[0]); } - int ft_read(byte *buf); + int ft_read(uchar *buf); int rnd_init(bool scan); - int rnd_next(byte *buf); - int rnd_pos(byte * buf, byte *pos); - int restart_rnd_next(byte *buf, byte *pos); - void position(const byte *record); + int rnd_next(uchar *buf); + int rnd_pos(uchar * buf, uchar *pos); + int restart_rnd_next(uchar *buf, uchar *pos); + void position(const uchar *record); int info(uint); int extra(enum ha_extra_function operation); int extra_opt(enum ha_extra_function operation, ulong cache_size); diff --git a/storage/myisam/mi_cache.c b/storage/myisam/mi_cache.c index 59c9b2c8812..d6dcc431a8d 100644 --- a/storage/myisam/mi_cache.c +++ b/storage/myisam/mi_cache.c @@ -35,12 +35,12 @@ #include "myisamdef.h" -int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length, +int _mi_read_cache(IO_CACHE *info, uchar *buff, my_off_t pos, uint length, int flag) { uint read_length,in_buff_length; my_off_t offset; - char *in_buff_pos; + uchar *in_buff_pos; DBUG_ENTER("_mi_read_cache"); if (pos < info->pos_in_file) @@ -61,7 +61,7 @@ int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length, (my_off_t) (info->read_end - info->request_pos)) { in_buff_pos=info->request_pos+(uint) offset; - in_buff_length= min(length,(uint) (info->read_end-in_buff_pos)); + in_buff_length= min(length, (size_t) (info->read_end-in_buff_pos)); memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length); if (!(length-=in_buff_length)) DBUG_RETURN(0); diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index cd6ab65c223..255f17eada7 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -83,12 +83,12 @@ static int sort_delete_record(MI_SORT_PARAM *sort_param); /*static int flush_pending_blocks(MI_CHECK *param);*/ static SORT_KEY_BLOCKS *alloc_key_blocks(MI_CHECK *param, uint blocks, uint buffer_length); -static ha_checksum mi_byte_checksum(const byte *buf, uint length); +static ha_checksum mi_byte_checksum(const uchar *buf, uint length); static void set_data_file_type(SORT_INFO *sort_info, MYISAM_SHARE *share); void myisamchk_init(MI_CHECK *param) { - bzero((gptr) param,sizeof(*param)); + bzero((uchar*) param,sizeof(*param)); param->opt_follow_links=1; param->keys_in_use= ~(ulonglong) 0; param->search_after_block=HA_OFFSET_ERROR; @@ -296,7 +296,7 @@ static int check_k_link(MI_CHECK *param, register MI_INFO *info, uint nr) */ if (!(buff=key_cache_read(info->s->key_cache, info->s->kfile, next_link, DFLT_INIT_HITS, - (byte*) info->buff, MI_MIN_KEY_BLOCK_LENGTH, + (uchar*) info->buff, MI_MIN_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, 1))) { /* purecov: begin tested */ @@ -531,7 +531,7 @@ int chk_key(MI_CHECK *param, register MI_INFO *info) /* Check that there isn't a row with auto_increment = 0 in the table */ mi_extra(info,HA_EXTRA_KEYREAD,0); bzero(info->lastkey,keyinfo->seg->length); - if (!mi_rkey(info, info->rec_buff, key, (const byte*) info->lastkey, + if (!mi_rkey(info, info->rec_buff, key, (const uchar*) info->lastkey, (key_part_map)1, HA_READ_KEY_EXACT)) { /* Don't count this as a real warning, as myisamchk can't correct it */ @@ -741,7 +741,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, char llbuff[22]; uint diff_pos[2]; DBUG_ENTER("chk_index"); - DBUG_DUMP("buff",(byte*) buff,mi_getint(buff)); + DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff)); /* TODO: implement appropriate check for RTree keys */ if (keyinfo->flag & HA_SPATIAL) @@ -799,8 +799,8 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, (flag=ha_key_cmp(keyinfo->seg,info->lastkey,key,key_length, comp_flag, diff_pos)) >=0) { - DBUG_DUMP("old",(byte*) info->lastkey, info->lastkey_length); - DBUG_DUMP("new",(byte*) key, key_length); + DBUG_DUMP("old",(uchar*) info->lastkey, info->lastkey_length); + DBUG_DUMP("new",(uchar*) key, key_length); DBUG_DUMP("new_in_page",(char*) old_keypos,(uint) (keypos-old_keypos)); if (comp_flag & SEARCH_FIND && flag == 0) @@ -832,7 +832,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, key); } } - (*key_checksum)+= mi_byte_checksum((byte*) key, + (*key_checksum)+= mi_byte_checksum((uchar*) key, key_length- info->s->rec_reflength); record= _mi_dpos(info,0,key+key_length); if (keyinfo->flag & HA_FULLTEXT) /* special handling for ft2 */ @@ -870,7 +870,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, DBUG_PRINT("test",("page: %s record: %s filelength: %s", llstr(page,llbuff),llstr(record,llbuff2), llstr(info->state->data_file_length,llbuff3))); - DBUG_DUMP("key",(byte*) key,key_length); + DBUG_DUMP("key",(uchar*) key,key_length); DBUG_DUMP("new_in_page",(char*) old_keypos,(uint) (keypos-old_keypos)); goto err; } @@ -882,10 +882,10 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, llstr(page,llbuff), used_length, (keypos - buff)); goto err; } - my_afree((byte*) temp_buff); + my_afree((uchar*) temp_buff); DBUG_RETURN(0); err: - my_afree((byte*) temp_buff); + my_afree((uchar*) temp_buff); DBUG_RETURN(1); } /* chk_index */ @@ -940,7 +940,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) ha_rows records,del_blocks; my_off_t used,empty,pos,splits,start_recpos, del_length,link_used,start_block; - byte *record,*to; + uchar *record,*to; char llbuff[22],llbuff2[22],llbuff3[22]; ha_checksum intern_record_checksum; ha_checksum key_checksum[MI_MAX_POSSIBLE_KEY]; @@ -957,7 +957,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) puts("- check record links"); } - if (!(record= (byte*) my_malloc(info->s->base.pack_reclength,MYF(0)))) + if (!(record= (uchar*) my_malloc(info->s->base.pack_reclength,MYF(0)))) { mi_check_print_error(param,"Not enough memory for record"); DBUG_RETURN(-1); @@ -992,7 +992,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) goto err2; switch (info->s->data_file_type) { case STATIC_RECORD: - if (my_b_read(¶m->read_cache,(byte*) record, + if (my_b_read(¶m->read_cache,(uchar*) record, info->s->base.pack_reclength)) goto err; start_recpos=pos; @@ -1012,7 +1012,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) block_info.next_filepos=pos; do { - if (_mi_read_cache(¶m->read_cache,(byte*) block_info.header, + if (_mi_read_cache(¶m->read_cache,(uchar*) block_info.header, (start_block=block_info.next_filepos), sizeof(block_info.header), (flag ? 0 : READING_NEXT) | READING_HEADER)) @@ -1116,7 +1116,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) got_error=1; break; } - if (_mi_read_cache(¶m->read_cache,(byte*) to,block_info.filepos, + if (_mi_read_cache(¶m->read_cache,(uchar*) to,block_info.filepos, (uint) block_info.data_len, flag == 1 ? READING_NEXT : 0)) goto err; @@ -1177,7 +1177,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) pos=block_info.filepos+block_info.block_len; break; case COMPRESSED_RECORD: - if (_mi_read_cache(¶m->read_cache,(byte*) block_info.header, pos, + if (_mi_read_cache(¶m->read_cache,(uchar*) block_info.header, pos, info->s->pack.ref_length, READING_NEXT)) goto err; start_recpos=pos; @@ -1194,7 +1194,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) got_error=1; break; } - if (_mi_read_cache(¶m->read_cache,(byte*) info->rec_buff, + if (_mi_read_cache(¶m->read_cache,(uchar*) info->rec_buff, block_info.filepos, block_info.rec_len, READING_NEXT)) goto err; if (_mi_pack_rec_unpack(info, &info->bit_buff, record, @@ -1254,7 +1254,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) } } else - key_checksum[key]+=mi_byte_checksum((byte*) info->lastkey, + key_checksum[key]+=mi_byte_checksum((uchar*) info->lastkey, key_length); } } @@ -1364,12 +1364,12 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) printf("Lost space: %12s Linkdata: %10s\n", llstr(empty,llbuff),llstr(link_used,llbuff2)); } - my_free((gptr) record,MYF(0)); + my_free((uchar*) record,MYF(0)); DBUG_RETURN (error); err: mi_check_print_error(param,"got error: %d when reading datafile at record: %s",my_errno, llstr(records,llbuff)); err2: - my_free((gptr) record,MYF(0)); + my_free((uchar*) record,MYF(0)); param->testflag|=T_RETRY_WITHOUT_QUICK; DBUG_RETURN(1); } /* chk_data_link */ @@ -1379,7 +1379,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) /* Save new datafile-name in temp_filename */ int mi_repair(MI_CHECK *param, register MI_INFO *info, - my_string name, int rep_quick) + char * name, int rep_quick) { int error,got_error; uint i; @@ -1428,7 +1428,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, MYF(MY_WME | MY_WAIT_IF_FULL))) goto err; info->opt_flag|=WRITE_CACHE_USED; - if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength, + if (!(sort_param.record=(uchar*) my_malloc((uint) share->base.pack_reclength, MYF(0))) || !mi_alloc_rec_buff(info, -1, &sort_param.rec_buff)) { @@ -1515,7 +1515,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, { if (my_errno != HA_ERR_FOUND_DUPP_KEY) goto err; - DBUG_DUMP("record",(byte*) sort_param.record,share->base.pack_reclength); + DBUG_DUMP("record",(uchar*) sort_param.record,share->base.pack_reclength); mi_check_print_info(param,"Duplicate key %2d for record at %10s against new record at %10s", info->errkey+1, llstr(sort_param.start_recpos,llbuff), @@ -1661,7 +1661,7 @@ static int writekeys(MI_SORT_PARAM *sort_param) register uint i; uchar *key; MI_INFO *info= sort_param->sort_info->info; - byte *buff= sort_param->record; + uchar *buff= sort_param->record; my_off_t filepos= sort_param->filepos; DBUG_ENTER("writekeys"); @@ -1725,7 +1725,7 @@ static int writekeys(MI_SORT_PARAM *sort_param) /* Change all key-pointers that points to a records */ -int movepoint(register MI_INFO *info, byte *record, my_off_t oldpos, +int movepoint(register MI_INFO *info, uchar *record, my_off_t oldpos, my_off_t newpos, uint prot_key) { register uint i; @@ -1802,7 +1802,7 @@ int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file) /* Sort index for more efficent reads */ -int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name) +int mi_sort_index(MI_CHECK *param, register MI_INFO *info, char * name) { reg2 uint key; reg1 MI_KEYDEF *keyinfo; @@ -1945,7 +1945,7 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, ("From page: %ld, keyoffset: %lu used_length: %d", (ulong) pagepos, (ulong) (keypos - buff), (int) used_length)); - DBUG_DUMP("buff",(byte*) buff,used_length); + DBUG_DUMP("buff",(uchar*) buff,used_length); goto err; } } @@ -1974,17 +1974,17 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, /* Fill block with zero and write it to the new index file */ length=mi_getint(buff); - bzero((byte*) buff+length,keyinfo->block_length-length); - if (my_pwrite(new_file,(byte*) buff,(uint) keyinfo->block_length, + bzero((uchar*) buff+length,keyinfo->block_length-length); + if (my_pwrite(new_file,(uchar*) buff,(uint) keyinfo->block_length, new_page_pos,MYF(MY_NABP | MY_WAIT_IF_FULL))) { mi_check_print_error(param,"Can't write indexblock, error: %d",my_errno); goto err; } - my_afree((gptr) buff); + my_afree((uchar*) buff); DBUG_RETURN(0); err: - my_afree((gptr) buff); + my_afree((uchar*) buff); DBUG_RETURN(1); } /* sort_one_index */ @@ -2055,13 +2055,13 @@ int filecopy(MI_CHECK *param, File to,File from,my_off_t start, VOID(my_seek(from,start,MY_SEEK_SET,MYF(0))); while (length > buff_length) { - if (my_read(from,(byte*) buff,buff_length,MYF(MY_NABP)) || - my_write(to,(byte*) buff,buff_length,param->myf_rw)) + if (my_read(from,(uchar*) buff,buff_length,MYF(MY_NABP)) || + my_write(to,(uchar*) buff,buff_length,param->myf_rw)) goto err; length-= buff_length; } - if (my_read(from,(byte*) buff,(uint) length,MYF(MY_NABP)) || - my_write(to,(byte*) buff,(uint) length,param->myf_rw)) + if (my_read(from,(uchar*) buff,(uint) length,MYF(MY_NABP)) || + my_write(to,(uchar*) buff,(uint) length,param->myf_rw)) goto err; if (buff != tmp_buff) my_free(buff,MYF(0)); @@ -2142,7 +2142,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, info->opt_flag|=WRITE_CACHE_USED; info->rec_cache.file=info->dfile; /* for sort_delete_record */ - if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength, + if (!(sort_param.record=(uchar*) my_malloc((uint) share->base.pack_reclength, MYF(0))) || !mi_alloc_rec_buff(info, -1, &sort_param.rec_buff)) { @@ -2455,8 +2455,8 @@ err: my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff), MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR)); - my_free((gptr) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR)); - my_free((gptr) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR)); VOID(end_io_cache(¶m->read_cache)); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); @@ -2988,9 +2988,9 @@ err: pthread_cond_destroy (&sort_info.cond); pthread_mutex_destroy(&sort_info.mutex); - my_free((gptr) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR)); - my_free((gptr) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR)); - my_free((gptr) sort_param,MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) sort_param,MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR)); VOID(end_io_cache(¶m->read_cache)); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); @@ -3120,7 +3120,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) int parallel_flag; uint found_record,b_type,left_length; my_off_t pos; - byte *to; + uchar *to; MI_BLOCK_INFO block_info; SORT_INFO *sort_info=sort_param->sort_info; MI_CHECK *param=sort_info->param; @@ -3198,7 +3198,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) llstr(param->search_after_block,llbuff), llstr(sort_param->start_recpos,llbuff2)); if (_mi_read_cache(&sort_param->read_cache, - (byte*) block_info.header,pos, + (uchar*) block_info.header,pos, MI_BLOCK_INFO_HEADER_LENGTH, (! found_record ? READING_NEXT : 0) | parallel_flag | READING_HEADER)) @@ -3462,7 +3462,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) case COMPRESSED_RECORD: for (searching=0 ;; searching=1, sort_param->pos++) { - if (_mi_read_cache(&sort_param->read_cache,(byte*) block_info.header, + if (_mi_read_cache(&sort_param->read_cache,(uchar*) block_info.header, sort_param->pos, share->pack.ref_length,READING_NEXT)) DBUG_RETURN(-1); @@ -3490,7 +3490,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) llstr(sort_param->pos,llbuff)); continue; } - if (_mi_read_cache(&sort_param->read_cache,(byte*) sort_param->rec_buff, + if (_mi_read_cache(&sort_param->read_cache,(uchar*) sort_param->rec_buff, block_info.filepos, block_info.rec_len, READING_NEXT)) { @@ -3546,8 +3546,8 @@ int sort_write_record(MI_SORT_PARAM *sort_param) int flag; uint length; ulong block_length,reclength; - byte *from; - byte block_buff[8]; + uchar *from; + uchar block_buff[8]; SORT_INFO *sort_info=sort_param->sort_info; MI_CHECK *param=sort_info->param; MI_INFO *info=sort_info->info; @@ -3623,7 +3623,7 @@ int sort_write_record(MI_SORT_PARAM *sort_param) length+= save_pack_length((uint) share->pack.version, block_buff + length, info->blob_length); if (my_b_write(&info->rec_cache,block_buff,length) || - my_b_write(&info->rec_cache,(byte*) sort_param->rec_buff,reclength)) + my_b_write(&info->rec_cache,(uchar*) sort_param->rec_buff,reclength)) { mi_check_print_error(param,"%d when writing to datafile",my_errno); DBUG_RETURN(1); @@ -3923,7 +3923,7 @@ static int sort_insert_key(MI_SORT_PARAM *sort_param, /* Fill block with end-zero and write filled block */ mi_putint(anc_buff,key_block->last_length,nod_flag); - bzero((byte*) anc_buff+key_block->last_length, + bzero((uchar*) anc_buff+key_block->last_length, keyinfo->block_length- key_block->last_length); key_file_length=info->state->key_file_length; if ((filepos=_mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR) @@ -3935,10 +3935,10 @@ static int sort_insert_key(MI_SORT_PARAM *sort_param, if (_mi_write_keypage(info, keyinfo, filepos, DFLT_INIT_HITS, anc_buff)) DBUG_RETURN(1); } - else if (my_pwrite(info->s->kfile,(byte*) anc_buff, + else if (my_pwrite(info->s->kfile,(uchar*) anc_buff, (uint) keyinfo->block_length,filepos, param->myf_rw)) DBUG_RETURN(1); - DBUG_DUMP("buff",(byte*) anc_buff,mi_getint(anc_buff)); + DBUG_DUMP("buff",(uchar*) anc_buff,mi_getint(anc_buff)); /* Write separator-key to block in next level */ if (sort_insert_key(sort_param,key_block+1,key_block->lastkey,filepos)) @@ -4029,7 +4029,7 @@ int flush_pending_blocks(MI_SORT_PARAM *sort_param) if (nod_flag) _mi_kpointer(info,key_block->end_pos,filepos); key_file_length=info->state->key_file_length; - bzero((byte*) key_block->buff+length, keyinfo->block_length-length); + bzero((uchar*) key_block->buff+length, keyinfo->block_length-length); if ((filepos=_mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR) DBUG_RETURN(1); @@ -4040,10 +4040,10 @@ int flush_pending_blocks(MI_SORT_PARAM *sort_param) DFLT_INIT_HITS, key_block->buff)) DBUG_RETURN(1); } - else if (my_pwrite(info->s->kfile,(byte*) key_block->buff, + else if (my_pwrite(info->s->kfile,(uchar*) key_block->buff, (uint) keyinfo->block_length,filepos, myf_rw)) DBUG_RETURN(1); - DBUG_DUMP("buff",(byte*) key_block->buff,length); + DBUG_DUMP("buff",(uchar*) key_block->buff,length); nod_flag=1; } info->s->state.key_root[sort_param->key]=filepos; /* Last is root for tree */ @@ -4114,34 +4114,34 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) (param->testflag & T_UNPACK); if (!(keyinfo=(MI_KEYDEF*) my_alloca(sizeof(MI_KEYDEF)*share.base.keys))) DBUG_RETURN(0); - memcpy((byte*) keyinfo,(byte*) share.keyinfo, + memcpy((uchar*) keyinfo,(uchar*) share.keyinfo, (size_t) (sizeof(MI_KEYDEF)*share.base.keys)); key_parts= share.base.all_key_parts; if (!(keysegs=(HA_KEYSEG*) my_alloca(sizeof(HA_KEYSEG)* (key_parts+share.base.keys)))) { - my_afree((gptr) keyinfo); + my_afree((uchar*) keyinfo); DBUG_RETURN(1); } if (!(recdef=(MI_COLUMNDEF*) my_alloca(sizeof(MI_COLUMNDEF)*(share.base.fields+1)))) { - my_afree((gptr) keyinfo); - my_afree((gptr) keysegs); + my_afree((uchar*) keyinfo); + my_afree((uchar*) keysegs); DBUG_RETURN(1); } if (!(uniquedef=(MI_UNIQUEDEF*) my_alloca(sizeof(MI_UNIQUEDEF)*(share.state.header.uniques+1)))) { - my_afree((gptr) recdef); - my_afree((gptr) keyinfo); - my_afree((gptr) keysegs); + my_afree((uchar*) recdef); + my_afree((uchar*) keyinfo); + my_afree((uchar*) keysegs); DBUG_RETURN(1); } /* Copy the column definitions */ - memcpy((byte*) recdef,(byte*) share.rec, + memcpy((uchar*) recdef,(uchar*) share.rec, (size_t) (sizeof(MI_COLUMNDEF)*(share.base.fields+1))); for (rec=recdef,end=recdef+share.base.fields; rec != end ; rec++) { @@ -4153,7 +4153,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) } /* Change the new key to point at the saved key segments */ - memcpy((byte*) keysegs,(byte*) share.keyparts, + memcpy((uchar*) keysegs,(uchar*) share.keyparts, (size_t) (sizeof(HA_KEYSEG)*(key_parts+share.base.keys+ share.state.header.uniques))); keyseg=keysegs; @@ -4170,7 +4170,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) /* Copy the unique definitions and change them to point at the new key segments*/ - memcpy((byte*) uniquedef,(byte*) share.uniqueinfo, + memcpy((uchar*) uniquedef,(uchar*) share.uniqueinfo, (size_t) (sizeof(MI_UNIQUEDEF)*(share.state.header.uniques))); for (u_ptr=uniquedef,u_end=uniquedef+share.state.header.uniques; u_ptr != u_end ; u_ptr++) @@ -4252,10 +4252,10 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) goto end; error=0; end: - my_afree((gptr) uniquedef); - my_afree((gptr) keyinfo); - my_afree((gptr) recdef); - my_afree((gptr) keysegs); + my_afree((uchar*) uniquedef); + my_afree((uchar*) keyinfo); + my_afree((uchar*) recdef); + my_afree((uchar*) keysegs); DBUG_RETURN(error); } @@ -4358,7 +4358,7 @@ err: void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, my_bool repair_only) { - byte *record; + uchar *record; DBUG_ENTER("update_auto_increment_key"); if (!info->s->base.auto_key || @@ -4377,7 +4377,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, We have to use an allocated buffer instead of info->rec_buff as _mi_put_key_in_record() may use info->rec_buff */ - if (!(record= (byte*) my_malloc((uint) info->s->base.pack_reclength, + if (!(record= (uchar*) my_malloc((uint) info->s->base.pack_reclength, MYF(0)))) { mi_check_print_error(param,"Not enough memory for extra record"); @@ -4505,10 +4505,10 @@ void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part, } -static ha_checksum mi_byte_checksum(const byte *buf, uint length) +static ha_checksum mi_byte_checksum(const uchar *buf, uint length) { ha_checksum crc; - const byte *end=buf+length; + const uchar *end=buf+length; for (crc=0; buf != end; buf++) crc=((crc << 1) + *((uchar*) buf)) + test(crc & (((ha_checksum) 1) << (8*sizeof(ha_checksum)-1))); diff --git a/storage/myisam/mi_checksum.c b/storage/myisam/mi_checksum.c index 711e87c1547..4e87de373bd 100644 --- a/storage/myisam/mi_checksum.c +++ b/storage/myisam/mi_checksum.c @@ -17,7 +17,7 @@ #include "myisamdef.h" -ha_checksum mi_checksum(MI_INFO *info, const byte *buf) +ha_checksum mi_checksum(MI_INFO *info, const uchar *buf) { uint i; ha_checksum crc=0; @@ -25,7 +25,7 @@ ha_checksum mi_checksum(MI_INFO *info, const byte *buf) for (i=info->s->base.fields ; i-- ; buf+=(rec++)->length) { - const byte *pos; + const uchar *pos; ulong length; switch (rec->type) { case FIELD_BLOB: @@ -52,13 +52,13 @@ ha_checksum mi_checksum(MI_INFO *info, const byte *buf) pos=buf; break; } - crc=my_checksum(crc, pos ? pos : "", length); + crc=my_checksum(crc, pos ? pos : (uchar*) "", length); } return crc; } -ha_checksum mi_static_checksum(MI_INFO *info, const byte *pos) +ha_checksum mi_static_checksum(MI_INFO *info, const uchar *pos) { return my_checksum(0, pos, info->s->base.reclength); } diff --git a/storage/myisam/mi_close.c b/storage/myisam/mi_close.c index 47b7ba855c0..07105aea88d 100644 --- a/storage/myisam/mi_close.c +++ b/storage/myisam/mi_close.c @@ -87,8 +87,8 @@ int mi_close(register MI_INFO *info) #endif if (share->decode_trees) { - my_free((gptr) share->decode_trees,MYF(0)); - my_free((gptr) share->decode_tables,MYF(0)); + my_free((uchar*) share->decode_trees,MYF(0)); + my_free((uchar*) share->decode_tables,MYF(0)); } #ifdef THREAD thr_lock_delete(&share->lock); @@ -102,19 +102,19 @@ int mi_close(register MI_INFO *info) } } #endif - my_free((gptr) info->s,MYF(0)); + my_free((uchar*) info->s,MYF(0)); } pthread_mutex_unlock(&THR_LOCK_myisam); if (info->ftparser_param) { - my_free((gptr)info->ftparser_param, MYF(0)); + my_free((uchar*)info->ftparser_param, MYF(0)); info->ftparser_param= 0; } if (info->dfile >= 0 && my_close(info->dfile,MYF(0))) error = my_errno; myisam_log_command(MI_LOG_CLOSE,info,NULL,0,error); - my_free((gptr) info,MYF(0)); + my_free((uchar*) info,MYF(0)); if (error) { diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index 71d377c8b6b..c177aa8d987 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -76,7 +76,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, LINT_INIT(file); errpos=0; options=0; - bzero((byte*) &share,sizeof(share)); + bzero((uchar*) &share,sizeof(share)); if (flags & HA_DONT_TOUCH_DATA) { @@ -498,7 +498,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, goto err; } - bmove(share.state.header.file_version,(byte*) myisam_file_magic,4); + bmove(share.state.header.file_version,(uchar*) myisam_file_magic,4); ci->old_options=options| (ci->old_options & HA_OPTION_TEMP_COMPRESS_RECORD ? HA_OPTION_COMPRESS_RECORD | HA_OPTION_TEMP_COMPRESS_RECORD: 0); diff --git a/storage/myisam/mi_delete.c b/storage/myisam/mi_delete.c index 409930ff7fb..29a84570f1e 100644 --- a/storage/myisam/mi_delete.c +++ b/storage/myisam/mi_delete.c @@ -32,7 +32,7 @@ static int _mi_ck_real_delete(register MI_INFO *info,MI_KEYDEF *keyinfo, uchar *key, uint key_length, my_off_t *root); -int mi_delete(MI_INFO *info,const byte *record) +int mi_delete(MI_INFO *info,const uchar *record) { uint i; uchar *old_key; @@ -100,7 +100,7 @@ int mi_delete(MI_INFO *info,const byte *record) info->state->records--; mi_sizestore(lastpos,info->lastpos); - myisam_log_command(MI_LOG_DELETE,info,(byte*) lastpos,sizeof(lastpos),0); + myisam_log_command(MI_LOG_DELETE,info,(uchar*) lastpos,sizeof(lastpos),0); VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE)); allow_break(); /* Allow SIGHUP & SIGINT */ if (info->invalidator != 0) @@ -114,7 +114,7 @@ int mi_delete(MI_INFO *info,const byte *record) err: save_errno=my_errno; mi_sizestore(lastpos,info->lastpos); - myisam_log_command(MI_LOG_DELETE,info,(byte*) lastpos, sizeof(lastpos),0); + myisam_log_command(MI_LOG_DELETE,info,(uchar*) lastpos, sizeof(lastpos),0); if (save_errno != HA_ERR_RECORD_CHANGED) { mi_print_error(info->s, HA_ERR_CRASHED); @@ -198,7 +198,7 @@ static int _mi_ck_real_delete(register MI_INFO *info, MI_KEYDEF *keyinfo, } } err: - my_afree((gptr) root_buff); + my_afree((uchar*) root_buff); DBUG_PRINT("exit",("Return: %d",error)); DBUG_RETURN(error); } /* _mi_ck_real_delete */ @@ -223,7 +223,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, my_off_t leaf_page,next_block; uchar lastkey[MI_MAX_KEY_BUFF]; DBUG_ENTER("d_search"); - DBUG_DUMP("page",(byte*) anc_buff,mi_getint(anc_buff)); + DBUG_DUMP("page",(uchar*) anc_buff,mi_getint(anc_buff)); search_key_length= (comp_flag & SEARCH_FIND) ? key_length : USE_WHOLE_KEY; flag=(*keyinfo->bin_search)(info,keyinfo,anc_buff,key, search_key_length, @@ -381,14 +381,14 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ret_value|=_mi_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,anc_buff); else { - DBUG_DUMP("page",(byte*) anc_buff,mi_getint(anc_buff)); + DBUG_DUMP("page",(uchar*) anc_buff,mi_getint(anc_buff)); } - my_afree((byte*) leaf_buff); + my_afree((uchar*) leaf_buff); DBUG_PRINT("exit",("Return: %d",ret_value)); DBUG_RETURN(ret_value); err: - my_afree((byte*) leaf_buff); + my_afree((uchar*) leaf_buff); DBUG_PRINT("exit",("Error: %d",my_errno)); DBUG_RETURN (-1); } /* d_search */ @@ -411,7 +411,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key, DBUG_ENTER("del"); DBUG_PRINT("enter",("leaf_page: %ld keypos: 0x%lx", (long) leaf_page, (ulong) keypos)); - DBUG_DUMP("leaf_buff",(byte*) leaf_buff,mi_getint(leaf_buff)); + DBUG_DUMP("leaf_buff",(uchar*) leaf_buff,mi_getint(leaf_buff)); endpos=leaf_buff+mi_getint(leaf_buff); if (!(key_start=_mi_get_last_key(info,keyinfo,leaf_buff,keybuff,endpos, @@ -428,7 +428,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key, ret_value= -1; else { - DBUG_DUMP("next_page",(byte*) next_buff,mi_getint(next_buff)); + DBUG_DUMP("next_page",(uchar*) next_buff,mi_getint(next_buff)); if ((ret_value=del(info,keyinfo,key,anc_buff,next_page,next_buff, keypos,next_block,ret_key)) >0) { @@ -455,7 +455,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key, if (_mi_write_keypage(info,keyinfo,leaf_page,DFLT_INIT_HITS,leaf_buff)) goto err; } - my_afree((byte*) next_buff); + my_afree((uchar*) next_buff); DBUG_RETURN(ret_value); } @@ -479,7 +479,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key, prev_key, prev_key, keybuff,&s_temp); if (length > 0) - bmove_upp((byte*) endpos+length,(byte*) endpos,(uint) (endpos-keypos)); + bmove_upp((uchar*) endpos+length,(uchar*) endpos,(uint) (endpos-keypos)); else bmove(keypos,keypos-length, (int) (endpos-keypos)+length); (*keyinfo->store_key)(keyinfo,keypos,&s_temp); @@ -517,8 +517,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, DBUG_ENTER("underflow"); DBUG_PRINT("enter",("leaf_page: %ld keypos: 0x%lx",(long) leaf_page, (ulong) keypos)); - DBUG_DUMP("anc_buff",(byte*) anc_buff,mi_getint(anc_buff)); - DBUG_DUMP("leaf_buff",(byte*) leaf_buff,mi_getint(leaf_buff)); + DBUG_DUMP("anc_buff",(uchar*) anc_buff,mi_getint(anc_buff)); + DBUG_DUMP("leaf_buff",(uchar*) leaf_buff,mi_getint(leaf_buff)); buff=info->buff; info->buff_used=1; @@ -554,10 +554,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (!_mi_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,buff,0)) goto err; buff_length=mi_getint(buff); - DBUG_DUMP("next",(byte*) buff,buff_length); + DBUG_DUMP("next",(uchar*) buff,buff_length); /* find keys to make a big key-page */ - bmove((byte*) next_keypos-key_reflength,(byte*) buff+2, + bmove((uchar*) next_keypos-key_reflength,(uchar*) buff+2, key_reflength); if (!_mi_get_last_key(info,keyinfo,anc_buff,anc_key,next_keypos,&length) || !_mi_get_last_key(info,keyinfo,leaf_buff,leaf_key, @@ -572,8 +572,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, length=buff_length-p_length; endpos=buff+length+leaf_length+t_length; /* buff will always be larger than before !*/ - bmove_upp((byte*) endpos, (byte*) buff+buff_length,length); - memcpy((byte*) buff, (byte*) leaf_buff,(size_t) leaf_length); + bmove_upp((uchar*) endpos, (uchar*) buff+buff_length,length); + memcpy((uchar*) buff, (uchar*) leaf_buff,(size_t) leaf_length); (*keyinfo->store_key)(keyinfo,buff+leaf_length,&s_temp); buff_length=(uint) (endpos-buff); mi_putint(buff,buff_length,nod_flag); @@ -589,7 +589,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (buff_length <= keyinfo->block_length) { /* Keys in one page */ - memcpy((byte*) leaf_buff,(byte*) buff,(size_t) buff_length); + memcpy((uchar*) leaf_buff,(uchar*) buff,(size_t) buff_length); if (_mi_dispose(info,keyinfo,next_page,DFLT_INIT_HITS)) goto err; } @@ -605,7 +605,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, &key_length, &after_key))) goto err; length=(uint) (half_pos-buff); - memcpy((byte*) leaf_buff,(byte*) buff,(size_t) length); + memcpy((uchar*) leaf_buff,(uchar*) buff,(size_t) length); mi_putint(leaf_buff,length,nod_flag); /* Correct new keypointer to leaf_page */ @@ -619,7 +619,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, prev_key, prev_key, leaf_key, &s_temp); if (t_length >= 0) - bmove_upp((byte*) endpos+t_length,(byte*) endpos, + bmove_upp((uchar*) endpos+t_length,(uchar*) endpos, (uint) (endpos-keypos)); else bmove(keypos,keypos-t_length,(uint) (endpos-keypos)+t_length); @@ -628,7 +628,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, /* Store key first in new page */ if (nod_flag) - bmove((byte*) buff+2,(byte*) half_pos-nod_flag,(size_t) nod_flag); + bmove((uchar*) buff+2,(uchar*) half_pos-nod_flag,(size_t) nod_flag); if (!(*keyinfo->get_key)(keyinfo,nod_flag,&half_pos,leaf_key)) goto err; t_length=(int) (*keyinfo->pack_key)(keyinfo, nod_flag, (uchar*) 0, @@ -636,7 +636,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, leaf_key, &s_temp); /* t_length will always be > 0 for a new page !*/ length=(uint) ((buff+mi_getint(buff))-half_pos); - bmove((byte*) buff+p_length+t_length,(byte*) half_pos,(size_t) length); + bmove((uchar*) buff+p_length+t_length,(uchar*) half_pos,(size_t) length); (*keyinfo->store_key)(keyinfo,buff+p_length,&s_temp); mi_putint(buff,length+t_length+p_length,nod_flag); @@ -659,10 +659,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, goto err; buff_length=mi_getint(buff); endpos=buff+buff_length; - DBUG_DUMP("prev",(byte*) buff,buff_length); + DBUG_DUMP("prev",(uchar*) buff,buff_length); /* find keys to make a big key-page */ - bmove((byte*) next_keypos - key_reflength,(byte*) leaf_buff+2, + bmove((uchar*) next_keypos - key_reflength,(uchar*) leaf_buff+2, key_reflength); next_keypos=keypos; if (!(*keyinfo->get_key)(keyinfo,key_reflength,&next_keypos, @@ -679,10 +679,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, prev_key, prev_key, anc_key, &s_temp); if (t_length >= 0) - bmove((byte*) endpos+t_length,(byte*) leaf_buff+p_length, + bmove((uchar*) endpos+t_length,(uchar*) leaf_buff+p_length, (size_t) (leaf_length-p_length)); else /* We gained space */ - bmove((byte*) endpos,(byte*) leaf_buff+((int) p_length-t_length), + bmove((uchar*) endpos,(uchar*) leaf_buff+((int) p_length-t_length), (size_t) (leaf_length-p_length+t_length)); (*keyinfo->store_key)(keyinfo,endpos,&s_temp); @@ -715,8 +715,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, goto err; _mi_kpointer(info,leaf_key+key_length,leaf_page); /* Save key in anc_buff */ - DBUG_DUMP("anc_buff",(byte*) anc_buff,anc_length); - DBUG_DUMP("key_to_anc",(byte*) leaf_key,key_length); + DBUG_DUMP("anc_buff",(uchar*) anc_buff,anc_length); + DBUG_DUMP("key_to_anc",(uchar*) leaf_key,key_length); temp_pos=anc_buff+anc_length; t_length=(*keyinfo->pack_key)(keyinfo,key_reflength, @@ -725,7 +725,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, anc_pos, anc_pos, leaf_key,&s_temp); if (t_length > 0) - bmove_upp((byte*) temp_pos+t_length,(byte*) temp_pos, + bmove_upp((uchar*) temp_pos+t_length,(uchar*) temp_pos, (uint) (temp_pos-keypos)); else bmove(keypos,keypos-t_length,(uint) (temp_pos-keypos)+t_length); @@ -734,15 +734,15 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, /* Store first key on new page */ if (nod_flag) - bmove((byte*) leaf_buff+2,(byte*) half_pos-nod_flag,(size_t) nod_flag); + bmove((uchar*) leaf_buff+2,(uchar*) half_pos-nod_flag,(size_t) nod_flag); if (!(length=(*keyinfo->get_key)(keyinfo,nod_flag,&half_pos,leaf_key))) goto err; - DBUG_DUMP("key_to_leaf",(byte*) leaf_key,length); + DBUG_DUMP("key_to_leaf",(uchar*) leaf_key,length); t_length=(*keyinfo->pack_key)(keyinfo,nod_flag, (uchar*) 0, (uchar*) 0, (uchar*) 0, leaf_key, &s_temp); length=(uint) ((buff+buff_length)-half_pos); DBUG_PRINT("info",("t_length: %d length: %d",t_length,(int) length)); - bmove((byte*) leaf_buff+p_length+t_length,(byte*) half_pos, + bmove((uchar*) leaf_buff+p_length+t_length,(uchar*) half_pos, (size_t) length); (*keyinfo->store_key)(keyinfo,leaf_buff+p_length,&s_temp); mi_putint(leaf_buff,length+t_length+p_length,nod_flag); @@ -886,7 +886,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag, } } end: - bmove((byte*) start,(byte*) start+s_length, + bmove((uchar*) start,(uchar*) start+s_length, (uint) (page_end-start-s_length)); DBUG_RETURN((uint) s_length); } /* remove_key */ diff --git a/storage/myisam/mi_delete_all.c b/storage/myisam/mi_delete_all.c index a17514486d5..dea0385cbca 100644 --- a/storage/myisam/mi_delete_all.c +++ b/storage/myisam/mi_delete_all.c @@ -47,7 +47,7 @@ int mi_delete_all_rows(MI_INFO *info) for (i=0 ; i < share->base.keys ; i++) state->key_root[i]= HA_OFFSET_ERROR; - myisam_log_command(MI_LOG_DELETE_ALL,info,(byte*) 0,0,0); + myisam_log_command(MI_LOG_DELETE_ALL,info,(uchar*) 0,0,0); /* If we are using delayed keys or if the user has done changes to the tables since it was locked then there may be key blocks in the key cache diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index 5342619c79b..eba868bfb82 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -28,15 +28,15 @@ /* Enough for comparing if number is zero */ static char zero_string[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -static int write_dynamic_record(MI_INFO *info,const byte *record, +static int write_dynamic_record(MI_INFO *info,const uchar *record, ulong reclength); static int _mi_find_writepos(MI_INFO *info,ulong reclength,my_off_t *filepos, ulong *length); -static int update_dynamic_record(MI_INFO *info,my_off_t filepos,byte *record, +static int update_dynamic_record(MI_INFO *info,my_off_t filepos,uchar *record, ulong reclength); static int delete_dynamic_record(MI_INFO *info,my_off_t filepos, uint second_read); -static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos, +static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos, uint length); #ifdef THREAD @@ -79,13 +79,13 @@ my_bool mi_dynmap_file(MI_INFO *info, my_off_t size) mapping. When swap space is not reserved one might get SIGSEGV upon a write if no physical memory is available. */ - info->s->file_map= (byte*) + info->s->file_map= (uchar*) my_mmap(0, (size_t)(size + MEMMAP_EXTRA_MARGIN), info->s->mode==O_RDONLY ? PROT_READ : PROT_READ | PROT_WRITE, MAP_SHARED | MAP_NORESERVE, info->dfile, 0L); - if (info->s->file_map == (byte*) MAP_FAILED) + if (info->s->file_map == (uchar*) MAP_FAILED) { info->s->file_map= NULL; DBUG_RETURN(1); @@ -135,7 +135,7 @@ void mi_remap_file(MI_INFO *info, my_off_t size) 0 ok */ -uint mi_mmap_pread(MI_INFO *info, byte *Buffer, +uint mi_mmap_pread(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags) { DBUG_PRINT("info", ("mi_read with mmap %d\n", info->dfile)); @@ -167,7 +167,7 @@ uint mi_mmap_pread(MI_INFO *info, byte *Buffer, /* wrapper for my_pread in case if mmap isn't used */ -uint mi_nommap_pread(MI_INFO *info, byte *Buffer, +uint mi_nommap_pread(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags) { return my_pread(info->dfile, Buffer, Count, offset, MyFlags); @@ -190,7 +190,7 @@ uint mi_nommap_pread(MI_INFO *info, byte *Buffer, !=0 error. In this case return error from pwrite */ -uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer, +uint mi_mmap_pwrite(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags) { DBUG_PRINT("info", ("mi_write with mmap %d\n", info->dfile)); @@ -224,28 +224,28 @@ uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer, /* wrapper for my_pwrite in case if mmap isn't used */ -uint mi_nommap_pwrite(MI_INFO *info, byte *Buffer, +uint mi_nommap_pwrite(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags) { return my_pwrite(info->dfile, Buffer, Count, offset, MyFlags); } -int _mi_write_dynamic_record(MI_INFO *info, const byte *record) +int _mi_write_dynamic_record(MI_INFO *info, const uchar *record) { ulong reclength=_mi_rec_pack(info,info->rec_buff,record); return (write_dynamic_record(info,info->rec_buff,reclength)); } -int _mi_update_dynamic_record(MI_INFO *info, my_off_t pos, const byte *record) +int _mi_update_dynamic_record(MI_INFO *info, my_off_t pos, const uchar *record) { uint length=_mi_rec_pack(info,info->rec_buff,record); return (update_dynamic_record(info,pos,info->rec_buff,length)); } -int _mi_write_blob_record(MI_INFO *info, const byte *record) +int _mi_write_blob_record(MI_INFO *info, const uchar *record) { - byte *rec_buff; + uchar *rec_buff; int error; ulong reclength,reclength2,extra; @@ -260,7 +260,7 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record) return -1; } #endif - if (!(rec_buff=(byte*) my_alloca(reclength))) + if (!(rec_buff=(uchar*) my_alloca(reclength))) { my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */ return(-1); @@ -277,9 +277,9 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record) } -int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const byte *record) +int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const uchar *record) { - byte *rec_buff; + uchar *rec_buff; int error; ulong reclength,extra; @@ -294,7 +294,7 @@ int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const byte *record) return -1; } #endif - if (!(rec_buff=(byte*) my_alloca(reclength))) + if (!(rec_buff=(uchar*) my_alloca(reclength))) { my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */ return(-1); @@ -317,7 +317,7 @@ int _mi_delete_dynamic_record(MI_INFO *info) /* Write record to data-file */ -static int write_dynamic_record(MI_INFO *info, const byte *record, +static int write_dynamic_record(MI_INFO *info, const uchar *record, ulong reclength) { int flag; @@ -333,7 +333,7 @@ static int write_dynamic_record(MI_INFO *info, const byte *record, if (_mi_write_part_record(info,filepos,length, (info->append_insert_at_end ? HA_OFFSET_ERROR : info->s->state.dellink), - (byte**) &record,&reclength,&flag)) + (uchar**) &record,&reclength,&flag)) goto err; } while (reclength); @@ -543,7 +543,7 @@ static int delete_dynamic_record(MI_INFO *info, my_off_t filepos, bfill(block_info.header+12,8,255); else mi_sizestore(block_info.header+12,block_info.next_filepos); - if (info->s->file_write(info,(byte*) block_info.header,20,filepos, + if (info->s->file_write(info,(uchar*) block_info.header,20,filepos, MYF(MY_NABP))) DBUG_RETURN(1); info->s->state.dellink = filepos; @@ -566,12 +566,12 @@ int _mi_write_part_record(MI_INFO *info, my_off_t filepos, /* points at empty block */ ulong length, /* length of block */ my_off_t next_filepos,/* Next empty block */ - byte **record, /* pointer to record ptr */ + uchar **record, /* pointer to record ptr */ ulong *reclength, /* length of *record */ int *flag) /* *flag == 0 if header */ { ulong head_length,res_length,extra_length,long_block,del_length; - byte *pos,*record_end; + uchar *pos,*record_end; my_off_t next_delete_block; uchar temp[MI_SPLIT_LENGTH+MI_DYN_DELETE_BLOCK_HEADER]; DBUG_ENTER("_mi_write_part_record"); @@ -615,7 +615,7 @@ int _mi_write_part_record(MI_INFO *info, temp[0]=13; mi_int4store(temp+1,*reclength); mi_int3store(temp+5,length-head_length); - mi_sizestore((byte*) temp+8,next_filepos); + mi_sizestore((uchar*) temp+8,next_filepos); } else { @@ -625,13 +625,13 @@ int _mi_write_part_record(MI_INFO *info, { mi_int3store(temp+1,*reclength); mi_int3store(temp+4,length-head_length); - mi_sizestore((byte*) temp+7,next_filepos); + mi_sizestore((uchar*) temp+7,next_filepos); } else { mi_int2store(temp+1,*reclength); mi_int2store(temp+3,length-head_length); - mi_sizestore((byte*) temp+5,next_filepos); + mi_sizestore((uchar*) temp+5,next_filepos); } } } @@ -642,12 +642,12 @@ int _mi_write_part_record(MI_INFO *info, if (long_block) { mi_int3store(temp+1,length-head_length); - mi_sizestore((byte*) temp+4,next_filepos); + mi_sizestore((uchar*) temp+4,next_filepos); } else { mi_int2store(temp+1,length-head_length); - mi_sizestore((byte*) temp+3,next_filepos); + mi_sizestore((uchar*) temp+3,next_filepos); } } } @@ -668,14 +668,14 @@ int _mi_write_part_record(MI_INFO *info, } length= *reclength+head_length; /* Write only what is needed */ } - DBUG_DUMP("header",(byte*) temp,head_length); + DBUG_DUMP("header",(uchar*) temp,head_length); /* Make a long block for one write */ record_end= *record+length-head_length; del_length=(res_length ? MI_DYN_DELETE_BLOCK_HEADER : 0); - bmove((byte*) (*record-head_length),(byte*) temp,head_length); + bmove((uchar*) (*record-head_length),(uchar*) temp,head_length); memcpy(temp,record_end,(size_t) (extra_length+del_length)); - bzero((byte*) record_end,extra_length); + bzero((uchar*) record_end,extra_length); if (res_length) { @@ -715,18 +715,18 @@ int _mi_write_part_record(MI_INFO *info, if (info->update & HA_STATE_EXTEND_BLOCK) { info->update&= ~HA_STATE_EXTEND_BLOCK; - if (my_block_write(&info->rec_cache,(byte*) *record-head_length, + if (my_block_write(&info->rec_cache,(uchar*) *record-head_length, length+extra_length+del_length,filepos)) goto err; } - else if (my_b_write(&info->rec_cache,(byte*) *record-head_length, + else if (my_b_write(&info->rec_cache,(uchar*) *record-head_length, length+extra_length+del_length)) goto err; } else { info->rec_cache.seek_not_done=1; - if (info->s->file_write(info,(byte*) *record-head_length,length+extra_length+ + if (info->s->file_write(info,(uchar*) *record-head_length,length+extra_length+ del_length,filepos,info->s->write_flag)) goto err; } @@ -752,7 +752,7 @@ err: /* update record from datafile */ -static int update_dynamic_record(MI_INFO *info, my_off_t filepos, byte *record, +static int update_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *record, ulong reclength) { int flag; @@ -836,7 +836,7 @@ static int update_dynamic_record(MI_INFO *info, my_off_t filepos, byte *record, mi_int3store(del_block.header+1, rest_length); mi_sizestore(del_block.header+4,info->s->state.dellink); bfill(del_block.header+12,8,255); - if (info->s->file_write(info,(byte*) del_block.header,20, next_pos, + if (info->s->file_write(info,(uchar*) del_block.header,20, next_pos, MYF(MY_NABP))) DBUG_RETURN(1); info->s->state.dellink= next_pos; @@ -875,10 +875,11 @@ err: /* Pack a record. Return new reclength */ -uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from) +uint _mi_rec_pack(MI_INFO *info, register uchar *to, + register const uchar *from) { uint length,new_length,flag,bit,i; - char *pos,*end,*startpos,*packpos; + uchar *pos,*end,*startpos,*packpos; enum en_fieldtype type; reg3 MI_COLUMNDEF *rec; MI_BLOB *blob; @@ -901,7 +902,7 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from) { char *temp_pos; size_t tmp_length=length-mi_portable_sizeof_char_ptr; - memcpy((byte*) to,from,tmp_length); + memcpy((uchar*) to,from,tmp_length); memcpy_fixed(&temp_pos,from+tmp_length,sizeof(char*)); memcpy(to+tmp_length,temp_pos,(size_t) blob->length); to+=tmp_length+blob->length; @@ -910,17 +911,17 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from) } else if (type == FIELD_SKIP_ZERO) { - if (memcmp((byte*) from,zero_string,length) == 0) + if (memcmp((uchar*) from,zero_string,length) == 0) flag|=bit; else { - memcpy((byte*) to,from,(size_t) length); to+=length; + memcpy((uchar*) to,from,(size_t) length); to+=length; } } else if (type == FIELD_SKIP_ENDSPACE || type == FIELD_SKIP_PRESPACE) { - pos= (byte*) from; end= (byte*) from + length; + pos= (uchar*) from; end= (uchar*) from + length; if (type == FIELD_SKIP_ENDSPACE) { /* Pack trailing spaces */ while (end > from && *(end-1) == ' ') @@ -943,7 +944,7 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from) } else *to++= (char) new_length; - memcpy((byte*) to,pos,(size_t) new_length); to+=new_length; + memcpy((uchar*) to,pos,(size_t) new_length); to+=new_length; flag|=bit; } else @@ -1000,11 +1001,11 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from) Returns 0 if record is ok. */ -my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff, +my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *rec_buff, ulong packed_length, my_bool with_checksum) { uint length,new_length,flag,bit,i; - char *pos,*end,*packpos,*to; + uchar *pos,*end,*packpos,*to; enum en_fieldtype type; reg3 MI_COLUMNDEF *rec; DBUG_ENTER("_mi_rec_check"); @@ -1029,7 +1030,7 @@ my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff, } else if (type == FIELD_SKIP_ZERO) { - if (memcmp((byte*) record,zero_string,length) == 0) + if (memcmp((uchar*) record,zero_string,length) == 0) { if (!(flag & bit)) goto err; @@ -1040,7 +1041,7 @@ my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff, else if (type == FIELD_SKIP_ENDSPACE || type == FIELD_SKIP_PRESPACE) { - pos= (byte*) record; end= (byte*) record + length; + pos= (uchar*) record; end= (uchar*) record + length; if (type == FIELD_SKIP_ENDSPACE) { /* Pack trailing spaces */ while (end > record && *(end-1) == ' ') @@ -1122,12 +1123,12 @@ err: /* Returns -1 and my_errno =HA_ERR_RECORD_DELETED if reclength isn't */ /* right. Returns reclength (>0) if ok */ -ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from, +ulong _mi_rec_unpack(register MI_INFO *info, register uchar *to, uchar *from, ulong found_length) { uint flag,bit,length,rec_length,min_pack_length; enum en_fieldtype type; - byte *from_end,*to_end,*packpos; + uchar *from_end,*to_end,*packpos; reg3 MI_COLUMNDEF *rec,*end_field; DBUG_ENTER("_mi_rec_unpack"); @@ -1173,7 +1174,7 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from, if (flag & bit) { if (type == FIELD_BLOB || type == FIELD_SKIP_ZERO) - bzero((byte*) to,rec_length); + bzero((uchar*) to,rec_length); else if (type == FIELD_SKIP_ENDSPACE || type == FIELD_SKIP_PRESPACE) { @@ -1195,13 +1196,13 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from, goto err; if (type == FIELD_SKIP_ENDSPACE) { - memcpy(to,(byte*) from,(size_t) length); - bfill((byte*) to+length,rec_length-length,' '); + memcpy(to,(uchar*) from,(size_t) length); + bfill((uchar*) to+length,rec_length-length,' '); } else { - bfill((byte*) to,rec_length-length,' '); - memcpy(to+rec_length-length,(byte*) from,(size_t) length); + bfill((uchar*) to,rec_length-length,' '); + memcpy(to+rec_length-length,(uchar*) from,(size_t) length); } from+=length; } @@ -1215,9 +1216,9 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from, from_left - size_length < blob_length || from_left - size_length - blob_length < min_pack_length) goto err; - memcpy((byte*) to,(byte*) from,(size_t) size_length); + memcpy((uchar*) to,(uchar*) from,(size_t) size_length); from+=size_length; - memcpy_fixed((byte*) to+size_length,(byte*) &from,sizeof(char*)); + memcpy_fixed((uchar*) to+size_length,(uchar*) &from,sizeof(char*)); from+=blob_length; } else @@ -1226,7 +1227,7 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from, min_pack_length--; if (min_pack_length + rec_length > (uint) (from_end - from)) goto err; - memcpy(to,(byte*) from,(size_t) rec_length); from+=rec_length; + memcpy(to,(uchar*) from,(size_t) rec_length); from+=rec_length; } if ((bit= bit << 1) >= 256) { @@ -1238,7 +1239,7 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from, if (min_pack_length > (uint) (from_end - from)) goto err; min_pack_length-=rec_length; - memcpy(to, (byte*) from, (size_t) rec_length); + memcpy(to, (uchar*) from, (size_t) rec_length); from+=rec_length; } } @@ -1251,14 +1252,14 @@ err: my_errno= HA_ERR_WRONG_IN_RECORD; DBUG_PRINT("error",("to_end: 0x%lx -> 0x%lx from_end: 0x%lx -> 0x%lx", (long) to, (long) to_end, (long) from, (long) from_end)); - DBUG_DUMP("from",(byte*) info->rec_buff,info->s->base.min_pack_length); + DBUG_DUMP("from",(uchar*) info->rec_buff,info->s->base.min_pack_length); DBUG_RETURN(MY_FILE_ERROR); } /* _mi_rec_unpack */ /* Calc length of blob. Update info in blobs->length */ -ulong _my_calc_total_blob_length(MI_INFO *info, const byte *record) +ulong _my_calc_total_blob_length(MI_INFO *info, const uchar *record) { ulong length; MI_BLOB *blob,*end; @@ -1274,7 +1275,7 @@ ulong _my_calc_total_blob_length(MI_INFO *info, const byte *record) } -ulong _mi_calc_blob_length(uint length, const byte *pos) +ulong _mi_calc_blob_length(uint length, const uchar *pos) { switch (length) { case 1: @@ -1292,7 +1293,7 @@ ulong _mi_calc_blob_length(uint length, const byte *pos) } -void _my_store_blob_length(byte *pos,uint pack_length,uint length) +void _my_store_blob_length(uchar *pos,uint pack_length,uint length) { switch (pack_length) { case 1: @@ -1345,11 +1346,11 @@ void _my_store_blob_length(byte *pos,uint pack_length,uint length) -1 Error */ -int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf) +int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *buf) { int block_of_record; uint b_type,left_length; - byte *to; + uchar *to; MI_BLOCK_INFO block_info; File file; DBUG_ENTER("mi_read_dynamic_record"); @@ -1405,7 +1406,7 @@ int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf) prefetch_len= block_info.data_len; if (prefetch_len) { - memcpy((byte*) to, block_info.header + offset, prefetch_len); + memcpy((uchar*) to, block_info.header + offset, prefetch_len); block_info.data_len-= prefetch_len; left_length-= prefetch_len; to+= prefetch_len; @@ -1423,7 +1424,7 @@ int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf) there is no equivalent without seeking. We are at the right position already. :( */ - if (info->s->file_read(info, (byte*) to, block_info.data_len, + if (info->s->file_read(info, (uchar*) to, block_info.data_len, filepos, MYF(MY_NABP))) goto panic; left_length-=block_info.data_len; @@ -1450,9 +1451,9 @@ err: /* compare unique constraint between stored rows */ int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def, - const byte *record, my_off_t pos) + const uchar *record, my_off_t pos) { - byte *rec_buff,*old_record; + uchar *rec_buff,*old_record; int error; DBUG_ENTER("_mi_cmp_dynamic_unique"); @@ -1478,11 +1479,11 @@ int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def, /* Compare of record one disk with packed record in memory */ -int _mi_cmp_dynamic_record(register MI_INFO *info, register const byte *record) +int _mi_cmp_dynamic_record(register MI_INFO *info, register const uchar *record) { uint flag,reclength,b_type; my_off_t filepos; - byte *buffer; + uchar *buffer; MI_BLOCK_INFO block_info; DBUG_ENTER("_mi_cmp_dynamic_record"); @@ -1504,7 +1505,7 @@ int _mi_cmp_dynamic_record(register MI_INFO *info, register const byte *record) { /* If check isn't disabled */ if (info->s->base.blobs) { - if (!(buffer=(byte*) my_alloca(info->s->base.pack_reclength+ + if (!(buffer=(uchar*) my_alloca(info->s->base.pack_reclength+ _my_calc_total_blob_length(info,record)))) DBUG_RETURN(-1); } @@ -1552,14 +1553,14 @@ int _mi_cmp_dynamic_record(register MI_INFO *info, register const byte *record) my_errno=0; err: if (buffer != info->rec_buff) - my_afree((gptr) buffer); + my_afree((uchar*) buffer); DBUG_RETURN(my_errno); } /* Compare file to buffert */ -static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos, +static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos, uint length) { uint next_length; @@ -1571,7 +1572,7 @@ static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos, while (length > IO_SIZE*2) { if (my_pread(file,temp_buff,next_length,filepos, MYF(MY_NABP)) || - memcmp((byte*) buff,temp_buff,next_length)) + memcmp((uchar*) buff,temp_buff,next_length)) goto err; filepos+=next_length; buff+=next_length; @@ -1580,7 +1581,7 @@ static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos, } if (my_pread(file,temp_buff,length,filepos,MYF(MY_NABP))) goto err; - DBUG_RETURN(memcmp((byte*) buff,temp_buff,length)); + DBUG_RETURN(memcmp((uchar*) buff,temp_buff,length)); err: DBUG_RETURN(1); } @@ -1620,13 +1621,13 @@ err: != 0 Error */ -int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf, +int _mi_read_rnd_dynamic_record(MI_INFO *info, uchar *buf, register my_off_t filepos, my_bool skip_deleted_blocks) { int block_of_record, info_read, save_errno; uint left_len,b_type; - byte *to; + uchar *to; MI_BLOCK_INFO block_info; MYISAM_SHARE *share=info->s; DBUG_ENTER("_mi_read_rnd_dynamic_record"); @@ -1672,7 +1673,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf, } if (info->opt_flag & READ_CACHE_USED) { - if (_mi_read_cache(&info->rec_cache,(byte*) block_info.header,filepos, + if (_mi_read_cache(&info->rec_cache,(uchar*) block_info.header,filepos, sizeof(block_info.header), (!block_of_record && skip_deleted_blocks ? READING_NEXT : 0) | READING_HEADER)) @@ -1735,7 +1736,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf, tmp_length= block_info.data_len; if (tmp_length) { - memcpy((byte*) to, block_info.header+offset,tmp_length); + memcpy((uchar*) to, block_info.header+offset,tmp_length); block_info.data_len-=tmp_length; left_len-=tmp_length; to+=tmp_length; @@ -1747,7 +1748,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf, { if (info->opt_flag & READ_CACHE_USED) { - if (_mi_read_cache(&info->rec_cache,(byte*) to,filepos, + if (_mi_read_cache(&info->rec_cache,(uchar*) to,filepos, block_info.data_len, (!block_of_record && skip_deleted_blocks) ? READING_NEXT : 0)) @@ -1761,7 +1762,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf, flush_io_cache(&info->rec_cache)) goto err; /* VOID(my_seek(info->dfile,filepos,MY_SEEK_SET,MYF(0))); */ - if (my_read(info->dfile,(byte*) to,block_info.data_len,MYF(MY_NABP))) + if (my_read(info->dfile,(uchar*) to,block_info.data_len,MYF(MY_NABP))) { if (my_errno == -1) my_errno= HA_ERR_WRONG_IN_RECORD; /* Unexpected end of file */ @@ -1818,7 +1819,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos) sizeof(info->header)) goto err; } - DBUG_DUMP("header",(byte*) header,MI_BLOCK_INFO_HEADER_LENGTH); + DBUG_DUMP("header",(uchar*) header,MI_BLOCK_INFO_HEADER_LENGTH); if (info->second_read) { if (info->header[0] <= 6 || info->header[0] == 13) diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c index 729174b6f88..72c40741a22 100644 --- a/storage/myisam/mi_extra.c +++ b/storage/myisam/mi_extra.c @@ -180,8 +180,8 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) case HA_EXTRA_KEYREAD: /* Read only keys to record */ case HA_EXTRA_REMEMBER_POS: info->opt_flag |= REMEMBER_OLD_POS; - bmove((byte*) info->lastkey+share->base.max_key_length*2, - (byte*) info->lastkey,info->lastkey_length); + bmove((uchar*) info->lastkey+share->base.max_key_length*2, + (uchar*) info->lastkey,info->lastkey_length); info->save_update= info->update; info->save_lastinx= info->lastinx; info->save_lastpos= info->lastpos; @@ -197,8 +197,8 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) case HA_EXTRA_RESTORE_POS: if (info->opt_flag & REMEMBER_OLD_POS) { - bmove((byte*) info->lastkey, - (byte*) info->lastkey+share->base.max_key_length*2, + bmove((uchar*) info->lastkey, + (uchar*) info->lastkey+share->base.max_key_length*2, info->save_lastkey_length); info->update= info->save_update | HA_STATE_WRITTEN; info->lastinx= info->save_lastinx; @@ -385,7 +385,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) { char tmp[1]; tmp[0]=function; - myisam_log_command(MI_LOG_EXTRA,info,(byte*) tmp,1,error); + myisam_log_command(MI_LOG_EXTRA,info,(uchar*) tmp,1,error); } DBUG_RETURN(error); } /* mi_extra */ diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c index 2f4915dec39..230ebac3bb0 100644 --- a/storage/myisam/mi_key.c +++ b/storage/myisam/mi_key.c @@ -31,7 +31,7 @@ set_if_smaller(char_length,length); \ } while(0) -static int _mi_put_key_in_record(MI_INFO *info,uint keynr,byte *record); +static int _mi_put_key_in_record(MI_INFO *info,uint keynr,uchar *record); /* Make a intern key from a record @@ -49,9 +49,9 @@ static int _mi_put_key_in_record(MI_INFO *info,uint keynr,byte *record); */ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, - const byte *record, my_off_t filepos) + const uchar *record, my_off_t filepos) { - byte *pos; + uchar *pos; uchar *start; reg1 HA_KEYSEG *keyseg; my_bool is_ft= info->s->keyinfo[keynr].flag & HA_FULLTEXT; @@ -90,7 +90,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, char_length= ((!is_ft && cs && cs->mbmaxlen > 1) ? length/cs->mbmaxlen : length); - pos= (byte*) record+keyseg->start; + pos= (uchar*) record+keyseg->start; if (type == HA_KEYTYPE_BIT) { if (keyseg->bit_length) @@ -100,7 +100,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, *key++= bits; length--; } - memcpy((byte*) key, pos, length); + memcpy((uchar*) key, pos, length); key+= length; continue; } @@ -112,14 +112,14 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, } else { - byte *end= pos + length; + uchar *end= pos + length; while (pos < end && pos[0] == ' ') pos++; length=(uint) (end-pos); } FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); - memcpy((byte*) key,(byte*) pos,(size_t) char_length); + memcpy((uchar*) key,(uchar*) pos,(size_t) char_length); key+=char_length; continue; } @@ -132,18 +132,18 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, set_if_smaller(length,tmp_length); FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); - memcpy((byte*) key,(byte*) pos,(size_t) char_length); + memcpy((uchar*) key,(uchar*) pos,(size_t) char_length); key+= char_length; continue; } else if (keyseg->flag & HA_BLOB_PART) { uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos); - memcpy_fixed((byte*) &pos,pos+keyseg->bit_start,sizeof(char*)); + memcpy_fixed((uchar*) &pos,pos+keyseg->bit_start,sizeof(char*)); set_if_smaller(length,tmp_length); FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); - memcpy((byte*) key,(byte*) pos,(size_t) char_length); + memcpy((uchar*) key,(uchar*) pos,(size_t) char_length); key+= char_length; continue; } @@ -182,14 +182,14 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, continue; } FIX_LENGTH(cs, pos, length, char_length); - memcpy((byte*) key, pos, char_length); + memcpy((uchar*) key, pos, char_length); if (length > char_length) cs->cset->fill(cs, (char*) key+char_length, length-char_length, ' '); key+= length; } _mi_dpointer(info,key,filepos); DBUG_PRINT("exit",("keynr: %d",keynr)); - DBUG_DUMP("key",(byte*) start,(uint) (key-start)+keyseg->length); + DBUG_DUMP("key",(uchar*) start,(uint) (key-start)+keyseg->length); DBUG_EXECUTE("key", _mi_print_key(DBUG_FILE,info->s->keyinfo[keynr].seg,start, (uint) (key-start));); @@ -267,7 +267,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, length=(uint) (end-pos); FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); - memcpy((byte*) key,pos,(size_t) char_length); + memcpy((uchar*) key,pos,(size_t) char_length); key+= char_length; continue; } @@ -280,7 +280,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); old+=2; /* Skip length */ - memcpy((byte*) key, pos,(size_t) char_length); + memcpy((uchar*) key, pos,(size_t) char_length); key+= char_length; continue; } @@ -292,7 +292,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, continue; } FIX_LENGTH(cs, pos, length, char_length); - memcpy((byte*) key, pos, char_length); + memcpy((uchar*) key, pos, char_length); if (length > char_length) cs->cset->fill(cs, (char*) key+char_length, length-char_length, ' '); key+= length; @@ -325,16 +325,16 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, */ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, - byte *record) + uchar *record) { - reg2 byte *key; - byte *pos,*key_end; + reg2 uchar *key; + uchar *pos,*key_end; reg1 HA_KEYSEG *keyseg; - byte *blob_ptr; + uchar *blob_ptr; DBUG_ENTER("_mi_put_key_in_record"); - blob_ptr= (byte*) info->lastkey2; /* Place to put blob parts */ - key=(byte*) info->lastkey; /* KEy that was read */ + blob_ptr= (uchar*) info->lastkey2; /* Place to put blob parts */ + key=(uchar*) info->lastkey; /* KEy that was read */ key_end=key+info->lastkey_length; for (keyseg=info->s->keyinfo[keynr].seg ; keyseg->type ;keyseg++) { @@ -363,7 +363,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, clr_rec_bits(record + keyseg->bit_pos, keyseg->bit_start, keyseg->bit_length); } - memcpy(record + keyseg->start, (byte*) key, length); + memcpy(record + keyseg->start, (uchar*) key, length); key+= length; continue; } @@ -406,7 +406,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, else int2store(record+keyseg->start, length); /* And key data */ - memcpy(record+keyseg->start + keyseg->bit_start, (byte*) key, length); + memcpy(record+keyseg->start + keyseg->bit_start, (uchar*) key, length); key+= length; } else if (keyseg->flag & HA_BLOB_PART) @@ -431,8 +431,8 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, } else if (keyseg->flag & HA_SWAP_KEY) { - byte *to= record+keyseg->start+keyseg->length; - byte *end= key+keyseg->length; + uchar *to= record+keyseg->start+keyseg->length; + uchar *end= key+keyseg->length; #ifdef CHECK_KEYS if (end > key_end) goto err; @@ -449,7 +449,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, if (key+keyseg->length > key_end) goto err; #endif - memcpy(record+keyseg->start,(byte*) key, + memcpy(record+keyseg->start,(uchar*) key, (size_t) keyseg->length); key+= keyseg->length; } @@ -463,7 +463,7 @@ err: /* Here when key reads are used */ -int _mi_read_key_record(MI_INFO *info, my_off_t filepos, byte *buf) +int _mi_read_key_record(MI_INFO *info, my_off_t filepos, uchar *buf) { fast_mi_writeinfo(info); if (filepos != HA_OFFSET_ERROR) @@ -498,7 +498,7 @@ int _mi_read_key_record(MI_INFO *info, my_off_t filepos, byte *buf) less than zero. */ -ulonglong retrieve_auto_increment(MI_INFO *info,const byte *record) +ulonglong retrieve_auto_increment(MI_INFO *info,const uchar *record) { ulonglong value= 0; /* Store unsigned values here */ longlong s_value= 0; /* Store signed values here */ diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c index e822ea9e6da..6aa62b70ae3 100644 --- a/storage/myisam/mi_locking.c +++ b/storage/myisam/mi_locking.c @@ -254,7 +254,7 @@ int mi_lock_database(MI_INFO *info, int lock_type) pthread_mutex_unlock(&share->intern_lock); #if defined(FULL_LOG) || defined(_lint) lock_type|=(int) (flag << 8); /* Set bit to set if real lock */ - myisam_log_command(MI_LOG_LOCK,info,(byte*) &lock_type,sizeof(lock_type), + myisam_log_command(MI_LOG_LOCK,info,(uchar*) &lock_type,sizeof(lock_type), error); #endif DBUG_RETURN(error); diff --git a/storage/myisam/mi_log.c b/storage/myisam/mi_log.c index f720f752a06..91d3bb6f702 100644 --- a/storage/myisam/mi_log.c +++ b/storage/myisam/mi_log.c @@ -74,7 +74,7 @@ int mi_log(int activate_log) /* All logs starts with command(1) dfile(2) process(4) result(2) */ void _myisam_log(enum myisam_log_commands command, MI_INFO *info, - const byte *buffert, uint length) + const uchar *buffert, uint length) { char buff[11]; int error,old_errno; @@ -98,7 +98,7 @@ void _myisam_log(enum myisam_log_commands command, MI_INFO *info, void _myisam_log_command(enum myisam_log_commands command, MI_INFO *info, - const byte *buffert, uint length, int result) + const uchar *buffert, uint length, int result) { char buff[9]; int error,old_errno; @@ -122,7 +122,7 @@ void _myisam_log_command(enum myisam_log_commands command, MI_INFO *info, void _myisam_log_record(enum myisam_log_commands command, MI_INFO *info, - const byte *record, my_off_t filepos, int result) + const uchar *record, my_off_t filepos, int result) { char buff[21],*pos; int error,old_errno; @@ -143,7 +143,7 @@ void _myisam_log_record(enum myisam_log_commands command, MI_INFO *info, pthread_mutex_lock(&THR_LOCK_myisam); error=my_lock(myisam_log_file,F_WRLCK,0L,F_TO_EOF,MYF(MY_SEEK_NOT_DONE)); VOID(my_write(myisam_log_file,buff,sizeof(buff),MYF(0))); - VOID(my_write(myisam_log_file,(byte*) record,info->s->base.reclength,MYF(0))); + VOID(my_write(myisam_log_file,(uchar*) record,info->s->base.reclength,MYF(0))); if (info->s->base.blobs) { MI_BLOB *blob,*end; diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index f4e089b6313..9ff8ecdb14d 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -92,7 +92,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) lock_error=1; errpos=0; head_length=sizeof(share_buff.state.header); - bzero((byte*) &info,sizeof(info)); + bzero((uchar*) &info,sizeof(info)); my_realpath(name_buff, fn_format(org_name,name,"",MI_NAME_IEXT, MY_UNPACK_FILENAME),MYF(0)); @@ -100,7 +100,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) if (!(old_info=test_if_reopen(name_buff))) { share= &share_buff; - bzero((gptr) &share_buff,sizeof(share_buff)); + bzero((uchar*) &share_buff,sizeof(share_buff)); share_buff.state.rec_per_key_part=rec_per_key_part; share_buff.state.key_root=key_root; share_buff.state.key_del=key_del; @@ -127,8 +127,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) my_errno= HA_ERR_NOT_A_TABLE; goto err; } - if (memcmp((byte*) share->state.header.file_version, - (byte*) myisam_file_magic, 4)) + if (memcmp((uchar*) share->state.header.file_version, + (uchar*) myisam_file_magic, 4)) { DBUG_PRINT("error",("Wrong header in %s",name_buff)); DBUG_DUMP("error_dump",(char*) share->state.header.file_version, @@ -504,7 +504,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) } else if (share->options & HA_OPTION_PACK_RECORD) share->data_file_type = DYNAMIC_RECORD; - my_afree((gptr) disk_cache); + my_afree((uchar*) disk_cache); mi_setup_functions(share); share->is_log_table= FALSE; #ifdef THREAD @@ -642,7 +642,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) if (myisam_log_file >= 0) { intern_filename(name_buff,share->index_file_name); - _myisam_log(MI_LOG_OPEN,m_info,name_buff,(uint) strlen(name_buff)); + _myisam_log(MI_LOG_OPEN, m_info,name_buff, strlen(name_buff)); } DBUG_RETURN(m_info); @@ -654,7 +654,7 @@ err: mi_report_error(save_errno, name); switch (errpos) { case 6: - my_free((gptr) m_info,MYF(0)); + my_free((uchar*) m_info,MYF(0)); /* fall through */ case 5: VOID(my_close(info.dfile,MYF(0))); @@ -662,14 +662,14 @@ err: break; /* Don't remove open table */ /* fall through */ case 4: - my_free((gptr) share,MYF(0)); + my_free((uchar*) share,MYF(0)); /* fall through */ case 3: if (! lock_error) VOID(my_lock(kfile, F_UNLCK, 0L, F_TO_EOF, MYF(MY_SEEK_NOT_DONE))); /* fall through */ case 2: - my_afree((gptr) disk_cache); + my_afree((uchar*) disk_cache); /* fall through */ case 1: VOID(my_close(kfile,MYF(0))); @@ -684,7 +684,7 @@ err: } /* mi_open */ -byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf) +uchar *mi_alloc_rec_buff(MI_INFO *info, ulong length, uchar **buf) { uint extra; uint32 old_length; @@ -692,7 +692,7 @@ byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf) if (! *buf || length > (old_length=mi_get_rec_buff_len(info, *buf))) { - byte *newptr = *buf; + uchar *newptr = *buf; /* to simplify initial init of info->rec_buf in mi_open and mi_extra */ if (length == (ulong) -1) @@ -709,7 +709,7 @@ byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf) MI_REC_BUFF_OFFSET : 0); if (extra && newptr) newptr-= MI_REC_BUFF_OFFSET; - if (!(newptr=(byte*) my_realloc((gptr)newptr, length+extra+8, + if (!(newptr=(uchar*) my_realloc((uchar*)newptr, length+extra+8, MYF(MY_ALLOW_ZERO_PTR)))) return newptr; *((uint32 *) newptr)= (uint32) length; @@ -899,10 +899,10 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite) } if (pWrite & 1) - DBUG_RETURN(my_pwrite(file,(char*) buff, (uint) (ptr-buff), 0L, - MYF(MY_NABP | MY_THREADSAFE))); - DBUG_RETURN(my_write(file, (char*) buff, (uint) (ptr-buff), - MYF(MY_NABP))); + DBUG_RETURN(my_pwrite(file, buff, (size_t) (ptr-buff), 0L, + MYF(MY_NABP | MY_THREADSAFE)) != 0); + DBUG_RETURN(my_write(file, buff, (size_t) (ptr-buff), + MYF(MY_NABP)) != 0); } @@ -968,10 +968,10 @@ uint mi_state_info_read_dsk(File file, MI_STATE_INFO *state, my_bool pRead) if (pRead) { if (my_pread(file, buff, state->state_length,0L, MYF(MY_NABP))) - return (MY_FILE_ERROR); + return 1; } else if (my_read(file, buff, state->state_length,MYF(MY_NABP))) - return (MY_FILE_ERROR); + return 1; mi_state_info_read((uchar*) buff, state); } return 0; @@ -1013,7 +1013,7 @@ uint mi_base_info_write(File file, MI_BASE_INFO *base) mi_int2store(ptr,base->raid_chunks); ptr +=2; mi_int4store(ptr,base->raid_chunksize); ptr +=4; bzero(ptr,6); ptr +=6; /* extra */ - return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP)); + return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; } @@ -1073,7 +1073,7 @@ uint mi_keydef_write(File file, MI_KEYDEF *keydef) mi_int2store(ptr,keydef->keylength); ptr +=2; mi_int2store(ptr,keydef->minlength); ptr +=2; mi_int2store(ptr,keydef->maxlength); ptr +=2; - return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP)); + return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; } char *mi_keydef_read(char *ptr, MI_KEYDEF *keydef) @@ -1117,7 +1117,7 @@ int mi_keyseg_write(File file, const HA_KEYSEG *keyseg) mi_int4store(ptr, pos); ptr+=4; - return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP)); + return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; } @@ -1157,7 +1157,7 @@ uint mi_uniquedef_write(File file, MI_UNIQUEDEF *def) *ptr++= (uchar) def->key; *ptr++ = (uchar) def->null_are_equal; - return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP)); + return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; } char *mi_uniquedef_read(char *ptr, MI_UNIQUEDEF *def) @@ -1181,7 +1181,7 @@ uint mi_recinfo_write(File file, MI_COLUMNDEF *recinfo) mi_int2store(ptr,recinfo->length); ptr +=2; *ptr++ = recinfo->null_bit; mi_int2store(ptr,recinfo->null_pos); ptr+= 2; - return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP)); + return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; } char *mi_recinfo_read(char *ptr, MI_COLUMNDEF *recinfo) @@ -1202,7 +1202,8 @@ The argument file_to_dup is here for the future if there would on some OS exist a dup()-like call that would give us two different file descriptors. *************************************************************************/ -int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup __attribute__((unused))) +int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, + File file_to_dup __attribute__((unused))) { #ifdef USE_RAID if (share->base.raid_type) diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c index a5a9aaededd..1231ef026f7 100644 --- a/storage/myisam/mi_packrec.c +++ b/storage/myisam/mi_packrec.c @@ -48,7 +48,7 @@ #define OFFSET_TABLE_SIZE 512 static uint read_huff_table(MI_BIT_BUFF *bit_buff,MI_DECODE_TREE *decode_tree, - uint16 **decode_table,byte **intervall_buff, + uint16 **decode_table,uchar **intervall_buff, uint16 *tmp_buff); static void make_quick_table(uint16 *to_table,uint16 *decode_table, uint *next_free,uint value,uint bits, @@ -107,7 +107,7 @@ static void fill_buffer(MI_BIT_BUFF *bit_buff); static uint max_bit(uint value); #ifdef HAVE_MMAP static uchar *_mi_mempack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, - MI_BLOCK_INFO *info, byte **rec_buff_p, + MI_BLOCK_INFO *info, uchar **rec_buff_p, uchar *header); #endif @@ -136,7 +136,8 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) uint i,trees,huff_tree_bits,rec_reflength,length; uint16 *decode_table,*tmp_buff; ulong elements,intervall_length; - char *disk_cache,*intervall_buff; + char *disk_cache; + uchar *intervall_buff; uchar header[HEAD_LENGTH]; MYISAM_SHARE *share=info->s; MI_BIT_BUFF bit_buff; @@ -149,14 +150,14 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) file=info->dfile; my_errno=0; - if (my_read(file,(byte*) header,sizeof(header),MYF(MY_NABP))) + if (my_read(file,(uchar*) header,sizeof(header),MYF(MY_NABP))) { if (!my_errno) my_errno=HA_ERR_END_OF_FILE; goto err0; } /* Only the first three bytes of magic number are independent of version. */ - if (memcmp((byte*) header, (byte*) myisam_pack_file_magic, 3)) + if (memcmp((uchar*) header, (uchar*) myisam_pack_file_magic, 3)) { my_errno=HA_ERR_WRONG_IN_RECORD; goto err0; @@ -195,10 +196,10 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) */ if (!(share->decode_trees=(MI_DECODE_TREE*) my_malloc((uint) (trees*sizeof(MI_DECODE_TREE)+ - intervall_length*sizeof(byte)), + intervall_length*sizeof(uchar)), MYF(MY_WME)))) goto err0; - intervall_buff=(byte*) (share->decode_trees+trees); + intervall_buff=(uchar*) (share->decode_trees+trees); /* Memory segment #2: @@ -215,7 +216,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) MYF(MY_WME | MY_ZEROFILL)))) goto err1; tmp_buff=share->decode_tables+length; - disk_cache=(byte*) (tmp_buff+OFFSET_TABLE_SIZE); + disk_cache=(uchar*) (tmp_buff+OFFSET_TABLE_SIZE); if (my_read(file,disk_cache, (uint) (share->pack.header_length-sizeof(header)), @@ -250,8 +251,8 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) goto err3; /* Reallocate the decoding tables to the used size. */ decode_table=(uint16*) - my_realloc((gptr) share->decode_tables, - (uint) ((byte*) decode_table - (byte*) share->decode_tables), + my_realloc((uchar*) share->decode_tables, + (uint) ((uchar*) decode_table - (uchar*) share->decode_tables), MYF(MY_HOLD_ON_ERROR)); /* Fix the table addresses in the tree heads. */ { @@ -291,9 +292,9 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) err3: my_errno=HA_ERR_WRONG_IN_RECORD; err2: - my_free((gptr) share->decode_tables,MYF(0)); + my_free((uchar*) share->decode_tables,MYF(0)); err1: - my_free((gptr) share->decode_trees,MYF(0)); + my_free((uchar*) share->decode_trees,MYF(0)); err0: DBUG_RETURN(1); } @@ -318,7 +319,7 @@ err0: */ static uint read_huff_table(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree, - uint16 **decode_table, byte **intervall_buff, + uint16 **decode_table, uchar **intervall_buff, uint16 *tmp_buff) { uint min_chr,elements,char_bits,offset_bits,size,intervall_length,table_bits, @@ -697,7 +698,7 @@ static uint find_longest_bitstream(uint16 *table, uint16 *end) HA_ERR_WRONG_IN_RECORD or -1 on error */ -int _mi_read_pack_record(MI_INFO *info, my_off_t filepos, byte *buf) +int _mi_read_pack_record(MI_INFO *info, my_off_t filepos, uchar *buf) { MI_BLOCK_INFO block_info; File file; @@ -710,7 +711,7 @@ int _mi_read_pack_record(MI_INFO *info, my_off_t filepos, byte *buf) if (_mi_pack_get_block_info(info, &info->bit_buff, &block_info, &info->rec_buff, file, filepos)) goto err; - if (my_read(file,(byte*) info->rec_buff + block_info.offset , + if (my_read(file,(uchar*) info->rec_buff + block_info.offset , block_info.rec_len - block_info.offset, MYF(MY_NABP))) goto panic; info->update|= HA_STATE_AKTIV; @@ -725,9 +726,9 @@ err: int _mi_pack_rec_unpack(register MI_INFO *info, MI_BIT_BUFF *bit_buff, - register byte *to, byte *from, ulong reclength) + register uchar *to, uchar *from, ulong reclength) { - byte *end_field; + uchar *end_field; reg3 MI_COLUMNDEF *end; MI_COLUMNDEF *current_field; MYISAM_SHARE *share=info->s; @@ -834,7 +835,7 @@ static void uf_space_normal(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end) { if (get_bit(bit_buff)) - bfill((byte*) to,(end-to),' '); + bfill((uchar*) to,(end-to),' '); else decode_bytes(rec,bit_buff,to,end); } @@ -844,7 +845,7 @@ static void uf_space_endspace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, { uint spaces; if (get_bit(bit_buff)) - bfill((byte*) to,(end-to),' '); + bfill((uchar*) to,(end-to),' '); else { if (get_bit(bit_buff)) @@ -856,7 +857,7 @@ static void uf_space_endspace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, } if (to+spaces != end) decode_bytes(rec,bit_buff,to,end-spaces); - bfill((byte*) end-spaces,spaces,' '); + bfill((uchar*) end-spaces,spaces,' '); } else decode_bytes(rec,bit_buff,to,end); @@ -876,7 +877,7 @@ static void uf_endspace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, } if (to+spaces != end) decode_bytes(rec,bit_buff,to,end-spaces); - bfill((byte*) end-spaces,spaces,' '); + bfill((uchar*) end-spaces,spaces,' '); } else decode_bytes(rec,bit_buff,to,end); @@ -887,7 +888,7 @@ static void uf_space_endspace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t { uint spaces; if (get_bit(bit_buff)) - bfill((byte*) to,(end-to),' '); + bfill((uchar*) to,(end-to),' '); else { if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end) @@ -897,7 +898,7 @@ static void uf_space_endspace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t } if (to+spaces != end) decode_bytes(rec,bit_buff,to,end-spaces); - bfill((byte*) end-spaces,spaces,' '); + bfill((uchar*) end-spaces,spaces,' '); } } @@ -912,7 +913,7 @@ static void uf_endspace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, } if (to+spaces != end) decode_bytes(rec,bit_buff,to,end-spaces); - bfill((byte*) end-spaces,spaces,' '); + bfill((uchar*) end-spaces,spaces,' '); } static void uf_space_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, @@ -920,7 +921,7 @@ static void uf_space_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, { uint spaces; if (get_bit(bit_buff)) - bfill((byte*) to,(end-to),' '); + bfill((uchar*) to,(end-to),' '); else { if (get_bit(bit_buff)) @@ -930,7 +931,7 @@ static void uf_space_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, bit_buff->error=1; return; } - bfill((byte*) to,spaces,' '); + bfill((uchar*) to,spaces,' '); if (to+spaces != end) decode_bytes(rec,bit_buff,to+spaces,end); } @@ -951,7 +952,7 @@ static void uf_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, bit_buff->error=1; return; } - bfill((byte*) to,spaces,' '); + bfill((uchar*) to,spaces,' '); if (to+spaces != end) decode_bytes(rec,bit_buff,to+spaces,end); } @@ -965,7 +966,7 @@ static void uf_space_prespace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t { uint spaces; if (get_bit(bit_buff)) - bfill((byte*) to,(end-to),' '); + bfill((uchar*) to,(end-to),' '); else { if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end) @@ -973,7 +974,7 @@ static void uf_space_prespace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t bit_buff->error=1; return; } - bfill((byte*) to,spaces,' '); + bfill((uchar*) to,spaces,' '); if (to+spaces != end) decode_bytes(rec,bit_buff,to+spaces,end); } @@ -988,7 +989,7 @@ static void uf_prespace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, bit_buff->error=1; return; } - bfill((byte*) to,spaces,' '); + bfill((uchar*) to,spaces,' '); if (to+spaces != end) decode_bytes(rec,bit_buff,to+spaces,end); } @@ -1031,7 +1032,7 @@ static void uf_blob(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end) { if (get_bit(bit_buff)) - bzero((byte*) to,(end-to)); + bzero((uchar*) to,(end-to)); else { ulong length=get_bits(bit_buff,rec->space_length_bits); @@ -1039,11 +1040,11 @@ static void uf_blob(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, if (bit_buff->blob_pos+length > bit_buff->blob_end) { bit_buff->error=1; - bzero((byte*) to,(end-to)); + bzero((uchar*) to,(end-to)); return; } decode_bytes(rec,bit_buff,bit_buff->blob_pos,bit_buff->blob_pos+length); - _my_store_blob_length((byte*) to,pack_length,length); + _my_store_blob_length((uchar*) to,pack_length,length); memcpy_fixed((char*) to+pack_length,(char*) &bit_buff->blob_pos, sizeof(char*)); bit_buff->blob_pos+=length; @@ -1286,7 +1287,7 @@ static uint decode_pos(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree) } -int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf, +int _mi_read_rnd_pack_record(MI_INFO *info, uchar *buf, register my_off_t filepos, my_bool skip_deleted_blocks) { @@ -1303,7 +1304,7 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf, if (info->opt_flag & READ_CACHE_USED) { - if (_mi_read_cache(&info->rec_cache, (byte*) block_info.header, + if (_mi_read_cache(&info->rec_cache, (uchar*) block_info.header, filepos, share->pack.ref_length, skip_deleted_blocks ? READING_NEXT : 0)) goto err; @@ -1325,14 +1326,14 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf, if (info->opt_flag & READ_CACHE_USED) { - if (_mi_read_cache(&info->rec_cache, (byte*) info->rec_buff, + if (_mi_read_cache(&info->rec_cache, (uchar*) info->rec_buff, block_info.filepos, block_info.rec_len, skip_deleted_blocks ? READING_NEXT : 0)) goto err; } else { - if (my_read(info->dfile,(byte*) info->rec_buff + block_info.offset, + if (my_read(info->dfile,(uchar*) info->rec_buff + block_info.offset, block_info.rec_len-block_info.offset, MYF(MY_NABP))) goto err; @@ -1352,7 +1353,7 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf, /* Read and process header from a huff-record-file */ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, - MI_BLOCK_INFO *info, byte **rec_buff_p, + MI_BLOCK_INFO *info, uchar **rec_buff_p, File file, my_off_t filepos) { uchar *header=info->header; @@ -1369,7 +1370,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0))); if (my_read(file,(char*) header,ref_length,MYF(MY_NABP))) return BLOCK_FATAL_ERROR; - DBUG_DUMP("header",(byte*) header,ref_length); + DBUG_DUMP("header",(uchar*) header,ref_length); } head_length= read_pack_length((uint) myisam->s->pack.version, header, &info->rec_len); @@ -1478,8 +1479,8 @@ static uint max_bit(register uint value) #ifdef HAVE_MMAP -static int _mi_read_mempack_record(MI_INFO *info,my_off_t filepos,byte *buf); -static int _mi_read_rnd_mempack_record(MI_INFO*, byte *,my_off_t, my_bool); +static int _mi_read_mempack_record(MI_INFO *info,my_off_t filepos,uchar *buf); +static int _mi_read_rnd_mempack_record(MI_INFO*, uchar *,my_off_t, my_bool); my_bool _mi_memmap_file(MI_INFO *info) { @@ -1512,7 +1513,7 @@ void _mi_unmap_file(MI_INFO *info) static uchar *_mi_mempack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, - MI_BLOCK_INFO *info, byte **rec_buff_p, + MI_BLOCK_INFO *info, uchar **rec_buff_p, uchar *header) { header+= read_pack_length((uint) myisam->s->pack.version, header, @@ -1532,17 +1533,17 @@ static uchar *_mi_mempack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, } -static int _mi_read_mempack_record(MI_INFO *info, my_off_t filepos, byte *buf) +static int _mi_read_mempack_record(MI_INFO *info, my_off_t filepos, uchar *buf) { MI_BLOCK_INFO block_info; MYISAM_SHARE *share=info->s; - byte *pos; + uchar *pos; DBUG_ENTER("mi_read_mempack_record"); if (filepos == HA_OFFSET_ERROR) DBUG_RETURN(-1); /* _search() didn't find record */ - if (!(pos= (byte*) _mi_mempack_get_block_info(info, &info->bit_buff, + if (!(pos= (uchar*) _mi_mempack_get_block_info(info, &info->bit_buff, &block_info, &info->rec_buff, (uchar*) share->file_map+ filepos))) @@ -1553,14 +1554,14 @@ static int _mi_read_mempack_record(MI_INFO *info, my_off_t filepos, byte *buf) /*ARGSUSED*/ -static int _mi_read_rnd_mempack_record(MI_INFO *info, byte *buf, +static int _mi_read_rnd_mempack_record(MI_INFO *info, uchar *buf, register my_off_t filepos, my_bool skip_deleted_blocks __attribute__((unused))) { MI_BLOCK_INFO block_info; MYISAM_SHARE *share=info->s; - byte *pos,*start; + uchar *pos,*start; DBUG_ENTER("_mi_read_rnd_mempack_record"); if (filepos >= share->state.state.data_file_length) @@ -1568,7 +1569,7 @@ static int _mi_read_rnd_mempack_record(MI_INFO *info, byte *buf, my_errno=HA_ERR_END_OF_FILE; goto err; } - if (!(pos= (byte*) _mi_mempack_get_block_info(info, &info->bit_buff, + if (!(pos= (uchar*) _mi_mempack_get_block_info(info, &info->bit_buff, &block_info, &info->rec_buff, (uchar*) (start=share->file_map+ @@ -1596,7 +1597,7 @@ static int _mi_read_rnd_mempack_record(MI_INFO *info, byte *buf, /* Save length of row */ -uint save_pack_length(uint version, byte *block_buff, ulong length) +uint save_pack_length(uint version, uchar *block_buff, ulong length) { if (length < 254) { diff --git a/storage/myisam/mi_page.c b/storage/myisam/mi_page.c index da9e19275c9..ede379feea6 100644 --- a/storage/myisam/mi_page.c +++ b/storage/myisam/mi_page.c @@ -29,7 +29,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo, DBUG_PRINT("enter",("page: %ld", (long) page)); tmp=(uchar*) key_cache_read(info->s->key_cache, - info->s->kfile, page, level, (byte*) buff, + info->s->kfile, page, level, (uchar*) buff, (uint) keyinfo->block_length, (uint) keyinfo->block_length, return_buffer); @@ -80,7 +80,7 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo, DBUG_RETURN((-1)); } DBUG_PRINT("page",("write page at: %lu",(long) page)); - DBUG_DUMP("buff",(byte*) buff,mi_getint(buff)); + DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff)); #endif if ((length=keyinfo->block_length) > IO_SIZE*2 && @@ -89,12 +89,12 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo, #ifdef HAVE_purify { length=mi_getint(buff); - bzero((byte*) buff+length,keyinfo->block_length-length); + bzero((uchar*) buff+length,keyinfo->block_length-length); length=keyinfo->block_length; } #endif DBUG_RETURN((key_cache_write(info->s->key_cache, - info->s->kfile,page, level, (byte*) buff,length, + info->s->kfile,page, level, (uchar*) buff,length, (uint) keyinfo->block_length, (int) ((info->lock_type != F_UNLCK) || info->s->delay_key_write)))); diff --git a/storage/myisam/mi_preload.c b/storage/myisam/mi_preload.c index 06c66c06bf4..60ab55106cb 100644 --- a/storage/myisam/mi_preload.c +++ b/storage/myisam/mi_preload.c @@ -81,7 +81,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) /* Read the next block of index file into the preload buffer */ if ((my_off_t) length > (key_file_length-pos)) length= (ulong) (key_file_length-pos); - if (my_pread(share->kfile, (byte*) buff, length, pos, MYF(MY_FAE|MY_FNABP))) + if (my_pread(share->kfile, (uchar*) buff, length, pos, MYF(MY_FAE|MY_FNABP))) goto err; if (ignore_leaves) @@ -93,7 +93,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) { if (key_cache_insert(share->key_cache, share->kfile, pos, DFLT_INIT_HITS, - (byte*) buff, block_length)) + (uchar*) buff, block_length)) goto err; } pos+= block_length; @@ -105,7 +105,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) { if (key_cache_insert(share->key_cache, share->kfile, pos, DFLT_INIT_HITS, - (byte*) buff, length)) + (uchar*) buff, length)) goto err; pos+= length; } diff --git a/storage/myisam/mi_range.c b/storage/myisam/mi_range.c index c7ab6731a2c..932a4abd1b3 100644 --- a/storage/myisam/mi_range.c +++ b/storage/myisam/mi_range.c @@ -21,7 +21,7 @@ #include "myisamdef.h" #include "rt_index.h" -static ha_rows _mi_record_pos(MI_INFO *, const byte *, key_part_map, +static ha_rows _mi_record_pos(MI_INFO *, const uchar *, key_part_map, enum ha_rkey_function); static double _mi_search_pos(MI_INFO *,MI_KEYDEF *,uchar *, uint,uint,my_off_t); static uint _mi_keynr(MI_INFO *info,MI_KEYDEF *,uchar *, uchar *,uint *); @@ -116,7 +116,7 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx, /* Find relative position (in records) for key in index-tree */ -static ha_rows _mi_record_pos(MI_INFO *info, const byte *key, +static ha_rows _mi_record_pos(MI_INFO *info, const uchar *key, key_part_map keypart_map, enum ha_rkey_function search_flag) { diff --git a/storage/myisam/mi_rfirst.c b/storage/myisam/mi_rfirst.c index d23bda46b1a..5a8b27b3e85 100644 --- a/storage/myisam/mi_rfirst.c +++ b/storage/myisam/mi_rfirst.c @@ -17,7 +17,7 @@ /* Read first row through a specfic key */ -int mi_rfirst(MI_INFO *info, byte *buf, int inx) +int mi_rfirst(MI_INFO *info, uchar *buf, int inx) { DBUG_ENTER("mi_rfirst"); info->lastpos= HA_OFFSET_ERROR; diff --git a/storage/myisam/mi_rkey.c b/storage/myisam/mi_rkey.c index a69e276a6d8..3dcaa27d3ca 100644 --- a/storage/myisam/mi_rkey.c +++ b/storage/myisam/mi_rkey.c @@ -21,7 +21,7 @@ /* Read a record using key */ /* Ordinary search_flag is 0 ; Give error if no record with key */ -int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, +int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key, key_part_map keypart_map, enum ha_rkey_function search_flag) { uchar *key_buff; diff --git a/storage/myisam/mi_rlast.c b/storage/myisam/mi_rlast.c index 7805755ab70..07be619617f 100644 --- a/storage/myisam/mi_rlast.c +++ b/storage/myisam/mi_rlast.c @@ -17,7 +17,7 @@ /* Read last row with the same key as the previous read. */ -int mi_rlast(MI_INFO *info, byte *buf, int inx) +int mi_rlast(MI_INFO *info, uchar *buf, int inx) { DBUG_ENTER("mi_rlast"); info->lastpos= HA_OFFSET_ERROR; diff --git a/storage/myisam/mi_rnext.c b/storage/myisam/mi_rnext.c index f6a0a47413e..7ce66d41e0f 100644 --- a/storage/myisam/mi_rnext.c +++ b/storage/myisam/mi_rnext.c @@ -24,7 +24,7 @@ based on the position of the last used key! */ -int mi_rnext(MI_INFO *info, byte *buf, int inx) +int mi_rnext(MI_INFO *info, uchar *buf, int inx) { int error,changed; uint flag; diff --git a/storage/myisam/mi_rnext_same.c b/storage/myisam/mi_rnext_same.c index 3a7004bf47c..1892fe3e1e0 100644 --- a/storage/myisam/mi_rnext_same.c +++ b/storage/myisam/mi_rnext_same.c @@ -24,7 +24,7 @@ based on the position of the last used key! */ -int mi_rnext_same(MI_INFO *info, byte *buf) +int mi_rnext_same(MI_INFO *info, uchar *buf) { int error; uint inx,not_used[2]; diff --git a/storage/myisam/mi_rprev.c b/storage/myisam/mi_rprev.c index 09802627185..d1407012590 100644 --- a/storage/myisam/mi_rprev.c +++ b/storage/myisam/mi_rprev.c @@ -22,7 +22,7 @@ based on the position of the last used key! */ -int mi_rprev(MI_INFO *info, byte *buf, int inx) +int mi_rprev(MI_INFO *info, uchar *buf, int inx) { int error,changed; register uint flag; diff --git a/storage/myisam/mi_rrnd.c b/storage/myisam/mi_rrnd.c index d31e6c24a37..211e5fa51cc 100644 --- a/storage/myisam/mi_rrnd.c +++ b/storage/myisam/mi_rrnd.c @@ -29,7 +29,7 @@ HA_ERR_END_OF_FILE = EOF. */ -int mi_rrnd(MI_INFO *info, byte *buf, register my_off_t filepos) +int mi_rrnd(MI_INFO *info, uchar *buf, register my_off_t filepos) { my_bool skip_deleted_blocks; DBUG_ENTER("mi_rrnd"); diff --git a/storage/myisam/mi_rsame.c b/storage/myisam/mi_rsame.c index 4831ebb3d7c..8093498483f 100644 --- a/storage/myisam/mi_rsame.c +++ b/storage/myisam/mi_rsame.c @@ -25,7 +25,7 @@ */ -int mi_rsame(MI_INFO *info, byte *record, int inx) +int mi_rsame(MI_INFO *info, uchar *record, int inx) { DBUG_ENTER("mi_rsame"); diff --git a/storage/myisam/mi_rsamepos.c b/storage/myisam/mi_rsamepos.c index 717b9ab52d5..6a1e462b686 100644 --- a/storage/myisam/mi_rsamepos.c +++ b/storage/myisam/mi_rsamepos.c @@ -27,7 +27,7 @@ ** HA_ERR_END_OF_FILE = End of file */ -int mi_rsame_with_pos(MI_INFO *info, byte *record, int inx, my_off_t filepos) +int mi_rsame_with_pos(MI_INFO *info, uchar *record, int inx, my_off_t filepos) { DBUG_ENTER("mi_rsame_with_pos"); DBUG_PRINT("enter",("index: %d filepos: %ld", inx, (long) filepos)); diff --git a/storage/myisam/mi_scan.c b/storage/myisam/mi_scan.c index 87debb67b37..a225b399660 100644 --- a/storage/myisam/mi_scan.c +++ b/storage/myisam/mi_scan.c @@ -36,7 +36,7 @@ int mi_scan_init(register MI_INFO *info) HA_ERR_END_OF_FILE = EOF. */ -int mi_scan(MI_INFO *info, byte *buf) +int mi_scan(MI_INFO *info, uchar *buf) { DBUG_ENTER("mi_scan"); /* Init all but update-flag */ diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c index d313619e007..acc8c073297 100644 --- a/storage/myisam/mi_search.c +++ b/storage/myisam/mi_search.c @@ -78,7 +78,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff, test(!(nextflag & SEARCH_SAVE_BUFF))))) goto err; - DBUG_DUMP("page",(byte*) buff,mi_getint(buff)); + DBUG_DUMP("page",(uchar*) buff,mi_getint(buff)); flag=(*keyinfo->bin_search)(info,keyinfo,buff,key,key_len,nextflag, &keypos,lastkey, &last_key); @@ -753,7 +753,7 @@ void _mi_dpointer(MI_INFO *info, uchar *buff, my_off_t pos) uint _mi_get_static_key(register MI_KEYDEF *keyinfo, uint nod_flag, register uchar **page, register uchar *key) { - memcpy((byte*) key,(byte*) *page, + memcpy((uchar*) key,(uchar*) *page, (size_t) (keyinfo->keylength+nod_flag)); *page+=keyinfo->keylength+nod_flag; return(keyinfo->keylength); @@ -897,12 +897,12 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, else length=keyseg->length; } - memcpy((byte*) key,(byte*) page,(size_t) length); + memcpy((uchar*) key,(uchar*) page,(size_t) length); key+=length; page+=length; } length=keyseg->length+nod_flag; - bmove((byte*) key,(byte*) page,length); + bmove((uchar*) key,(uchar*) page,length); *page_pos= page+length; return ((uint) (key-start_key)+keyseg->length); } /* _mi_get_pack_key */ @@ -1003,7 +1003,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, } DBUG_PRINT("info",("key: 0x%lx from: 0x%lx length: %u", (long) key, (long) from, length)); - memmove((byte*) key, (byte*) from, (size_t) length); + memmove((uchar*) key, (uchar*) from, (size_t) length); key+=length; from+=length; } @@ -1035,7 +1035,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, DBUG_RETURN(0); /* Error */ } /* Copy data pointer and, if appropriate, key block pointer. */ - memcpy((byte*) key,(byte*) from,(size_t) length); + memcpy((uchar*) key,(uchar*) from,(size_t) length); *page_pos= from+length; } DBUG_RETURN((uint) (key-start_key)+keyseg->length); @@ -1054,7 +1054,7 @@ uchar *_mi_get_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, nod_flag=mi_test_if_nod(page); if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY))) { - bmove((byte*) key,(byte*) keypos,keyinfo->keylength+nod_flag); + bmove((uchar*) key,(uchar*) keypos,keyinfo->keylength+nod_flag); DBUG_RETURN(keypos+keyinfo->keylength+nod_flag); } else @@ -1092,7 +1092,7 @@ static my_bool _mi_get_prev_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY))) { *return_key_length=keyinfo->keylength; - bmove((byte*) key,(byte*) keypos- *return_key_length-nod_flag, + bmove((uchar*) key,(uchar*) keypos- *return_key_length-nod_flag, *return_key_length); DBUG_RETURN(0); } @@ -1134,7 +1134,7 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, lastpos=endpos-keyinfo->keylength-nod_flag; *return_key_length=keyinfo->keylength; if (lastpos > page) - bmove((byte*) lastkey,(byte*) lastpos,keyinfo->keylength+nod_flag); + bmove((uchar*) lastkey,(uchar*) lastpos,keyinfo->keylength+nod_flag); } else { @@ -1225,7 +1225,7 @@ uint _mi_keylength_part(MI_KEYDEF *keyinfo, register uchar *key, uchar *_mi_move_key(MI_KEYDEF *keyinfo, uchar *to, uchar *from) { reg1 uint length; - memcpy((byte*) to, (byte*) from, + memcpy((uchar*) to, (uchar*) from, (size_t) (length=_mi_keylength(keyinfo,from))); return to+length; } @@ -1827,7 +1827,7 @@ void _mi_store_static_key(MI_KEYDEF *keyinfo __attribute__((unused)), register uchar *key_pos, register MI_KEY_PARAM *s_temp) { - memcpy((byte*) key_pos,(byte*) s_temp->key,(size_t) s_temp->totlength); + memcpy((uchar*) key_pos,(uchar*) s_temp->key,(size_t) s_temp->totlength); } @@ -1860,7 +1860,7 @@ void _mi_store_var_pack_key(MI_KEYDEF *keyinfo __attribute__((unused)), /* Not packed against previous key */ store_pack_length(s_temp->pack_marker == 128,key_pos,s_temp->key_length); } - bmove((byte*) key_pos,(byte*) s_temp->key, + bmove((uchar*) key_pos,(uchar*) s_temp->key, (length=s_temp->totlength-(uint) (key_pos-start))); if (!s_temp->next_key_pos) /* No following key */ diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c index 21a25f66b7c..c92d577b621 100644 --- a/storage/myisam/mi_static.c +++ b/storage/myisam/mi_static.c @@ -27,7 +27,7 @@ uchar NEAR myisam_file_magic[]= { (uchar) 254, (uchar) 254,'\007', '\001', }; uchar NEAR myisam_pack_file_magic[]= { (uchar) 254, (uchar) 254,'\010', '\002', }; -my_string myisam_log_filename=(char*) "myisam.log"; +char * myisam_log_filename=(char*) "myisam.log"; File myisam_log_file= -1; uint myisam_quick_table_bits=9; ulong myisam_block_size= MI_KEY_BLOCK_LENGTH; /* Best by test */ diff --git a/storage/myisam/mi_statrec.c b/storage/myisam/mi_statrec.c index 3f92ec31d4c..93e91fb9e32 100644 --- a/storage/myisam/mi_statrec.c +++ b/storage/myisam/mi_statrec.c @@ -18,7 +18,7 @@ #include "myisamdef.h" -int _mi_write_static_record(MI_INFO *info, const byte *record) +int _mi_write_static_record(MI_INFO *info, const uchar *record) { uchar temp[8]; /* max pointer length */ if (info->s->state.dellink != HA_OFFSET_ERROR && @@ -48,14 +48,14 @@ int _mi_write_static_record(MI_INFO *info, const byte *record) } if (info->opt_flag & WRITE_CACHE_USED) { /* Cash in use */ - if (my_b_write(&info->rec_cache, (byte*) record, + if (my_b_write(&info->rec_cache, (uchar*) record, info->s->base.reclength)) goto err; if (info->s->base.pack_reclength != info->s->base.reclength) { uint length=info->s->base.pack_reclength - info->s->base.reclength; bzero((char*) temp,length); - if (my_b_write(&info->rec_cache, (byte*) temp,length)) + if (my_b_write(&info->rec_cache, (uchar*) temp,length)) goto err; } } @@ -70,7 +70,7 @@ int _mi_write_static_record(MI_INFO *info, const byte *record) { uint length=info->s->base.pack_reclength - info->s->base.reclength; bzero((char*) temp,length); - if (info->s->file_write(info, (byte*) temp,length, + if (info->s->file_write(info, (uchar*) temp,length, info->state->data_file_length+ info->s->base.reclength, info->s->write_flag)) @@ -85,7 +85,7 @@ int _mi_write_static_record(MI_INFO *info, const byte *record) return 1; } -int _mi_update_static_record(MI_INFO *info, my_off_t pos, const byte *record) +int _mi_update_static_record(MI_INFO *info, my_off_t pos, const uchar *record) { info->rec_cache.seek_not_done=1; /* We have done a seek */ return (info->s->file_write(info, @@ -105,12 +105,12 @@ int _mi_delete_static_record(MI_INFO *info) _mi_dpointer(info,temp+1,info->s->state.dellink); info->s->state.dellink = info->lastpos; info->rec_cache.seek_not_done=1; - return (info->s->file_write(info,(byte*) temp, 1+info->s->rec_reflength, + return (info->s->file_write(info,(uchar*) temp, 1+info->s->rec_reflength, info->lastpos, MYF(MY_NABP)) != 0); } -int _mi_cmp_static_record(register MI_INFO *info, register const byte *old) +int _mi_cmp_static_record(register MI_INFO *info, register const uchar *old) { DBUG_ENTER("_mi_cmp_static_record"); @@ -133,7 +133,7 @@ int _mi_cmp_static_record(register MI_INFO *info, register const byte *old) info->lastpos, MYF(MY_NABP))) DBUG_RETURN(-1); - if (memcmp((byte*) info->rec_buff, (byte*) old, + if (memcmp((uchar*) info->rec_buff, (uchar*) old, (uint) info->s->base.reclength)) { DBUG_DUMP("read",old,info->s->base.reclength); @@ -147,7 +147,7 @@ int _mi_cmp_static_record(register MI_INFO *info, register const byte *old) int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def, - const byte *record, my_off_t pos) + const uchar *record, my_off_t pos) { DBUG_ENTER("_mi_cmp_static_unique"); @@ -166,7 +166,7 @@ int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def, /* MY_FILE_ERROR on read-error or locking-error */ int _mi_read_static_record(register MI_INFO *info, register my_off_t pos, - register byte *record) + register uchar *record) { int error; @@ -199,7 +199,7 @@ int _mi_read_static_record(register MI_INFO *info, register my_off_t pos, -int _mi_read_rnd_static_record(MI_INFO *info, byte *buf, +int _mi_read_rnd_static_record(MI_INFO *info, uchar *buf, register my_off_t filepos, my_bool skip_deleted_blocks) { @@ -274,11 +274,11 @@ int _mi_read_rnd_static_record(MI_INFO *info, byte *buf, } /* Read record with cacheing */ - error=my_b_read(&info->rec_cache,(byte*) buf,share->base.reclength); + error=my_b_read(&info->rec_cache,(uchar*) buf,share->base.reclength); if (info->s->base.pack_reclength != info->s->base.reclength && !error) { char tmp[8]; /* Skill fill bytes */ - error=my_b_read(&info->rec_cache,(byte*) tmp, + error=my_b_read(&info->rec_cache,(uchar*) tmp, info->s->base.pack_reclength - info->s->base.reclength); } if (locked) diff --git a/storage/myisam/mi_test1.c b/storage/myisam/mi_test1.c index ebb9cdcb2f7..1165ea4bb32 100644 --- a/storage/myisam/mi_test1.c +++ b/storage/myisam/mi_test1.c @@ -109,7 +109,7 @@ static int run_test(const char *filename) } keyinfo[0].flag = (uint8) (pack_keys | unique_key); - bzero((byte*) flags,sizeof(flags)); + bzero((uchar*) flags,sizeof(flags)); if (opt_unique) { uint start; @@ -534,21 +534,21 @@ static struct my_option my_long_options[] = {"debug", '#', "Undocumented", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"delete_rows", 'd', "Undocumented", (gptr*) &remove_count, - (gptr*) &remove_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, + {"delete_rows", 'd', "Undocumented", (uchar**) &remove_count, + (uchar**) &remove_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, {"help", '?', "Display help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"insert_rows", 'i', "Undocumented", (gptr*) &insert_count, - (gptr*) &insert_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, + {"insert_rows", 'i', "Undocumented", (uchar**) &insert_count, + (uchar**) &insert_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, {"key_alpha", 'a', "Use a key of type HA_KEYTYPE_TEXT", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"key_binary_pack", 'B', "Undocumented", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"key_blob", 'b', "Undocumented", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"key_cache", 'K', "Undocumented", (gptr*) &key_cacheing, - (gptr*) &key_cacheing, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"key_length", 'k', "Undocumented", (gptr*) &key_length, (gptr*) &key_length, + {"key_cache", 'K', "Undocumented", (uchar**) &key_cacheing, + (uchar**) &key_cacheing, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"key_length", 'k', "Undocumented", (uchar**) &key_length, (uchar**) &key_length, 0, GET_UINT, REQUIRED_ARG, 6, 0, 0, 0, 0, 0}, {"key_multiple", 'm', "Undocumented", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -559,21 +559,21 @@ static struct my_option my_long_options[] = {"key_varchar", 'w', "Test VARCHAR keys", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"null_fields", 'N', "Define fields with NULL", - (gptr*) &null_fields, (gptr*) &null_fields, 0, GET_BOOL, NO_ARG, + (uchar**) &null_fields, (uchar**) &null_fields, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"row_fixed_size", 'S', "Undocumented", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"row_pointer_size", 'R', "Undocumented", (gptr*) &rec_pointer_size, - (gptr*) &rec_pointer_size, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"row_pointer_size", 'R', "Undocumented", (uchar**) &rec_pointer_size, + (uchar**) &rec_pointer_size, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"silent", 's', "Undocumented", - (gptr*) &silent, (gptr*) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"skip_update", 'U', "Undocumented", (gptr*) &skip_update, - (gptr*) &skip_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"unique", 'C', "Undocumented", (gptr*) &opt_unique, (gptr*) &opt_unique, 0, + (uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"skip_update", 'U', "Undocumented", (uchar**) &skip_update, + (uchar**) &skip_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"unique", 'C', "Undocumented", (uchar**) &opt_unique, (uchar**) &opt_unique, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"update_rows", 'u', "Undocumented", (gptr*) &update_count, - (gptr*) &update_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, - {"verbose", 'v', "Be more verbose", (gptr*) &verbose, (gptr*) &verbose, 0, + {"update_rows", 'u', "Undocumented", (uchar**) &update_count, + (uchar**) &update_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, + {"verbose", 'v', "Be more verbose", (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Print version number and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c index 878bba31ea8..96ee82e023c 100644 --- a/storage/myisam/mi_test2.c +++ b/storage/myisam/mi_test2.c @@ -36,7 +36,7 @@ static void get_options(int argc, char *argv[]); static uint rnd(uint max_value); -static void fix_length(byte *record,uint length); +static void fix_length(uchar *record,uint length); static void put_blob_in_record(char *blob_pos,char **blob_buffer); static void copy_key(struct st_myisam_info *info,uint inx, uchar *record,uchar *key); @@ -455,8 +455,8 @@ int main(int argc, char *argv[]) bcmp(read_record2,read_record3,reclength)) { printf("Can't find last record\n"); - DBUG_DUMP("record2",(byte*) read_record2,reclength); - DBUG_DUMP("record3",(byte*) read_record3,reclength); + DBUG_DUMP("record2",(uchar*) read_record2,reclength); + DBUG_DUMP("record3",(uchar*) read_record3,reclength); goto end; } ant=1; @@ -1001,7 +1001,7 @@ static uint rnd(uint max_value) /* Create a variable length record */ -static void fix_length(byte *rec, uint length) +static void fix_length(uchar *rec, uint length) { bmove(rec+STANDARD_LENGTH, "0123456789012345678901234567890123456789012345678901234567890", diff --git a/storage/myisam/mi_test3.c b/storage/myisam/mi_test3.c index 3987c20ab69..982b999c3a5 100644 --- a/storage/myisam/mi_test3.c +++ b/storage/myisam/mi_test3.c @@ -243,7 +243,7 @@ int test_read(MI_INFO *file,int id) for (i=0 ; i < 100 ; i++) { find=rnd(100000); - if (!mi_rkey(file,record.id,1,(byte*) &find, + if (!mi_rkey(file,record.id,1,(uchar*) &find, sizeof(find),HA_READ_KEY_EXACT)) found++; else @@ -426,7 +426,7 @@ int test_update(MI_INFO *file,int id,int lock_type) { tmp=rnd(100000); int4store(find,tmp); - if (!mi_rkey(file,record.id,1,(byte*) find, + if (!mi_rkey(file,record.id,1,(uchar*) find, sizeof(find),HA_READ_KEY_EXACT)) found++; else diff --git a/storage/myisam/mi_unique.c b/storage/myisam/mi_unique.c index 635f6c18247..e490fb683e4 100644 --- a/storage/myisam/mi_unique.c +++ b/storage/myisam/mi_unique.c @@ -18,7 +18,7 @@ #include "myisamdef.h" #include <m_ctype.h> -my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record, +my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record, ha_checksum unique_hash, my_off_t disk_pos) { my_off_t lastpos=info->lastpos; @@ -73,9 +73,9 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record, Add support for bit fields */ -ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record) +ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *record) { - const byte *pos, *end; + const uchar *pos, *end; ha_checksum crc= 0; ulong seed1=0, seed2= 4; HA_KEYSEG *keyseg; @@ -111,7 +111,7 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record) else if (keyseg->flag & HA_BLOB_PART) { uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos); - memcpy_fixed((byte*) &pos,pos+keyseg->bit_start,sizeof(char*)); + memcpy_fixed((uchar*) &pos,pos+keyseg->bit_start,sizeof(char*)); if (!length || length > tmp_length) length=tmp_length; /* The whole blob */ } @@ -145,10 +145,10 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record) # Rows are different */ -int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b, +int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b, my_bool null_are_equal) { - const byte *pos_a, *pos_b, *end; + const uchar *pos_a, *pos_b, *end; HA_KEYSEG *keyseg; for (keyseg=def->seg ; keyseg < def->end ; keyseg++) @@ -206,8 +206,8 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b, set_if_smaller(a_length, keyseg->length); set_if_smaller(b_length, keyseg->length); } - memcpy_fixed((byte*) &pos_a,pos_a+keyseg->bit_start,sizeof(char*)); - memcpy_fixed((byte*) &pos_b,pos_b+keyseg->bit_start,sizeof(char*)); + memcpy_fixed((uchar*) &pos_a,pos_a+keyseg->bit_start,sizeof(char*)); + memcpy_fixed((uchar*) &pos_b,pos_b+keyseg->bit_start,sizeof(char*)); } if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT1 || type == HA_KEYTYPE_VARTEXT2) diff --git a/storage/myisam/mi_update.c b/storage/myisam/mi_update.c index bea457d2e9a..924cdfcbc21 100644 --- a/storage/myisam/mi_update.c +++ b/storage/myisam/mi_update.c @@ -18,7 +18,7 @@ #include "fulltext.h" #include "rt_index.h" -int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec) +int mi_update(register MI_INFO *info, const uchar *oldrec, uchar *newrec) { int flag,key_changed,save_errno; reg3 my_off_t pos; @@ -115,7 +115,7 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec) info->update&= ~HA_STATE_RNEXT_SAME; if (new_length != old_length || - memcmp((byte*) old_key,(byte*) new_key,new_length)) + memcmp((uchar*) old_key,(uchar*) new_key,new_length)) { if ((int) i == info->lastinx) key_changed|=HA_STATE_WRITTEN; /* Mark that keyfile changed */ diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c index 57c054f2de8..8ae979f8bf6 100644 --- a/storage/myisam/mi_write.c +++ b/storage/myisam/mi_write.c @@ -40,7 +40,7 @@ int _mi_ck_write_btree(register MI_INFO *info, uint keynr,uchar *key, /* Write new record to database */ -int mi_write(MI_INFO *info, byte *record) +int mi_write(MI_INFO *info, uchar *record) { MYISAM_SHARE *share=info->s; uint i; @@ -286,7 +286,7 @@ int _mi_ck_write_btree(register MI_INFO *info, uint keynr, uchar *key, if (!error) error= _mi_ft_convert_to_ft2(info, keynr, key); delete_dynamic(info->ft1_to_ft2); - my_free((gptr)info->ft1_to_ft2, MYF(0)); + my_free((uchar*)info->ft1_to_ft2, MYF(0)); info->ft1_to_ft2=0; } DBUG_RETURN(error); @@ -403,14 +403,14 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ft_intXstore(keypos, subkeys); if (!error) error=_mi_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,temp_buff); - my_afree((byte*) temp_buff); + my_afree((uchar*) temp_buff); DBUG_RETURN(error); } } else /* not HA_FULLTEXT, normal HA_NOSAME key */ { info->dupp_key_pos= dupp_key_pos; - my_afree((byte*) temp_buff); + my_afree((uchar*) temp_buff); my_errno=HA_ERR_FOUND_DUPP_KEY; DBUG_RETURN(-1); } @@ -429,10 +429,10 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (_mi_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,temp_buff)) goto err; } - my_afree((byte*) temp_buff); + my_afree((uchar*) temp_buff); DBUG_RETURN(error); err: - my_afree((byte*) temp_buff); + my_afree((uchar*) temp_buff); DBUG_PRINT("exit",("Error: %d",my_errno)); DBUG_RETURN (-1); } /* w_search */ @@ -488,7 +488,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (key_pos != anc_buff+2+nod_flag && (keyinfo->flag & (HA_BINARY_PACK_KEY | HA_PACK_KEY))) { - DBUG_DUMP("prev_key",(byte*) key_buff,_mi_keylength(keyinfo,key_buff)); + DBUG_DUMP("prev_key",(uchar*) key_buff,_mi_keylength(keyinfo,key_buff)); } if (keyinfo->flag & HA_PACK_KEY) { @@ -506,7 +506,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo, my_errno=HA_ERR_CRASHED; DBUG_RETURN(-1); } - bmove_upp((byte*) endpos+t_length,(byte*) endpos,(uint) (endpos-key_pos)); + bmove_upp((uchar*) endpos+t_length,(uchar*) endpos,(uint) (endpos-key_pos)); } else { @@ -595,7 +595,7 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo, MI_KEY_PARAM s_temp; DBUG_ENTER("mi_split_page"); LINT_INIT(after_key); - DBUG_DUMP("buff",(byte*) buff,mi_getint(buff)); + DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff)); if (info->s->keyinfo+info->lastinx == keyinfo) info->page_changed=1; /* Info->buff is used */ @@ -619,7 +619,7 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo, { DBUG_PRINT("test",("Splitting nod")); pos=key_pos-nod_flag; - memcpy((byte*) info->buff+2,(byte*) pos,(size_t) nod_flag); + memcpy((uchar*) info->buff+2,(uchar*) pos,(size_t) nod_flag); } /* Move middle item to key and pointer to new page */ @@ -635,14 +635,14 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo, (uchar*) 0, (uchar*) 0, key_buff, &s_temp); length=(uint) ((buff+a_length)-key_pos); - memcpy((byte*) info->buff+key_ref_length+t_length,(byte*) key_pos, + memcpy((uchar*) info->buff+key_ref_length+t_length,(uchar*) key_pos, (size_t) length); (*keyinfo->store_key)(keyinfo,info->buff+key_ref_length,&s_temp); mi_putint(info->buff,length+t_length+key_ref_length,nod_flag); if (_mi_write_keypage(info,keyinfo,new_pos,DFLT_INIT_HITS,info->buff)) DBUG_RETURN(-1); - DBUG_DUMP("key",(byte*) key,_mi_keylength(keyinfo,key)); + DBUG_DUMP("key",(uchar*) key,_mi_keylength(keyinfo,key)); DBUG_RETURN(2); /* Middle key up */ } /* _mi_split_page */ @@ -764,7 +764,7 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo, length,keys; uchar *pos,*buff,*extra_buff; my_off_t next_page,new_pos; - byte tmp_part_key[MI_MAX_KEY_BUFF]; + uchar tmp_part_key[MI_MAX_KEY_BUFF]; DBUG_ENTER("_mi_balance_page"); k_length=keyinfo->keylength; @@ -796,7 +796,7 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo, if (!_mi_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,info->buff,0)) goto err; - DBUG_DUMP("next",(byte*) info->buff,mi_getint(info->buff)); + DBUG_DUMP("next",(uchar*) info->buff,mi_getint(info->buff)); /* Test if there is room to share keys */ @@ -815,23 +815,23 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo, if (left_length < new_left_length) { /* Move keys buff -> leaf */ pos=curr_buff+left_length; - memcpy((byte*) pos,(byte*) father_key_pos, (size_t) k_length); - memcpy((byte*) pos+k_length, (byte*) buff+2, + memcpy((uchar*) pos,(uchar*) father_key_pos, (size_t) k_length); + memcpy((uchar*) pos+k_length, (uchar*) buff+2, (size_t) (length=new_left_length - left_length - k_length)); pos=buff+2+length; - memcpy((byte*) father_key_pos,(byte*) pos,(size_t) k_length); - bmove((byte*) buff+2,(byte*) pos+k_length,new_right_length); + memcpy((uchar*) father_key_pos,(uchar*) pos,(size_t) k_length); + bmove((uchar*) buff+2,(uchar*) pos+k_length,new_right_length); } else { /* Move keys -> buff */ - bmove_upp((byte*) buff+new_right_length,(byte*) buff+right_length, + bmove_upp((uchar*) buff+new_right_length,(uchar*) buff+right_length, right_length-2); length=new_right_length-right_length-k_length; - memcpy((byte*) buff+2+length,father_key_pos,(size_t) k_length); + memcpy((uchar*) buff+2+length,father_key_pos,(size_t) k_length); pos=curr_buff+new_left_length; - memcpy((byte*) father_key_pos,(byte*) pos,(size_t) k_length); - memcpy((byte*) buff+2,(byte*) pos+k_length,(size_t) length); + memcpy((uchar*) father_key_pos,(uchar*) pos,(size_t) k_length); + memcpy((uchar*) buff+2,(uchar*) pos+k_length,(size_t) length); } if (_mi_write_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,info->buff) || @@ -858,22 +858,22 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo, /* move first largest keys to new page */ pos=buff+right_length-extra_length; - memcpy((byte*) extra_buff+2,pos,(size_t) extra_length); + memcpy((uchar*) extra_buff+2,pos,(size_t) extra_length); /* Save new parting key */ memcpy(tmp_part_key, pos-k_length,k_length); /* Make place for new keys */ - bmove_upp((byte*) buff+new_right_length,(byte*) pos-k_length, + bmove_upp((uchar*) buff+new_right_length,(uchar*) pos-k_length, right_length-extra_length-k_length-2); /* Copy keys from left page */ pos= curr_buff+new_left_length; - memcpy((byte*) buff+2,(byte*) pos+k_length, + memcpy((uchar*) buff+2,(uchar*) pos+k_length, (size_t) (length=left_length-new_left_length-k_length)); /* Copy old parting key */ - memcpy((byte*) buff+2+length,father_key_pos,(size_t) k_length); + memcpy((uchar*) buff+2+length,father_key_pos,(size_t) k_length); /* Move new parting keys up to caller */ - memcpy((byte*) (right ? key : father_key_pos),pos,(size_t) k_length); - memcpy((byte*) (right ? father_key_pos : key),tmp_part_key, k_length); + memcpy((uchar*) (right ? key : father_key_pos),pos,(size_t) k_length); + memcpy((uchar*) (right ? father_key_pos : key),tmp_part_key, k_length); if ((new_pos=_mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR) goto err; diff --git a/storage/myisam/myisam_ftdump.c b/storage/myisam/myisam_ftdump.c index 4bc1833cca6..63d954242a0 100644 --- a/storage/myisam/myisam_ftdump.c +++ b/storage/myisam/myisam_ftdump.c @@ -46,7 +46,7 @@ static struct my_option my_long_options[] = {"stats", 's', "Report global stats.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"verbose", 'v', "Be verbose.", - (gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 066e6cdb81b..3700251ab15 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -68,9 +68,9 @@ static void get_options(int *argc,char * * *argv); static void print_version(void); static void usage(void); static int myisamchk(MI_CHECK *param, char *filename); -static void descript(MI_CHECK *param, register MI_INFO *info, my_string name); +static void descript(MI_CHECK *param, register MI_INFO *info, char * name); static int mi_sort_records(MI_CHECK *param, register MI_INFO *info, - my_string name, uint sort_key, + char * name, uint sort_key, my_bool write_info, my_bool update_index); static int sort_record_index(MI_SORT_PARAM *sort_param, MI_INFO *info, MI_KEYDEF *keyinfo, @@ -167,7 +167,7 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR, "Directory where character sets are.", - (gptr*) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + (uchar**) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"check", 'c', "Check table for errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -187,8 +187,8 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"data-file-length", 'D', "Max length of data file (when recreating data-file when it's full).", - (gptr*) &check_param.max_data_file_length, - (gptr*) &check_param.max_data_file_length, + (uchar**) &check_param.max_data_file_length, + (uchar**) &check_param.max_data_file_length, 0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"extend-check", 'e', "If used when checking a table, ensure that the table is 100 percent consistent, which will take a long time. If used when repairing a table, try to recover every possible row from the data file. Normally this will also find a lot of garbage rows; Don't use this option with repair if you are not totally desperate.", @@ -210,13 +210,13 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"keys-used", 'k', "Tell MyISAM to update only some specific keys. # is a bit mask of which keys to use. This can be used to get faster inserts.", - (gptr*) &check_param.keys_in_use, - (gptr*) &check_param.keys_in_use, + (uchar**) &check_param.keys_in_use, + (uchar**) &check_param.keys_in_use, 0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0}, {"max-record-length", OPT_MAX_RECORD_LENGTH, "Skip rows bigger than this if myisamchk can't allocate memory to hold it", - (gptr*) &check_param.max_record_length, - (gptr*) &check_param.max_record_length, + (uchar**) &check_param.max_record_length, + (uchar**) &check_param.max_record_length, 0, GET_ULL, REQUIRED_ARG, LONGLONG_MAX, 0, LONGLONG_MAX, 0, 0, 0}, {"medium-check", 'm', "Faster than extend-check, but only finds 99.99% of all errors. Should be good enough for most cases.", @@ -245,12 +245,12 @@ static struct my_option my_long_options[] = #endif {"set-auto-increment", 'A', "Force auto_increment to start at this or higher value. If no value is given, then sets the next auto_increment value to the highest used value for the auto key + 1.", - (gptr*) &check_param.auto_increment_value, - (gptr*) &check_param.auto_increment_value, + (uchar**) &check_param.auto_increment_value, + (uchar**) &check_param.auto_increment_value, 0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"set-collation", OPT_SET_COLLATION, "Change the collation used by the index", - (gptr*) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + (uchar**) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"set-variable", 'O', "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -262,12 +262,12 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"sort-records", 'R', "Sort records according to an index. This makes your data much more localized and may speed up things. (It may be VERY slow to do a sort the first time!)", - (gptr*) &check_param.opt_sort_key, - (gptr*) &check_param.opt_sort_key, + (uchar**) &check_param.opt_sort_key, + (uchar**) &check_param.opt_sort_key, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"tmpdir", 't', "Path for temporary files.", - (gptr*) &opt_tmpdir, + (uchar**) &opt_tmpdir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"update-state", 'U', "Mark tables as crashed if any errors were found.", @@ -285,54 +285,54 @@ static struct my_option my_long_options[] = "Wait if table is locked.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, { "key_buffer_size", OPT_KEY_BUFFER_SIZE, "", - (gptr*) &check_param.use_buffers, (gptr*) &check_param.use_buffers, 0, + (uchar**) &check_param.use_buffers, (uchar**) &check_param.use_buffers, 0, GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT, (long) MALLOC_OVERHEAD, (long) ~0L, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0}, { "key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE, "", - (gptr*) &opt_key_cache_block_size, - (gptr*) &opt_key_cache_block_size, 0, + (uchar**) &opt_key_cache_block_size, + (uchar**) &opt_key_cache_block_size, 0, GET_LONG, REQUIRED_ARG, MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH, 0, MI_MIN_KEY_BLOCK_LENGTH, 0}, { "myisam_block_size", OPT_MYISAM_BLOCK_SIZE, "", - (gptr*) &opt_myisam_block_size, (gptr*) &opt_myisam_block_size, 0, + (uchar**) &opt_myisam_block_size, (uchar**) &opt_myisam_block_size, 0, GET_LONG, REQUIRED_ARG, MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH, 0, MI_MIN_KEY_BLOCK_LENGTH, 0}, { "read_buffer_size", OPT_READ_BUFFER_SIZE, "", - (gptr*) &check_param.read_buffer_length, - (gptr*) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG, + (uchar**) &check_param.read_buffer_length, + (uchar**) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, { "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "", - (gptr*) &check_param.write_buffer_length, - (gptr*) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG, + (uchar**) &check_param.write_buffer_length, + (uchar**) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "", - (gptr*) &check_param.sort_buffer_length, - (gptr*) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG, + (uchar**) &check_param.sort_buffer_length, + (uchar**) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, { "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "", - (gptr*) &check_param.sort_key_blocks, - (gptr*) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG, + (uchar**) &check_param.sort_key_blocks, + (uchar**) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG, BUFFERS_WHEN_SORTING, 4L, 100L, 0L, 1L, 0}, - { "decode_bits", OPT_DECODE_BITS, "", (gptr*) &decode_bits, - (gptr*) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0}, - { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (gptr*) &ft_min_word_len, - (gptr*) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN, + { "decode_bits", OPT_DECODE_BITS, "", (uchar**) &decode_bits, + (uchar**) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0}, + { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (uchar**) &ft_min_word_len, + (uchar**) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN, 0, 1, 0}, - { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (gptr*) &ft_max_word_len, - (gptr*) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10, + { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (uchar**) &ft_max_word_len, + (uchar**) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10, HA_FT_MAXCHARLEN, 0, 1, 0}, { "ft_stopword_file", OPT_FT_STOPWORD_FILE, "Use stopwords from this file instead of built-in list.", - (gptr*) &ft_stopword_file, (gptr*) &ft_stopword_file, 0, GET_STR, + (uchar**) &ft_stopword_file, (uchar**) &ft_stopword_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"stats_method", OPT_STATS_METHOD, "Specifies how index statistics collection code should threat NULLs. " "Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), " "\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".", - (gptr*) &myisam_stats_method_str, (gptr*) &myisam_stats_method_str, 0, + (uchar**) &myisam_stats_method_str, (uchar**) &myisam_stats_method_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -794,7 +794,7 @@ static void get_options(register int *argc,register char ***argv) /* Check table */ -static int myisamchk(MI_CHECK *param, my_string filename) +static int myisamchk(MI_CHECK *param, char * filename) { int error,lock_type,recreate; int rep_quick= param->testflag & (T_QUICK | T_FORCE_UNIQUENESS); @@ -1199,7 +1199,7 @@ end2: /* Write info about table */ -static void descript(MI_CHECK *param, register MI_INFO *info, my_string name) +static void descript(MI_CHECK *param, register MI_INFO *info, char * name) { uint key,keyseg_nr,field,start; reg3 MI_KEYDEF *keyinfo; @@ -1465,7 +1465,7 @@ static void descript(MI_CHECK *param, register MI_INFO *info, my_string name) /* Sort records according to one key */ static int mi_sort_records(MI_CHECK *param, - register MI_INFO *info, my_string name, + register MI_INFO *info, char * name, uint sort_key, my_bool write_info, my_bool update_index) @@ -1536,7 +1536,7 @@ static int mi_sort_records(MI_CHECK *param, mi_check_print_error(param,"Not enough memory for key block"); goto err; } - if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength, + if (!(sort_param.record=(uchar*) my_malloc((uint) share->base.pack_reclength, MYF(0)))) { mi_check_print_error(param,"Not enough memory for record"); @@ -1567,7 +1567,7 @@ static int mi_sort_records(MI_CHECK *param, for (key=0 ; key < share->base.keys ; key++) share->keyinfo[key].flag|= HA_SORT_ALLOWS_SAME; - if (my_pread(share->kfile,(byte*) temp_buff, + if (my_pread(share->kfile,(uchar*) temp_buff, (uint) keyinfo->block_length, share->state.key_root[sort_key], MYF(MY_NABP+MY_WME))) @@ -1630,7 +1630,7 @@ err: } if (temp_buff) { - my_afree((gptr) temp_buff); + my_afree((uchar*) temp_buff); } my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR)); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); @@ -1679,7 +1679,7 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info, if (nod_flag) { next_page=_mi_kpos(nod_flag,keypos); - if (my_pread(info->s->kfile,(byte*) temp_buff, + if (my_pread(info->s->kfile,(uchar*) temp_buff, (uint) keyinfo->block_length, next_page, MYF(MY_NABP+MY_WME))) { @@ -1718,19 +1718,19 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info, goto err; } /* Clear end of block to get better compression if the table is backuped */ - bzero((byte*) buff+used_length,keyinfo->block_length-used_length); - if (my_pwrite(info->s->kfile,(byte*) buff,(uint) keyinfo->block_length, + bzero((uchar*) buff+used_length,keyinfo->block_length-used_length); + if (my_pwrite(info->s->kfile,(uchar*) buff,(uint) keyinfo->block_length, page,param->myf_rw)) { mi_check_print_error(param,"%d when updating keyblock",my_errno); goto err; } if (temp_buff) - my_afree((gptr) temp_buff); + my_afree((uchar*) temp_buff); DBUG_RETURN(0); err: if (temp_buff) - my_afree((gptr) temp_buff); + my_afree((uchar*) temp_buff); DBUG_RETURN(1); } /* sort_record_index */ diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index a491e6d210c..f68d66d4cbb 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -167,22 +167,22 @@ typedef struct st_mi_isam_share { /* Shared between opens */ char *unique_file_name; /* realpath() of index file */ char *data_file_name, /* Resolved path names from symlinks */ *index_file_name; - byte *file_map; /* mem-map of file if possible */ + uchar *file_map; /* mem-map of file if possible */ KEY_CACHE *key_cache; /* ref to the current key cache */ MI_DECODE_TREE *decode_trees; uint16 *decode_tables; - int (*read_record)(struct st_myisam_info*, my_off_t, byte*); - int (*write_record)(struct st_myisam_info*, const byte*); - int (*update_record)(struct st_myisam_info*, my_off_t, const byte*); + int (*read_record)(struct st_myisam_info*, my_off_t, uchar*); + int (*write_record)(struct st_myisam_info*, const uchar*); + int (*update_record)(struct st_myisam_info*, my_off_t, const uchar*); int (*delete_record)(struct st_myisam_info*); - int (*read_rnd)(struct st_myisam_info*, byte*, my_off_t, my_bool); - int (*compare_record)(struct st_myisam_info*, const byte *); + int (*read_rnd)(struct st_myisam_info*, uchar*, my_off_t, my_bool); + int (*compare_record)(struct st_myisam_info*, const uchar *); /* Function to use for a row checksum. */ - ha_checksum (*calc_checksum)(struct st_myisam_info*, const byte *); + ha_checksum (*calc_checksum)(struct st_myisam_info*, const uchar *); int (*compare_unique)(struct st_myisam_info*, MI_UNIQUEDEF *, - const byte *record, my_off_t pos); - uint (*file_read)(MI_INFO *, byte *, uint, my_off_t, myf); - uint (*file_write)(MI_INFO *, byte *, uint, my_off_t, myf); + const uchar *record, my_off_t pos); + uint (*file_read)(MI_INFO *, uchar *, uint, my_off_t, myf); + uint (*file_write)(MI_INFO *, uchar *, uint, my_off_t, myf); invalidator_by_filename invalidator; /* query cache invalidator */ ulong this_process; /* processid */ ulong last_process; /* For table-change-check */ @@ -245,12 +245,12 @@ struct st_myisam_info { uchar *buff, /* Temp area for key */ *lastkey,*lastkey2; /* Last used search key */ uchar *first_mbr_key; /* Searhed spatial key */ - byte *rec_buff; /* Tempbuff for recordpack */ + uchar *rec_buff; /* Tempbuff for recordpack */ uchar *int_keypos, /* Save position for next/previous */ *int_maxpos; /* -""- */ uint int_nod_flag; /* -""- */ uint32 int_keytree_version; /* -""- */ - int (*read_record)(struct st_myisam_info*, my_off_t, byte*); + int (*read_record)(struct st_myisam_info*, my_off_t, uchar*); invalidator_by_filename invalidator; /* query cache invalidator */ ulong this_unique; /* uniq filenumber or thread */ ulong last_unique; /* last unique number */ @@ -334,10 +334,10 @@ typedef struct st_mi_sort_param HA_KEYSEG *seg; SORT_INFO *sort_info; uchar **sort_keys; - byte *rec_buff; + uchar *rec_buff; void *wordlist, *wordptr; MEM_ROOT wordroot; - char *record; + uchar *record; MY_TMPDIR *tmpdir; int (*key_cmp)(struct st_mi_sort_param *, const void *, const void *); int (*key_read)(struct st_mi_sort_param *,void *); @@ -349,6 +349,7 @@ typedef struct st_mi_sort_param NEAR int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,char *, uint, uint); } MI_SORT_PARAM; + /* Some defines used by isam-funktions */ #define USE_WHOLE_KEY MI_MAX_KEY_BUFF*2 /* Use whole key in _mi_search() */ @@ -497,20 +498,20 @@ typedef struct st_mi_s_param /* Prototypes for intern functions */ -extern int _mi_read_dynamic_record(MI_INFO *info,my_off_t filepos,byte *buf); -extern int _mi_write_dynamic_record(MI_INFO*, const byte*); -extern int _mi_update_dynamic_record(MI_INFO*, my_off_t, const byte*); +extern int _mi_read_dynamic_record(MI_INFO *info,my_off_t filepos,uchar *buf); +extern int _mi_write_dynamic_record(MI_INFO*, const uchar*); +extern int _mi_update_dynamic_record(MI_INFO*, my_off_t, const uchar*); extern int _mi_delete_dynamic_record(MI_INFO *info); -extern int _mi_cmp_dynamic_record(MI_INFO *info,const byte *record); -extern int _mi_read_rnd_dynamic_record(MI_INFO *, byte *,my_off_t, my_bool); -extern int _mi_write_blob_record(MI_INFO*, const byte*); -extern int _mi_update_blob_record(MI_INFO*, my_off_t, const byte*); -extern int _mi_read_static_record(MI_INFO *info, my_off_t filepos,byte *buf); -extern int _mi_write_static_record(MI_INFO*, const byte*); -extern int _mi_update_static_record(MI_INFO*, my_off_t, const byte*); +extern int _mi_cmp_dynamic_record(MI_INFO *info,const uchar *record); +extern int _mi_read_rnd_dynamic_record(MI_INFO *, uchar *,my_off_t, my_bool); +extern int _mi_write_blob_record(MI_INFO*, const uchar*); +extern int _mi_update_blob_record(MI_INFO*, my_off_t, const uchar*); +extern int _mi_read_static_record(MI_INFO *info, my_off_t filepos,uchar *buf); +extern int _mi_write_static_record(MI_INFO*, const uchar*); +extern int _mi_update_static_record(MI_INFO*, my_off_t, const uchar*); extern int _mi_delete_static_record(MI_INFO *info); -extern int _mi_cmp_static_record(MI_INFO *info,const byte *record); -extern int _mi_read_rnd_static_record(MI_INFO*, byte *,my_off_t, my_bool); +extern int _mi_cmp_static_record(MI_INFO *info,const uchar *record); +extern int _mi_read_rnd_static_record(MI_INFO*, uchar *,my_off_t, my_bool); extern int _mi_ck_write(MI_INFO *info,uint keynr,uchar *key,uint length); extern int _mi_ck_real_write_btree(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, uint key_length, @@ -604,39 +605,39 @@ extern int _mi_dispose(MI_INFO *info,MI_KEYDEF *keyinfo,my_off_t pos, int level); extern my_off_t _mi_new(MI_INFO *info,MI_KEYDEF *keyinfo,int level); extern uint _mi_make_key(MI_INFO *info,uint keynr,uchar *key, - const byte *record,my_off_t filepos); + const uchar *record,my_off_t filepos); extern uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, key_part_map keypart_map, HA_KEYSEG **last_used_keyseg); -extern int _mi_read_key_record(MI_INFO *info,my_off_t filepos,byte *buf); -extern int _mi_read_cache(IO_CACHE *info,byte *buff,my_off_t pos, +extern int _mi_read_key_record(MI_INFO *info,my_off_t filepos,uchar *buf); +extern int _mi_read_cache(IO_CACHE *info,uchar *buff,my_off_t pos, uint length,int re_read_if_possibly); -extern ulonglong retrieve_auto_increment(MI_INFO *info,const byte *record); +extern ulonglong retrieve_auto_increment(MI_INFO *info,const uchar *record); -extern byte *mi_alloc_rec_buff(MI_INFO *,ulong, byte**); +extern uchar *mi_alloc_rec_buff(MI_INFO *,ulong, uchar**); #define mi_get_rec_buff_ptr(info,buf) \ ((((info)->s->options & HA_OPTION_PACK_RECORD) && (buf)) ? \ (buf) - MI_REC_BUFF_OFFSET : (buf)) #define mi_get_rec_buff_len(info,buf) \ (*((uint32 *)(mi_get_rec_buff_ptr(info,buf)))) -extern ulong _mi_rec_unpack(MI_INFO *info,byte *to,byte *from, +extern ulong _mi_rec_unpack(MI_INFO *info,uchar *to,uchar *from, ulong reclength); -extern my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *packpos, +extern my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *packpos, ulong packed_length, my_bool with_checkum); extern int _mi_write_part_record(MI_INFO *info,my_off_t filepos,ulong length, - my_off_t next_filepos,byte **record, + my_off_t next_filepos,uchar **record, ulong *reclength,int *flag); extern void _mi_print_key(FILE *stream,HA_KEYSEG *keyseg,const uchar *key, uint length); extern my_bool _mi_read_pack_info(MI_INFO *info,pbool fix_keys); -extern int _mi_read_pack_record(MI_INFO *info,my_off_t filepos,byte *buf); -extern int _mi_read_rnd_pack_record(MI_INFO*, byte *,my_off_t, my_bool); +extern int _mi_read_pack_record(MI_INFO *info,my_off_t filepos,uchar *buf); +extern int _mi_read_rnd_pack_record(MI_INFO*, uchar *,my_off_t, my_bool); extern int _mi_pack_rec_unpack(MI_INFO *info, MI_BIT_BUFF *bit_buff, - byte *to, byte *from, ulong reclength); + uchar *to, uchar *from, ulong reclength); extern ulonglong mi_safe_mul(ulonglong a,ulonglong b); -extern int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf, - const byte *oldrec, const byte *newrec, my_off_t pos); +extern int _mi_ft_update(MI_INFO *info, uint keynr, uchar *keybuf, + const uchar *oldrec, const uchar *newrec, my_off_t pos); struct st_sort_info; @@ -697,32 +698,32 @@ extern "C" { #endif extern uint _mi_get_block_info(MI_BLOCK_INFO *,File, my_off_t); -extern uint _mi_rec_pack(MI_INFO *info,byte *to,const byte *from); +extern uint _mi_rec_pack(MI_INFO *info,uchar *to,const uchar *from); extern uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, - MI_BLOCK_INFO *info, byte **rec_buff_p, + MI_BLOCK_INFO *info, uchar **rec_buff_p, File file, my_off_t filepos); -extern void _my_store_blob_length(byte *pos,uint pack_length,uint length); +extern void _my_store_blob_length(uchar *pos,uint pack_length,uint length); extern void _myisam_log(enum myisam_log_commands command,MI_INFO *info, - const byte *buffert,uint length); + const uchar *buffert,uint length); extern void _myisam_log_command(enum myisam_log_commands command, - MI_INFO *info, const byte *buffert, + MI_INFO *info, const uchar *buffert, uint length, int result); extern void _myisam_log_record(enum myisam_log_commands command,MI_INFO *info, - const byte *record,my_off_t filepos, + const uchar *record,my_off_t filepos, int result); extern void mi_report_error(int errcode, const char *file_name); extern my_bool _mi_memmap_file(MI_INFO *info); extern void _mi_unmap_file(MI_INFO *info); -extern uint save_pack_length(uint version, byte *block_buff, ulong length); +extern uint save_pack_length(uint version, uchar *block_buff, ulong length); extern uint read_pack_length(uint version, const uchar *buf, ulong *length); extern uint calc_pack_length(uint version, ulong length); -extern uint mi_mmap_pread(MI_INFO *info, byte *Buffer, +extern uint mi_mmap_pread(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags); -extern uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer, +extern uint mi_mmap_pwrite(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags); -extern uint mi_nommap_pread(MI_INFO *info, byte *Buffer, +extern uint mi_nommap_pread(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags); -extern uint mi_nommap_pwrite(MI_INFO *info, byte *Buffer, +extern uint mi_nommap_pwrite(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags); uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite); @@ -741,17 +742,17 @@ char *mi_recinfo_read(char *ptr, MI_COLUMNDEF *recinfo); extern int mi_disable_indexes(MI_INFO *info); extern int mi_enable_indexes(MI_INFO *info); extern int mi_indexes_are_disabled(MI_INFO *info); -ulong _my_calc_total_blob_length(MI_INFO *info, const byte *record); -ha_checksum mi_checksum(MI_INFO *info, const byte *buf); -ha_checksum mi_static_checksum(MI_INFO *info, const byte *buf); -my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record, +ulong _my_calc_total_blob_length(MI_INFO *info, const uchar *record); +ha_checksum mi_checksum(MI_INFO *info, const uchar *buf); +ha_checksum mi_static_checksum(MI_INFO *info, const uchar *buf); +my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record, ha_checksum unique_hash, my_off_t pos); -ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *buf); +ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *buf); int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def, - const byte *record, my_off_t pos); + const uchar *record, my_off_t pos); int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def, - const byte *record, my_off_t pos); -int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b, + const uchar *record, my_off_t pos); +int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b, my_bool null_are_equal); void mi_get_status(void* param, int concurrent_insert); void mi_update_status(void* param); diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c index 0bcf74d87a4..1cf4ad730cb 100644 --- a/storage/myisam/myisamlog.c +++ b/storage/myisam/myisamlog.c @@ -32,14 +32,14 @@ struct file_info { long process; int filenr,id; uint rnd; - my_string name,show_name,record; + char *name, *show_name, *record; MI_INFO *isam; bool closed,used; ulong accessed; }; struct test_if_open_param { - my_string name; + char * name; int max_id; }; @@ -53,24 +53,25 @@ struct st_access_param extern int main(int argc,char * *argv); static void get_options(int *argc,char ***argv); -static int examine_log(my_string file_name,char **table_names); -static int read_string(IO_CACHE *file,gptr *to,uint length); +static int examine_log(char * file_name,char **table_names); +static int read_string(IO_CACHE *file,uchar* *to,uint length); static int file_info_compare(void *cmp_arg, void *a,void *b); static int test_if_open(struct file_info *key,element_count count, struct test_if_open_param *param); -static void fix_blob_pointers(MI_INFO *isam,byte *record); +static void fix_blob_pointers(MI_INFO *isam,uchar *record); static int test_when_accessed(struct file_info *key,element_count count, struct st_access_param *access_param); static void file_info_free(struct file_info *info); static int close_some_file(TREE *tree); static int reopen_closed_file(TREE *tree,struct file_info *file_info); -static int find_record_with_key(struct file_info *file_info,byte *record); +static int find_record_with_key(struct file_info *file_info,uchar *record); static void printf_log(const char *str,...); -static bool cmp_filename(struct file_info *file_info,my_string name); +static bool cmp_filename(struct file_info *file_info,char * name); static uint verbose=0,update=0,test_info=0,max_files=0,re_open_count=0, recover=0,prefix_remove=0,opt_processes=0; -static my_string log_filename=0,filepath=0,write_filename=0,record_pos_file=0; +static char *log_filename=0, *filepath=0, *write_filename=0; +static char *record_pos_file= 0; static ulong com_count[10][3],number_of_commands=(ulong) ~0L, isamlog_process; static my_off_t isamlog_filepos,start_offset=0,record_pos= HA_OFFSET_ERROR; @@ -296,7 +297,7 @@ static void get_options(register int *argc, register char ***argv) } -static int examine_log(my_string file_name, char **table_names) +static int examine_log(char * file_name, char **table_names) { uint command,result,files_open; ulong access_time,length; @@ -304,7 +305,7 @@ static int examine_log(my_string file_name, char **table_names) int lock_command,mi_result; char isam_file_name[FN_REFLEN],llbuff[21],llbuff2[21]; uchar head[20]; - gptr buff; + uchar* buff; struct test_if_open_param open_param; IO_CACHE cache; File file; @@ -327,7 +328,7 @@ static int examine_log(my_string file_name, char **table_names) } init_io_cache(&cache,file,0,READ_CACHE,start_offset,0,MYF(0)); - bzero((gptr) com_count,sizeof(com_count)); + bzero((uchar*) com_count,sizeof(com_count)); init_tree(&tree,0,0,sizeof(file_info),(qsort_cmp2) file_info_compare,1, (tree_element_free) file_info_free, NULL); VOID(init_key_cache(dflt_key_cache,KEY_CACHE_BLOCK_SIZE,KEY_CACHE_SIZE, @@ -335,7 +336,7 @@ static int examine_log(my_string file_name, char **table_names) files_open=0; access_time=0; while (access_time++ != number_of_commands && - !my_b_read(&cache,(byte*) head,9)) + !my_b_read(&cache,(uchar*) head,9)) { isamlog_filepos=my_b_tell(&cache)-9L; file_info.filenr= mi_uint2korr(head+1); @@ -375,14 +376,15 @@ static int examine_log(my_string file_name, char **table_names) } if (curr_file_info) - printf("\nWarning: %s is opened with same process and filenumber\nMaybe you should use the -P option ?\n", + printf("\nWarning: %s is opened with same process and filenumber\n" + "Maybe you should use the -P option ?\n", curr_file_info->show_name); - if (my_b_read(&cache,(byte*) head,2)) + if (my_b_read(&cache,(uchar*) head,2)) goto err; file_info.name=0; file_info.show_name=0; file_info.record=0; - if (read_string(&cache,(gptr*) &file_info.name, + if (read_string(&cache,(uchar**) &file_info.name, (uint) mi_uint2korr(head))) goto err; { @@ -455,7 +457,7 @@ static int examine_log(my_string file_name, char **table_names) files_open++; file_info.closed=0; } - VOID(tree_insert(&tree, (gptr) &file_info, 0, tree.custom_arg)); + VOID(tree_insert(&tree, (uchar*) &file_info, 0, tree.custom_arg)); if (file_info.used) { if (verbose && !record_pos_file) @@ -474,11 +476,11 @@ static int examine_log(my_string file_name, char **table_names) { if (!curr_file_info->closed) files_open--; - VOID(tree_delete(&tree, (gptr) curr_file_info, 0, tree.custom_arg)); + VOID(tree_delete(&tree, (uchar*) curr_file_info, 0, tree.custom_arg)); } break; case MI_LOG_EXTRA: - if (my_b_read(&cache,(byte*) head,1)) + if (my_b_read(&cache,(uchar*) head,1)) goto err; extra_command=(enum ha_extra_function) head[0]; if (verbose && !record_pos_file && @@ -499,7 +501,7 @@ static int examine_log(my_string file_name, char **table_names) } break; case MI_LOG_DELETE: - if (my_b_read(&cache,(byte*) head,8)) + if (my_b_read(&cache,(uchar*) head,8)) goto err; filepos=mi_sizekorr(head); if (verbose && (!record_pos_file || @@ -534,7 +536,7 @@ static int examine_log(my_string file_name, char **table_names) break; case MI_LOG_WRITE: case MI_LOG_UPDATE: - if (my_b_read(&cache,(byte*) head,12)) + if (my_b_read(&cache,(uchar*) head,12)) goto err; filepos=mi_sizekorr(head); length=mi_uint4korr(head+8); @@ -616,7 +618,7 @@ static int examine_log(my_string file_name, char **table_names) my_free(buff,MYF(0)); break; case MI_LOG_LOCK: - if (my_b_read(&cache,(byte*) head,sizeof(lock_command))) + if (my_b_read(&cache,(uchar*) head,sizeof(lock_command))) goto err; memcpy_fixed(&lock_command,head,sizeof(lock_command)); if (verbose && !record_pos_file && @@ -675,14 +677,14 @@ static int examine_log(my_string file_name, char **table_names) } -static int read_string(IO_CACHE *file, register gptr *to, register uint length) +static int read_string(IO_CACHE *file, register uchar* *to, register uint length) { DBUG_ENTER("read_string"); if (*to) - my_free((gptr) *to,MYF(0)); - if (!(*to= (gptr) my_malloc(length+1,MYF(MY_WME))) || - my_b_read(file,(byte*) *to,length)) + my_free((uchar*) *to,MYF(0)); + if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) || + my_b_read(file,(uchar*) *to,length)) { if (*to) my_free(*to,MYF(0)); @@ -717,9 +719,9 @@ static int test_if_open (struct file_info *key, } -static void fix_blob_pointers(MI_INFO *info, byte *record) +static void fix_blob_pointers(MI_INFO *info, uchar *record) { - byte *pos; + uchar *pos; MI_BLOB *blob,*end; pos=record+info->s->base.reclength; @@ -801,7 +803,7 @@ static int reopen_closed_file(TREE *tree, struct file_info *fileinfo) /* Try to find record with uniq key */ -static int find_record_with_key(struct file_info *file_info, byte *record) +static int find_record_with_key(struct file_info *file_info, uchar *record) { uint key; MI_INFO *info=file_info->isam; @@ -836,7 +838,7 @@ static void printf_log(const char *format,...) } -static bool cmp_filename(struct file_info *file_info, my_string name) +static bool cmp_filename(struct file_info *file_info, char * name) { if (!file_info) return 1; diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index fb631b5e63e..5f7c4ee8f2e 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -69,8 +69,8 @@ typedef struct st_huff_counts { my_off_t pre_space[8]; my_off_t tot_end_space,tot_pre_space,zero_fields,empty_fields,bytes_packed; TREE int_tree; /* Tree for detecting distinct column values. */ - byte *tree_buff; /* Column values, 'field_length' each. */ - byte *tree_pos; /* Points to end of column values in 'tree_buff'. */ + uchar *tree_buff; /* Column values, 'field_length' each. */ + uchar *tree_pos; /* Points to end of column values in 'tree_buff'. */ } HUFF_COUNTS; typedef struct st_huff_element HUFF_ELEMENT; @@ -141,8 +141,8 @@ static int test_space_compress(HUFF_COUNTS *huff_counts,my_off_t records, enum en_fieldtype field_type); static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts,uint trees); static int make_huff_tree(HUFF_TREE *tree,HUFF_COUNTS *huff_counts); -static int compare_huff_elements(void *not_used, byte *a,byte *b); -static int save_counts_in_queue(byte *key,element_count count, +static int compare_huff_elements(void *not_used, uchar *a,uchar *b); +static int save_counts_in_queue(uchar *key,element_count count, HUFF_TREE *tree); static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,uint flag); static uint join_same_trees(HUFF_COUNTS *huff_counts,uint trees); @@ -171,7 +171,7 @@ static int save_state(MI_INFO *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length, static int save_state_mrg(File file,PACK_MRG_INFO *isam_file,my_off_t new_length, ha_checksum crc); static int mrg_close(PACK_MRG_INFO *mrg); -static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf); +static int mrg_rrnd(PACK_MRG_INFO *info,uchar *buf); static void mrg_reset(PACK_MRG_INFO *mrg); #if !defined(DBUG_OFF) static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count); @@ -257,10 +257,10 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"backup", 'b', "Make a backup of the table as table_name.OLD.", - (gptr*) &backup, (gptr*) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + (uchar**) &backup, (uchar**) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR_MP, - "Directory where character sets are.", (gptr*) &charsets_dir, - (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + "Directory where character sets are.", (uchar**) &charsets_dir, + (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"force", 'f', @@ -268,7 +268,7 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"join", 'j', "Join all given tables into 'new_table_name'. All tables MUST have identical layouts.", - (gptr*) &join_table, (gptr*) &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, + (uchar**) &join_table, (uchar**) &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -282,8 +282,8 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"wait", 'w', "Wait and retry if table is in use.", (gptr*) &opt_wait, - (gptr*) &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"wait", 'w', "Wait and retry if table is in use.", (uchar**) &opt_wait, + (uchar**) &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -478,7 +478,7 @@ static bool open_isam_files(PACK_MRG_INFO *mrg,char **names,uint count) error: while (i--) mi_close(mrg->file[i]); - my_free((gptr) mrg->file,MYF(0)); + my_free((uchar*) mrg->file,MYF(0)); return 1; } @@ -811,11 +811,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees, for (i=0 ; i < trees ; i++) { if (huff_trees[i].element_buffer) - my_free((gptr) huff_trees[i].element_buffer,MYF(0)); + my_free((uchar*) huff_trees[i].element_buffer,MYF(0)); if (huff_trees[i].code) - my_free((gptr) huff_trees[i].code,MYF(0)); + my_free((uchar*) huff_trees[i].code,MYF(0)); } - my_free((gptr) huff_trees,MYF(0)); + my_free((uchar*) huff_trees,MYF(0)); } if (huff_counts) { @@ -823,11 +823,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees, { if (huff_counts[i].tree_buff) { - my_free((gptr) huff_counts[i].tree_buff,MYF(0)); + my_free((uchar*) huff_counts[i].tree_buff,MYF(0)); delete_tree(&huff_counts[i].int_tree); } } - my_free((gptr) huff_counts,MYF(0)); + my_free((uchar*) huff_counts,MYF(0)); } delete_queue(&queue); /* This is safe to free */ return; @@ -840,7 +840,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) int error; uint length; ulong reclength,max_blob_length; - byte *record,*pos,*next_pos,*end_pos,*start_pos; + uchar *record,*pos,*next_pos,*end_pos,*start_pos; ha_rows record_count; my_bool static_row_size; HUFF_COUNTS *count,*end_count; @@ -848,7 +848,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) DBUG_ENTER("get_statistic"); reclength=mrg->file[0]->s->base.reclength; - record=(byte*) my_alloca(reclength); + record=(uchar*) my_alloca(reclength); end_count=huff_counts+mrg->file[0]->s->base.fields; record_count=0; glob_crc=0; max_blob_length=0; @@ -1032,7 +1032,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) { uint i; /* Zero fields are just counted. Go to the next record. */ - if (!memcmp((byte*) start_pos,zero_string,count->field_length)) + if (!memcmp((uchar*) start_pos,zero_string,count->field_length)) { count->zero_fields++; continue; @@ -1141,12 +1141,12 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) mrg->records=record_count; mrg->max_blob_length=max_blob_length; - my_afree((gptr) record); + my_afree((uchar*) record); DBUG_RETURN(error != HA_ERR_END_OF_FILE); } static int compare_huff_elements(void *not_used __attribute__((unused)), - byte *a, byte *b) + uchar *a, uchar *b) { return *((my_off_t*) a) < *((my_off_t*) b) ? -1 : (*((my_off_t*) a) == *((my_off_t*) b) ? 0 : 1); @@ -1162,7 +1162,7 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees, my_off_t old_length,new_length,length; DBUG_ENTER("check_counts"); - bzero((gptr) field_count,sizeof(field_count)); + bzero((uchar*) field_count,sizeof(field_count)); space_fields=fill_zero_fields=0; for (; trees-- ; huff_counts++) @@ -1328,12 +1328,12 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees, } else { - my_free((gptr) huff_counts->tree_buff,MYF(0)); + my_free((uchar*) huff_counts->tree_buff,MYF(0)); delete_tree(&huff_counts->int_tree); huff_counts->tree_buff=0; } if (tree.element_buffer) - my_free((gptr) tree.element_buffer,MYF(0)); + my_free((uchar*) tree.element_buffer,MYF(0)); } if (huff_counts->pack_type & PACK_TYPE_SPACE_FIELDS) space_fields++; @@ -1450,8 +1450,8 @@ static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts, uint trees) if (make_huff_tree(huff_tree+tree,huff_counts+tree)) { while (tree--) - my_free((gptr) huff_tree[tree].element_buffer,MYF(0)); - my_free((gptr) huff_tree,MYF(0)); + my_free((uchar*) huff_tree[tree].element_buffer,MYF(0)); + my_free((uchar*) huff_tree,MYF(0)); DBUG_RETURN(0); } } @@ -1526,7 +1526,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts) { HUFF_ELEMENT *temp; if (!(temp= - (HUFF_ELEMENT*) my_realloc((gptr) huff_tree->element_buffer, + (HUFF_ELEMENT*) my_realloc((uchar*) huff_tree->element_buffer, found*2*sizeof(HUFF_ELEMENT), MYF(MY_WME)))) return 1; @@ -1561,7 +1561,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts) */ tree_walk(&huff_counts->int_tree, (int (*)(void*, element_count,void*)) save_counts_in_queue, - (gptr) huff_tree, left_root_right); + (uchar*) huff_tree, left_root_right); } else { @@ -1587,7 +1587,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts) new_huff_el->count=huff_counts->counts[i]; new_huff_el->a.leaf.null=0; new_huff_el->a.leaf.element_nr=i; - queue.root[found]=(byte*) new_huff_el; + queue.root[found]=(uchar*) new_huff_el; } } /* @@ -1604,7 +1604,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts) new_huff_el->a.leaf.element_nr=huff_tree->min_chr=last-1; else new_huff_el->a.leaf.element_nr=huff_tree->max_chr=last+1; - queue.root[found]=(byte*) new_huff_el; + queue.root[found]=(uchar*) new_huff_el; } } @@ -1654,7 +1654,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts) Replace the copied top element by the new element and re-order the queue. */ - queue.root[1]=(byte*) new_huff_el; + queue.root[1]=(uchar*) new_huff_el; queue_replaced(&queue); } huff_tree->root=(HUFF_ELEMENT*) queue.root[1]; @@ -1693,7 +1693,7 @@ static int compare_tree(void* cmp_arg __attribute__((unused)), 0 */ -static int save_counts_in_queue(byte *key, element_count count, +static int save_counts_in_queue(uchar *key, element_count count, HUFF_TREE *tree) { HUFF_ELEMENT *new_huff_el; @@ -1703,7 +1703,7 @@ static int save_counts_in_queue(byte *key, element_count count, new_huff_el->a.leaf.null=0; new_huff_el->a.leaf.element_nr= (uint) (key- tree->counts->tree_buff) / tree->counts->field_length; - queue.root[tree->elements]=(byte*) new_huff_el; + queue.root[tree->elements]=(uchar*) new_huff_el; return 0; } @@ -1760,7 +1760,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts, first=i; last=i; /* We start with root[1], which is the queues top element. */ - queue.root[found]=(byte*) &huff_counts->counts[i]; + queue.root[found]=(uchar*) &huff_counts->counts[i]; } } if (!found) @@ -1771,7 +1771,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts, the loop, which follows the Huffman algorithm. */ if (found < 2) - queue.root[++found]=(byte*) &huff_counts->counts[last ? 0 : 1]; + queue.root[++found]=(uchar*) &huff_counts->counts[last ? 0 : 1]; /* Make a queue from the queue buffer. */ queue.elements=found; @@ -1826,7 +1826,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts, queue. This successively replaces the references to counts by references to HUFF_ELEMENTs. */ - queue.root[1]=(byte*) new_huff_el; + queue.root[1]=(uchar*) new_huff_el; queue_replaced(&queue); } DBUG_RETURN(bytes_packed+(bits_packed+7)/8); @@ -1859,12 +1859,12 @@ static uint join_same_trees(HUFF_COUNTS *huff_counts, uint trees) i->tree->tree_pack_length+j->tree->tree_pack_length+ ALLOWED_JOIN_DIFF) { - memcpy_fixed((byte*) i->counts,(byte*) count.counts, + memcpy_fixed((uchar*) i->counts,(uchar*) count.counts, sizeof(count.counts[0])*256); - my_free((gptr) j->tree->element_buffer,MYF(0)); + my_free((uchar*) j->tree->element_buffer,MYF(0)); j->tree->element_buffer=0; j->tree=i->tree; - bmove((byte*) i->counts,(byte*) count.counts, + bmove((uchar*) i->counts,(uchar*) count.counts, sizeof(count.counts[0])*256); if (make_huff_tree(i->tree,i)) return (uint) -1; @@ -2007,7 +2007,7 @@ static char *hexdigits(ulonglong value) static int write_header(PACK_MRG_INFO *mrg,uint head_length,uint trees, my_off_t tot_elements,my_off_t filelength) { - byte *buff= (byte*) file_buffer.pos; + uchar *buff= (uchar*) file_buffer.pos; bzero(buff,HEAD_LENGTH); memcpy_fixed(buff,myisam_pack_file_magic,4); @@ -2023,7 +2023,7 @@ static int write_header(PACK_MRG_INFO *mrg,uint head_length,uint trees, if (test_only) return 0; VOID(my_seek(file_buffer.file,0L,MY_SEEK_SET,MYF(0))); - return my_write(file_buffer.file,(const byte *) file_buffer.pos,HEAD_LENGTH, + return my_write(file_buffer.file,(const uchar *) file_buffer.pos,HEAD_LENGTH, MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)) != 0; } @@ -2159,7 +2159,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees) { /* This should be impossible */ VOID(fprintf(stderr, "Tree offset got too big: %d, aborted\n", huff_tree->max_offset)); - my_afree((gptr) packed_tree); + my_afree((uchar*) packed_tree); return 0; } @@ -2331,7 +2331,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees) DBUG_PRINT("info", (" ")); if (verbose >= 2) VOID(printf("\n")); - my_afree((gptr) packed_tree); + my_afree((uchar*) packed_tree); if (errors) { VOID(fprintf(stderr, "Error: Generated decode trees are corrupt. Stop.\n")); @@ -2412,7 +2412,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) my_off_t record_count; char llbuf[32]; ulong length,pack_length; - byte *record,*pos,*end_pos,*record_pos,*start_pos; + uchar *record,*pos,*end_pos,*record_pos,*start_pos; HUFF_COUNTS *count,*end_count; HUFF_TREE *tree; MI_INFO *isam_file=mrg->file[0]; @@ -2420,7 +2420,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) DBUG_ENTER("compress_isam_file"); /* Allocate a buffer for the records (excluding blobs). */ - if (!(record=(byte*) my_alloca(isam_file->s->base.reclength))) + if (!(record=(uchar*) my_alloca(isam_file->s->base.reclength))) return -1; end_count=huff_counts+isam_file->s->base.fields; @@ -2471,7 +2471,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) { if (flush_buffer((ulong) max_calc_length + (ulong) max_pack_length)) break; - record_pos= (byte*) file_buffer.pos; + record_pos= (uchar*) file_buffer.pos; file_buffer.pos+=max_pack_length; for (start_pos=record, count= huff_counts; count < end_count ; count++) { @@ -2508,7 +2508,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) switch (count->field_type) { case FIELD_SKIP_ZERO: - if (!memcmp((byte*) start_pos,zero_string,field_length)) + if (!memcmp((uchar*) start_pos,zero_string,field_length)) { DBUG_PRINT("fields", ("FIELD_SKIP_ZERO zeroes only, bits: 1")); write_bits(1,1); @@ -2637,7 +2637,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) break; case FIELD_INTERVALL: global_count=count; - pos=(byte*) tree_search(&count->int_tree, start_pos, + pos=(uchar*) tree_search(&count->int_tree, start_pos, count->int_tree.custom_arg); intervall=(uint) (pos - count->tree_buff)/field_length; DBUG_PRINT("fields", ("FIELD_INTERVALL")); @@ -2660,7 +2660,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) } else { - byte *blob,*blob_end; + uchar *blob,*blob_end; DBUG_PRINT("fields", ("FIELD_BLOB not empty, bits: 1")); write_bits(0,1); /* Write the blob length. */ @@ -2701,7 +2701,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) } else { - byte *end= start_pos + var_pack_length + col_length; + uchar *end= start_pos + var_pack_length + col_length; DBUG_PRINT("fields", ("FIELD_VARCHAR not empty, bits: 1")); write_bits(0,1); /* Write the varchar length. */ @@ -2733,7 +2733,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) DBUG_PRINT("fields", ("---")); } flush_bits(); - length=(ulong) ((byte*) file_buffer.pos - record_pos) - max_pack_length; + length=(ulong) ((uchar*) file_buffer.pos - record_pos) - max_pack_length; pack_length= save_pack_length(pack_version, record_pos, length); if (pack_blob_length) pack_length+= save_pack_length(pack_version, record_pos + pack_length, @@ -2773,7 +2773,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) if (verbose >= 2) VOID(printf("wrote %s records.\n", llstr((longlong) record_count, llbuf))); - my_afree((gptr) record); + my_afree((uchar*) record); mrg->ref_length=max_pack_length; mrg->min_pack_length=max_record_length ? min_record_length : 0; mrg->max_pack_length=max_record_length; @@ -2840,7 +2840,7 @@ static int flush_buffer(ulong neaded_length) if (test_only) return 0; if (error_on_write|| my_write(file_buffer.file, - (const byte*) file_buffer.buffer, + (const uchar*) file_buffer.buffer, length, MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL))) { @@ -2867,7 +2867,7 @@ static int flush_buffer(ulong neaded_length) static void end_file_buffer(void) { - my_free((gptr) file_buffer.buffer,MYF(0)); + my_free((uchar*) file_buffer.buffer,MYF(0)); } /* output `bits` low bits of `value' */ @@ -3025,7 +3025,7 @@ static void mrg_reset(PACK_MRG_INFO *mrg) } } -static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf) +static int mrg_rrnd(PACK_MRG_INFO *info,uchar *buf) { int error; MI_INFO *isam_info; @@ -3048,7 +3048,7 @@ static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf) for (;;) { isam_info->update&= HA_STATE_CHANGED; - if (!(error=(*isam_info->s->read_rnd)(isam_info,(byte*) buf, + if (!(error=(*isam_info->s->read_rnd)(isam_info,(uchar*) buf, filepos, 1)) || error != HA_ERR_END_OF_FILE) return (error); @@ -3071,7 +3071,7 @@ static int mrg_close(PACK_MRG_INFO *mrg) for (i=0 ; i < mrg->count ; i++) error|=mi_close(mrg->file[i]); if (mrg->free_file) - my_free((gptr) mrg->file,MYF(0)); + my_free((uchar*) mrg->file,MYF(0)); return error; } @@ -3134,7 +3134,7 @@ static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count) */ if (huff_counts->tree_buff) { - my_free((gptr) huff_counts->tree_buff, MYF(0)); + my_free((uchar*) huff_counts->tree_buff, MYF(0)); delete_tree(&huff_counts->int_tree); huff_counts->tree_buff= NULL; DBUG_PRINT("fakebigcodes", ("freed distinct column values")); diff --git a/storage/myisam/rt_index.c b/storage/myisam/rt_index.c index cf144839dd1..63ed60586d6 100644 --- a/storage/myisam/rt_index.c +++ b/storage/myisam/rt_index.c @@ -141,11 +141,11 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag, res = 1; ok: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); return res; err1: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); info->lastpos = HA_OFFSET_ERROR; return -1; } @@ -356,11 +356,11 @@ static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length, res = 1; ok: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); return res; err1: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); info->lastpos = HA_OFFSET_ERROR; return -1; } @@ -602,11 +602,11 @@ static int rtree_insert_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, } ok: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); DBUG_RETURN(res); err1: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); DBUG_RETURN(-1); /* purecov: inspected */ } @@ -690,10 +690,10 @@ static int rtree_insert_level(MI_INFO *info, uint keynr, uchar *key, DBUG_PRINT("rtree", ("new root page: %lu level: %d nod_flag: %u", (ulong) new_root, 0, mi_test_if_nod(new_root_buf))); - my_afree((byte*)new_root_buf); + my_afree((uchar*)new_root_buf); break; err1: - my_afree((byte*)new_root_buf); + my_afree((uchar*)new_root_buf); DBUG_RETURN(-1); /* purecov: inspected */ } default: @@ -739,7 +739,7 @@ static int rtree_fill_reinsert_list(stPageList *ReinsertList, my_off_t page, if (ReinsertList->n_pages == ReinsertList->m_pages) { ReinsertList->m_pages += REINSERT_BUFFER_INC; - if (!(ReinsertList->pages = (stPageLevel*)my_realloc((gptr)ReinsertList->pages, + if (!(ReinsertList->pages = (stPageLevel*)my_realloc((uchar*)ReinsertList->pages, ReinsertList->m_pages * sizeof(stPageLevel), MYF(MY_ALLOW_ZERO_PTR)))) goto err1; } @@ -891,11 +891,11 @@ static int rtree_delete_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, res = 1; ok: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); DBUG_RETURN(res); err1: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); DBUG_RETURN(-1); /* purecov: inspected */ } @@ -968,7 +968,7 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length) if ((res= rtree_insert_level(info, keynr, k, key_length, ReinsertList.pages[i].level)) == -1) { - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); goto err1; } if (res) @@ -984,13 +984,13 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length) } } } - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); if (_mi_dispose(info, keyinfo, ReinsertList.pages[i].offs, DFLT_INIT_HITS)) goto err1; } if (ReinsertList.pages) - my_free((byte*) ReinsertList.pages, MYF(0)); + my_free((uchar*) ReinsertList.pages, MYF(0)); /* check for redundant root (not leaf, 1 child) and eliminate */ if ((old_root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR) @@ -1117,11 +1117,11 @@ ha_rows rtree_estimate(MI_INFO *info, uint keynr, uchar *key, res = HA_POS_ERROR; } - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); return res; err1: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); return HA_POS_ERROR; } diff --git a/storage/myisam/rt_split.c b/storage/myisam/rt_split.c index 0f6dc872958..ef988dbd048 100644 --- a/storage/myisam/rt_split.c +++ b/storage/myisam/rt_split.c @@ -345,10 +345,10 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key, DFLT_INIT_HITS, new_page); DBUG_PRINT("rtree", ("split new block: %lu", (ulong) *new_page_offs)); - my_afree((byte*)new_page); + my_afree((uchar*)new_page); split_err: - my_afree((byte*) coord_buf); + my_afree((uchar*) coord_buf); DBUG_RETURN(err_code); } diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index 1d4d15c7b25..2abfa749d46 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -84,7 +84,7 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, char* key, uint sort_length, uint count); static inline int -my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs); +my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs); /* Creates a index of sorted keys @@ -163,7 +163,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer, maxbuffer/2)) { - my_free((gptr) sort_keys,MYF(0)); + my_free((uchar*) sort_keys,MYF(0)); sort_keys= 0; } else @@ -230,9 +230,9 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, reinit_io_cache(&tempfile_for_exceptions,READ_CACHE,0L,0,0)) goto err; - while (!my_b_read(&tempfile_for_exceptions,(byte*)&key_length, + while (!my_b_read(&tempfile_for_exceptions,(uchar*)&key_length, sizeof(key_length)) - && !my_b_read(&tempfile_for_exceptions,(byte*)sort_keys, + && !my_b_read(&tempfile_for_exceptions,(uchar*)sort_keys, (uint) key_length)) { if (_mi_ck_write(idx,keyno,(uchar*) sort_keys,key_length-ref_length)) @@ -244,7 +244,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, err: if (sort_keys) - my_free((gptr) sort_keys,MYF(0)); + my_free((uchar*) sort_keys,MYF(0)); delete_dynamic(&buffpek); close_cached_file(&tempfile); close_cached_file(&tempfile_for_exceptions); @@ -383,7 +383,7 @@ pthread_handler_t thr_find_all_keys(void *arg) if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK), maxbuffer, maxbuffer/2)) { - my_free((gptr) sort_keys,MYF(0)); + my_free((uchar*) sort_keys,MYF(0)); sort_keys= (uchar **) NULL; /* for err: label */ } else @@ -453,7 +453,7 @@ err: DBUG_PRINT("error", ("got some error")); sort_param->sort_info->got_error= 1; /* no need to protect with a mutex */ if (sort_keys) - my_free((gptr) sort_keys,MYF(0)); + my_free((uchar*) sort_keys,MYF(0)); sort_param->sort_keys= 0; delete_dynamic(& sort_param->buffpek); close_cached_file(&sort_param->tempfile); @@ -495,7 +495,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) MI_INFO *info=sort_info->info; MYISAM_SHARE *share=info->s; MI_SORT_PARAM *sinfo; - byte *mergebuf=0; + uchar *mergebuf=0; DBUG_ENTER("thr_write_keys"); LINT_INIT(length); @@ -530,7 +530,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) sinfo->notnull: NULL, (ulonglong) info->state->records); } - my_free((gptr) sinfo->sort_keys,MYF(0)); + my_free((uchar*) sinfo->sort_keys,MYF(0)); my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff), MYF(MY_ALLOW_ZERO_PTR)); sinfo->sort_keys=0; @@ -621,12 +621,12 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) } while (!got_error && - !my_b_read(&sinfo->tempfile_for_exceptions,(byte*)&key_length, + !my_b_read(&sinfo->tempfile_for_exceptions,(uchar*)&key_length, sizeof(key_length))) { - byte ft_buf[HA_FT_MAXBYTELEN + HA_FT_WLEN + 10]; + uchar ft_buf[HA_FT_MAXBYTELEN + HA_FT_WLEN + 10]; if (key_length > sizeof(ft_buf) || - my_b_read(&sinfo->tempfile_for_exceptions, (byte*)ft_buf, + my_b_read(&sinfo->tempfile_for_exceptions, (uchar*)ft_buf, (uint)key_length) || _mi_ck_write(info, sinfo->key, (uchar*)ft_buf, key_length - info->s->rec_reflength)) @@ -634,7 +634,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) } } } - my_free((gptr) mergebuf,MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) mergebuf,MYF(MY_ALLOW_ZERO_PTR)); DBUG_RETURN(got_error); } #endif /* THREAD */ @@ -648,7 +648,7 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, uint sort_length=info->key_length; DBUG_ENTER("write_keys"); - qsort2((byte*) sort_keys,count,sizeof(byte*),(qsort2_cmp) info->key_cmp, + qsort2((uchar*) sort_keys,count,sizeof(uchar*),(qsort2_cmp) info->key_cmp, info); if (!my_b_inited(tempfile) && open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST", @@ -660,7 +660,7 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, for (end=sort_keys+count ; sort_keys != end ; sort_keys++) { - if (my_b_write(tempfile,(byte*) *sort_keys,(uint) sort_length)) + if (my_b_write(tempfile,(uchar*) *sort_keys,(uint) sort_length)) DBUG_RETURN(1); /* purecov: inspected */ } DBUG_RETURN(0); @@ -668,13 +668,13 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, static inline int -my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs) +my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs) { int err; uint16 len = _mi_keylength(info->keyinfo, (uchar*) bufs); /* The following is safe as this is a local file */ - if ((err= my_b_write(to_file, (byte*)&len, sizeof(len)))) + if ((err= my_b_write(to_file, (uchar*)&len, sizeof(len)))) return (err); if ((err= my_b_write(to_file,bufs, (uint) len))) return (err); @@ -691,7 +691,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, int err; DBUG_ENTER("write_keys_varlen"); - qsort2((byte*) sort_keys,count,sizeof(byte*),(qsort2_cmp) info->key_cmp, + qsort2((uchar*) sort_keys,count,sizeof(uchar*),(qsort2_cmp) info->key_cmp, info); if (!my_b_inited(tempfile) && open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST", @@ -702,7 +702,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, buffpek->count=count; for (end=sort_keys+count ; sort_keys != end ; sort_keys++) { - if ((err= my_var_write(info,tempfile, (byte*) *sort_keys))) + if ((err= my_var_write(info,tempfile, (uchar*) *sort_keys))) DBUG_RETURN(err); } DBUG_RETURN(0); @@ -720,8 +720,8 @@ static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key, DISK_BUFFER_SIZE, info->sort_info->param->myf_rw)) DBUG_RETURN(1); - if (my_b_write(tempfile,(byte*)&key_length,sizeof(key_length)) || - my_b_write(tempfile,(byte*)key,(uint) key_length)) + if (my_b_write(tempfile,(uchar*)&key_length,sizeof(key_length)) || + my_b_write(tempfile,(uchar*)key,(uint) key_length)) DBUG_RETURN(1); DBUG_RETURN(0); } /* write_key */ @@ -734,7 +734,7 @@ static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys, { DBUG_ENTER("write_index"); - qsort2((gptr) sort_keys,(size_t) count,sizeof(byte*), + qsort2((uchar*) sort_keys,(size_t) count,sizeof(uchar*), (qsort2_cmp) info->key_cmp,info); while (count--) { @@ -813,7 +813,7 @@ static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count))) { - if (my_pread(fromfile->file,(byte*) buffpek->base, + if (my_pread(fromfile->file,(uchar*) buffpek->base, (length= sort_length*count),buffpek->file_pos,MYF_RW)) return((uint) -1); /* purecov: inspected */ buffpek->key=buffpek->base; @@ -838,11 +838,11 @@ static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek, for (idx=1;idx<=count;idx++) { - if (my_pread(fromfile->file,(byte*)&length_of_key,sizeof(length_of_key), + if (my_pread(fromfile->file,(uchar*)&length_of_key,sizeof(length_of_key), buffpek->file_pos,MYF_RW)) return((uint) -1); buffpek->file_pos+=sizeof(length_of_key); - if (my_pread(fromfile->file,(byte*) buffp,length_of_key, + if (my_pread(fromfile->file,(uchar*) buffp,length_of_key, buffpek->file_pos,MYF_RW)) return((uint) -1); buffpek->file_pos+=length_of_key; @@ -866,7 +866,7 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, for (idx=1;idx<=count;idx++) { int err; - if ((err= my_var_write(info,to_file, (byte*) bufs))) + if ((err= my_var_write(info,to_file, (uchar*) bufs))) return (err); bufs=bufs+sort_length; } @@ -878,7 +878,7 @@ static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)), IO_CACHE *to_file, char* key, uint sort_length, uint count) { - return my_b_write(to_file,(byte*) key,(uint) sort_length*count); + return my_b_write(to_file,(uchar*) key,(uint) sort_length*count); } /* @@ -910,7 +910,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, sort_length=info->key_length; if (init_queue(&queue,(uint) (Tb-Fb)+1,offsetof(BUFFPEK,key),0, - (int (*)(void*, byte *,byte*)) info->key_cmp, + (int (*)(void*, uchar *,uchar*)) info->key_cmp, (void*) info)) DBUG_RETURN(1); /* purecov: inspected */ @@ -937,7 +937,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, buffpek=(BUFFPEK*) queue_top(&queue); if (to_file) { - if (info->write_key(info,to_file,(byte*) buffpek->key, + if (info->write_key(info,to_file,(uchar*) buffpek->key, (uint) sort_length,1)) { error=1; goto err; /* purecov: inspected */ @@ -993,7 +993,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, { if (to_file) { - if (info->write_key(info,to_file,(byte*) buffpek->key, + if (info->write_key(info,to_file,(uchar*) buffpek->key, sort_length,buffpek->mem_count)) { error=1; goto err; /* purecov: inspected */ @@ -1046,7 +1046,7 @@ flush_ft_buf(MI_SORT_PARAM *info) if (info->sort_info->ft_buf) { err=sort_ft_buf_flush(info); - my_free((gptr)info->sort_info->ft_buf, MYF(0)); + my_free((uchar*)info->sort_info->ft_buf, MYF(0)); info->sort_info->ft_buf=0; } return err; diff --git a/storage/myisam/sp_defs.h b/storage/myisam/sp_defs.h index 11254d16c97..187ec62b2a3 100644 --- a/storage/myisam/sp_defs.h +++ b/storage/myisam/sp_defs.h @@ -40,7 +40,7 @@ enum wkbByteOrder }; uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key, - const byte *record, my_off_t filepos); + const uchar *record, my_off_t filepos); #endif /*HAVE_SPATIAL*/ #endif /* _SP_DEFS_H */ diff --git a/storage/myisam/sp_key.c b/storage/myisam/sp_key.c index 34c96a219c7..be4021935c4 100644 --- a/storage/myisam/sp_key.c +++ b/storage/myisam/sp_key.c @@ -31,25 +31,25 @@ static int sp_get_geometry_mbr(uchar *(*wkb), uchar *end, uint n_dims, double *mbr, int top); static int sp_mbr_from_wkb(uchar (*wkb), uint size, uint n_dims, double *mbr); -static void get_double(double *d, const byte *pos) +static void get_double(double *d, const uchar *pos) { float8get(*d, pos); } uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key, - const byte *record, my_off_t filepos) + const uchar *record, my_off_t filepos) { HA_KEYSEG *keyseg; MI_KEYDEF *keyinfo = &info->s->keyinfo[keynr]; uint len = 0; - byte *pos; + uchar *pos; uint dlen; uchar *dptr; double mbr[SPDIMS * 2]; uint i; keyseg = &keyinfo->seg[-1]; - pos = (byte*)record + keyseg->start; + pos = (uchar*)record + keyseg->start; dlen = _mi_calc_blob_length(keyseg->bit_start, pos); memcpy_fixed(&dptr, pos + keyseg->bit_start, sizeof(char*)); @@ -64,7 +64,7 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key, { uint length = keyseg->length; - pos = ((byte*)mbr) + keyseg->start; + pos = ((uchar*)mbr) + keyseg->start; if (keyseg->flag & HA_SWAP_KEY) { #ifdef HAVE_ISNAN @@ -100,7 +100,7 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key, } else { - memcpy((byte*)key, pos, length); + memcpy((uchar*)key, pos, length); key += keyseg->length; } len += keyseg->length; @@ -141,7 +141,7 @@ static int sp_add_point_to_mbr(uchar *(*wkb), uchar *end, uint n_dims, { if ((*wkb) > end - 8) return -1; - get_double(&ord, (const byte*) *wkb); + get_double(&ord, (const uchar*) *wkb); (*wkb)+= 8; if (ord < *mbr) float8store((char*) mbr, ord); |