diff options
author | pappa@c-4a09e253.1238-1-64736c10.cust.bredbandsbolaget.se <> | 2005-08-25 13:11:38 -0400 |
---|---|---|
committer | pappa@c-4a09e253.1238-1-64736c10.cust.bredbandsbolaget.se <> | 2005-08-25 13:11:38 -0400 |
commit | 02056f8e3ae729c06875ab63eef8680574b3d91e (patch) | |
tree | 86faf87634c19937967b360a0dd1413fc9eb2879 /mysys | |
parent | 1c9a78438e789a70c6ee3f227c164739c4bd25e2 (diff) | |
parent | 0c859d6651277c2ee3664cb14bb34a23d048731f (diff) | |
download | mariadb-git-02056f8e3ae729c06875ab63eef8680574b3d91e.tar.gz |
Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-5.0
into c-4a09e253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/mysql-5.1
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/Makefile.am | 2 | ||||
-rw-r--r-- | mysys/charset.c | 26 | ||||
-rw-r--r-- | mysys/list.c | 2 | ||||
-rw-r--r-- | mysys/mf_dirname.c | 33 | ||||
-rw-r--r-- | mysys/mf_getdate.c | 2 | ||||
-rw-r--r-- | mysys/mf_pack.c | 12 | ||||
-rw-r--r-- | mysys/my_init.c | 2 | ||||
-rw-r--r-- | mysys/thr_lock.c | 3 |
8 files changed, 76 insertions, 6 deletions
diff --git a/mysys/Makefile.am b/mysys/Makefile.am index 6b983dc38dd..7bfcb21c4ad 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -30,7 +30,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ mf_path.c mf_loadpath.c my_file.c \ my_open.c my_create.c my_dup.c my_seek.c my_read.c \ my_pread.c my_write.c \ - mf_keycache.c mf_keycaches.c my_crc32.c \ + mf_keycaches.c my_crc32.c \ mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \ mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c \ my_malloc.c my_realloc.c my_once.c mulalloc.c \ diff --git a/mysys/charset.c b/mysys/charset.c index 701170b747b..c02144fafc0 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -679,6 +679,32 @@ ulong escape_string_for_mysql(CHARSET_INFO *charset_info, } +#ifdef BACKSLASH_MBTAIL +static CHARSET_INFO *fs_cset_cache= NULL; + +CHARSET_INFO *fs_character_set() +{ + if (!fs_cset_cache) + { + char buf[10]= "cp"; + GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE, + buf+2, sizeof(buf)-3); + /* + We cannot call get_charset_by_name here + because fs_character_set() is executed before + LOCK_THD_charset mutex initialization, which + is used inside get_charset_by_name. + As we're now interested in cp932 only, + let's just detect it using strcmp(). + */ + fs_cset_cache= !strcmp(buf, "cp932") ? + &my_charset_cp932_japanese_ci : &my_charset_bin; + } + return fs_cset_cache; +} +#endif + + /* Escape apostrophes by doubling them up diff --git a/mysys/list.c b/mysys/list.c index c3cd6c94b9f..0e55c9399f5 100644 --- a/mysys/list.c +++ b/mysys/list.c @@ -109,7 +109,7 @@ int list_walk(LIST *list, list_walk_action action, gptr argument) { if ((error = (*action)(list->data,argument))) return error; - list=rest(list); + list=list_rest(list); } return 0; } diff --git a/mysys/mf_dirname.c b/mysys/mf_dirname.c index 3de82c05b87..45bf4d56c31 100644 --- a/mysys/mf_dirname.c +++ b/mysys/mf_dirname.c @@ -22,6 +22,9 @@ uint dirname_length(const char *name) { register my_string pos,gpos; +#ifdef BASKSLASH_MBTAIL + CHARSET_INFO *fs= fs_character_set(); +#endif #ifdef FN_DEVCHAR if ((pos=(char*)strrchr(name,FN_DEVCHAR)) == 0) #endif @@ -29,12 +32,22 @@ uint dirname_length(const char *name) gpos= pos++; for ( ; *pos ; pos++) /* Find last FN_LIBCHAR */ + { +#ifdef BASKSLASH_MBTAIL + uint l; + if (use_mb(fs) && (l= my_ismbchar(fs, pos, pos + 3))) + { + pos+= l - 1; + continue; + } +#endif if (*pos == FN_LIBCHAR || *pos == '/' #ifdef FN_C_AFTER_DIR || *pos == FN_C_AFTER_DIR || *pos == FN_C_AFTER_DIR_2 #endif ) gpos=pos; + } return ((uint) (uint) (gpos+1-(char*) name)); } @@ -85,6 +98,9 @@ uint dirname_part(my_string to, const char *name) char *convert_dirname(char *to, const char *from, const char *from_end) { char *to_org=to; +#ifdef BACKSLASH_MBTAIL + CHARSET_INFO *fs= fs_character_set(); +#endif /* We use -2 here, becasue we need place for the last FN_LIBCHAR */ if (!from_end || (from_end - from) > FN_REFLEN-2) @@ -103,7 +119,22 @@ char *convert_dirname(char *to, const char *from, const char *from_end) *to++= FN_C_AFTER_DIR; #endif else - *to++= *from; + { +#ifdef BACKSLASH_MBTAIL + uint l; + if (use_mb(fs) && (l= my_ismbchar(fs, from, from + 3))) + { + memmove(to, from, l); + to+= l; + from+= l - 1; + to_org= to; /* Don't look inside mbchar */ + } + else +#endif + { + *to++= *from; + } + } } *to=0; } diff --git a/mysys/mf_getdate.c b/mysys/mf_getdate.c index b12e68cc1f9..8998da8aefa 100644 --- a/mysys/mf_getdate.c +++ b/mysys/mf_getdate.c @@ -54,7 +54,7 @@ void get_date(register my_string to, int flag, time_t date) if (flag & GETDATE_GMT) start_time= localtime(&skr); else - gmtime(&skr,&tm_tmp); + start_time= gmtime(&skr); #endif if (flag & GETDATE_SHORT_DATE) sprintf(to,"%02d%02d%02d", diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c index 86172f648f4..049aa59a578 100644 --- a/mysys/mf_pack.c +++ b/mysys/mf_pack.c @@ -124,6 +124,9 @@ uint cleanup_dirname(register my_string to, const char *from) reg4 my_string start; char parent[5], /* for "FN_PARENTDIR" */ buff[FN_REFLEN+1],*end_parentdir; +#ifdef BACKSLASH_MBTAIL + CHARSET_INFO *fs= fs_character_set(); +#endif DBUG_ENTER("cleanup_dirname"); DBUG_PRINT("enter",("from: '%s'",from)); @@ -141,6 +144,15 @@ uint cleanup_dirname(register my_string to, const char *from) length=(uint) (strmov(parent+1,FN_PARENTDIR)-parent); for (pos=start ; (*pos= *from_ptr++) != 0 ; pos++) { +#ifdef BACKSLASH_MBTAIL + uint l; + if (use_mb(fs) && (l= my_ismbchar(fs, from_ptr - 1, from_ptr + 2))) + { + for (l-- ; l ; *++pos= *from_ptr++, l--); + start= pos + 1; /* Don't look inside multi-byte char */ + continue; + } +#endif if (*pos == '/') *pos = FN_LIBCHAR; if (*pos == FN_LIBCHAR) diff --git a/mysys/my_init.c b/mysys/my_init.c index 410cb2e7ee7..abb1ad27f7b 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -395,7 +395,7 @@ static void netware_init() } /* Parse program name and change to base format */ - name= my_progname; + name= (char*) my_progname; for (; *name; name++) { if (*name == '\\') diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index c076e8934ad..41266d61b0a 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -1206,7 +1206,8 @@ void thr_print_locks(void) pthread_mutex_lock(&THR_LOCK_lock); puts("Current locks:"); - for (list=thr_lock_thread_list ; list && count++ < MAX_THREADS ; list=rest(list)) + for (list= thr_lock_thread_list; list && count++ < MAX_THREADS; + list= list_rest(list)) { THR_LOCK *lock=(THR_LOCK*) list->data; VOID(pthread_mutex_lock(&lock->mutex)); |