diff options
author | unknown <bar@mysql.com> | 2005-08-08 19:52:30 +0500 |
---|---|---|
committer | unknown <bar@mysql.com> | 2005-08-08 19:52:30 +0500 |
commit | 4112dc21765162ae3dfd356eedf480720eb32904 (patch) | |
tree | 9af79335dde7a3443f3f55a42ed6fd07728796af /mysys/charset.c | |
parent | 062258ca7e6d457a978be0be73a6ba727f81b6c8 (diff) | |
download | mariadb-git-4112dc21765162ae3dfd356eedf480720eb32904.tar.gz |
Bug#5439 : mysql_server_init() crashes if ShiftJIS path is passed
(important for Adobe).
mf_pack.c, mf_dirname.c, charset.c, my_sys.h:
- adding fs_character_set() function on Windows
- ignoring fake slashes which are just multibyte
parts in several functions in /mysys
Verified by Shu to work on WinXP and Win2k.
Test is not possible, or very hard to do.
include/my_sys.h:
Bug#5439 : mysql_server_init() crashes if ShiftJIS path is passed
(important for Adobe)
- adding fs_character_set() function on Windows
- ignoring fake slashes which are just multibyte
parts in several functions in /mysys
mysys/charset.c:
d
mysys/mf_dirname.c:
d
mysys/mf_pack.c:
d
Diffstat (limited to 'mysys/charset.c')
-rw-r--r-- | mysys/charset.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/mysys/charset.c b/mysys/charset.c index cabdbad3413..3a39fce9437 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -637,3 +637,29 @@ ulong escape_string_for_mysql(CHARSET_INFO *charset_info, char *to, *to= 0; return (ulong) (to - to_start); } + + +#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 |