diff options
Diffstat (limited to 'storage')
135 files changed, 1429 insertions, 1442 deletions
diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c index 14018217dea..d3c11f1dce2 100644 --- a/storage/archive/archive_reader.c +++ b/storage/archive/archive_reader.c @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) if (opt_check) { - byte size_buffer[ARCHIVE_ROW_HEADER_SIZE]; + uchar size_buffer[ARCHIVE_ROW_HEADER_SIZE]; int error; unsigned int x; unsigned int read; @@ -118,7 +118,7 @@ int main(int argc, char *argv[]) unsigned long long row_count= 0; char buffer; - while ((read= azread(&reader_handle, (byte *)size_buffer, + while ((read= azread(&reader_handle, (uchar *)size_buffer, ARCHIVE_ROW_HEADER_SIZE, &error))) { if (error == Z_STREAM_ERROR || (read && read < ARCHIVE_ROW_HEADER_SIZE)) @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) if (opt_backup) { - byte size_buffer[ARCHIVE_ROW_HEADER_SIZE]; + uchar size_buffer[ARCHIVE_ROW_HEADER_SIZE]; int error; unsigned int read; unsigned int row_len; @@ -213,7 +213,7 @@ int main(int argc, char *argv[]) my_free(ptr, MYF(0)); } - while ((read= azread(&reader_handle, (byte *)size_buffer, + while ((read= azread(&reader_handle, (uchar *)size_buffer, ARCHIVE_ROW_HEADER_SIZE, &error))) { if (error == Z_STREAM_ERROR || (read && read < ARCHIVE_ROW_HEADER_SIZE)) @@ -355,15 +355,15 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"set-auto-increment", 'A', "Force auto_increment to start at this or higher value. If no value is given, then sets the next auto_increment value to the highest used value for the auto key + 1.", - (gptr*) &new_auto_increment, - (gptr*) &new_auto_increment, + (uchar**) &new_auto_increment, + (uchar**) &new_auto_increment, 0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"silent", 's', "Only print errors. One can use two -s to make archive_reader very silent.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"tmpdir", 't', "Path for temporary files.", - (gptr*) &opt_tmpdir, + (uchar**) &opt_tmpdir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Print version and exit.", diff --git a/storage/archive/azio.c b/storage/archive/azio.c index 6b01d9c3c88..1f7e9d7c1de 100644 --- a/storage/archive/azio.c +++ b/storage/archive/azio.c @@ -19,7 +19,7 @@ static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ static int const az_magic[3] = {0xfe, 0x03, 0x01}; /* az magic header */ -/* gzip flag byte */ +/* gzip flag uchar */ #define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ #define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ #define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ @@ -139,8 +139,8 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd) } else if (s->mode == 'w') { - unsigned char buffer[AZHEADER_SIZE + AZMETA_BUFFER_SIZE]; - my_pread(s->file, (byte*) buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, 0, + uchar buffer[AZHEADER_SIZE + AZMETA_BUFFER_SIZE]; + my_pread(s->file, buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, 0, MYF(0)); read_header(s, buffer); /* skip the .az header */ my_seek(s->file, 0, MY_SEEK_END, MYF(0)); @@ -224,7 +224,7 @@ int get_byte(s) if (s->stream.avail_in == 0) { errno = 0; - s->stream.avail_in = my_read(s->file, (byte *)s->inbuf, AZ_BUFSIZE_READ, MYF(0)); + s->stream.avail_in = my_read(s->file, (uchar *)s->inbuf, AZ_BUFSIZE_READ, MYF(0)); if (s->stream.avail_in == 0) { s->z_eof = 1; @@ -248,8 +248,8 @@ int get_byte(s) */ void check_header(azio_stream *s) { - int method; /* method byte */ - int flags; /* flags byte */ + int method; /* method uchar */ + int flags; /* flags uchar */ uInt len; int c; @@ -260,7 +260,7 @@ void check_header(azio_stream *s) if (len < 2) { if (len) s->inbuf[0] = s->stream.next_in[0]; errno = 0; - len = (uInt)my_read(s->file, (byte *)s->inbuf + len, AZ_BUFSIZE_READ >> len, MYF(0)); + len = (uInt)my_read(s->file, (uchar *)s->inbuf + len, AZ_BUFSIZE_READ >> len, MYF(0)); if (len == 0) s->z_err = Z_ERRNO; s->stream.avail_in += len; s->stream.next_in = s->inbuf; @@ -442,7 +442,7 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, unsigned int len, int * if (s->stream.avail_out > 0) { s->stream.avail_out -= - (uInt)my_read(s->file, (byte *)next_out, s->stream.avail_out, MYF(0)); + (uInt)my_read(s->file, (uchar *)next_out, s->stream.avail_out, MYF(0)); } len -= s->stream.avail_out; s->in += len; @@ -455,7 +455,7 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, unsigned int len, int * if (s->stream.avail_in == 0 && !s->z_eof) { errno = 0; - s->stream.avail_in = (uInt)my_read(s->file, (byte *)s->inbuf, AZ_BUFSIZE_READ, MYF(0)); + s->stream.avail_in = (uInt)my_read(s->file, (uchar *)s->inbuf, AZ_BUFSIZE_READ, MYF(0)); if (s->stream.avail_in == 0) { s->z_eof = 1; @@ -522,7 +522,7 @@ unsigned int azwrite (azio_stream *s, voidpc buf, unsigned int len) { s->stream.next_out = s->outbuf; - if (my_write(s->file, (byte *)s->outbuf, AZ_BUFSIZE_WRITE, + if (my_write(s->file, (uchar *)s->outbuf, AZ_BUFSIZE_WRITE, MYF(0)) != AZ_BUFSIZE_WRITE) { s->z_err = Z_ERRNO; @@ -569,7 +569,7 @@ int do_flush (azio_stream *s, int flush) if (len != 0) { s->check_point= my_tell(s->file, MYF(0)); - if ((uInt)my_write(s->file, (byte *)s->outbuf, len, MYF(0)) != len) + if ((uInt)my_write(s->file, (uchar *)s->outbuf, len, MYF(0)) != len) { s->z_err = Z_ERRNO; return Z_ERRNO; @@ -611,7 +611,7 @@ int ZEXPORT azflush (s, flush) if (s->mode == 'r') { unsigned char buffer[AZHEADER_SIZE + AZMETA_BUFFER_SIZE]; - my_pread(s->file, (byte*) buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, 0, + my_pread(s->file, (uchar*) buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, 0, MYF(0)); read_header(s, buffer); /* skip the .az header */ @@ -748,7 +748,7 @@ my_off_t ZEXPORT aztell (file) void putLong (File file, uLong x) { int n; - byte buffer[1]; + uchar buffer[1]; for (n = 0; n < 4; n++) { diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 6853e879f55..d1482de18ec 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -113,9 +113,9 @@ static handler *archive_create_handler(handlerton *hton, TABLE_SHARE *table, MEM_ROOT *mem_root); int archive_discover(handlerton *hton, THD* thd, const char *db, - const char *name, - const void** frmblob, - uint* frmlen); + const char *name, + uchar **frmblob, + size_t *frmlen); /* Number of rows that will force a bulk insert. @@ -137,11 +137,11 @@ static handler *archive_create_handler(handlerton *hton, /* Used for hash table that tracks open tables. */ -static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length, +static uchar* archive_get_key(ARCHIVE_SHARE *share, size_t *length, my_bool not_used __attribute__((unused))) { *length=share->table_name_length; - return (byte*) share->table_name; + return (uchar*) share->table_name; } @@ -216,9 +216,9 @@ ha_archive::ha_archive(handlerton *hton, TABLE_SHARE *table_arg) } int archive_discover(handlerton *hton, THD* thd, const char *db, - const char *name, - const void** frmblob, - uint* frmlen) + const char *name, + uchar **frmblob, + size_t *frmlen) { DBUG_ENTER("archive_discover"); DBUG_PRINT("archive_discover", ("db: %s, name: %s", db, name)); @@ -247,7 +247,7 @@ int archive_discover(handlerton *hton, THD* thd, const char *db, azclose(&frm_stream); *frmlen= frm_stream.frm_length; - *frmblob= frm_ptr; + *frmblob= (uchar*) frm_ptr; DBUG_RETURN(0); err: @@ -316,7 +316,7 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc) length=(uint) strlen(table_name); if (!(share=(ARCHIVE_SHARE*) hash_search(&archive_open_tables, - (byte*) table_name, + (uchar*) table_name, length))) { char *tmp_name; @@ -362,7 +362,7 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc) share->crashed= archive_tmp.dirty; azclose(&archive_tmp); - VOID(my_hash_insert(&archive_open_tables, (byte*) share)); + VOID(my_hash_insert(&archive_open_tables, (uchar*) share)); thr_lock_init(&share->lock); } share->use_count++; @@ -393,7 +393,7 @@ int ha_archive::free_share() pthread_mutex_lock(&archive_mutex); if (!--share->use_count) { - hash_delete(&archive_open_tables, (byte*) share); + hash_delete(&archive_open_tables, (uchar*) share); thr_lock_delete(&share->lock); VOID(pthread_mutex_destroy(&share->mutex)); /* @@ -408,7 +408,7 @@ int ha_archive::free_share() if (azclose(&(share->archive_write))) rc= 1; } - my_free((gptr) share, MYF(0)); + my_free((uchar*) share, MYF(0)); } pthread_mutex_unlock(&archive_mutex); @@ -579,7 +579,7 @@ int ha_archive::create(const char *name, TABLE *table_arg, azio_stream create_stream; /* Archive file we are working with */ File frm_file; /* File handler for readers */ MY_STAT file_stat; // Stat information for the data file - byte *frm_ptr; + uchar *frm_ptr; DBUG_ENTER("ha_archive::create"); @@ -651,12 +651,12 @@ int ha_archive::create(const char *name, TABLE *table_arg, { if (!my_fstat(frm_file, &file_stat, MYF(MY_WME))) { - frm_ptr= (byte *)my_malloc(sizeof(byte) * file_stat.st_size , MYF(0)); + frm_ptr= (uchar *)my_malloc(sizeof(uchar) * file_stat.st_size, MYF(0)); if (frm_ptr) { my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0)); azwrite_frm(&create_stream, (char *)frm_ptr, file_stat.st_size); - my_free((gptr)frm_ptr, MYF(0)); + my_free((uchar*)frm_ptr, MYF(0)); } } my_close(frm_file, MYF(0)); @@ -696,7 +696,7 @@ error: /* This is where the actual row is written out. */ -int ha_archive::real_write_row(byte *buf, azio_stream *writer) +int ha_archive::real_write_row(uchar *buf, azio_stream *writer) { my_off_t written; unsigned int r_pack_length; @@ -726,7 +726,7 @@ int ha_archive::real_write_row(byte *buf, azio_stream *writer) the bytes required for the length in the header. */ -uint32 ha_archive::max_row_length(const byte *buf) +uint32 ha_archive::max_row_length(const uchar *buf) { uint32 length= (uint32)(table->s->reclength + table->s->fields*2); length+= ARCHIVE_ROW_HEADER_SIZE; @@ -743,9 +743,9 @@ uint32 ha_archive::max_row_length(const byte *buf) } -unsigned int ha_archive::pack_row(byte *record) +unsigned int ha_archive::pack_row(uchar *record) { - byte *ptr; + uchar *ptr; DBUG_ENTER("ha_archive::pack_row"); @@ -761,8 +761,7 @@ unsigned int ha_archive::pack_row(byte *record) for (Field **field=table->field ; *field ; field++) { if (!((*field)->is_null())) - ptr=(byte*) (*field)->pack((char*) ptr, - (char*) record + (*field)->offset(record)); + ptr= (*field)->pack(ptr, record + (*field)->offset(record)); } int4store(record_buffer->buffer, (int)(ptr - record_buffer->buffer - @@ -784,12 +783,12 @@ unsigned int ha_archive::pack_row(byte *record) for implementing start_bulk_insert() is that we could skip setting dirty to true each time. */ -int ha_archive::write_row(byte *buf) +int ha_archive::write_row(uchar *buf) { int rc; - byte *read_buf= NULL; + uchar *read_buf= NULL; ulonglong temp_auto; - byte *record= table->record[0]; + uchar *record= table->record[0]; DBUG_ENTER("ha_archive::write_row"); if (share->crashed) @@ -832,7 +831,7 @@ int ha_archive::write_row(byte *buf) First we create a buffer that we can use for reading rows, and can pass to get_row(). */ - if (!(read_buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME)))) + if (!(read_buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME)))) { rc= HA_ERR_OUT_OF_MEM; goto error; @@ -882,7 +881,7 @@ int ha_archive::write_row(byte *buf) error: pthread_mutex_unlock(&share->mutex); if (read_buf) - my_free((gptr) read_buf, MYF(0)); + my_free((uchar*) read_buf, MYF(0)); DBUG_RETURN(rc); } @@ -910,7 +909,7 @@ int ha_archive::index_init(uint keynr, bool sorted) No indexes, so if we get a request for an index search since we tell the optimizer that we have unique indexes, we scan */ -int ha_archive::index_read(byte *buf, const byte *key, +int ha_archive::index_read(uchar *buf, const uchar *key, uint key_len, enum ha_rkey_function find_flag) { int rc; @@ -920,7 +919,7 @@ int ha_archive::index_read(byte *buf, const byte *key, } -int ha_archive::index_read_idx(byte *buf, uint index, const byte *key, +int ha_archive::index_read_idx(uchar *buf, uint index, const uchar *key, uint key_len, enum ha_rkey_function find_flag) { int rc; @@ -955,7 +954,7 @@ error: } -int ha_archive::index_next(byte * buf) +int ha_archive::index_next(uchar * buf) { bool found= 0; @@ -1024,7 +1023,7 @@ int ha_archive::rnd_init(bool scan) This is the method that is used to read a row. It assumes that the row is positioned where you want it. */ -int ha_archive::get_row(azio_stream *file_to_read, byte *buf) +int ha_archive::get_row(azio_stream *file_to_read, uchar *buf) { int rc; DBUG_ENTER("ha_archive::get_row"); @@ -1051,8 +1050,8 @@ bool ha_archive::fix_rec_buff(unsigned int length) if (length > record_buffer->length) { - byte *newptr; - if (!(newptr=(byte*) my_realloc((gptr) record_buffer->buffer, + uchar *newptr; + if (!(newptr=(uchar*) my_realloc((uchar*) record_buffer->buffer, length, MYF(MY_ALLOW_ZERO_PTR)))) DBUG_RETURN(1); @@ -1065,17 +1064,17 @@ bool ha_archive::fix_rec_buff(unsigned int length) DBUG_RETURN(0); } -int ha_archive::unpack_row(azio_stream *file_to_read, byte *record) +int ha_archive::unpack_row(azio_stream *file_to_read, uchar *record) { DBUG_ENTER("ha_archive::unpack_row"); unsigned int read; int error; - byte size_buffer[ARCHIVE_ROW_HEADER_SIZE]; + uchar size_buffer[ARCHIVE_ROW_HEADER_SIZE]; unsigned int row_len; /* First we grab the length stored */ - read= azread(file_to_read, (byte *)size_buffer, ARCHIVE_ROW_HEADER_SIZE, &error); + read= azread(file_to_read, size_buffer, ARCHIVE_ROW_HEADER_SIZE, &error); if (error == Z_STREAM_ERROR || (read && read < ARCHIVE_ROW_HEADER_SIZE)) DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); @@ -1100,21 +1099,21 @@ int ha_archive::unpack_row(azio_stream *file_to_read, byte *record) } /* Copy null bits */ - const char *ptr= (const char*) record_buffer->buffer; + const uchar *ptr= record_buffer->buffer; memcpy(record, ptr, table->s->null_bytes); ptr+= table->s->null_bytes; for (Field **field=table->field ; *field ; field++) + { if (!((*field)->is_null())) { - ptr= (*field)->unpack((char *)record + - (*field)->offset(table->record[0]), ptr); + ptr= (*field)->unpack(record + (*field)->offset(table->record[0]), ptr); } - + } DBUG_RETURN(0); } -int ha_archive::get_row_version3(azio_stream *file_to_read, byte *buf) +int ha_archive::get_row_version3(azio_stream *file_to_read, uchar *buf) { DBUG_ENTER("ha_archive::get_row_version3"); @@ -1124,7 +1123,7 @@ int ha_archive::get_row_version3(azio_stream *file_to_read, byte *buf) } -int ha_archive::get_row_version2(azio_stream *file_to_read, byte *buf) +int ha_archive::get_row_version2(azio_stream *file_to_read, uchar *buf) { unsigned int read; int error; @@ -1190,7 +1189,7 @@ int ha_archive::get_row_version2(azio_stream *file_to_read, byte *buf) if ((size_t) read != size) DBUG_RETURN(HA_ERR_END_OF_FILE); - ((Field_blob*) table->field[*ptr])->set_ptr(size, last); + ((Field_blob*) table->field[*ptr])->set_ptr(size, (uchar*) last); last += size; } else @@ -1208,7 +1207,7 @@ int ha_archive::get_row_version2(azio_stream *file_to_read, byte *buf) or by having had ha_archive::rnd_pos() called before it is called. */ -int ha_archive::rnd_next(byte *buf) +int ha_archive::rnd_next(uchar *buf) { int rc; DBUG_ENTER("ha_archive::rnd_next"); @@ -1238,7 +1237,7 @@ int ha_archive::rnd_next(byte *buf) needed. */ -void ha_archive::position(const byte *record) +void ha_archive::position(const uchar *record) { DBUG_ENTER("ha_archive::position"); my_store_ptr(ref, ref_length, current_position); @@ -1253,7 +1252,7 @@ void ha_archive::position(const byte *record) correctly ordered row. */ -int ha_archive::rnd_pos(byte * buf, byte *pos) +int ha_archive::rnd_pos(uchar * buf, uchar *pos) { DBUG_ENTER("ha_archive::rnd_pos"); ha_statistic_increment(&SSV::ha_read_rnd_next_count); @@ -1346,8 +1345,8 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) { Field *field= table->found_next_number_field; ulonglong auto_value= - (ulonglong) field->val_int((char*)(table->record[0] + - field->offset(table->record[0]))); + (ulonglong) field->val_int(table->record[0] + + field->offset(table->record[0])); if (share->archive_write.auto_increment < auto_value) stats.auto_increment_value= share->archive_write.auto_increment= auto_value; @@ -1549,7 +1548,7 @@ bool ha_archive::is_crashed() const int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt) { int rc= 0; - byte *buf; + uchar *buf; const char *old_proc_info; ha_rows count= share->rows_recorded; DBUG_ENTER("ha_archive::check"); @@ -1562,7 +1561,7 @@ int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt) First we create a buffer that we can use for reading rows, and can pass to get_row(). */ - if (!(buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME)))) + if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME)))) rc= HA_ERR_OUT_OF_MEM; /* @@ -1618,7 +1617,7 @@ archive_record_buffer *ha_archive::create_record_buffer(unsigned int length) } r->length= (int)length; - if (!(r->buffer= (byte*) my_malloc(r->length, + if (!(r->buffer= (uchar*) my_malloc(r->length, MYF(MY_WME)))) { my_free((char*) r, MYF(MY_ALLOW_ZERO_PTR)); diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h index 8fc54f6715f..936bb6e253d 100644 --- a/storage/archive/ha_archive.h +++ b/storage/archive/ha_archive.h @@ -27,7 +27,7 @@ */ typedef struct st_archive_record_buffer { - byte *buffer; + uchar *buffer; uint32 length; } archive_record_buffer; @@ -62,12 +62,12 @@ class ha_archive: public handler azio_stream archive; /* Archive file we are working with */ my_off_t current_position; /* The position of the row we just read */ - byte byte_buffer[IO_SIZE]; /* Initial buffer for our string */ + uchar byte_buffer[IO_SIZE]; /* Initial buffer for our string */ String buffer; /* Buffer used for blob storage */ ha_rows scan_rows; /* Number of rows left in scan */ bool delayed_insert; /* If the insert is delayed */ bool bulk_insert; /* If we are performing a bulk insert */ - const byte *current_key; + const uchar *current_key; uint current_key_len; uint current_k_offset; archive_record_buffer *record_buffer; @@ -101,29 +101,29 @@ public: uint max_supported_key_length() const { return sizeof(ulonglong); } uint max_supported_key_part_length() const { return sizeof(ulonglong); } int index_init(uint keynr, bool sorted); - virtual int index_read(byte * buf, const byte * key, + virtual int index_read(uchar * buf, const uchar * key, uint key_len, enum ha_rkey_function find_flag); - virtual int index_read_idx(byte * buf, uint index, const byte * key, + virtual int index_read_idx(uchar * buf, uint index, const uchar * key, uint key_len, enum ha_rkey_function find_flag); - int index_next(byte * buf); + int index_next(uchar * buf); int open(const char *name, int mode, uint test_if_locked); int close(void); - int write_row(byte * buf); - int real_write_row(byte *buf, azio_stream *writer); + int write_row(uchar * buf); + int real_write_row(uchar *buf, azio_stream *writer); int delete_all_rows(); int rnd_init(bool scan=1); - int rnd_next(byte *buf); - int rnd_pos(byte * buf, byte *pos); - int get_row(azio_stream *file_to_read, byte *buf); - int get_row_version2(azio_stream *file_to_read, byte *buf); - int get_row_version3(azio_stream *file_to_read, byte *buf); + int rnd_next(uchar *buf); + int rnd_pos(uchar * buf, uchar *pos); + int get_row(azio_stream *file_to_read, uchar *buf); + int get_row_version2(azio_stream *file_to_read, uchar *buf); + int get_row_version3(azio_stream *file_to_read, uchar *buf); ARCHIVE_SHARE *get_share(const char *table_name, int *rc); int free_share(); int init_archive_writer(); int init_archive_reader(); bool auto_repair() const { return 1; } // For the moment we just do this int read_data_header(azio_stream *file_to_read); - void position(const byte *record); + void position(const uchar *record); int info(uint); void update_create_info(HA_CREATE_INFO *create_info); int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); @@ -140,9 +140,9 @@ public: bool is_crashed() const; int check(THD* thd, HA_CHECK_OPT* check_opt); bool check_and_repair(THD *thd); - uint32 max_row_length(const byte *buf); + uint32 max_row_length(const uchar *buf); bool fix_rec_buff(unsigned int length); - int unpack_row(azio_stream *file_to_read, byte *record); - unsigned int pack_row(byte *record); + int unpack_row(azio_stream *file_to_read, uchar *record); + unsigned int pack_row(uchar *record); }; diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc index 6f07c4183f1..f867cbfdeb5 100644 --- a/storage/blackhole/ha_blackhole.cc +++ b/storage/blackhole/ha_blackhole.cc @@ -83,7 +83,7 @@ const char *ha_blackhole::index_type(uint key_number) HA_KEY_ALG_RTREE) ? "RTREE" : "BTREE"); } -int ha_blackhole::write_row(byte * buf) +int ha_blackhole::write_row(uchar * buf) { DBUG_ENTER("ha_blackhole::write_row"); DBUG_RETURN(0); @@ -96,14 +96,14 @@ int ha_blackhole::rnd_init(bool scan) } -int ha_blackhole::rnd_next(byte *buf) +int ha_blackhole::rnd_next(uchar *buf) { DBUG_ENTER("ha_blackhole::rnd_next"); DBUG_RETURN(HA_ERR_END_OF_FILE); } -int ha_blackhole::rnd_pos(byte * buf, byte *pos) +int ha_blackhole::rnd_pos(uchar * buf, uchar *pos) { DBUG_ENTER("ha_blackhole::rnd_pos"); DBUG_ASSERT(0); @@ -111,7 +111,7 @@ int ha_blackhole::rnd_pos(byte * buf, byte *pos) } -void ha_blackhole::position(const byte *record) +void ha_blackhole::position(const uchar *record) { DBUG_ENTER("ha_blackhole::position"); DBUG_ASSERT(0); @@ -151,7 +151,7 @@ THR_LOCK_DATA **ha_blackhole::store_lock(THD *thd, } -int ha_blackhole::index_read(byte * buf, const byte * key, +int ha_blackhole::index_read(uchar * buf, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag) { @@ -160,7 +160,7 @@ int ha_blackhole::index_read(byte * buf, const byte * key, } -int ha_blackhole::index_read_idx(byte * buf, uint idx, const byte * key, +int ha_blackhole::index_read_idx(uchar * buf, uint idx, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag) { @@ -169,7 +169,7 @@ int ha_blackhole::index_read_idx(byte * buf, uint idx, const byte * key, } -int ha_blackhole::index_read_last(byte * buf, const byte * key, +int ha_blackhole::index_read_last(uchar * buf, const uchar * key, key_part_map keypart_map) { DBUG_ENTER("ha_blackhole::index_read_last"); @@ -177,28 +177,28 @@ int ha_blackhole::index_read_last(byte * buf, const byte * key, } -int ha_blackhole::index_next(byte * buf) +int ha_blackhole::index_next(uchar * buf) { DBUG_ENTER("ha_blackhole::index_next"); DBUG_RETURN(HA_ERR_END_OF_FILE); } -int ha_blackhole::index_prev(byte * buf) +int ha_blackhole::index_prev(uchar * buf) { DBUG_ENTER("ha_blackhole::index_prev"); DBUG_RETURN(HA_ERR_END_OF_FILE); } -int ha_blackhole::index_first(byte * buf) +int ha_blackhole::index_first(uchar * buf) { DBUG_ENTER("ha_blackhole::index_first"); DBUG_RETURN(HA_ERR_END_OF_FILE); } -int ha_blackhole::index_last(byte * buf) +int ha_blackhole::index_last(uchar * buf) { DBUG_ENTER("ha_blackhole::index_last"); DBUG_RETURN(HA_ERR_END_OF_FILE); diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h index 2af12b33077..e22f1a6beba 100644 --- a/storage/blackhole/ha_blackhole.h +++ b/storage/blackhole/ha_blackhole.h @@ -60,20 +60,20 @@ public: uint max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; } int open(const char *name, int mode, uint test_if_locked); int close(void); - int write_row(byte * buf); + int write_row(uchar * buf); int rnd_init(bool scan); - int rnd_next(byte *buf); - int rnd_pos(byte * buf, byte *pos); - int index_read(byte * buf, const byte * key, key_part_map keypart_map, + int rnd_next(uchar *buf); + int rnd_pos(uchar * buf, uchar *pos); + int index_read(uchar * buf, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag); - int index_read_idx(byte * buf, uint idx, const byte * key, + int index_read_idx(uchar * buf, uint idx, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag); - int index_read_last(byte * buf, const byte * key, key_part_map keypart_map); - int index_next(byte * buf); - int index_prev(byte * buf); - int index_first(byte * buf); - int index_last(byte * buf); - void position(const byte *record); + int index_read_last(uchar * buf, const uchar * key, key_part_map keypart_map); + int index_next(uchar * buf); + int index_prev(uchar * buf); + int index_first(uchar * buf); + int index_last(uchar * buf); + void position(const uchar *record); int info(uint flag); int external_lock(THD *thd, int lock_type); uint lock_count(void) const; diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 07a4ffc65c5..9eead7a059c 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -93,11 +93,11 @@ int sort_set (tina_set *a, tina_set *b) return ( a->begin > b->begin ? 1 : ( a->begin < b->begin ? -1 : 0 ) ); } -static byte* tina_get_key(TINA_SHARE *share,uint *length, +static uchar* tina_get_key(TINA_SHARE *share, size_t *length, my_bool not_used __attribute__((unused))) { *length=share->table_name_length; - return (byte*) share->table_name; + return (uchar*) share->table_name; } static int tina_init_func(void *p) @@ -144,7 +144,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table) initialize its members. */ if (!(share=(TINA_SHARE*) hash_search(&tina_open_tables, - (byte*) table_name, + (uchar*) table_name, length))) { if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), @@ -174,7 +174,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table) goto error; share->saved_data_file_length= file_stat.st_size; - if (my_hash_insert(&tina_open_tables, (byte*) share)) + if (my_hash_insert(&tina_open_tables, (uchar*) share)) goto error; thr_lock_init(&share->lock); pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST); @@ -203,7 +203,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table) error: pthread_mutex_unlock(&tina_mutex); - my_free((gptr) share, MYF(0)); + my_free((uchar*) share, MYF(0)); return NULL; } @@ -236,7 +236,7 @@ static int read_meta_file(File meta_file, ha_rows *rows) DBUG_ENTER("ha_tina::read_meta_file"); VOID(my_seek(meta_file, 0, MY_SEEK_SET, MYF(0))); - if (my_read(meta_file, (byte*)meta_buffer, META_BUFFER_SIZE, 0) + if (my_read(meta_file, (uchar*)meta_buffer, META_BUFFER_SIZE, 0) != META_BUFFER_SIZE) DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); @@ -305,7 +305,7 @@ static int write_meta_file(File meta_file, ha_rows rows, bool dirty) *ptr= (uchar)dirty; VOID(my_seek(meta_file, 0, MY_SEEK_SET, MYF(0))); - if (my_write(meta_file, (byte *)meta_buffer, META_BUFFER_SIZE, 0) + if (my_write(meta_file, (uchar *)meta_buffer, META_BUFFER_SIZE, 0) != META_BUFFER_SIZE) DBUG_RETURN(-1); @@ -376,10 +376,10 @@ static int free_share(TINA_SHARE *share) share->tina_write_opened= FALSE; } - hash_delete(&tina_open_tables, (byte*) share); + hash_delete(&tina_open_tables, (uchar*) share); thr_lock_delete(&share->lock); pthread_mutex_destroy(&share->mutex); - my_free((gptr) share, MYF(0)); + my_free((uchar*) share, MYF(0)); } pthread_mutex_unlock(&tina_mutex); @@ -454,7 +454,7 @@ ha_tina::ha_tina(handlerton *hton, TABLE_SHARE *table_arg) Encode a buffer into the quoted format. */ -int ha_tina::encode_quote(byte *buf) +int ha_tina::encode_quote(uchar *buf) { char attribute_buffer[1024]; String attribute(attribute_buffer, sizeof(attribute_buffer), @@ -558,7 +558,7 @@ int ha_tina::chain_append() if (chain_alloced) { /* Must cast since my_malloc unlike malloc doesn't have a void ptr */ - if ((chain= (tina_set *) my_realloc((gptr)chain, + if ((chain= (tina_set *) my_realloc((uchar*)chain, chain_size, MYF(MY_WME))) == NULL) return -1; } @@ -584,7 +584,7 @@ int ha_tina::chain_append() /* Scans for a row. */ -int ha_tina::find_current_row(byte *buf) +int ha_tina::find_current_row(uchar *buf) { off_t end_offset, curr_offset= current_position; int eoln_len; @@ -851,7 +851,7 @@ int ha_tina::close(void) of the file and appends the data. In an error case it really should just truncate to the original position (this is not done yet). */ -int ha_tina::write_row(byte * buf) +int ha_tina::write_row(uchar * buf) { int size; DBUG_ENTER("ha_tina::write_row"); @@ -871,7 +871,7 @@ int ha_tina::write_row(byte * buf) DBUG_RETURN(-1); /* use pwrite, as concurrent reader could have changed the position */ - if (my_write(share->tina_write_filedes, (byte*)buffer.ptr(), size, + if (my_write(share->tina_write_filedes, (uchar*)buffer.ptr(), size, MYF(MY_WME | MY_NABP))) DBUG_RETURN(-1); @@ -916,7 +916,7 @@ int ha_tina::open_update_temp_file_if_needed() This will be called in a table scan right before the previous ::rnd_next() call. */ -int ha_tina::update_row(const byte * old_data, byte * new_data) +int ha_tina::update_row(const uchar * old_data, uchar * new_data) { int size; DBUG_ENTER("ha_tina::update_row"); @@ -934,7 +934,7 @@ int ha_tina::update_row(const byte * old_data, byte * new_data) if (open_update_temp_file_if_needed()) DBUG_RETURN(-1); - if (my_write(update_temp_file, (byte*)buffer.ptr(), size, + if (my_write(update_temp_file, (uchar*)buffer.ptr(), size, MYF(MY_WME | MY_NABP))) DBUG_RETURN(-1); @@ -954,7 +954,7 @@ int ha_tina::update_row(const byte * old_data, byte * new_data) The table will then be deleted/positioned based on the ORDER (so RANDOM, DESC, ASC). */ -int ha_tina::delete_row(const byte * buf) +int ha_tina::delete_row(const uchar * buf) { DBUG_ENTER("ha_tina::delete_row"); ha_statistic_increment(&SSV::ha_delete_count); @@ -1033,7 +1033,7 @@ int ha_tina::rnd_init(bool scan) NULL and "". This is ok since this table handler is for spreadsheets and they don't know about them either :) */ -int ha_tina::rnd_next(byte *buf) +int ha_tina::rnd_next(uchar *buf) { int rc; DBUG_ENTER("ha_tina::rnd_next"); @@ -1065,7 +1065,7 @@ int ha_tina::rnd_next(byte *buf) its just a position. Look at the bdb code if you want to see a case where something other then a number is stored. */ -void ha_tina::position(const byte *record) +void ha_tina::position(const uchar *record) { DBUG_ENTER("ha_tina::position"); my_store_ptr(ref, ref_length, current_position); @@ -1078,7 +1078,7 @@ void ha_tina::position(const byte *record) my_get_ptr() retrieves the data for you. */ -int ha_tina::rnd_pos(byte * buf, byte *pos) +int ha_tina::rnd_pos(uchar * buf, uchar *pos) { DBUG_ENTER("ha_tina::rnd_pos"); ha_statistic_increment(&SSV::ha_read_rnd_next_count); @@ -1178,7 +1178,7 @@ int ha_tina::rnd_end() /* if there is something to write, write it */ if ((write_end - write_begin) && (my_write(update_temp_file, - (byte*)(file_buff->ptr() + + (uchar*)(file_buff->ptr() + (write_begin - file_buff->start())), write_end - write_begin, MYF_RW))) goto error; @@ -1266,7 +1266,7 @@ error: int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt) { char repaired_fname[FN_REFLEN]; - byte *buf; + uchar *buf; File repair_file; int rc; ha_rows rows_repaired= 0; @@ -1282,7 +1282,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt) /* Don't assert in field::val() functions */ table->use_all_columns(); - if (!(buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME)))) + if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME)))) DBUG_RETURN(HA_ERR_OUT_OF_MEM); /* position buffer to the start of the file */ @@ -1338,7 +1338,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt) { write_end= min(file_buff->end(), current_position); if ((write_end - write_begin) && - (my_write(repair_file, (byte*)file_buff->ptr(), + (my_write(repair_file, (uchar*)file_buff->ptr(), write_end - write_begin, MYF_RW))) DBUG_RETURN(-1); @@ -1442,13 +1442,13 @@ int ha_tina::create(const char *name, TABLE *table_arg, int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt) { int rc= 0; - byte *buf; + uchar *buf; const char *old_proc_info; ha_rows count= share->rows_recorded; DBUG_ENTER("ha_tina::check"); old_proc_info= thd_proc_info(thd, "Checking table"); - if (!(buf= (byte*) my_malloc(table->s->reclength, MYF(MY_WME)))) + if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME)))) DBUG_RETURN(HA_ERR_OUT_OF_MEM); /* position buffer to the start of the file */ diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index c096f21fca2..ecb7f006cc4 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -63,7 +63,7 @@ class ha_tina: public handler off_t current_position; /* Current position in the file during a file scan */ off_t next_position; /* Next position in the file scan */ off_t local_saved_data_file_length; /* save position for reads */ - byte byte_buffer[IO_SIZE]; + uchar byte_buffer[IO_SIZE]; Transparent_file *file_buff; File data_file; /* File handler for readers */ File update_temp_file; @@ -76,7 +76,7 @@ class ha_tina: public handler tina_set chain_buffer[DEFAULT_CHAIN_LENGTH]; tina_set *chain; tina_set *chain_ptr; - byte chain_alloced; + uchar chain_alloced; uint32 chain_size; bool records_is_known; @@ -90,7 +90,7 @@ public: ~ha_tina() { if (chain_alloced) - my_free((gptr)chain, 0); + my_free(chain, 0); if (file_buff) delete file_buff; } @@ -133,12 +133,12 @@ public: bool called_by_logger_thread); int open(const char *name, int mode, uint open_options); int close(void); - int write_row(byte * buf); - int update_row(const byte * old_data, byte * new_data); - int delete_row(const byte * buf); + int write_row(uchar * buf); + int update_row(const uchar * old_data, uchar * new_data); + int delete_row(const uchar * buf); int rnd_init(bool scan=1); - int rnd_next(byte *buf); - int rnd_pos(byte * buf, byte *pos); + int rnd_next(uchar *buf); + int rnd_pos(uchar * buf, uchar *pos); bool check_and_repair(THD *thd); int check(THD* thd, HA_CHECK_OPT* check_opt); bool is_crashed() const; @@ -146,7 +146,7 @@ public: int repair(THD* thd, HA_CHECK_OPT* check_opt); /* This is required for SQL layer to know that we support autorepair */ bool auto_repair() const { return 1; } - void position(const byte *record); + void position(const uchar *record); int info(uint); int extra(enum ha_extra_function operation); int delete_all_rows(void); @@ -165,8 +165,8 @@ public: void update_status(); /* The following methods were added just for TINA */ - int encode_quote(byte *buf); - int find_current_row(byte *buf); + int encode_quote(uchar *buf); + int find_current_row(uchar *buf); int chain_append(); }; diff --git a/storage/csv/transparent_file.cc b/storage/csv/transparent_file.cc index 27cc8c024b4..a200fa6ac36 100644 --- a/storage/csv/transparent_file.cc +++ b/storage/csv/transparent_file.cc @@ -22,12 +22,12 @@ Transparent_file::Transparent_file() : lower_bound(0), buff_size(IO_SIZE) { - buff= (byte *) my_malloc(buff_size*sizeof(byte), MYF(MY_WME)); + buff= (uchar *) my_malloc(buff_size*sizeof(uchar), MYF(MY_WME)); } Transparent_file::~Transparent_file() { - my_free((gptr)buff, MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*)buff, MYF(MY_ALLOW_ZERO_PTR)); } void Transparent_file::init_buff(File filedes_arg) @@ -40,7 +40,7 @@ void Transparent_file::init_buff(File filedes_arg) upper_bound= my_read(filedes, buff, buff_size, MYF(0)); } -byte *Transparent_file::ptr() +uchar *Transparent_file::ptr() { return buff; } @@ -57,18 +57,18 @@ off_t Transparent_file::end() off_t Transparent_file::read_next() { - off_t bytes_read; + size_t bytes_read; /* No need to seek here, as the file managed by Transparent_file class always points to upper_bound byte */ if ((bytes_read= my_read(filedes, buff, buff_size, MYF(0))) == MY_FILE_ERROR) - return -1; + return (off_t) -1; /* end of file */ if (!bytes_read) - return -1; + return (off_t) -1; lower_bound= upper_bound; upper_bound+= bytes_read; @@ -79,26 +79,24 @@ off_t Transparent_file::read_next() char Transparent_file::get_value(off_t offset) { - off_t bytes_read; + size_t bytes_read; /* check boundaries */ if ((lower_bound <= offset) && (offset < upper_bound)) return buff[offset - lower_bound]; - else - { - VOID(my_seek(filedes, offset, MY_SEEK_SET, MYF(0))); - /* read appropriate portion of the file */ - if ((bytes_read= my_read(filedes, buff, buff_size, - MYF(0))) == MY_FILE_ERROR) - return 0; - - lower_bound= offset; - upper_bound= lower_bound + bytes_read; - - /* end of file */ - if (upper_bound == offset) - return 0; - - return buff[0]; - } + + VOID(my_seek(filedes, offset, MY_SEEK_SET, MYF(0))); + /* read appropriate portion of the file */ + if ((bytes_read= my_read(filedes, buff, buff_size, + MYF(0))) == MY_FILE_ERROR) + return 0; + + lower_bound= offset; + upper_bound= lower_bound + bytes_read; + + /* end of file */ + if (upper_bound == offset) + return 0; + + return buff[0]; } diff --git a/storage/csv/transparent_file.h b/storage/csv/transparent_file.h index ceb59ec7caf..4c0f4cce7e7 100644 --- a/storage/csv/transparent_file.h +++ b/storage/csv/transparent_file.h @@ -21,7 +21,7 @@ class Transparent_file { File filedes; - byte *buff; /* in-memory window to the file or mmaped area */ + uchar *buff; /* in-memory window to the file or mmaped area */ /* current window sizes */ off_t lower_bound; off_t upper_bound; @@ -33,7 +33,7 @@ public: ~Transparent_file(); void init_buff(File filedes_arg); - byte *ptr(); + uchar *ptr(); off_t start(); off_t end(); char get_value (off_t offset); diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index a4cdcafc6d0..45433fd58ce 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -114,11 +114,11 @@ pthread_mutex_t example_mutex; Function we use in the creation of our hash to get key. */ -static byte* example_get_key(EXAMPLE_SHARE *share,uint *length, +static uchar* example_get_key(EXAMPLE_SHARE *share,uint *length, my_bool not_used __attribute__((unused))) { *length=share->table_name_length; - return (byte*) share->table_name; + return (uchar*) share->table_name; } @@ -172,7 +172,7 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table) length=(uint) strlen(table_name); if (!(share=(EXAMPLE_SHARE*) hash_search(&example_open_tables, - (byte*) table_name, + (uchar*) table_name, length))) { if (!(share=(EXAMPLE_SHARE *) @@ -189,7 +189,7 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table) share->table_name_length=length; share->table_name=tmp_name; strmov(share->table_name,table_name); - if (my_hash_insert(&example_open_tables, (byte*) share)) + if (my_hash_insert(&example_open_tables, (uchar*) share)) goto error; thr_lock_init(&share->lock); pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST); @@ -201,7 +201,7 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table) error: pthread_mutex_destroy(&share->mutex); - my_free((gptr) share, MYF(0)); + my_free(share, MYF(0)); return NULL; } @@ -218,10 +218,10 @@ static int free_share(EXAMPLE_SHARE *share) pthread_mutex_lock(&example_mutex); if (!--share->use_count) { - hash_delete(&example_open_tables, (byte*) share); + hash_delete(&example_open_tables, (uchar*) share); thr_lock_delete(&share->lock); pthread_mutex_destroy(&share->mutex); - my_free((gptr) share, MYF(0)); + my_free(share, MYF(0)); } pthread_mutex_unlock(&example_mutex); @@ -349,7 +349,7 @@ int ha_example::close(void) sql_insert.cc, sql_select.cc, sql_table.cc, sql_udf.cc and sql_update.cc */ -int ha_example::write_row(byte * buf) +int ha_example::write_row(uchar *buf) { DBUG_ENTER("ha_example::write_row"); DBUG_RETURN(HA_ERR_WRONG_COMMAND); @@ -378,7 +378,7 @@ int ha_example::write_row(byte * buf) @see sql_select.cc, sql_acl.cc, sql_update.cc and sql_insert.cc */ -int ha_example::update_row(const byte * old_data, byte * new_data) +int ha_example::update_row(const uchar *old_data, uchar *new_data) { DBUG_ENTER("ha_example::update_row"); @@ -406,7 +406,7 @@ int ha_example::update_row(const byte * old_data, byte * new_data) sql_acl.cc, sql_udf.cc, sql_delete.cc, sql_insert.cc and sql_select.cc */ -int ha_example::delete_row(const byte * buf) +int ha_example::delete_row(const uchar *buf) { DBUG_ENTER("ha_example::delete_row"); DBUG_RETURN(HA_ERR_WRONG_COMMAND); @@ -420,7 +420,7 @@ int ha_example::delete_row(const byte * buf) index. */ -int ha_example::index_read(byte * buf, const byte * key, +int ha_example::index_read(uchar *buf, const uchar *key, key_part_map keypart_map __attribute__((unused)), enum ha_rkey_function find_flag __attribute__((unused))) @@ -435,7 +435,7 @@ int ha_example::index_read(byte * buf, const byte * key, Used to read forward through the index. */ -int ha_example::index_next(byte * buf) +int ha_example::index_next(uchar *buf) { DBUG_ENTER("ha_example::index_next"); DBUG_RETURN(HA_ERR_WRONG_COMMAND); @@ -447,7 +447,7 @@ int ha_example::index_next(byte * buf) Used to read backwards through the index. */ -int ha_example::index_prev(byte * buf) +int ha_example::index_prev(uchar *buf) { DBUG_ENTER("ha_example::index_prev"); DBUG_RETURN(HA_ERR_WRONG_COMMAND); @@ -464,7 +464,7 @@ int ha_example::index_prev(byte * buf) @see opt_range.cc, opt_sum.cc, sql_handler.cc and sql_select.cc */ -int ha_example::index_first(byte * buf) +int ha_example::index_first(uchar *buf) { DBUG_ENTER("ha_example::index_first"); DBUG_RETURN(HA_ERR_WRONG_COMMAND); @@ -481,7 +481,7 @@ int ha_example::index_first(byte * buf) @see opt_range.cc, opt_sum.cc, sql_handler.cc and sql_select.cc */ -int ha_example::index_last(byte * buf) +int ha_example::index_last(uchar *buf) { DBUG_ENTER("ha_example::index_last"); DBUG_RETURN(HA_ERR_WRONG_COMMAND); @@ -528,7 +528,7 @@ int ha_example::rnd_end() @see filesort.cc, records.cc, sql_handler.cc, sql_select.cc, sql_table.cc and sql_update.cc */ -int ha_example::rnd_next(byte *buf) +int ha_example::rnd_next(uchar *buf) { DBUG_ENTER("ha_example::rnd_next"); DBUG_RETURN(HA_ERR_END_OF_FILE); @@ -556,7 +556,7 @@ int ha_example::rnd_next(byte *buf) @see filesort.cc, sql_select.cc, sql_delete.cc and sql_update.cc */ -void ha_example::position(const byte *record) +void ha_example::position(const uchar *record) { DBUG_ENTER("ha_example::position"); DBUG_VOID_RETURN; @@ -576,7 +576,7 @@ void ha_example::position(const byte *record) @see filesort.cc, records.cc, sql_insert.cc, sql_select.cc and sql_update.cc */ -int ha_example::rnd_pos(byte * buf, byte *pos) +int ha_example::rnd_pos(uchar *buf, uchar *pos) { DBUG_ENTER("ha_example::rnd_pos"); DBUG_RETURN(HA_ERR_WRONG_COMMAND); diff --git a/storage/example/ha_example.h b/storage/example/ha_example.h index 9777a478209..69b7cf4d336 100644 --- a/storage/example/ha_example.h +++ b/storage/example/ha_example.h @@ -172,50 +172,50 @@ public: We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int write_row(byte * buf); + int write_row(uchar *buf); /** @brief We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int update_row(const byte * old_data, byte * new_data); + int update_row(const uchar *old_data, uchar *new_data); /** @brief We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int delete_row(const byte * buf); + int delete_row(const uchar *buf); /** @brief We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int index_read(byte * buf, const byte * key, + int index_read(uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag); /** @brief We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int index_next(byte * buf); + int index_next(uchar *buf); /** @brief We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int index_prev(byte * buf); + int index_prev(uchar *buf); /** @brief We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int index_first(byte * buf); + int index_first(uchar *buf); /** @brief We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int index_last(byte * buf); + int index_last(uchar *buf); /** @brief Unlike index_init(), rnd_init() can be called two consecutive times @@ -227,9 +227,9 @@ public: */ int rnd_init(bool scan); //required int rnd_end(); - int rnd_next(byte *buf); ///< required - int rnd_pos(byte * buf, byte *pos); ///< required - void position(const byte *record); ///< required + int rnd_next(uchar *buf); ///< required + int rnd_pos(uchar *buf, uchar *pos); ///< required + void position(const uchar *record); ///< required int info(uint); ///< required int extra(enum ha_extra_function operation); int external_lock(THD *thd, int lock_type); ///< required diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index aa7184268f5..103cb9b4cb0 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -414,11 +414,11 @@ static handler *federated_create_handler(handlerton *hton, /* Function we use in the creation of our hash to get key */ -static byte *federated_get_key(FEDERATED_SHARE *share, uint *length, +static uchar *federated_get_key(FEDERATED_SHARE *share, size_t *length, my_bool not_used __attribute__ ((unused))) { *length= share->share_key_length; - return (byte*) share->share_key; + return (uchar*) share->share_key; } /* @@ -725,8 +725,8 @@ static int parse_url(MEM_ROOT *mem_root, FEDERATED_SHARE *share, TABLE *table, share->port= 0; share->socket= 0; DBUG_PRINT("info", ("share at %lx", (long unsigned int) share)); - DBUG_PRINT("info", ("Length: %d", table->s->connect_string.length)); - DBUG_PRINT("info", ("String: '%.*s'", table->s->connect_string.length, + DBUG_PRINT("info", ("Length: %u", (uint) table->s->connect_string.length)); + DBUG_PRINT("info", ("String: '%.*s'", (int) table->s->connect_string.length, table->s->connect_string.str)); share->connection_string= strmake_root(mem_root, table->s->connect_string.str, table->s->connect_string.length); @@ -930,7 +930,7 @@ ha_federated::ha_federated(handlerton *hton, 0 After fields have had field values stored from record */ -uint ha_federated::convert_row_to_internal_format(byte *record, +uint ha_federated::convert_row_to_internal_format(uchar *record, MYSQL_ROW row, MYSQL_RES *result) { @@ -978,7 +978,7 @@ static bool emit_key_part_name(String *to, KEY_PART_INFO *part) static bool emit_key_part_element(String *to, KEY_PART_INFO *part, bool needs_quotes, bool is_like, - const byte *ptr, uint len) + const uchar *ptr, uint len) { Field *field= part->field; DBUG_ENTER("emit_key_part_element"); @@ -1019,7 +1019,7 @@ static bool emit_key_part_element(String *to, KEY_PART_INFO *part, char strbuff[MAX_FIELD_WIDTH]; String str(strbuff, sizeof(strbuff), part->field->charset()), *res; - res= field->val_str(&str, (char *)ptr); + res= field->val_str(&str, ptr); if (field->result_type() == STRING_RESULT) { @@ -1286,7 +1286,7 @@ bool ha_federated::create_where_from_key(String *to, { bool both_not_null= (start_key != NULL && end_key != NULL) ? TRUE : FALSE; - const byte *ptr; + const uchar *ptr; uint remainder, length; char tmpbuff[FEDERATED_QUERY_BUFFER_SIZE]; String tmp(tmpbuff, sizeof(tmpbuff), system_charset_info); @@ -1325,7 +1325,7 @@ bool ha_federated::create_where_from_key(String *to, uint store_length= key_part->store_length; uint part_length= min(store_length, length); needs_quotes= field->str_needs_quotes(); - DBUG_DUMP("key, start of loop", (char *) ptr, length); + DBUG_DUMP("key, start of loop", ptr, length); if (key_part->null_bit) { @@ -1507,7 +1507,7 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table) /* TODO: change tmp_share.scheme to LEX_STRING object */ if (!(share= (FEDERATED_SHARE *) hash_search(&federated_open_tables, - (byte*) tmp_share.share_key, + (uchar*) tmp_share.share_key, tmp_share. share_key_length))) { @@ -1537,7 +1537,7 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table) DBUG_PRINT("info", ("share->select_query %s", share->select_query)); - if (my_hash_insert(&federated_open_tables, (byte*) share)) + if (my_hash_insert(&federated_open_tables, (uchar*) share)) goto error; thr_lock_init(&share->lock); pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST); @@ -1571,7 +1571,7 @@ static int free_share(FEDERATED_SHARE *share) pthread_mutex_lock(&federated_mutex); if (!--share->use_count) { - hash_delete(&federated_open_tables, (byte*) share); + hash_delete(&federated_open_tables, (uchar*) share); thr_lock_delete(&share->lock); VOID(pthread_mutex_destroy(&share->mutex)); free_root(&mem_root, MYF(0)); @@ -1755,7 +1755,7 @@ static inline uint field_in_record_is_null(TABLE *table, sql_insert.cc, sql_select.cc, sql_table.cc, sql_udf.cc, and sql_update.cc. */ -int ha_federated::write_row(byte *buf) +int ha_federated::write_row(uchar *buf) { /* I need a bool again, in 5.0, I used table->s->fields to accomplish this. @@ -2010,7 +2010,7 @@ int ha_federated::repair(THD* thd, HA_CHECK_OPT* check_opt) Called from sql_select.cc, sql_acl.cc, sql_update.cc, and sql_insert.cc. */ -int ha_federated::update_row(const byte *old_data, byte *new_data) +int ha_federated::update_row(const uchar *old_data, uchar *new_data) { /* This used to control how the query was built. If there was a @@ -2044,7 +2044,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) String where_string(where_buffer, sizeof(where_buffer), &my_charset_bin); - byte *record= table->record[0]; + uchar *record= table->record[0]; DBUG_ENTER("ha_federated::update_row"); /* set string lengths to 0 to avoid misc chars in string @@ -2103,7 +2103,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) bool needs_quote= (*field)->str_needs_quotes(); where_string.append(STRING_WITH_LEN(" = ")); (*field)->val_str(&field_value, - (char*) (old_data + (*field)->offset(record))); + (old_data + (*field)->offset(record))); if (needs_quote) where_string.append('\''); field_value.print(&where_string); @@ -2155,7 +2155,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) calls. */ -int ha_federated::delete_row(const byte *buf) +int ha_federated::delete_row(const uchar *buf) { char delete_buffer[FEDERATED_QUERY_BUFFER_SIZE]; char data_buffer[FEDERATED_QUERY_BUFFER_SIZE]; @@ -2225,7 +2225,7 @@ int ha_federated::delete_row(const byte *buf) a WHERE clause on a non-primary key index, simply calls index_read_idx. */ -int ha_federated::index_read(byte *buf, const byte *key, +int ha_federated::index_read(uchar *buf, const uchar *key, uint key_len, ha_rkey_function find_flag) { DBUG_ENTER("ha_federated::index_read"); @@ -2251,7 +2251,7 @@ int ha_federated::index_read(byte *buf, const byte *key, returns. We need to be able to be calable from ha_rnd_pos() */ -int ha_federated::index_read_idx(byte *buf, uint index, const byte *key, +int ha_federated::index_read_idx(uchar *buf, uint index, const uchar *key, uint key_len, enum ha_rkey_function find_flag) { int retval; @@ -2277,8 +2277,8 @@ int ha_federated::index_read_idx(byte *buf, uint index, const byte *key, table->status == STATUS_NOT_FOUND */ -int ha_federated::index_read_idx_with_result_set(byte *buf, uint index, - const byte *key, +int ha_federated::index_read_idx_with_result_set(uchar *buf, uint index, + const uchar *key, uint key_len, ha_rkey_function find_flag, MYSQL_RES **result) @@ -2411,7 +2411,7 @@ int ha_federated::read_range_next() /* Used to read forward through the index. */ -int ha_federated::index_next(byte *buf) +int ha_federated::index_next(uchar *buf) { DBUG_ENTER("ha_federated::index_next"); statistic_increment(table->in_use->status_var.ha_read_next_count, @@ -2525,7 +2525,7 @@ int ha_federated::index_end(void) sql_table.cc, and sql_update.cc. */ -int ha_federated::rnd_next(byte *buf) +int ha_federated::rnd_next(uchar *buf) { DBUG_ENTER("ha_federated::rnd_next"); @@ -2562,7 +2562,7 @@ int ha_federated::rnd_next(byte *buf) 0 no error */ -int ha_federated::read_next(byte *buf, MYSQL_RES *result) +int ha_federated::read_next(uchar *buf, MYSQL_RES *result) { int retval; MYSQL_ROW row; @@ -2591,11 +2591,11 @@ int ha_federated::read_next(byte *buf, MYSQL_RES *result) Called from filesort.cc, sql_select.cc, sql_delete.cc and sql_update.cc. */ -void ha_federated::position(const byte *record) +void ha_federated::position(const uchar *record) { DBUG_ENTER("ha_federated::position"); if (table->s->primary_key != MAX_KEY) - key_copy(ref, (byte *)record, table->key_info + table->s->primary_key, + key_copy(ref, (uchar *)record, table->key_info + table->s->primary_key, ref_length); else memcpy(ref, record, ref_length); @@ -2612,7 +2612,7 @@ void ha_federated::position(const byte *record) Called from filesort.cc records.cc sql_insert.cc sql_select.cc sql_update.cc. */ -int ha_federated::rnd_pos(byte *buf, byte *pos) +int ha_federated::rnd_pos(uchar *buf, uchar *pos) { int result; DBUG_ENTER("ha_federated::rnd_pos"); diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h index 4d2eefdd986..94f61af96c3 100644 --- a/storage/federated/ha_federated.h +++ b/storage/federated/ha_federated.h @@ -94,7 +94,7 @@ private: return 0 on success return errorcode otherwise */ - uint convert_row_to_internal_format(byte *buf, MYSQL_ROW row, + uint convert_row_to_internal_format(uchar *buf, MYSQL_ROW row, MYSQL_RES *result); bool create_where_from_key(String *to, KEY *key_info, const key_range *start_key, @@ -188,15 +188,15 @@ public: int open(const char *name, int mode, uint test_if_locked); // required int close(void); // required - int write_row(byte *buf); - int update_row(const byte *old_data, byte *new_data); - int delete_row(const byte *buf); + int write_row(uchar *buf); + int update_row(const uchar *old_data, uchar *new_data); + int delete_row(const uchar *buf); int index_init(uint keynr, bool sorted); - int index_read(byte *buf, const byte *key, + int index_read(uchar *buf, const uchar *key, uint key_len, enum ha_rkey_function find_flag); - int index_read_idx(byte *buf, uint idx, const byte *key, + int index_read_idx(uchar *buf, uint idx, const uchar *key, uint key_len, enum ha_rkey_function find_flag); - int index_next(byte *buf); + int index_next(uchar *buf); int index_end(); int read_range_first(const key_range *start_key, const key_range *end_key, @@ -212,9 +212,9 @@ public: */ int rnd_init(bool scan); //required int rnd_end(); - int rnd_next(byte *buf); //required - int rnd_pos(byte *buf, byte *pos); //required - void position(const byte *record); //required + int rnd_next(uchar *buf); //required + int rnd_pos(uchar *buf, uchar *pos); //required + void position(const uchar *record); //required int info(uint); //required void update_auto_increment(void); @@ -237,9 +237,9 @@ public: int connection_autocommit(bool state); int execute_simple_query(const char *query, int len); - int read_next(byte *buf, MYSQL_RES *result); - int index_read_idx_with_result_set(byte *buf, uint index, - const byte *key, + int read_next(uchar *buf, MYSQL_RES *result); + int index_read_idx_with_result_set(uchar *buf, uint index, + const uchar *key, uint key_len, ha_rkey_function find_flag, MYSQL_RES **result); diff --git a/storage/heap/_check.c b/storage/heap/_check.c index 05f12dade0d..08b6da62ae1 100644 --- a/storage/heap/_check.c +++ b/storage/heap/_check.c @@ -167,7 +167,7 @@ static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records, HP_KEYDEF *keydef= info->s->keydef + keynr; int error= 0; ulong found= 0; - byte *key, *recpos; + uchar *key, *recpos; uint key_length; uint not_used[2]; @@ -176,7 +176,7 @@ static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records, { do { - memcpy(&recpos, key + (*keydef->get_key_length)(keydef,key), sizeof(byte*)); + memcpy(&recpos, key + (*keydef->get_key_length)(keydef,key), sizeof(uchar*)); key_length= hp_rb_make_key(keydef, info->recbuf, recpos, 0); if (ha_key_cmp(keydef->seg, (uchar*) info->recbuf, (uchar*) key, key_length, SEARCH_FIND | SEARCH_SAME, not_used)) diff --git a/storage/heap/_rectest.c b/storage/heap/_rectest.c index 2fd2d39bed7..068fedf719c 100644 --- a/storage/heap/_rectest.c +++ b/storage/heap/_rectest.c @@ -18,7 +18,7 @@ #include "heapdef.h" -int hp_rectest(register HP_INFO *info, register const byte *old) +int hp_rectest(register HP_INFO *info, register const uchar *old) { DBUG_ENTER("hp_rectest"); diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index 8c378f7334f..ec52d6f835c 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -178,7 +178,7 @@ void ha_heap::update_key_stats() } -int ha_heap::write_row(byte * buf) +int ha_heap::write_row(uchar * buf) { int res; statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status); @@ -202,7 +202,7 @@ int ha_heap::write_row(byte * buf) return res; } -int ha_heap::update_row(const byte * old_data, byte * new_data) +int ha_heap::update_row(const uchar * old_data, uchar * new_data) { int res; statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status); @@ -221,7 +221,7 @@ int ha_heap::update_row(const byte * old_data, byte * new_data) return res; } -int ha_heap::delete_row(const byte * buf) +int ha_heap::delete_row(const uchar * buf) { int res; statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status); @@ -238,7 +238,7 @@ int ha_heap::delete_row(const byte * buf) return res; } -int ha_heap::index_read(byte * buf, const byte * key, key_part_map keypart_map, +int ha_heap::index_read(uchar * buf, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag) { DBUG_ASSERT(inited==INDEX); @@ -249,7 +249,7 @@ int ha_heap::index_read(byte * buf, const byte * key, key_part_map keypart_map, return error; } -int ha_heap::index_read_last(byte *buf, const byte *key, key_part_map keypart_map) +int ha_heap::index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map) { DBUG_ASSERT(inited==INDEX); statistic_increment(table->in_use->status_var.ha_read_key_count, @@ -260,7 +260,7 @@ int ha_heap::index_read_last(byte *buf, const byte *key, key_part_map keypart_ma return error; } -int ha_heap::index_read_idx(byte * buf, uint index, const byte * key, +int ha_heap::index_read_idx(uchar * buf, uint index, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag) { @@ -271,7 +271,7 @@ int ha_heap::index_read_idx(byte * buf, uint index, const byte * key, return error; } -int ha_heap::index_next(byte * buf) +int ha_heap::index_next(uchar * buf) { DBUG_ASSERT(inited==INDEX); statistic_increment(table->in_use->status_var.ha_read_next_count, @@ -281,7 +281,7 @@ int ha_heap::index_next(byte * buf) return error; } -int ha_heap::index_prev(byte * buf) +int ha_heap::index_prev(uchar * buf) { DBUG_ASSERT(inited==INDEX); statistic_increment(table->in_use->status_var.ha_read_prev_count, @@ -291,7 +291,7 @@ int ha_heap::index_prev(byte * buf) return error; } -int ha_heap::index_first(byte * buf) +int ha_heap::index_first(uchar * buf) { DBUG_ASSERT(inited==INDEX); statistic_increment(table->in_use->status_var.ha_read_first_count, @@ -301,7 +301,7 @@ int ha_heap::index_first(byte * buf) return error; } -int ha_heap::index_last(byte * buf) +int ha_heap::index_last(uchar * buf) { DBUG_ASSERT(inited==INDEX); statistic_increment(table->in_use->status_var.ha_read_last_count, @@ -316,7 +316,7 @@ int ha_heap::rnd_init(bool scan) return scan ? heap_scan_init(file) : 0; } -int ha_heap::rnd_next(byte *buf) +int ha_heap::rnd_next(uchar *buf) { statistic_increment(table->in_use->status_var.ha_read_rnd_next_count, &LOCK_status); @@ -325,7 +325,7 @@ int ha_heap::rnd_next(byte *buf) return error; } -int ha_heap::rnd_pos(byte * buf, byte *pos) +int ha_heap::rnd_pos(uchar * buf, uchar *pos) { int error; HEAP_PTR heap_position; @@ -337,7 +337,7 @@ int ha_heap::rnd_pos(byte * buf, byte *pos) return error; } -void ha_heap::position(const byte *record) +void ha_heap::position(const uchar *record) { *(HEAP_PTR*) ref= heap_position(file); // Ref is aligned } @@ -677,7 +677,7 @@ int ha_heap::create(const char *name, TABLE *table_arg, share->max_rows) ? share->max_rows : max_rows), (ulong) share->min_rows, &hp_create_info); - my_free((gptr) keydef, MYF(0)); + my_free((uchar*) keydef, MYF(0)); if (file) info(HA_STATUS_NO_LOCK | HA_STATUS_CONST | HA_STATUS_VARIABLE); return (error); diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h index a2d531fc515..c93a33b524b 100644 --- a/storage/heap/ha_heap.h +++ b/storage/heap/ha_heap.h @@ -68,26 +68,26 @@ public: int open(const char *name, int mode, uint test_if_locked); int close(void); void set_keys_for_scanning(void); - int write_row(byte * buf); - int update_row(const byte * old_data, byte * new_data); - int delete_row(const byte * buf); + int write_row(uchar * buf); + int update_row(const uchar * old_data, uchar * new_data); + int delete_row(const uchar * buf); virtual void get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong *first_value, ulonglong *nb_reserved_values); - int index_read(byte * buf, const byte * key, key_part_map keypart_map, + int index_read(uchar * buf, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag); - int index_read_last(byte *buf, const byte *key, key_part_map keypart_map); - int index_read_idx(byte * buf, uint index, const byte * key, + int index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map); + int index_read_idx(uchar * buf, uint index, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag); - int index_next(byte * buf); - int index_prev(byte * buf); - int index_first(byte * buf); - int index_last(byte * buf); + int index_next(uchar * buf); + int index_prev(uchar * buf); + int index_first(uchar * buf); + int index_last(uchar * buf); int rnd_init(bool scan); - int rnd_next(byte *buf); - int rnd_pos(byte * buf, byte *pos); - void position(const byte *record); + int rnd_next(uchar *buf); + int rnd_pos(uchar * buf, uchar *pos); + void position(const uchar *record); int info(uint); int extra(enum ha_extra_function operation); int reset(); @@ -105,7 +105,7 @@ public: THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); - int cmp_ref(const byte *ref1, const byte *ref2) + int cmp_ref(const uchar *ref1, const uchar *ref2) { HEAP_PTR ptr1=*(HEAP_PTR*)ref1; HEAP_PTR ptr2=*(HEAP_PTR*)ref2; diff --git a/storage/heap/heapdef.h b/storage/heap/heapdef.h index b52a6c60ac6..c43d73eb96d 100644 --- a/storage/heap/heapdef.h +++ b/storage/heap/heapdef.h @@ -48,7 +48,7 @@ if (!(info->update & HA_STATE_AKTIV))\ typedef struct st_hp_hash_info { struct st_hp_hash_info *next_key; - byte *ptr_to_rec; + uchar *ptr_to_rec; } HASH_INFO; typedef struct { @@ -60,42 +60,42 @@ typedef struct { /* Prototypes for intern functions */ extern HP_SHARE *hp_find_named_heap(const char *name); -extern int hp_rectest(HP_INFO *info,const byte *old); -extern byte *hp_find_block(HP_BLOCK *info,ulong pos); -extern int hp_get_new_block(HP_BLOCK *info, ulong* alloc_length); +extern int hp_rectest(HP_INFO *info,const uchar *old); +extern uchar *hp_find_block(HP_BLOCK *info,ulong pos); +extern int hp_get_new_block(HP_BLOCK *info, size_t* alloc_length); extern void hp_free(HP_SHARE *info); -extern byte *hp_free_level(HP_BLOCK *block,uint level,HP_PTRS *pos, - byte *last_pos); +extern uchar *hp_free_level(HP_BLOCK *block,uint level,HP_PTRS *pos, + uchar *last_pos); extern int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, - const byte *record, byte *recpos); + const uchar *record, uchar *recpos); extern int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, - const byte *record, byte *recpos); + const uchar *record, uchar *recpos); extern int hp_rb_delete_key(HP_INFO *info,HP_KEYDEF *keyinfo, - const byte *record,byte *recpos,int flag); + const uchar *record,uchar *recpos,int flag); extern int hp_delete_key(HP_INFO *info,HP_KEYDEF *keyinfo, - const byte *record,byte *recpos,int flag); + const uchar *record,uchar *recpos,int flag); extern HASH_INFO *_heap_find_hash(HP_BLOCK *block,ulong pos); -extern byte *hp_search(HP_INFO *info,HP_KEYDEF *keyinfo,const byte *key, +extern uchar *hp_search(HP_INFO *info,HP_KEYDEF *keyinfo,const uchar *key, uint nextflag); -extern byte *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo, - const byte *key, HASH_INFO *pos); -extern ulong hp_hashnr(HP_KEYDEF *keyinfo,const byte *key); -extern ulong hp_rec_hashnr(HP_KEYDEF *keyinfo,const byte *rec); +extern uchar *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo, + const uchar *key, HASH_INFO *pos); +extern ulong hp_hashnr(HP_KEYDEF *keyinfo,const uchar *key); +extern ulong hp_rec_hashnr(HP_KEYDEF *keyinfo,const uchar *rec); extern ulong hp_mask(ulong hashnr,ulong buffmax,ulong maxlength); extern void hp_movelink(HASH_INFO *pos,HASH_INFO *next_link, HASH_INFO *newlink); -extern int hp_rec_key_cmp(HP_KEYDEF *keydef,const byte *rec1, - const byte *rec2, +extern int hp_rec_key_cmp(HP_KEYDEF *keydef,const uchar *rec1, + const uchar *rec2, my_bool diff_if_only_endspace_difference); -extern int hp_key_cmp(HP_KEYDEF *keydef,const byte *rec, - const byte *key); -extern void hp_make_key(HP_KEYDEF *keydef,byte *key,const byte *rec); -extern uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key, - const byte *rec, byte *recpos); -extern uint hp_rb_key_length(HP_KEYDEF *keydef, const byte *key); -extern uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key); -extern uint hp_rb_var_key_length(HP_KEYDEF *keydef, const byte *key); -extern my_bool hp_if_null_in_key(HP_KEYDEF *keyinfo, const byte *record); +extern int hp_key_cmp(HP_KEYDEF *keydef,const uchar *rec, + const uchar *key); +extern void hp_make_key(HP_KEYDEF *keydef,uchar *key,const uchar *rec); +extern uint hp_rb_make_key(HP_KEYDEF *keydef, uchar *key, + const uchar *rec, uchar *recpos); +extern uint hp_rb_key_length(HP_KEYDEF *keydef, const uchar *key); +extern uint hp_rb_null_key_length(HP_KEYDEF *keydef, const uchar *key); +extern uint hp_rb_var_key_length(HP_KEYDEF *keydef, const uchar *key); +extern my_bool hp_if_null_in_key(HP_KEYDEF *keyinfo, const uchar *record); extern int hp_close(register HP_INFO *info); extern void hp_clear(HP_SHARE *info); extern void hp_clear_keys(HP_SHARE *info); diff --git a/storage/heap/hp_block.c b/storage/heap/hp_block.c index 85219380287..c622a9e52f8 100644 --- a/storage/heap/hp_block.c +++ b/storage/heap/hp_block.c @@ -26,7 +26,7 @@ {p_0, p_1, ...} serve as indexes to descend the blocks tree. */ -byte *hp_find_block(HP_BLOCK *block, ulong pos) +uchar *hp_find_block(HP_BLOCK *block, ulong pos) { reg1 int i; reg3 HP_PTRS *ptr; /* block base ptr */ @@ -36,12 +36,13 @@ byte *hp_find_block(HP_BLOCK *block, ulong pos) ptr=(HP_PTRS*)ptr->blocks[pos/block->level_info[i].records_under_level]; pos%=block->level_info[i].records_under_level; } - return (byte*) ptr+ pos*block->recbuffer; + return (uchar*) ptr+ pos*block->recbuffer; } /* Get one new block-of-records. Alloc ptr to block if needed + SYNOPSIS hp_get_new_block() block HP_BLOCK tree-like block @@ -53,7 +54,7 @@ byte *hp_find_block(HP_BLOCK *block, ulong pos) 1 Out of memory */ -int hp_get_new_block(HP_BLOCK *block, ulong *alloc_length) +int hp_get_new_block(HP_BLOCK *block, size_t *alloc_length) { reg1 uint i,j; HP_PTRS *root; @@ -101,13 +102,13 @@ int hp_get_new_block(HP_BLOCK *block, ulong *alloc_length) /* Occupy the free slot we've found at level i */ block->level_info[i].last_blocks-> blocks[HP_PTRS_IN_NOD - block->level_info[i].free_ptrs_in_block--]= - (byte*) root; + (uchar*) root; /* Add a block subtree with each node having one left-most child */ for (j=i-1 ; j >0 ; j--) { block->level_info[j].last_blocks= root++; - block->level_info[j].last_blocks->blocks[0]=(byte*) root; + block->level_info[j].last_blocks->blocks[0]=(uchar*) root; block->level_info[j].free_ptrs_in_block=HP_PTRS_IN_NOD-1; } @@ -124,27 +125,27 @@ int hp_get_new_block(HP_BLOCK *block, ulong *alloc_length) /* free all blocks under level */ -byte *hp_free_level(HP_BLOCK *block, uint level, HP_PTRS *pos, byte *last_pos) +uchar *hp_free_level(HP_BLOCK *block, uint level, HP_PTRS *pos, uchar *last_pos) { int i,max_pos; - byte *next_ptr; + uchar *next_ptr; if (level == 1) - next_ptr=(byte*) pos+block->recbuffer; + next_ptr=(uchar*) pos+block->recbuffer; else { max_pos= (block->level_info[level-1].last_blocks == pos) ? HP_PTRS_IN_NOD - block->level_info[level-1].free_ptrs_in_block : HP_PTRS_IN_NOD; - next_ptr=(byte*) (pos+1); + next_ptr=(uchar*) (pos+1); for (i=0 ; i < max_pos ; i++) next_ptr=hp_free_level(block,level-1, (HP_PTRS*) pos->blocks[i],next_ptr); } - if ((byte*) pos != last_pos) + if ((uchar*) pos != last_pos) { - my_free((gptr) pos,MYF(0)); + my_free((uchar*) pos,MYF(0)); return last_pos; } return next_ptr; /* next memory position */ diff --git a/storage/heap/hp_clear.c b/storage/heap/hp_clear.c index 2d8b8b394d5..babfcbd6f41 100644 --- a/storage/heap/hp_clear.c +++ b/storage/heap/hp_clear.c @@ -32,7 +32,7 @@ void hp_clear(HP_SHARE *info) if (info->block.levels) VOID(hp_free_level(&info->block,info->block.levels,info->block.root, - (byte*) 0)); + (uchar*) 0)); info->block.levels=0; hp_clear_keys(info); info->records= info->deleted= 0; @@ -94,7 +94,7 @@ void hp_clear_keys(HP_SHARE *info) { HP_BLOCK *block= &keyinfo->block; if (block->levels) - VOID(hp_free_level(block,block->levels,block->root,(byte*) 0)); + VOID(hp_free_level(block,block->levels,block->root,(uchar*) 0)); block->levels=0; block->last_allocated=0; keyinfo->hash_buckets= 0; diff --git a/storage/heap/hp_close.c b/storage/heap/hp_close.c index 5f6fc3249b5..79fed859487 100644 --- a/storage/heap/hp_close.c +++ b/storage/heap/hp_close.c @@ -45,6 +45,6 @@ int hp_close(register HP_INFO *info) heap_open_list=list_delete(heap_open_list,&info->open_list); if (!--info->s->open_count && info->s->delete_on_close) hp_free(info->s); /* Table was deleted */ - my_free((gptr) info,MYF(0)); + my_free((uchar*) info,MYF(0)); DBUG_RETURN(error); } diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c index 4e1347966b9..b910b89ffcd 100644 --- a/storage/heap/hp_create.c +++ b/storage/heap/hp_create.c @@ -42,10 +42,10 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef, DBUG_PRINT("info",("Initializing new table")); /* - We have to store sometimes byte* del_link in records, - so the record length should be at least sizeof(byte*) + We have to store sometimes uchar* del_link in records, + so the record length should be at least sizeof(uchar*) */ - set_if_bigger(reclength, sizeof (byte*)); + set_if_bigger(reclength, sizeof (uchar*)); for (i= key_segs= max_length= 0, keyinfo= keydef; i < keys; i++, keyinfo++) { @@ -112,7 +112,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef, } keyinfo->length= length; length+= keyinfo->rb_tree.size_of_element + - ((keyinfo->algorithm == HA_KEY_ALG_BTREE) ? sizeof(byte*) : 0); + ((keyinfo->algorithm == HA_KEY_ALG_BTREE) ? sizeof(uchar*) : 0); if (length > max_length) max_length= length; key_segs+= keyinfo->keysegs; @@ -152,12 +152,12 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef, { /* additional HA_KEYTYPE_END keyseg */ keyseg->type= HA_KEYTYPE_END; - keyseg->length= sizeof(byte*); + keyseg->length= sizeof(uchar*); keyseg->flag= 0; keyseg->null_bit= 0; keyseg++; - init_tree(&keyinfo->rb_tree, 0, 0, sizeof(byte*), + init_tree(&keyinfo->rb_tree, 0, 0, sizeof(uchar*), (qsort_cmp2)keys_compare, 1, NULL, NULL); keyinfo->delete_key= hp_rb_delete_key; keyinfo->write_key= hp_rb_write_key; @@ -188,7 +188,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef, /* Must be allocated separately for rename to work */ if (!(share->name= my_strdup(name,MYF(0)))) { - my_free((gptr) share,MYF(0)); + my_free((uchar*) share,MYF(0)); pthread_mutex_unlock(&THR_LOCK_heap); DBUG_RETURN(1); } @@ -218,7 +218,7 @@ static void init_block(HP_BLOCK *block, uint reclength, ulong min_records, max_records= max(min_records,max_records); if (!max_records) max_records= 1000; /* As good as quess as anything */ - recbuffer= (uint) (reclength + sizeof(byte**) - 1) & ~(sizeof(byte**) - 1); + recbuffer= (uint) (reclength + sizeof(uchar**) - 1) & ~(sizeof(uchar**) - 1); records_in_block= max_records / 10; if (records_in_block < 10 && max_records) records_in_block= 10; @@ -285,7 +285,7 @@ void hp_free(HP_SHARE *share) thr_lock_delete(&share->lock); VOID(pthread_mutex_destroy(&share->intern_lock)); #endif - my_free((gptr) share->name, MYF(0)); - my_free((gptr) share, MYF(0)); + my_free((uchar*) share->name, MYF(0)); + my_free((uchar*) share, MYF(0)); return; } diff --git a/storage/heap/hp_delete.c b/storage/heap/hp_delete.c index 637e5f1a497..1dd79a42e0b 100644 --- a/storage/heap/hp_delete.c +++ b/storage/heap/hp_delete.c @@ -17,9 +17,9 @@ #include "heapdef.h" -int heap_delete(HP_INFO *info, const byte *record) +int heap_delete(HP_INFO *info, const uchar *record) { - byte *pos; + uchar *pos; HP_SHARE *share=info->s; HP_KEYDEF *keydef, *end, *p_lastinx; DBUG_ENTER("heap_delete"); @@ -43,7 +43,7 @@ int heap_delete(HP_INFO *info, const byte *record) } info->update=HA_STATE_DELETED; - *((byte**) pos)=share->del_link; + *((uchar**) pos)=share->del_link; share->del_link=pos; pos[share->reclength]=0; /* Record deleted */ share->deleted++; @@ -65,7 +65,7 @@ err: */ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo, - const byte *record, byte *recpos, int flag) + const uchar *record, uchar *recpos, int flag) { heap_rb_param custom_arg; uint old_allocated; @@ -105,7 +105,7 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo, */ int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo, - const byte *record, byte *recpos, int flag) + const uchar *record, uchar *recpos, int flag) { ulong blength,pos2,pos_hashnr,lastpos_hashnr; HASH_INFO *lastpos,*gpos,*pos,*pos3,*empty,*last_ptr; diff --git a/storage/heap/hp_hash.c b/storage/heap/hp_hash.c index fbf3e541372..470b8c6841f 100644 --- a/storage/heap/hp_hash.c +++ b/storage/heap/hp_hash.c @@ -97,7 +97,7 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, key_range *min_key, /* Sets info->current_ptr to found record */ /* next_flag: Search=0, next=1, prev =2, same =3 */ -byte *hp_search(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *key, +uchar *hp_search(HP_INFO *info, HP_KEYDEF *keyinfo, const uchar *key, uint nextflag) { reg1 HASH_INFO *pos,*prev_ptr; @@ -175,7 +175,7 @@ byte *hp_search(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *key, since last read ! */ -byte *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *key, +uchar *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo, const uchar *key, HASH_INFO *pos) { DBUG_ENTER("hp_search_next"); @@ -238,7 +238,7 @@ void hp_movelink(HASH_INFO *pos, HASH_INFO *next_link, HASH_INFO *newlink) /* Calc hashvalue for a key */ -ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) +ulong hp_hashnr(register HP_KEYDEF *keydef, register const uchar *key) { /*register*/ ulong nr=1, nr2=4; @@ -304,7 +304,7 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) /* Calc hashvalue for a key in a record */ -ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) +ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec) { ulong nr=1, nr2=4; HA_KEYSEG *seg,*endseg; @@ -377,7 +377,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) * far, and works well on both numbers and strings. */ -ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) +ulong hp_hashnr(register HP_KEYDEF *keydef, register const uchar *key) { register ulong nr=0; HA_KEYSEG *seg,*endseg; @@ -426,7 +426,7 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) /* Calc hashvalue for a key in a record */ -ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) +ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec) { register ulong nr=0; HA_KEYSEG *seg,*endseg; @@ -490,7 +490,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) <> 0 Key differes */ -int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2, +int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2, my_bool diff_if_only_endspace_difference) { HA_KEYSEG *seg,*endseg; @@ -577,7 +577,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2, /* Compare a key in a record to a whole key */ -int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key) +int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key) { HA_KEYSEG *seg,*endseg; @@ -661,7 +661,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key) /* Copy a key from a record to a keybuffer */ -void hp_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec) +void hp_make_key(HP_KEYDEF *keydef, uchar *key, const uchar *rec) { HA_KEYSEG *seg,*endseg; @@ -693,10 +693,10 @@ void hp_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec) } while(0) -uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key, - const byte *rec, byte *recpos) +uint hp_rb_make_key(HP_KEYDEF *keydef, uchar *key, + const uchar *rec, uchar *recpos) { - byte *start_key= key; + uchar *start_key= key; HA_KEYSEG *seg, *endseg; for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg; seg++) @@ -710,7 +710,7 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key, if (seg->flag & HA_SWAP_KEY) { uint length= seg->length; - byte *pos= (byte*) rec + seg->start; + uchar *pos= (uchar*) rec + seg->start; #ifdef HAVE_ISNAN if (seg->type == HA_KEYTYPE_FLOAT) @@ -759,7 +759,7 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key, set_if_smaller(length,tmp_length); FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); - memcpy((byte*) key,(byte*) pos,(size_t) char_length); + memcpy((uchar*) key,(uchar*) pos,(size_t) char_length); key+= char_length; continue; } @@ -778,7 +778,7 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key, memcpy(key, rec + seg->start, (size_t) char_length); key+= seg->length; } - memcpy(key, &recpos, sizeof(byte*)); + memcpy(key, &recpos, sizeof(uchar*)); return (uint) (key - start_key); } @@ -802,7 +802,7 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, if (seg->flag & HA_SWAP_KEY) { uint length= seg->length; - byte *pos= (byte*) old + length; + uchar *pos= (uchar*) old + length; while (length--) { @@ -822,7 +822,7 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, set_if_smaller(length,tmp_length); /* Safety */ FIX_LENGTH(cs, old, length, char_length); store_key_length_inc(key,char_length); - memcpy((byte*) key, old,(size_t) char_length); + memcpy((uchar*) key, old,(size_t) char_length); key+= char_length; continue; } @@ -844,15 +844,15 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint hp_rb_key_length(HP_KEYDEF *keydef, - const byte *key __attribute__((unused))) + const uchar *key __attribute__((unused))) { return keydef->length; } -uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key) +uint hp_rb_null_key_length(HP_KEYDEF *keydef, const uchar *key) { - const byte *start_key= key; + const uchar *start_key= key; HA_KEYSEG *seg, *endseg; for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg; seg++) @@ -865,9 +865,9 @@ uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key) } -uint hp_rb_var_key_length(HP_KEYDEF *keydef, const byte *key) +uint hp_rb_var_key_length(HP_KEYDEF *keydef, const uchar *key) { - const byte *start_key= key; + const uchar *start_key= key; HA_KEYSEG *seg, *endseg; for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg; seg++) @@ -892,7 +892,7 @@ uint hp_rb_var_key_length(HP_KEYDEF *keydef, const byte *key) 0 otherwise */ -my_bool hp_if_null_in_key(HP_KEYDEF *keydef, const byte *record) +my_bool hp_if_null_in_key(HP_KEYDEF *keydef, const uchar *record) { HA_KEYSEG *seg,*endseg; for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) @@ -918,7 +918,7 @@ my_bool hp_if_null_in_key(HP_KEYDEF *keydef, const byte *record) less than zero. */ -void heap_update_auto_increment(HP_INFO *info, const byte *record) +void heap_update_auto_increment(HP_INFO *info, const uchar *record) { ulonglong value= 0; /* Store unsigned values here */ longlong s_value= 0; /* Store signed values here */ diff --git a/storage/heap/hp_info.c b/storage/heap/hp_info.c index 2c58604eed1..ea78c53fd40 100644 --- a/storage/heap/hp_info.c +++ b/storage/heap/hp_info.c @@ -18,7 +18,7 @@ #include "heapdef.h" -byte *heap_position(HP_INFO *info) +uchar *heap_position(HP_INFO *info) { return ((info->update & HA_STATE_AKTIV) ? info->current_ptr : (HEAP_PTR) 0); diff --git a/storage/heap/hp_open.c b/storage/heap/hp_open.c index 02a8d4f95ca..d252704a11b 100644 --- a/storage/heap/hp_open.c +++ b/storage/heap/hp_open.c @@ -51,8 +51,8 @@ HP_INFO *heap_open(const char *name, int mode) pthread_mutex_unlock(&THR_LOCK_heap); info->s= share; - info->lastkey= (byte*) (info + 1); - info->recbuf= (byte*) (info->lastkey + share->max_key_length); + info->lastkey= (uchar*) (info + 1); + info->recbuf= (uchar*) (info->lastkey + share->max_key_length); info->mode= mode; info->current_record= (ulong) ~0L; /* No current record */ info->current_ptr= 0; diff --git a/storage/heap/hp_rfirst.c b/storage/heap/hp_rfirst.c index d1842949421..48c1e625bd8 100644 --- a/storage/heap/hp_rfirst.c +++ b/storage/heap/hp_rfirst.c @@ -17,7 +17,7 @@ /* Read first record with the current key */ -int heap_rfirst(HP_INFO *info, byte *record, int inx) +int heap_rfirst(HP_INFO *info, uchar *record, int inx) { HP_SHARE *share = info->s; HP_KEYDEF *keyinfo = share->keydef + inx; @@ -26,13 +26,13 @@ int heap_rfirst(HP_INFO *info, byte *record, int inx) info->lastinx= inx; if (keyinfo->algorithm == HA_KEY_ALG_BTREE) { - byte *pos; + uchar *pos; if ((pos = tree_search_edge(&keyinfo->rb_tree, info->parents, &info->last_pos, offsetof(TREE_ELEMENT, left)))) { memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), - sizeof(byte*)); + sizeof(uchar*)); info->current_ptr = pos; memcpy(record, pos, (size_t)share->reclength); info->update = HA_STATE_AKTIV; diff --git a/storage/heap/hp_rkey.c b/storage/heap/hp_rkey.c index ced81985f99..6eeac6acd7b 100644 --- a/storage/heap/hp_rkey.c +++ b/storage/heap/hp_rkey.c @@ -15,10 +15,10 @@ #include "heapdef.h" -int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key, +int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) { - byte *pos; + uchar *pos; HP_SHARE *share= info->s; HP_KEYDEF *keyinfo= share->keydef + inx; DBUG_ENTER("heap_rkey"); @@ -53,7 +53,7 @@ int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key, info->update= 0; DBUG_RETURN(my_errno= HA_ERR_KEY_NOT_FOUND); } - memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(byte*)); + memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(uchar*)); info->current_ptr= pos; } else @@ -74,7 +74,7 @@ int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key, /* Quick find of record */ -gptr heap_find(HP_INFO *info, int inx, const byte *key) +uchar* heap_find(HP_INFO *info, int inx, const uchar *key) { return hp_search(info, info->s->keydef + inx, key, 0); } diff --git a/storage/heap/hp_rlast.c b/storage/heap/hp_rlast.c index b72e815147f..45ad7c21f49 100644 --- a/storage/heap/hp_rlast.c +++ b/storage/heap/hp_rlast.c @@ -18,7 +18,7 @@ /* Read first record with the current key */ -int heap_rlast(HP_INFO *info, byte *record, int inx) +int heap_rlast(HP_INFO *info, uchar *record, int inx) { HP_SHARE *share= info->s; HP_KEYDEF *keyinfo= share->keydef + inx; @@ -27,13 +27,13 @@ int heap_rlast(HP_INFO *info, byte *record, int inx) info->lastinx= inx; if (keyinfo->algorithm == HA_KEY_ALG_BTREE) { - byte *pos; + uchar *pos; if ((pos = tree_search_edge(&keyinfo->rb_tree, info->parents, &info->last_pos, offsetof(TREE_ELEMENT, right)))) { memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), - sizeof(byte*)); + sizeof(uchar*)); info->current_ptr = pos; memcpy(record, pos, (size_t)share->reclength); info->update = HA_STATE_AKTIV; diff --git a/storage/heap/hp_rnext.c b/storage/heap/hp_rnext.c index 3b436fe87aa..262754e9e64 100644 --- a/storage/heap/hp_rnext.c +++ b/storage/heap/hp_rnext.c @@ -17,9 +17,9 @@ /* Read next record with the same key */ -int heap_rnext(HP_INFO *info, byte *record) +int heap_rnext(HP_INFO *info, uchar *record) { - byte *pos; + uchar *pos; HP_SHARE *share=info->s; HP_KEYDEF *keyinfo; DBUG_ENTER("heap_rnext"); @@ -47,7 +47,7 @@ int heap_rnext(HP_INFO *info, byte *record) if (pos) { memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), - sizeof(byte*)); + sizeof(uchar*)); info->current_ptr = pos; } else diff --git a/storage/heap/hp_rprev.c b/storage/heap/hp_rprev.c index bfdd2f9d47a..63bfffffba9 100644 --- a/storage/heap/hp_rprev.c +++ b/storage/heap/hp_rprev.c @@ -18,9 +18,9 @@ /* Read prev record for key */ -int heap_rprev(HP_INFO *info, byte *record) +int heap_rprev(HP_INFO *info, uchar *record) { - byte *pos; + uchar *pos; HP_SHARE *share=info->s; HP_KEYDEF *keyinfo; DBUG_ENTER("heap_rprev"); @@ -47,7 +47,7 @@ int heap_rprev(HP_INFO *info, byte *record) if (pos) { memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), - sizeof(byte*)); + sizeof(uchar*)); info->current_ptr = pos; } else diff --git a/storage/heap/hp_rrnd.c b/storage/heap/hp_rrnd.c index ad0190cc00c..3ac23d293f2 100644 --- a/storage/heap/hp_rrnd.c +++ b/storage/heap/hp_rrnd.c @@ -24,7 +24,7 @@ HA_ERR_END_OF_FILE = EOF. */ -int heap_rrnd(register HP_INFO *info, byte *record, byte *pos) +int heap_rrnd(register HP_INFO *info, uchar *record, uchar *pos) { HP_SHARE *share=info->s; DBUG_ENTER("heap_rrnd"); @@ -59,7 +59,7 @@ int heap_rrnd(register HP_INFO *info, byte *record, byte *pos) HA_ERR_END_OF_FILE = EOF. */ -int heap_rrnd_old(register HP_INFO *info, byte *record, ulong pos) +int heap_rrnd_old(register HP_INFO *info, uchar *record, ulong pos) { HP_SHARE *share=info->s; DBUG_ENTER("heap_rrnd"); diff --git a/storage/heap/hp_rsame.c b/storage/heap/hp_rsame.c index 10513f91726..1a3724672b6 100644 --- a/storage/heap/hp_rsame.c +++ b/storage/heap/hp_rsame.c @@ -25,7 +25,7 @@ HA_ERR_KEY_NOT_FOUND = Record not found with key */ -int heap_rsame(register HP_INFO *info, byte *record, int inx) +int heap_rsame(register HP_INFO *info, uchar *record, int inx) { HP_SHARE *share=info->s; DBUG_ENTER("heap_rsame"); diff --git a/storage/heap/hp_scan.c b/storage/heap/hp_scan.c index 4249ac4148a..e8913e92c86 100644 --- a/storage/heap/hp_scan.c +++ b/storage/heap/hp_scan.c @@ -34,7 +34,7 @@ int heap_scan_init(register HP_INFO *info) DBUG_RETURN(0); } -int heap_scan(register HP_INFO *info, byte *record) +int heap_scan(register HP_INFO *info, uchar *record) { HP_SHARE *share=info->s; ulong pos; diff --git a/storage/heap/hp_test1.c b/storage/heap/hp_test1.c index 31c9b8f2f30..aad5677db69 100644 --- a/storage/heap/hp_test1.c +++ b/storage/heap/hp_test1.c @@ -55,7 +55,7 @@ int main(int argc, char **argv) keyinfo[0].flag = HA_NOSAME; deleted=0; - bzero((gptr) flags,sizeof(flags)); + bzero((uchar*) flags,sizeof(flags)); printf("- Creating heap-file\n"); if (heap_create(filename,1,keyinfo,30,(ulong) flag*100000L,10L, diff --git a/storage/heap/hp_test2.c b/storage/heap/hp_test2.c index dcca5fb44b9..46b1fd61d46 100644 --- a/storage/heap/hp_test2.c +++ b/storage/heap/hp_test2.c @@ -42,7 +42,7 @@ static my_bool key3[MAX_RECORDS]; static int reclength=39; -static int calc_check(byte *buf,uint length); +static int calc_check(uchar *buf,uint length); static void make_record(char *record, uint n1, uint n2, uint n3, const char *mark, uint count); @@ -674,7 +674,7 @@ static sig_handler endprog(int sig_number __attribute__((unused))) } } -static int calc_check(byte *buf, uint length) +static int calc_check(uchar *buf, uint length) { int check=0; while (length--) diff --git a/storage/heap/hp_update.c b/storage/heap/hp_update.c index e7314e3d38c..11dca974ad4 100644 --- a/storage/heap/hp_update.c +++ b/storage/heap/hp_update.c @@ -17,10 +17,10 @@ #include "heapdef.h" -int heap_update(HP_INFO *info, const byte *old, const byte *heap_new) +int heap_update(HP_INFO *info, const uchar *old, const uchar *heap_new) { HP_KEYDEF *keydef, *end, *p_lastinx; - byte *pos; + uchar *pos; bool auto_key_changed= 0; HP_SHARE *share= info->s; DBUG_ENTER("heap_update"); diff --git a/storage/heap/hp_write.c b/storage/heap/hp_write.c index 19215fcf017..2abef2d9b43 100644 --- a/storage/heap/hp_write.c +++ b/storage/heap/hp_write.c @@ -25,14 +25,14 @@ #define HIGHFIND 4 #define HIGHUSED 8 -static byte *next_free_record_pos(HP_SHARE *info); +static uchar *next_free_record_pos(HP_SHARE *info); static HASH_INFO *hp_find_free_hash(HP_SHARE *info, HP_BLOCK *block, ulong records); -int heap_write(HP_INFO *info, const byte *record) +int heap_write(HP_INFO *info, const uchar *record) { HP_KEYDEF *keydef, *end; - byte *pos; + uchar *pos; HP_SHARE *share=info->s; DBUG_ENTER("heap_write"); #ifndef DBUG_OFF @@ -88,7 +88,7 @@ err: } share->deleted++; - *((byte**) pos)=share->del_link; + *((uchar**) pos)=share->del_link; share->del_link=pos; pos[share->reclength]=0; /* Record deleted */ @@ -99,8 +99,8 @@ err: Write a key to rb_tree-index */ -int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *record, - byte *recpos) +int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, const uchar *record, + uchar *recpos) { heap_rb_param custom_arg; uint old_allocated; @@ -130,17 +130,17 @@ int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *record, /* Find where to place new record */ -static byte *next_free_record_pos(HP_SHARE *info) +static uchar *next_free_record_pos(HP_SHARE *info) { int block_pos; - byte *pos; - ulong length; + uchar *pos; + size_t length; DBUG_ENTER("next_free_record_pos"); if (info->del_link) { pos=info->del_link; - info->del_link= *((byte**) pos); + info->del_link= *((uchar**) pos); info->deleted--; DBUG_PRINT("exit",("Used old position: 0x%lx",(long) pos)); DBUG_RETURN(pos); @@ -158,9 +158,9 @@ static byte *next_free_record_pos(HP_SHARE *info) info->data_length+=length; } DBUG_PRINT("exit",("Used new position: 0x%lx", - (long) ((byte*) info->block.level_info[0].last_blocks+ + (long) ((uchar*) info->block.level_info[0].last_blocks+ block_pos * info->block.recbuffer))); - DBUG_RETURN((byte*) info->block.level_info[0].last_blocks+ + DBUG_RETURN((uchar*) info->block.level_info[0].last_blocks+ block_pos*info->block.recbuffer); } @@ -191,12 +191,12 @@ static byte *next_free_record_pos(HP_SHARE *info) */ int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, - const byte *record, byte *recpos) + const uchar *record, uchar *recpos) { HP_SHARE *share = info->s; int flag; ulong halfbuff,hashnr,first_index; - byte *ptr_to_rec,*ptr_to_rec2; + uchar *ptr_to_rec,*ptr_to_rec2; HASH_INFO *empty,*gpos,*gpos2,*pos; DBUG_ENTER("hp_write_key"); @@ -390,7 +390,7 @@ static HASH_INFO *hp_find_free_hash(HP_SHARE *info, HP_BLOCK *block, ulong records) { uint block_pos; - ulong length; + size_t length; if (records < block->last_allocated) return hp_find_hash(block,records); @@ -401,6 +401,6 @@ static HASH_INFO *hp_find_free_hash(HP_SHARE *info, info->index_length+=length; } block->last_allocated=records+1; - return((HASH_INFO*) ((byte*) block->level_info[0].last_blocks+ + return((HASH_INFO*) ((uchar*) block->level_info[0].last_blocks+ block_pos*block->recbuffer)); } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index de9cf06fe3a..00d4db12823 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -60,7 +60,7 @@ static handlerton *legacy_innodb_hton; uses unsigned char; the header univ.i which we include next defines 'byte' as a macro which expands to 'unsigned char' */ -typedef byte mysql_byte; +typedef uchar mysql_byte; #define INSIDE_HA_INNOBASE_CC @@ -147,7 +147,7 @@ static HASH innobase_open_tables; bool nw_panic = FALSE; #endif -static mysql_byte* innobase_get_key(INNOBASE_SHARE *share,uint *length, +static mysql_byte* innobase_get_key(INNOBASE_SHARE *share, size_t *length, my_bool not_used __attribute__((unused))); static INNOBASE_SHARE *get_share(const char *table_name); static void free_share(INNOBASE_SHARE *share); @@ -730,7 +730,7 @@ innobase_mysql_print_thd( len = min(thd->query_length, max_query_len); if (len > (sizeof(buf) - 1)) { - dyn_str = my_malloc(len + 1, MYF(0)); + dyn_str = (char*) my_malloc(len + 1, MYF(0)); str = dyn_str; } @@ -1296,12 +1296,12 @@ innobase_print_identifier( output strings buffers must not be shared. The function only produces more output when the name contains other characters than [0-9A-Z_a-z]. */ - char* temp_name = my_malloc((uint) namelen + 1, MYF(MY_WME)); + char* temp_name = (char*) my_malloc((uint) namelen + 1, MYF(MY_WME)); uint qnamelen = (uint) (namelen + (1 + sizeof srv_mysql50_table_name_prefix)); if (temp_name) { - qname = my_malloc(qnamelen, MYF(MY_WME)); + qname = (char*) my_malloc(qnamelen, MYF(MY_WME)); if (qname) { memcpy(temp_name, name, namelen); temp_name[namelen] = 0; @@ -2441,7 +2441,7 @@ ha_innobase::open( "how you can resolve the problem.\n", norm_name); free_share(share); - my_free((gptr) upd_buff, MYF(0)); + my_free(upd_buff, MYF(0)); my_errno = ENOENT; DBUG_RETURN(HA_ERR_NO_SUCH_TABLE); @@ -2458,7 +2458,7 @@ ha_innobase::open( "how you can resolve the problem.\n", norm_name); free_share(share); - my_free((gptr) upd_buff, MYF(0)); + my_free(upd_buff, MYF(0)); my_errno = ENOENT; dict_table_decrement_handle_count(ib_table); @@ -2557,7 +2557,7 @@ ha_innobase::close(void) row_prebuilt_free(prebuilt); - my_free((gptr) upd_buff, MYF(0)); + my_free(upd_buff, MYF(0)); free_share(share); /* Tell InnoDB server that there might be work for @@ -2580,7 +2580,7 @@ get_field_offset( TABLE* table, /* in: MySQL table object */ Field* field) /* in: MySQL field object */ { - return((uint) (field->ptr - (char*) table->record[0])); + return((uint) (field->ptr - table->record[0])); } /****************************************************************** @@ -4432,7 +4432,7 @@ ha_innobase::rnd_pos( int error; uint keynr = active_index; DBUG_ENTER("rnd_pos"); - DBUG_DUMP("key", (char*) pos, ref_length); + DBUG_DUMP("key", pos, ref_length); ha_statistic_increment(&SSV::ha_read_rnd_count); @@ -4741,7 +4741,7 @@ create_index( error = convert_error_code_to_mysql(error, NULL); - my_free((gptr) field_lengths, MYF(0)); + my_free(field_lengths, MYF(0)); DBUG_RETURN(error); } @@ -5174,7 +5174,7 @@ innobase_drop_database( } ptr++; - namebuf = my_malloc((uint) len + 2, MYF(0)); + namebuf = (char*) my_malloc((uint) len + 2, MYF(0)); memcpy(namebuf, ptr, len); namebuf[len] = '/'; @@ -5371,7 +5371,7 @@ ha_innobase::records_in_range( dtuple_free_for_mysql(heap1); dtuple_free_for_mysql(heap2); - my_free((gptr) key_val_buff2, MYF(0)); + my_free(key_val_buff2, MYF(0)); prebuilt->trx->op_info = (char*)""; @@ -5828,7 +5828,7 @@ ha_innobase::update_table_comment( /* allocate buffer for the full string, and read the contents of the temporary file */ - str = my_malloc(length + flen + 3, MYF(0)); + str = (char*) my_malloc(length + flen + 3, MYF(0)); if (str) { char* pos = str + length; @@ -5896,7 +5896,7 @@ ha_innobase::get_foreign_key_create_info(void) /* allocate buffer for the string, and read the contents of the temporary file */ - str = my_malloc(flen + 1, MYF(0)); + str = (char*) my_malloc(flen + 1, MYF(0)); if (str) { rewind(srv_dict_tmpfile); @@ -6028,7 +6028,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) } FOREIGN_KEY_INFO *pf_key_info= ((FOREIGN_KEY_INFO *) - thd->memdup((gptr) &f_key_info, + thd->memdup(&f_key_info, sizeof(FOREIGN_KEY_INFO))); f_key_list->push_back(pf_key_info); foreign = UT_LIST_GET_NEXT(foreign_list, foreign); @@ -6556,7 +6556,7 @@ innodb_show_status( /* allocate buffer for the string, and read the contents of the temporary file */ - if (!(str = my_malloc(usable_len + 1, MYF(0)))) { + if (!(str = (char*) my_malloc(usable_len + 1, MYF(0)))) { mutex_exit_noninline(&srv_monitor_file_mutex); DBUG_RETURN(TRUE); } @@ -6717,7 +6717,7 @@ bool innobase_show_status(handlerton *hton, THD* thd, locking. ****************************************************************************/ -static mysql_byte* innobase_get_key(INNOBASE_SHARE* share, uint* length, +static mysql_byte* innobase_get_key(INNOBASE_SHARE* share, size_t *length, my_bool not_used __attribute__((unused))) { *length=share->table_name_length; @@ -6745,7 +6745,7 @@ static INNOBASE_SHARE* get_share(const char* table_name) if (my_hash_insert(&innobase_open_tables, (mysql_byte*) share)) { pthread_mutex_unlock(&innobase_share_mutex); - my_free((gptr) share,0); + my_free(share,0); return 0; } @@ -6768,7 +6768,7 @@ static void free_share(INNOBASE_SHARE* share) hash_delete(&innobase_open_tables, (mysql_byte*) share); thr_lock_delete(&share->lock); pthread_mutex_destroy(&share->mutex); - my_free((gptr) share, MYF(0)); + my_free(share, MYF(0)); } pthread_mutex_unlock(&innobase_share_mutex); @@ -7263,9 +7263,8 @@ ha_innobase::cmp_ref( ref1 += 2; ref2 += 2; - result = ((Field_blob*)field)->cmp( - (const char*)ref1, len1, - (const char*)ref2, len2); + result = ((Field_blob*)field)->cmp( ref1, len1, + ref2, len2); } else { result = field->key_cmp(ref1, ref2); } diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 8b6c4d5a3d8..4b9ce2b01bc 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -47,8 +47,8 @@ class ha_innobase: public handler THR_LOCK_DATA lock; INNOBASE_SHARE *share; - byte* upd_buff; /* buffer used in updates */ - byte* key_val_buff; /* buffer used in converting + uchar* upd_buff; /* buffer used in updates */ + uchar* key_val_buff; /* buffer used in converting search key values from MySQL format to Innodb format */ ulong upd_and_key_val_buff_len; @@ -65,10 +65,10 @@ class ha_innobase: public handler uint num_write_row; /* number of write_row() calls */ uint store_key_val_for_row(uint keynr, char* buff, uint buff_len, - const byte* record); + const uchar* record); int update_thd(THD* thd); int change_active_index(uint keynr); - int general_fetch(byte* buf, uint direction, uint match_mode); + int general_fetch(uchar* buf, uint direction, uint match_mode); int innobase_read_and_init_auto_inc(longlong* ret); /* Init values for the class: */ @@ -110,32 +110,32 @@ class ha_innobase: public handler double scan_time(); double read_time(uint index, uint ranges, ha_rows rows); - int write_row(byte * buf); - int update_row(const byte * old_data, byte * new_data); - int delete_row(const byte * buf); + int write_row(uchar * buf); + int update_row(const uchar * old_data, uchar * new_data); + int delete_row(const uchar * buf); bool was_semi_consistent_read(); void try_semi_consistent_read(bool yes); void unlock_row(); int index_init(uint index, bool sorted); int index_end(); - int index_read(byte * buf, const byte * key, + int index_read(uchar * buf, const uchar * key, uint key_len, enum ha_rkey_function find_flag); - int index_read_idx(byte * buf, uint index, const byte * key, + int index_read_idx(uchar * buf, uint index, const uchar * key, uint key_len, enum ha_rkey_function find_flag); - int index_read_last(byte * buf, const byte * key, uint key_len); - int index_next(byte * buf); - int index_next_same(byte * buf, const byte *key, uint keylen); - int index_prev(byte * buf); - int index_first(byte * buf); - int index_last(byte * buf); + int index_read_last(uchar * buf, const uchar * key, uint key_len); + int index_next(uchar * buf); + int index_next_same(uchar * buf, const uchar *key, uint keylen); + int index_prev(uchar * buf); + int index_first(uchar * buf); + int index_last(uchar * buf); int rnd_init(bool scan); int rnd_end(); - int rnd_next(byte *buf); - int rnd_pos(byte * buf, byte *pos); + int rnd_next(uchar *buf); + int rnd_pos(uchar * buf, uchar *pos); - void position(const byte *record); + void position(const uchar *record); int info(uint); int analyze(THD* thd,HA_CHECK_OPT* check_opt); int optimize(THD* thd,HA_CHECK_OPT* check_opt); @@ -145,7 +145,7 @@ class ha_innobase: public handler int external_lock(THD *thd, int lock_type); int transactional_table_lock(THD *thd, int lock_type); int start_stmt(THD *thd, thr_lock_type lock_type); - void position(byte *record); + void position(uchar *record); ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key); ha_rows estimate_rows_upper_bound(); @@ -185,7 +185,7 @@ class ha_innobase: public handler static char *get_mysql_bin_log_name(); static ulonglong get_mysql_bin_log_pos(); bool primary_key_is_clustered() { return true; } - int cmp_ref(const byte *ref1, const byte *ref2); + int cmp_ref(const uchar *ref1, const uchar *ref2); bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes); }; diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index 68076d7e401..bf4c29f5b4e 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -111,7 +111,7 @@ typedef struct st_ftb_word uint ndepth; uint len; uchar off; - byte word[1]; + uchar word[1]; } FTB_WORD; typedef struct st_ft_info @@ -161,7 +161,7 @@ typedef struct st_my_ftb_param { FTB *ftb; FTB_EXPR *ftbe; - byte *up_quot; + uchar *up_quot; uint depth; } MY_FTB_PARAM; @@ -274,7 +274,7 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param, MY_FTB_PARAM *ftb_param= param->mysql_ftparam; MYSQL_FTPARSER_BOOLEAN_INFO info; CHARSET_INFO *cs= ftb_param->ftb->charset; - char **start= &query; + uchar **start= (uchar**) &query; char *end= query + len; FT_WORD w; @@ -286,7 +286,7 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param, } -static void _ftb_parse_query(FTB *ftb, byte *query, uint len, +static void _ftb_parse_query(FTB *ftb, uchar *query, uint len, struct st_mysql_ftparser *parser) { MYSQL_FTPARSER_PARAM *param; @@ -331,7 +331,7 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) my_bool can_go_down; MI_INFO *info=ftb->info; uint off, extra=HA_FT_WLEN+info->s->base.rec_reflength; - byte *lastkey_buf=ftbw->word+ftbw->off; + uchar *lastkey_buf=ftbw->word+ftbw->off; LINT_INIT(off); if (ftbw->flags & FTB_FLAG_TRUNC) @@ -505,7 +505,7 @@ static void _ftb_init_index_search(FT_INFO *ftb) } -FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, +FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, uchar *query, uint query_len, CHARSET_INFO *cs) { FTB *ftb; @@ -545,14 +545,14 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, Hack: instead of init_queue, we'll use reinit queue to be able to alloc queue with alloc_root() */ - if (! (ftb->queue.root= (byte **)alloc_root(&ftb->mem_root, + if (! (ftb->queue.root= (uchar **)alloc_root(&ftb->mem_root, (ftb->queue.max_elements + 1) * sizeof(void *)))) goto err; reinit_queue(&ftb->queue, ftb->queue.max_elements, 0, 0, - (int (*)(void*, byte*, byte*))FTB_WORD_cmp, 0); + (int (*)(void*, uchar*, uchar*))FTB_WORD_cmp, 0); for (ftbw= ftb->last_word; ftbw; ftbw= ftbw->prev) - queue_insert(&ftb->queue, (byte *)ftbw); + queue_insert(&ftb->queue, (uchar *)ftbw); ftb->list=(FTB_WORD **)alloc_root(&ftb->mem_root, sizeof(FTB_WORD *)*ftb->queue.elements); memcpy(ftb->list, ftb->queue.root+1, sizeof(FTB_WORD *)*ftb->queue.elements); @@ -563,7 +563,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, return ftb; err: free_root(& ftb->mem_root, MYF(0)); - my_free((gptr)ftb,MYF(0)); + my_free((uchar*)ftb,MYF(0)); return 0; } @@ -617,7 +617,8 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param, FT_WORD word; MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam; const char *docend= document + len; - while (ft_simple_get_word(phrase_param->cs, &document, docend, &word, FALSE)) + while (ft_simple_get_word(phrase_param->cs, (uchar**) &document, docend, + &word, FALSE)) { param->mysql_add_word(param, word.pos, word.len, 0); if (phrase_param->match) @@ -641,7 +642,7 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param, 1 is returned if phrase found, 0 else. */ -static int _ftb_check_phrase(FTB *ftb, const byte *document, uint len, +static int _ftb_check_phrase(FTB *ftb, const uchar *document, uint len, FTB_EXPR *ftbe, struct st_mysql_ftparser *parser) { MY_FTB_PHRASE_PARAM ftb_param; @@ -663,7 +664,7 @@ static int _ftb_check_phrase(FTB *ftb, const byte *document, uint len, param->mysql_add_word= ftb_phrase_add_word; param->mysql_ftparam= (void *)&ftb_param; param->cs= ftb->charset; - param->doc= (byte *)document; + param->doc= (uchar *)document; param->length= len; param->flags= 0; param->mode= MYSQL_FTPARSER_WITH_STOPWORDS; @@ -867,13 +868,13 @@ static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param, FT_INFO *ftb= ftb_param->ftb; char *end= doc + len; FT_WORD w; - while (ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE)) + while (ft_simple_get_word(ftb->charset, (uchar**) &doc, end, &w, TRUE)) param->mysql_add_word(param, w.pos, w.len, 0); return(0); } -float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) +float ft_boolean_find_relevance(FT_INFO *ftb, uchar *record, uint length) { FTB_EXPR *ftbe; FT_SEG_ITERATOR ftsi, ftsi2; @@ -924,7 +925,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) { if (!ftsi.pos) continue; - param->doc= (byte *)ftsi.pos; + param->doc= (uchar *)ftsi.pos; param->length= ftsi.len; parser->parse(param); } @@ -948,7 +949,7 @@ void ft_boolean_close_search(FT_INFO *ftb) delete_tree(& ftb->no_dupes); } free_root(& ftb->mem_root, MYF(0)); - my_free((gptr)ftb,MYF(0)); + my_free((uchar*)ftb,MYF(0)); } diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c index 5c6f66897ee..bcf6c46d41f 100644 --- a/storage/myisam/ft_nlq_search.c +++ b/storage/myisam/ft_nlq_search.c @@ -189,7 +189,7 @@ static int walk_and_push(FT_SUPERDOC *from, DBUG_ENTER("walk_and_copy"); from->doc.weight+=from->tmp_weight*from->word_ptr->weight; set_if_smaller(best->elements, ft_query_expansion_limit-1); - queue_insert(best, (byte *)& from->doc); + queue_insert(best, (uchar *)& from->doc); DBUG_RETURN(0); } @@ -201,8 +201,8 @@ static int FT_DOC_cmp(void *unused __attribute__((unused)), } -FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query, - uint query_len, uint flags, byte *record) +FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, uchar *query, + uint query_len, uint flags, uchar *record) { TREE wtree; ALL_IN_ONE aio; @@ -323,7 +323,7 @@ int ft_nlq_read_next(FT_INFO *handler, char *record) float ft_nlq_find_relevance(FT_INFO *handler, - byte *record __attribute__((unused)), + uchar *record __attribute__((unused)), uint length __attribute__((unused))) { int a,b,c; @@ -352,7 +352,7 @@ float ft_nlq_find_relevance(FT_INFO *handler, void ft_nlq_close_search(FT_INFO *handler) { - my_free((gptr)handler,MYF(0)); + my_free((uchar*)handler,MYF(0)); } diff --git a/storage/myisam/ft_parser.c b/storage/myisam/ft_parser.c index 5992d9c118e..ba858c37aee 100644 --- a/storage/myisam/ft_parser.c +++ b/storage/myisam/ft_parser.c @@ -78,7 +78,7 @@ FT_WORD * ft_linearize(TREE *wtree, MEM_ROOT *mem_root) DBUG_RETURN(wlist); } -my_bool ft_boolean_check_syntax_string(const byte *str) +my_bool ft_boolean_check_syntax_string(const uchar *str) { uint i, j; @@ -106,10 +106,10 @@ my_bool ft_boolean_check_syntax_string(const byte *str) 3 - right bracket 4 - stopword found */ -byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end, - FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param) +uchar ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end, + FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param) { - byte *doc=*start; + uchar *doc=*start; int ctype; uint mwc, length, mbl; @@ -196,10 +196,10 @@ ret: return param->type; } -byte ft_simple_get_word(CHARSET_INFO *cs, byte **start, const byte *end, - FT_WORD *word, my_bool skip_stopwords) +uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end, + FT_WORD *word, my_bool skip_stopwords) { - byte *doc= *start; + uchar *doc= *start; uint mwc, length, mbl; int ctype; DBUG_ENTER("ft_simple_get_word"); @@ -260,9 +260,9 @@ static int ft_add_word(MYSQL_FTPARSER_PARAM *param, wtree= ft_param->wtree; if (param->flags & MYSQL_FTFLAGS_NEED_COPY) { - byte *ptr; + uchar *ptr; DBUG_ASSERT(wtree->with_delete == 0); - ptr= (byte *)alloc_root(ft_param->mem_root, word_len); + ptr= (uchar *)alloc_root(ft_param->mem_root, word_len); memcpy(ptr, word, word_len); w.pos= ptr; } @@ -279,9 +279,10 @@ static int ft_add_word(MYSQL_FTPARSER_PARAM *param, static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param, - char *doc, int doc_len) + char *doc_arg, int doc_len) { - byte *end=doc+doc_len; + uchar *doc= (uchar*) doc_arg; + uchar *end= doc + doc_len; MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam; TREE *wtree= ft_param->wtree; FT_WORD w; @@ -294,9 +295,9 @@ static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param, } -int ft_parse(TREE *wtree, byte *doc, int doclen, - struct st_mysql_ftparser *parser, - MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root) +int ft_parse(TREE *wtree, uchar *doc, int doclen, + struct st_mysql_ftparser *parser, + MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root) { MY_FT_PARSER_PARAM my_param; DBUG_ENTER("ft_parse"); diff --git a/storage/myisam/ft_static.c b/storage/myisam/ft_static.c index 34608be1721..610c20eede6 100644 --- a/storage/myisam/ft_static.c +++ b/storage/myisam/ft_static.c @@ -56,8 +56,8 @@ const struct _ft_vft _ft_vft_boolean = { FT_INFO *ft_init_search(uint flags, void *info, uint keynr, - byte *query, uint query_len, CHARSET_INFO *cs, - byte *record) + uchar *query, uint query_len, CHARSET_INFO *cs, + uchar *record) { FT_INFO *res; if (flags & FT_BOOL) diff --git a/storage/myisam/ft_stopwords.c b/storage/myisam/ft_stopwords.c index 63732ebadc9..e6a90bc927a 100644 --- a/storage/myisam/ft_stopwords.c +++ b/storage/myisam/ft_stopwords.c @@ -38,7 +38,7 @@ static void FT_STOPWORD_free(FT_STOPWORD *w, TREE_FREE action, void *arg __attribute__((unused))) { if (action == free_free) - my_free((gptr) w->pos, MYF(0)); + my_free((uchar*) w->pos, MYF(0)); } static int ft_add_stopword(const char *w) @@ -65,7 +65,7 @@ int ft_init_stopwords() { File fd; uint len; - byte *buffer, *start, *end; + uchar *buffer, *start, *end; FT_WORD w; int error=-1; diff --git a/storage/myisam/ft_update.c b/storage/myisam/ft_update.c index e176d550b1d..e3e4c62158f 100644 --- a/storage/myisam/ft_update.c +++ b/storage/myisam/ft_update.c @@ -20,7 +20,7 @@ #include "ftdefs.h" #include <math.h> -void _mi_ft_segiterator_init(MI_INFO *info, uint keynr, const byte *record, +void _mi_ft_segiterator_init(MI_INFO *info, uint keynr, const uchar *record, FT_SEG_ITERATOR *ftsi) { DBUG_ENTER("_mi_ft_segiterator_init"); @@ -31,7 +31,7 @@ void _mi_ft_segiterator_init(MI_INFO *info, uint keynr, const byte *record, DBUG_VOID_RETURN; } -void _mi_ft_segiterator_dummy_init(const byte *record, uint len, +void _mi_ft_segiterator_dummy_init(const uchar *record, uint len, FT_SEG_ITERATOR *ftsi) { DBUG_ENTER("_mi_ft_segiterator_dummy_init"); @@ -94,7 +94,7 @@ uint _mi_ft_segiterator(register FT_SEG_ITERATOR *ftsi) /* parses a document i.e. calls ft_parse for every keyseg */ -uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record, +uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const uchar *record, MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root) { FT_SEG_ITERATOR ftsi; @@ -108,13 +108,13 @@ uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record, while (_mi_ft_segiterator(&ftsi)) { if (ftsi.pos) - if (ft_parse(parsed, (byte *)ftsi.pos, ftsi.len, parser, param, mem_root)) + if (ft_parse(parsed, (uchar *)ftsi.pos, ftsi.len, parser, param, mem_root)) DBUG_RETURN(1); } DBUG_RETURN(0); } -FT_WORD *_mi_ft_parserecord(MI_INFO *info, uint keynr, const byte *record, +FT_WORD *_mi_ft_parserecord(MI_INFO *info, uint keynr, const uchar *record, MEM_ROOT *mem_root) { TREE ptree; @@ -130,7 +130,7 @@ FT_WORD *_mi_ft_parserecord(MI_INFO *info, uint keynr, const byte *record, DBUG_RETURN(ft_linearize(&ptree, mem_root)); } -static int _mi_ft_store(MI_INFO *info, uint keynr, byte *keybuf, +static int _mi_ft_store(MI_INFO *info, uint keynr, uchar *keybuf, FT_WORD *wlist, my_off_t filepos) { uint key_length; @@ -145,7 +145,7 @@ static int _mi_ft_store(MI_INFO *info, uint keynr, byte *keybuf, DBUG_RETURN(0); } -static int _mi_ft_erase(MI_INFO *info, uint keynr, byte *keybuf, +static int _mi_ft_erase(MI_INFO *info, uint keynr, uchar *keybuf, FT_WORD *wlist, my_off_t filepos) { uint key_length, err=0; @@ -168,7 +168,7 @@ static int _mi_ft_erase(MI_INFO *info, uint keynr, byte *keybuf, #define THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT 1 #define GEE_THEY_ARE_ABSOLUTELY_IDENTICAL 0 -int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2) +int _mi_ft_cmp(MI_INFO *info, uint keynr, const uchar *rec1, const uchar *rec2) { FT_SEG_ITERATOR ftsi1, ftsi2; CHARSET_INFO *cs=info->s->keyinfo[keynr].seg->charset; @@ -190,8 +190,8 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2) /* update a document entry */ -int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf, - const byte *oldrec, const byte *newrec, my_off_t pos) +int _mi_ft_update(MI_INFO *info, uint keynr, uchar *keybuf, + const uchar *oldrec, const uchar *newrec, my_off_t pos) { int error= -1; FT_WORD *oldlist,*newlist, *old_word, *new_word; @@ -241,7 +241,7 @@ err: /* adds a document to the collection */ -int _mi_ft_add(MI_INFO *info, uint keynr, byte *keybuf, const byte *record, +int _mi_ft_add(MI_INFO *info, uint keynr, uchar *keybuf, const uchar *record, my_off_t pos) { int error= -1; @@ -260,7 +260,7 @@ int _mi_ft_add(MI_INFO *info, uint keynr, byte *keybuf, const byte *record, /* removes a document from the collection */ -int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record, +int _mi_ft_del(MI_INFO *info, uint keynr, uchar *keybuf, const uchar *record, my_off_t pos) { int error= -1; @@ -276,10 +276,10 @@ int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record, DBUG_RETURN(error); } -uint _ft_make_key(MI_INFO *info, uint keynr, byte *keybuf, FT_WORD *wptr, +uint _ft_make_key(MI_INFO *info, uint keynr, uchar *keybuf, FT_WORD *wptr, my_off_t filepos) { - byte buf[HA_FT_MAXBYTELEN+16]; + uchar buf[HA_FT_MAXBYTELEN+16]; DBUG_ENTER("_ft_make_key"); #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT diff --git a/storage/myisam/ftdefs.h b/storage/myisam/ftdefs.h index 26f5e4f266e..22443807b87 100644 --- a/storage/myisam/ftdefs.h +++ b/storage/myisam/ftdefs.h @@ -96,44 +96,44 @@ #define FTB_RQUOT (ft_boolean_syntax[11]) typedef struct st_ft_word { - byte * pos; + uchar * pos; uint len; double weight; } FT_WORD; int is_stopword(char *word, uint len); -uint _ft_make_key(MI_INFO *, uint , byte *, FT_WORD *, my_off_t); +uint _ft_make_key(MI_INFO *, uint , uchar *, FT_WORD *, my_off_t); -byte ft_get_word(CHARSET_INFO *, byte **, byte *, FT_WORD *, - MYSQL_FTPARSER_BOOLEAN_INFO *); -byte ft_simple_get_word(CHARSET_INFO *, byte **, const byte *, - FT_WORD *, my_bool); +uchar ft_get_word(CHARSET_INFO *, uchar **, uchar *, FT_WORD *, + MYSQL_FTPARSER_BOOLEAN_INFO *); +uchar ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *, + FT_WORD *, my_bool); typedef struct _st_ft_seg_iterator { uint num, len; HA_KEYSEG *seg; - const byte *rec, *pos; + const uchar *rec, *pos; } FT_SEG_ITERATOR; -void _mi_ft_segiterator_init(MI_INFO *, uint, const byte *, FT_SEG_ITERATOR *); -void _mi_ft_segiterator_dummy_init(const byte *, uint, FT_SEG_ITERATOR *); +void _mi_ft_segiterator_init(MI_INFO *, uint, const uchar *, FT_SEG_ITERATOR *); +void _mi_ft_segiterator_dummy_init(const uchar *, uint, FT_SEG_ITERATOR *); uint _mi_ft_segiterator(FT_SEG_ITERATOR *); void ft_parse_init(TREE *, CHARSET_INFO *); -int ft_parse(TREE *, byte *, int, struct st_mysql_ftparser *parser, +int ft_parse(TREE *, uchar *, int, struct st_mysql_ftparser *parser, MYSQL_FTPARSER_PARAM *, MEM_ROOT *); FT_WORD * ft_linearize(TREE *, MEM_ROOT *); -FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, const byte *, MEM_ROOT *); -uint _mi_ft_parse(TREE *, MI_INFO *, uint, const byte *, +FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, const uchar *, MEM_ROOT *); +uint _mi_ft_parse(TREE *, MI_INFO *, uint, const uchar *, MYSQL_FTPARSER_PARAM *, MEM_ROOT *); -FT_INFO *ft_init_nlq_search(MI_INFO *, uint, byte *, uint, uint, byte *); -FT_INFO *ft_init_boolean_search(MI_INFO *, uint, byte *, uint, CHARSET_INFO *); +FT_INFO *ft_init_nlq_search(MI_INFO *, uint, uchar *, uint, uint, uchar *); +FT_INFO *ft_init_boolean_search(MI_INFO *, uint, uchar *, uint, CHARSET_INFO *); extern const struct _ft_vft _ft_vft_nlq; int ft_nlq_read_next(FT_INFO *, char *); -float ft_nlq_find_relevance(FT_INFO *, byte *, uint); +float ft_nlq_find_relevance(FT_INFO *, uchar *, uint); void ft_nlq_close_search(FT_INFO *); float ft_nlq_get_relevance(FT_INFO *); my_off_t ft_nlq_get_docid(FT_INFO *); @@ -141,7 +141,7 @@ void ft_nlq_reinit_search(FT_INFO *); extern const struct _ft_vft _ft_vft_boolean; int ft_boolean_read_next(FT_INFO *, char *); -float ft_boolean_find_relevance(FT_INFO *, byte *, uint); +float ft_boolean_find_relevance(FT_INFO *, uchar *, uint); void ft_boolean_close_search(FT_INFO *); float ft_boolean_get_relevance(FT_INFO *); my_off_t ft_boolean_get_docid(FT_INFO *); diff --git a/storage/myisam/fulltext.h b/storage/myisam/fulltext.h index bea2fa96969..856e93e034d 100644 --- a/storage/myisam/fulltext.h +++ b/storage/myisam/fulltext.h @@ -29,9 +29,9 @@ extern const HA_KEYSEG ft_keysegs[FT_SEGS]; -int _mi_ft_cmp(MI_INFO *, uint, const byte *, const byte *); -int _mi_ft_add(MI_INFO *, uint, byte *, const byte *, my_off_t); -int _mi_ft_del(MI_INFO *, uint, byte *, const byte *, my_off_t); +int _mi_ft_cmp(MI_INFO *, uint, const uchar *, const uchar *); +int _mi_ft_add(MI_INFO *, uint, uchar *, const uchar *, my_off_t); +int _mi_ft_del(MI_INFO *, uint, uchar *, const uchar *, my_off_t); uint _mi_ft_convert_to_ft2(MI_INFO *, uint, uchar *); diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index d31f5b7e792..d2a45d41566 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -121,7 +121,7 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out, { uint i, j, recpos, minpos, fieldpos, temp_length, length; enum ha_base_keytype type= HA_KEYTYPE_BINARY; - byte *record; + uchar *record; KEY *pos; MI_KEYDEF *keydef; MI_COLUMNDEF *recinfo, *recinfo_pos; @@ -531,7 +531,7 @@ int ha_myisam::net_read_dump(NET* net) error= -1; goto err; } - if (my_write(data_fd, (byte*)net->read_pos, (uint) packet_len, + if (my_write(data_fd, (uchar*)net->read_pos, (uint) packet_len, MYF(MY_WME|MY_FNABP))) { error = errno; @@ -550,7 +550,7 @@ int ha_myisam::dump(THD* thd, int fd) uint blocksize = share->blocksize; my_off_t bytes_to_read = share->state.state.data_file_length; int data_fd = file->dfile; - byte * buf = (byte*) my_malloc(blocksize, MYF(MY_WME)); + uchar *buf = (uchar*) my_malloc(blocksize, MYF(MY_WME)); if (!buf) return ENOMEM; @@ -558,7 +558,7 @@ int ha_myisam::dump(THD* thd, int fd) my_seek(data_fd, 0L, MY_SEEK_SET, MYF(MY_WME)); for (; bytes_to_read > 0;) { - uint bytes = my_read(data_fd, buf, blocksize, MYF(MY_WME)); + size_t bytes = my_read(data_fd, buf, blocksize, MYF(MY_WME)); if (bytes == MY_FILE_ERROR) { error = errno; @@ -575,7 +575,7 @@ int ha_myisam::dump(THD* thd, int fd) } else { - if (my_net_write(net, (char*) buf, bytes)) + if (my_net_write(net, buf, bytes)) { error = errno ? errno : EPIPE; goto err; @@ -586,13 +586,13 @@ int ha_myisam::dump(THD* thd, int fd) if (fd < 0) { - if (my_net_write(net, "", 0)) + if (my_net_write(net, (uchar*) "", 0)) error = errno ? errno : EPIPE; net_flush(net); } err: - my_free((gptr) buf, MYF(0)); + my_free((uchar*) buf, MYF(0)); return error; } #endif /* HAVE_REPLICATION */ @@ -710,7 +710,7 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked) recinfo must be freed. */ if (recinfo) - my_free((gptr) recinfo, MYF(0)); + my_free((uchar*) recinfo, MYF(0)); return my_errno; } @@ -721,7 +721,7 @@ int ha_myisam::close(void) return mi_close(tmp); } -int ha_myisam::write_row(byte * buf) +int ha_myisam::write_row(uchar *buf) { statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status); @@ -1594,7 +1594,7 @@ bool ha_myisam::is_crashed() const (my_disable_locking && file->s->state.open_count)); } -int ha_myisam::update_row(const byte * old_data, byte * new_data) +int ha_myisam::update_row(const uchar *old_data, uchar *new_data) { statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status); if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) @@ -1602,13 +1602,13 @@ int ha_myisam::update_row(const byte * old_data, byte * new_data) return mi_update(file,old_data,new_data); } -int ha_myisam::delete_row(const byte * buf) +int ha_myisam::delete_row(const uchar *buf) { statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status); return mi_delete(file,buf); } -int ha_myisam::index_read(byte *buf, const byte *key, key_part_map keypart_map, +int ha_myisam::index_read(uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) { DBUG_ASSERT(inited==INDEX); @@ -1619,7 +1619,7 @@ int ha_myisam::index_read(byte *buf, const byte *key, key_part_map keypart_map, return error; } -int ha_myisam::index_read_idx(byte *buf, uint index, const byte *key, +int ha_myisam::index_read_idx(uchar *buf, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) { @@ -1630,7 +1630,7 @@ int ha_myisam::index_read_idx(byte *buf, uint index, const byte *key, return error; } -int ha_myisam::index_read_last(byte *buf, const byte *key, +int ha_myisam::index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map) { DBUG_ENTER("ha_myisam::index_read_last"); @@ -1643,7 +1643,7 @@ int ha_myisam::index_read_last(byte *buf, const byte *key, DBUG_RETURN(error); } -int ha_myisam::index_next(byte * buf) +int ha_myisam::index_next(uchar *buf) { DBUG_ASSERT(inited==INDEX); statistic_increment(table->in_use->status_var.ha_read_next_count, @@ -1653,7 +1653,7 @@ int ha_myisam::index_next(byte * buf) return error; } -int ha_myisam::index_prev(byte * buf) +int ha_myisam::index_prev(uchar *buf) { DBUG_ASSERT(inited==INDEX); statistic_increment(table->in_use->status_var.ha_read_prev_count, @@ -1663,7 +1663,7 @@ int ha_myisam::index_prev(byte * buf) return error; } -int ha_myisam::index_first(byte * buf) +int ha_myisam::index_first(uchar *buf) { DBUG_ASSERT(inited==INDEX); statistic_increment(table->in_use->status_var.ha_read_first_count, @@ -1673,7 +1673,7 @@ int ha_myisam::index_first(byte * buf) return error; } -int ha_myisam::index_last(byte * buf) +int ha_myisam::index_last(uchar *buf) { DBUG_ASSERT(inited==INDEX); statistic_increment(table->in_use->status_var.ha_read_last_count, @@ -1683,8 +1683,8 @@ int ha_myisam::index_last(byte * buf) return error; } -int ha_myisam::index_next_same(byte * buf, - const byte *key __attribute__((unused)), +int ha_myisam::index_next_same(uchar *buf, + const uchar *key __attribute__((unused)), uint length __attribute__((unused))) { DBUG_ASSERT(inited==INDEX); @@ -1703,7 +1703,7 @@ int ha_myisam::rnd_init(bool scan) return mi_reset(file); // Free buffers } -int ha_myisam::rnd_next(byte *buf) +int ha_myisam::rnd_next(uchar *buf) { statistic_increment(table->in_use->status_var.ha_read_rnd_next_count, &LOCK_status); @@ -1712,12 +1712,12 @@ int ha_myisam::rnd_next(byte *buf) return error; } -int ha_myisam::restart_rnd_next(byte *buf, byte *pos) +int ha_myisam::restart_rnd_next(uchar *buf, uchar *pos) { return rnd_pos(buf,pos); } -int ha_myisam::rnd_pos(byte * buf, byte *pos) +int ha_myisam::rnd_pos(uchar *buf, uchar *pos) { statistic_increment(table->in_use->status_var.ha_read_rnd_count, &LOCK_status); @@ -1726,7 +1726,7 @@ int ha_myisam::rnd_pos(byte * buf, byte *pos) return error; } -void ha_myisam::position(const byte* record) +void ha_myisam::position(const uchar *record) { my_off_t row_position= mi_position(file); my_store_ptr(ref, ref_length, row_position); @@ -1911,7 +1911,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg, records, recinfo, 0, (MI_UNIQUEDEF*) 0, &create_info, create_flags); - my_free((gptr) recinfo, MYF(0)); + my_free((uchar*) recinfo, MYF(0)); DBUG_RETURN(error); } @@ -1929,7 +1929,7 @@ void ha_myisam::get_auto_increment(ulonglong offset, ulonglong increment, { ulonglong nr; int error; - byte key[MI_MAX_KEY_LENGTH]; + uchar key[MI_MAX_KEY_LENGTH]; if (!table->s->next_number_key_offset) { // Autoincrement at key-start @@ -2002,7 +2002,7 @@ ha_rows ha_myisam::records_in_range(uint inx, key_range *min_key, } -int ha_myisam::ft_read(byte * buf) +int ha_myisam::ft_read(uchar *buf) { int error; diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index bb439e9914d..6cc9f4811b0 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -67,19 +67,19 @@ class ha_myisam: public handler bool called_by_logger_thread); int open(const char *name, int mode, uint test_if_locked); int close(void); - int write_row(byte * buf); - int update_row(const byte * old_data, byte * new_data); - int delete_row(const byte * buf); - int index_read(byte *buf, const byte *key, key_part_map keypart_map, + int write_row(uchar * buf); + int update_row(const uchar * old_data, uchar * new_data); + int delete_row(const uchar * buf); + int index_read(uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag); - int index_read_idx(byte *buf, uint index, const byte *key, + int index_read_idx(uchar *buf, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag); - int index_read_last(byte *buf, const byte *key, key_part_map keypart_map); - int index_next(byte * buf); - int index_prev(byte * buf); - int index_first(byte * buf); - int index_last(byte * buf); - int index_next_same(byte *buf, const byte *key, uint keylen); + int index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map); + int index_next(uchar * buf); + int index_prev(uchar * buf); + int index_first(uchar * buf); + int index_last(uchar * buf); + int index_next_same(uchar *buf, const uchar *key, uint keylen); int ft_init() { if (!ft_handler) @@ -90,15 +90,15 @@ class ha_myisam: public handler FT_INFO *ft_init_ext(uint flags, uint inx,String *key) { return ft_init_search(flags,file,inx, - (byte *)key->ptr(), key->length(), key->charset(), + (uchar *)key->ptr(), key->length(), key->charset(), table->record[0]); } - int ft_read(byte *buf); + int ft_read(uchar *buf); int rnd_init(bool scan); - int rnd_next(byte *buf); - int rnd_pos(byte * buf, byte *pos); - int restart_rnd_next(byte *buf, byte *pos); - void position(const byte *record); + int rnd_next(uchar *buf); + int rnd_pos(uchar * buf, uchar *pos); + int restart_rnd_next(uchar *buf, uchar *pos); + void position(const uchar *record); int info(uint); int extra(enum ha_extra_function operation); int extra_opt(enum ha_extra_function operation, ulong cache_size); diff --git a/storage/myisam/mi_cache.c b/storage/myisam/mi_cache.c index 59c9b2c8812..d6dcc431a8d 100644 --- a/storage/myisam/mi_cache.c +++ b/storage/myisam/mi_cache.c @@ -35,12 +35,12 @@ #include "myisamdef.h" -int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length, +int _mi_read_cache(IO_CACHE *info, uchar *buff, my_off_t pos, uint length, int flag) { uint read_length,in_buff_length; my_off_t offset; - char *in_buff_pos; + uchar *in_buff_pos; DBUG_ENTER("_mi_read_cache"); if (pos < info->pos_in_file) @@ -61,7 +61,7 @@ int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length, (my_off_t) (info->read_end - info->request_pos)) { in_buff_pos=info->request_pos+(uint) offset; - in_buff_length= min(length,(uint) (info->read_end-in_buff_pos)); + in_buff_length= min(length, (size_t) (info->read_end-in_buff_pos)); memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length); if (!(length-=in_buff_length)) DBUG_RETURN(0); diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 7a4d47954a5..e529666f462 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -83,12 +83,12 @@ static int sort_delete_record(MI_SORT_PARAM *sort_param); /*static int flush_pending_blocks(MI_CHECK *param);*/ static SORT_KEY_BLOCKS *alloc_key_blocks(MI_CHECK *param, uint blocks, uint buffer_length); -static ha_checksum mi_byte_checksum(const byte *buf, uint length); +static ha_checksum mi_byte_checksum(const uchar *buf, uint length); static void set_data_file_type(SORT_INFO *sort_info, MYISAM_SHARE *share); void myisamchk_init(MI_CHECK *param) { - bzero((gptr) param,sizeof(*param)); + bzero((uchar*) param,sizeof(*param)); param->opt_follow_links=1; param->keys_in_use= ~(ulonglong) 0; param->search_after_block=HA_OFFSET_ERROR; @@ -296,7 +296,7 @@ static int check_k_link(MI_CHECK *param, register MI_INFO *info, uint nr) */ if (!(buff=key_cache_read(info->s->key_cache, info->s->kfile, next_link, DFLT_INIT_HITS, - (byte*) info->buff, MI_MIN_KEY_BLOCK_LENGTH, + (uchar*) info->buff, MI_MIN_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, 1))) { /* purecov: begin tested */ @@ -531,7 +531,7 @@ int chk_key(MI_CHECK *param, register MI_INFO *info) /* Check that there isn't a row with auto_increment = 0 in the table */ mi_extra(info,HA_EXTRA_KEYREAD,0); bzero(info->lastkey,keyinfo->seg->length); - if (!mi_rkey(info, info->rec_buff, key, (const byte*) info->lastkey, + if (!mi_rkey(info, info->rec_buff, key, (const uchar*) info->lastkey, (key_part_map)1, HA_READ_KEY_EXACT)) { /* Don't count this as a real warning, as myisamchk can't correct it */ @@ -740,7 +740,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, char llbuff[22]; uint diff_pos[2]; DBUG_ENTER("chk_index"); - DBUG_DUMP("buff",(byte*) buff,mi_getint(buff)); + DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff)); /* TODO: implement appropriate check for RTree keys */ if (keyinfo->flag & HA_SPATIAL) @@ -798,8 +798,8 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, (flag=ha_key_cmp(keyinfo->seg,info->lastkey,key,key_length, comp_flag, diff_pos)) >=0) { - DBUG_DUMP("old",(byte*) info->lastkey, info->lastkey_length); - DBUG_DUMP("new",(byte*) key, key_length); + DBUG_DUMP("old",(uchar*) info->lastkey, info->lastkey_length); + DBUG_DUMP("new",(uchar*) key, key_length); DBUG_DUMP("new_in_page",(char*) old_keypos,(uint) (keypos-old_keypos)); if (comp_flag & SEARCH_FIND && flag == 0) @@ -831,7 +831,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, key); } } - (*key_checksum)+= mi_byte_checksum((byte*) key, + (*key_checksum)+= mi_byte_checksum((uchar*) key, key_length- info->s->rec_reflength); record= _mi_dpos(info,0,key+key_length); if (keyinfo->flag & HA_FULLTEXT) /* special handling for ft2 */ @@ -869,7 +869,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, DBUG_PRINT("test",("page: %s record: %s filelength: %s", llstr(page,llbuff),llstr(record,llbuff2), llstr(info->state->data_file_length,llbuff3))); - DBUG_DUMP("key",(byte*) key,key_length); + DBUG_DUMP("key",(uchar*) key,key_length); DBUG_DUMP("new_in_page",(char*) old_keypos,(uint) (keypos-old_keypos)); goto err; } @@ -881,10 +881,10 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, llstr(page,llbuff), used_length, (keypos - buff)); goto err; } - my_afree((byte*) temp_buff); + my_afree((uchar*) temp_buff); DBUG_RETURN(0); err: - my_afree((byte*) temp_buff); + my_afree((uchar*) temp_buff); DBUG_RETURN(1); } /* chk_index */ @@ -939,7 +939,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) ha_rows records,del_blocks; my_off_t used,empty,pos,splits,start_recpos, del_length,link_used,start_block; - byte *record,*to; + uchar *record,*to; char llbuff[22],llbuff2[22],llbuff3[22]; ha_checksum intern_record_checksum; ha_checksum key_checksum[MI_MAX_POSSIBLE_KEY]; @@ -956,7 +956,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) puts("- check record links"); } - if (!(record= (byte*) my_malloc(info->s->base.pack_reclength,MYF(0)))) + if (!(record= (uchar*) my_malloc(info->s->base.pack_reclength,MYF(0)))) { mi_check_print_error(param,"Not enough memory for record"); DBUG_RETURN(-1); @@ -991,7 +991,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) goto err2; switch (info->s->data_file_type) { case STATIC_RECORD: - if (my_b_read(¶m->read_cache,(byte*) record, + if (my_b_read(¶m->read_cache,(uchar*) record, info->s->base.pack_reclength)) goto err; start_recpos=pos; @@ -1011,7 +1011,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) block_info.next_filepos=pos; do { - if (_mi_read_cache(¶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)) @@ -1115,7 +1115,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; @@ -1176,7 +1176,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) pos=block_info.filepos+block_info.block_len; break; case COMPRESSED_RECORD: - if (_mi_read_cache(¶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; @@ -1193,7 +1193,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, @@ -1253,7 +1253,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) } } else - key_checksum[key]+=mi_byte_checksum((byte*) info->lastkey, + key_checksum[key]+=mi_byte_checksum((uchar*) info->lastkey, key_length); } } @@ -1363,12 +1363,12 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) printf("Lost space: %12s Linkdata: %10s\n", llstr(empty,llbuff),llstr(link_used,llbuff2)); } - my_free((gptr) record,MYF(0)); + my_free((uchar*) record,MYF(0)); DBUG_RETURN (error); err: mi_check_print_error(param,"got error: %d when reading datafile at record: %s",my_errno, llstr(records,llbuff)); err2: - my_free((gptr) record,MYF(0)); + my_free((uchar*) record,MYF(0)); param->testflag|=T_RETRY_WITHOUT_QUICK; DBUG_RETURN(1); } /* chk_data_link */ @@ -1378,7 +1378,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) /* Save new datafile-name in temp_filename */ int mi_repair(MI_CHECK *param, register MI_INFO *info, - my_string name, int rep_quick) + char * name, int rep_quick) { int error,got_error; uint i; @@ -1427,7 +1427,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, MYF(MY_WME | MY_WAIT_IF_FULL))) goto err; info->opt_flag|=WRITE_CACHE_USED; - if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength, + if (!(sort_param.record=(uchar*) my_malloc((uint) share->base.pack_reclength, MYF(0))) || !mi_alloc_rec_buff(info, -1, &sort_param.rec_buff)) { @@ -1514,7 +1514,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, { if (my_errno != HA_ERR_FOUND_DUPP_KEY) goto err; - DBUG_DUMP("record",(byte*) sort_param.record,share->base.pack_reclength); + DBUG_DUMP("record",(uchar*) sort_param.record,share->base.pack_reclength); mi_check_print_info(param,"Duplicate key %2d for record at %10s against new record at %10s", info->errkey+1, llstr(sort_param.start_recpos,llbuff), @@ -1660,7 +1660,7 @@ static int writekeys(MI_SORT_PARAM *sort_param) register uint i; uchar *key; MI_INFO *info= sort_param->sort_info->info; - byte *buff= sort_param->record; + uchar *buff= sort_param->record; my_off_t filepos= sort_param->filepos; DBUG_ENTER("writekeys"); @@ -1724,7 +1724,7 @@ static int writekeys(MI_SORT_PARAM *sort_param) /* Change all key-pointers that points to a records */ -int movepoint(register MI_INFO *info, byte *record, my_off_t oldpos, +int movepoint(register MI_INFO *info, uchar *record, my_off_t oldpos, my_off_t newpos, uint prot_key) { register uint i; @@ -1801,7 +1801,7 @@ int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file) /* Sort index for more efficent reads */ -int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name) +int mi_sort_index(MI_CHECK *param, register MI_INFO *info, char * name) { reg2 uint key; reg1 MI_KEYDEF *keyinfo; @@ -1944,7 +1944,7 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, ("From page: %ld, keyoffset: %lu used_length: %d", (ulong) pagepos, (ulong) (keypos - buff), (int) used_length)); - DBUG_DUMP("buff",(byte*) buff,used_length); + DBUG_DUMP("buff",(uchar*) buff,used_length); goto err; } } @@ -1973,17 +1973,17 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, /* Fill block with zero and write it to the new index file */ length=mi_getint(buff); - bzero((byte*) buff+length,keyinfo->block_length-length); - if (my_pwrite(new_file,(byte*) buff,(uint) keyinfo->block_length, + bzero((uchar*) buff+length,keyinfo->block_length-length); + if (my_pwrite(new_file,(uchar*) buff,(uint) keyinfo->block_length, new_page_pos,MYF(MY_NABP | MY_WAIT_IF_FULL))) { mi_check_print_error(param,"Can't write indexblock, error: %d",my_errno); goto err; } - my_afree((gptr) buff); + my_afree((uchar*) buff); DBUG_RETURN(0); err: - my_afree((gptr) buff); + my_afree((uchar*) buff); DBUG_RETURN(1); } /* sort_one_index */ @@ -2054,13 +2054,13 @@ int filecopy(MI_CHECK *param, File to,File from,my_off_t start, VOID(my_seek(from,start,MY_SEEK_SET,MYF(0))); while (length > buff_length) { - if (my_read(from,(byte*) buff,buff_length,MYF(MY_NABP)) || - my_write(to,(byte*) buff,buff_length,param->myf_rw)) + if (my_read(from,(uchar*) buff,buff_length,MYF(MY_NABP)) || + my_write(to,(uchar*) buff,buff_length,param->myf_rw)) goto err; length-= buff_length; } - if (my_read(from,(byte*) buff,(uint) length,MYF(MY_NABP)) || - my_write(to,(byte*) buff,(uint) length,param->myf_rw)) + if (my_read(from,(uchar*) buff,(uint) length,MYF(MY_NABP)) || + my_write(to,(uchar*) buff,(uint) length,param->myf_rw)) goto err; if (buff != tmp_buff) my_free(buff,MYF(0)); @@ -2141,7 +2141,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, info->opt_flag|=WRITE_CACHE_USED; info->rec_cache.file=info->dfile; /* for sort_delete_record */ - if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength, + if (!(sort_param.record=(uchar*) my_malloc((uint) share->base.pack_reclength, MYF(0))) || !mi_alloc_rec_buff(info, -1, &sort_param.rec_buff)) { @@ -2454,8 +2454,8 @@ err: my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff), MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR)); - my_free((gptr) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR)); - my_free((gptr) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR)); VOID(end_io_cache(¶m->read_cache)); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); @@ -2987,9 +2987,9 @@ err: pthread_cond_destroy (&sort_info.cond); pthread_mutex_destroy(&sort_info.mutex); - my_free((gptr) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR)); - my_free((gptr) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR)); - my_free((gptr) sort_param,MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) sort_param,MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR)); VOID(end_io_cache(¶m->read_cache)); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); @@ -3119,7 +3119,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) int parallel_flag; uint found_record,b_type,left_length; my_off_t pos; - byte *to; + uchar *to; MI_BLOCK_INFO block_info; SORT_INFO *sort_info=sort_param->sort_info; MI_CHECK *param=sort_info->param; @@ -3197,7 +3197,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) llstr(param->search_after_block,llbuff), llstr(sort_param->start_recpos,llbuff2)); if (_mi_read_cache(&sort_param->read_cache, - (byte*) block_info.header,pos, + (uchar*) block_info.header,pos, MI_BLOCK_INFO_HEADER_LENGTH, (! found_record ? READING_NEXT : 0) | parallel_flag | READING_HEADER)) @@ -3461,7 +3461,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) case COMPRESSED_RECORD: for (searching=0 ;; searching=1, sort_param->pos++) { - if (_mi_read_cache(&sort_param->read_cache,(byte*) block_info.header, + if (_mi_read_cache(&sort_param->read_cache,(uchar*) block_info.header, sort_param->pos, share->pack.ref_length,READING_NEXT)) DBUG_RETURN(-1); @@ -3489,7 +3489,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) llstr(sort_param->pos,llbuff)); continue; } - if (_mi_read_cache(&sort_param->read_cache,(byte*) sort_param->rec_buff, + if (_mi_read_cache(&sort_param->read_cache,(uchar*) sort_param->rec_buff, block_info.filepos, block_info.rec_len, READING_NEXT)) { @@ -3545,8 +3545,8 @@ int sort_write_record(MI_SORT_PARAM *sort_param) int flag; uint length; ulong block_length,reclength; - byte *from; - byte block_buff[8]; + uchar *from; + uchar block_buff[8]; SORT_INFO *sort_info=sort_param->sort_info; MI_CHECK *param=sort_info->param; MI_INFO *info=sort_info->info; @@ -3622,7 +3622,7 @@ int sort_write_record(MI_SORT_PARAM *sort_param) length+= save_pack_length((uint) share->pack.version, block_buff + length, info->blob_length); if (my_b_write(&info->rec_cache,block_buff,length) || - my_b_write(&info->rec_cache,(byte*) sort_param->rec_buff,reclength)) + my_b_write(&info->rec_cache,(uchar*) sort_param->rec_buff,reclength)) { mi_check_print_error(param,"%d when writing to datafile",my_errno); DBUG_RETURN(1); @@ -3922,7 +3922,7 @@ static int sort_insert_key(MI_SORT_PARAM *sort_param, /* Fill block with end-zero and write filled block */ mi_putint(anc_buff,key_block->last_length,nod_flag); - bzero((byte*) anc_buff+key_block->last_length, + bzero((uchar*) anc_buff+key_block->last_length, keyinfo->block_length- key_block->last_length); key_file_length=info->state->key_file_length; if ((filepos=_mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR) @@ -3934,10 +3934,10 @@ static int sort_insert_key(MI_SORT_PARAM *sort_param, if (_mi_write_keypage(info, keyinfo, filepos, DFLT_INIT_HITS, anc_buff)) DBUG_RETURN(1); } - else if (my_pwrite(info->s->kfile,(byte*) anc_buff, + else if (my_pwrite(info->s->kfile,(uchar*) anc_buff, (uint) keyinfo->block_length,filepos, param->myf_rw)) DBUG_RETURN(1); - DBUG_DUMP("buff",(byte*) anc_buff,mi_getint(anc_buff)); + DBUG_DUMP("buff",(uchar*) anc_buff,mi_getint(anc_buff)); /* Write separator-key to block in next level */ if (sort_insert_key(sort_param,key_block+1,key_block->lastkey,filepos)) @@ -4028,7 +4028,7 @@ int flush_pending_blocks(MI_SORT_PARAM *sort_param) if (nod_flag) _mi_kpointer(info,key_block->end_pos,filepos); key_file_length=info->state->key_file_length; - bzero((byte*) key_block->buff+length, keyinfo->block_length-length); + bzero((uchar*) key_block->buff+length, keyinfo->block_length-length); if ((filepos=_mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR) DBUG_RETURN(1); @@ -4039,10 +4039,10 @@ int flush_pending_blocks(MI_SORT_PARAM *sort_param) DFLT_INIT_HITS, key_block->buff)) DBUG_RETURN(1); } - else if (my_pwrite(info->s->kfile,(byte*) key_block->buff, + else if (my_pwrite(info->s->kfile,(uchar*) key_block->buff, (uint) keyinfo->block_length,filepos, myf_rw)) DBUG_RETURN(1); - DBUG_DUMP("buff",(byte*) key_block->buff,length); + DBUG_DUMP("buff",(uchar*) key_block->buff,length); nod_flag=1; } info->s->state.key_root[sort_param->key]=filepos; /* Last is root for tree */ @@ -4113,34 +4113,34 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) (param->testflag & T_UNPACK); if (!(keyinfo=(MI_KEYDEF*) my_alloca(sizeof(MI_KEYDEF)*share.base.keys))) DBUG_RETURN(0); - memcpy((byte*) keyinfo,(byte*) share.keyinfo, + memcpy((uchar*) keyinfo,(uchar*) share.keyinfo, (size_t) (sizeof(MI_KEYDEF)*share.base.keys)); key_parts= share.base.all_key_parts; if (!(keysegs=(HA_KEYSEG*) my_alloca(sizeof(HA_KEYSEG)* (key_parts+share.base.keys)))) { - my_afree((gptr) keyinfo); + my_afree((uchar*) keyinfo); DBUG_RETURN(1); } if (!(recdef=(MI_COLUMNDEF*) my_alloca(sizeof(MI_COLUMNDEF)*(share.base.fields+1)))) { - my_afree((gptr) keyinfo); - my_afree((gptr) keysegs); + my_afree((uchar*) keyinfo); + my_afree((uchar*) keysegs); DBUG_RETURN(1); } if (!(uniquedef=(MI_UNIQUEDEF*) my_alloca(sizeof(MI_UNIQUEDEF)*(share.state.header.uniques+1)))) { - my_afree((gptr) recdef); - my_afree((gptr) keyinfo); - my_afree((gptr) keysegs); + my_afree((uchar*) recdef); + my_afree((uchar*) keyinfo); + my_afree((uchar*) keysegs); DBUG_RETURN(1); } /* Copy the column definitions */ - memcpy((byte*) recdef,(byte*) share.rec, + memcpy((uchar*) recdef,(uchar*) share.rec, (size_t) (sizeof(MI_COLUMNDEF)*(share.base.fields+1))); for (rec=recdef,end=recdef+share.base.fields; rec != end ; rec++) { @@ -4152,7 +4152,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) } /* Change the new key to point at the saved key segments */ - memcpy((byte*) keysegs,(byte*) share.keyparts, + memcpy((uchar*) keysegs,(uchar*) share.keyparts, (size_t) (sizeof(HA_KEYSEG)*(key_parts+share.base.keys+ share.state.header.uniques))); keyseg=keysegs; @@ -4169,7 +4169,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) /* Copy the unique definitions and change them to point at the new key segments*/ - memcpy((byte*) uniquedef,(byte*) share.uniqueinfo, + memcpy((uchar*) uniquedef,(uchar*) share.uniqueinfo, (size_t) (sizeof(MI_UNIQUEDEF)*(share.state.header.uniques))); for (u_ptr=uniquedef,u_end=uniquedef+share.state.header.uniques; u_ptr != u_end ; u_ptr++) @@ -4251,10 +4251,10 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) goto end; error=0; end: - my_afree((gptr) uniquedef); - my_afree((gptr) keyinfo); - my_afree((gptr) recdef); - my_afree((gptr) keysegs); + my_afree((uchar*) uniquedef); + my_afree((uchar*) keyinfo); + my_afree((uchar*) recdef); + my_afree((uchar*) keysegs); DBUG_RETURN(error); } @@ -4357,7 +4357,7 @@ err: void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, my_bool repair_only) { - byte *record; + uchar *record; DBUG_ENTER("update_auto_increment_key"); if (!info->s->base.auto_key || @@ -4376,7 +4376,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, We have to use an allocated buffer instead of info->rec_buff as _mi_put_key_in_record() may use info->rec_buff */ - if (!(record= (byte*) my_malloc((uint) info->s->base.pack_reclength, + if (!(record= (uchar*) my_malloc((uint) info->s->base.pack_reclength, MYF(0)))) { mi_check_print_error(param,"Not enough memory for extra record"); @@ -4504,10 +4504,10 @@ void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part, } -static ha_checksum mi_byte_checksum(const byte *buf, uint length) +static ha_checksum mi_byte_checksum(const uchar *buf, uint length) { ha_checksum crc; - const byte *end=buf+length; + const uchar *end=buf+length; for (crc=0; buf != end; buf++) crc=((crc << 1) + *((uchar*) buf)) + test(crc & (((ha_checksum) 1) << (8*sizeof(ha_checksum)-1))); diff --git a/storage/myisam/mi_checksum.c b/storage/myisam/mi_checksum.c index 711e87c1547..4e87de373bd 100644 --- a/storage/myisam/mi_checksum.c +++ b/storage/myisam/mi_checksum.c @@ -17,7 +17,7 @@ #include "myisamdef.h" -ha_checksum mi_checksum(MI_INFO *info, const byte *buf) +ha_checksum mi_checksum(MI_INFO *info, const uchar *buf) { uint i; ha_checksum crc=0; @@ -25,7 +25,7 @@ ha_checksum mi_checksum(MI_INFO *info, const byte *buf) for (i=info->s->base.fields ; i-- ; buf+=(rec++)->length) { - const byte *pos; + const uchar *pos; ulong length; switch (rec->type) { case FIELD_BLOB: @@ -52,13 +52,13 @@ ha_checksum mi_checksum(MI_INFO *info, const byte *buf) pos=buf; break; } - crc=my_checksum(crc, pos ? pos : "", length); + crc=my_checksum(crc, pos ? pos : (uchar*) "", length); } return crc; } -ha_checksum mi_static_checksum(MI_INFO *info, const byte *pos) +ha_checksum mi_static_checksum(MI_INFO *info, const uchar *pos) { return my_checksum(0, pos, info->s->base.reclength); } diff --git a/storage/myisam/mi_close.c b/storage/myisam/mi_close.c index 47b7ba855c0..07105aea88d 100644 --- a/storage/myisam/mi_close.c +++ b/storage/myisam/mi_close.c @@ -87,8 +87,8 @@ int mi_close(register MI_INFO *info) #endif if (share->decode_trees) { - my_free((gptr) share->decode_trees,MYF(0)); - my_free((gptr) share->decode_tables,MYF(0)); + my_free((uchar*) share->decode_trees,MYF(0)); + my_free((uchar*) share->decode_tables,MYF(0)); } #ifdef THREAD thr_lock_delete(&share->lock); @@ -102,19 +102,19 @@ int mi_close(register MI_INFO *info) } } #endif - my_free((gptr) info->s,MYF(0)); + my_free((uchar*) info->s,MYF(0)); } pthread_mutex_unlock(&THR_LOCK_myisam); if (info->ftparser_param) { - my_free((gptr)info->ftparser_param, MYF(0)); + my_free((uchar*)info->ftparser_param, MYF(0)); info->ftparser_param= 0; } if (info->dfile >= 0 && my_close(info->dfile,MYF(0))) error = my_errno; myisam_log_command(MI_LOG_CLOSE,info,NULL,0,error); - my_free((gptr) info,MYF(0)); + my_free((uchar*) info,MYF(0)); if (error) { diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index 71d377c8b6b..c177aa8d987 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -76,7 +76,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, LINT_INIT(file); errpos=0; options=0; - bzero((byte*) &share,sizeof(share)); + bzero((uchar*) &share,sizeof(share)); if (flags & HA_DONT_TOUCH_DATA) { @@ -498,7 +498,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, goto err; } - bmove(share.state.header.file_version,(byte*) myisam_file_magic,4); + bmove(share.state.header.file_version,(uchar*) myisam_file_magic,4); ci->old_options=options| (ci->old_options & HA_OPTION_TEMP_COMPRESS_RECORD ? HA_OPTION_COMPRESS_RECORD | HA_OPTION_TEMP_COMPRESS_RECORD: 0); diff --git a/storage/myisam/mi_delete.c b/storage/myisam/mi_delete.c index 409930ff7fb..29a84570f1e 100644 --- a/storage/myisam/mi_delete.c +++ b/storage/myisam/mi_delete.c @@ -32,7 +32,7 @@ static int _mi_ck_real_delete(register MI_INFO *info,MI_KEYDEF *keyinfo, uchar *key, uint key_length, my_off_t *root); -int mi_delete(MI_INFO *info,const byte *record) +int mi_delete(MI_INFO *info,const uchar *record) { uint i; uchar *old_key; @@ -100,7 +100,7 @@ int mi_delete(MI_INFO *info,const byte *record) info->state->records--; mi_sizestore(lastpos,info->lastpos); - myisam_log_command(MI_LOG_DELETE,info,(byte*) lastpos,sizeof(lastpos),0); + myisam_log_command(MI_LOG_DELETE,info,(uchar*) lastpos,sizeof(lastpos),0); VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE)); allow_break(); /* Allow SIGHUP & SIGINT */ if (info->invalidator != 0) @@ -114,7 +114,7 @@ int mi_delete(MI_INFO *info,const byte *record) err: save_errno=my_errno; mi_sizestore(lastpos,info->lastpos); - myisam_log_command(MI_LOG_DELETE,info,(byte*) lastpos, sizeof(lastpos),0); + myisam_log_command(MI_LOG_DELETE,info,(uchar*) lastpos, sizeof(lastpos),0); if (save_errno != HA_ERR_RECORD_CHANGED) { mi_print_error(info->s, HA_ERR_CRASHED); @@ -198,7 +198,7 @@ static int _mi_ck_real_delete(register MI_INFO *info, MI_KEYDEF *keyinfo, } } err: - my_afree((gptr) root_buff); + my_afree((uchar*) root_buff); DBUG_PRINT("exit",("Return: %d",error)); DBUG_RETURN(error); } /* _mi_ck_real_delete */ @@ -223,7 +223,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, my_off_t leaf_page,next_block; uchar lastkey[MI_MAX_KEY_BUFF]; DBUG_ENTER("d_search"); - DBUG_DUMP("page",(byte*) anc_buff,mi_getint(anc_buff)); + DBUG_DUMP("page",(uchar*) anc_buff,mi_getint(anc_buff)); search_key_length= (comp_flag & SEARCH_FIND) ? key_length : USE_WHOLE_KEY; flag=(*keyinfo->bin_search)(info,keyinfo,anc_buff,key, search_key_length, @@ -381,14 +381,14 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ret_value|=_mi_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,anc_buff); else { - DBUG_DUMP("page",(byte*) anc_buff,mi_getint(anc_buff)); + DBUG_DUMP("page",(uchar*) anc_buff,mi_getint(anc_buff)); } - my_afree((byte*) leaf_buff); + my_afree((uchar*) leaf_buff); DBUG_PRINT("exit",("Return: %d",ret_value)); DBUG_RETURN(ret_value); err: - my_afree((byte*) leaf_buff); + my_afree((uchar*) leaf_buff); DBUG_PRINT("exit",("Error: %d",my_errno)); DBUG_RETURN (-1); } /* d_search */ @@ -411,7 +411,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key, DBUG_ENTER("del"); DBUG_PRINT("enter",("leaf_page: %ld keypos: 0x%lx", (long) leaf_page, (ulong) keypos)); - DBUG_DUMP("leaf_buff",(byte*) leaf_buff,mi_getint(leaf_buff)); + DBUG_DUMP("leaf_buff",(uchar*) leaf_buff,mi_getint(leaf_buff)); endpos=leaf_buff+mi_getint(leaf_buff); if (!(key_start=_mi_get_last_key(info,keyinfo,leaf_buff,keybuff,endpos, @@ -428,7 +428,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key, ret_value= -1; else { - DBUG_DUMP("next_page",(byte*) next_buff,mi_getint(next_buff)); + DBUG_DUMP("next_page",(uchar*) next_buff,mi_getint(next_buff)); if ((ret_value=del(info,keyinfo,key,anc_buff,next_page,next_buff, keypos,next_block,ret_key)) >0) { @@ -455,7 +455,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key, if (_mi_write_keypage(info,keyinfo,leaf_page,DFLT_INIT_HITS,leaf_buff)) goto err; } - my_afree((byte*) next_buff); + my_afree((uchar*) next_buff); DBUG_RETURN(ret_value); } @@ -479,7 +479,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key, prev_key, prev_key, keybuff,&s_temp); if (length > 0) - bmove_upp((byte*) endpos+length,(byte*) endpos,(uint) (endpos-keypos)); + bmove_upp((uchar*) endpos+length,(uchar*) endpos,(uint) (endpos-keypos)); else bmove(keypos,keypos-length, (int) (endpos-keypos)+length); (*keyinfo->store_key)(keyinfo,keypos,&s_temp); @@ -517,8 +517,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, DBUG_ENTER("underflow"); DBUG_PRINT("enter",("leaf_page: %ld keypos: 0x%lx",(long) leaf_page, (ulong) keypos)); - DBUG_DUMP("anc_buff",(byte*) anc_buff,mi_getint(anc_buff)); - DBUG_DUMP("leaf_buff",(byte*) leaf_buff,mi_getint(leaf_buff)); + DBUG_DUMP("anc_buff",(uchar*) anc_buff,mi_getint(anc_buff)); + DBUG_DUMP("leaf_buff",(uchar*) leaf_buff,mi_getint(leaf_buff)); buff=info->buff; info->buff_used=1; @@ -554,10 +554,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (!_mi_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,buff,0)) goto err; buff_length=mi_getint(buff); - DBUG_DUMP("next",(byte*) buff,buff_length); + DBUG_DUMP("next",(uchar*) buff,buff_length); /* find keys to make a big key-page */ - bmove((byte*) next_keypos-key_reflength,(byte*) buff+2, + bmove((uchar*) next_keypos-key_reflength,(uchar*) buff+2, key_reflength); if (!_mi_get_last_key(info,keyinfo,anc_buff,anc_key,next_keypos,&length) || !_mi_get_last_key(info,keyinfo,leaf_buff,leaf_key, @@ -572,8 +572,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, length=buff_length-p_length; endpos=buff+length+leaf_length+t_length; /* buff will always be larger than before !*/ - bmove_upp((byte*) endpos, (byte*) buff+buff_length,length); - memcpy((byte*) buff, (byte*) leaf_buff,(size_t) leaf_length); + bmove_upp((uchar*) endpos, (uchar*) buff+buff_length,length); + memcpy((uchar*) buff, (uchar*) leaf_buff,(size_t) leaf_length); (*keyinfo->store_key)(keyinfo,buff+leaf_length,&s_temp); buff_length=(uint) (endpos-buff); mi_putint(buff,buff_length,nod_flag); @@ -589,7 +589,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (buff_length <= keyinfo->block_length) { /* Keys in one page */ - memcpy((byte*) leaf_buff,(byte*) buff,(size_t) buff_length); + memcpy((uchar*) leaf_buff,(uchar*) buff,(size_t) buff_length); if (_mi_dispose(info,keyinfo,next_page,DFLT_INIT_HITS)) goto err; } @@ -605,7 +605,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, &key_length, &after_key))) goto err; length=(uint) (half_pos-buff); - memcpy((byte*) leaf_buff,(byte*) buff,(size_t) length); + memcpy((uchar*) leaf_buff,(uchar*) buff,(size_t) length); mi_putint(leaf_buff,length,nod_flag); /* Correct new keypointer to leaf_page */ @@ -619,7 +619,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, prev_key, prev_key, leaf_key, &s_temp); if (t_length >= 0) - bmove_upp((byte*) endpos+t_length,(byte*) endpos, + bmove_upp((uchar*) endpos+t_length,(uchar*) endpos, (uint) (endpos-keypos)); else bmove(keypos,keypos-t_length,(uint) (endpos-keypos)+t_length); @@ -628,7 +628,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, /* Store key first in new page */ if (nod_flag) - bmove((byte*) buff+2,(byte*) half_pos-nod_flag,(size_t) nod_flag); + bmove((uchar*) buff+2,(uchar*) half_pos-nod_flag,(size_t) nod_flag); if (!(*keyinfo->get_key)(keyinfo,nod_flag,&half_pos,leaf_key)) goto err; t_length=(int) (*keyinfo->pack_key)(keyinfo, nod_flag, (uchar*) 0, @@ -636,7 +636,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, leaf_key, &s_temp); /* t_length will always be > 0 for a new page !*/ length=(uint) ((buff+mi_getint(buff))-half_pos); - bmove((byte*) buff+p_length+t_length,(byte*) half_pos,(size_t) length); + bmove((uchar*) buff+p_length+t_length,(uchar*) half_pos,(size_t) length); (*keyinfo->store_key)(keyinfo,buff+p_length,&s_temp); mi_putint(buff,length+t_length+p_length,nod_flag); @@ -659,10 +659,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, goto err; buff_length=mi_getint(buff); endpos=buff+buff_length; - DBUG_DUMP("prev",(byte*) buff,buff_length); + DBUG_DUMP("prev",(uchar*) buff,buff_length); /* find keys to make a big key-page */ - bmove((byte*) next_keypos - key_reflength,(byte*) leaf_buff+2, + bmove((uchar*) next_keypos - key_reflength,(uchar*) leaf_buff+2, key_reflength); next_keypos=keypos; if (!(*keyinfo->get_key)(keyinfo,key_reflength,&next_keypos, @@ -679,10 +679,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, prev_key, prev_key, anc_key, &s_temp); if (t_length >= 0) - bmove((byte*) endpos+t_length,(byte*) leaf_buff+p_length, + bmove((uchar*) endpos+t_length,(uchar*) leaf_buff+p_length, (size_t) (leaf_length-p_length)); else /* We gained space */ - bmove((byte*) endpos,(byte*) leaf_buff+((int) p_length-t_length), + bmove((uchar*) endpos,(uchar*) leaf_buff+((int) p_length-t_length), (size_t) (leaf_length-p_length+t_length)); (*keyinfo->store_key)(keyinfo,endpos,&s_temp); @@ -715,8 +715,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, goto err; _mi_kpointer(info,leaf_key+key_length,leaf_page); /* Save key in anc_buff */ - DBUG_DUMP("anc_buff",(byte*) anc_buff,anc_length); - DBUG_DUMP("key_to_anc",(byte*) leaf_key,key_length); + DBUG_DUMP("anc_buff",(uchar*) anc_buff,anc_length); + DBUG_DUMP("key_to_anc",(uchar*) leaf_key,key_length); temp_pos=anc_buff+anc_length; t_length=(*keyinfo->pack_key)(keyinfo,key_reflength, @@ -725,7 +725,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, anc_pos, anc_pos, leaf_key,&s_temp); if (t_length > 0) - bmove_upp((byte*) temp_pos+t_length,(byte*) temp_pos, + bmove_upp((uchar*) temp_pos+t_length,(uchar*) temp_pos, (uint) (temp_pos-keypos)); else bmove(keypos,keypos-t_length,(uint) (temp_pos-keypos)+t_length); @@ -734,15 +734,15 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, /* Store first key on new page */ if (nod_flag) - bmove((byte*) leaf_buff+2,(byte*) half_pos-nod_flag,(size_t) nod_flag); + bmove((uchar*) leaf_buff+2,(uchar*) half_pos-nod_flag,(size_t) nod_flag); if (!(length=(*keyinfo->get_key)(keyinfo,nod_flag,&half_pos,leaf_key))) goto err; - DBUG_DUMP("key_to_leaf",(byte*) leaf_key,length); + DBUG_DUMP("key_to_leaf",(uchar*) leaf_key,length); t_length=(*keyinfo->pack_key)(keyinfo,nod_flag, (uchar*) 0, (uchar*) 0, (uchar*) 0, leaf_key, &s_temp); length=(uint) ((buff+buff_length)-half_pos); DBUG_PRINT("info",("t_length: %d length: %d",t_length,(int) length)); - bmove((byte*) leaf_buff+p_length+t_length,(byte*) half_pos, + bmove((uchar*) leaf_buff+p_length+t_length,(uchar*) half_pos, (size_t) length); (*keyinfo->store_key)(keyinfo,leaf_buff+p_length,&s_temp); mi_putint(leaf_buff,length+t_length+p_length,nod_flag); @@ -886,7 +886,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag, } } end: - bmove((byte*) start,(byte*) start+s_length, + bmove((uchar*) start,(uchar*) start+s_length, (uint) (page_end-start-s_length)); DBUG_RETURN((uint) s_length); } /* remove_key */ diff --git a/storage/myisam/mi_delete_all.c b/storage/myisam/mi_delete_all.c index a17514486d5..dea0385cbca 100644 --- a/storage/myisam/mi_delete_all.c +++ b/storage/myisam/mi_delete_all.c @@ -47,7 +47,7 @@ int mi_delete_all_rows(MI_INFO *info) for (i=0 ; i < share->base.keys ; i++) state->key_root[i]= HA_OFFSET_ERROR; - myisam_log_command(MI_LOG_DELETE_ALL,info,(byte*) 0,0,0); + myisam_log_command(MI_LOG_DELETE_ALL,info,(uchar*) 0,0,0); /* If we are using delayed keys or if the user has done changes to the tables since it was locked then there may be key blocks in the key cache diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index 5342619c79b..eba868bfb82 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -28,15 +28,15 @@ /* Enough for comparing if number is zero */ static char zero_string[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -static int write_dynamic_record(MI_INFO *info,const byte *record, +static int write_dynamic_record(MI_INFO *info,const uchar *record, ulong reclength); static int _mi_find_writepos(MI_INFO *info,ulong reclength,my_off_t *filepos, ulong *length); -static int update_dynamic_record(MI_INFO *info,my_off_t filepos,byte *record, +static int update_dynamic_record(MI_INFO *info,my_off_t filepos,uchar *record, ulong reclength); static int delete_dynamic_record(MI_INFO *info,my_off_t filepos, uint second_read); -static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos, +static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos, uint length); #ifdef THREAD @@ -79,13 +79,13 @@ my_bool mi_dynmap_file(MI_INFO *info, my_off_t size) mapping. When swap space is not reserved one might get SIGSEGV upon a write if no physical memory is available. */ - info->s->file_map= (byte*) + info->s->file_map= (uchar*) my_mmap(0, (size_t)(size + MEMMAP_EXTRA_MARGIN), info->s->mode==O_RDONLY ? PROT_READ : PROT_READ | PROT_WRITE, MAP_SHARED | MAP_NORESERVE, info->dfile, 0L); - if (info->s->file_map == (byte*) MAP_FAILED) + if (info->s->file_map == (uchar*) MAP_FAILED) { info->s->file_map= NULL; DBUG_RETURN(1); @@ -135,7 +135,7 @@ void mi_remap_file(MI_INFO *info, my_off_t size) 0 ok */ -uint mi_mmap_pread(MI_INFO *info, byte *Buffer, +uint mi_mmap_pread(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags) { DBUG_PRINT("info", ("mi_read with mmap %d\n", info->dfile)); @@ -167,7 +167,7 @@ uint mi_mmap_pread(MI_INFO *info, byte *Buffer, /* wrapper for my_pread in case if mmap isn't used */ -uint mi_nommap_pread(MI_INFO *info, byte *Buffer, +uint mi_nommap_pread(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags) { return my_pread(info->dfile, Buffer, Count, offset, MyFlags); @@ -190,7 +190,7 @@ uint mi_nommap_pread(MI_INFO *info, byte *Buffer, !=0 error. In this case return error from pwrite */ -uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer, +uint mi_mmap_pwrite(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags) { DBUG_PRINT("info", ("mi_write with mmap %d\n", info->dfile)); @@ -224,28 +224,28 @@ uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer, /* wrapper for my_pwrite in case if mmap isn't used */ -uint mi_nommap_pwrite(MI_INFO *info, byte *Buffer, +uint mi_nommap_pwrite(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags) { return my_pwrite(info->dfile, Buffer, Count, offset, MyFlags); } -int _mi_write_dynamic_record(MI_INFO *info, const byte *record) +int _mi_write_dynamic_record(MI_INFO *info, const uchar *record) { ulong reclength=_mi_rec_pack(info,info->rec_buff,record); return (write_dynamic_record(info,info->rec_buff,reclength)); } -int _mi_update_dynamic_record(MI_INFO *info, my_off_t pos, const byte *record) +int _mi_update_dynamic_record(MI_INFO *info, my_off_t pos, const uchar *record) { uint length=_mi_rec_pack(info,info->rec_buff,record); return (update_dynamic_record(info,pos,info->rec_buff,length)); } -int _mi_write_blob_record(MI_INFO *info, const byte *record) +int _mi_write_blob_record(MI_INFO *info, const uchar *record) { - byte *rec_buff; + uchar *rec_buff; int error; ulong reclength,reclength2,extra; @@ -260,7 +260,7 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record) return -1; } #endif - if (!(rec_buff=(byte*) my_alloca(reclength))) + if (!(rec_buff=(uchar*) my_alloca(reclength))) { my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */ return(-1); @@ -277,9 +277,9 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record) } -int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const byte *record) +int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const uchar *record) { - byte *rec_buff; + uchar *rec_buff; int error; ulong reclength,extra; @@ -294,7 +294,7 @@ int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const byte *record) return -1; } #endif - if (!(rec_buff=(byte*) my_alloca(reclength))) + if (!(rec_buff=(uchar*) my_alloca(reclength))) { my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */ return(-1); @@ -317,7 +317,7 @@ int _mi_delete_dynamic_record(MI_INFO *info) /* Write record to data-file */ -static int write_dynamic_record(MI_INFO *info, const byte *record, +static int write_dynamic_record(MI_INFO *info, const uchar *record, ulong reclength) { int flag; @@ -333,7 +333,7 @@ static int write_dynamic_record(MI_INFO *info, const byte *record, if (_mi_write_part_record(info,filepos,length, (info->append_insert_at_end ? HA_OFFSET_ERROR : info->s->state.dellink), - (byte**) &record,&reclength,&flag)) + (uchar**) &record,&reclength,&flag)) goto err; } while (reclength); @@ -543,7 +543,7 @@ static int delete_dynamic_record(MI_INFO *info, my_off_t filepos, bfill(block_info.header+12,8,255); else mi_sizestore(block_info.header+12,block_info.next_filepos); - if (info->s->file_write(info,(byte*) block_info.header,20,filepos, + if (info->s->file_write(info,(uchar*) block_info.header,20,filepos, MYF(MY_NABP))) DBUG_RETURN(1); info->s->state.dellink = filepos; @@ -566,12 +566,12 @@ int _mi_write_part_record(MI_INFO *info, my_off_t filepos, /* points at empty block */ ulong length, /* length of block */ my_off_t next_filepos,/* Next empty block */ - byte **record, /* pointer to record ptr */ + uchar **record, /* pointer to record ptr */ ulong *reclength, /* length of *record */ int *flag) /* *flag == 0 if header */ { ulong head_length,res_length,extra_length,long_block,del_length; - byte *pos,*record_end; + uchar *pos,*record_end; my_off_t next_delete_block; uchar temp[MI_SPLIT_LENGTH+MI_DYN_DELETE_BLOCK_HEADER]; DBUG_ENTER("_mi_write_part_record"); @@ -615,7 +615,7 @@ int _mi_write_part_record(MI_INFO *info, temp[0]=13; mi_int4store(temp+1,*reclength); mi_int3store(temp+5,length-head_length); - mi_sizestore((byte*) temp+8,next_filepos); + mi_sizestore((uchar*) temp+8,next_filepos); } else { @@ -625,13 +625,13 @@ int _mi_write_part_record(MI_INFO *info, { mi_int3store(temp+1,*reclength); mi_int3store(temp+4,length-head_length); - mi_sizestore((byte*) temp+7,next_filepos); + mi_sizestore((uchar*) temp+7,next_filepos); } else { mi_int2store(temp+1,*reclength); mi_int2store(temp+3,length-head_length); - mi_sizestore((byte*) temp+5,next_filepos); + mi_sizestore((uchar*) temp+5,next_filepos); } } } @@ -642,12 +642,12 @@ int _mi_write_part_record(MI_INFO *info, if (long_block) { mi_int3store(temp+1,length-head_length); - mi_sizestore((byte*) temp+4,next_filepos); + mi_sizestore((uchar*) temp+4,next_filepos); } else { mi_int2store(temp+1,length-head_length); - mi_sizestore((byte*) temp+3,next_filepos); + mi_sizestore((uchar*) temp+3,next_filepos); } } } @@ -668,14 +668,14 @@ int _mi_write_part_record(MI_INFO *info, } length= *reclength+head_length; /* Write only what is needed */ } - DBUG_DUMP("header",(byte*) temp,head_length); + DBUG_DUMP("header",(uchar*) temp,head_length); /* Make a long block for one write */ record_end= *record+length-head_length; del_length=(res_length ? MI_DYN_DELETE_BLOCK_HEADER : 0); - bmove((byte*) (*record-head_length),(byte*) temp,head_length); + bmove((uchar*) (*record-head_length),(uchar*) temp,head_length); memcpy(temp,record_end,(size_t) (extra_length+del_length)); - bzero((byte*) record_end,extra_length); + bzero((uchar*) record_end,extra_length); if (res_length) { @@ -715,18 +715,18 @@ int _mi_write_part_record(MI_INFO *info, if (info->update & HA_STATE_EXTEND_BLOCK) { info->update&= ~HA_STATE_EXTEND_BLOCK; - if (my_block_write(&info->rec_cache,(byte*) *record-head_length, + if (my_block_write(&info->rec_cache,(uchar*) *record-head_length, length+extra_length+del_length,filepos)) goto err; } - else if (my_b_write(&info->rec_cache,(byte*) *record-head_length, + else if (my_b_write(&info->rec_cache,(uchar*) *record-head_length, length+extra_length+del_length)) goto err; } else { info->rec_cache.seek_not_done=1; - if (info->s->file_write(info,(byte*) *record-head_length,length+extra_length+ + if (info->s->file_write(info,(uchar*) *record-head_length,length+extra_length+ del_length,filepos,info->s->write_flag)) goto err; } @@ -752,7 +752,7 @@ err: /* update record from datafile */ -static int update_dynamic_record(MI_INFO *info, my_off_t filepos, byte *record, +static int update_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *record, ulong reclength) { int flag; @@ -836,7 +836,7 @@ static int update_dynamic_record(MI_INFO *info, my_off_t filepos, byte *record, mi_int3store(del_block.header+1, rest_length); mi_sizestore(del_block.header+4,info->s->state.dellink); bfill(del_block.header+12,8,255); - if (info->s->file_write(info,(byte*) del_block.header,20, next_pos, + if (info->s->file_write(info,(uchar*) del_block.header,20, next_pos, MYF(MY_NABP))) DBUG_RETURN(1); info->s->state.dellink= next_pos; @@ -875,10 +875,11 @@ err: /* Pack a record. Return new reclength */ -uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from) +uint _mi_rec_pack(MI_INFO *info, register uchar *to, + register const uchar *from) { uint length,new_length,flag,bit,i; - char *pos,*end,*startpos,*packpos; + uchar *pos,*end,*startpos,*packpos; enum en_fieldtype type; reg3 MI_COLUMNDEF *rec; MI_BLOB *blob; @@ -901,7 +902,7 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from) { char *temp_pos; size_t tmp_length=length-mi_portable_sizeof_char_ptr; - memcpy((byte*) to,from,tmp_length); + memcpy((uchar*) to,from,tmp_length); memcpy_fixed(&temp_pos,from+tmp_length,sizeof(char*)); memcpy(to+tmp_length,temp_pos,(size_t) blob->length); to+=tmp_length+blob->length; @@ -910,17 +911,17 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from) } else if (type == FIELD_SKIP_ZERO) { - if (memcmp((byte*) from,zero_string,length) == 0) + if (memcmp((uchar*) from,zero_string,length) == 0) flag|=bit; else { - memcpy((byte*) to,from,(size_t) length); to+=length; + memcpy((uchar*) to,from,(size_t) length); to+=length; } } else if (type == FIELD_SKIP_ENDSPACE || type == FIELD_SKIP_PRESPACE) { - pos= (byte*) from; end= (byte*) from + length; + pos= (uchar*) from; end= (uchar*) from + length; if (type == FIELD_SKIP_ENDSPACE) { /* Pack trailing spaces */ while (end > from && *(end-1) == ' ') @@ -943,7 +944,7 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from) } else *to++= (char) new_length; - memcpy((byte*) to,pos,(size_t) new_length); to+=new_length; + memcpy((uchar*) to,pos,(size_t) new_length); to+=new_length; flag|=bit; } else @@ -1000,11 +1001,11 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from) Returns 0 if record is ok. */ -my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff, +my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *rec_buff, ulong packed_length, my_bool with_checksum) { uint length,new_length,flag,bit,i; - char *pos,*end,*packpos,*to; + uchar *pos,*end,*packpos,*to; enum en_fieldtype type; reg3 MI_COLUMNDEF *rec; DBUG_ENTER("_mi_rec_check"); @@ -1029,7 +1030,7 @@ my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff, } else if (type == FIELD_SKIP_ZERO) { - if (memcmp((byte*) record,zero_string,length) == 0) + if (memcmp((uchar*) record,zero_string,length) == 0) { if (!(flag & bit)) goto err; @@ -1040,7 +1041,7 @@ my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff, else if (type == FIELD_SKIP_ENDSPACE || type == FIELD_SKIP_PRESPACE) { - pos= (byte*) record; end= (byte*) record + length; + pos= (uchar*) record; end= (uchar*) record + length; if (type == FIELD_SKIP_ENDSPACE) { /* Pack trailing spaces */ while (end > record && *(end-1) == ' ') @@ -1122,12 +1123,12 @@ err: /* Returns -1 and my_errno =HA_ERR_RECORD_DELETED if reclength isn't */ /* right. Returns reclength (>0) if ok */ -ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from, +ulong _mi_rec_unpack(register MI_INFO *info, register uchar *to, uchar *from, ulong found_length) { uint flag,bit,length,rec_length,min_pack_length; enum en_fieldtype type; - byte *from_end,*to_end,*packpos; + uchar *from_end,*to_end,*packpos; reg3 MI_COLUMNDEF *rec,*end_field; DBUG_ENTER("_mi_rec_unpack"); @@ -1173,7 +1174,7 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from, if (flag & bit) { if (type == FIELD_BLOB || type == FIELD_SKIP_ZERO) - bzero((byte*) to,rec_length); + bzero((uchar*) to,rec_length); else if (type == FIELD_SKIP_ENDSPACE || type == FIELD_SKIP_PRESPACE) { @@ -1195,13 +1196,13 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from, goto err; if (type == FIELD_SKIP_ENDSPACE) { - memcpy(to,(byte*) from,(size_t) length); - bfill((byte*) to+length,rec_length-length,' '); + memcpy(to,(uchar*) from,(size_t) length); + bfill((uchar*) to+length,rec_length-length,' '); } else { - bfill((byte*) to,rec_length-length,' '); - memcpy(to+rec_length-length,(byte*) from,(size_t) length); + bfill((uchar*) to,rec_length-length,' '); + memcpy(to+rec_length-length,(uchar*) from,(size_t) length); } from+=length; } @@ -1215,9 +1216,9 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from, from_left - size_length < blob_length || from_left - size_length - blob_length < min_pack_length) goto err; - memcpy((byte*) to,(byte*) from,(size_t) size_length); + memcpy((uchar*) to,(uchar*) from,(size_t) size_length); from+=size_length; - memcpy_fixed((byte*) to+size_length,(byte*) &from,sizeof(char*)); + memcpy_fixed((uchar*) to+size_length,(uchar*) &from,sizeof(char*)); from+=blob_length; } else @@ -1226,7 +1227,7 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from, min_pack_length--; if (min_pack_length + rec_length > (uint) (from_end - from)) goto err; - memcpy(to,(byte*) from,(size_t) rec_length); from+=rec_length; + memcpy(to,(uchar*) from,(size_t) rec_length); from+=rec_length; } if ((bit= bit << 1) >= 256) { @@ -1238,7 +1239,7 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from, if (min_pack_length > (uint) (from_end - from)) goto err; min_pack_length-=rec_length; - memcpy(to, (byte*) from, (size_t) rec_length); + memcpy(to, (uchar*) from, (size_t) rec_length); from+=rec_length; } } @@ -1251,14 +1252,14 @@ err: my_errno= HA_ERR_WRONG_IN_RECORD; DBUG_PRINT("error",("to_end: 0x%lx -> 0x%lx from_end: 0x%lx -> 0x%lx", (long) to, (long) to_end, (long) from, (long) from_end)); - DBUG_DUMP("from",(byte*) info->rec_buff,info->s->base.min_pack_length); + DBUG_DUMP("from",(uchar*) info->rec_buff,info->s->base.min_pack_length); DBUG_RETURN(MY_FILE_ERROR); } /* _mi_rec_unpack */ /* Calc length of blob. Update info in blobs->length */ -ulong _my_calc_total_blob_length(MI_INFO *info, const byte *record) +ulong _my_calc_total_blob_length(MI_INFO *info, const uchar *record) { ulong length; MI_BLOB *blob,*end; @@ -1274,7 +1275,7 @@ ulong _my_calc_total_blob_length(MI_INFO *info, const byte *record) } -ulong _mi_calc_blob_length(uint length, const byte *pos) +ulong _mi_calc_blob_length(uint length, const uchar *pos) { switch (length) { case 1: @@ -1292,7 +1293,7 @@ ulong _mi_calc_blob_length(uint length, const byte *pos) } -void _my_store_blob_length(byte *pos,uint pack_length,uint length) +void _my_store_blob_length(uchar *pos,uint pack_length,uint length) { switch (pack_length) { case 1: @@ -1345,11 +1346,11 @@ void _my_store_blob_length(byte *pos,uint pack_length,uint length) -1 Error */ -int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf) +int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *buf) { int block_of_record; uint b_type,left_length; - byte *to; + uchar *to; MI_BLOCK_INFO block_info; File file; DBUG_ENTER("mi_read_dynamic_record"); @@ -1405,7 +1406,7 @@ int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf) prefetch_len= block_info.data_len; if (prefetch_len) { - memcpy((byte*) to, block_info.header + offset, prefetch_len); + memcpy((uchar*) to, block_info.header + offset, prefetch_len); block_info.data_len-= prefetch_len; left_length-= prefetch_len; to+= prefetch_len; @@ -1423,7 +1424,7 @@ int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf) there is no equivalent without seeking. We are at the right position already. :( */ - if (info->s->file_read(info, (byte*) to, block_info.data_len, + if (info->s->file_read(info, (uchar*) to, block_info.data_len, filepos, MYF(MY_NABP))) goto panic; left_length-=block_info.data_len; @@ -1450,9 +1451,9 @@ err: /* compare unique constraint between stored rows */ int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def, - const byte *record, my_off_t pos) + const uchar *record, my_off_t pos) { - byte *rec_buff,*old_record; + uchar *rec_buff,*old_record; int error; DBUG_ENTER("_mi_cmp_dynamic_unique"); @@ -1478,11 +1479,11 @@ int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def, /* Compare of record one disk with packed record in memory */ -int _mi_cmp_dynamic_record(register MI_INFO *info, register const byte *record) +int _mi_cmp_dynamic_record(register MI_INFO *info, register const uchar *record) { uint flag,reclength,b_type; my_off_t filepos; - byte *buffer; + uchar *buffer; MI_BLOCK_INFO block_info; DBUG_ENTER("_mi_cmp_dynamic_record"); @@ -1504,7 +1505,7 @@ int _mi_cmp_dynamic_record(register MI_INFO *info, register const byte *record) { /* If check isn't disabled */ if (info->s->base.blobs) { - if (!(buffer=(byte*) my_alloca(info->s->base.pack_reclength+ + if (!(buffer=(uchar*) my_alloca(info->s->base.pack_reclength+ _my_calc_total_blob_length(info,record)))) DBUG_RETURN(-1); } @@ -1552,14 +1553,14 @@ int _mi_cmp_dynamic_record(register MI_INFO *info, register const byte *record) my_errno=0; err: if (buffer != info->rec_buff) - my_afree((gptr) buffer); + my_afree((uchar*) buffer); DBUG_RETURN(my_errno); } /* Compare file to buffert */ -static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos, +static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos, uint length) { uint next_length; @@ -1571,7 +1572,7 @@ static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos, while (length > IO_SIZE*2) { if (my_pread(file,temp_buff,next_length,filepos, MYF(MY_NABP)) || - memcmp((byte*) buff,temp_buff,next_length)) + memcmp((uchar*) buff,temp_buff,next_length)) goto err; filepos+=next_length; buff+=next_length; @@ -1580,7 +1581,7 @@ static int _mi_cmp_buffer(File file, const byte *buff, my_off_t filepos, } if (my_pread(file,temp_buff,length,filepos,MYF(MY_NABP))) goto err; - DBUG_RETURN(memcmp((byte*) buff,temp_buff,length)); + DBUG_RETURN(memcmp((uchar*) buff,temp_buff,length)); err: DBUG_RETURN(1); } @@ -1620,13 +1621,13 @@ err: != 0 Error */ -int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf, +int _mi_read_rnd_dynamic_record(MI_INFO *info, uchar *buf, register my_off_t filepos, my_bool skip_deleted_blocks) { int block_of_record, info_read, save_errno; uint left_len,b_type; - byte *to; + uchar *to; MI_BLOCK_INFO block_info; MYISAM_SHARE *share=info->s; DBUG_ENTER("_mi_read_rnd_dynamic_record"); @@ -1672,7 +1673,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf, } if (info->opt_flag & READ_CACHE_USED) { - if (_mi_read_cache(&info->rec_cache,(byte*) block_info.header,filepos, + if (_mi_read_cache(&info->rec_cache,(uchar*) block_info.header,filepos, sizeof(block_info.header), (!block_of_record && skip_deleted_blocks ? READING_NEXT : 0) | READING_HEADER)) @@ -1735,7 +1736,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf, tmp_length= block_info.data_len; if (tmp_length) { - memcpy((byte*) to, block_info.header+offset,tmp_length); + memcpy((uchar*) to, block_info.header+offset,tmp_length); block_info.data_len-=tmp_length; left_len-=tmp_length; to+=tmp_length; @@ -1747,7 +1748,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf, { if (info->opt_flag & READ_CACHE_USED) { - if (_mi_read_cache(&info->rec_cache,(byte*) to,filepos, + if (_mi_read_cache(&info->rec_cache,(uchar*) to,filepos, block_info.data_len, (!block_of_record && skip_deleted_blocks) ? READING_NEXT : 0)) @@ -1761,7 +1762,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf, flush_io_cache(&info->rec_cache)) goto err; /* VOID(my_seek(info->dfile,filepos,MY_SEEK_SET,MYF(0))); */ - if (my_read(info->dfile,(byte*) to,block_info.data_len,MYF(MY_NABP))) + if (my_read(info->dfile,(uchar*) to,block_info.data_len,MYF(MY_NABP))) { if (my_errno == -1) my_errno= HA_ERR_WRONG_IN_RECORD; /* Unexpected end of file */ @@ -1818,7 +1819,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos) sizeof(info->header)) goto err; } - DBUG_DUMP("header",(byte*) header,MI_BLOCK_INFO_HEADER_LENGTH); + DBUG_DUMP("header",(uchar*) header,MI_BLOCK_INFO_HEADER_LENGTH); if (info->second_read) { if (info->header[0] <= 6 || info->header[0] == 13) diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c index 729174b6f88..72c40741a22 100644 --- a/storage/myisam/mi_extra.c +++ b/storage/myisam/mi_extra.c @@ -180,8 +180,8 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) case HA_EXTRA_KEYREAD: /* Read only keys to record */ case HA_EXTRA_REMEMBER_POS: info->opt_flag |= REMEMBER_OLD_POS; - bmove((byte*) info->lastkey+share->base.max_key_length*2, - (byte*) info->lastkey,info->lastkey_length); + bmove((uchar*) info->lastkey+share->base.max_key_length*2, + (uchar*) info->lastkey,info->lastkey_length); info->save_update= info->update; info->save_lastinx= info->lastinx; info->save_lastpos= info->lastpos; @@ -197,8 +197,8 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) case HA_EXTRA_RESTORE_POS: if (info->opt_flag & REMEMBER_OLD_POS) { - bmove((byte*) info->lastkey, - (byte*) info->lastkey+share->base.max_key_length*2, + bmove((uchar*) info->lastkey, + (uchar*) info->lastkey+share->base.max_key_length*2, info->save_lastkey_length); info->update= info->save_update | HA_STATE_WRITTEN; info->lastinx= info->save_lastinx; @@ -385,7 +385,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) { char tmp[1]; tmp[0]=function; - myisam_log_command(MI_LOG_EXTRA,info,(byte*) tmp,1,error); + myisam_log_command(MI_LOG_EXTRA,info,(uchar*) tmp,1,error); } DBUG_RETURN(error); } /* mi_extra */ diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c index 2f4915dec39..230ebac3bb0 100644 --- a/storage/myisam/mi_key.c +++ b/storage/myisam/mi_key.c @@ -31,7 +31,7 @@ set_if_smaller(char_length,length); \ } while(0) -static int _mi_put_key_in_record(MI_INFO *info,uint keynr,byte *record); +static int _mi_put_key_in_record(MI_INFO *info,uint keynr,uchar *record); /* Make a intern key from a record @@ -49,9 +49,9 @@ static int _mi_put_key_in_record(MI_INFO *info,uint keynr,byte *record); */ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, - const byte *record, my_off_t filepos) + const uchar *record, my_off_t filepos) { - byte *pos; + uchar *pos; uchar *start; reg1 HA_KEYSEG *keyseg; my_bool is_ft= info->s->keyinfo[keynr].flag & HA_FULLTEXT; @@ -90,7 +90,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, char_length= ((!is_ft && cs && cs->mbmaxlen > 1) ? length/cs->mbmaxlen : length); - pos= (byte*) record+keyseg->start; + pos= (uchar*) record+keyseg->start; if (type == HA_KEYTYPE_BIT) { if (keyseg->bit_length) @@ -100,7 +100,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, *key++= bits; length--; } - memcpy((byte*) key, pos, length); + memcpy((uchar*) key, pos, length); key+= length; continue; } @@ -112,14 +112,14 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, } else { - byte *end= pos + length; + uchar *end= pos + length; while (pos < end && pos[0] == ' ') pos++; length=(uint) (end-pos); } FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); - memcpy((byte*) key,(byte*) pos,(size_t) char_length); + memcpy((uchar*) key,(uchar*) pos,(size_t) char_length); key+=char_length; continue; } @@ -132,18 +132,18 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, set_if_smaller(length,tmp_length); FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); - memcpy((byte*) key,(byte*) pos,(size_t) char_length); + memcpy((uchar*) key,(uchar*) pos,(size_t) char_length); key+= char_length; continue; } else if (keyseg->flag & HA_BLOB_PART) { uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos); - memcpy_fixed((byte*) &pos,pos+keyseg->bit_start,sizeof(char*)); + memcpy_fixed((uchar*) &pos,pos+keyseg->bit_start,sizeof(char*)); set_if_smaller(length,tmp_length); FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); - memcpy((byte*) key,(byte*) pos,(size_t) char_length); + memcpy((uchar*) key,(uchar*) pos,(size_t) char_length); key+= char_length; continue; } @@ -182,14 +182,14 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, continue; } FIX_LENGTH(cs, pos, length, char_length); - memcpy((byte*) key, pos, char_length); + memcpy((uchar*) key, pos, char_length); if (length > char_length) cs->cset->fill(cs, (char*) key+char_length, length-char_length, ' '); key+= length; } _mi_dpointer(info,key,filepos); DBUG_PRINT("exit",("keynr: %d",keynr)); - DBUG_DUMP("key",(byte*) start,(uint) (key-start)+keyseg->length); + DBUG_DUMP("key",(uchar*) start,(uint) (key-start)+keyseg->length); DBUG_EXECUTE("key", _mi_print_key(DBUG_FILE,info->s->keyinfo[keynr].seg,start, (uint) (key-start));); @@ -267,7 +267,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, length=(uint) (end-pos); FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); - memcpy((byte*) key,pos,(size_t) char_length); + memcpy((uchar*) key,pos,(size_t) char_length); key+= char_length; continue; } @@ -280,7 +280,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); old+=2; /* Skip length */ - memcpy((byte*) key, pos,(size_t) char_length); + memcpy((uchar*) key, pos,(size_t) char_length); key+= char_length; continue; } @@ -292,7 +292,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, continue; } FIX_LENGTH(cs, pos, length, char_length); - memcpy((byte*) key, pos, char_length); + memcpy((uchar*) key, pos, char_length); if (length > char_length) cs->cset->fill(cs, (char*) key+char_length, length-char_length, ' '); key+= length; @@ -325,16 +325,16 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, */ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, - byte *record) + uchar *record) { - reg2 byte *key; - byte *pos,*key_end; + reg2 uchar *key; + uchar *pos,*key_end; reg1 HA_KEYSEG *keyseg; - byte *blob_ptr; + uchar *blob_ptr; DBUG_ENTER("_mi_put_key_in_record"); - blob_ptr= (byte*) info->lastkey2; /* Place to put blob parts */ - key=(byte*) info->lastkey; /* KEy that was read */ + blob_ptr= (uchar*) info->lastkey2; /* Place to put blob parts */ + key=(uchar*) info->lastkey; /* KEy that was read */ key_end=key+info->lastkey_length; for (keyseg=info->s->keyinfo[keynr].seg ; keyseg->type ;keyseg++) { @@ -363,7 +363,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, clr_rec_bits(record + keyseg->bit_pos, keyseg->bit_start, keyseg->bit_length); } - memcpy(record + keyseg->start, (byte*) key, length); + memcpy(record + keyseg->start, (uchar*) key, length); key+= length; continue; } @@ -406,7 +406,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, else int2store(record+keyseg->start, length); /* And key data */ - memcpy(record+keyseg->start + keyseg->bit_start, (byte*) key, length); + memcpy(record+keyseg->start + keyseg->bit_start, (uchar*) key, length); key+= length; } else if (keyseg->flag & HA_BLOB_PART) @@ -431,8 +431,8 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, } else if (keyseg->flag & HA_SWAP_KEY) { - byte *to= record+keyseg->start+keyseg->length; - byte *end= key+keyseg->length; + uchar *to= record+keyseg->start+keyseg->length; + uchar *end= key+keyseg->length; #ifdef CHECK_KEYS if (end > key_end) goto err; @@ -449,7 +449,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, if (key+keyseg->length > key_end) goto err; #endif - memcpy(record+keyseg->start,(byte*) key, + memcpy(record+keyseg->start,(uchar*) key, (size_t) keyseg->length); key+= keyseg->length; } @@ -463,7 +463,7 @@ err: /* Here when key reads are used */ -int _mi_read_key_record(MI_INFO *info, my_off_t filepos, byte *buf) +int _mi_read_key_record(MI_INFO *info, my_off_t filepos, uchar *buf) { fast_mi_writeinfo(info); if (filepos != HA_OFFSET_ERROR) @@ -498,7 +498,7 @@ int _mi_read_key_record(MI_INFO *info, my_off_t filepos, byte *buf) less than zero. */ -ulonglong retrieve_auto_increment(MI_INFO *info,const byte *record) +ulonglong retrieve_auto_increment(MI_INFO *info,const uchar *record) { ulonglong value= 0; /* Store unsigned values here */ longlong s_value= 0; /* Store signed values here */ diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c index e822ea9e6da..6aa62b70ae3 100644 --- a/storage/myisam/mi_locking.c +++ b/storage/myisam/mi_locking.c @@ -254,7 +254,7 @@ int mi_lock_database(MI_INFO *info, int lock_type) pthread_mutex_unlock(&share->intern_lock); #if defined(FULL_LOG) || defined(_lint) lock_type|=(int) (flag << 8); /* Set bit to set if real lock */ - myisam_log_command(MI_LOG_LOCK,info,(byte*) &lock_type,sizeof(lock_type), + myisam_log_command(MI_LOG_LOCK,info,(uchar*) &lock_type,sizeof(lock_type), error); #endif DBUG_RETURN(error); diff --git a/storage/myisam/mi_log.c b/storage/myisam/mi_log.c index f720f752a06..91d3bb6f702 100644 --- a/storage/myisam/mi_log.c +++ b/storage/myisam/mi_log.c @@ -74,7 +74,7 @@ int mi_log(int activate_log) /* All logs starts with command(1) dfile(2) process(4) result(2) */ void _myisam_log(enum myisam_log_commands command, MI_INFO *info, - const byte *buffert, uint length) + const uchar *buffert, uint length) { char buff[11]; int error,old_errno; @@ -98,7 +98,7 @@ void _myisam_log(enum myisam_log_commands command, MI_INFO *info, void _myisam_log_command(enum myisam_log_commands command, MI_INFO *info, - const byte *buffert, uint length, int result) + const uchar *buffert, uint length, int result) { char buff[9]; int error,old_errno; @@ -122,7 +122,7 @@ void _myisam_log_command(enum myisam_log_commands command, MI_INFO *info, void _myisam_log_record(enum myisam_log_commands command, MI_INFO *info, - const byte *record, my_off_t filepos, int result) + const uchar *record, my_off_t filepos, int result) { char buff[21],*pos; int error,old_errno; @@ -143,7 +143,7 @@ void _myisam_log_record(enum myisam_log_commands command, MI_INFO *info, pthread_mutex_lock(&THR_LOCK_myisam); error=my_lock(myisam_log_file,F_WRLCK,0L,F_TO_EOF,MYF(MY_SEEK_NOT_DONE)); VOID(my_write(myisam_log_file,buff,sizeof(buff),MYF(0))); - VOID(my_write(myisam_log_file,(byte*) record,info->s->base.reclength,MYF(0))); + VOID(my_write(myisam_log_file,(uchar*) record,info->s->base.reclength,MYF(0))); if (info->s->base.blobs) { MI_BLOB *blob,*end; diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index f4e089b6313..9ff8ecdb14d 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -92,7 +92,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) lock_error=1; errpos=0; head_length=sizeof(share_buff.state.header); - bzero((byte*) &info,sizeof(info)); + bzero((uchar*) &info,sizeof(info)); my_realpath(name_buff, fn_format(org_name,name,"",MI_NAME_IEXT, MY_UNPACK_FILENAME),MYF(0)); @@ -100,7 +100,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) if (!(old_info=test_if_reopen(name_buff))) { share= &share_buff; - bzero((gptr) &share_buff,sizeof(share_buff)); + bzero((uchar*) &share_buff,sizeof(share_buff)); share_buff.state.rec_per_key_part=rec_per_key_part; share_buff.state.key_root=key_root; share_buff.state.key_del=key_del; @@ -127,8 +127,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) my_errno= HA_ERR_NOT_A_TABLE; goto err; } - if (memcmp((byte*) share->state.header.file_version, - (byte*) myisam_file_magic, 4)) + if (memcmp((uchar*) share->state.header.file_version, + (uchar*) myisam_file_magic, 4)) { DBUG_PRINT("error",("Wrong header in %s",name_buff)); DBUG_DUMP("error_dump",(char*) share->state.header.file_version, @@ -504,7 +504,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) } else if (share->options & HA_OPTION_PACK_RECORD) share->data_file_type = DYNAMIC_RECORD; - my_afree((gptr) disk_cache); + my_afree((uchar*) disk_cache); mi_setup_functions(share); share->is_log_table= FALSE; #ifdef THREAD @@ -642,7 +642,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) if (myisam_log_file >= 0) { intern_filename(name_buff,share->index_file_name); - _myisam_log(MI_LOG_OPEN,m_info,name_buff,(uint) strlen(name_buff)); + _myisam_log(MI_LOG_OPEN, m_info,name_buff, strlen(name_buff)); } DBUG_RETURN(m_info); @@ -654,7 +654,7 @@ err: mi_report_error(save_errno, name); switch (errpos) { case 6: - my_free((gptr) m_info,MYF(0)); + my_free((uchar*) m_info,MYF(0)); /* fall through */ case 5: VOID(my_close(info.dfile,MYF(0))); @@ -662,14 +662,14 @@ err: break; /* Don't remove open table */ /* fall through */ case 4: - my_free((gptr) share,MYF(0)); + my_free((uchar*) share,MYF(0)); /* fall through */ case 3: if (! lock_error) VOID(my_lock(kfile, F_UNLCK, 0L, F_TO_EOF, MYF(MY_SEEK_NOT_DONE))); /* fall through */ case 2: - my_afree((gptr) disk_cache); + my_afree((uchar*) disk_cache); /* fall through */ case 1: VOID(my_close(kfile,MYF(0))); @@ -684,7 +684,7 @@ err: } /* mi_open */ -byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf) +uchar *mi_alloc_rec_buff(MI_INFO *info, ulong length, uchar **buf) { uint extra; uint32 old_length; @@ -692,7 +692,7 @@ byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf) if (! *buf || length > (old_length=mi_get_rec_buff_len(info, *buf))) { - byte *newptr = *buf; + uchar *newptr = *buf; /* to simplify initial init of info->rec_buf in mi_open and mi_extra */ if (length == (ulong) -1) @@ -709,7 +709,7 @@ byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf) MI_REC_BUFF_OFFSET : 0); if (extra && newptr) newptr-= MI_REC_BUFF_OFFSET; - if (!(newptr=(byte*) my_realloc((gptr)newptr, length+extra+8, + if (!(newptr=(uchar*) my_realloc((uchar*)newptr, length+extra+8, MYF(MY_ALLOW_ZERO_PTR)))) return newptr; *((uint32 *) newptr)= (uint32) length; @@ -899,10 +899,10 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite) } if (pWrite & 1) - DBUG_RETURN(my_pwrite(file,(char*) buff, (uint) (ptr-buff), 0L, - MYF(MY_NABP | MY_THREADSAFE))); - DBUG_RETURN(my_write(file, (char*) buff, (uint) (ptr-buff), - MYF(MY_NABP))); + DBUG_RETURN(my_pwrite(file, buff, (size_t) (ptr-buff), 0L, + MYF(MY_NABP | MY_THREADSAFE)) != 0); + DBUG_RETURN(my_write(file, buff, (size_t) (ptr-buff), + MYF(MY_NABP)) != 0); } @@ -968,10 +968,10 @@ uint mi_state_info_read_dsk(File file, MI_STATE_INFO *state, my_bool pRead) if (pRead) { if (my_pread(file, buff, state->state_length,0L, MYF(MY_NABP))) - return (MY_FILE_ERROR); + return 1; } else if (my_read(file, buff, state->state_length,MYF(MY_NABP))) - return (MY_FILE_ERROR); + return 1; mi_state_info_read((uchar*) buff, state); } return 0; @@ -1013,7 +1013,7 @@ uint mi_base_info_write(File file, MI_BASE_INFO *base) mi_int2store(ptr,base->raid_chunks); ptr +=2; mi_int4store(ptr,base->raid_chunksize); ptr +=4; bzero(ptr,6); ptr +=6; /* extra */ - return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP)); + return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; } @@ -1073,7 +1073,7 @@ uint mi_keydef_write(File file, MI_KEYDEF *keydef) mi_int2store(ptr,keydef->keylength); ptr +=2; mi_int2store(ptr,keydef->minlength); ptr +=2; mi_int2store(ptr,keydef->maxlength); ptr +=2; - return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP)); + return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; } char *mi_keydef_read(char *ptr, MI_KEYDEF *keydef) @@ -1117,7 +1117,7 @@ int mi_keyseg_write(File file, const HA_KEYSEG *keyseg) mi_int4store(ptr, pos); ptr+=4; - return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP)); + return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; } @@ -1157,7 +1157,7 @@ uint mi_uniquedef_write(File file, MI_UNIQUEDEF *def) *ptr++= (uchar) def->key; *ptr++ = (uchar) def->null_are_equal; - return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP)); + return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; } char *mi_uniquedef_read(char *ptr, MI_UNIQUEDEF *def) @@ -1181,7 +1181,7 @@ uint mi_recinfo_write(File file, MI_COLUMNDEF *recinfo) mi_int2store(ptr,recinfo->length); ptr +=2; *ptr++ = recinfo->null_bit; mi_int2store(ptr,recinfo->null_pos); ptr+= 2; - return my_write(file,(char*) buff, (uint) (ptr-buff), MYF(MY_NABP)); + return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; } char *mi_recinfo_read(char *ptr, MI_COLUMNDEF *recinfo) @@ -1202,7 +1202,8 @@ The argument file_to_dup is here for the future if there would on some OS exist a dup()-like call that would give us two different file descriptors. *************************************************************************/ -int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup __attribute__((unused))) +int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, + File file_to_dup __attribute__((unused))) { #ifdef USE_RAID if (share->base.raid_type) diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c index a5a9aaededd..1231ef026f7 100644 --- a/storage/myisam/mi_packrec.c +++ b/storage/myisam/mi_packrec.c @@ -48,7 +48,7 @@ #define OFFSET_TABLE_SIZE 512 static uint read_huff_table(MI_BIT_BUFF *bit_buff,MI_DECODE_TREE *decode_tree, - uint16 **decode_table,byte **intervall_buff, + uint16 **decode_table,uchar **intervall_buff, uint16 *tmp_buff); static void make_quick_table(uint16 *to_table,uint16 *decode_table, uint *next_free,uint value,uint bits, @@ -107,7 +107,7 @@ static void fill_buffer(MI_BIT_BUFF *bit_buff); static uint max_bit(uint value); #ifdef HAVE_MMAP static uchar *_mi_mempack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, - MI_BLOCK_INFO *info, byte **rec_buff_p, + MI_BLOCK_INFO *info, uchar **rec_buff_p, uchar *header); #endif @@ -136,7 +136,8 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) uint i,trees,huff_tree_bits,rec_reflength,length; uint16 *decode_table,*tmp_buff; ulong elements,intervall_length; - char *disk_cache,*intervall_buff; + char *disk_cache; + uchar *intervall_buff; uchar header[HEAD_LENGTH]; MYISAM_SHARE *share=info->s; MI_BIT_BUFF bit_buff; @@ -149,14 +150,14 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) file=info->dfile; my_errno=0; - if (my_read(file,(byte*) header,sizeof(header),MYF(MY_NABP))) + if (my_read(file,(uchar*) header,sizeof(header),MYF(MY_NABP))) { if (!my_errno) my_errno=HA_ERR_END_OF_FILE; goto err0; } /* Only the first three bytes of magic number are independent of version. */ - if (memcmp((byte*) header, (byte*) myisam_pack_file_magic, 3)) + if (memcmp((uchar*) header, (uchar*) myisam_pack_file_magic, 3)) { my_errno=HA_ERR_WRONG_IN_RECORD; goto err0; @@ -195,10 +196,10 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) */ if (!(share->decode_trees=(MI_DECODE_TREE*) my_malloc((uint) (trees*sizeof(MI_DECODE_TREE)+ - intervall_length*sizeof(byte)), + intervall_length*sizeof(uchar)), MYF(MY_WME)))) goto err0; - intervall_buff=(byte*) (share->decode_trees+trees); + intervall_buff=(uchar*) (share->decode_trees+trees); /* Memory segment #2: @@ -215,7 +216,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) MYF(MY_WME | MY_ZEROFILL)))) goto err1; tmp_buff=share->decode_tables+length; - disk_cache=(byte*) (tmp_buff+OFFSET_TABLE_SIZE); + disk_cache=(uchar*) (tmp_buff+OFFSET_TABLE_SIZE); if (my_read(file,disk_cache, (uint) (share->pack.header_length-sizeof(header)), @@ -250,8 +251,8 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) goto err3; /* Reallocate the decoding tables to the used size. */ decode_table=(uint16*) - my_realloc((gptr) share->decode_tables, - (uint) ((byte*) decode_table - (byte*) share->decode_tables), + my_realloc((uchar*) share->decode_tables, + (uint) ((uchar*) decode_table - (uchar*) share->decode_tables), MYF(MY_HOLD_ON_ERROR)); /* Fix the table addresses in the tree heads. */ { @@ -291,9 +292,9 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) err3: my_errno=HA_ERR_WRONG_IN_RECORD; err2: - my_free((gptr) share->decode_tables,MYF(0)); + my_free((uchar*) share->decode_tables,MYF(0)); err1: - my_free((gptr) share->decode_trees,MYF(0)); + my_free((uchar*) share->decode_trees,MYF(0)); err0: DBUG_RETURN(1); } @@ -318,7 +319,7 @@ err0: */ static uint read_huff_table(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree, - uint16 **decode_table, byte **intervall_buff, + uint16 **decode_table, uchar **intervall_buff, uint16 *tmp_buff) { uint min_chr,elements,char_bits,offset_bits,size,intervall_length,table_bits, @@ -697,7 +698,7 @@ static uint find_longest_bitstream(uint16 *table, uint16 *end) HA_ERR_WRONG_IN_RECORD or -1 on error */ -int _mi_read_pack_record(MI_INFO *info, my_off_t filepos, byte *buf) +int _mi_read_pack_record(MI_INFO *info, my_off_t filepos, uchar *buf) { MI_BLOCK_INFO block_info; File file; @@ -710,7 +711,7 @@ int _mi_read_pack_record(MI_INFO *info, my_off_t filepos, byte *buf) if (_mi_pack_get_block_info(info, &info->bit_buff, &block_info, &info->rec_buff, file, filepos)) goto err; - if (my_read(file,(byte*) info->rec_buff + block_info.offset , + if (my_read(file,(uchar*) info->rec_buff + block_info.offset , block_info.rec_len - block_info.offset, MYF(MY_NABP))) goto panic; info->update|= HA_STATE_AKTIV; @@ -725,9 +726,9 @@ err: int _mi_pack_rec_unpack(register MI_INFO *info, MI_BIT_BUFF *bit_buff, - register byte *to, byte *from, ulong reclength) + register uchar *to, uchar *from, ulong reclength) { - byte *end_field; + uchar *end_field; reg3 MI_COLUMNDEF *end; MI_COLUMNDEF *current_field; MYISAM_SHARE *share=info->s; @@ -834,7 +835,7 @@ static void uf_space_normal(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end) { if (get_bit(bit_buff)) - bfill((byte*) to,(end-to),' '); + bfill((uchar*) to,(end-to),' '); else decode_bytes(rec,bit_buff,to,end); } @@ -844,7 +845,7 @@ static void uf_space_endspace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, { uint spaces; if (get_bit(bit_buff)) - bfill((byte*) to,(end-to),' '); + bfill((uchar*) to,(end-to),' '); else { if (get_bit(bit_buff)) @@ -856,7 +857,7 @@ static void uf_space_endspace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, } if (to+spaces != end) decode_bytes(rec,bit_buff,to,end-spaces); - bfill((byte*) end-spaces,spaces,' '); + bfill((uchar*) end-spaces,spaces,' '); } else decode_bytes(rec,bit_buff,to,end); @@ -876,7 +877,7 @@ static void uf_endspace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, } if (to+spaces != end) decode_bytes(rec,bit_buff,to,end-spaces); - bfill((byte*) end-spaces,spaces,' '); + bfill((uchar*) end-spaces,spaces,' '); } else decode_bytes(rec,bit_buff,to,end); @@ -887,7 +888,7 @@ static void uf_space_endspace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t { uint spaces; if (get_bit(bit_buff)) - bfill((byte*) to,(end-to),' '); + bfill((uchar*) to,(end-to),' '); else { if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end) @@ -897,7 +898,7 @@ static void uf_space_endspace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t } if (to+spaces != end) decode_bytes(rec,bit_buff,to,end-spaces); - bfill((byte*) end-spaces,spaces,' '); + bfill((uchar*) end-spaces,spaces,' '); } } @@ -912,7 +913,7 @@ static void uf_endspace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, } if (to+spaces != end) decode_bytes(rec,bit_buff,to,end-spaces); - bfill((byte*) end-spaces,spaces,' '); + bfill((uchar*) end-spaces,spaces,' '); } static void uf_space_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, @@ -920,7 +921,7 @@ static void uf_space_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, { uint spaces; if (get_bit(bit_buff)) - bfill((byte*) to,(end-to),' '); + bfill((uchar*) to,(end-to),' '); else { if (get_bit(bit_buff)) @@ -930,7 +931,7 @@ static void uf_space_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, bit_buff->error=1; return; } - bfill((byte*) to,spaces,' '); + bfill((uchar*) to,spaces,' '); if (to+spaces != end) decode_bytes(rec,bit_buff,to+spaces,end); } @@ -951,7 +952,7 @@ static void uf_prespace_selected(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, bit_buff->error=1; return; } - bfill((byte*) to,spaces,' '); + bfill((uchar*) to,spaces,' '); if (to+spaces != end) decode_bytes(rec,bit_buff,to+spaces,end); } @@ -965,7 +966,7 @@ static void uf_space_prespace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t { uint spaces; if (get_bit(bit_buff)) - bfill((byte*) to,(end-to),' '); + bfill((uchar*) to,(end-to),' '); else { if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end) @@ -973,7 +974,7 @@ static void uf_space_prespace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *t bit_buff->error=1; return; } - bfill((byte*) to,spaces,' '); + bfill((uchar*) to,spaces,' '); if (to+spaces != end) decode_bytes(rec,bit_buff,to+spaces,end); } @@ -988,7 +989,7 @@ static void uf_prespace(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, bit_buff->error=1; return; } - bfill((byte*) to,spaces,' '); + bfill((uchar*) to,spaces,' '); if (to+spaces != end) decode_bytes(rec,bit_buff,to+spaces,end); } @@ -1031,7 +1032,7 @@ static void uf_blob(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end) { if (get_bit(bit_buff)) - bzero((byte*) to,(end-to)); + bzero((uchar*) to,(end-to)); else { ulong length=get_bits(bit_buff,rec->space_length_bits); @@ -1039,11 +1040,11 @@ static void uf_blob(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, if (bit_buff->blob_pos+length > bit_buff->blob_end) { bit_buff->error=1; - bzero((byte*) to,(end-to)); + bzero((uchar*) to,(end-to)); return; } decode_bytes(rec,bit_buff,bit_buff->blob_pos,bit_buff->blob_pos+length); - _my_store_blob_length((byte*) to,pack_length,length); + _my_store_blob_length((uchar*) to,pack_length,length); memcpy_fixed((char*) to+pack_length,(char*) &bit_buff->blob_pos, sizeof(char*)); bit_buff->blob_pos+=length; @@ -1286,7 +1287,7 @@ static uint decode_pos(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree) } -int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf, +int _mi_read_rnd_pack_record(MI_INFO *info, uchar *buf, register my_off_t filepos, my_bool skip_deleted_blocks) { @@ -1303,7 +1304,7 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf, if (info->opt_flag & READ_CACHE_USED) { - if (_mi_read_cache(&info->rec_cache, (byte*) block_info.header, + if (_mi_read_cache(&info->rec_cache, (uchar*) block_info.header, filepos, share->pack.ref_length, skip_deleted_blocks ? READING_NEXT : 0)) goto err; @@ -1325,14 +1326,14 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf, if (info->opt_flag & READ_CACHE_USED) { - if (_mi_read_cache(&info->rec_cache, (byte*) info->rec_buff, + if (_mi_read_cache(&info->rec_cache, (uchar*) info->rec_buff, block_info.filepos, block_info.rec_len, skip_deleted_blocks ? READING_NEXT : 0)) goto err; } else { - if (my_read(info->dfile,(byte*) info->rec_buff + block_info.offset, + if (my_read(info->dfile,(uchar*) info->rec_buff + block_info.offset, block_info.rec_len-block_info.offset, MYF(MY_NABP))) goto err; @@ -1352,7 +1353,7 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf, /* Read and process header from a huff-record-file */ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, - MI_BLOCK_INFO *info, byte **rec_buff_p, + MI_BLOCK_INFO *info, uchar **rec_buff_p, File file, my_off_t filepos) { uchar *header=info->header; @@ -1369,7 +1370,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0))); if (my_read(file,(char*) header,ref_length,MYF(MY_NABP))) return BLOCK_FATAL_ERROR; - DBUG_DUMP("header",(byte*) header,ref_length); + DBUG_DUMP("header",(uchar*) header,ref_length); } head_length= read_pack_length((uint) myisam->s->pack.version, header, &info->rec_len); @@ -1478,8 +1479,8 @@ static uint max_bit(register uint value) #ifdef HAVE_MMAP -static int _mi_read_mempack_record(MI_INFO *info,my_off_t filepos,byte *buf); -static int _mi_read_rnd_mempack_record(MI_INFO*, byte *,my_off_t, my_bool); +static int _mi_read_mempack_record(MI_INFO *info,my_off_t filepos,uchar *buf); +static int _mi_read_rnd_mempack_record(MI_INFO*, uchar *,my_off_t, my_bool); my_bool _mi_memmap_file(MI_INFO *info) { @@ -1512,7 +1513,7 @@ void _mi_unmap_file(MI_INFO *info) static uchar *_mi_mempack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, - MI_BLOCK_INFO *info, byte **rec_buff_p, + MI_BLOCK_INFO *info, uchar **rec_buff_p, uchar *header) { header+= read_pack_length((uint) myisam->s->pack.version, header, @@ -1532,17 +1533,17 @@ static uchar *_mi_mempack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, } -static int _mi_read_mempack_record(MI_INFO *info, my_off_t filepos, byte *buf) +static int _mi_read_mempack_record(MI_INFO *info, my_off_t filepos, uchar *buf) { MI_BLOCK_INFO block_info; MYISAM_SHARE *share=info->s; - byte *pos; + uchar *pos; DBUG_ENTER("mi_read_mempack_record"); if (filepos == HA_OFFSET_ERROR) DBUG_RETURN(-1); /* _search() didn't find record */ - if (!(pos= (byte*) _mi_mempack_get_block_info(info, &info->bit_buff, + if (!(pos= (uchar*) _mi_mempack_get_block_info(info, &info->bit_buff, &block_info, &info->rec_buff, (uchar*) share->file_map+ filepos))) @@ -1553,14 +1554,14 @@ static int _mi_read_mempack_record(MI_INFO *info, my_off_t filepos, byte *buf) /*ARGSUSED*/ -static int _mi_read_rnd_mempack_record(MI_INFO *info, byte *buf, +static int _mi_read_rnd_mempack_record(MI_INFO *info, uchar *buf, register my_off_t filepos, my_bool skip_deleted_blocks __attribute__((unused))) { MI_BLOCK_INFO block_info; MYISAM_SHARE *share=info->s; - byte *pos,*start; + uchar *pos,*start; DBUG_ENTER("_mi_read_rnd_mempack_record"); if (filepos >= share->state.state.data_file_length) @@ -1568,7 +1569,7 @@ static int _mi_read_rnd_mempack_record(MI_INFO *info, byte *buf, my_errno=HA_ERR_END_OF_FILE; goto err; } - if (!(pos= (byte*) _mi_mempack_get_block_info(info, &info->bit_buff, + if (!(pos= (uchar*) _mi_mempack_get_block_info(info, &info->bit_buff, &block_info, &info->rec_buff, (uchar*) (start=share->file_map+ @@ -1596,7 +1597,7 @@ static int _mi_read_rnd_mempack_record(MI_INFO *info, byte *buf, /* Save length of row */ -uint save_pack_length(uint version, byte *block_buff, ulong length) +uint save_pack_length(uint version, uchar *block_buff, ulong length) { if (length < 254) { diff --git a/storage/myisam/mi_page.c b/storage/myisam/mi_page.c index da9e19275c9..ede379feea6 100644 --- a/storage/myisam/mi_page.c +++ b/storage/myisam/mi_page.c @@ -29,7 +29,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo, DBUG_PRINT("enter",("page: %ld", (long) page)); tmp=(uchar*) key_cache_read(info->s->key_cache, - info->s->kfile, page, level, (byte*) buff, + info->s->kfile, page, level, (uchar*) buff, (uint) keyinfo->block_length, (uint) keyinfo->block_length, return_buffer); @@ -80,7 +80,7 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo, DBUG_RETURN((-1)); } DBUG_PRINT("page",("write page at: %lu",(long) page)); - DBUG_DUMP("buff",(byte*) buff,mi_getint(buff)); + DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff)); #endif if ((length=keyinfo->block_length) > IO_SIZE*2 && @@ -89,12 +89,12 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo, #ifdef HAVE_purify { length=mi_getint(buff); - bzero((byte*) buff+length,keyinfo->block_length-length); + bzero((uchar*) buff+length,keyinfo->block_length-length); length=keyinfo->block_length; } #endif DBUG_RETURN((key_cache_write(info->s->key_cache, - info->s->kfile,page, level, (byte*) buff,length, + info->s->kfile,page, level, (uchar*) buff,length, (uint) keyinfo->block_length, (int) ((info->lock_type != F_UNLCK) || info->s->delay_key_write)))); diff --git a/storage/myisam/mi_preload.c b/storage/myisam/mi_preload.c index 78729f18424..1bb5072713d 100644 --- a/storage/myisam/mi_preload.c +++ b/storage/myisam/mi_preload.c @@ -76,7 +76,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) /* Read the next block of index file into the preload buffer */ if ((my_off_t) length > (key_file_length-pos)) length= (ulong) (key_file_length-pos); - if (my_pread(share->kfile, (byte*) buff, length, pos, MYF(MY_FAE|MY_FNABP))) + if (my_pread(share->kfile, (uchar*) buff, length, pos, MYF(MY_FAE|MY_FNABP))) goto err; if (ignore_leaves) @@ -88,7 +88,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) { if (key_cache_insert(share->key_cache, share->kfile, pos, DFLT_INIT_HITS, - (byte*) buff, block_length)) + (uchar*) buff, block_length)) goto err; } pos+= block_length; @@ -100,7 +100,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) { if (key_cache_insert(share->key_cache, share->kfile, pos, DFLT_INIT_HITS, - (byte*) buff, length)) + (uchar*) buff, length)) goto err; pos+= length; } diff --git a/storage/myisam/mi_range.c b/storage/myisam/mi_range.c index c7ab6731a2c..932a4abd1b3 100644 --- a/storage/myisam/mi_range.c +++ b/storage/myisam/mi_range.c @@ -21,7 +21,7 @@ #include "myisamdef.h" #include "rt_index.h" -static ha_rows _mi_record_pos(MI_INFO *, const byte *, key_part_map, +static ha_rows _mi_record_pos(MI_INFO *, const uchar *, key_part_map, enum ha_rkey_function); static double _mi_search_pos(MI_INFO *,MI_KEYDEF *,uchar *, uint,uint,my_off_t); static uint _mi_keynr(MI_INFO *info,MI_KEYDEF *,uchar *, uchar *,uint *); @@ -116,7 +116,7 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx, /* Find relative position (in records) for key in index-tree */ -static ha_rows _mi_record_pos(MI_INFO *info, const byte *key, +static ha_rows _mi_record_pos(MI_INFO *info, const uchar *key, key_part_map keypart_map, enum ha_rkey_function search_flag) { diff --git a/storage/myisam/mi_rfirst.c b/storage/myisam/mi_rfirst.c index d23bda46b1a..5a8b27b3e85 100644 --- a/storage/myisam/mi_rfirst.c +++ b/storage/myisam/mi_rfirst.c @@ -17,7 +17,7 @@ /* Read first row through a specfic key */ -int mi_rfirst(MI_INFO *info, byte *buf, int inx) +int mi_rfirst(MI_INFO *info, uchar *buf, int inx) { DBUG_ENTER("mi_rfirst"); info->lastpos= HA_OFFSET_ERROR; diff --git a/storage/myisam/mi_rkey.c b/storage/myisam/mi_rkey.c index a69e276a6d8..3dcaa27d3ca 100644 --- a/storage/myisam/mi_rkey.c +++ b/storage/myisam/mi_rkey.c @@ -21,7 +21,7 @@ /* Read a record using key */ /* Ordinary search_flag is 0 ; Give error if no record with key */ -int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, +int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key, key_part_map keypart_map, enum ha_rkey_function search_flag) { uchar *key_buff; diff --git a/storage/myisam/mi_rlast.c b/storage/myisam/mi_rlast.c index 7805755ab70..07be619617f 100644 --- a/storage/myisam/mi_rlast.c +++ b/storage/myisam/mi_rlast.c @@ -17,7 +17,7 @@ /* Read last row with the same key as the previous read. */ -int mi_rlast(MI_INFO *info, byte *buf, int inx) +int mi_rlast(MI_INFO *info, uchar *buf, int inx) { DBUG_ENTER("mi_rlast"); info->lastpos= HA_OFFSET_ERROR; diff --git a/storage/myisam/mi_rnext.c b/storage/myisam/mi_rnext.c index f6a0a47413e..7ce66d41e0f 100644 --- a/storage/myisam/mi_rnext.c +++ b/storage/myisam/mi_rnext.c @@ -24,7 +24,7 @@ based on the position of the last used key! */ -int mi_rnext(MI_INFO *info, byte *buf, int inx) +int mi_rnext(MI_INFO *info, uchar *buf, int inx) { int error,changed; uint flag; diff --git a/storage/myisam/mi_rnext_same.c b/storage/myisam/mi_rnext_same.c index 3a7004bf47c..1892fe3e1e0 100644 --- a/storage/myisam/mi_rnext_same.c +++ b/storage/myisam/mi_rnext_same.c @@ -24,7 +24,7 @@ based on the position of the last used key! */ -int mi_rnext_same(MI_INFO *info, byte *buf) +int mi_rnext_same(MI_INFO *info, uchar *buf) { int error; uint inx,not_used[2]; diff --git a/storage/myisam/mi_rprev.c b/storage/myisam/mi_rprev.c index 09802627185..d1407012590 100644 --- a/storage/myisam/mi_rprev.c +++ b/storage/myisam/mi_rprev.c @@ -22,7 +22,7 @@ based on the position of the last used key! */ -int mi_rprev(MI_INFO *info, byte *buf, int inx) +int mi_rprev(MI_INFO *info, uchar *buf, int inx) { int error,changed; register uint flag; diff --git a/storage/myisam/mi_rrnd.c b/storage/myisam/mi_rrnd.c index d31e6c24a37..211e5fa51cc 100644 --- a/storage/myisam/mi_rrnd.c +++ b/storage/myisam/mi_rrnd.c @@ -29,7 +29,7 @@ HA_ERR_END_OF_FILE = EOF. */ -int mi_rrnd(MI_INFO *info, byte *buf, register my_off_t filepos) +int mi_rrnd(MI_INFO *info, uchar *buf, register my_off_t filepos) { my_bool skip_deleted_blocks; DBUG_ENTER("mi_rrnd"); diff --git a/storage/myisam/mi_rsame.c b/storage/myisam/mi_rsame.c index 4831ebb3d7c..8093498483f 100644 --- a/storage/myisam/mi_rsame.c +++ b/storage/myisam/mi_rsame.c @@ -25,7 +25,7 @@ */ -int mi_rsame(MI_INFO *info, byte *record, int inx) +int mi_rsame(MI_INFO *info, uchar *record, int inx) { DBUG_ENTER("mi_rsame"); diff --git a/storage/myisam/mi_rsamepos.c b/storage/myisam/mi_rsamepos.c index 717b9ab52d5..6a1e462b686 100644 --- a/storage/myisam/mi_rsamepos.c +++ b/storage/myisam/mi_rsamepos.c @@ -27,7 +27,7 @@ ** HA_ERR_END_OF_FILE = End of file */ -int mi_rsame_with_pos(MI_INFO *info, byte *record, int inx, my_off_t filepos) +int mi_rsame_with_pos(MI_INFO *info, uchar *record, int inx, my_off_t filepos) { DBUG_ENTER("mi_rsame_with_pos"); DBUG_PRINT("enter",("index: %d filepos: %ld", inx, (long) filepos)); diff --git a/storage/myisam/mi_scan.c b/storage/myisam/mi_scan.c index 87debb67b37..a225b399660 100644 --- a/storage/myisam/mi_scan.c +++ b/storage/myisam/mi_scan.c @@ -36,7 +36,7 @@ int mi_scan_init(register MI_INFO *info) HA_ERR_END_OF_FILE = EOF. */ -int mi_scan(MI_INFO *info, byte *buf) +int mi_scan(MI_INFO *info, uchar *buf) { DBUG_ENTER("mi_scan"); /* Init all but update-flag */ diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c index d313619e007..acc8c073297 100644 --- a/storage/myisam/mi_search.c +++ b/storage/myisam/mi_search.c @@ -78,7 +78,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff, test(!(nextflag & SEARCH_SAVE_BUFF))))) goto err; - DBUG_DUMP("page",(byte*) buff,mi_getint(buff)); + DBUG_DUMP("page",(uchar*) buff,mi_getint(buff)); flag=(*keyinfo->bin_search)(info,keyinfo,buff,key,key_len,nextflag, &keypos,lastkey, &last_key); @@ -753,7 +753,7 @@ void _mi_dpointer(MI_INFO *info, uchar *buff, my_off_t pos) uint _mi_get_static_key(register MI_KEYDEF *keyinfo, uint nod_flag, register uchar **page, register uchar *key) { - memcpy((byte*) key,(byte*) *page, + memcpy((uchar*) key,(uchar*) *page, (size_t) (keyinfo->keylength+nod_flag)); *page+=keyinfo->keylength+nod_flag; return(keyinfo->keylength); @@ -897,12 +897,12 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, else length=keyseg->length; } - memcpy((byte*) key,(byte*) page,(size_t) length); + memcpy((uchar*) key,(uchar*) page,(size_t) length); key+=length; page+=length; } length=keyseg->length+nod_flag; - bmove((byte*) key,(byte*) page,length); + bmove((uchar*) key,(uchar*) page,length); *page_pos= page+length; return ((uint) (key-start_key)+keyseg->length); } /* _mi_get_pack_key */ @@ -1003,7 +1003,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, } DBUG_PRINT("info",("key: 0x%lx from: 0x%lx length: %u", (long) key, (long) from, length)); - memmove((byte*) key, (byte*) from, (size_t) length); + memmove((uchar*) key, (uchar*) from, (size_t) length); key+=length; from+=length; } @@ -1035,7 +1035,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, DBUG_RETURN(0); /* Error */ } /* Copy data pointer and, if appropriate, key block pointer. */ - memcpy((byte*) key,(byte*) from,(size_t) length); + memcpy((uchar*) key,(uchar*) from,(size_t) length); *page_pos= from+length; } DBUG_RETURN((uint) (key-start_key)+keyseg->length); @@ -1054,7 +1054,7 @@ uchar *_mi_get_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, nod_flag=mi_test_if_nod(page); if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY))) { - bmove((byte*) key,(byte*) keypos,keyinfo->keylength+nod_flag); + bmove((uchar*) key,(uchar*) keypos,keyinfo->keylength+nod_flag); DBUG_RETURN(keypos+keyinfo->keylength+nod_flag); } else @@ -1092,7 +1092,7 @@ static my_bool _mi_get_prev_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY))) { *return_key_length=keyinfo->keylength; - bmove((byte*) key,(byte*) keypos- *return_key_length-nod_flag, + bmove((uchar*) key,(uchar*) keypos- *return_key_length-nod_flag, *return_key_length); DBUG_RETURN(0); } @@ -1134,7 +1134,7 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, lastpos=endpos-keyinfo->keylength-nod_flag; *return_key_length=keyinfo->keylength; if (lastpos > page) - bmove((byte*) lastkey,(byte*) lastpos,keyinfo->keylength+nod_flag); + bmove((uchar*) lastkey,(uchar*) lastpos,keyinfo->keylength+nod_flag); } else { @@ -1225,7 +1225,7 @@ uint _mi_keylength_part(MI_KEYDEF *keyinfo, register uchar *key, uchar *_mi_move_key(MI_KEYDEF *keyinfo, uchar *to, uchar *from) { reg1 uint length; - memcpy((byte*) to, (byte*) from, + memcpy((uchar*) to, (uchar*) from, (size_t) (length=_mi_keylength(keyinfo,from))); return to+length; } @@ -1827,7 +1827,7 @@ void _mi_store_static_key(MI_KEYDEF *keyinfo __attribute__((unused)), register uchar *key_pos, register MI_KEY_PARAM *s_temp) { - memcpy((byte*) key_pos,(byte*) s_temp->key,(size_t) s_temp->totlength); + memcpy((uchar*) key_pos,(uchar*) s_temp->key,(size_t) s_temp->totlength); } @@ -1860,7 +1860,7 @@ void _mi_store_var_pack_key(MI_KEYDEF *keyinfo __attribute__((unused)), /* Not packed against previous key */ store_pack_length(s_temp->pack_marker == 128,key_pos,s_temp->key_length); } - bmove((byte*) key_pos,(byte*) s_temp->key, + bmove((uchar*) key_pos,(uchar*) s_temp->key, (length=s_temp->totlength-(uint) (key_pos-start))); if (!s_temp->next_key_pos) /* No following key */ diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c index 21a25f66b7c..c92d577b621 100644 --- a/storage/myisam/mi_static.c +++ b/storage/myisam/mi_static.c @@ -27,7 +27,7 @@ uchar NEAR myisam_file_magic[]= { (uchar) 254, (uchar) 254,'\007', '\001', }; uchar NEAR myisam_pack_file_magic[]= { (uchar) 254, (uchar) 254,'\010', '\002', }; -my_string myisam_log_filename=(char*) "myisam.log"; +char * myisam_log_filename=(char*) "myisam.log"; File myisam_log_file= -1; uint myisam_quick_table_bits=9; ulong myisam_block_size= MI_KEY_BLOCK_LENGTH; /* Best by test */ diff --git a/storage/myisam/mi_statrec.c b/storage/myisam/mi_statrec.c index 3f92ec31d4c..93e91fb9e32 100644 --- a/storage/myisam/mi_statrec.c +++ b/storage/myisam/mi_statrec.c @@ -18,7 +18,7 @@ #include "myisamdef.h" -int _mi_write_static_record(MI_INFO *info, const byte *record) +int _mi_write_static_record(MI_INFO *info, const uchar *record) { uchar temp[8]; /* max pointer length */ if (info->s->state.dellink != HA_OFFSET_ERROR && @@ -48,14 +48,14 @@ int _mi_write_static_record(MI_INFO *info, const byte *record) } if (info->opt_flag & WRITE_CACHE_USED) { /* Cash in use */ - if (my_b_write(&info->rec_cache, (byte*) record, + if (my_b_write(&info->rec_cache, (uchar*) record, info->s->base.reclength)) goto err; if (info->s->base.pack_reclength != info->s->base.reclength) { uint length=info->s->base.pack_reclength - info->s->base.reclength; bzero((char*) temp,length); - if (my_b_write(&info->rec_cache, (byte*) temp,length)) + if (my_b_write(&info->rec_cache, (uchar*) temp,length)) goto err; } } @@ -70,7 +70,7 @@ int _mi_write_static_record(MI_INFO *info, const byte *record) { uint length=info->s->base.pack_reclength - info->s->base.reclength; bzero((char*) temp,length); - if (info->s->file_write(info, (byte*) temp,length, + if (info->s->file_write(info, (uchar*) temp,length, info->state->data_file_length+ info->s->base.reclength, info->s->write_flag)) @@ -85,7 +85,7 @@ int _mi_write_static_record(MI_INFO *info, const byte *record) return 1; } -int _mi_update_static_record(MI_INFO *info, my_off_t pos, const byte *record) +int _mi_update_static_record(MI_INFO *info, my_off_t pos, const uchar *record) { info->rec_cache.seek_not_done=1; /* We have done a seek */ return (info->s->file_write(info, @@ -105,12 +105,12 @@ int _mi_delete_static_record(MI_INFO *info) _mi_dpointer(info,temp+1,info->s->state.dellink); info->s->state.dellink = info->lastpos; info->rec_cache.seek_not_done=1; - return (info->s->file_write(info,(byte*) temp, 1+info->s->rec_reflength, + return (info->s->file_write(info,(uchar*) temp, 1+info->s->rec_reflength, info->lastpos, MYF(MY_NABP)) != 0); } -int _mi_cmp_static_record(register MI_INFO *info, register const byte *old) +int _mi_cmp_static_record(register MI_INFO *info, register const uchar *old) { DBUG_ENTER("_mi_cmp_static_record"); @@ -133,7 +133,7 @@ int _mi_cmp_static_record(register MI_INFO *info, register const byte *old) info->lastpos, MYF(MY_NABP))) DBUG_RETURN(-1); - if (memcmp((byte*) info->rec_buff, (byte*) old, + if (memcmp((uchar*) info->rec_buff, (uchar*) old, (uint) info->s->base.reclength)) { DBUG_DUMP("read",old,info->s->base.reclength); @@ -147,7 +147,7 @@ int _mi_cmp_static_record(register MI_INFO *info, register const byte *old) int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def, - const byte *record, my_off_t pos) + const uchar *record, my_off_t pos) { DBUG_ENTER("_mi_cmp_static_unique"); @@ -166,7 +166,7 @@ int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def, /* MY_FILE_ERROR on read-error or locking-error */ int _mi_read_static_record(register MI_INFO *info, register my_off_t pos, - register byte *record) + register uchar *record) { int error; @@ -199,7 +199,7 @@ int _mi_read_static_record(register MI_INFO *info, register my_off_t pos, -int _mi_read_rnd_static_record(MI_INFO *info, byte *buf, +int _mi_read_rnd_static_record(MI_INFO *info, uchar *buf, register my_off_t filepos, my_bool skip_deleted_blocks) { @@ -274,11 +274,11 @@ int _mi_read_rnd_static_record(MI_INFO *info, byte *buf, } /* Read record with cacheing */ - error=my_b_read(&info->rec_cache,(byte*) buf,share->base.reclength); + error=my_b_read(&info->rec_cache,(uchar*) buf,share->base.reclength); if (info->s->base.pack_reclength != info->s->base.reclength && !error) { char tmp[8]; /* Skill fill bytes */ - error=my_b_read(&info->rec_cache,(byte*) tmp, + error=my_b_read(&info->rec_cache,(uchar*) tmp, info->s->base.pack_reclength - info->s->base.reclength); } if (locked) diff --git a/storage/myisam/mi_test1.c b/storage/myisam/mi_test1.c index ebb9cdcb2f7..1165ea4bb32 100644 --- a/storage/myisam/mi_test1.c +++ b/storage/myisam/mi_test1.c @@ -109,7 +109,7 @@ static int run_test(const char *filename) } keyinfo[0].flag = (uint8) (pack_keys | unique_key); - bzero((byte*) flags,sizeof(flags)); + bzero((uchar*) flags,sizeof(flags)); if (opt_unique) { uint start; @@ -534,21 +534,21 @@ static struct my_option my_long_options[] = {"debug", '#', "Undocumented", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"delete_rows", 'd', "Undocumented", (gptr*) &remove_count, - (gptr*) &remove_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, + {"delete_rows", 'd', "Undocumented", (uchar**) &remove_count, + (uchar**) &remove_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, {"help", '?', "Display help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"insert_rows", 'i', "Undocumented", (gptr*) &insert_count, - (gptr*) &insert_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, + {"insert_rows", 'i', "Undocumented", (uchar**) &insert_count, + (uchar**) &insert_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, {"key_alpha", 'a', "Use a key of type HA_KEYTYPE_TEXT", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"key_binary_pack", 'B', "Undocumented", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"key_blob", 'b', "Undocumented", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"key_cache", 'K', "Undocumented", (gptr*) &key_cacheing, - (gptr*) &key_cacheing, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"key_length", 'k', "Undocumented", (gptr*) &key_length, (gptr*) &key_length, + {"key_cache", 'K', "Undocumented", (uchar**) &key_cacheing, + (uchar**) &key_cacheing, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"key_length", 'k', "Undocumented", (uchar**) &key_length, (uchar**) &key_length, 0, GET_UINT, REQUIRED_ARG, 6, 0, 0, 0, 0, 0}, {"key_multiple", 'm', "Undocumented", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -559,21 +559,21 @@ static struct my_option my_long_options[] = {"key_varchar", 'w', "Test VARCHAR keys", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"null_fields", 'N', "Define fields with NULL", - (gptr*) &null_fields, (gptr*) &null_fields, 0, GET_BOOL, NO_ARG, + (uchar**) &null_fields, (uchar**) &null_fields, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"row_fixed_size", 'S', "Undocumented", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"row_pointer_size", 'R', "Undocumented", (gptr*) &rec_pointer_size, - (gptr*) &rec_pointer_size, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"row_pointer_size", 'R', "Undocumented", (uchar**) &rec_pointer_size, + (uchar**) &rec_pointer_size, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"silent", 's', "Undocumented", - (gptr*) &silent, (gptr*) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"skip_update", 'U', "Undocumented", (gptr*) &skip_update, - (gptr*) &skip_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"unique", 'C', "Undocumented", (gptr*) &opt_unique, (gptr*) &opt_unique, 0, + (uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"skip_update", 'U', "Undocumented", (uchar**) &skip_update, + (uchar**) &skip_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"unique", 'C', "Undocumented", (uchar**) &opt_unique, (uchar**) &opt_unique, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"update_rows", 'u', "Undocumented", (gptr*) &update_count, - (gptr*) &update_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, - {"verbose", 'v', "Be more verbose", (gptr*) &verbose, (gptr*) &verbose, 0, + {"update_rows", 'u', "Undocumented", (uchar**) &update_count, + (uchar**) &update_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, + {"verbose", 'v', "Be more verbose", (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Print version number and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c index 878bba31ea8..96ee82e023c 100644 --- a/storage/myisam/mi_test2.c +++ b/storage/myisam/mi_test2.c @@ -36,7 +36,7 @@ static void get_options(int argc, char *argv[]); static uint rnd(uint max_value); -static void fix_length(byte *record,uint length); +static void fix_length(uchar *record,uint length); static void put_blob_in_record(char *blob_pos,char **blob_buffer); static void copy_key(struct st_myisam_info *info,uint inx, uchar *record,uchar *key); @@ -455,8 +455,8 @@ int main(int argc, char *argv[]) bcmp(read_record2,read_record3,reclength)) { printf("Can't find last record\n"); - DBUG_DUMP("record2",(byte*) read_record2,reclength); - DBUG_DUMP("record3",(byte*) read_record3,reclength); + DBUG_DUMP("record2",(uchar*) read_record2,reclength); + DBUG_DUMP("record3",(uchar*) read_record3,reclength); goto end; } ant=1; @@ -1001,7 +1001,7 @@ static uint rnd(uint max_value) /* Create a variable length record */ -static void fix_length(byte *rec, uint length) +static void fix_length(uchar *rec, uint length) { bmove(rec+STANDARD_LENGTH, "0123456789012345678901234567890123456789012345678901234567890", diff --git a/storage/myisam/mi_test3.c b/storage/myisam/mi_test3.c index 3987c20ab69..982b999c3a5 100644 --- a/storage/myisam/mi_test3.c +++ b/storage/myisam/mi_test3.c @@ -243,7 +243,7 @@ int test_read(MI_INFO *file,int id) for (i=0 ; i < 100 ; i++) { find=rnd(100000); - if (!mi_rkey(file,record.id,1,(byte*) &find, + if (!mi_rkey(file,record.id,1,(uchar*) &find, sizeof(find),HA_READ_KEY_EXACT)) found++; else @@ -426,7 +426,7 @@ int test_update(MI_INFO *file,int id,int lock_type) { tmp=rnd(100000); int4store(find,tmp); - if (!mi_rkey(file,record.id,1,(byte*) find, + if (!mi_rkey(file,record.id,1,(uchar*) find, sizeof(find),HA_READ_KEY_EXACT)) found++; else diff --git a/storage/myisam/mi_unique.c b/storage/myisam/mi_unique.c index 635f6c18247..e490fb683e4 100644 --- a/storage/myisam/mi_unique.c +++ b/storage/myisam/mi_unique.c @@ -18,7 +18,7 @@ #include "myisamdef.h" #include <m_ctype.h> -my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record, +my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record, ha_checksum unique_hash, my_off_t disk_pos) { my_off_t lastpos=info->lastpos; @@ -73,9 +73,9 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record, Add support for bit fields */ -ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record) +ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *record) { - const byte *pos, *end; + const uchar *pos, *end; ha_checksum crc= 0; ulong seed1=0, seed2= 4; HA_KEYSEG *keyseg; @@ -111,7 +111,7 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record) else if (keyseg->flag & HA_BLOB_PART) { uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos); - memcpy_fixed((byte*) &pos,pos+keyseg->bit_start,sizeof(char*)); + memcpy_fixed((uchar*) &pos,pos+keyseg->bit_start,sizeof(char*)); if (!length || length > tmp_length) length=tmp_length; /* The whole blob */ } @@ -145,10 +145,10 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record) # Rows are different */ -int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b, +int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b, my_bool null_are_equal) { - const byte *pos_a, *pos_b, *end; + const uchar *pos_a, *pos_b, *end; HA_KEYSEG *keyseg; for (keyseg=def->seg ; keyseg < def->end ; keyseg++) @@ -206,8 +206,8 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b, set_if_smaller(a_length, keyseg->length); set_if_smaller(b_length, keyseg->length); } - memcpy_fixed((byte*) &pos_a,pos_a+keyseg->bit_start,sizeof(char*)); - memcpy_fixed((byte*) &pos_b,pos_b+keyseg->bit_start,sizeof(char*)); + memcpy_fixed((uchar*) &pos_a,pos_a+keyseg->bit_start,sizeof(char*)); + memcpy_fixed((uchar*) &pos_b,pos_b+keyseg->bit_start,sizeof(char*)); } if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT1 || type == HA_KEYTYPE_VARTEXT2) diff --git a/storage/myisam/mi_update.c b/storage/myisam/mi_update.c index bea457d2e9a..924cdfcbc21 100644 --- a/storage/myisam/mi_update.c +++ b/storage/myisam/mi_update.c @@ -18,7 +18,7 @@ #include "fulltext.h" #include "rt_index.h" -int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec) +int mi_update(register MI_INFO *info, const uchar *oldrec, uchar *newrec) { int flag,key_changed,save_errno; reg3 my_off_t pos; @@ -115,7 +115,7 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec) info->update&= ~HA_STATE_RNEXT_SAME; if (new_length != old_length || - memcmp((byte*) old_key,(byte*) new_key,new_length)) + memcmp((uchar*) old_key,(uchar*) new_key,new_length)) { if ((int) i == info->lastinx) key_changed|=HA_STATE_WRITTEN; /* Mark that keyfile changed */ diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c index 57c054f2de8..8ae979f8bf6 100644 --- a/storage/myisam/mi_write.c +++ b/storage/myisam/mi_write.c @@ -40,7 +40,7 @@ int _mi_ck_write_btree(register MI_INFO *info, uint keynr,uchar *key, /* Write new record to database */ -int mi_write(MI_INFO *info, byte *record) +int mi_write(MI_INFO *info, uchar *record) { MYISAM_SHARE *share=info->s; uint i; @@ -286,7 +286,7 @@ int _mi_ck_write_btree(register MI_INFO *info, uint keynr, uchar *key, if (!error) error= _mi_ft_convert_to_ft2(info, keynr, key); delete_dynamic(info->ft1_to_ft2); - my_free((gptr)info->ft1_to_ft2, MYF(0)); + my_free((uchar*)info->ft1_to_ft2, MYF(0)); info->ft1_to_ft2=0; } DBUG_RETURN(error); @@ -403,14 +403,14 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ft_intXstore(keypos, subkeys); if (!error) error=_mi_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,temp_buff); - my_afree((byte*) temp_buff); + my_afree((uchar*) temp_buff); DBUG_RETURN(error); } } else /* not HA_FULLTEXT, normal HA_NOSAME key */ { info->dupp_key_pos= dupp_key_pos; - my_afree((byte*) temp_buff); + my_afree((uchar*) temp_buff); my_errno=HA_ERR_FOUND_DUPP_KEY; DBUG_RETURN(-1); } @@ -429,10 +429,10 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (_mi_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,temp_buff)) goto err; } - my_afree((byte*) temp_buff); + my_afree((uchar*) temp_buff); DBUG_RETURN(error); err: - my_afree((byte*) temp_buff); + my_afree((uchar*) temp_buff); DBUG_PRINT("exit",("Error: %d",my_errno)); DBUG_RETURN (-1); } /* w_search */ @@ -488,7 +488,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (key_pos != anc_buff+2+nod_flag && (keyinfo->flag & (HA_BINARY_PACK_KEY | HA_PACK_KEY))) { - DBUG_DUMP("prev_key",(byte*) key_buff,_mi_keylength(keyinfo,key_buff)); + DBUG_DUMP("prev_key",(uchar*) key_buff,_mi_keylength(keyinfo,key_buff)); } if (keyinfo->flag & HA_PACK_KEY) { @@ -506,7 +506,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo, my_errno=HA_ERR_CRASHED; DBUG_RETURN(-1); } - bmove_upp((byte*) endpos+t_length,(byte*) endpos,(uint) (endpos-key_pos)); + bmove_upp((uchar*) endpos+t_length,(uchar*) endpos,(uint) (endpos-key_pos)); } else { @@ -595,7 +595,7 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo, MI_KEY_PARAM s_temp; DBUG_ENTER("mi_split_page"); LINT_INIT(after_key); - DBUG_DUMP("buff",(byte*) buff,mi_getint(buff)); + DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff)); if (info->s->keyinfo+info->lastinx == keyinfo) info->page_changed=1; /* Info->buff is used */ @@ -619,7 +619,7 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo, { DBUG_PRINT("test",("Splitting nod")); pos=key_pos-nod_flag; - memcpy((byte*) info->buff+2,(byte*) pos,(size_t) nod_flag); + memcpy((uchar*) info->buff+2,(uchar*) pos,(size_t) nod_flag); } /* Move middle item to key and pointer to new page */ @@ -635,14 +635,14 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo, (uchar*) 0, (uchar*) 0, key_buff, &s_temp); length=(uint) ((buff+a_length)-key_pos); - memcpy((byte*) info->buff+key_ref_length+t_length,(byte*) key_pos, + memcpy((uchar*) info->buff+key_ref_length+t_length,(uchar*) key_pos, (size_t) length); (*keyinfo->store_key)(keyinfo,info->buff+key_ref_length,&s_temp); mi_putint(info->buff,length+t_length+key_ref_length,nod_flag); if (_mi_write_keypage(info,keyinfo,new_pos,DFLT_INIT_HITS,info->buff)) DBUG_RETURN(-1); - DBUG_DUMP("key",(byte*) key,_mi_keylength(keyinfo,key)); + DBUG_DUMP("key",(uchar*) key,_mi_keylength(keyinfo,key)); DBUG_RETURN(2); /* Middle key up */ } /* _mi_split_page */ @@ -764,7 +764,7 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo, length,keys; uchar *pos,*buff,*extra_buff; my_off_t next_page,new_pos; - byte tmp_part_key[MI_MAX_KEY_BUFF]; + uchar tmp_part_key[MI_MAX_KEY_BUFF]; DBUG_ENTER("_mi_balance_page"); k_length=keyinfo->keylength; @@ -796,7 +796,7 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo, if (!_mi_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,info->buff,0)) goto err; - DBUG_DUMP("next",(byte*) info->buff,mi_getint(info->buff)); + DBUG_DUMP("next",(uchar*) info->buff,mi_getint(info->buff)); /* Test if there is room to share keys */ @@ -815,23 +815,23 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo, if (left_length < new_left_length) { /* Move keys buff -> leaf */ pos=curr_buff+left_length; - memcpy((byte*) pos,(byte*) father_key_pos, (size_t) k_length); - memcpy((byte*) pos+k_length, (byte*) buff+2, + memcpy((uchar*) pos,(uchar*) father_key_pos, (size_t) k_length); + memcpy((uchar*) pos+k_length, (uchar*) buff+2, (size_t) (length=new_left_length - left_length - k_length)); pos=buff+2+length; - memcpy((byte*) father_key_pos,(byte*) pos,(size_t) k_length); - bmove((byte*) buff+2,(byte*) pos+k_length,new_right_length); + memcpy((uchar*) father_key_pos,(uchar*) pos,(size_t) k_length); + bmove((uchar*) buff+2,(uchar*) pos+k_length,new_right_length); } else { /* Move keys -> buff */ - bmove_upp((byte*) buff+new_right_length,(byte*) buff+right_length, + bmove_upp((uchar*) buff+new_right_length,(uchar*) buff+right_length, right_length-2); length=new_right_length-right_length-k_length; - memcpy((byte*) buff+2+length,father_key_pos,(size_t) k_length); + memcpy((uchar*) buff+2+length,father_key_pos,(size_t) k_length); pos=curr_buff+new_left_length; - memcpy((byte*) father_key_pos,(byte*) pos,(size_t) k_length); - memcpy((byte*) buff+2,(byte*) pos+k_length,(size_t) length); + memcpy((uchar*) father_key_pos,(uchar*) pos,(size_t) k_length); + memcpy((uchar*) buff+2,(uchar*) pos+k_length,(size_t) length); } if (_mi_write_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,info->buff) || @@ -858,22 +858,22 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo, /* move first largest keys to new page */ pos=buff+right_length-extra_length; - memcpy((byte*) extra_buff+2,pos,(size_t) extra_length); + memcpy((uchar*) extra_buff+2,pos,(size_t) extra_length); /* Save new parting key */ memcpy(tmp_part_key, pos-k_length,k_length); /* Make place for new keys */ - bmove_upp((byte*) buff+new_right_length,(byte*) pos-k_length, + bmove_upp((uchar*) buff+new_right_length,(uchar*) pos-k_length, right_length-extra_length-k_length-2); /* Copy keys from left page */ pos= curr_buff+new_left_length; - memcpy((byte*) buff+2,(byte*) pos+k_length, + memcpy((uchar*) buff+2,(uchar*) pos+k_length, (size_t) (length=left_length-new_left_length-k_length)); /* Copy old parting key */ - memcpy((byte*) buff+2+length,father_key_pos,(size_t) k_length); + memcpy((uchar*) buff+2+length,father_key_pos,(size_t) k_length); /* Move new parting keys up to caller */ - memcpy((byte*) (right ? key : father_key_pos),pos,(size_t) k_length); - memcpy((byte*) (right ? father_key_pos : key),tmp_part_key, k_length); + memcpy((uchar*) (right ? key : father_key_pos),pos,(size_t) k_length); + memcpy((uchar*) (right ? father_key_pos : key),tmp_part_key, k_length); if ((new_pos=_mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR) goto err; diff --git a/storage/myisam/myisam_ftdump.c b/storage/myisam/myisam_ftdump.c index 4bc1833cca6..63d954242a0 100644 --- a/storage/myisam/myisam_ftdump.c +++ b/storage/myisam/myisam_ftdump.c @@ -46,7 +46,7 @@ static struct my_option my_long_options[] = {"stats", 's', "Report global stats.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"verbose", 'v', "Be verbose.", - (gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 066e6cdb81b..3700251ab15 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -68,9 +68,9 @@ static void get_options(int *argc,char * * *argv); static void print_version(void); static void usage(void); static int myisamchk(MI_CHECK *param, char *filename); -static void descript(MI_CHECK *param, register MI_INFO *info, my_string name); +static void descript(MI_CHECK *param, register MI_INFO *info, char * name); static int mi_sort_records(MI_CHECK *param, register MI_INFO *info, - my_string name, uint sort_key, + char * name, uint sort_key, my_bool write_info, my_bool update_index); static int sort_record_index(MI_SORT_PARAM *sort_param, MI_INFO *info, MI_KEYDEF *keyinfo, @@ -167,7 +167,7 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR, "Directory where character sets are.", - (gptr*) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + (uchar**) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"check", 'c', "Check table for errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -187,8 +187,8 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"data-file-length", 'D', "Max length of data file (when recreating data-file when it's full).", - (gptr*) &check_param.max_data_file_length, - (gptr*) &check_param.max_data_file_length, + (uchar**) &check_param.max_data_file_length, + (uchar**) &check_param.max_data_file_length, 0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"extend-check", 'e', "If used when checking a table, ensure that the table is 100 percent consistent, which will take a long time. If used when repairing a table, try to recover every possible row from the data file. Normally this will also find a lot of garbage rows; Don't use this option with repair if you are not totally desperate.", @@ -210,13 +210,13 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"keys-used", 'k', "Tell MyISAM to update only some specific keys. # is a bit mask of which keys to use. This can be used to get faster inserts.", - (gptr*) &check_param.keys_in_use, - (gptr*) &check_param.keys_in_use, + (uchar**) &check_param.keys_in_use, + (uchar**) &check_param.keys_in_use, 0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0}, {"max-record-length", OPT_MAX_RECORD_LENGTH, "Skip rows bigger than this if myisamchk can't allocate memory to hold it", - (gptr*) &check_param.max_record_length, - (gptr*) &check_param.max_record_length, + (uchar**) &check_param.max_record_length, + (uchar**) &check_param.max_record_length, 0, GET_ULL, REQUIRED_ARG, LONGLONG_MAX, 0, LONGLONG_MAX, 0, 0, 0}, {"medium-check", 'm', "Faster than extend-check, but only finds 99.99% of all errors. Should be good enough for most cases.", @@ -245,12 +245,12 @@ static struct my_option my_long_options[] = #endif {"set-auto-increment", 'A', "Force auto_increment to start at this or higher value. If no value is given, then sets the next auto_increment value to the highest used value for the auto key + 1.", - (gptr*) &check_param.auto_increment_value, - (gptr*) &check_param.auto_increment_value, + (uchar**) &check_param.auto_increment_value, + (uchar**) &check_param.auto_increment_value, 0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"set-collation", OPT_SET_COLLATION, "Change the collation used by the index", - (gptr*) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + (uchar**) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"set-variable", 'O', "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -262,12 +262,12 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"sort-records", 'R', "Sort records according to an index. This makes your data much more localized and may speed up things. (It may be VERY slow to do a sort the first time!)", - (gptr*) &check_param.opt_sort_key, - (gptr*) &check_param.opt_sort_key, + (uchar**) &check_param.opt_sort_key, + (uchar**) &check_param.opt_sort_key, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"tmpdir", 't', "Path for temporary files.", - (gptr*) &opt_tmpdir, + (uchar**) &opt_tmpdir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"update-state", 'U', "Mark tables as crashed if any errors were found.", @@ -285,54 +285,54 @@ static struct my_option my_long_options[] = "Wait if table is locked.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, { "key_buffer_size", OPT_KEY_BUFFER_SIZE, "", - (gptr*) &check_param.use_buffers, (gptr*) &check_param.use_buffers, 0, + (uchar**) &check_param.use_buffers, (uchar**) &check_param.use_buffers, 0, GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT, (long) MALLOC_OVERHEAD, (long) ~0L, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0}, { "key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE, "", - (gptr*) &opt_key_cache_block_size, - (gptr*) &opt_key_cache_block_size, 0, + (uchar**) &opt_key_cache_block_size, + (uchar**) &opt_key_cache_block_size, 0, GET_LONG, REQUIRED_ARG, MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH, 0, MI_MIN_KEY_BLOCK_LENGTH, 0}, { "myisam_block_size", OPT_MYISAM_BLOCK_SIZE, "", - (gptr*) &opt_myisam_block_size, (gptr*) &opt_myisam_block_size, 0, + (uchar**) &opt_myisam_block_size, (uchar**) &opt_myisam_block_size, 0, GET_LONG, REQUIRED_ARG, MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH, 0, MI_MIN_KEY_BLOCK_LENGTH, 0}, { "read_buffer_size", OPT_READ_BUFFER_SIZE, "", - (gptr*) &check_param.read_buffer_length, - (gptr*) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG, + (uchar**) &check_param.read_buffer_length, + (uchar**) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, { "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "", - (gptr*) &check_param.write_buffer_length, - (gptr*) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG, + (uchar**) &check_param.write_buffer_length, + (uchar**) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "", - (gptr*) &check_param.sort_buffer_length, - (gptr*) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG, + (uchar**) &check_param.sort_buffer_length, + (uchar**) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, { "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "", - (gptr*) &check_param.sort_key_blocks, - (gptr*) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG, + (uchar**) &check_param.sort_key_blocks, + (uchar**) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG, BUFFERS_WHEN_SORTING, 4L, 100L, 0L, 1L, 0}, - { "decode_bits", OPT_DECODE_BITS, "", (gptr*) &decode_bits, - (gptr*) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0}, - { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (gptr*) &ft_min_word_len, - (gptr*) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN, + { "decode_bits", OPT_DECODE_BITS, "", (uchar**) &decode_bits, + (uchar**) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0}, + { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (uchar**) &ft_min_word_len, + (uchar**) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN, 0, 1, 0}, - { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (gptr*) &ft_max_word_len, - (gptr*) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10, + { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (uchar**) &ft_max_word_len, + (uchar**) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10, HA_FT_MAXCHARLEN, 0, 1, 0}, { "ft_stopword_file", OPT_FT_STOPWORD_FILE, "Use stopwords from this file instead of built-in list.", - (gptr*) &ft_stopword_file, (gptr*) &ft_stopword_file, 0, GET_STR, + (uchar**) &ft_stopword_file, (uchar**) &ft_stopword_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"stats_method", OPT_STATS_METHOD, "Specifies how index statistics collection code should threat NULLs. " "Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), " "\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".", - (gptr*) &myisam_stats_method_str, (gptr*) &myisam_stats_method_str, 0, + (uchar**) &myisam_stats_method_str, (uchar**) &myisam_stats_method_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -794,7 +794,7 @@ static void get_options(register int *argc,register char ***argv) /* Check table */ -static int myisamchk(MI_CHECK *param, my_string filename) +static int myisamchk(MI_CHECK *param, char * filename) { int error,lock_type,recreate; int rep_quick= param->testflag & (T_QUICK | T_FORCE_UNIQUENESS); @@ -1199,7 +1199,7 @@ end2: /* Write info about table */ -static void descript(MI_CHECK *param, register MI_INFO *info, my_string name) +static void descript(MI_CHECK *param, register MI_INFO *info, char * name) { uint key,keyseg_nr,field,start; reg3 MI_KEYDEF *keyinfo; @@ -1465,7 +1465,7 @@ static void descript(MI_CHECK *param, register MI_INFO *info, my_string name) /* Sort records according to one key */ static int mi_sort_records(MI_CHECK *param, - register MI_INFO *info, my_string name, + register MI_INFO *info, char * name, uint sort_key, my_bool write_info, my_bool update_index) @@ -1536,7 +1536,7 @@ static int mi_sort_records(MI_CHECK *param, mi_check_print_error(param,"Not enough memory for key block"); goto err; } - if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength, + if (!(sort_param.record=(uchar*) my_malloc((uint) share->base.pack_reclength, MYF(0)))) { mi_check_print_error(param,"Not enough memory for record"); @@ -1567,7 +1567,7 @@ static int mi_sort_records(MI_CHECK *param, for (key=0 ; key < share->base.keys ; key++) share->keyinfo[key].flag|= HA_SORT_ALLOWS_SAME; - if (my_pread(share->kfile,(byte*) temp_buff, + if (my_pread(share->kfile,(uchar*) temp_buff, (uint) keyinfo->block_length, share->state.key_root[sort_key], MYF(MY_NABP+MY_WME))) @@ -1630,7 +1630,7 @@ err: } if (temp_buff) { - my_afree((gptr) temp_buff); + my_afree((uchar*) temp_buff); } my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR)); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); @@ -1679,7 +1679,7 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info, if (nod_flag) { next_page=_mi_kpos(nod_flag,keypos); - if (my_pread(info->s->kfile,(byte*) temp_buff, + if (my_pread(info->s->kfile,(uchar*) temp_buff, (uint) keyinfo->block_length, next_page, MYF(MY_NABP+MY_WME))) { @@ -1718,19 +1718,19 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info, goto err; } /* Clear end of block to get better compression if the table is backuped */ - bzero((byte*) buff+used_length,keyinfo->block_length-used_length); - if (my_pwrite(info->s->kfile,(byte*) buff,(uint) keyinfo->block_length, + bzero((uchar*) buff+used_length,keyinfo->block_length-used_length); + if (my_pwrite(info->s->kfile,(uchar*) buff,(uint) keyinfo->block_length, page,param->myf_rw)) { mi_check_print_error(param,"%d when updating keyblock",my_errno); goto err; } if (temp_buff) - my_afree((gptr) temp_buff); + my_afree((uchar*) temp_buff); DBUG_RETURN(0); err: if (temp_buff) - my_afree((gptr) temp_buff); + my_afree((uchar*) temp_buff); DBUG_RETURN(1); } /* sort_record_index */ diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index a491e6d210c..f68d66d4cbb 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -167,22 +167,22 @@ typedef struct st_mi_isam_share { /* Shared between opens */ char *unique_file_name; /* realpath() of index file */ char *data_file_name, /* Resolved path names from symlinks */ *index_file_name; - byte *file_map; /* mem-map of file if possible */ + uchar *file_map; /* mem-map of file if possible */ KEY_CACHE *key_cache; /* ref to the current key cache */ MI_DECODE_TREE *decode_trees; uint16 *decode_tables; - int (*read_record)(struct st_myisam_info*, my_off_t, byte*); - int (*write_record)(struct st_myisam_info*, const byte*); - int (*update_record)(struct st_myisam_info*, my_off_t, const byte*); + int (*read_record)(struct st_myisam_info*, my_off_t, uchar*); + int (*write_record)(struct st_myisam_info*, const uchar*); + int (*update_record)(struct st_myisam_info*, my_off_t, const uchar*); int (*delete_record)(struct st_myisam_info*); - int (*read_rnd)(struct st_myisam_info*, byte*, my_off_t, my_bool); - int (*compare_record)(struct st_myisam_info*, const byte *); + int (*read_rnd)(struct st_myisam_info*, uchar*, my_off_t, my_bool); + int (*compare_record)(struct st_myisam_info*, const uchar *); /* Function to use for a row checksum. */ - ha_checksum (*calc_checksum)(struct st_myisam_info*, const byte *); + ha_checksum (*calc_checksum)(struct st_myisam_info*, const uchar *); int (*compare_unique)(struct st_myisam_info*, MI_UNIQUEDEF *, - const byte *record, my_off_t pos); - uint (*file_read)(MI_INFO *, byte *, uint, my_off_t, myf); - uint (*file_write)(MI_INFO *, byte *, uint, my_off_t, myf); + const uchar *record, my_off_t pos); + uint (*file_read)(MI_INFO *, uchar *, uint, my_off_t, myf); + uint (*file_write)(MI_INFO *, uchar *, uint, my_off_t, myf); invalidator_by_filename invalidator; /* query cache invalidator */ ulong this_process; /* processid */ ulong last_process; /* For table-change-check */ @@ -245,12 +245,12 @@ struct st_myisam_info { uchar *buff, /* Temp area for key */ *lastkey,*lastkey2; /* Last used search key */ uchar *first_mbr_key; /* Searhed spatial key */ - byte *rec_buff; /* Tempbuff for recordpack */ + uchar *rec_buff; /* Tempbuff for recordpack */ uchar *int_keypos, /* Save position for next/previous */ *int_maxpos; /* -""- */ uint int_nod_flag; /* -""- */ uint32 int_keytree_version; /* -""- */ - int (*read_record)(struct st_myisam_info*, my_off_t, byte*); + int (*read_record)(struct st_myisam_info*, my_off_t, uchar*); invalidator_by_filename invalidator; /* query cache invalidator */ ulong this_unique; /* uniq filenumber or thread */ ulong last_unique; /* last unique number */ @@ -334,10 +334,10 @@ typedef struct st_mi_sort_param HA_KEYSEG *seg; SORT_INFO *sort_info; uchar **sort_keys; - byte *rec_buff; + uchar *rec_buff; void *wordlist, *wordptr; MEM_ROOT wordroot; - char *record; + uchar *record; MY_TMPDIR *tmpdir; int (*key_cmp)(struct st_mi_sort_param *, const void *, const void *); int (*key_read)(struct st_mi_sort_param *,void *); @@ -349,6 +349,7 @@ typedef struct st_mi_sort_param NEAR int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,char *, uint, uint); } MI_SORT_PARAM; + /* Some defines used by isam-funktions */ #define USE_WHOLE_KEY MI_MAX_KEY_BUFF*2 /* Use whole key in _mi_search() */ @@ -497,20 +498,20 @@ typedef struct st_mi_s_param /* Prototypes for intern functions */ -extern int _mi_read_dynamic_record(MI_INFO *info,my_off_t filepos,byte *buf); -extern int _mi_write_dynamic_record(MI_INFO*, const byte*); -extern int _mi_update_dynamic_record(MI_INFO*, my_off_t, const byte*); +extern int _mi_read_dynamic_record(MI_INFO *info,my_off_t filepos,uchar *buf); +extern int _mi_write_dynamic_record(MI_INFO*, const uchar*); +extern int _mi_update_dynamic_record(MI_INFO*, my_off_t, const uchar*); extern int _mi_delete_dynamic_record(MI_INFO *info); -extern int _mi_cmp_dynamic_record(MI_INFO *info,const byte *record); -extern int _mi_read_rnd_dynamic_record(MI_INFO *, byte *,my_off_t, my_bool); -extern int _mi_write_blob_record(MI_INFO*, const byte*); -extern int _mi_update_blob_record(MI_INFO*, my_off_t, const byte*); -extern int _mi_read_static_record(MI_INFO *info, my_off_t filepos,byte *buf); -extern int _mi_write_static_record(MI_INFO*, const byte*); -extern int _mi_update_static_record(MI_INFO*, my_off_t, const byte*); +extern int _mi_cmp_dynamic_record(MI_INFO *info,const uchar *record); +extern int _mi_read_rnd_dynamic_record(MI_INFO *, uchar *,my_off_t, my_bool); +extern int _mi_write_blob_record(MI_INFO*, const uchar*); +extern int _mi_update_blob_record(MI_INFO*, my_off_t, const uchar*); +extern int _mi_read_static_record(MI_INFO *info, my_off_t filepos,uchar *buf); +extern int _mi_write_static_record(MI_INFO*, const uchar*); +extern int _mi_update_static_record(MI_INFO*, my_off_t, const uchar*); extern int _mi_delete_static_record(MI_INFO *info); -extern int _mi_cmp_static_record(MI_INFO *info,const byte *record); -extern int _mi_read_rnd_static_record(MI_INFO*, byte *,my_off_t, my_bool); +extern int _mi_cmp_static_record(MI_INFO *info,const uchar *record); +extern int _mi_read_rnd_static_record(MI_INFO*, uchar *,my_off_t, my_bool); extern int _mi_ck_write(MI_INFO *info,uint keynr,uchar *key,uint length); extern int _mi_ck_real_write_btree(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, uint key_length, @@ -604,39 +605,39 @@ extern int _mi_dispose(MI_INFO *info,MI_KEYDEF *keyinfo,my_off_t pos, int level); extern my_off_t _mi_new(MI_INFO *info,MI_KEYDEF *keyinfo,int level); extern uint _mi_make_key(MI_INFO *info,uint keynr,uchar *key, - const byte *record,my_off_t filepos); + const uchar *record,my_off_t filepos); extern uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, key_part_map keypart_map, HA_KEYSEG **last_used_keyseg); -extern int _mi_read_key_record(MI_INFO *info,my_off_t filepos,byte *buf); -extern int _mi_read_cache(IO_CACHE *info,byte *buff,my_off_t pos, +extern int _mi_read_key_record(MI_INFO *info,my_off_t filepos,uchar *buf); +extern int _mi_read_cache(IO_CACHE *info,uchar *buff,my_off_t pos, uint length,int re_read_if_possibly); -extern ulonglong retrieve_auto_increment(MI_INFO *info,const byte *record); +extern ulonglong retrieve_auto_increment(MI_INFO *info,const uchar *record); -extern byte *mi_alloc_rec_buff(MI_INFO *,ulong, byte**); +extern uchar *mi_alloc_rec_buff(MI_INFO *,ulong, uchar**); #define mi_get_rec_buff_ptr(info,buf) \ ((((info)->s->options & HA_OPTION_PACK_RECORD) && (buf)) ? \ (buf) - MI_REC_BUFF_OFFSET : (buf)) #define mi_get_rec_buff_len(info,buf) \ (*((uint32 *)(mi_get_rec_buff_ptr(info,buf)))) -extern ulong _mi_rec_unpack(MI_INFO *info,byte *to,byte *from, +extern ulong _mi_rec_unpack(MI_INFO *info,uchar *to,uchar *from, ulong reclength); -extern my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *packpos, +extern my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *packpos, ulong packed_length, my_bool with_checkum); extern int _mi_write_part_record(MI_INFO *info,my_off_t filepos,ulong length, - my_off_t next_filepos,byte **record, + my_off_t next_filepos,uchar **record, ulong *reclength,int *flag); extern void _mi_print_key(FILE *stream,HA_KEYSEG *keyseg,const uchar *key, uint length); extern my_bool _mi_read_pack_info(MI_INFO *info,pbool fix_keys); -extern int _mi_read_pack_record(MI_INFO *info,my_off_t filepos,byte *buf); -extern int _mi_read_rnd_pack_record(MI_INFO*, byte *,my_off_t, my_bool); +extern int _mi_read_pack_record(MI_INFO *info,my_off_t filepos,uchar *buf); +extern int _mi_read_rnd_pack_record(MI_INFO*, uchar *,my_off_t, my_bool); extern int _mi_pack_rec_unpack(MI_INFO *info, MI_BIT_BUFF *bit_buff, - byte *to, byte *from, ulong reclength); + uchar *to, uchar *from, ulong reclength); extern ulonglong mi_safe_mul(ulonglong a,ulonglong b); -extern int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf, - const byte *oldrec, const byte *newrec, my_off_t pos); +extern int _mi_ft_update(MI_INFO *info, uint keynr, uchar *keybuf, + const uchar *oldrec, const uchar *newrec, my_off_t pos); struct st_sort_info; @@ -697,32 +698,32 @@ extern "C" { #endif extern uint _mi_get_block_info(MI_BLOCK_INFO *,File, my_off_t); -extern uint _mi_rec_pack(MI_INFO *info,byte *to,const byte *from); +extern uint _mi_rec_pack(MI_INFO *info,uchar *to,const uchar *from); extern uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, - MI_BLOCK_INFO *info, byte **rec_buff_p, + MI_BLOCK_INFO *info, uchar **rec_buff_p, File file, my_off_t filepos); -extern void _my_store_blob_length(byte *pos,uint pack_length,uint length); +extern void _my_store_blob_length(uchar *pos,uint pack_length,uint length); extern void _myisam_log(enum myisam_log_commands command,MI_INFO *info, - const byte *buffert,uint length); + const uchar *buffert,uint length); extern void _myisam_log_command(enum myisam_log_commands command, - MI_INFO *info, const byte *buffert, + MI_INFO *info, const uchar *buffert, uint length, int result); extern void _myisam_log_record(enum myisam_log_commands command,MI_INFO *info, - const byte *record,my_off_t filepos, + const uchar *record,my_off_t filepos, int result); extern void mi_report_error(int errcode, const char *file_name); extern my_bool _mi_memmap_file(MI_INFO *info); extern void _mi_unmap_file(MI_INFO *info); -extern uint save_pack_length(uint version, byte *block_buff, ulong length); +extern uint save_pack_length(uint version, uchar *block_buff, ulong length); extern uint read_pack_length(uint version, const uchar *buf, ulong *length); extern uint calc_pack_length(uint version, ulong length); -extern uint mi_mmap_pread(MI_INFO *info, byte *Buffer, +extern uint mi_mmap_pread(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags); -extern uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer, +extern uint mi_mmap_pwrite(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags); -extern uint mi_nommap_pread(MI_INFO *info, byte *Buffer, +extern uint mi_nommap_pread(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags); -extern uint mi_nommap_pwrite(MI_INFO *info, byte *Buffer, +extern uint mi_nommap_pwrite(MI_INFO *info, uchar *Buffer, uint Count, my_off_t offset, myf MyFlags); uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite); @@ -741,17 +742,17 @@ char *mi_recinfo_read(char *ptr, MI_COLUMNDEF *recinfo); extern int mi_disable_indexes(MI_INFO *info); extern int mi_enable_indexes(MI_INFO *info); extern int mi_indexes_are_disabled(MI_INFO *info); -ulong _my_calc_total_blob_length(MI_INFO *info, const byte *record); -ha_checksum mi_checksum(MI_INFO *info, const byte *buf); -ha_checksum mi_static_checksum(MI_INFO *info, const byte *buf); -my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record, +ulong _my_calc_total_blob_length(MI_INFO *info, const uchar *record); +ha_checksum mi_checksum(MI_INFO *info, const uchar *buf); +ha_checksum mi_static_checksum(MI_INFO *info, const uchar *buf); +my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record, ha_checksum unique_hash, my_off_t pos); -ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *buf); +ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *buf); int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def, - const byte *record, my_off_t pos); + const uchar *record, my_off_t pos); int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def, - const byte *record, my_off_t pos); -int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b, + const uchar *record, my_off_t pos); +int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b, my_bool null_are_equal); void mi_get_status(void* param, int concurrent_insert); void mi_update_status(void* param); diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c index 0bcf74d87a4..1cf4ad730cb 100644 --- a/storage/myisam/myisamlog.c +++ b/storage/myisam/myisamlog.c @@ -32,14 +32,14 @@ struct file_info { long process; int filenr,id; uint rnd; - my_string name,show_name,record; + char *name, *show_name, *record; MI_INFO *isam; bool closed,used; ulong accessed; }; struct test_if_open_param { - my_string name; + char * name; int max_id; }; @@ -53,24 +53,25 @@ struct st_access_param extern int main(int argc,char * *argv); static void get_options(int *argc,char ***argv); -static int examine_log(my_string file_name,char **table_names); -static int read_string(IO_CACHE *file,gptr *to,uint length); +static int examine_log(char * file_name,char **table_names); +static int read_string(IO_CACHE *file,uchar* *to,uint length); static int file_info_compare(void *cmp_arg, void *a,void *b); static int test_if_open(struct file_info *key,element_count count, struct test_if_open_param *param); -static void fix_blob_pointers(MI_INFO *isam,byte *record); +static void fix_blob_pointers(MI_INFO *isam,uchar *record); static int test_when_accessed(struct file_info *key,element_count count, struct st_access_param *access_param); static void file_info_free(struct file_info *info); static int close_some_file(TREE *tree); static int reopen_closed_file(TREE *tree,struct file_info *file_info); -static int find_record_with_key(struct file_info *file_info,byte *record); +static int find_record_with_key(struct file_info *file_info,uchar *record); static void printf_log(const char *str,...); -static bool cmp_filename(struct file_info *file_info,my_string name); +static bool cmp_filename(struct file_info *file_info,char * name); static uint verbose=0,update=0,test_info=0,max_files=0,re_open_count=0, recover=0,prefix_remove=0,opt_processes=0; -static my_string log_filename=0,filepath=0,write_filename=0,record_pos_file=0; +static char *log_filename=0, *filepath=0, *write_filename=0; +static char *record_pos_file= 0; static ulong com_count[10][3],number_of_commands=(ulong) ~0L, isamlog_process; static my_off_t isamlog_filepos,start_offset=0,record_pos= HA_OFFSET_ERROR; @@ -296,7 +297,7 @@ static void get_options(register int *argc, register char ***argv) } -static int examine_log(my_string file_name, char **table_names) +static int examine_log(char * file_name, char **table_names) { uint command,result,files_open; ulong access_time,length; @@ -304,7 +305,7 @@ static int examine_log(my_string file_name, char **table_names) int lock_command,mi_result; char isam_file_name[FN_REFLEN],llbuff[21],llbuff2[21]; uchar head[20]; - gptr buff; + uchar* buff; struct test_if_open_param open_param; IO_CACHE cache; File file; @@ -327,7 +328,7 @@ static int examine_log(my_string file_name, char **table_names) } init_io_cache(&cache,file,0,READ_CACHE,start_offset,0,MYF(0)); - bzero((gptr) com_count,sizeof(com_count)); + bzero((uchar*) com_count,sizeof(com_count)); init_tree(&tree,0,0,sizeof(file_info),(qsort_cmp2) file_info_compare,1, (tree_element_free) file_info_free, NULL); VOID(init_key_cache(dflt_key_cache,KEY_CACHE_BLOCK_SIZE,KEY_CACHE_SIZE, @@ -335,7 +336,7 @@ static int examine_log(my_string file_name, char **table_names) files_open=0; access_time=0; while (access_time++ != number_of_commands && - !my_b_read(&cache,(byte*) head,9)) + !my_b_read(&cache,(uchar*) head,9)) { isamlog_filepos=my_b_tell(&cache)-9L; file_info.filenr= mi_uint2korr(head+1); @@ -375,14 +376,15 @@ static int examine_log(my_string file_name, char **table_names) } if (curr_file_info) - printf("\nWarning: %s is opened with same process and filenumber\nMaybe you should use the -P option ?\n", + printf("\nWarning: %s is opened with same process and filenumber\n" + "Maybe you should use the -P option ?\n", curr_file_info->show_name); - if (my_b_read(&cache,(byte*) head,2)) + if (my_b_read(&cache,(uchar*) head,2)) goto err; file_info.name=0; file_info.show_name=0; file_info.record=0; - if (read_string(&cache,(gptr*) &file_info.name, + if (read_string(&cache,(uchar**) &file_info.name, (uint) mi_uint2korr(head))) goto err; { @@ -455,7 +457,7 @@ static int examine_log(my_string file_name, char **table_names) files_open++; file_info.closed=0; } - VOID(tree_insert(&tree, (gptr) &file_info, 0, tree.custom_arg)); + VOID(tree_insert(&tree, (uchar*) &file_info, 0, tree.custom_arg)); if (file_info.used) { if (verbose && !record_pos_file) @@ -474,11 +476,11 @@ static int examine_log(my_string file_name, char **table_names) { if (!curr_file_info->closed) files_open--; - VOID(tree_delete(&tree, (gptr) curr_file_info, 0, tree.custom_arg)); + VOID(tree_delete(&tree, (uchar*) curr_file_info, 0, tree.custom_arg)); } break; case MI_LOG_EXTRA: - if (my_b_read(&cache,(byte*) head,1)) + if (my_b_read(&cache,(uchar*) head,1)) goto err; extra_command=(enum ha_extra_function) head[0]; if (verbose && !record_pos_file && @@ -499,7 +501,7 @@ static int examine_log(my_string file_name, char **table_names) } break; case MI_LOG_DELETE: - if (my_b_read(&cache,(byte*) head,8)) + if (my_b_read(&cache,(uchar*) head,8)) goto err; filepos=mi_sizekorr(head); if (verbose && (!record_pos_file || @@ -534,7 +536,7 @@ static int examine_log(my_string file_name, char **table_names) break; case MI_LOG_WRITE: case MI_LOG_UPDATE: - if (my_b_read(&cache,(byte*) head,12)) + if (my_b_read(&cache,(uchar*) head,12)) goto err; filepos=mi_sizekorr(head); length=mi_uint4korr(head+8); @@ -616,7 +618,7 @@ static int examine_log(my_string file_name, char **table_names) my_free(buff,MYF(0)); break; case MI_LOG_LOCK: - if (my_b_read(&cache,(byte*) head,sizeof(lock_command))) + if (my_b_read(&cache,(uchar*) head,sizeof(lock_command))) goto err; memcpy_fixed(&lock_command,head,sizeof(lock_command)); if (verbose && !record_pos_file && @@ -675,14 +677,14 @@ static int examine_log(my_string file_name, char **table_names) } -static int read_string(IO_CACHE *file, register gptr *to, register uint length) +static int read_string(IO_CACHE *file, register uchar* *to, register uint length) { DBUG_ENTER("read_string"); if (*to) - my_free((gptr) *to,MYF(0)); - if (!(*to= (gptr) my_malloc(length+1,MYF(MY_WME))) || - my_b_read(file,(byte*) *to,length)) + my_free((uchar*) *to,MYF(0)); + if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) || + my_b_read(file,(uchar*) *to,length)) { if (*to) my_free(*to,MYF(0)); @@ -717,9 +719,9 @@ static int test_if_open (struct file_info *key, } -static void fix_blob_pointers(MI_INFO *info, byte *record) +static void fix_blob_pointers(MI_INFO *info, uchar *record) { - byte *pos; + uchar *pos; MI_BLOB *blob,*end; pos=record+info->s->base.reclength; @@ -801,7 +803,7 @@ static int reopen_closed_file(TREE *tree, struct file_info *fileinfo) /* Try to find record with uniq key */ -static int find_record_with_key(struct file_info *file_info, byte *record) +static int find_record_with_key(struct file_info *file_info, uchar *record) { uint key; MI_INFO *info=file_info->isam; @@ -836,7 +838,7 @@ static void printf_log(const char *format,...) } -static bool cmp_filename(struct file_info *file_info, my_string name) +static bool cmp_filename(struct file_info *file_info, char * name) { if (!file_info) return 1; diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index fb631b5e63e..5f7c4ee8f2e 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -69,8 +69,8 @@ typedef struct st_huff_counts { my_off_t pre_space[8]; my_off_t tot_end_space,tot_pre_space,zero_fields,empty_fields,bytes_packed; TREE int_tree; /* Tree for detecting distinct column values. */ - byte *tree_buff; /* Column values, 'field_length' each. */ - byte *tree_pos; /* Points to end of column values in 'tree_buff'. */ + uchar *tree_buff; /* Column values, 'field_length' each. */ + uchar *tree_pos; /* Points to end of column values in 'tree_buff'. */ } HUFF_COUNTS; typedef struct st_huff_element HUFF_ELEMENT; @@ -141,8 +141,8 @@ static int test_space_compress(HUFF_COUNTS *huff_counts,my_off_t records, enum en_fieldtype field_type); static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts,uint trees); static int make_huff_tree(HUFF_TREE *tree,HUFF_COUNTS *huff_counts); -static int compare_huff_elements(void *not_used, byte *a,byte *b); -static int save_counts_in_queue(byte *key,element_count count, +static int compare_huff_elements(void *not_used, uchar *a,uchar *b); +static int save_counts_in_queue(uchar *key,element_count count, HUFF_TREE *tree); static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,uint flag); static uint join_same_trees(HUFF_COUNTS *huff_counts,uint trees); @@ -171,7 +171,7 @@ static int save_state(MI_INFO *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length, static int save_state_mrg(File file,PACK_MRG_INFO *isam_file,my_off_t new_length, ha_checksum crc); static int mrg_close(PACK_MRG_INFO *mrg); -static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf); +static int mrg_rrnd(PACK_MRG_INFO *info,uchar *buf); static void mrg_reset(PACK_MRG_INFO *mrg); #if !defined(DBUG_OFF) static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count); @@ -257,10 +257,10 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"backup", 'b', "Make a backup of the table as table_name.OLD.", - (gptr*) &backup, (gptr*) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + (uchar**) &backup, (uchar**) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR_MP, - "Directory where character sets are.", (gptr*) &charsets_dir, - (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + "Directory where character sets are.", (uchar**) &charsets_dir, + (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"force", 'f', @@ -268,7 +268,7 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"join", 'j', "Join all given tables into 'new_table_name'. All tables MUST have identical layouts.", - (gptr*) &join_table, (gptr*) &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, + (uchar**) &join_table, (uchar**) &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -282,8 +282,8 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"wait", 'w', "Wait and retry if table is in use.", (gptr*) &opt_wait, - (gptr*) &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"wait", 'w', "Wait and retry if table is in use.", (uchar**) &opt_wait, + (uchar**) &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -478,7 +478,7 @@ static bool open_isam_files(PACK_MRG_INFO *mrg,char **names,uint count) error: while (i--) mi_close(mrg->file[i]); - my_free((gptr) mrg->file,MYF(0)); + my_free((uchar*) mrg->file,MYF(0)); return 1; } @@ -811,11 +811,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees, for (i=0 ; i < trees ; i++) { if (huff_trees[i].element_buffer) - my_free((gptr) huff_trees[i].element_buffer,MYF(0)); + my_free((uchar*) huff_trees[i].element_buffer,MYF(0)); if (huff_trees[i].code) - my_free((gptr) huff_trees[i].code,MYF(0)); + my_free((uchar*) huff_trees[i].code,MYF(0)); } - my_free((gptr) huff_trees,MYF(0)); + my_free((uchar*) huff_trees,MYF(0)); } if (huff_counts) { @@ -823,11 +823,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees, { if (huff_counts[i].tree_buff) { - my_free((gptr) huff_counts[i].tree_buff,MYF(0)); + my_free((uchar*) huff_counts[i].tree_buff,MYF(0)); delete_tree(&huff_counts[i].int_tree); } } - my_free((gptr) huff_counts,MYF(0)); + my_free((uchar*) huff_counts,MYF(0)); } delete_queue(&queue); /* This is safe to free */ return; @@ -840,7 +840,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) int error; uint length; ulong reclength,max_blob_length; - byte *record,*pos,*next_pos,*end_pos,*start_pos; + uchar *record,*pos,*next_pos,*end_pos,*start_pos; ha_rows record_count; my_bool static_row_size; HUFF_COUNTS *count,*end_count; @@ -848,7 +848,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) DBUG_ENTER("get_statistic"); reclength=mrg->file[0]->s->base.reclength; - record=(byte*) my_alloca(reclength); + record=(uchar*) my_alloca(reclength); end_count=huff_counts+mrg->file[0]->s->base.fields; record_count=0; glob_crc=0; max_blob_length=0; @@ -1032,7 +1032,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) { uint i; /* Zero fields are just counted. Go to the next record. */ - if (!memcmp((byte*) start_pos,zero_string,count->field_length)) + if (!memcmp((uchar*) start_pos,zero_string,count->field_length)) { count->zero_fields++; continue; @@ -1141,12 +1141,12 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) mrg->records=record_count; mrg->max_blob_length=max_blob_length; - my_afree((gptr) record); + my_afree((uchar*) record); DBUG_RETURN(error != HA_ERR_END_OF_FILE); } static int compare_huff_elements(void *not_used __attribute__((unused)), - byte *a, byte *b) + uchar *a, uchar *b) { return *((my_off_t*) a) < *((my_off_t*) b) ? -1 : (*((my_off_t*) a) == *((my_off_t*) b) ? 0 : 1); @@ -1162,7 +1162,7 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees, my_off_t old_length,new_length,length; DBUG_ENTER("check_counts"); - bzero((gptr) field_count,sizeof(field_count)); + bzero((uchar*) field_count,sizeof(field_count)); space_fields=fill_zero_fields=0; for (; trees-- ; huff_counts++) @@ -1328,12 +1328,12 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees, } else { - my_free((gptr) huff_counts->tree_buff,MYF(0)); + my_free((uchar*) huff_counts->tree_buff,MYF(0)); delete_tree(&huff_counts->int_tree); huff_counts->tree_buff=0; } if (tree.element_buffer) - my_free((gptr) tree.element_buffer,MYF(0)); + my_free((uchar*) tree.element_buffer,MYF(0)); } if (huff_counts->pack_type & PACK_TYPE_SPACE_FIELDS) space_fields++; @@ -1450,8 +1450,8 @@ static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts, uint trees) if (make_huff_tree(huff_tree+tree,huff_counts+tree)) { while (tree--) - my_free((gptr) huff_tree[tree].element_buffer,MYF(0)); - my_free((gptr) huff_tree,MYF(0)); + my_free((uchar*) huff_tree[tree].element_buffer,MYF(0)); + my_free((uchar*) huff_tree,MYF(0)); DBUG_RETURN(0); } } @@ -1526,7 +1526,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts) { HUFF_ELEMENT *temp; if (!(temp= - (HUFF_ELEMENT*) my_realloc((gptr) huff_tree->element_buffer, + (HUFF_ELEMENT*) my_realloc((uchar*) huff_tree->element_buffer, found*2*sizeof(HUFF_ELEMENT), MYF(MY_WME)))) return 1; @@ -1561,7 +1561,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts) */ tree_walk(&huff_counts->int_tree, (int (*)(void*, element_count,void*)) save_counts_in_queue, - (gptr) huff_tree, left_root_right); + (uchar*) huff_tree, left_root_right); } else { @@ -1587,7 +1587,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts) new_huff_el->count=huff_counts->counts[i]; new_huff_el->a.leaf.null=0; new_huff_el->a.leaf.element_nr=i; - queue.root[found]=(byte*) new_huff_el; + queue.root[found]=(uchar*) new_huff_el; } } /* @@ -1604,7 +1604,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts) new_huff_el->a.leaf.element_nr=huff_tree->min_chr=last-1; else new_huff_el->a.leaf.element_nr=huff_tree->max_chr=last+1; - queue.root[found]=(byte*) new_huff_el; + queue.root[found]=(uchar*) new_huff_el; } } @@ -1654,7 +1654,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts) Replace the copied top element by the new element and re-order the queue. */ - queue.root[1]=(byte*) new_huff_el; + queue.root[1]=(uchar*) new_huff_el; queue_replaced(&queue); } huff_tree->root=(HUFF_ELEMENT*) queue.root[1]; @@ -1693,7 +1693,7 @@ static int compare_tree(void* cmp_arg __attribute__((unused)), 0 */ -static int save_counts_in_queue(byte *key, element_count count, +static int save_counts_in_queue(uchar *key, element_count count, HUFF_TREE *tree) { HUFF_ELEMENT *new_huff_el; @@ -1703,7 +1703,7 @@ static int save_counts_in_queue(byte *key, element_count count, new_huff_el->a.leaf.null=0; new_huff_el->a.leaf.element_nr= (uint) (key- tree->counts->tree_buff) / tree->counts->field_length; - queue.root[tree->elements]=(byte*) new_huff_el; + queue.root[tree->elements]=(uchar*) new_huff_el; return 0; } @@ -1760,7 +1760,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts, first=i; last=i; /* We start with root[1], which is the queues top element. */ - queue.root[found]=(byte*) &huff_counts->counts[i]; + queue.root[found]=(uchar*) &huff_counts->counts[i]; } } if (!found) @@ -1771,7 +1771,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts, the loop, which follows the Huffman algorithm. */ if (found < 2) - queue.root[++found]=(byte*) &huff_counts->counts[last ? 0 : 1]; + queue.root[++found]=(uchar*) &huff_counts->counts[last ? 0 : 1]; /* Make a queue from the queue buffer. */ queue.elements=found; @@ -1826,7 +1826,7 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts, queue. This successively replaces the references to counts by references to HUFF_ELEMENTs. */ - queue.root[1]=(byte*) new_huff_el; + queue.root[1]=(uchar*) new_huff_el; queue_replaced(&queue); } DBUG_RETURN(bytes_packed+(bits_packed+7)/8); @@ -1859,12 +1859,12 @@ static uint join_same_trees(HUFF_COUNTS *huff_counts, uint trees) i->tree->tree_pack_length+j->tree->tree_pack_length+ ALLOWED_JOIN_DIFF) { - memcpy_fixed((byte*) i->counts,(byte*) count.counts, + memcpy_fixed((uchar*) i->counts,(uchar*) count.counts, sizeof(count.counts[0])*256); - my_free((gptr) j->tree->element_buffer,MYF(0)); + my_free((uchar*) j->tree->element_buffer,MYF(0)); j->tree->element_buffer=0; j->tree=i->tree; - bmove((byte*) i->counts,(byte*) count.counts, + bmove((uchar*) i->counts,(uchar*) count.counts, sizeof(count.counts[0])*256); if (make_huff_tree(i->tree,i)) return (uint) -1; @@ -2007,7 +2007,7 @@ static char *hexdigits(ulonglong value) static int write_header(PACK_MRG_INFO *mrg,uint head_length,uint trees, my_off_t tot_elements,my_off_t filelength) { - byte *buff= (byte*) file_buffer.pos; + uchar *buff= (uchar*) file_buffer.pos; bzero(buff,HEAD_LENGTH); memcpy_fixed(buff,myisam_pack_file_magic,4); @@ -2023,7 +2023,7 @@ static int write_header(PACK_MRG_INFO *mrg,uint head_length,uint trees, if (test_only) return 0; VOID(my_seek(file_buffer.file,0L,MY_SEEK_SET,MYF(0))); - return my_write(file_buffer.file,(const byte *) file_buffer.pos,HEAD_LENGTH, + return my_write(file_buffer.file,(const uchar *) file_buffer.pos,HEAD_LENGTH, MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)) != 0; } @@ -2159,7 +2159,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees) { /* This should be impossible */ VOID(fprintf(stderr, "Tree offset got too big: %d, aborted\n", huff_tree->max_offset)); - my_afree((gptr) packed_tree); + my_afree((uchar*) packed_tree); return 0; } @@ -2331,7 +2331,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees) DBUG_PRINT("info", (" ")); if (verbose >= 2) VOID(printf("\n")); - my_afree((gptr) packed_tree); + my_afree((uchar*) packed_tree); if (errors) { VOID(fprintf(stderr, "Error: Generated decode trees are corrupt. Stop.\n")); @@ -2412,7 +2412,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) my_off_t record_count; char llbuf[32]; ulong length,pack_length; - byte *record,*pos,*end_pos,*record_pos,*start_pos; + uchar *record,*pos,*end_pos,*record_pos,*start_pos; HUFF_COUNTS *count,*end_count; HUFF_TREE *tree; MI_INFO *isam_file=mrg->file[0]; @@ -2420,7 +2420,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) DBUG_ENTER("compress_isam_file"); /* Allocate a buffer for the records (excluding blobs). */ - if (!(record=(byte*) my_alloca(isam_file->s->base.reclength))) + if (!(record=(uchar*) my_alloca(isam_file->s->base.reclength))) return -1; end_count=huff_counts+isam_file->s->base.fields; @@ -2471,7 +2471,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) { if (flush_buffer((ulong) max_calc_length + (ulong) max_pack_length)) break; - record_pos= (byte*) file_buffer.pos; + record_pos= (uchar*) file_buffer.pos; file_buffer.pos+=max_pack_length; for (start_pos=record, count= huff_counts; count < end_count ; count++) { @@ -2508,7 +2508,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) switch (count->field_type) { case FIELD_SKIP_ZERO: - if (!memcmp((byte*) start_pos,zero_string,field_length)) + if (!memcmp((uchar*) start_pos,zero_string,field_length)) { DBUG_PRINT("fields", ("FIELD_SKIP_ZERO zeroes only, bits: 1")); write_bits(1,1); @@ -2637,7 +2637,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) break; case FIELD_INTERVALL: global_count=count; - pos=(byte*) tree_search(&count->int_tree, start_pos, + pos=(uchar*) tree_search(&count->int_tree, start_pos, count->int_tree.custom_arg); intervall=(uint) (pos - count->tree_buff)/field_length; DBUG_PRINT("fields", ("FIELD_INTERVALL")); @@ -2660,7 +2660,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) } else { - byte *blob,*blob_end; + uchar *blob,*blob_end; DBUG_PRINT("fields", ("FIELD_BLOB not empty, bits: 1")); write_bits(0,1); /* Write the blob length. */ @@ -2701,7 +2701,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) } else { - byte *end= start_pos + var_pack_length + col_length; + uchar *end= start_pos + var_pack_length + col_length; DBUG_PRINT("fields", ("FIELD_VARCHAR not empty, bits: 1")); write_bits(0,1); /* Write the varchar length. */ @@ -2733,7 +2733,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) DBUG_PRINT("fields", ("---")); } flush_bits(); - length=(ulong) ((byte*) file_buffer.pos - record_pos) - max_pack_length; + length=(ulong) ((uchar*) file_buffer.pos - record_pos) - max_pack_length; pack_length= save_pack_length(pack_version, record_pos, length); if (pack_blob_length) pack_length+= save_pack_length(pack_version, record_pos + pack_length, @@ -2773,7 +2773,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) if (verbose >= 2) VOID(printf("wrote %s records.\n", llstr((longlong) record_count, llbuf))); - my_afree((gptr) record); + my_afree((uchar*) record); mrg->ref_length=max_pack_length; mrg->min_pack_length=max_record_length ? min_record_length : 0; mrg->max_pack_length=max_record_length; @@ -2840,7 +2840,7 @@ static int flush_buffer(ulong neaded_length) if (test_only) return 0; if (error_on_write|| my_write(file_buffer.file, - (const byte*) file_buffer.buffer, + (const uchar*) file_buffer.buffer, length, MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL))) { @@ -2867,7 +2867,7 @@ static int flush_buffer(ulong neaded_length) static void end_file_buffer(void) { - my_free((gptr) file_buffer.buffer,MYF(0)); + my_free((uchar*) file_buffer.buffer,MYF(0)); } /* output `bits` low bits of `value' */ @@ -3025,7 +3025,7 @@ static void mrg_reset(PACK_MRG_INFO *mrg) } } -static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf) +static int mrg_rrnd(PACK_MRG_INFO *info,uchar *buf) { int error; MI_INFO *isam_info; @@ -3048,7 +3048,7 @@ static int mrg_rrnd(PACK_MRG_INFO *info,byte *buf) for (;;) { isam_info->update&= HA_STATE_CHANGED; - if (!(error=(*isam_info->s->read_rnd)(isam_info,(byte*) buf, + if (!(error=(*isam_info->s->read_rnd)(isam_info,(uchar*) buf, filepos, 1)) || error != HA_ERR_END_OF_FILE) return (error); @@ -3071,7 +3071,7 @@ static int mrg_close(PACK_MRG_INFO *mrg) for (i=0 ; i < mrg->count ; i++) error|=mi_close(mrg->file[i]); if (mrg->free_file) - my_free((gptr) mrg->file,MYF(0)); + my_free((uchar*) mrg->file,MYF(0)); return error; } @@ -3134,7 +3134,7 @@ static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count) */ if (huff_counts->tree_buff) { - my_free((gptr) huff_counts->tree_buff, MYF(0)); + my_free((uchar*) huff_counts->tree_buff, MYF(0)); delete_tree(&huff_counts->int_tree); huff_counts->tree_buff= NULL; DBUG_PRINT("fakebigcodes", ("freed distinct column values")); diff --git a/storage/myisam/rt_index.c b/storage/myisam/rt_index.c index cf144839dd1..63ed60586d6 100644 --- a/storage/myisam/rt_index.c +++ b/storage/myisam/rt_index.c @@ -141,11 +141,11 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag, res = 1; ok: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); return res; err1: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); info->lastpos = HA_OFFSET_ERROR; return -1; } @@ -356,11 +356,11 @@ static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length, res = 1; ok: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); return res; err1: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); info->lastpos = HA_OFFSET_ERROR; return -1; } @@ -602,11 +602,11 @@ static int rtree_insert_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, } ok: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); DBUG_RETURN(res); err1: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); DBUG_RETURN(-1); /* purecov: inspected */ } @@ -690,10 +690,10 @@ static int rtree_insert_level(MI_INFO *info, uint keynr, uchar *key, DBUG_PRINT("rtree", ("new root page: %lu level: %d nod_flag: %u", (ulong) new_root, 0, mi_test_if_nod(new_root_buf))); - my_afree((byte*)new_root_buf); + my_afree((uchar*)new_root_buf); break; err1: - my_afree((byte*)new_root_buf); + my_afree((uchar*)new_root_buf); DBUG_RETURN(-1); /* purecov: inspected */ } default: @@ -739,7 +739,7 @@ static int rtree_fill_reinsert_list(stPageList *ReinsertList, my_off_t page, if (ReinsertList->n_pages == ReinsertList->m_pages) { ReinsertList->m_pages += REINSERT_BUFFER_INC; - if (!(ReinsertList->pages = (stPageLevel*)my_realloc((gptr)ReinsertList->pages, + if (!(ReinsertList->pages = (stPageLevel*)my_realloc((uchar*)ReinsertList->pages, ReinsertList->m_pages * sizeof(stPageLevel), MYF(MY_ALLOW_ZERO_PTR)))) goto err1; } @@ -891,11 +891,11 @@ static int rtree_delete_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, res = 1; ok: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); DBUG_RETURN(res); err1: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); DBUG_RETURN(-1); /* purecov: inspected */ } @@ -968,7 +968,7 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length) if ((res= rtree_insert_level(info, keynr, k, key_length, ReinsertList.pages[i].level)) == -1) { - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); goto err1; } if (res) @@ -984,13 +984,13 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length) } } } - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); if (_mi_dispose(info, keyinfo, ReinsertList.pages[i].offs, DFLT_INIT_HITS)) goto err1; } if (ReinsertList.pages) - my_free((byte*) ReinsertList.pages, MYF(0)); + my_free((uchar*) ReinsertList.pages, MYF(0)); /* check for redundant root (not leaf, 1 child) and eliminate */ if ((old_root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR) @@ -1117,11 +1117,11 @@ ha_rows rtree_estimate(MI_INFO *info, uint keynr, uchar *key, res = HA_POS_ERROR; } - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); return res; err1: - my_afree((byte*)page_buf); + my_afree((uchar*)page_buf); return HA_POS_ERROR; } diff --git a/storage/myisam/rt_split.c b/storage/myisam/rt_split.c index 0f6dc872958..ef988dbd048 100644 --- a/storage/myisam/rt_split.c +++ b/storage/myisam/rt_split.c @@ -345,10 +345,10 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key, DFLT_INIT_HITS, new_page); DBUG_PRINT("rtree", ("split new block: %lu", (ulong) *new_page_offs)); - my_afree((byte*)new_page); + my_afree((uchar*)new_page); split_err: - my_afree((byte*) coord_buf); + my_afree((uchar*) coord_buf); DBUG_RETURN(err_code); } diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index 53eb6b2e310..c7d970768f4 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -84,7 +84,7 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, char* key, uint sort_length, uint count); static inline int -my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs); +my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs); /* Creates a index of sorted keys @@ -163,7 +163,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer, maxbuffer/2)) { - my_free((gptr) sort_keys,MYF(0)); + my_free((uchar*) sort_keys,MYF(0)); sort_keys= 0; } else @@ -230,9 +230,9 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, reinit_io_cache(&tempfile_for_exceptions,READ_CACHE,0L,0,0)) goto err; - while (!my_b_read(&tempfile_for_exceptions,(byte*)&key_length, + while (!my_b_read(&tempfile_for_exceptions,(uchar*)&key_length, sizeof(key_length)) - && !my_b_read(&tempfile_for_exceptions,(byte*)sort_keys, + && !my_b_read(&tempfile_for_exceptions,(uchar*)sort_keys, (uint) key_length)) { if (_mi_ck_write(idx,keyno,(uchar*) sort_keys,key_length-ref_length)) @@ -244,7 +244,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, err: if (sort_keys) - my_free((gptr) sort_keys,MYF(0)); + my_free((uchar*) sort_keys,MYF(0)); delete_dynamic(&buffpek); close_cached_file(&tempfile); close_cached_file(&tempfile_for_exceptions); @@ -383,7 +383,7 @@ pthread_handler_t thr_find_all_keys(void *arg) if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK), maxbuffer, maxbuffer/2)) { - my_free((gptr) sort_keys,MYF(0)); + my_free((uchar*) sort_keys,MYF(0)); sort_keys= (uchar **) NULL; /* for err: label */ } else @@ -453,7 +453,7 @@ err: DBUG_PRINT("error", ("got some error")); sort_param->sort_info->got_error= 1; /* no need to protect with a mutex */ if (sort_keys) - my_free((gptr) sort_keys,MYF(0)); + my_free((uchar*) sort_keys,MYF(0)); sort_param->sort_keys= 0; delete_dynamic(& sort_param->buffpek); close_cached_file(&sort_param->tempfile); @@ -495,7 +495,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) MI_INFO *info=sort_info->info; MYISAM_SHARE *share=info->s; MI_SORT_PARAM *sinfo; - byte *mergebuf=0; + uchar *mergebuf=0; DBUG_ENTER("thr_write_keys"); LINT_INIT(length); @@ -530,7 +530,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) sinfo->notnull: NULL, (ulonglong) info->state->records); } - my_free((gptr) sinfo->sort_keys,MYF(0)); + my_free((uchar*) sinfo->sort_keys,MYF(0)); my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff), MYF(MY_ALLOW_ZERO_PTR)); sinfo->sort_keys=0; @@ -621,12 +621,12 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) } while (!got_error && - !my_b_read(&sinfo->tempfile_for_exceptions,(byte*)&key_length, + !my_b_read(&sinfo->tempfile_for_exceptions,(uchar*)&key_length, sizeof(key_length))) { - byte ft_buf[HA_FT_MAXBYTELEN + HA_FT_WLEN + 10]; + uchar ft_buf[HA_FT_MAXBYTELEN + HA_FT_WLEN + 10]; if (key_length > sizeof(ft_buf) || - my_b_read(&sinfo->tempfile_for_exceptions, (byte*)ft_buf, + my_b_read(&sinfo->tempfile_for_exceptions, (uchar*)ft_buf, (uint)key_length) || _mi_ck_write(info, sinfo->key, (uchar*)ft_buf, key_length - info->s->rec_reflength)) @@ -634,7 +634,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) } } } - my_free((gptr) mergebuf,MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) mergebuf,MYF(MY_ALLOW_ZERO_PTR)); DBUG_RETURN(got_error); } #endif /* THREAD */ @@ -648,7 +648,7 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, uint sort_length=info->key_length; DBUG_ENTER("write_keys"); - qsort2((byte*) sort_keys,count,sizeof(byte*),(qsort2_cmp) info->key_cmp, + qsort2((uchar*) sort_keys,count,sizeof(uchar*),(qsort2_cmp) info->key_cmp, info); if (!my_b_inited(tempfile) && open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST", @@ -660,7 +660,7 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, for (end=sort_keys+count ; sort_keys != end ; sort_keys++) { - if (my_b_write(tempfile,(byte*) *sort_keys,(uint) sort_length)) + if (my_b_write(tempfile,(uchar*) *sort_keys,(uint) sort_length)) DBUG_RETURN(1); /* purecov: inspected */ } DBUG_RETURN(0); @@ -668,13 +668,13 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, static inline int -my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs) +my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs) { int err; uint16 len = _mi_keylength(info->keyinfo, (uchar*) bufs); /* The following is safe as this is a local file */ - if ((err= my_b_write(to_file, (byte*)&len, sizeof(len)))) + if ((err= my_b_write(to_file, (uchar*)&len, sizeof(len)))) return (err); if ((err= my_b_write(to_file,bufs, (uint) len))) return (err); @@ -691,7 +691,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, int err; DBUG_ENTER("write_keys_varlen"); - qsort2((byte*) sort_keys,count,sizeof(byte*),(qsort2_cmp) info->key_cmp, + qsort2((uchar*) sort_keys,count,sizeof(uchar*),(qsort2_cmp) info->key_cmp, info); if (!my_b_inited(tempfile) && open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST", @@ -702,7 +702,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, buffpek->count=count; for (end=sort_keys+count ; sort_keys != end ; sort_keys++) { - if ((err= my_var_write(info,tempfile, (byte*) *sort_keys))) + if ((err= my_var_write(info,tempfile, (uchar*) *sort_keys))) DBUG_RETURN(err); } DBUG_RETURN(0); @@ -720,8 +720,8 @@ static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key, DISK_BUFFER_SIZE, info->sort_info->param->myf_rw)) DBUG_RETURN(1); - if (my_b_write(tempfile,(byte*)&key_length,sizeof(key_length)) || - my_b_write(tempfile,(byte*)key,(uint) key_length)) + if (my_b_write(tempfile,(uchar*)&key_length,sizeof(key_length)) || + my_b_write(tempfile,(uchar*)key,(uint) key_length)) DBUG_RETURN(1); DBUG_RETURN(0); } /* write_key */ @@ -734,7 +734,7 @@ static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys, { DBUG_ENTER("write_index"); - qsort2((gptr) sort_keys,(size_t) count,sizeof(byte*), + qsort2((uchar*) sort_keys,(size_t) count,sizeof(uchar*), (qsort2_cmp) info->key_cmp,info); while (count--) { @@ -812,7 +812,7 @@ static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count))) { - if (my_pread(fromfile->file,(byte*) buffpek->base, + if (my_pread(fromfile->file,(uchar*) buffpek->base, (length= sort_length*count),buffpek->file_pos,MYF_RW)) return((uint) -1); /* purecov: inspected */ buffpek->key=buffpek->base; @@ -837,11 +837,11 @@ static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek, for (idx=1;idx<=count;idx++) { - if (my_pread(fromfile->file,(byte*)&length_of_key,sizeof(length_of_key), + if (my_pread(fromfile->file,(uchar*)&length_of_key,sizeof(length_of_key), buffpek->file_pos,MYF_RW)) return((uint) -1); buffpek->file_pos+=sizeof(length_of_key); - if (my_pread(fromfile->file,(byte*) buffp,length_of_key, + if (my_pread(fromfile->file,(uchar*) buffp,length_of_key, buffpek->file_pos,MYF_RW)) return((uint) -1); buffpek->file_pos+=length_of_key; @@ -865,7 +865,7 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, for (idx=1;idx<=count;idx++) { int err; - if ((err= my_var_write(info,to_file, (byte*) bufs))) + if ((err= my_var_write(info,to_file, (uchar*) bufs))) return (err); bufs=bufs+sort_length; } @@ -877,7 +877,7 @@ static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)), IO_CACHE *to_file, char* key, uint sort_length, uint count) { - return my_b_write(to_file,(byte*) key,(uint) sort_length*count); + return my_b_write(to_file,(uchar*) key,(uint) sort_length*count); } /* @@ -909,7 +909,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, sort_length=info->key_length; if (init_queue(&queue,(uint) (Tb-Fb)+1,offsetof(BUFFPEK,key),0, - (int (*)(void*, byte *,byte*)) info->key_cmp, + (int (*)(void*, uchar *,uchar*)) info->key_cmp, (void*) info)) DBUG_RETURN(1); /* purecov: inspected */ @@ -936,7 +936,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, buffpek=(BUFFPEK*) queue_top(&queue); if (to_file) { - if (info->write_key(info,to_file,(byte*) buffpek->key, + if (info->write_key(info,to_file,(uchar*) buffpek->key, (uint) sort_length,1)) { error=1; goto err; /* purecov: inspected */ @@ -992,7 +992,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, { if (to_file) { - if (info->write_key(info,to_file,(byte*) buffpek->key, + if (info->write_key(info,to_file,(uchar*) buffpek->key, sort_length,buffpek->mem_count)) { error=1; goto err; /* purecov: inspected */ @@ -1045,7 +1045,7 @@ flush_ft_buf(MI_SORT_PARAM *info) if (info->sort_info->ft_buf) { err=sort_ft_buf_flush(info); - my_free((gptr)info->sort_info->ft_buf, MYF(0)); + my_free((uchar*)info->sort_info->ft_buf, MYF(0)); info->sort_info->ft_buf=0; } return err; diff --git a/storage/myisam/sp_defs.h b/storage/myisam/sp_defs.h index 11254d16c97..187ec62b2a3 100644 --- a/storage/myisam/sp_defs.h +++ b/storage/myisam/sp_defs.h @@ -40,7 +40,7 @@ enum wkbByteOrder }; uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key, - const byte *record, my_off_t filepos); + const uchar *record, my_off_t filepos); #endif /*HAVE_SPATIAL*/ #endif /* _SP_DEFS_H */ diff --git a/storage/myisam/sp_key.c b/storage/myisam/sp_key.c index 34c96a219c7..be4021935c4 100644 --- a/storage/myisam/sp_key.c +++ b/storage/myisam/sp_key.c @@ -31,25 +31,25 @@ static int sp_get_geometry_mbr(uchar *(*wkb), uchar *end, uint n_dims, double *mbr, int top); static int sp_mbr_from_wkb(uchar (*wkb), uint size, uint n_dims, double *mbr); -static void get_double(double *d, const byte *pos) +static void get_double(double *d, const uchar *pos) { float8get(*d, pos); } uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key, - const byte *record, my_off_t filepos) + const uchar *record, my_off_t filepos) { HA_KEYSEG *keyseg; MI_KEYDEF *keyinfo = &info->s->keyinfo[keynr]; uint len = 0; - byte *pos; + uchar *pos; uint dlen; uchar *dptr; double mbr[SPDIMS * 2]; uint i; keyseg = &keyinfo->seg[-1]; - pos = (byte*)record + keyseg->start; + pos = (uchar*)record + keyseg->start; dlen = _mi_calc_blob_length(keyseg->bit_start, pos); memcpy_fixed(&dptr, pos + keyseg->bit_start, sizeof(char*)); @@ -64,7 +64,7 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key, { uint length = keyseg->length; - pos = ((byte*)mbr) + keyseg->start; + pos = ((uchar*)mbr) + keyseg->start; if (keyseg->flag & HA_SWAP_KEY) { #ifdef HAVE_ISNAN @@ -100,7 +100,7 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key, } else { - memcpy((byte*)key, pos, length); + memcpy((uchar*)key, pos, length); key += keyseg->length; } len += keyseg->length; @@ -141,7 +141,7 @@ static int sp_add_point_to_mbr(uchar *(*wkb), uchar *end, uint n_dims, { if ((*wkb) > end - 8) return -1; - get_double(&ord, (const byte*) *wkb); + get_double(&ord, (const uchar*) *wkb); (*wkb)+= 8; if (ord < *mbr) float8store((char*) mbr, ord); diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 96f7db6e633..3399694ecc3 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -120,12 +120,12 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked) u_table->table->s->base.keys, u_table->table->s->base.fields, false)) { - my_free((gptr) recinfo, MYF(0)); + my_free((uchar*) recinfo, MYF(0)); error= HA_ERR_WRONG_MRG_TABLE_DEF; goto err; } } - my_free((gptr) recinfo, MYF(0)); + my_free((uchar*) recinfo, MYF(0)); #if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4 /* Merge table has more than 2G rows */ if (table->s->crashed) @@ -146,7 +146,7 @@ int ha_myisammrg::close(void) return myrg_close(file); } -int ha_myisammrg::write_row(byte * buf) +int ha_myisammrg::write_row(uchar * buf) { statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status); @@ -164,7 +164,7 @@ int ha_myisammrg::write_row(byte * buf) return myrg_write(file,buf); } -int ha_myisammrg::update_row(const byte * old_data, byte * new_data) +int ha_myisammrg::update_row(const uchar * old_data, uchar * new_data) { statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status); if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) @@ -172,13 +172,13 @@ int ha_myisammrg::update_row(const byte * old_data, byte * new_data) return myrg_update(file,old_data,new_data); } -int ha_myisammrg::delete_row(const byte * buf) +int ha_myisammrg::delete_row(const uchar * buf) { statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status); return myrg_delete(file,buf); } -int ha_myisammrg::index_read(byte * buf, const byte * key, +int ha_myisammrg::index_read(uchar * buf, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag) { @@ -189,7 +189,7 @@ int ha_myisammrg::index_read(byte * buf, const byte * key, return error; } -int ha_myisammrg::index_read_idx(byte * buf, uint index, const byte * key, +int ha_myisammrg::index_read_idx(uchar * buf, uint index, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag) { @@ -200,7 +200,7 @@ int ha_myisammrg::index_read_idx(byte * buf, uint index, const byte * key, return error; } -int ha_myisammrg::index_read_last(byte * buf, const byte * key, +int ha_myisammrg::index_read_last(uchar * buf, const uchar * key, key_part_map keypart_map) { statistic_increment(table->in_use->status_var.ha_read_key_count, @@ -211,7 +211,7 @@ int ha_myisammrg::index_read_last(byte * buf, const byte * key, return error; } -int ha_myisammrg::index_next(byte * buf) +int ha_myisammrg::index_next(uchar * buf) { statistic_increment(table->in_use->status_var.ha_read_next_count, &LOCK_status); @@ -220,7 +220,7 @@ int ha_myisammrg::index_next(byte * buf) return error; } -int ha_myisammrg::index_prev(byte * buf) +int ha_myisammrg::index_prev(uchar * buf) { statistic_increment(table->in_use->status_var.ha_read_prev_count, &LOCK_status); @@ -229,7 +229,7 @@ int ha_myisammrg::index_prev(byte * buf) return error; } -int ha_myisammrg::index_first(byte * buf) +int ha_myisammrg::index_first(uchar * buf) { statistic_increment(table->in_use->status_var.ha_read_first_count, &LOCK_status); @@ -238,7 +238,7 @@ int ha_myisammrg::index_first(byte * buf) return error; } -int ha_myisammrg::index_last(byte * buf) +int ha_myisammrg::index_last(uchar * buf) { statistic_increment(table->in_use->status_var.ha_read_last_count, &LOCK_status); @@ -247,8 +247,8 @@ int ha_myisammrg::index_last(byte * buf) return error; } -int ha_myisammrg::index_next_same(byte * buf, - const byte *key __attribute__((unused)), +int ha_myisammrg::index_next_same(uchar * buf, + const uchar *key __attribute__((unused)), uint length __attribute__((unused))) { statistic_increment(table->in_use->status_var.ha_read_next_count, @@ -265,7 +265,7 @@ int ha_myisammrg::rnd_init(bool scan) } -int ha_myisammrg::rnd_next(byte *buf) +int ha_myisammrg::rnd_next(uchar *buf) { statistic_increment(table->in_use->status_var.ha_read_rnd_next_count, &LOCK_status); @@ -275,7 +275,7 @@ int ha_myisammrg::rnd_next(byte *buf) } -int ha_myisammrg::rnd_pos(byte * buf, byte *pos) +int ha_myisammrg::rnd_pos(uchar * buf, uchar *pos) { statistic_increment(table->in_use->status_var.ha_read_rnd_count, &LOCK_status); @@ -284,7 +284,7 @@ int ha_myisammrg::rnd_pos(byte * buf, byte *pos) return error; } -void ha_myisammrg::position(const byte *record) +void ha_myisammrg::position(const uchar *record) { ulonglong row_position= myrg_position(file); my_store_ptr(ref, ref_length, (my_off_t) row_position); @@ -474,8 +474,8 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info) goto err; create_info->merge_list.elements++; - (*create_info->merge_list.next) = (byte*) ptr; - create_info->merge_list.next= (byte**) &ptr->next_local; + (*create_info->merge_list.next) = (uchar*) ptr; + create_info->merge_list.next= (uchar**) &ptr->next_local; } *create_info->merge_list.next=0; } diff --git a/storage/myisammrg/ha_myisammrg.h b/storage/myisammrg/ha_myisammrg.h index 7bbe659d4b7..88bb5dd2e21 100644 --- a/storage/myisammrg/ha_myisammrg.h +++ b/storage/myisammrg/ha_myisammrg.h @@ -53,23 +53,23 @@ class ha_myisammrg: public handler int open(const char *name, int mode, uint test_if_locked); int close(void); - int write_row(byte * buf); - int update_row(const byte * old_data, byte * new_data); - int delete_row(const byte * buf); - int index_read(byte * buf, const byte * key, key_part_map keypart_map, + int write_row(uchar * buf); + int update_row(const uchar * old_data, uchar * new_data); + int delete_row(const uchar * buf); + int index_read(uchar * buf, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag); - int index_read_idx(byte * buf, uint index, const byte * key, + int index_read_idx(uchar * buf, uint index, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag); - int index_read_last(byte * buf, const byte * key, key_part_map keypart_map); - int index_next(byte * buf); - int index_prev(byte * buf); - int index_first(byte * buf); - int index_last(byte * buf); - int index_next_same(byte *buf, const byte *key, uint keylen); + int index_read_last(uchar * buf, const uchar * key, key_part_map keypart_map); + int index_next(uchar * buf); + int index_prev(uchar * buf); + int index_first(uchar * buf); + int index_last(uchar * buf); + int index_next_same(uchar *buf, const uchar *key, uint keylen); int rnd_init(bool scan); - int rnd_next(byte *buf); - int rnd_pos(byte * buf, byte *pos); - void position(const byte *record); + int rnd_next(uchar *buf); + int rnd_pos(uchar * buf, uchar *pos); + void position(const uchar *record); ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key); int info(uint); int reset(void); diff --git a/storage/myisammrg/myrg_close.c b/storage/myisammrg/myrg_close.c index 971a83928b1..baae24634b3 100644 --- a/storage/myisammrg/myrg_close.c +++ b/storage/myisammrg/myrg_close.c @@ -30,7 +30,7 @@ int myrg_close(MYRG_INFO *info) pthread_mutex_lock(&THR_LOCK_open); myrg_open_list=list_delete(myrg_open_list,&info->open_list); pthread_mutex_unlock(&THR_LOCK_open); - my_free((gptr) info,MYF(0)); + my_free((uchar*) info,MYF(0)); if (error) { DBUG_RETURN(my_errno=error); diff --git a/storage/myisammrg/myrg_def.h b/storage/myisammrg/myrg_def.h index 344bd4edd3c..ec33d2c0bb4 100644 --- a/storage/myisammrg/myrg_def.h +++ b/storage/myisammrg/myrg_def.h @@ -28,5 +28,5 @@ extern pthread_mutex_t THR_LOCK_open; #endif int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag); -int _myrg_mi_read_record(MI_INFO *info, byte *buf); +int _myrg_mi_read_record(MI_INFO *info, uchar *buf); diff --git a/storage/myisammrg/myrg_delete.c b/storage/myisammrg/myrg_delete.c index f9604f66885..93d45198b36 100644 --- a/storage/myisammrg/myrg_delete.c +++ b/storage/myisammrg/myrg_delete.c @@ -17,7 +17,7 @@ #include "myrg_def.h" -int myrg_delete(MYRG_INFO *info, const byte *record) +int myrg_delete(MYRG_INFO *info, const uchar *record) { if (!info->current_table) return (my_errno= HA_ERR_NO_ACTIVE_RECORD); diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c index 3dbb605463e..cca81f0f605 100644 --- a/storage/myisammrg/myrg_open.c +++ b/storage/myisammrg/myrg_open.c @@ -40,6 +40,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) IO_CACHE file; MI_INFO *isam=0; uint found_merge_insert_method= 0; + size_t name_buff_length; DBUG_ENTER("myrg_open"); LINT_INIT(key_parts); @@ -48,13 +49,13 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) if ((fd=my_open(fn_format(name_buff,name,"",MYRG_NAME_EXT, MY_UNPACK_FILENAME|MY_APPEND_EXT), O_RDONLY | O_SHARE,MYF(0))) < 0) - goto err; - errpos=1; - if (init_io_cache(&file, fd, 4*IO_SIZE, READ_CACHE, 0, 0, + goto err; + errpos=1; + if (init_io_cache(&file, fd, 4*IO_SIZE, READ_CACHE, 0, 0, MYF(MY_WME | MY_NABP))) - goto err; - errpos=2; - dir_length=dirname_part(name_buff,name); + goto err; + errpos=2; + dir_length=dirname_part(name_buff, name, &name_buff_length); while ((length=my_b_gets(&file,buff,FN_REFLEN-1))) { if ((end=buff+length)[-1] == '\n') diff --git a/storage/myisammrg/myrg_queue.c b/storage/myisammrg/myrg_queue.c index 1d252207db1..d2579053784 100644 --- a/storage/myisammrg/myrg_queue.c +++ b/storage/myisammrg/myrg_queue.c @@ -15,7 +15,7 @@ #include "myrg_def.h" -static int queue_key_cmp(void *keyseg, byte *a, byte *b) +static int queue_key_cmp(void *keyseg, uchar *a, uchar *b) { MYRG_TABLE *ma= (MYRG_TABLE *)a; MYRG_TABLE *mb= (MYRG_TABLE *)b; @@ -69,7 +69,7 @@ int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag) return error; } -int _myrg_mi_read_record(MI_INFO *info, byte *buf) +int _myrg_mi_read_record(MI_INFO *info, uchar *buf) { if (!(*info->read_record)(info,info->lastpos,buf)) { diff --git a/storage/myisammrg/myrg_rfirst.c b/storage/myisammrg/myrg_rfirst.c index 80736537d02..9d7b0f9e83f 100644 --- a/storage/myisammrg/myrg_rfirst.c +++ b/storage/myisammrg/myrg_rfirst.c @@ -17,7 +17,7 @@ /* Read first row according to specific key */ -int myrg_rfirst(MYRG_INFO *info, byte *buf, int inx) +int myrg_rfirst(MYRG_INFO *info, uchar *buf, int inx) { MYRG_TABLE *table; MI_INFO *mi; @@ -35,7 +35,7 @@ int myrg_rfirst(MYRG_INFO *info, byte *buf, int inx) return err; } /* adding to queue */ - queue_insert(&(info->by_key),(byte *)table); + queue_insert(&(info->by_key),(uchar *)table); } /* We have done a read in all tables */ info->last_used_table=table; diff --git a/storage/myisammrg/myrg_rkey.c b/storage/myisammrg/myrg_rkey.c index 2d744ae31ec..8e7886f5a43 100644 --- a/storage/myisammrg/myrg_rkey.c +++ b/storage/myisammrg/myrg_rkey.c @@ -35,10 +35,10 @@ SerG */ -int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key, +int myrg_rkey(MYRG_INFO *info,uchar *buf,int inx, const uchar *key, key_part_map keypart_map, enum ha_rkey_function search_flag) { - byte *key_buff; + uchar *key_buff; uint pack_key_length; uint16 last_used_keyseg; MYRG_TABLE *table; @@ -60,7 +60,7 @@ int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key, { err=mi_rkey(mi, 0, inx, key, keypart_map, search_flag); /* Get the saved packed key and packed key length. */ - key_buff=(byte*) mi->lastkey+mi->s->base.max_key_length; + key_buff=(uchar*) mi->lastkey+mi->s->base.max_key_length; pack_key_length=mi->pack_key_length; last_used_keyseg= mi->last_used_keyseg; } @@ -80,7 +80,7 @@ int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key, DBUG_RETURN(err); } /* adding to queue */ - queue_insert(&(info->by_key),(byte *)table); + queue_insert(&(info->by_key),(uchar *)table); } @@ -92,6 +92,6 @@ int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key, mi->once_flags|= RRND_PRESERVE_LASTINX; DBUG_PRINT("info", ("using table no: %d", (int) (info->current_table - info->open_tables + 1))); - DBUG_DUMP("result key", (byte*) mi->lastkey, mi->lastkey_length); + DBUG_DUMP("result key", (uchar*) mi->lastkey, mi->lastkey_length); DBUG_RETURN(_myrg_mi_read_record(mi,buf)); } diff --git a/storage/myisammrg/myrg_rlast.c b/storage/myisammrg/myrg_rlast.c index f364bf9b32f..8086a2f8104 100644 --- a/storage/myisammrg/myrg_rlast.c +++ b/storage/myisammrg/myrg_rlast.c @@ -17,7 +17,7 @@ /* Read last row with the same key as the previous read. */ -int myrg_rlast(MYRG_INFO *info, byte *buf, int inx) +int myrg_rlast(MYRG_INFO *info, uchar *buf, int inx) { MYRG_TABLE *table; MI_INFO *mi; @@ -35,7 +35,7 @@ int myrg_rlast(MYRG_INFO *info, byte *buf, int inx) return err; } /* adding to queue */ - queue_insert(&(info->by_key),(byte *)table); + queue_insert(&(info->by_key),(uchar *)table); } /* We have done a read in all tables */ info->last_used_table=table; diff --git a/storage/myisammrg/myrg_rnext.c b/storage/myisammrg/myrg_rnext.c index de1aa4df4b6..82d5cbf38b1 100644 --- a/storage/myisammrg/myrg_rnext.c +++ b/storage/myisammrg/myrg_rnext.c @@ -19,7 +19,7 @@ Read next row with the same key as previous read */ -int myrg_rnext(MYRG_INFO *info, byte *buf, int inx) +int myrg_rnext(MYRG_INFO *info, uchar *buf, int inx) { int err; MI_INFO *mi; @@ -42,7 +42,7 @@ int myrg_rnext(MYRG_INFO *info, byte *buf, int inx) else { /* Found here, adding to queue */ - queue_top(&(info->by_key))=(byte *)(info->current_table); + queue_top(&(info->by_key))=(uchar *)(info->current_table); queue_replaced(&(info->by_key)); } diff --git a/storage/myisammrg/myrg_rnext_same.c b/storage/myisammrg/myrg_rnext_same.c index 9c6b522ee8a..ad7bbfb0f6e 100644 --- a/storage/myisammrg/myrg_rnext_same.c +++ b/storage/myisammrg/myrg_rnext_same.c @@ -16,7 +16,7 @@ #include "myrg_def.h" -int myrg_rnext_same(MYRG_INFO *info, byte *buf) +int myrg_rnext_same(MYRG_INFO *info, uchar *buf) { int err; MI_INFO *mi; @@ -39,7 +39,7 @@ int myrg_rnext_same(MYRG_INFO *info, byte *buf) else { /* Found here, adding to queue */ - queue_top(&(info->by_key))=(byte *)(info->current_table); + queue_top(&(info->by_key))=(uchar *)(info->current_table); queue_replaced(&(info->by_key)); } diff --git a/storage/myisammrg/myrg_rprev.c b/storage/myisammrg/myrg_rprev.c index b1b86a93fad..66c94974940 100644 --- a/storage/myisammrg/myrg_rprev.c +++ b/storage/myisammrg/myrg_rprev.c @@ -19,7 +19,7 @@ Read previous row with the same key as previous read */ -int myrg_rprev(MYRG_INFO *info, byte *buf, int inx) +int myrg_rprev(MYRG_INFO *info, uchar *buf, int inx) { int err; MI_INFO *mi; @@ -42,7 +42,7 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx) else { /* Found here, adding to queue */ - queue_top(&(info->by_key))=(byte *)(info->current_table); + queue_top(&(info->by_key))=(uchar *)(info->current_table); queue_replaced(&(info->by_key)); } diff --git a/storage/myisammrg/myrg_rrnd.c b/storage/myisammrg/myrg_rrnd.c index 55e72b2170d..b598563680c 100644 --- a/storage/myisammrg/myrg_rrnd.c +++ b/storage/myisammrg/myrg_rrnd.c @@ -30,7 +30,7 @@ static MYRG_TABLE *find_table(MYRG_TABLE *start,MYRG_TABLE *end,ulonglong pos); HA_ERR_END_OF_FILE = EOF. */ -int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos) +int myrg_rrnd(MYRG_INFO *info,uchar *buf,ulonglong filepos) { int error; MI_INFO *isam_info; @@ -47,7 +47,7 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos) } isam_info=(info->current_table=info->open_tables)->table; if (info->cache_in_use) - mi_extra(isam_info,HA_EXTRA_CACHE,(byte*) &info->cache_size); + mi_extra(isam_info,HA_EXTRA_CACHE,(uchar*) &info->cache_size); filepos=isam_info->s->pack.header_length; isam_info->lastinx= (uint) -1; /* Can't forward or backward */ } @@ -60,20 +60,20 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos) for (;;) { isam_info->update&= HA_STATE_CHANGED; - if ((error=(*isam_info->s->read_rnd)(isam_info,(byte*) buf, + if ((error=(*isam_info->s->read_rnd)(isam_info,(uchar*) buf, (my_off_t) filepos,1)) != HA_ERR_END_OF_FILE) DBUG_RETURN(error); if (info->cache_in_use) mi_extra(info->current_table->table, HA_EXTRA_NO_CACHE, - (byte*) &info->cache_size); + (uchar*) &info->cache_size); if (info->current_table+1 == info->end_table) DBUG_RETURN(HA_ERR_END_OF_FILE); info->current_table++; info->last_used_table=info->current_table; if (info->cache_in_use) mi_extra(info->current_table->table, HA_EXTRA_CACHE, - (byte*) &info->cache_size); + (uchar*) &info->cache_size); info->current_table->file_offset= info->current_table[-1].file_offset+ info->current_table[-1].table->state->data_file_length; @@ -88,7 +88,7 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos) isam_info=info->current_table->table; isam_info->update&= HA_STATE_CHANGED; DBUG_RETURN((*isam_info->s->read_rnd) - (isam_info, (byte*) buf, + (isam_info, (uchar*) buf, (my_off_t) (filepos - info->current_table->file_offset), 0)); } diff --git a/storage/myisammrg/myrg_rsame.c b/storage/myisammrg/myrg_rsame.c index 56b16c0aa3c..2f7523759dc 100644 --- a/storage/myisammrg/myrg_rsame.c +++ b/storage/myisammrg/myrg_rsame.c @@ -15,7 +15,7 @@ #include "myrg_def.h" -int myrg_rsame(MYRG_INFO *info,byte *record,int inx) +int myrg_rsame(MYRG_INFO *info,uchar *record,int inx) { if (inx) /* not yet used, should be 0 */ return (my_errno=HA_ERR_WRONG_INDEX); diff --git a/storage/myisammrg/myrg_update.c b/storage/myisammrg/myrg_update.c index ba667d69f12..5d883be8484 100644 --- a/storage/myisammrg/myrg_update.c +++ b/storage/myisammrg/myrg_update.c @@ -17,7 +17,7 @@ #include "myrg_def.h" -int myrg_update(register MYRG_INFO *info,const byte *oldrec, byte *newrec) +int myrg_update(register MYRG_INFO *info,const uchar *oldrec, uchar *newrec) { if (!info->current_table) return (my_errno=HA_ERR_NO_ACTIVE_RECORD); diff --git a/storage/myisammrg/myrg_write.c b/storage/myisammrg/myrg_write.c index ed0a4a7996a..27534df2821 100644 --- a/storage/myisammrg/myrg_write.c +++ b/storage/myisammrg/myrg_write.c @@ -17,7 +17,7 @@ #include "myrg_def.h" -int myrg_write(register MYRG_INFO *info, byte *rec) +int myrg_write(register MYRG_INFO *info, uchar *rec) { /* [phi] MERGE_WRITE_DISABLED is handled by the else case */ if (info->merge_insert_method == MERGE_INSERT_TO_FIRST) diff --git a/storage/ndb/include/util/ndb_opts.h b/storage/ndb/include/util/ndb_opts.h index 9cb65d4bc2e..f18bb9646cc 100644 --- a/storage/ndb/include/util/ndb_opts.h +++ b/storage/ndb/include/util/ndb_opts.h @@ -58,40 +58,40 @@ const char *opt_debug= 0; "Set connect string for connecting to ndb_mgmd. " \ "Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". " \ "Overrides specifying entries in NDB_CONNECTSTRING and my.cnf", \ - (gptr*) &opt_ndb_connectstring, (gptr*) &opt_ndb_connectstring, \ + (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ { "ndb-mgmd-host", OPT_NDB_MGMD, \ "Set host and port for connecting to ndb_mgmd. " \ "Syntax: <hostname>[:<port>].", \ - (gptr*) &opt_ndb_mgmd, (gptr*) &opt_ndb_mgmd, 0, \ + (uchar**) &opt_ndb_mgmd, (uchar**) &opt_ndb_mgmd, 0, \ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ { "ndb-nodeid", OPT_NDB_NODEID, \ "Set node id for this node.", \ - (gptr*) &opt_ndb_nodeid, (gptr*) &opt_ndb_nodeid, 0, \ + (uchar**) &opt_ndb_nodeid, (uchar**) &opt_ndb_nodeid, 0, \ GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ { "ndb-shm", OPT_NDB_SHM,\ "Allow optimizing using shared memory connections when available",\ - (gptr*) &opt_ndb_shm, (gptr*) &opt_ndb_shm, 0,\ + (uchar**) &opt_ndb_shm, (uchar**) &opt_ndb_shm, 0,\ GET_BOOL, NO_ARG, OPT_NDB_SHM_DEFAULT, 0, 0, 0, 0, 0 },\ {"ndb-optimized-node-selection", OPT_NDB_OPTIMIZED_NODE_SELECTION,\ "Select nodes for transactions in a more optimal way",\ - (gptr*) &opt_ndb_optimized_node_selection,\ - (gptr*) &opt_ndb_optimized_node_selection, 0,\ + (uchar**) &opt_ndb_optimized_node_selection,\ + (uchar**) &opt_ndb_optimized_node_selection, 0,\ GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},\ { "connect-string", OPT_NDB_CONNECTSTRING, "same as --ndb-connectstring",\ - (gptr*) &opt_ndb_connectstring, (gptr*) &opt_ndb_connectstring, \ + (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ { "core-file", OPT_WANT_CORE, "Write core on errors.",\ - (gptr*) &opt_core, (gptr*) &opt_core, 0,\ + (uchar**) &opt_core, (uchar**) &opt_core, 0,\ GET_BOOL, NO_ARG, OPT_WANT_CORE_DEFAULT, 0, 0, 0, 0, 0},\ {"character-sets-dir", OPT_CHARSETS_DIR,\ - "Directory where character sets are.", (gptr*) &charsets_dir,\ - (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}\ + "Directory where character sets are.", (uchar**) &charsets_dir,\ + (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}\ #ifndef DBUG_OFF #define NDB_STD_OPTS(prog_name) \ { "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", \ - (gptr*) &opt_debug, (gptr*) &opt_debug, \ + (uchar**) &opt_debug, (uchar**) &opt_debug, \ 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, \ NDB_STD_OPTS_COMMON #else diff --git a/storage/ndb/src/cw/cpcd/main.cpp b/storage/ndb/src/cw/cpcd/main.cpp index f23a92b8010..d5c31d610cb 100644 --- a/storage/ndb/src/cw/cpcd/main.cpp +++ b/storage/ndb/src/cw/cpcd/main.cpp @@ -39,22 +39,22 @@ static const char *user = 0; static struct my_option my_long_options[] = { { "work-dir", 'w', "Work directory", - (gptr*) &work_dir, (gptr*) &work_dir, 0, + (uchar**) &work_dir, (uchar**) &work_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "port", 'p', "TCP port to listen on", - (gptr*) &port, (gptr*) &port, 0, + (uchar**) &port, (uchar**) &port, 0, GET_INT, REQUIRED_ARG, CPCD_DEFAULT_TCP_PORT, 0, 0, 0, 0, 0 }, { "syslog", 'S', "Log events to syslog", - (gptr*) &use_syslog, (gptr*) &use_syslog, 0, + (uchar**) &use_syslog, (uchar**) &use_syslog, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "logfile", 'L', "File to log events to", - (gptr*) &logfile, (gptr*) &logfile, 0, + (uchar**) &logfile, (uchar**) &logfile, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "debug", 'D', "Enable debug mode", - (gptr*) &debug, (gptr*) &debug, 0, + (uchar**) &debug, (uchar**) &debug, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "user", 'u', "Run as user", - (gptr*) &user, (gptr*) &user, 0, + (uchar**) &user, (uchar**) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/src/kernel/vm/Configuration.cpp b/storage/ndb/src/kernel/vm/Configuration.cpp index e0b485eda59..ebdd4c97aab 100644 --- a/storage/ndb/src/kernel/vm/Configuration.cpp +++ b/storage/ndb/src/kernel/vm/Configuration.cpp @@ -74,35 +74,35 @@ static struct my_option my_long_options[] = { "initial", OPT_INITIAL, "Perform initial start of ndbd, including cleaning the file system. " "Consult documentation before using this", - (gptr*) &_initial, (gptr*) &_initial, 0, + (uchar**) &_initial, (uchar**) &_initial, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "nostart", 'n', "Don't start ndbd immediately. Ndbd will await command from ndb_mgmd", - (gptr*) &_no_start, (gptr*) &_no_start, 0, + (uchar**) &_no_start, (uchar**) &_no_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "daemon", 'd', "Start ndbd as daemon (default)", - (gptr*) &_daemon, (gptr*) &_daemon, 0, + (uchar**) &_daemon, (uchar**) &_daemon, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 }, { "nodaemon", OPT_NODAEMON, "Do not start ndbd as daemon, provided for testing purposes", - (gptr*) &_no_daemon, (gptr*) &_no_daemon, 0, + (uchar**) &_no_daemon, (uchar**) &_no_daemon, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "foreground", OPT_FOREGROUND, "Run real ndbd in foreground, provided for debugging purposes" " (implies --nodaemon)", - (gptr*) &_foreground, (gptr*) &_foreground, 0, + (uchar**) &_foreground, (uchar**) &_foreground, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "nowait-nodes", OPT_NOWAIT_NODES, "Nodes that will not be waited for during start", - (gptr*) &_nowait_nodes, (gptr*) &_nowait_nodes, 0, + (uchar**) &_nowait_nodes, (uchar**) &_nowait_nodes, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "initial-start", OPT_INITIAL_START, "Perform initial start", - (gptr*) &_initialstart, (gptr*) &_initialstart, 0, + (uchar**) &_initialstart, (uchar**) &_initialstart, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "bind-address", OPT_NOWAIT_NODES, "Local bind address", - (gptr*) &_bind_address, (gptr*) &_bind_address, 0, + (uchar**) &_bind_address, (uchar**) &_bind_address, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/src/mgmclient/main.cpp b/storage/ndb/src/mgmclient/main.cpp index 44408362f09..d0c117f20d3 100644 --- a/storage/ndb/src/mgmclient/main.cpp +++ b/storage/ndb/src/mgmclient/main.cpp @@ -71,11 +71,11 @@ static struct my_option my_long_options[] = NDB_STD_OPTS("ndb_mgm"), { "execute", 'e', "execute command and exit", - (gptr*) &opt_execute_str, (gptr*) &opt_execute_str, 0, + (uchar**) &opt_execute_str, (uchar**) &opt_execute_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "try-reconnect", 't', "Specify number of tries for connecting to ndb_mgmd (0 = infinite)", - (gptr*) &_try_reconnect, (gptr*) &_try_reconnect, 0, + (uchar**) &_try_reconnect, (uchar**) &_try_reconnect, 0, GET_UINT, REQUIRED_ARG, 3, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp index 94768e6ae52..5c25d8f4f80 100644 --- a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp +++ b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp @@ -780,19 +780,19 @@ InitConfigFileParser::parse_mycnf() const ConfigInfo::ParamInfo& param = ConfigInfo::m_ParamInfo[i]; switch(param._type){ case ConfigInfo::CI_BOOL: - opt.value = (gptr*)malloc(sizeof(int)); + opt.value = (uchar **)malloc(sizeof(int)); opt.var_type = GET_INT; break; case ConfigInfo::CI_INT: - opt.value = (gptr*)malloc(sizeof(int)); + opt.value = (uchar**)malloc(sizeof(int)); opt.var_type = GET_INT; break; case ConfigInfo::CI_INT64: - opt.value = (gptr*)malloc(sizeof(Int64)); + opt.value = (uchar**)malloc(sizeof(Int64)); opt.var_type = GET_LL; break; case ConfigInfo::CI_STRING: - opt.value = (gptr*)malloc(sizeof(char *)); + opt.value = (uchar**)malloc(sizeof(char *)); opt.var_type = GET_STR; break; default: @@ -818,28 +818,28 @@ InitConfigFileParser::parse_mycnf() bzero(&opt, sizeof(opt)); opt.name = "ndbd"; opt.id = 256; - opt.value = (gptr*)malloc(sizeof(char*)); + opt.value = (uchar**)malloc(sizeof(char*)); opt.var_type = GET_STR; opt.arg_type = REQUIRED_ARG; options.push_back(opt); opt.name = "ndb_mgmd"; opt.id = 256; - opt.value = (gptr*)malloc(sizeof(char*)); + opt.value = (uchar**)malloc(sizeof(char*)); opt.var_type = GET_STR; opt.arg_type = REQUIRED_ARG; options.push_back(opt); opt.name = "mysqld"; opt.id = 256; - opt.value = (gptr*)malloc(sizeof(char*)); + opt.value = (uchar**)malloc(sizeof(char*)); opt.var_type = GET_STR; opt.arg_type = REQUIRED_ARG; options.push_back(opt); opt.name = "ndbapi"; opt.id = 256; - opt.value = (gptr*)malloc(sizeof(char*)); + opt.value = (uchar**)malloc(sizeof(char*)); opt.var_type = GET_STR; opt.arg_type = REQUIRED_ARG; options.push_back(opt); @@ -947,23 +947,3 @@ end: } template class Vector<struct my_option>; - -#if 0 -struct my_option -{ - const char *name; /* Name of the option */ - int id; /* unique id or short option */ - const char *comment; /* option comment, for autom. --help */ - gptr *value; /* The variable value */ - gptr *u_max_value; /* The user def. max variable value */ - const char **str_values; /* Pointer to possible values */ - ulong var_type; - enum get_opt_arg_type arg_type; - longlong def_value; /* Default value */ - longlong min_value; /* Min allowed value */ - longlong max_value; /* Max allowed value */ - longlong sub_size; /* Subtract this from given value */ - long block_size; /* Value should be a mult. of this */ - int app_type; /* To be used by an application */ -}; -#endif diff --git a/storage/ndb/src/mgmsrv/main.cpp b/storage/ndb/src/mgmsrv/main.cpp index b880657d89b..16c560868ef 100644 --- a/storage/ndb/src/mgmsrv/main.cpp +++ b/storage/ndb/src/mgmsrv/main.cpp @@ -142,29 +142,29 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_mgmd"), { "config-file", 'f', "Specify cluster configuration file", - (gptr*) &opt_config_filename, (gptr*) &opt_config_filename, 0, + (uchar**) &opt_config_filename, (uchar**) &opt_config_filename, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "print-full-config", 'P', "Print full config and exit", - (gptr*) &g_print_full_config, (gptr*) &g_print_full_config, 0, + (uchar**) &g_print_full_config, (uchar**) &g_print_full_config, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "daemon", 'd', "Run ndb_mgmd in daemon mode (default)", - (gptr*) &opt_daemon, (gptr*) &opt_daemon, 0, + (uchar**) &opt_daemon, (uchar**) &opt_daemon, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 }, { "interactive", OPT_INTERACTIVE, "Run interactive. Not supported but provided for testing purposes", - (gptr*) &opt_interactive, (gptr*) &opt_interactive, 0, + (uchar**) &opt_interactive, (uchar**) &opt_interactive, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-nodeid-checks", OPT_NO_NODEID_CHECKS, "Do not provide any node id checks", - (gptr*) &g_no_nodeid_checks, (gptr*) &g_no_nodeid_checks, 0, + (uchar**) &g_no_nodeid_checks, (uchar**) &g_no_nodeid_checks, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "nodaemon", OPT_NO_DAEMON, "Don't run as daemon, but don't read from stdin", - (gptr*) &opt_non_interactive, (gptr*) &opt_non_interactive, 0, + (uchar**) &opt_non_interactive, (uchar**) &opt_non_interactive, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "mycnf", 256, "Read cluster config from my.cnf", - (gptr*) &opt_mycnf, (gptr*) &opt_mycnf, 0, + (uchar**) &opt_mycnf, (uchar**) &opt_mycnf, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/src/ndbapi/NdbBlob.cpp b/storage/ndb/src/ndbapi/NdbBlob.cpp index 25dcafdef53..e651a4c70b0 100644 --- a/storage/ndb/src/ndbapi/NdbBlob.cpp +++ b/storage/ndb/src/ndbapi/NdbBlob.cpp @@ -536,7 +536,7 @@ int NdbBlob::setTableKeyValue(NdbOperation* anOp) { DBUG_ENTER("NdbBlob::setTableKeyValue"); - DBUG_DUMP("info", theKeyBuf.data, 4 * theTable->m_keyLenInWords); + DBUG_DUMP("info", (uchar*) theKeyBuf.data, 4 * theTable->m_keyLenInWords); const Uint32* data = (const Uint32*)theKeyBuf.data; const unsigned columns = theTable->m_columns.size(); unsigned pos = 0; @@ -562,7 +562,8 @@ int NdbBlob::setAccessKeyValue(NdbOperation* anOp) { DBUG_ENTER("NdbBlob::setAccessKeyValue"); - DBUG_DUMP("info", theAccessKeyBuf.data, 4 * theAccessTable->m_keyLenInWords); + DBUG_DUMP("info", (uchar*) theAccessKeyBuf.data, + 4 * theAccessTable->m_keyLenInWords); const Uint32* data = (const Uint32*)theAccessKeyBuf.data; const unsigned columns = theAccessTable->m_columns.size(); unsigned pos = 0; @@ -587,7 +588,7 @@ NdbBlob::setPartKeyValue(NdbOperation* anOp, Uint32 part) { DBUG_ENTER("NdbBlob::setPartKeyValue"); DBUG_PRINT("info", ("dist=%u part=%u packkey=", getDistKey(part), part)); - DBUG_DUMP("info", thePackKeyBuf.data, 4 * thePackKeyBuf.size); + DBUG_DUMP("info", (uchar*) thePackKeyBuf.data, 4 * thePackKeyBuf.size); // TODO use attr ids after compatibility with 4.1.7 not needed if (anOp->equal("PK", thePackKeyBuf.data) == -1 || anOp->equal("DIST", getDistKey(part)) == -1 || diff --git a/storage/ndb/src/ndbapi/NdbOperationDefine.cpp b/storage/ndb/src/ndbapi/NdbOperationDefine.cpp index ced9b18bd55..c9459ff911c 100644 --- a/storage/ndb/src/ndbapi/NdbOperationDefine.cpp +++ b/storage/ndb/src/ndbapi/NdbOperationDefine.cpp @@ -608,7 +608,6 @@ NdbOperation::setAnyValue(Uint32 any_value) const NdbColumnImpl* impl = &NdbColumnImpl::getImpl(* NdbDictionary::Column::ANY_VALUE); OperationType tOpType = theOperationType; - OperationStatus tStatus = theStatus; switch(tOpType){ case DeleteRequest:{ diff --git a/storage/ndb/src/ndbapi/NdbOperationInt.cpp b/storage/ndb/src/ndbapi/NdbOperationInt.cpp index 0df1dbfe2c8..f69211cb78b 100644 --- a/storage/ndb/src/ndbapi/NdbOperationInt.cpp +++ b/storage/ndb/src/ndbapi/NdbOperationInt.cpp @@ -1023,7 +1023,7 @@ NdbOperation::branch_col(Uint32 type, DBUG_PRINT("enter", ("type: %u col:%u val: 0x%lx len: %u label: %u", type, ColId, (long) val, len, Label)); if (val != NULL) - DBUG_DUMP("value", (char*)val, len); + DBUG_DUMP("value", (uchar*)val, len); if (initial_interpreterCheck() == -1) DBUG_RETURN(-1); diff --git a/storage/ndb/src/ndbapi/NdbScanOperation.cpp b/storage/ndb/src/ndbapi/NdbScanOperation.cpp index dc9a74ae11c..fa94bf8d836 100644 --- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp +++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp @@ -1311,7 +1311,7 @@ NdbIndexScanOperation::getKeyFromSCANTABREQ(Uint32* data, Uint32 size) } pos += rem; } - DBUG_DUMP("key", (char*)data, size << 2); + DBUG_DUMP("key", (uchar*) data, size << 2); DBUG_RETURN(size); } diff --git a/storage/ndb/tools/delete_all.cpp b/storage/ndb/tools/delete_all.cpp index 4e3037f1941..1bf89f5a32f 100644 --- a/storage/ndb/tools/delete_all.cpp +++ b/storage/ndb/tools/delete_all.cpp @@ -36,16 +36,16 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "database", 'd', "Name of database table is in", - (gptr*) &_dbname, (gptr*) &_dbname, 0, + (uchar**) &_dbname, (uchar**) &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "transactional", 't', "Single transaction (may run out of operations)", - (gptr*) &_transactional, (gptr*) &_transactional, 0, + (uchar**) &_transactional, (uchar**) &_transactional, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "tupscan", 999, "Run tupscan", - (gptr*) &_tupscan, (gptr*) &_tupscan, 0, + (uchar**) &_tupscan, (uchar**) &_tupscan, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "diskscan", 999, "Run diskcan", - (gptr*) &_diskscan, (gptr*) &_diskscan, 0, + (uchar**) &_diskscan, (uchar**) &_diskscan, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/desc.cpp b/storage/ndb/tools/desc.cpp index 9eb0cf67ceb..831005139de 100644 --- a/storage/ndb/tools/desc.cpp +++ b/storage/ndb/tools/desc.cpp @@ -39,16 +39,16 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "database", 'd', "Name of database table is in", - (gptr*) &_dbname, (gptr*) &_dbname, 0, + (uchar**) &_dbname, (uchar**) &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "unqualified", 'u', "Use unqualified table names", - (gptr*) &_unqualified, (gptr*) &_unqualified, 0, + (uchar**) &_unqualified, (uchar**) &_unqualified, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "extra-partition-info", 'p', "Print more info per partition", - (gptr*) &_partinfo, (gptr*) &_partinfo, 0, + (uchar**) &_partinfo, (uchar**) &_partinfo, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "retries", 'r', "Retry every second for # retries", - (gptr*) &_retries, (gptr*) &_retries, 0, + (uchar**) &_retries, (uchar**) &_retries, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/drop_index.cpp b/storage/ndb/tools/drop_index.cpp index 256c40e1924..ec88f331a80 100644 --- a/storage/ndb/tools/drop_index.cpp +++ b/storage/ndb/tools/drop_index.cpp @@ -30,7 +30,7 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "database", 'd', "Name of database table is in", - (gptr*) &_dbname, (gptr*) &_dbname, 0, + (uchar**) &_dbname, (uchar**) &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/drop_tab.cpp b/storage/ndb/tools/drop_tab.cpp index a7accb904a4..8d07afbbf50 100644 --- a/storage/ndb/tools/drop_tab.cpp +++ b/storage/ndb/tools/drop_tab.cpp @@ -30,7 +30,7 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "database", 'd', "Name of database table is in", - (gptr*) &_dbname, (gptr*) &_dbname, 0, + (uchar**) &_dbname, (uchar**) &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/listTables.cpp b/storage/ndb/tools/listTables.cpp index 6a73bcc54f5..45129cb34af 100644 --- a/storage/ndb/tools/listTables.cpp +++ b/storage/ndb/tools/listTables.cpp @@ -256,22 +256,22 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_show_tables"), { "database", 'd', "Name of database table is in", - (gptr*) &_dbname, (gptr*) &_dbname, 0, + (uchar**) &_dbname, (uchar**) &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "loops", 'l', "loops", - (gptr*) &_loops, (gptr*) &_loops, 0, + (uchar**) &_loops, (uchar**) &_loops, 0, GET_INT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0 }, { "type", 't', "type", - (gptr*) &_type, (gptr*) &_type, 0, + (uchar**) &_type, (uchar**) &_type, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "unqualified", 'u', "Use unqualified table names", - (gptr*) &_unqualified, (gptr*) &_unqualified, 0, + (uchar**) &_unqualified, (uchar**) &_unqualified, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "parsable", 'p', "Return output suitable for mysql LOAD DATA INFILE", - (gptr*) &_parsable, (gptr*) &_parsable, 0, + (uchar**) &_parsable, (uchar**) &_parsable, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "show-temp-status", OPT_SHOW_TMP_STATUS, "Show table temporary flag", - (gptr*) &show_temp_status, (gptr*) &show_temp_status, 0, + (uchar**) &show_temp_status, (uchar**) &show_temp_status, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/ndb_config.cpp b/storage/ndb/tools/ndb_config.cpp index 31fc59a8b83..af36103f947 100644 --- a/storage/ndb/tools/ndb_config.cpp +++ b/storage/ndb/tools/ndb_config.cpp @@ -58,37 +58,37 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_config"), { "nodes", 256, "Print nodes", - (gptr*) &g_nodes, (gptr*) &g_nodes, + (uchar**) &g_nodes, (uchar**) &g_nodes, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { "connections", 256, "Print connections", - (gptr*) &g_connections, (gptr*) &g_connections, + (uchar**) &g_connections, (uchar**) &g_connections, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { "query", 'q', "Query option(s)", - (gptr*) &g_query, (gptr*) &g_query, + (uchar**) &g_query, (uchar**) &g_query, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "host", 256, "Host", - (gptr*) &g_host, (gptr*) &g_host, + (uchar**) &g_host, (uchar**) &g_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "type", 258, "Type of node/connection", - (gptr*) &g_type, (gptr*) &g_type, + (uchar**) &g_type, (uchar**) &g_type, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "id", 258, "Nodeid", - (gptr*) &g_nodeid, (gptr*) &g_nodeid, + (uchar**) &g_nodeid, (uchar**) &g_nodeid, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "nodeid", 258, "Nodeid", - (gptr*) &g_nodeid, (gptr*) &g_nodeid, + (uchar**) &g_nodeid, (uchar**) &g_nodeid, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "fields", 'f', "Field separator", - (gptr*) &g_field_delimiter, (gptr*) &g_field_delimiter, + (uchar**) &g_field_delimiter, (uchar**) &g_field_delimiter, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "rows", 'r', "Row separator", - (gptr*) &g_row_delimiter, (gptr*) &g_row_delimiter, + (uchar**) &g_row_delimiter, (uchar**) &g_row_delimiter, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "config-file", 256, "Path to config.ini", - (gptr*) &g_config_file, (gptr*) &g_config_file, + (uchar**) &g_config_file, (uchar**) &g_config_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "mycnf", 256, "Read config from my.cnf", - (gptr*) &g_mycnf, (gptr*) &g_mycnf, + (uchar**) &g_mycnf, (uchar**) &g_mycnf, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/restore/consumer_restore.cpp b/storage/ndb/tools/restore/consumer_restore.cpp index 3dd4b072671..9b087a48ef4 100644 --- a/storage/ndb/tools/restore/consumer_restore.cpp +++ b/storage/ndb/tools/restore/consumer_restore.cpp @@ -424,13 +424,14 @@ error: bool BackupRestore::translate_frm(NdbDictionary::Table *table) { - const void *pack_data, *data, *new_pack_data; + uchar *pack_data, *data, *new_pack_data; char *new_data; - uint data_len, new_data_len, new_pack_len; + uint new_data_len; + size_t data_len, new_pack_len; uint no_parts, extra_growth; DBUG_ENTER("translate_frm"); - pack_data = table->getFrmData(); + pack_data = (uchar*) table->getFrmData(); no_parts = table->getFragmentCount(); /* Add max 4 characters per partition to handle worst case @@ -442,7 +443,7 @@ bool BackupRestore::translate_frm(NdbDictionary::Table *table) { DBUG_RETURN(TRUE); } - if ((new_data = my_malloc(data_len + extra_growth, MYF(0)))) + if ((new_data = (char*) my_malloc(data_len + extra_growth, MYF(0)))) { DBUG_RETURN(TRUE); } @@ -451,7 +452,7 @@ bool BackupRestore::translate_frm(NdbDictionary::Table *table) my_free(new_data, MYF(0)); DBUG_RETURN(TRUE); } - if (packfrm((const void*)new_data, new_data_len, + if (packfrm((uchar*) new_data, new_data_len, &new_pack_data, &new_pack_len)) { my_free(new_data, MYF(0)); diff --git a/storage/ndb/tools/restore/restore_main.cpp b/storage/ndb/tools/restore/restore_main.cpp index adccd024d88..4752f019a08 100644 --- a/storage/ndb/tools/restore/restore_main.cpp +++ b/storage/ndb/tools/restore/restore_main.cpp @@ -99,95 +99,95 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_restore"), { "connect", 'c', "same as --connect-string", - (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, + (uchar**) &opt_connect_str, (uchar**) &opt_connect_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "nodeid", 'n', "Backup files from node with id", - (gptr*) &ga_nodeId, (gptr*) &ga_nodeId, 0, + (uchar**) &ga_nodeId, (uchar**) &ga_nodeId, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "backupid", 'b', "Backup id", - (gptr*) &ga_backupId, (gptr*) &ga_backupId, 0, + (uchar**) &ga_backupId, (uchar**) &ga_backupId, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "restore_data", 'r', "Restore table data/logs into NDB Cluster using NDBAPI", - (gptr*) &_restore_data, (gptr*) &_restore_data, 0, + (uchar**) &_restore_data, (uchar**) &_restore_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "restore_meta", 'm', "Restore meta data into NDB Cluster using NDBAPI", - (gptr*) &_restore_meta, (gptr*) &_restore_meta, 0, + (uchar**) &_restore_meta, (uchar**) &_restore_meta, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-restore-disk-objects", 'd', "Dont restore disk objects (tablespace/logfilegroups etc)", - (gptr*) &_no_restore_disk, (gptr*) &_no_restore_disk, 0, + (uchar**) &_no_restore_disk, (uchar**) &_no_restore_disk, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "restore_epoch", 'e', "Restore epoch info into the status table. Convenient on a MySQL Cluster " "replication slave, for starting replication. The row in " NDB_REP_DB "." NDB_APPLY_TABLE " with id 0 will be updated/inserted.", - (gptr*) &ga_restore_epoch, (gptr*) &ga_restore_epoch, 0, + (uchar**) &ga_restore_epoch, (uchar**) &ga_restore_epoch, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "skip-table-check", 's', "Skip table structure check during restore of data", - (gptr*) &ga_skip_table_check, (gptr*) &ga_skip_table_check, 0, + (uchar**) &ga_skip_table_check, (uchar**) &ga_skip_table_check, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "parallelism", 'p', "No of parallel transactions during restore of data." "(parallelism can be 1 to 1024)", - (gptr*) &ga_nParallelism, (gptr*) &ga_nParallelism, 0, + (uchar**) &ga_nParallelism, (uchar**) &ga_nParallelism, 0, GET_INT, REQUIRED_ARG, 128, 1, 1024, 0, 1, 0 }, { "print", OPT_PRINT, "Print data and log to stdout", - (gptr*) &_print, (gptr*) &_print, 0, + (uchar**) &_print, (uchar**) &_print, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "print_data", OPT_PRINT_DATA, "Print data to stdout", - (gptr*) &_print_data, (gptr*) &_print_data, 0, + (uchar**) &_print_data, (uchar**) &_print_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "print_meta", OPT_PRINT_META, "Print meta data to stdout", - (gptr*) &_print_meta, (gptr*) &_print_meta, 0, + (uchar**) &_print_meta, (uchar**) &_print_meta, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "print_log", OPT_PRINT_LOG, "Print log to stdout", - (gptr*) &_print_log, (gptr*) &_print_log, 0, + (uchar**) &_print_log, (uchar**) &_print_log, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "backup_path", OPT_BACKUP_PATH, "Path to backup files", - (gptr*) &ga_backupPath, (gptr*) &ga_backupPath, 0, + (uchar**) &ga_backupPath, (uchar**) &ga_backupPath, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "dont_ignore_systab_0", 'f', "Experimental. Do not ignore system table during restore.", - (gptr*) &ga_dont_ignore_systab_0, (gptr*) &ga_dont_ignore_systab_0, 0, + (uchar**) &ga_dont_ignore_systab_0, (uchar**) &ga_dont_ignore_systab_0, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "ndb-nodegroup-map", OPT_NDB_NODEGROUP_MAP, "Nodegroup map for ndbcluster. Syntax: list of (source_ng, dest_ng)", - (gptr*) &opt_nodegroup_map_str, - (gptr*) &opt_nodegroup_map_str, + (uchar**) &opt_nodegroup_map_str, + (uchar**) &opt_nodegroup_map_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "fields-enclosed-by", OPT_FIELDS_ENCLOSED_BY, "Fields are enclosed by ...", - (gptr*) &opt_fields_enclosed_by, (gptr*) &opt_fields_enclosed_by, 0, + (uchar**) &opt_fields_enclosed_by, (uchar**) &opt_fields_enclosed_by, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "fields-terminated-by", OPT_FIELDS_TERMINATED_BY, "Fields are terminated by ...", - (gptr*) &opt_fields_terminated_by, - (gptr*) &opt_fields_terminated_by, 0, + (uchar**) &opt_fields_terminated_by, + (uchar**) &opt_fields_terminated_by, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "fields-optionally-enclosed-by", OPT_FIELDS_OPTIONALLY_ENCLOSED_BY, "Fields are optionally enclosed by ...", - (gptr*) &opt_fields_optionally_enclosed_by, - (gptr*) &opt_fields_optionally_enclosed_by, 0, + (uchar**) &opt_fields_optionally_enclosed_by, + (uchar**) &opt_fields_optionally_enclosed_by, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "hex", OPT_HEX_FORMAT, "print binary types in hex format", - (gptr*) &opt_hex_format, (gptr*) &opt_hex_format, 0, + (uchar**) &opt_hex_format, (uchar**) &opt_hex_format, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "tab", 'T', "Creates tab separated textfile for each table to " "given path. (creates .txt files)", - (gptr*) &tab_path, (gptr*) &tab_path, 0, + (uchar**) &tab_path, (uchar**) &tab_path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "append", OPT_APPEND, "for --tab append data to file", - (gptr*) &opt_append, (gptr*) &opt_append, 0, + (uchar**) &opt_append, (uchar**) &opt_append, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "lines-terminated-by", OPT_LINES_TERMINATED_BY, "", - (gptr*) &opt_lines_terminated_by, (gptr*) &opt_lines_terminated_by, 0, + (uchar**) &opt_lines_terminated_by, (uchar**) &opt_lines_terminated_by, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "verbose", OPT_VERBOSE, "verbosity", - (gptr*) &opt_verbose, (gptr*) &opt_verbose, 0, + (uchar**) &opt_verbose, (uchar**) &opt_verbose, 0, GET_INT, REQUIRED_ARG, 1, 0, 255, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/select_all.cpp b/storage/ndb/tools/select_all.cpp index e2072f30edf..23d5f95f3f7 100644 --- a/storage/ndb/tools/select_all.cpp +++ b/storage/ndb/tools/select_all.cpp @@ -54,43 +54,43 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "database", 'd', "Name of database table is in", - (gptr*) &_dbname, (gptr*) &_dbname, 0, + (uchar**) &_dbname, (uchar**) &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "parallelism", 'p', "parallelism", - (gptr*) &_parallelism, (gptr*) &_parallelism, 0, + (uchar**) &_parallelism, (uchar**) &_parallelism, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "lock", 'l', "Read(0), Read-hold(1), Exclusive(2)", - (gptr*) &_lock, (gptr*) &_lock, 0, + (uchar**) &_lock, (uchar**) &_lock, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "order", 'o', "Sort resultset according to index", - (gptr*) &_order, (gptr*) &_order, 0, + (uchar**) &_order, (uchar**) &_order, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "descending", 'z', "Sort descending (requires order flag)", - (gptr*) &_descending, (gptr*) &_descending, 0, + (uchar**) &_descending, (uchar**) &_descending, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "header", 'h', "Print header", - (gptr*) &_header, (gptr*) &_header, 0, + (uchar**) &_header, (uchar**) &_header, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 }, { "useHexFormat", 'x', "Output numbers in hexadecimal format", - (gptr*) &_useHexFormat, (gptr*) &_useHexFormat, 0, + (uchar**) &_useHexFormat, (uchar**) &_useHexFormat, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "delimiter", 'D', "Column delimiter", - (gptr*) &_delimiter, (gptr*) &_delimiter, 0, + (uchar**) &_delimiter, (uchar**) &_delimiter, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "disk", 256, "Dump disk ref", - (gptr*) &_dumpDisk, (gptr*) &_dumpDisk, 0, + (uchar**) &_dumpDisk, (uchar**) &_dumpDisk, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "rowid", 256, "Dump rowid", - (gptr*) &use_rowid, (gptr*) &use_rowid, 0, + (uchar**) &use_rowid, (uchar**) &use_rowid, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "gci", 256, "Dump gci", - (gptr*) &use_gci, (gptr*) &use_gci, 0, + (uchar**) &use_gci, (uchar**) &use_gci, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "tupscan", 't', "Scan in tup order", - (gptr*) &_tup, (gptr*) &_tup, 0, + (uchar**) &_tup, (uchar**) &_tup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "nodata", 256, "Dont print data", - (gptr*) &nodata, (gptr*) &nodata, 0, + (uchar**) &nodata, (uchar**) &nodata, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/select_count.cpp b/storage/ndb/tools/select_count.cpp index 552d156b665..73982e886b5 100644 --- a/storage/ndb/tools/select_count.cpp +++ b/storage/ndb/tools/select_count.cpp @@ -43,13 +43,13 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "database", 'd', "Name of database table is in", - (gptr*) &_dbname, (gptr*) &_dbname, 0, + (uchar**) &_dbname, (uchar**) &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "parallelism", 'p', "parallelism", - (gptr*) &_parallelism, (gptr*) &_parallelism, 0, + (uchar**) &_parallelism, (uchar**) &_parallelism, 0, GET_INT, REQUIRED_ARG, 240, 0, 0, 0, 0, 0 }, { "lock", 'l', "Read(0), Read-hold(1), Exclusive(2)", - (gptr*) &_lock, (gptr*) &_lock, 0, + (uchar**) &_lock, (uchar**) &_lock, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/waiter.cpp b/storage/ndb/tools/waiter.cpp index de8d15ac17a..a292ab9140a 100644 --- a/storage/ndb/tools/waiter.cpp +++ b/storage/ndb/tools/waiter.cpp @@ -46,17 +46,17 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "no-contact", 'n', "Wait for cluster no contact", - (gptr*) &_no_contact, (gptr*) &_no_contact, 0, + (uchar**) &_no_contact, (uchar**) &_no_contact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "not-started", OPT_WAIT_STATUS_NOT_STARTED, "Wait for cluster not started", - (gptr*) &_not_started, (gptr*) &_not_started, 0, + (uchar**) &_not_started, (uchar**) &_not_started, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "single-user", OPT_WAIT_STATUS_SINGLE_USER, "Wait for cluster to enter single user mode", - (gptr*) &_single_user, (gptr*) &_single_user, 0, + (uchar**) &_single_user, (uchar**) &_single_user, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "timeout", 't', "Timeout to wait", - (gptr*) &_timeout, (gptr*) &_timeout, 0, + (uchar**) &_timeout, (uchar**) &_timeout, 0, GET_INT, REQUIRED_ARG, 120, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; |