diff options
author | unknown <bar@bar.mysql.r18.ru> | 2003-01-31 17:08:14 +0400 |
---|---|---|
committer | unknown <bar@bar.mysql.r18.ru> | 2003-01-31 17:08:14 +0400 |
commit | f845e66b3f5615fcfc09db9bf62777b233a4b434 (patch) | |
tree | d7600d5601cd0f458ff39152714c428bd55349bc /sql/sql_string.cc | |
parent | 953e27208bb1c13addaa0caaaa15f8db28ef8d81 (diff) | |
download | mariadb-git-f845e66b3f5615fcfc09db9bf62777b233a4b434.tar.gz |
More use of new CHARSET_INFO functions and two bug fixes
sql/sql_string.cc:
More use of new CHARSET_INFO functions
strings/ctype-mb.c:
Bug fix
strings/ctype-utf8.c:
Bug fix
Diffstat (limited to 'sql/sql_string.cc')
-rw-r--r-- | sql/sql_string.cc | 39 |
1 files changed, 3 insertions, 36 deletions
diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 62b347b672d..21e38397842 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -363,46 +363,13 @@ bool String::append(IO_CACHE* file, uint32 arg_length) uint32 String::numchars() { -#ifdef USE_MB - register uint32 n=0,mblen; - register const char *mbstr=Ptr; - register const char *end=mbstr+str_length; - if (use_mb(str_charset)) - { - while (mbstr < end) { - if ((mblen=my_ismbchar(str_charset, mbstr,end))) mbstr+=mblen; - else ++mbstr; - ++n; - } - return n; - } - else -#endif - return str_length; + return str_charset->numchars(str_charset, Ptr, Ptr+str_length); } int String::charpos(int i,uint32 offset) { -#ifdef USE_MB - register uint32 mblen; - register const char *mbstr=Ptr+offset; - register const char *end=Ptr+str_length; - if (use_mb(str_charset)) - { - if (i<=0) return i; - while (i && mbstr < end) { - if ((mblen=my_ismbchar(str_charset, mbstr,end))) mbstr+=mblen; - else ++mbstr; - --i; - } - if ( INT_MAX32-i <= (int) (mbstr-Ptr-offset)) - return INT_MAX32; - else - return (int) ((mbstr-Ptr-offset)+i); - } - else -#endif - return i; + if (i<0) return i; + return str_charset->charpos(str_charset,Ptr+offset,Ptr+str_length,i); } int String::strstr(const String &s,uint32 offset) |