diff options
Diffstat (limited to 'isam')
-rw-r--r-- | isam/Makefile.am | 2 | ||||
-rw-r--r-- | isam/_key.c | 18 | ||||
-rw-r--r-- | isam/_search.c | 26 | ||||
-rw-r--r-- | isam/isamlog.c | 6 | ||||
-rw-r--r-- | isam/pack_isam.c | 25 | ||||
-rw-r--r-- | isam/static.c | 2 |
6 files changed, 30 insertions, 49 deletions
diff --git a/isam/Makefile.am b/isam/Makefile.am index 8f23138f29f..6d9e4176d43 100644 --- a/isam/Makefile.am +++ b/isam/Makefile.am @@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include +INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include LDADD = @CLIENT_EXTRA_LDFLAGS@ libnisam.a ../mysys/libmysys.a \ ../dbug/libdbug.a ../strings/libmystrings.a pkglib_LIBRARIES = libnisam.a diff --git a/isam/_key.c b/isam/_key.c index c0d667cb32d..871ec82eba7 100644 --- a/isam/_key.c +++ b/isam/_key.c @@ -53,12 +53,10 @@ uint _nisam_make_key(register N_INFO *info, uint keynr, uchar *key, const char * } *key++= (uchar) (length=(uint) (end-pos)); memcpy((byte*) key,(byte*) pos,(size_t) length); -#ifdef USE_STRCOLL - if (!use_strcoll(default_charset_info)) -#endif + if (!use_strnxfrm(default_charset_info)) { if (type == HA_KEYTYPE_TEXT) - case_sort((byte*) key,length); + my_tosort(default_charset_info,(byte*) key,length); } key+=length; } @@ -66,12 +64,10 @@ uint _nisam_make_key(register N_INFO *info, uint keynr, uchar *key, const char * { memcpy((byte*) key,(byte*) record+keyseg->base.start, (size_t) keyseg->base.length); -#ifdef USE_STRCOLL - if (!use_strcoll(default_charset_info)) -#endif + if (!use_strnxfrm(default_charset_info)) { if (type == HA_KEYTYPE_TEXT) - case_sort((byte*) key,(uint) keyseg->base.length); + my_tosort(default_charset_info,(byte*) key,(uint) keyseg->base.length); } #ifdef NAN_TEST else if (type == HA_KEYTYPE_FLOAT) @@ -149,12 +145,10 @@ uint _nisam_pack_key(register N_INFO *info, uint keynr, uchar *key, uchar *old, } else memcpy((byte*) key,old,(size_t) length); -#ifdef USE_STRCOLL - if (!use_strcoll(default_charset_info)) -#endif + if (!use_strnxfrm(default_charset_info)) { if (type == HA_KEYTYPE_TEXT) - case_sort((byte*) key,length); + my_tosort(default_charset_info,(byte*) key,length); } key+= length; } diff --git a/isam/_search.c b/isam/_search.c index 57787d61818..1ceeab1e824 100644 --- a/isam/_search.c +++ b/isam/_search.c @@ -118,7 +118,7 @@ int _nisam_search(register N_INFO *info, register N_KEYDEF *keyinfo, uchar *key, if ((nextflag & (SEARCH_SMALLER | SEARCH_LAST)) && flag != 0) { keypos=_nisam_get_last_key(info,keyinfo,buff,lastkey,keypos); - if ((nextflag & SEARCH_LAST) && + if (!(nextflag & SEARCH_SMALLER) && _nisam_key_cmp(keyinfo->seg, info->lastkey, key, key_len, SEARCH_FIND)) { my_errno=HA_ERR_KEY_NOT_FOUND; /* Didn't find key */ @@ -331,8 +331,7 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar (int) *as : b_length; end= a+ min(key_length,(uint) length); -#ifdef USE_STRCOLL - if (use_strcoll(default_charset_info)) { + if (use_strnxfrm(default_charset_info)) { if (((enum ha_base_keytype) keyseg->base.type) == HA_KEYTYPE_BINARY) { while (a < end) @@ -349,7 +348,6 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar } } else -#endif { while (a < end) if ((flag= (int) *a++ - (int) *b++)) @@ -382,8 +380,7 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar } else { -#ifdef USE_STRCOLL - if (use_strcoll(default_charset_info)) { + if (use_strnxfrm(default_charset_info)) { if (((enum ha_base_keytype) keyseg->base.type) == HA_KEYTYPE_BINARY) { while (a < end) @@ -400,7 +397,6 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar } } else -#endif { while (a < end) if ((flag= (int) *a++ - (int) *b++)) @@ -515,11 +511,13 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar if (*a++ != *b++) { a--; b--; - if (isdigit((char) *a) && isdigit((char) *b)) + if (my_isdigit(default_charset_info, (char) *a) && + my_isdigit(default_charset_info, (char) *b)) return ((int) *a - (int) *b); - if (*a == '-' || isdigit((char) *b)) + if (*a == '-' || my_isdigit(default_charset_info,(char) *b)) return (-1); - if (*b == '-' || *b++ == ' ' || isdigit((char) *a)) + if (*b == '-' || *b++ == ' ' || + my_isdigit(default_charset_info,(char) *a)) return (1); if (*a++ == ' ') return (-1); @@ -539,11 +537,13 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar if (*a++ != *b++) { a--; b--; - if (isdigit((char) *a) && isdigit((char) *b)) + if (my_isdigit(default_charset_info,(char) *a) && + my_isdigit(default_charset_info,(char) *b)) return ((int) *a - (int) *b); - if (*a == '-' || isdigit((char) *b)) + if (*a == '-' || my_isdigit(default_charset_info,(char) *b)) return (-1); - if (*b == '-' || *b++ == ' ' || isdigit((char) *a)) + if (*b == '-' || *b++ == ' ' || + my_isdigit(default_charset_info,(char) *a)) return (1); if (*a++ == ' ') return -1; diff --git a/isam/isamlog.c b/isam/isamlog.c index 0367c03e08a..ff3bca39e40 100644 --- a/isam/isamlog.c +++ b/isam/isamlog.c @@ -342,7 +342,7 @@ static int examine_log(my_string file_name, char **table_names) file_info.process=0; result=uint2korr(head+7); if ((curr_file_info=(struct isamlog_file_info*) - tree_search(&tree,&file_info))) + tree_search(&tree, &file_info, tree.custom_arg))) { curr_file_info->accessed=access_time; if (update && curr_file_info->used && curr_file_info->closed) @@ -444,7 +444,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)); + VOID(tree_insert(&tree, (gptr) &file_info, 0, tree.custom_arg)); if (file_info.used) { if (verbose && !record_pos_file) @@ -463,7 +463,7 @@ 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)); + VOID(tree_delete(&tree, (gptr) curr_file_info, tree.custom_arg)); } break; case LOG_EXTRA: diff --git a/isam/pack_isam.c b/isam/pack_isam.c index b2e21afc743..fd12aac1e09 100644 --- a/isam/pack_isam.c +++ b/isam/pack_isam.c @@ -46,22 +46,6 @@ #define OLD_EXT ".OLD" #define WRITE_COUNT MY_HOW_OFTEN_TO_WRITE -#ifdef __WIN__ -static double ulonglong2double(ulonglong value) -{ - longlong nr=(longlong) value; - if (nr >= 0) - return (double) nr; - return (18446744073709551616.0 + (double) nr); -} - -#if SIZEOF_OFF_T > 4 -#define my_off_t2double(A) ulonglong2double(A) -#else -#define my_off_t2double(A) ((double) (A)) -#endif /* SIZEOF_OFF_T > 4 */ -#endif - struct st_file_buffer { File file; char *buffer,*pos,*end; @@ -687,7 +671,8 @@ static HUFF_COUNTS *init_huff_count(N_INFO *info,my_off_t records) (type == FIELD_NORMAL || type == FIELD_SKIP_ZERO)) count[i].max_zero_fill= count[i].field_length; - init_tree(&count[i].int_tree,0,0,-1,(qsort_cmp2) compare_tree,0,NULL,NULL); + init_tree(&count[i].int_tree,0,0,-1,(qsort_cmp2) compare_tree,0, + NULL, NULL); if (records) count[i].tree_pos=count[i].tree_buff = my_malloc(count[i].field_length > 1 ? tree_buff_length : 2, @@ -765,7 +750,8 @@ static int get_statistic(MRG_INFO *mrg,HUFF_COUNTS *huff_counts) if (count->tree_buff) { global_count=count; - if (!(element=tree_insert(&count->int_tree,pos,0)) || + if (!(element=tree_insert(&count->int_tree, pos, 0, + count->int_tree.custom_arg)) || ((element->count == 1 && count->tree_buff + tree_buff_length < count->tree_pos + count->field_length) || @@ -1736,7 +1722,8 @@ static int compress_isam_file(MRG_INFO *mrg, HUFF_COUNTS *huff_counts) break; case FIELD_INTERVALL: global_count=count; - pos=(byte*) tree_search(&count->int_tree,start_pos); + pos=(byte*) tree_search(&count->int_tree, start_pos, + count->int_tree.custom_arg); intervall=(uint) (pos - count->tree_buff)/field_length; write_bits(tree->code[intervall],(uint) tree->code_len[intervall]); start_pos=end_pos; diff --git a/isam/static.c b/isam/static.c index 9c68a0cfdba..0a8dc809ad7 100644 --- a/isam/static.c +++ b/isam/static.c @@ -41,5 +41,5 @@ uint NEAR nisam_read_vec[]= { SEARCH_FIND, SEARCH_FIND | SEARCH_BIGGER, SEARCH_FIND | SEARCH_SMALLER, SEARCH_NO_FIND | SEARCH_BIGGER, SEARCH_NO_FIND | SEARCH_SMALLER, - SEARCH_FIND, SEARCH_LAST + SEARCH_FIND, SEARCH_LAST,SEARCH_LAST | SEARCH_SMALLER }; |