From 1b412a501e22602ac5edcd875e09bd3814b6e841 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 19 May 1998 20:08:37 +0000 Subject: passdb.c: Fixed typo in coment. smb.h: Removed comments no longer valid. smbpass.c: Stopped dummy function from being prototyped. util.c: Fix for multibyte char problems with strlower, strupper and string_replace. Jeremy. (This used to be commit cd244b45a5d35fceee2a4034b0c6aabdb58871aa) --- source3/lib/util.c | 53 ++++++++++++++++++++++------------------------------- 1 file changed, 22 insertions(+), 31 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/util.c b/source3/lib/util.c index 4c8133cabf..75c3de541f 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1115,9 +1115,15 @@ void strlower(char *s) else #endif /* KANJI_WIN95_COMPATIBILITY */ { - if (isupper(*s)) - *s = tolower(*s); - s++; + int skip = skip_multibyte_char( *s ); + if( skip != 0 ) + s += skip; + else + { + if (isupper(*s)) + *s = tolower(*s); + s++; + } } } } @@ -1162,9 +1168,15 @@ void strupper(char *s) else #endif /* KANJI_WIN95_COMPATIBILITY */ { - if (islower(*s)) - *s = toupper(*s); - s++; + int skip = skip_multibyte_char( *s ); + if( skip != 0 ) + s += skip; + else + { + if (islower(*s)) + *s = toupper(*s); + s++; + } } } } @@ -1197,34 +1209,13 @@ BOOL strisnormal(char *s) ****************************************************************************/ void string_replace(char *s,char oldc,char newc) { + int skip; while (*s) { -#if !defined(KANJI_WIN95_COMPATIBILITY) - /* - * For completeness we should put in equivalent code for code pages - * 949 (Korean hangul) and 950 (Big5 Traditional Chinese) here - but - * doubt anyone wants Samba to behave differently from Win95 and WinNT - * here. They both treat full width ascii characters as case senstive - * filenames (ie. they don't do the work we do here). - * JRA. - */ - - if(lp_client_code_page() == KANJI_CODEPAGE) - { - /* Win95 treats full width ascii characters as case sensitive. */ - if (is_shift_jis (*s)) - s += 2; - else if (is_kana (*s)) - s++; - else - { - if (oldc == *s) - *s = newc; - s++; - } - } + skip = skip_multibyte_char( *s ); + if( skip != 0 ) + s += skip; else -#endif /* KANJI_WIN95_COMPATIBILITY */ { if (oldc == *s) *s = newc; -- cgit