diff options
Diffstat (limited to 'strings')
80 files changed, 3184 insertions, 1470 deletions
diff --git a/strings/CHARSET_INFO.txt b/strings/CHARSET_INFO.txt index bb8e40025c7..6f0a810be37 100644 --- a/strings/CHARSET_INFO.txt +++ b/strings/CHARSET_INFO.txt @@ -208,14 +208,11 @@ charpos() - calculates the offset of the given position in the string. Used in SQL functions LEFT(), RIGHT(), SUBSTRING(), INSERT() -well_formed_length() - - finds the length of correctly formed multi-byte beginning. - Used in INSERTs to cut a beginning of the given string - which is - a) "well formed" according to the given character set. +well_formed_len() + - returns length of a given multi-byte string in bytes + Used in INSERTs to shorten the given string so it + a) is "well formed" according to the given character set b) can fit into the given data type - Terminates the string in the good position, taking in account - multi-byte character boundaries. lengthsp() - returns the length of the given string without trailing spaces. diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt index 4f752044271..a37c37b489a 100755 --- a/strings/CMakeLists.txt +++ b/strings/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2006 MySQL AB +# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,11 +17,16 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX") INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) -ADD_LIBRARY(strings bchange.c bcmp.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c + +SET(STRINGS_SOURCES bchange.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c ctype-czech.c ctype-euc_kr.c ctype-eucjpms.c ctype-extra.c ctype-gb2312.c ctype-gbk.c ctype-latin1.c ctype-mb.c ctype-simple.c ctype-sjis.c ctype-tis620.c ctype-uca.c ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c int2str.c is_prefix.c llstr.c longlong2str.c my_strtoll10.c my_vsnprintf.c r_strinstr.c str2int.c str_alloc.c strcend.c strend.c strfill.c strmake.c strmov.c strnmov.c strtod.c strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c xml.c - strcont.c strinstr.c) + my_strchr.c strcont.c strinstr.c strnlen.c) + +IF(NOT SOURCE_SUBLIBS) + ADD_LIBRARY(strings ${STRINGS_SOURCES}) +ENDIF(NOT SOURCE_SUBLIBS) diff --git a/strings/Makefile.am b/strings/Makefile.am index 143786d7f1c..b88cd1c8d8c 100644 --- a/strings/Makefile.am +++ b/strings/Makefile.am @@ -1,5 +1,4 @@ -# Copyright (c) 2000-2006 MySQL AB, 2009, 2010 Sun Microsystems, Inc. -# Use is subject to license terms. +# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,24 +21,25 @@ pkglib_LIBRARIES = libmystrings.a # Exact one of ASSEMBLER_X if ASSEMBLER_x86 ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s -CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c strmov.c +CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c my_strchr.c strmov.c else if ASSEMBLER_sparc32 # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s -CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c strmov.c +CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c strmov.c else #no assembler ASRCS = # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile -CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c +CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c endif endif libmystrings_a_SOURCES = $(ASRCS) $(CSRCS) noinst_PROGRAMS = conf_to_src +CLEANFILES = str_test uctypedump test_decimal # Default charset definitions EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-win1250ch.c \ ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-utf8.c \ @@ -53,10 +53,11 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc bmove_upp-sparc.s strappend-sparc.s strend-sparc.s \ strinstr-sparc.s strmake-sparc.s strmov-sparc.s \ strnmov-sparc.s strstr-sparc.s strxmov-sparc.s \ - t_ctype.h CMakeLists.txt CHARSET_INFO.txt + t_ctype.h my_strchr.c CMakeLists.txt \ + CHARSET_INFO.txt libmystrings_a_LIBADD= -conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c bcmp.c +conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c conf_to_src_LDADD= #force static linking of conf_to_src - essential when linking against #custom installation of libc @@ -71,6 +72,9 @@ FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@ str_test: str_test.c $(pkglib_LIBRARIES) $(LINK) $(FLAGS) -DMAIN $(INCLUDES) $(srcdir)/str_test.c $(LDADD) $(pkglib_LIBRARIES) +uctypedump: uctypedump.c + $(LINK) $(INCLUDES) $(srcdir)/uctypedump.c + test_decimal$(EXEEXT): decimal.c $(pkglib_LIBRARIES) $(CP) $(srcdir)/decimal.c ./test_decimal.c $(LINK) $(FLAGS) -DMAIN ./test_decimal.c $(LDADD) $(pkglib_LIBRARIES) diff --git a/strings/bchange.c b/strings/bchange.c index f17fb9bea27..13d491844f7 100644 --- a/strings/bchange.c +++ b/strings/bchange.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : bchange.c Author : Michael widenius @@ -26,10 +28,10 @@ #include <my_global.h> #include "m_string.h" -void bchange(register char *dst, uint old_length, register const char *src, - uint new_length, uint tot_length) +void bchange(register uchar *dst, size_t old_length, register const uchar *src, + size_t new_length, size_t tot_length) { - uint rest=tot_length-old_length; + size_t rest=tot_length-old_length; if (old_length < new_length) bmove_upp(dst+rest+new_length,dst+tot_length,rest); else diff --git a/strings/bcmp.c b/strings/bcmp.c deleted file mode 100644 index fd9ee5c1b96..00000000000 --- a/strings/bcmp.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - bcmp(s1, s2, len) returns 0 if the "len" bytes starting at "s1" are - identical to the "len" bytes starting at "s2", non-zero if they are - different. - Now only used with purify because purify gives wrong warnings when - comparing a shorter string with bcmp. -*/ - -#include <my_global.h> -#include "m_string.h" - -#ifdef HAVE_purify -#undef bcmp -#undef HAVE_BCMP -#endif - -#if !defined(bcmp) && !defined(HAVE_BCMP) - -#if defined(MC68000) && defined(DS90) - -int bcmp(s1,s2, len) -const char *s1; -const char *s2; -uint len; /* 0 <= len <= 65535 */ -{ - asm(" movl 12(a7),d0 "); - asm(" subqw #1,d0 "); - asm(" blt .L5 "); - asm(" movl 4(a7),a1 "); - asm(" movl 8(a7),a0 "); - asm(".L4: cmpmb (a0)+,(a1)+ "); - asm(" dbne d0,.L4 "); - asm(".L5: addqw #1,d0 "); -} - -#else - -#ifndef HAVE_purify -int bcmp(register const char *s1,register const char *s2, register uint len) -#else -int my_bcmp(register const char *s1,register const char *s2, register uint len) -#endif -{ - while (len-- != 0 && *s1++ == *s2++) ; - return len+1; -} - -#endif -#endif /* BSD_FUNCS */ diff --git a/strings/bcopy-duff.c b/strings/bcopy-duff.c index 215857715fd..2a461f349ce 100644 --- a/strings/bcopy-duff.c +++ b/strings/bcopy-duff.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #define IFACTOR 4 diff --git a/strings/bfill.c b/strings/bfill.c index 2750553f48a..e6c1c3e0ed0 100644 --- a/strings/bfill.c +++ b/strings/bfill.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2002 MySQL AB +/* Copyright (c) 2000-2002, 2006 MySQL AB + Use is subject to license terms. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -12,8 +13,9 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ + Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA +*/ /* File : bfill.c Author : Richard A. O'Keefe. diff --git a/strings/bmove.c b/strings/bmove.c index ae9641a5d58..f7f29271de1 100644 --- a/strings/bmove.c +++ b/strings/bmove.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2002 MySQL AB +/* Copyright (c) 2000-2002, 2006 MySQL AB + Use is subject to license terms. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -12,8 +13,9 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ + Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA +*/ /* File : bmove.c Author : Richard A. O'Keefe. diff --git a/strings/bmove512.c b/strings/bmove512.c index c3a4b7dfe4e..bd863f82071 100644 --- a/strings/bmove512.c +++ b/strings/bmove512.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2003, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : bmove512.c Author : Michael Widenius; @@ -36,7 +38,7 @@ #define LONG ulonglong #endif -void bmove512(gptr to, const gptr from, register uint length) +void bmove512(uchar *to, const uchar *from, register size_t length) { reg1 LONG *f,*t,*end= (LONG*) ((char*) from+length); diff --git a/strings/bmove_upp.c b/strings/bmove_upp.c index 02b59bdb703..48af2e43737 100644 --- a/strings/bmove_upp.c +++ b/strings/bmove_upp.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : bmove.c Author : Michael widenius @@ -41,7 +43,8 @@ asm(".L5: "); } #else -void bmove_upp(register char *dst, register const char *src, register uint len) +void bmove_upp(register uchar *dst, register const uchar *src, + register size_t len) { while (len-- != 0) *--dst = *--src; } diff --git a/strings/bzero.c b/strings/bzero.c deleted file mode 100644 index b720de65eed..00000000000 --- a/strings/bzero.c +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* File : bzero.c - Author : Richard A. O'Keefe. - Michael Widenius; ifdef MC68000 - Updated: 23 April 1984 - Defines: bzero() - - bzero(dst, len) moves "len" 0 bytes to "dst". - Thus to clear a disc buffer to 0s do bzero(buffer, BUFSIZ). - - Note: the "b" routines are there to exploit certain VAX order codes, - The asm code is presented for your interest and amusement. -*/ - -#ifndef BSD_FUNCS -#include "strings.h" - -#ifdef bzero -#undef bzero /* remove macro */ -#endif - -#if VaxAsm - -static void _bzero64 _A((char *dst,int len)); - -void bzero(dst, len) -char *dst; -uint len; -{ - while ((int) len >= 64*K) - { - _bzero64(dst, 64*K-1); - dst += 64*K-1; - len -= 64*K-1; - } - _bzero64(dst, len); -} - -_bzero64(dst, len) -char *dst; -int len; -{ - asm("movc5 $0,*4(ap),$0,8(ap),*4(ap)"); -} - -#else - -#if defined(MC68000) && defined(DS90) - -void bzero(dst, len) -char *dst; -uint len; -{ - bfill(dst,len,0); /* This is very optimized ! */ -} /* bzero */ - -#else - -void bzero(dst, len) -register char *dst; -register uint len; -{ - while (len-- != 0) *dst++ = 0; -} /* bzero */ - -#endif -#endif -#endif /* BSD_FUNCS */ diff --git a/strings/conf_to_src.c b/strings/conf_to_src.c index dc2a300a2ec..66a29a4267a 100644 --- a/strings/conf_to_src.c +++ b/strings/conf_to_src.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000-2003, 2005-2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include <my_global.h> #include <m_string.h> @@ -249,7 +251,7 @@ static void fprint_copyright(FILE *file) { fprintf(file, -"/* Copyright (C) 2000-2007 MySQL AB\n" +"/* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.\n" "\n" " This program is free software; you can redistribute it and/or modify\n" " it under the terms of the GNU General Public License as published by\n" diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index c73247db404..1478da875f7 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* * This file is basicly usa7 character sets with some extra functions @@ -220,7 +221,7 @@ static uint16 big5strokexfrm(uint16 i) static int my_strnncoll_big5_internal(const uchar **a_res, - const uchar **b_res, uint length) + const uchar **b_res, size_t length) { const uchar *a= *a_res, *b= *b_res; @@ -249,11 +250,11 @@ static int my_strnncoll_big5_internal(const uchar **a_res, /* Compare strings */ static int my_strnncoll_big5(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool b_is_prefix) { - uint length= min(a_length, b_length); + size_t length= min(a_length, b_length); int res= my_strnncoll_big5_internal(&a, &b, length); return res ? res : (int)((b_is_prefix ? length : a_length) - b_length); } @@ -262,11 +263,11 @@ static int my_strnncoll_big5(CHARSET_INFO *cs __attribute__((unused)), /* compare strings, ignore end space */ static int my_strnncollsp_big5(CHARSET_INFO * cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference) { - uint length= min(a_length, b_length); + size_t length= min(a_length, b_length); int res= my_strnncoll_big5_internal(&a, &b, length); #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE @@ -301,12 +302,12 @@ static int my_strnncollsp_big5(CHARSET_INFO * cs __attribute__((unused)), } -static int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint len, - const uchar * src, uint srclen) +static size_t my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { uint16 e; - uint dstlen= len; + size_t dstlen= len; uchar *dest_end= dest + dstlen; len = srclen; @@ -329,7 +330,7 @@ static int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)), } #if 0 -static int my_strcoll_big5(const uchar * s1, const uchar * s2) +static int my_strcoll_big5(const uchar *s1, const uchar *s2) { while (*s1 && *s2) @@ -348,7 +349,7 @@ static int my_strcoll_big5(const uchar * s1, const uchar * s2) return 0; } -static int my_strxfrm_big5(uchar * dest, const uchar * src, int len) +static int my_strxfrm_big5(uchar *dest, const uchar *src, int len) { uint16 e; uchar *d = dest; @@ -377,93 +378,14 @@ static int my_strxfrm_big5(uchar * dest, const uchar * src, int len) #endif -/* -** Calculate min_str and max_str that ranges a LIKE string. -** Arguments: -** ptr Pointer to LIKE string. -** ptr_length Length of LIKE string. -** escape Escape character in LIKE. (Normally '\'). -** All escape characters should be removed from min_str and max_str -** res_length Length of min_str and max_str. -** min_str Smallest case sensitive string that ranges LIKE. -** Should be space padded to res_length. -** max_str Largest case sensitive string that ranges LIKE. -** Normally padded with the biggest character sort value. -** -** The function should return 0 if ok and 1 if the LIKE string can't be -** optimized ! -*/ - -#define max_sort_char ((char) 255) - -static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr,uint ptr_length, - pbool escape, pbool w_one, pbool w_many, - uint res_length, char *min_str,char *max_str, - uint *min_length,uint *max_length) -{ - const char *end= ptr + ptr_length; - char *min_org=min_str; - char *min_end=min_str+res_length; - uint charlen= res_length / cs->mbmaxlen; - - for (; ptr != end && min_str != min_end && charlen > 0; ptr++, charlen--) - { - if (ptr+1 != end && isbig5code(ptr[0],ptr[1])) - { - *min_str++= *max_str++ = *ptr++; - *min_str++= *max_str++ = *ptr; - continue; - } - if (*ptr == escape && ptr+1 != end) - { - ptr++; /* Skip escape */ - if (isbig5code(ptr[0], ptr[1])) - *min_str++= *max_str++ = *ptr++; - if (min_str < min_end) - *min_str++= *max_str++= *ptr; - continue; - } - if (*ptr == w_one) /* '_' in SQL */ - { - *min_str++='\0'; /* This should be min char */ - *max_str++=max_sort_char; - continue; - } - if (*ptr == w_many) /* '%' in SQL */ - { - /* - Calculate length of keys: - 'a\0\0... is the smallest possible string when we have space expand - a\ff\ff... is the biggest possible string - */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (uint) (min_str - min_org) : - res_length); - *max_length= res_length; - do { - *min_str++ = 0; - *max_str++ = max_sort_char; - } while (min_str != min_end); - return 0; - } - *min_str++= *max_str++ = *ptr; - } - - *min_length= *max_length= (uint) (min_str-min_org); - while (min_str != min_end) - *min_str++= *max_str++= ' '; - return 0; -} - - -static int ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)), - const char* p, const char *e) +static uint ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)), + const char* p, const char *e) { return (isbig5head(*(p)) && (e)-(p)>1 && isbig5tail(*((p)+1))? 2: 0); } -static int mbcharlen_big5(CHARSET_INFO *cs __attribute__((unused)), uint c) +static uint mbcharlen_big5(CHARSET_INFO *cs __attribute__((unused)), uint c) { return (isbig5head(c)? 2 : 1); } @@ -6241,7 +6163,7 @@ static int func_uni_big5_onechar(int code){ static int my_wc_mb_big5(CHARSET_INFO *cs __attribute__((unused)), - my_wc_t wc, unsigned char *s, unsigned char *e) + my_wc_t wc, uchar *s, uchar *e) { int code; @@ -6299,9 +6221,9 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)), CP950 and HKSCS additional characters are also accepted. */ static -uint my_well_formed_len_big5(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e, - uint pos, int *error) +size_t my_well_formed_len_big5(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t pos, int *error) { const char *b0= b; const char *emb= e - 1; /* Last possible end of an MB character */ @@ -6326,7 +6248,7 @@ uint my_well_formed_len_big5(CHARSET_INFO *cs __attribute__((unused)), break; } } - return (uint) (b - b0); + return (size_t) (b - b0); } @@ -6337,7 +6259,7 @@ static MY_COLLATION_HANDLER my_collation_big5_chinese_ci_handler = my_strnncollsp_big5, my_strnxfrm_big5, my_strnxfrmlen_simple, - my_like_range_big5, + my_like_range_mb, my_wildcmp_mb, my_strcasecmp_mb, my_instr_mb, @@ -6357,6 +6279,7 @@ static MY_CHARSET_HANDLER my_charset_big5_handler= my_numcells_8bit, my_mb_wc_big5, /* mb_wc */ my_wc_mb_big5, /* wc_mb */ + my_mb_ctype_mb, my_caseup_str_mb, my_casedn_str_mb, my_caseup_mb, @@ -6400,7 +6323,7 @@ CHARSET_INFO my_charset_big5_chinese_ci= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xF9D5, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_big5_handler, @@ -6433,7 +6356,7 @@ CHARSET_INFO my_charset_big5_bin= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xF9FE, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_big5_handler, diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index f9d29ca1739..424549de9b2 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2002 MySQL AB & tommy@valley.ne.jp. +/* Copyright (c) 2002-2007 MySQL AB & tommy@valley.ne.jp + Use is subject to license terms. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -12,8 +13,9 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ + Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA +*/ /* This file is for binary pseudo charset, created by bar@mysql.com */ @@ -69,26 +71,26 @@ static uchar bin_char_array[] = static my_bool my_coll_init_8bit_bin(CHARSET_INFO *cs, - void *(*alloc)(uint) __attribute__((unused))) + void *(*alloc)(size_t) __attribute__((unused))) { cs->max_sort_char=255; return FALSE; } static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)), - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { - uint len=min(slen,tlen); + size_t len=min(slen,tlen); int cmp= memcmp(s,t,len); return cmp ? cmp : (int)((t_is_prefix ? len : slen) - tlen); } -uint my_lengthsp_binary(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr __attribute__((unused)), - uint length) +size_t my_lengthsp_binary(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr __attribute__((unused)), + size_t length) { return length; } @@ -117,8 +119,8 @@ uint my_lengthsp_binary(CHARSET_INFO *cs __attribute__((unused)), */ static int my_strnncollsp_binary(CHARSET_INFO * cs __attribute__((unused)), - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference __attribute__((unused))) { @@ -127,11 +129,11 @@ static int my_strnncollsp_binary(CHARSET_INFO * cs __attribute__((unused)), static int my_strnncoll_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { - uint len=min(slen,tlen); + size_t len=min(slen,tlen); int cmp= memcmp(s,t,len); return cmp ? cmp : (int)((t_is_prefix ? len : slen) - tlen); } @@ -163,12 +165,12 @@ static int my_strnncoll_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), */ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference) { const uchar *end; - uint length; + size_t length; int res; #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE @@ -211,17 +213,18 @@ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), /* This function is used for all conversion functions */ -static uint my_case_str_bin(CHARSET_INFO *cs __attribute__((unused)), - char *str __attribute__((unused))) +static size_t my_case_str_bin(CHARSET_INFO *cs __attribute__((unused)), + char *str __attribute__((unused))) { return 0; } -static uint my_case_bin(CHARSET_INFO *cs __attribute__((unused)), - char *src __attribute__((unused)), - uint srclen, - char *dst __attribute__((unused)), - uint dstlen __attribute__((unused))) + +static size_t my_case_bin(CHARSET_INFO *cs __attribute__((unused)), + char *src __attribute__((unused)), + size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) { return srclen; } @@ -234,8 +237,8 @@ static int my_strcasecmp_bin(CHARSET_INFO * cs __attribute__((unused)), } -int my_mbcharlen_8bit(CHARSET_INFO *cs __attribute__((unused)), - uint c __attribute__((unused))) +uint my_mbcharlen_8bit(CHARSET_INFO *cs __attribute__((unused)), + uint c __attribute__((unused))) { return 1; } @@ -243,8 +246,8 @@ int my_mbcharlen_8bit(CHARSET_INFO *cs __attribute__((unused)), static int my_mb_wc_bin(CHARSET_INFO *cs __attribute__((unused)), my_wc_t *wc, - const unsigned char *str, - const unsigned char *end __attribute__((unused))) + const uchar *str, + const uchar *end __attribute__((unused))) { if (str >= end) return MY_CS_TOOSMALL; @@ -256,8 +259,8 @@ static int my_mb_wc_bin(CHARSET_INFO *cs __attribute__((unused)), static int my_wc_mb_bin(CHARSET_INFO *cs __attribute__((unused)), my_wc_t wc, - unsigned char *s, - unsigned char *e __attribute__((unused))) + uchar *s, + uchar *e __attribute__((unused))) { if (s >= e) return MY_CS_TOOSMALL; @@ -272,7 +275,8 @@ static int my_wc_mb_bin(CHARSET_INFO *cs __attribute__((unused)), void my_hash_sort_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *key, uint len,ulong *nr1, ulong *nr2) + const uchar *key, size_t len, + ulong *nr1, ulong *nr2) { const uchar *pos = key; @@ -295,7 +299,7 @@ void my_hash_sort_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *key, uint len,ulong *nr1, ulong *nr2) + const uchar *key, size_t len,ulong *nr1, ulong *nr2) { const uchar *pos = key; @@ -397,9 +401,9 @@ int my_wildcmp_bin(CHARSET_INFO *cs, } -static int my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint dstlen, - const uchar *src, uint srclen) +static size_t my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t dstlen, + const uchar *src, size_t srclen) { if (dest != src) memcpy(dest, src, min(dstlen,srclen)); @@ -410,9 +414,9 @@ static int my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)), static -int my_strnxfrm_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint dstlen, - const uchar *src, uint srclen) +size_t my_strnxfrm_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t dstlen, + const uchar *src, size_t srclen) { if (dest != src) memcpy(dest, src, min(dstlen,srclen)); @@ -424,8 +428,8 @@ int my_strnxfrm_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), static uint my_instr_bin(CHARSET_INFO *cs __attribute__((unused)), - const char *b, uint b_length, - const char *s, uint s_length, + const char *b, size_t b_length, + const char *s, size_t s_length, my_match_t *match, uint nmatch) { register const uchar *str, *search, *end, *search_end; @@ -465,7 +469,7 @@ skip: if (nmatch > 0) { match[0].beg= 0; - match[0].end= (uint) (str- (const uchar*)b-1); + match[0].end= (size_t) (str- (const uchar*)b-1); match[0].mb_len= match[0].end; if (nmatch > 1) @@ -485,64 +489,65 @@ skip: MY_COLLATION_HANDLER my_collation_8bit_bin_handler = { - my_coll_init_8bit_bin, - my_strnncoll_8bit_bin, - my_strnncollsp_8bit_bin, - my_strnxfrm_8bit_bin, - my_strnxfrmlen_simple, - my_like_range_simple, - my_wildcmp_bin, - my_strcasecmp_bin, - my_instr_bin, - my_hash_sort_8bit_bin, - my_propagate_simple + my_coll_init_8bit_bin, + my_strnncoll_8bit_bin, + my_strnncollsp_8bit_bin, + my_strnxfrm_8bit_bin, + my_strnxfrmlen_simple, + my_like_range_simple, + my_wildcmp_bin, + my_strcasecmp_bin, + my_instr_bin, + my_hash_sort_8bit_bin, + my_propagate_simple }; static MY_COLLATION_HANDLER my_collation_binary_handler = { - NULL, /* init */ - my_strnncoll_binary, - my_strnncollsp_binary, - my_strnxfrm_bin, - my_strnxfrmlen_simple, - my_like_range_simple, - my_wildcmp_bin, - my_strcasecmp_bin, - my_instr_bin, - my_hash_sort_bin, - my_propagate_simple + NULL, /* init */ + my_strnncoll_binary, + my_strnncollsp_binary, + my_strnxfrm_bin, + my_strnxfrmlen_simple, + my_like_range_simple, + my_wildcmp_bin, + my_strcasecmp_bin, + my_instr_bin, + my_hash_sort_bin, + my_propagate_simple }; static MY_CHARSET_HANDLER my_charset_handler= { - NULL, /* init */ - NULL, /* ismbchar */ - my_mbcharlen_8bit, /* mbcharlen */ - my_numchars_8bit, - my_charpos_8bit, - my_well_formed_len_8bit, - my_lengthsp_binary, - my_numcells_8bit, - my_mb_wc_bin, - my_wc_mb_bin, - my_case_str_bin, - my_case_str_bin, - my_case_bin, - my_case_bin, - my_snprintf_8bit, - my_long10_to_str_8bit, - my_longlong10_to_str_8bit, - my_fill_8bit, - my_strntol_8bit, - my_strntoul_8bit, - my_strntoll_8bit, - my_strntoull_8bit, - my_strntod_8bit, - my_strtoll10_8bit, - my_strntoull10rnd_8bit, - my_scan_8bit + NULL, /* init */ + NULL, /* ismbchar */ + my_mbcharlen_8bit, /* mbcharlen */ + my_numchars_8bit, + my_charpos_8bit, + my_well_formed_len_8bit, + my_lengthsp_binary, + my_numcells_8bit, + my_mb_wc_bin, + my_wc_mb_bin, + my_mb_ctype_8bit, + my_case_str_bin, + my_case_str_bin, + my_case_bin, + my_case_bin, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit }; diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c index 48c217921b1..3d5601e6a09 100644 --- a/strings/ctype-cp932.c +++ b/strings/ctype-cp932.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* This file is for cp932 charaset (Windows Japanese), and created based on ctype-sjis.c file */ @@ -182,13 +183,13 @@ static uchar NEAR sort_order_cp932[]= (0x80<=(c) && (c)<=0xfc)) -static int ismbchar_cp932(CHARSET_INFO *cs __attribute__((unused)), +static uint ismbchar_cp932(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) { return (iscp932head((uchar) *p) && (e-p)>1 && iscp932tail((uchar)p[1]) ? 2: 0); } -static int mbcharlen_cp932(CHARSET_INFO *cs __attribute__((unused)),uint c) +static uint mbcharlen_cp932(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (iscp932head((uchar) c) ? 2 : 1); } @@ -198,8 +199,8 @@ static int mbcharlen_cp932(CHARSET_INFO *cs __attribute__((unused)),uint c) static int my_strnncoll_cp932_internal(CHARSET_INFO *cs, - const uchar **a_res, uint a_length, - const uchar **b_res, uint b_length) + const uchar **a_res, size_t a_length, + const uchar **b_res, size_t b_length) { const uchar *a= *a_res, *b= *b_res; const uchar *a_end= a + a_length; @@ -230,8 +231,8 @@ static int my_strnncoll_cp932_internal(CHARSET_INFO *cs, static int my_strnncoll_cp932(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool b_is_prefix) { int res= my_strnncoll_cp932_internal(cs, &a, a_length, &b, b_length); @@ -242,8 +243,8 @@ static int my_strnncoll_cp932(CHARSET_INFO *cs __attribute__((unused)), static int my_strnncollsp_cp932(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference __attribute__((unused))) { @@ -283,9 +284,9 @@ static int my_strnncollsp_cp932(CHARSET_INFO *cs __attribute__((unused)), -static int my_strnxfrm_cp932(CHARSET_INFO *cs __attribute__((unused)), - uchar *dest, uint len, - const uchar *src, uint srclen) +static size_t my_strnxfrm_cp932(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { uchar *d_end = dest + len; uchar *s_end = (uchar*) src + srclen; @@ -306,75 +307,6 @@ static int my_strnxfrm_cp932(CHARSET_INFO *cs __attribute__((unused)), } -/* -** Calculate min_str and max_str that ranges a LIKE string. -** Arguments: -** ptr Pointer to LIKE string. -** ptr_length Length of LIKE string. -** escape Escape character in LIKE. (Normally '\'). -** All escape characters should be removed from min_str and max_str -** res_length Length of min_str and max_str. -** min_str Smallest case sensitive string that ranges LIKE. -** Should be space padded to res_length. -** max_str Largest case sensitive string that ranges LIKE. -** Normally padded with the biggest character sort value. -** -** The function should return 0 if ok and 1 if the LIKE string can't be -** optimized ! -*/ - -#define max_sort_char ((char) 255) - -static my_bool my_like_range_cp932(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr,uint ptr_length, - pbool escape, pbool w_one, pbool w_many, - uint res_length, char *min_str,char *max_str, - uint *min_length,uint *max_length) -{ - const char *end=ptr+ptr_length; - char *min_org=min_str; - char *min_end=min_str+res_length; - - while (ptr < end && min_str < min_end) { - if (ismbchar_cp932(cs, ptr, end)) { - *min_str++ = *max_str++ = *ptr++; - if (min_str < min_end) - *min_str++ = *max_str++ = *ptr++; - continue; - } - if (*ptr == escape && ptr+1 < end) { - ptr++; /* Skip escape */ - if (ismbchar_cp932(cs, ptr, end)) - *min_str++ = *max_str++ = *ptr++; - if (min_str < min_end) - *min_str++ = *max_str++ = *ptr++; - continue; - } - if (*ptr == w_one) { /* '_' in SQL */ - *min_str++ = '\0'; /* This should be min char */ - *max_str++ = max_sort_char; - ptr++; - continue; - } - if (*ptr == w_many) - { /* '%' in SQL */ - *min_length = (uint)(min_str - min_org); - *max_length = res_length; - do - { - *min_str++= 0; - *max_str++= max_sort_char; - } while (min_str < min_end); - return 0; - } - *min_str++ = *max_str++ = *ptr++; - } - *min_length = *max_length = (uint)(min_str - min_org); - while (min_str < min_end) - *min_str++ = *max_str++ = ' '; /* Because if key compression */ - return 0; -} - /* page 0 0x00A1-0x00DF */ static uint16 tab_cp932_uni0[]={ 0xFF61,0xFF62,0xFF63,0xFF64,0xFF65,0xFF66,0xFF67,0xFF68, @@ -5386,12 +5318,12 @@ my_mb_wc_cp932(CHARSET_INFO *cs __attribute__((unused)), } static -uint my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)), +size_t my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)), const char *str, const char *str_end) { - uint clen= 0; - const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) str_end; + size_t clen= 0; + const uchar *b= (const uchar *) str; + const uchar *e= (const uchar *) str_end; for (clen= 0; b < e; ) { @@ -5418,9 +5350,11 @@ uint my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)), Returns a well formed length of a cp932 string. cp932 additional characters are also accepted. */ + static -uint my_well_formed_len_cp932(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e, uint pos, int *error) +size_t my_well_formed_len_cp932(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t pos, int *error) { const char *b0= b; *error= 0; @@ -5453,7 +5387,7 @@ uint my_well_formed_len_cp932(CHARSET_INFO *cs __attribute__((unused)), break; } } - return (uint) (b - b0); + return (size_t) (b - b0); } @@ -5464,7 +5398,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler = my_strnncollsp_cp932, my_strnxfrm_cp932, my_strnxfrmlen_simple, - my_like_range_cp932, + my_like_range_mb, my_wildcmp_mb, /* wildcmp */ my_strcasecmp_8bit, my_instr_mb, @@ -5485,10 +5419,11 @@ static MY_CHARSET_HANDLER my_charset_handler= my_numcells_cp932, my_mb_wc_cp932, /* mb_wc */ my_wc_mb_cp932, /* wc_mb */ - my_caseup_str_8bit, - my_casedn_str_8bit, - my_caseup_8bit, - my_casedn_8bit, + my_mb_ctype_mb, + my_caseup_str_mb, + my_casedn_str_mb, + my_caseup_mb, + my_casedn_mb, my_snprintf_8bit, my_long10_to_str_8bit, my_longlong10_to_str_8bit, @@ -5529,7 +5464,7 @@ CHARSET_INFO my_charset_cp932_japanese_ci= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFCFC, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, @@ -5561,7 +5496,7 @@ CHARSET_INFO my_charset_cp932_bin= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFCFC, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c index d0104a50f4a..d68efc34f3d 100644 --- a/strings/ctype-czech.c +++ b/strings/ctype-czech.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000-2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File strings/ctype-czech.c for MySQL. @@ -83,7 +85,7 @@ below for what are the "special values" */ -static uchar * CZ_SORT_TABLE[] = { +static uchar *CZ_SORT_TABLE[] = { (uchar*) "\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\043\044\045\046\047\050\051\052\053\054\000\000\000\000\000\000\000\003\004\377\007\010\011\012\013\015\016\017\020\022\023\024\025\026\027\031\033\034\035\036\037\040\041\000\000\000\000\000\000\003\004\377\007\010\011\012\013\015\016\017\020\022\023\024\025\026\027\031\033\034\035\036\037\040\041\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\003\000\021\000\020\032\000\000\032\032\033\042\000\042\042\000\003\000\021\000\020\032\000\000\032\032\033\042\000\042\042\027\003\003\003\003\020\006\006\006\010\010\010\010\015\015\007\007\023\023\024\024\024\024\000\030\034\034\034\034\040\033\000\027\003\003\003\003\020\006\006\006\010\010\010\010\015\015\007\007\023\023\024\024\024\024\000\030\034\034\034\034\040\033\000", (uchar*) "\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\106\107\110\111\112\113\114\115\116\117\000\000\000\000\000\000\000\003\011\377\016\021\026\027\030\032\035\036\037\043\044\047\054\055\056\061\065\070\075\076\077\100\102\000\000\000\000\000\000\003\011\377\016\021\026\027\030\032\035\036\037\043\044\047\054\055\056\061\065\070\075\076\077\100\102\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\010\000\042\000\041\063\000\000\062\064\066\104\000\103\105\000\010\000\042\000\041\063\000\000\062\064\066\104\000\103\105\057\004\005\007\006\040\014\015\013\022\025\024\023\033\034\017\020\046\045\050\051\053\052\000\060\072\071\074\073\101\067\000\057\004\005\007\006\040\014\015\013\022\025\024\023\033\034\017\020\046\045\050\051\053\052\000\060\072\071\074\073\101\067\000", (uchar*) "\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\212\213\214\215\216\217\220\221\222\223\000\000\000\000\000\000\000\004\020\377\032\040\052\054\056\063\071\073\075\105\107\115\127\131\133\141\151\157\171\173\175\177\203\000\000\000\000\000\000\003\017\377\031\037\051\053\055\062\070\072\074\104\106\114\126\130\132\140\150\156\170\172\174\176\202\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\016\000\103\000\101\145\000\000\143\147\153\207\000\205\211\000\015\000\102\000\100\144\000\000\142\146\152\206\000\204\210\135\006\010\014\012\077\026\030\024\042\050\046\044\065\067\034\036\113\111\117\121\125\123\000\137\163\161\167\165\201\155\000\134\005\007\013\011\076\025\027\023\041\047\045\043\064\066\033\035\112\110\116\120\124\122\000\136\162\160\166\164\200\154\000", @@ -99,7 +101,7 @@ static uchar * CZ_SORT_TABLE[] = { struct wordvalue { const char * word; - uchar * outvalue; + uchar *outvalue; }; static struct wordvalue doubles[] = { { "ch", (uchar*) "\014\031\057\057" }, @@ -190,8 +192,8 @@ while (1) \ { p++; continue; } /* ignore value */ \ if (value == 2) /* space */ \ { \ - const uchar * tmp; \ - const uchar * runner = ++p; \ + const uchar *tmp; \ + const uchar *runner = ++p; \ while (!(IS_END(runner, src, len)) && (CZ_SORT_TABLE[pass][*runner] == 2)) \ runner++; /* skip all spaces */ \ if (IS_END(runner, src, len) && SKIP_TRAILING_SPACES) \ @@ -240,12 +242,12 @@ while (1) \ */ static int my_strnncoll_czech(CHARSET_INFO *cs __attribute__((unused)), - const uchar * s1, uint len1, - const uchar * s2, uint len2, + const uchar *s1, size_t len1, + const uchar *s2, size_t len2, my_bool s2_is_prefix) { int v1, v2; - const uchar * p1, * p2, * store1, * store2; + const uchar *p1, * p2, * store1, * store2; int pass1 = 0, pass2 = 0; if (s2_is_prefix && len1 > len2) @@ -274,8 +276,8 @@ static int my_strnncoll_czech(CHARSET_INFO *cs __attribute__((unused)), static int my_strnncollsp_czech(CHARSET_INFO * cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference __attribute__((unused))) { @@ -290,14 +292,14 @@ int my_strnncollsp_czech(CHARSET_INFO * cs, the length of the strings being specified */ -static int my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint len, - const uchar * src, uint srclen) +static size_t my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { int value; - const uchar * p, * store; + const uchar *p, * store; int pass = 0; - uint totlen = 0; + size_t totlen = 0; p = src; store = src; do @@ -361,11 +363,11 @@ static int my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)), #define EXAMPLE static my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr,uint ptr_length, + const char *ptr,size_t ptr_length, pbool escape, pbool w_one, pbool w_many, - uint res_length, char *min_str, + size_t res_length, char *min_str, char *max_str, - uint *min_length,uint *max_length) + size_t *min_length,size_t *max_length) { #ifdef EXAMPLE uchar value; @@ -396,7 +398,7 @@ static my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)), } if (cs->state & MY_CS_BINSORT) - *min_length= (uint) (min_str - min_org); + *min_length= (size_t) (min_str - min_org); else { /* 'a\0\0... is the smallest possible string */ diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index 0e10f50fce0..132689b1794 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* * This file is for Korean EUC charset, and created by powerm90@tinc.co.kr. @@ -185,13 +186,13 @@ static uchar NEAR sort_order_euc_kr[]= Valid multi-byte characters: - [A1..FE][41..5A,61..7A,81..FE] + [81..FE][41..5A,61..7A,81..FE] Note, 0x5C is not a valid MB tail, so escape_with_backslash_is_dangerous is not set. */ -#define iseuc_kr_head(c) ((0xa1<=(uchar)(c) && (uchar)(c)<=0xfe)) +#define iseuc_kr_head(c) ((0x81<=(uchar)(c) && (uchar)(c)<=0xfe)) #define iseuc_kr_tail1(c) ((uchar) (c) >= 0x41 && (uchar) (c) <= 0x5A) #define iseuc_kr_tail2(c) ((uchar) (c) >= 0x61 && (uchar) (c) <= 0x7A) @@ -201,15 +202,16 @@ static uchar NEAR sort_order_euc_kr[]= iseuc_kr_tail2(c) || \ iseuc_kr_tail3(c)) -static int ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)), - const char* p, const char *e) + +static uint ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)), + const char* p, const char *e) { return ((*(uchar*)(p)<0x80)? 0:\ iseuc_kr_head(*(p)) && (e)-(p)>1 && iseuc_kr_tail(*((p)+1))? 2:\ 0); } -static int mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c) +static uint mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (iseuc_kr_head(c) ? 2 : 1); } @@ -1293,7 +1295,7 @@ static uint16 tab_ksc5601_uni0[]={ 0x25A8,0x25A7,0x25A6,0x25A9,0x2668,0x260F,0x260E,0x261C, 0x261E,0x00B6,0x2020,0x2021,0x2195,0x2197,0x2199,0x2196, 0x2198,0x266D,0x2669,0x266A,0x266C,0x327F,0x321C,0x2116, -0x33C7,0x2122,0x33C2,0x33D8,0x2121, 0, 0, 0, +0x33C7,0x2122,0x33C2,0x33D8,0x2121,0x20AC,0x00AE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -4171,7 +4173,7 @@ static int func_ksc5601_uni_onechar(int code){ /* page 0 0x00A1-0x0167 */ static uint16 tab_uni_ksc56010[]={ 0xA2AE, 0, 0,0xA2B4, 0, 0,0xA1D7,0xA1A7, - 0,0xA8A3, 0, 0,0xA1A9, 0, 0,0xA1C6, + 0,0xA8A3, 0, 0,0xA1A9,0xA2E7, 0,0xA1C6, 0xA1BE,0xA9F7,0xA9F8,0xA2A5, 0,0xA2D2,0xA1A4,0xA2AC, 0xA9F6,0xA8AC, 0,0xA8F9,0xA8F6,0xA8FA,0xA2AF, 0, 0, 0, 0, 0, 0,0xA8A1, 0, 0, @@ -4269,7 +4271,7 @@ static uint16 tab_uni_ksc56012[]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xA2E6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -8627,6 +8629,7 @@ my_wc_mb_euc_kr(CHARSET_INFO *cs __attribute__((unused)), return 2; } + static int my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)), my_wc_t *pwc, const uchar *s, const uchar *e) @@ -8656,10 +8659,10 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)), /* Returns well formed length of a EUC-KR string. */ -static uint +static size_t my_well_formed_len_euckr(CHARSET_INFO *cs __attribute__((unused)), const char *b, const char *e, - uint pos, int *error) + size_t pos, int *error) { const char *b0= b; const char *emb= e - 1; /* Last possible end of an MB character */ @@ -8684,7 +8687,7 @@ my_well_formed_len_euckr(CHARSET_INFO *cs __attribute__((unused)), break; } } - return (uint) (b - b0); + return (size_t) (b - b0); } @@ -8715,6 +8718,7 @@ static MY_CHARSET_HANDLER my_charset_handler= my_numcells_8bit, my_mb_wc_euc_kr, /* mb_wc */ my_wc_mb_euc_kr, /* wc_mb */ + my_mb_ctype_mb, my_caseup_str_mb, my_casedn_str_mb, my_caseup_mb, @@ -8759,7 +8763,7 @@ CHARSET_INFO my_charset_euckr_korean_ci= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFEFE, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, @@ -8792,7 +8796,7 @@ CHARSET_INFO my_charset_euckr_bin= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFEFE, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c index d96b34d2838..eb79ec56aab 100644 --- a/strings/ctype-eucjpms.c +++ b/strings/ctype-eucjpms.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 MySQL AB & tommy@valley.ne.jp. +/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. & tommy@valley.ne.jp. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -12,8 +12,9 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ + Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA +*/ /* This file is for Japanese EUC charset, and created based on ctype-ujis.c file. @@ -185,7 +186,7 @@ static uchar NEAR sort_order_eucjpms[]= #define iseucjpms_ss3(c) (((c)&0xff) == 0x8f) -static int ismbchar_eucjpms(CHARSET_INFO *cs __attribute__((unused)), +static uint ismbchar_eucjpms(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) { return ((*(uchar*)(p)<0x80)? 0:\ @@ -195,7 +196,7 @@ static int ismbchar_eucjpms(CHARSET_INFO *cs __attribute__((unused)), 0); } -static int mbcharlen_eucjpms(CHARSET_INFO *cs __attribute__((unused)),uint c) +static uint mbcharlen_eucjpms(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (iseucjpms(c)? 2: iseucjpms_ss2(c)? 2: iseucjpms_ss3(c)? 3: 1); } @@ -8387,8 +8388,9 @@ my_jisx0212_uni_onechar(int code){ */ static -uint my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)), - const char *beg, const char *end, uint pos, int *error) +size_t my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)), + const char *beg, const char *end, size_t pos, + int *error) { const uchar *b= (uchar *) beg; *error=0; @@ -8427,19 +8429,19 @@ uint my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)), *b >= 0xA1 && *b <= 0xFE) /* [xA1-xFE][xA1-xFE] */ continue; *error=1; - return (uint) (chbeg - beg); /* invalid sequence */ + return (size_t) (chbeg - beg); /* invalid sequence */ } - return (uint) (b - (uchar *) beg); + return (size_t) (b - (uchar *) beg); } static -uint my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), - const char *str, const char *str_end) +size_t my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), + const char *str, const char *str_end) { - uint clen= 0; - const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) str_end; + size_t clen; + const uchar *b= (const uchar *) str; + const uchar *e= (const uchar *) str_end; for (clen= 0; b < e; ) { @@ -8555,9 +8557,9 @@ my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *pwc, const uchar *s, const uchar *e) } static int -my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e) +my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, uchar *s, uchar *e) { - unsigned char c1; + uchar c1; int jp; if (s >= e) @@ -8663,6 +8665,7 @@ static MY_CHARSET_HANDLER my_charset_handler= my_numcells_eucjp, my_mb_wc_euc_jp, /* mb_wc */ my_wc_mb_euc_jp, /* wc_mb */ + my_mb_ctype_mb, my_caseup_str_mb, my_casedn_str_mb, my_caseup_mb, @@ -8708,7 +8711,7 @@ CHARSET_INFO my_charset_eucjpms_japanese_ci= 1, /* mbminlen */ 3, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFEFE, /* max_sort_char */ ' ', /* pad_char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, @@ -8741,7 +8744,7 @@ CHARSET_INFO my_charset_eucjpms_bin= 1, /* mbminlen */ 3, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFEFE, /* max_sort_char */ ' ', /* pad_char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, diff --git a/strings/ctype-extra.c b/strings/ctype-extra.c index 70d30722b0b..6272e92d5cb 100644 --- a/strings/ctype-extra.c +++ b/strings/ctype-extra.c @@ -6,7 +6,7 @@ ./conf_to_src ../sql/share/charsets/ > FILE */ -/* Copyright (C) 2000-2007 MySQL AB +/* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include <my_global.h> #include <m_ctype.h> @@ -1040,7 +1041,7 @@ uint16 to_uni_cp1251_bulgarian_ci[] = { 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, 0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021, -0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F, +0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F, 0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, 0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F, 0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7, @@ -1730,7 +1731,7 @@ uint16 to_uni_cp1251_ukrainian_ci[] = { 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, 0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021, -0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F, +0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F, 0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, 0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F, 0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7, @@ -3762,7 +3763,7 @@ uint16 to_uni_cp1251_bin[] = { 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, 0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021, -0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F, +0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F, 0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, 0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F, 0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7, @@ -3877,7 +3878,7 @@ uint16 to_uni_cp1251_general_ci[] = { 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, 0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021, -0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F, +0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F, 0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, 0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F, 0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7, @@ -3992,7 +3993,7 @@ uint16 to_uni_cp1251_general_cs[] = { 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, 0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021, -0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F, +0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F, 0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, 0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F, 0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7, @@ -6487,6 +6488,121 @@ uint16 to_uni_latin1_spanish_ci[] = { #endif +#ifdef HAVE_CHARSET_cp1250 +uchar ctype_cp1250_polish_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x20,0x20,0x10,0x20,0x10,0x10,0x10,0x10,0x20,0x10,0x01,0x10,0x01,0x01,0x01,0x01, +0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x10,0x02,0x10,0x02,0x02,0x02,0x02, +0x48,0x10,0x10,0x01,0x10,0x01,0x10,0x01,0x10,0x10,0x01,0x10,0x10,0x10,0x10,0x01, +0x10,0x10,0x10,0x02,0x10,0x10,0x10,0x10,0x10,0x02,0x02,0x10,0x01,0x10,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10 +}; + +uchar to_lower_cp1250_polish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x9A,0x8B,0x9C,0x9D,0x9E,0x9F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xB3,0xA4,0xB9,0xA6,0xA7,0xA8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBE,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp1250_polish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xA3,0xB4,0xB5,0xB6,0xB7,0xB8,0xA5,0xAA,0xBB,0xBC,0xBD,0xBC,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_cp1250_polish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x43,0x44,0x48,0x4B,0x4D,0x4E,0x4F,0x50,0x52,0x53,0x54,0x56,0x57,0x59, +0x5B,0x5C,0x5D,0x5F,0x62,0x64,0x66,0x67,0x68,0x69,0x6B,0x90,0x91,0x92,0x93,0x94, +0x95,0x41,0x43,0x44,0x48,0x4B,0x4D,0x4E,0x4F,0x50,0x52,0x53,0x54,0x56,0x57,0x59, +0x5B,0x5C,0x5D,0x5F,0x62,0x64,0x66,0x67,0x68,0x69,0x6B,0x96,0x97,0x98,0x99,0x9A, +0x9B,0x9C,0x9E,0x9F,0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0x5F,0xA6,0x60,0x62,0x6B,0x6C, +0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0x5F,0xB1,0x60,0x62,0x6B,0x6C, +0xB2,0xB3,0xB4,0x55,0xB5,0x42,0xB6,0xB7,0xB8,0xB9,0x5F,0xBA,0xBB,0xBC,0xBD,0x6D, +0xBE,0xBF,0xC0,0x55,0xC1,0xC2,0xC3,0xC4,0xC5,0x42,0x5F,0xC6,0x54,0xC7,0x54,0x6D, +0x5D,0x41,0x41,0x41,0x41,0x54,0x47,0x44,0x44,0x4B,0x4C,0x4B,0x4B,0x50,0x50,0x48, +0x48,0x58,0x57,0x5A,0x59,0x59,0x59,0xC8,0x5D,0x64,0x64,0x64,0x64,0x69,0x62,0x5F, +0x5D,0x41,0x41,0x41,0x41,0x54,0x47,0x44,0x44,0x4B,0x4C,0x4B,0x4B,0x50,0x50,0x48, +0x48,0x58,0x57,0x5A,0x59,0x59,0x59,0xC9,0x5D,0x64,0x64,0x64,0x64,0x69,0x62,0xFF +}; + +uint16 to_uni_cp1250_polish_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0000,0x201A,0x0000,0x201E,0x2026,0x2020,0x2021, +0x0000,0x2030,0x0160,0x2039,0x015A,0x0164,0x017D,0x0179, +0x0000,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x2122,0x0161,0x203A,0x015B,0x0165,0x017E,0x017A, +0x00A0,0x02C7,0x02D8,0x0141,0x00A4,0x0104,0x00A6,0x00A7, +0x00A8,0x00A9,0x015E,0x00AB,0x00AC,0x00AD,0x00AE,0x017B, +0x00B0,0x00B1,0x02DB,0x0142,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x0105,0x015F,0x00BB,0x013D,0x02DD,0x013E,0x017C, +0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7, +0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E, +0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7, +0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF, +0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7, +0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F, +0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7, +0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 +}; + +#endif + CHARSET_INFO compiled_charsets[] = { #ifdef HAVE_CHARSET_dec8 { @@ -8435,6 +8551,72 @@ CHARSET_INFO compiled_charsets[] = { } , #endif +#ifdef HAVE_CHARSET_geostd8 +{ + 92,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "geostd8", /* cset name */ + "geostd8_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_geostd8_general_ci, /* ctype */ + to_lower_geostd8_general_ci, /* lower */ + to_upper_geostd8_general_ci, /* upper */ + sort_order_geostd8_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_geostd8_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_geostd8 +{ + 93,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "geostd8", /* cset name */ + "geostd8_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_geostd8_bin, /* ctype */ + to_lower_geostd8_bin, /* lower */ + to_upper_geostd8_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_geostd8_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif #ifdef HAVE_CHARSET_latin1 { 94,0,0, @@ -8468,6 +8650,39 @@ CHARSET_INFO compiled_charsets[] = { } , #endif +#ifdef HAVE_CHARSET_cp1250 +{ + 99,0,0, + MY_CS_COMPILED, + "cp1250", /* cset name */ + "cp1250_polish_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1250_polish_ci, /* ctype */ + to_lower_cp1250_polish_ci, /* lower */ + to_upper_cp1250_polish_ci, /* upper */ + sort_order_cp1250_polish_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp1250_polish_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif { 0,0,0, MY_CS_COMPILED, diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index 6ffe29430db..ef2c3e408e9 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* This file is for Chinese EUC character sets (GB2312), and created by Miles Tsai (net-bull@126.com). */ @@ -165,13 +166,13 @@ static uchar NEAR sort_order_gb2312[]= #define isgb2312tail(c) (0xa1<=(uchar)(c) && (uchar)(c)<=0xfe) -static int ismbchar_gb2312(CHARSET_INFO *cs __attribute__((unused)), +static uint ismbchar_gb2312(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) { return (isgb2312head(*(p)) && (e)-(p)>1 && isgb2312tail(*((p)+1))? 2: 0); } -static int mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c) +static uint mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (isgb2312head(c)? 2 : 1); } @@ -5686,10 +5687,10 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)), /* Returns well formed length of a EUC-KR string. */ -static uint +static size_t my_well_formed_len_gb2312(CHARSET_INFO *cs __attribute__((unused)), const char *b, const char *e, - uint pos, int *error) + size_t pos, int *error) { const char *b0= b; const char *emb= e - 1; /* Last possible end of an MB character */ @@ -5714,7 +5715,7 @@ my_well_formed_len_gb2312(CHARSET_INFO *cs __attribute__((unused)), break; } } - return (uint) (b - b0); + return (size_t) (b - b0); } @@ -5745,6 +5746,7 @@ static MY_CHARSET_HANDLER my_charset_handler= my_numcells_8bit, my_mb_wc_gb2312, /* mb_wc */ my_wc_mb_gb2312, /* wc_mb */ + my_mb_ctype_mb, my_caseup_str_mb, my_casedn_str_mb, my_caseup_mb, @@ -5789,7 +5791,7 @@ CHARSET_INFO my_charset_gb2312_chinese_ci= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xF7FE, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, @@ -5821,7 +5823,7 @@ CHARSET_INFO my_charset_gb2312_bin= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xF7FE, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index d0ba33aa3cc..e80b6888698 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* This file is for Chinese character sets GBK, created by Wei He (hewei@mail.ied.ac.cn) @@ -2582,7 +2583,7 @@ static uint16 gbksortorder(uint16 i) int my_strnncoll_gbk_internal(const uchar **a_res, const uchar **b_res, - uint length) + size_t length) { const uchar *a= *a_res, *b= *b_res; uint a_char,b_char; @@ -2612,22 +2613,22 @@ int my_strnncoll_gbk_internal(const uchar **a_res, const uchar **b_res, int my_strnncoll_gbk(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool b_is_prefix) { - uint length= min(a_length, b_length); + size_t length= min(a_length, b_length); int res= my_strnncoll_gbk_internal(&a, &b, length); return res ? res : (int) ((b_is_prefix ? length : a_length) - b_length); } static int my_strnncollsp_gbk(CHARSET_INFO * cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference) { - uint length= min(a_length, b_length); + size_t length= min(a_length, b_length); int res= my_strnncoll_gbk_internal(&a, &b, length); #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE @@ -2662,12 +2663,12 @@ static int my_strnncollsp_gbk(CHARSET_INFO * cs __attribute__((unused)), } -static int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint len, - const uchar * src, uint srclen) +static size_t my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { uint16 e; - uint dstlen= len; + size_t dstlen= len; uchar *dest_end= dest + dstlen; len = srclen; @@ -2690,92 +2691,13 @@ static int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)), } -/* -** Calculate min_str and max_str that ranges a LIKE string. -** Arguments: -** ptr Pointer to LIKE string. -** ptr_length Length of LIKE string. -** escape Escape character in LIKE. (Normally '\'). -** All escape characters should be removed from min_str and max_str -** res_length Length of min_str and max_str. -** min_str Smallest case sensitive string that ranges LIKE. -** Should be space padded to res_length. -** max_str Largest case sensitive string that ranges LIKE. -** Normally padded with the biggest character sort value. -** -** The function should return 0 if ok and 1 if the LIKE string can't be -** optimized ! -*/ - -#define max_sort_char ((uchar) 255) - -static my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr,uint ptr_length, - pbool escape, pbool w_one, pbool w_many, - uint res_length, char *min_str,char *max_str, - uint *min_length,uint *max_length) -{ - const char *end= ptr + ptr_length; - char *min_org=min_str; - char *min_end=min_str+res_length; - uint charlen= res_length / cs->mbmaxlen; - - for (; ptr != end && min_str != min_end && charlen > 0; ptr++, charlen--) - { - if (ptr+1 != end && isgbkcode(ptr[0],ptr[1])) - { - *min_str++= *max_str++ = *ptr++; - *min_str++= *max_str++ = *ptr; - continue; - } - if (*ptr == escape && ptr+1 != end) - { - ptr++; /* Skip escape */ - if (isgbkcode(ptr[0], ptr[1])) - *min_str++= *max_str++ = *ptr; - if (min_str < min_end) - *min_str++= *max_str++= *ptr; - continue; - } - if (*ptr == w_one) /* '_' in SQL */ - { - *min_str++='\0'; /* This should be min char */ - *max_str++=max_sort_char; - continue; - } - if (*ptr == w_many) /* '%' in SQL */ - { - /* - Calculate length of keys: - 'a\0\0... is the smallest possible string when we have space expand - a\ff\ff... is the biggest possible string - */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (uint) (min_str - min_org) : - res_length); - *max_length= res_length; - do { - *min_str++= 0; - *max_str++= max_sort_char; - } while (min_str != min_end); - return 0; - } - *min_str++= *max_str++ = *ptr; - } - - *min_length= *max_length = (uint) (min_str - min_org); - while (min_str != min_end) - *min_str++= *max_str++= ' '; /* Because if key compression */ - return 0; -} - - -static int ismbchar_gbk(CHARSET_INFO *cs __attribute__((unused)), +static uint ismbchar_gbk(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) { return (isgbkhead(*(p)) && (e)-(p)>1 && isgbktail(*((p)+1))? 2: 0); } -static int mbcharlen_gbk(CHARSET_INFO *cs __attribute__((unused)),uint c) +static uint mbcharlen_gbk(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (isgbkhead(c)? 2 : 1); } @@ -9942,9 +9864,9 @@ my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)), Returns well formed length of a GBK string. */ static -uint my_well_formed_len_gbk(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e, - uint pos, int *error) +size_t my_well_formed_len_gbk(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t pos, int *error) { const char *b0= b; const char *emb= e - 1; /* Last possible end of an MB character */ @@ -9969,7 +9891,7 @@ uint my_well_formed_len_gbk(CHARSET_INFO *cs __attribute__((unused)), break; } } - return (uint) (b - b0); + return (size_t) (b - b0); } @@ -9982,7 +9904,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler = my_strnncollsp_gbk, my_strnxfrm_gbk, my_strnxfrmlen_simple, - my_like_range_gbk, + my_like_range_mb, my_wildcmp_mb, my_strcasecmp_mb, my_instr_mb, @@ -10002,6 +9924,7 @@ static MY_CHARSET_HANDLER my_charset_handler= my_numcells_8bit, my_mb_wc_gbk, my_wc_mb_gbk, + my_mb_ctype_mb, my_caseup_str_mb, my_casedn_str_mb, my_caseup_mb, @@ -10046,7 +9969,7 @@ CHARSET_INFO my_charset_gbk_chinese_ci= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xA967, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, @@ -10078,7 +10001,7 @@ CHARSET_INFO my_charset_gbk_bin= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFEFE, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index 906595e60bf..c0017d93beb 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2003-2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include <my_global.h> #include "m_string.h" @@ -150,7 +152,7 @@ unsigned short cs_to_uni[256]={ 0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF }; -unsigned char pl00[256]={ +uchar pl00[256]={ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, @@ -184,7 +186,7 @@ unsigned char pl00[256]={ 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7, 0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF }; -unsigned char pl01[256]={ +uchar pl01[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -218,7 +220,7 @@ unsigned char pl01[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; -unsigned char pl02[256]={ +uchar pl02[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -252,7 +254,7 @@ unsigned char pl02[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; -unsigned char pl20[256]={ +uchar pl20[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x96,0x97,0x00,0x00,0x00, @@ -286,7 +288,7 @@ unsigned char pl20[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; -unsigned char pl21[256]={ +uchar pl21[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -320,7 +322,7 @@ unsigned char pl21[256]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; -unsigned char *uni_to_cs[256]={ +uchar *uni_to_cs[256]={ pl00,pl01,pl02,NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, @@ -358,8 +360,8 @@ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL static int my_mb_wc_latin1(CHARSET_INFO *cs __attribute__((unused)), my_wc_t *wc, - const unsigned char *str, - const unsigned char *end __attribute__((unused))) + const uchar *str, + const uchar *end __attribute__((unused))) { if (str >= end) return MY_CS_TOOSMALL; @@ -371,10 +373,10 @@ int my_mb_wc_latin1(CHARSET_INFO *cs __attribute__((unused)), static int my_wc_mb_latin1(CHARSET_INFO *cs __attribute__((unused)), my_wc_t wc, - unsigned char *str, - unsigned char *end __attribute__((unused))) + uchar *str, + uchar *end __attribute__((unused))) { - unsigned char *pl; + uchar *pl; if (str >= end) return MY_CS_TOOSMALL; @@ -396,6 +398,7 @@ static MY_CHARSET_HANDLER my_charset_handler= my_numcells_8bit, my_mb_wc_latin1, my_wc_mb_latin1, + my_mb_ctype_8bit, my_caseup_str_8bit, my_casedn_str_8bit, my_caseup_8bit, @@ -542,8 +545,8 @@ uchar combo2map[]={ static int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool b_is_prefix) { const uchar *a_end= a + a_length; @@ -583,8 +586,8 @@ static int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)), static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference) { const uchar *a_end= a + a_length, *b_end= b + b_length; @@ -654,9 +657,9 @@ static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)), } -static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint len, - const uchar * src, uint srclen) +static size_t my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { const uchar *de = dest + len; const uchar *se = src + srclen; @@ -674,7 +677,7 @@ static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)), void my_hash_sort_latin1_de(CHARSET_INFO *cs __attribute__((unused)), - const uchar *key, uint len, + const uchar *key, size_t len, ulong *nr1, ulong *nr2) { const uchar *end= key+len; diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index eaf380faf3f..76dae6762af 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -1,5 +1,4 @@ -/* Copyright (c) 2002-2007 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. +/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +11,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include <my_global.h> #include "m_ctype.h" @@ -21,7 +21,7 @@ #ifdef USE_MB -uint my_caseup_str_mb(CHARSET_INFO * cs, char *str) +size_t my_caseup_str_mb(CHARSET_INFO * cs, char *str) { register uint32 l; register uchar *map= cs->to_upper; @@ -38,10 +38,11 @@ uint my_caseup_str_mb(CHARSET_INFO * cs, char *str) str++; } } - return (uint) (str - str_orig); + return (size_t) (str - str_orig); } -uint my_casedn_str_mb(CHARSET_INFO * cs, char *str) + +size_t my_casedn_str_mb(CHARSET_INFO * cs, char *str) { register uint32 l; register uchar *map= cs->to_lower; @@ -58,12 +59,13 @@ uint my_casedn_str_mb(CHARSET_INFO * cs, char *str) str++; } } - return (uint) (str - str_orig); + return (size_t) (str - str_orig); } -uint my_caseup_mb(CHARSET_INFO * cs, char *src, uint srclen, - char *dst __attribute__((unused)), - uint dstlen __attribute__((unused))) + +size_t my_caseup_mb(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) { register uint32 l; register char *srcend= src + srclen; @@ -83,9 +85,10 @@ uint my_caseup_mb(CHARSET_INFO * cs, char *src, uint srclen, return srclen; } -uint my_casedn_mb(CHARSET_INFO * cs, char *src, uint srclen, - char *dst __attribute__((unused)), - uint dstlen __attribute__((unused))) + +size_t my_casedn_mb(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) { register uint32 l; register char *srcend= src + srclen; @@ -105,9 +108,11 @@ uint my_casedn_mb(CHARSET_INFO * cs, char *src, uint srclen, return srclen; } + /* my_strcasecmp_mb() returns 0 if strings are equal, non-zero otherwise. */ + int my_strcasecmp_mb(CHARSET_INFO * cs,const char *s, const char *t) { register uint32 l; @@ -251,10 +256,10 @@ int my_wildcmp_mb(CHARSET_INFO *cs, } -uint my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)), +size_t my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)), const char *pos, const char *end) { - register uint32 count=0; + register size_t count= 0; while (pos < end) { uint mb_len; @@ -265,8 +270,8 @@ uint my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)), } -uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)), - const char *pos, const char *end, uint length) +size_t my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)), + const char *pos, const char *end, size_t length) { const char *start= pos; @@ -276,12 +281,12 @@ uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)), pos+= (mb_len= my_ismbchar(cs, pos, end)) ? mb_len : 1; length--; } - return (uint) (length ? end+2-start : pos-start); + return (size_t) (length ? end+2-start : pos-start); } -uint my_well_formed_len_mb(CHARSET_INFO *cs, const char *b, const char *e, - uint pos, int *error) +size_t my_well_formed_len_mb(CHARSET_INFO *cs, const char *b, const char *e, + size_t pos, int *error) { const char *b_start= b; *error= 0; @@ -298,14 +303,13 @@ uint my_well_formed_len_mb(CHARSET_INFO *cs, const char *b, const char *e, b+= mb_len; pos--; } - return (uint) (b - b_start); + return (size_t) (b - b_start); } - uint my_instr_mb(CHARSET_INFO *cs, - const char *b, uint b_length, - const char *s, uint s_length, + const char *b, size_t b_length, + const char *s, size_t s_length, my_match_t *match, uint nmatch) { register const char *end, *b0; @@ -331,13 +335,13 @@ uint my_instr_mb(CHARSET_INFO *cs, { int mb_len; - if (!cs->coll->strnncoll(cs, (unsigned char*) b, s_length, - (unsigned char*) s, s_length, 0)) + if (!cs->coll->strnncoll(cs, (uchar*) b, s_length, + (uchar*) s, s_length, 0)) { if (nmatch) { match[0].beg= 0; - match[0].end= (uint) (b-b0); + match[0].end= (size_t) (b-b0); match[0].mb_len= res; if (nmatch > 1) { @@ -361,11 +365,11 @@ uint my_instr_mb(CHARSET_INFO *cs, /* BINARY collations handlers for MB charsets */ static int my_strnncoll_mb_bin(CHARSET_INFO * cs __attribute__((unused)), - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { - uint len=min(slen,tlen); + size_t len=min(slen,tlen); int cmp= memcmp(s,t,len); return cmp ? cmp : (int) ((t_is_prefix ? len : slen) - tlen); } @@ -397,12 +401,12 @@ static int my_strnncoll_mb_bin(CHARSET_INFO * cs __attribute__((unused)), */ static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference) { const uchar *end; - uint length; + size_t length; int res; #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE @@ -443,9 +447,9 @@ static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), } -static int my_strnxfrm_mb_bin(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint dstlen, - const uchar *src, uint srclen) +static size_t my_strnxfrm_mb_bin(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t dstlen, + const uchar *src, size_t srclen) { if (dest != src) memcpy(dest, src, min(dstlen, srclen)); @@ -462,7 +466,7 @@ static int my_strcasecmp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), } static void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *key, uint len,ulong *nr1, ulong *nr2) + const uchar *key, size_t len,ulong *nr1, ulong *nr2) { const uchar *pos = key; @@ -495,7 +499,9 @@ static void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), DESCRIPTION Write max key: - for non-Unicode character sets: - just set to 255. + just bfill using max_sort_char if max_sort_char is one byte. + In case when max_sort_char is two bytes, fill with double-byte pairs + and optionally pad with a single space character. - for Unicode character set (utf-8): create a buffer with multibyte representation of the max_sort_char character, and copy it into max_str in a loop. @@ -507,12 +513,20 @@ static void pad_max_char(CHARSET_INFO *cs, char *str, char *end) if (!(cs->state & MY_CS_UNICODE)) { - bfill(str, end - str, 255); - return; + if (cs->max_sort_char <= 255) + { + bfill(str, end - str, cs->max_sort_char); + return; + } + buf[0]= cs->max_sort_char >> 8; + buf[1]= cs->max_sort_char & 0xFF; + buflen= 2; + } + else + { + buflen= cs->cset->wc_mb(cs, cs->max_sort_char, (uchar*) buf, + (uchar*) buf + sizeof(buf)); } - - buflen= cs->cset->wc_mb(cs, cs->max_sort_char, (uchar*) buf, - (uchar*) buf + sizeof(buf)); DBUG_ASSERT(buflen > 0); do @@ -552,18 +566,18 @@ static void pad_max_char(CHARSET_INFO *cs, char *str, char *end) */ my_bool my_like_range_mb(CHARSET_INFO *cs, - const char *ptr,uint ptr_length, + const char *ptr,size_t ptr_length, pbool escape, pbool w_one, pbool w_many, - uint res_length, + size_t res_length, char *min_str,char *max_str, - uint *min_length,uint *max_length) + size_t *min_length,size_t *max_length) { uint mb_len; const char *end= ptr + ptr_length; char *min_org= min_str; char *min_end= min_str + res_length; char *max_end= max_str + res_length; - uint maxcharlen= res_length / cs->mbmaxlen; + size_t maxcharlen= res_length / cs->mbmaxlen; const char *contraction_flags= cs->contractions ? ((const char*) cs->contractions) + 0x40*0x40 : NULL; @@ -580,7 +594,7 @@ fill_max_and_min: 'a\0\0... is the smallest possible string when we have space expand a\ff\ff... is the biggest possible string */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (uint) (min_str - min_org) : + *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : res_length); *max_length= res_length; /* Create min key */ @@ -676,7 +690,7 @@ fill_max_and_min: } } - *min_length= *max_length = (uint) (min_str - min_org); + *min_length= *max_length = (size_t) (min_str - min_org); while (min_str != min_end) *min_str++= *max_str++= ' '; /* Because if key compression */ return 0; @@ -996,10 +1010,11 @@ static struct {int page; char *p;} utr11_data[256]= {0,NULL},{1,NULL},{0,pgFA},{0,NULL},{0,NULL},{0,NULL},{0,pgFE},{0,pgFF} }; -uint my_numcells_mb(CHARSET_INFO *cs, const char *b, const char *e) + +size_t my_numcells_mb(CHARSET_INFO *cs, const char *b, const char *e) { my_wc_t wc; - int clen= 0; + size_t clen= 0; while (b < e) { @@ -1020,6 +1035,21 @@ uint my_numcells_mb(CHARSET_INFO *cs, const char *b, const char *e) } +int my_mb_ctype_mb(CHARSET_INFO *cs, int *ctype, + const uchar *s, const uchar *e) +{ + my_wc_t wc; + int res= cs->cset->mb_wc(cs, &wc, s, e); + if (res <= 0) + *ctype= 0; + else + *ctype= my_uni_ctype[wc>>8].ctype ? + my_uni_ctype[wc>>8].ctype[wc&0xFF] : + my_uni_ctype[wc>>8].pctype; + return res; +} + + MY_COLLATION_HANDLER my_collation_mb_bin_handler = { NULL, /* init */ diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index b01b56a54c9..2193e155f1f 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -12,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include <my_global.h> #include "m_string.h" @@ -25,7 +26,8 @@ /* Returns the number of bytes required for strnxfrm(). */ -uint my_strnxfrmlen_simple(CHARSET_INFO *cs, uint len) + +size_t my_strnxfrmlen_simple(CHARSET_INFO *cs, size_t len) { return len * (cs->strxfrm_multiply ? cs->strxfrm_multiply : 1); } @@ -71,12 +73,12 @@ uint my_strnxfrmlen_simple(CHARSET_INFO *cs, uint len) */ -int my_strnxfrm_simple(CHARSET_INFO * cs, - uchar *dest, uint len, - const uchar *src, uint srclen) +size_t my_strnxfrm_simple(CHARSET_INFO * cs, + uchar *dest, size_t len, + const uchar *src, size_t srclen) { uchar *map= cs->sort_order; - uint dstlen= len; + size_t dstlen= len; set_if_smaller(len, srclen); if (dest != src) { @@ -95,11 +97,12 @@ int my_strnxfrm_simple(CHARSET_INFO * cs, return dstlen; } -int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, uint slen, - const uchar *t, uint tlen, + +int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { - int len = ( slen > tlen ) ? tlen : slen; + size_t len = ( slen > tlen ) ? tlen : slen; uchar *map= cs->sort_order; if (t_is_prefix && slen > tlen) slen=tlen; @@ -108,7 +111,11 @@ int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, uint slen, if (map[*s++] != map[*t++]) return ((int) map[s[-1]] - (int) map[t[-1]]); } - return (int) (slen - tlen); + /* + We can't use (slen - tlen) here as the result may be outside of the + precision of a signed int + */ + return slen > tlen ? 1 : slen < tlen ? -1 : 0 ; } @@ -142,12 +149,12 @@ int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, uint slen, > 0 a > b */ -int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_length, - const uchar *b, uint b_length, +int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference) { const uchar *map= cs->sort_order, *end; - uint length; + size_t length; int res; #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE @@ -180,56 +187,57 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_length, } for (end= a + a_length-length; a < end ; a++) { - if (map[*a] != ' ') - return (map[*a] < ' ') ? -swap : swap; + if (map[*a] != map[' ']) + return (map[*a] < map[' ']) ? -swap : swap; } } return res; } -uint my_caseup_str_8bit(CHARSET_INFO * cs,char *str) +size_t my_caseup_str_8bit(CHARSET_INFO * cs,char *str) { register uchar *map= cs->to_upper; char *str_orig= str; while ((*str= (char) map[(uchar) *str]) != 0) str++; - return (uint) (str - str_orig); + return (size_t) (str - str_orig); } -uint my_casedn_str_8bit(CHARSET_INFO * cs,char *str) +size_t my_casedn_str_8bit(CHARSET_INFO * cs,char *str) { register uchar *map= cs->to_lower; char *str_orig= str; while ((*str= (char) map[(uchar) *str]) != 0) str++; - return (uint) (str - str_orig); + return (size_t) (str - str_orig); } -uint my_caseup_8bit(CHARSET_INFO * cs, char *src, uint srclen, - char *dst __attribute__((unused)), - uint dstlen __attribute__((unused))) +size_t my_caseup_8bit(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) { - uint srclen0= srclen; + char *end= src + srclen; register uchar *map= cs->to_upper; DBUG_ASSERT(src == dst && srclen == dstlen); - for ( ; srclen > 0 ; srclen--, src++) + for ( ; src != end ; src++) *src= (char) map[(uchar) *src]; - return srclen0; + return srclen; } -uint my_casedn_8bit(CHARSET_INFO * cs, char *src, uint srclen, - char *dst __attribute__((unused)), - uint dstlen __attribute__((unused))) + +size_t my_casedn_8bit(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) { - uint srclen0= srclen; + char *end= src + srclen; register uchar *map=cs->to_lower; DBUG_ASSERT(src == dst && srclen == dstlen); - for ( ; srclen > 0 ; srclen--, src++) + for ( ; src != end ; src++) *src= (char) map[(uchar) *src]; - return srclen0; + return srclen; } int my_strcasecmp_8bit(CHARSET_INFO * cs,const char *s, const char *t) @@ -242,8 +250,8 @@ int my_strcasecmp_8bit(CHARSET_INFO * cs,const char *s, const char *t) int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, - const unsigned char *str, - const unsigned char *end __attribute__((unused))) + const uchar *str, + const uchar *end __attribute__((unused))) { if (str >= end) return MY_CS_TOOSMALL; @@ -253,8 +261,8 @@ int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, } int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, - unsigned char *str, - unsigned char *end __attribute__((unused))) + uchar *str, + uchar *end) { MY_UNI_IDX *idx; @@ -280,8 +288,8 @@ int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, end buffer must be checked. */ -int my_snprintf_8bit(CHARSET_INFO *cs __attribute__((unused)), - char* to, uint n __attribute__((unused)), +size_t my_snprintf_8bit(CHARSET_INFO *cs __attribute__((unused)), + char* to, size_t n __attribute__((unused)), const char* fmt, ...) { va_list args; @@ -294,7 +302,7 @@ int my_snprintf_8bit(CHARSET_INFO *cs __attribute__((unused)), void my_hash_sort_simple(CHARSET_INFO *cs, - const uchar *key, uint len, + const uchar *key, size_t len, ulong *nr1, ulong *nr2) { register uchar *sort_order=cs->sort_order; @@ -317,15 +325,15 @@ void my_hash_sort_simple(CHARSET_INFO *cs, long my_strntol_8bit(CHARSET_INFO *cs, - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr, int *err) { int negative; register uint32 cutoff; - register unsigned int cutlim; + register uint cutlim; register uint32 i; register const char *s; - register unsigned char c; + register uchar c; const char *save, *e; int overflow; @@ -440,15 +448,15 @@ noconv: ulong my_strntoul_8bit(CHARSET_INFO *cs, - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr, int *err) { int negative; register uint32 cutoff; - register unsigned int cutlim; + register uint cutlim; register uint32 i; register const char *s; - register unsigned char c; + register uchar c; const char *save, *e; int overflow; @@ -554,12 +562,12 @@ noconv: longlong my_strntoll_8bit(CHARSET_INFO *cs __attribute__((unused)), - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr,int *err) { int negative; register ulonglong cutoff; - register unsigned int cutlim; + register uint cutlim; register ulonglong i; register const char *s, *e; const char *save; @@ -626,7 +634,7 @@ longlong my_strntoll_8bit(CHARSET_INFO *cs __attribute__((unused)), i = 0; for ( ; s != e; s++) { - register unsigned char c= *s; + register uchar c= *s; if (c>='0' && c<='9') c -= '0'; else if (c>='A' && c<='Z') @@ -677,12 +685,12 @@ noconv: ulonglong my_strntoull_8bit(CHARSET_INFO *cs, - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr, int *err) { int negative; register ulonglong cutoff; - register unsigned int cutlim; + register uint cutlim; register ulonglong i; register const char *s, *e; const char *save; @@ -749,7 +757,7 @@ ulonglong my_strntoull_8bit(CHARSET_INFO *cs, i = 0; for ( ; s != e; s++) { - register unsigned char c= *s; + register uchar c= *s; if (c>='0' && c<='9') c -= '0'; @@ -791,6 +799,7 @@ noconv: return 0L; } + /* Read double from string @@ -815,7 +824,7 @@ noconv: double my_strntod_8bit(CHARSET_INFO *cs __attribute__((unused)), - char *str, uint length, + char *str, size_t length, char **end, int *err) { if (length == INT_MAX32) @@ -831,8 +840,8 @@ double my_strntod_8bit(CHARSET_INFO *cs __attribute__((unused)), Assume len >= 1 */ -int my_long10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), - char *dst, uint len, int radix, long int val) +size_t my_long10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), + char *dst, size_t len, int radix, long int val) { char buffer[66]; register char *p, *e; @@ -866,14 +875,15 @@ int my_long10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), val= new_val; } - len= min(len, (uint) (e-p)); + len= min(len, (size_t) (e-p)); memcpy(dst, p, len); - return (int) len+sign; + return len+sign; } -int my_longlong10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), - char *dst, uint len, int radix, longlong val) +size_t my_longlong10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), + char *dst, size_t len, int radix, + longlong val) { char buffer[65]; register char *p, *e; @@ -919,7 +929,7 @@ int my_longlong10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), long_val= quo; } - len= min(len, (uint) (e-p)); + len= min(len, (size_t) (e-p)); cnv: memcpy(dst, p, len); return len+sign; @@ -1039,16 +1049,16 @@ int my_wildcmp_8bit(CHARSET_INFO *cs, */ my_bool my_like_range_simple(CHARSET_INFO *cs, - const char *ptr,uint ptr_length, + const char *ptr, size_t ptr_length, pbool escape, pbool w_one, pbool w_many, - uint res_length, + size_t res_length, char *min_str,char *max_str, - uint *min_length,uint *max_length) + size_t *min_length, size_t *max_length) { const char *end= ptr + ptr_length; char *min_org=min_str; char *min_end=min_str+res_length; - uint charlen= res_length / cs->mbmaxlen; + size_t charlen= res_length / cs->mbmaxlen; for (; ptr != end && min_str != min_end && charlen > 0 ; ptr++, charlen--) { @@ -1067,7 +1077,8 @@ my_bool my_like_range_simple(CHARSET_INFO *cs, if (*ptr == w_many) /* '%' in SQL */ { /* Calculate length of keys */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (uint) (min_str - min_org) : + *min_length= ((cs->state & MY_CS_BINSORT) ? + (size_t) (min_str - min_org) : res_length); *max_length= res_length; do @@ -1080,14 +1091,14 @@ my_bool my_like_range_simple(CHARSET_INFO *cs, *min_str++= *max_str++ = *ptr; } - *min_length= *max_length = (uint) (min_str - min_org); + *min_length= *max_length = (size_t) (min_str - min_org); while (min_str != min_end) *min_str++= *max_str++ = ' '; /* Because if key compression */ return 0; } -ulong my_scan_8bit(CHARSET_INFO *cs, const char *str, const char *end, int sq) +size_t my_scan_8bit(CHARSET_INFO *cs, const char *str, const char *end, int sq) { const char *str0= str; switch (sq) @@ -1096,7 +1107,7 @@ ulong my_scan_8bit(CHARSET_INFO *cs, const char *str, const char *end, int sq) if (*str == '.') { for(str++ ; str != end && *str == '0' ; str++); - return (ulong) (str - str0); + return (size_t) (str - str0); } return 0; @@ -1106,7 +1117,7 @@ ulong my_scan_8bit(CHARSET_INFO *cs, const char *str, const char *end, int sq) if (!my_isspace(cs,*str)) break; } - return (ulong) (str - str0); + return (size_t) (str - str0); default: return 0; } @@ -1114,59 +1125,59 @@ ulong my_scan_8bit(CHARSET_INFO *cs, const char *str, const char *end, int sq) void my_fill_8bit(CHARSET_INFO *cs __attribute__((unused)), - char *s, uint l, int fill) + char *s, size_t l, int fill) { - bfill(s,l,fill); + bfill((uchar*) s,l,fill); } -uint my_numchars_8bit(CHARSET_INFO *cs __attribute__((unused)), +size_t my_numchars_8bit(CHARSET_INFO *cs __attribute__((unused)), const char *b, const char *e) { - return (uint) (e - b); + return (size_t) (e - b); } -uint my_numcells_8bit(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e) +size_t my_numcells_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e) { - return (uint) (e - b); + return (size_t) (e - b); } -uint my_charpos_8bit(CHARSET_INFO *cs __attribute__((unused)), - const char *b __attribute__((unused)), - const char *e __attribute__((unused)), - uint pos) +size_t my_charpos_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *b __attribute__((unused)), + const char *e __attribute__((unused)), + size_t pos) { return pos; } -uint my_well_formed_len_8bit(CHARSET_INFO *cs __attribute__((unused)), - const char *start, const char *end, - uint nchars, int *error) +size_t my_well_formed_len_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *start, const char *end, + size_t nchars, int *error) { - uint nbytes= (uint) (end-start); + size_t nbytes= (size_t) (end-start); *error= 0; return min(nbytes, nchars); } -uint my_lengthsp_8bit(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr, uint length) +size_t my_lengthsp_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr, size_t length) { const char *end= ptr+length; while (end > ptr && end[-1] == ' ') end--; - return (uint) (end-ptr); + return (size_t) (end-ptr); } uint my_instr_simple(CHARSET_INFO *cs, - const char *b, uint b_length, - const char *s, uint s_length, - my_match_t *match, uint nmatch) + const char *b, size_t b_length, + const char *s, size_t s_length, + my_match_t *match, uint nmatch) { register const uchar *str, *search, *end, *search_end; @@ -1205,7 +1216,7 @@ skip: if (nmatch > 0) { match[0].beg= 0; - match[0].end= (uint) (str- (const uchar*)b-1); + match[0].end= (size_t) (str- (const uchar*)b-1); match[0].mb_len= match[0].end; if (nmatch > 1) @@ -1244,7 +1255,7 @@ static int pcmp(const void * f, const void * s) return res; } -static my_bool create_fromuni(CHARSET_INFO *cs, void *(*alloc)(uint)) +static my_bool create_fromuni(CHARSET_INFO *cs, void *(*alloc)(size_t)) { uni_idx idx[PLANE_NUM]; int i,n; @@ -1323,7 +1334,7 @@ static my_bool create_fromuni(CHARSET_INFO *cs, void *(*alloc)(uint)) return FALSE; } -static my_bool my_cset_init_8bit(CHARSET_INFO *cs, void *(*alloc)(uint)) +static my_bool my_cset_init_8bit(CHARSET_INFO *cs, void *(*alloc)(size_t)) { cs->caseup_multiply= 1; cs->casedn_multiply= 1; @@ -1351,7 +1362,7 @@ static void set_max_sort_char(CHARSET_INFO *cs) } static my_bool my_coll_init_simple(CHARSET_INFO *cs, - void *(*alloc)(uint) __attribute__((unused))) + void *(*alloc)(size_t) __attribute__((unused))) { set_max_sort_char(cs); return FALSE; @@ -1365,6 +1376,19 @@ longlong my_strtoll10_8bit(CHARSET_INFO *cs __attribute__((unused)), } +int my_mb_ctype_8bit(CHARSET_INFO *cs, int *ctype, + const uchar *s, const uchar *e) +{ + if (s >= e) + { + *ctype= 0; + return MY_CS_TOOSMALL; + } + *ctype= cs->ctype[*s + 1]; + return 1; +} + + #undef ULONGLONG_MAX /* Needed under MetroWerks Compiler, since MetroWerks compiler does not @@ -1465,13 +1489,13 @@ static ulonglong d10[DIGITS_IN_ULONGLONG]= ulonglong my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)), - const char *str, uint length, int unsigned_flag, + const char *str, size_t length, int unsigned_flag, char **endptr, int *error) { const char *dot, *end9, *beg, *end= str + length; ulonglong ull; ulong ul; - unsigned char ch; + uchar ch; int shift= 0, digits= 0, negative, addon; /* Skip leading spaces and tabs */ @@ -1489,7 +1513,7 @@ my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)), beg= str; end9= (str + 9) > end ? end : (str + 9); /* Accumulate small number into ulong, for performance purposes */ - for (ul= 0 ; str < end9 && (ch= (unsigned char) (*str - '0')) < 10; str++) + for (ul= 0 ; str < end9 && (ch= (uchar) (*str - '0')) < 10; str++) { ul= ul * 10 + ch; } @@ -1517,12 +1541,12 @@ my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)), } } - digits= (int) (str - beg); + digits= str - beg; /* Continue to accumulate into ulonglong */ for (dot= NULL, ull= ul; str < end; str++) { - if ((ch= (unsigned char) (*str - '0')) < 10) + if ((ch= (uchar) (*str - '0')) < 10) { if (ull < CUTOFF || (ull == CUTOFF && ch <= CUTLIM)) { @@ -1545,17 +1569,17 @@ my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)), addon= (*str >= '5'); if (!dot) { - for ( ; str < end && (ch= (unsigned char) (*str - '0')) < 10; shift++, str++); + for ( ; str < end && (ch= (uchar) (*str - '0')) < 10; shift++, str++); if (str < end && *str == '.') { str++; - for ( ; str < end && (ch= (unsigned char) (*str - '0')) < 10; str++); + for ( ; str < end && (ch= (uchar) (*str - '0')) < 10; str++); } } else { - shift= (int) (dot - str); - for ( ; str < end && (ch= (unsigned char) (*str - '0')) < 10; str++); + shift= dot - str; + for ( ; str < end && (ch= (uchar) (*str - '0')) < 10; str++); } goto exp; } @@ -1578,7 +1602,7 @@ my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)), /* Unknown character, exit the loop */ break; } - shift= dot ? (int) (dot - str) : 0; /* Right shift */ + shift= dot ? dot - str : 0; /* Right shift */ addon= 0; exp: /* [ E [ <sign> ] <unsigned integer> ] */ @@ -1601,7 +1625,7 @@ exp: /* [ E [ <sign> ] <unsigned integer> ] */ goto ret_sign; } for (exponent= 0 ; - str < end && (ch= (unsigned char) (*str - '0')) < 10; + str < end && (ch= (uchar) (*str - '0')) < 10; str++) { exponent= exponent * 10 + ch; @@ -1744,7 +1768,7 @@ ret_too_big: my_bool my_propagate_simple(CHARSET_INFO *cs __attribute__((unused)), const uchar *str __attribute__((unused)), - uint length __attribute__((unused))) + size_t length __attribute__((unused))) { return 1; } @@ -1752,7 +1776,7 @@ my_bool my_propagate_simple(CHARSET_INFO *cs __attribute__((unused)), my_bool my_propagate_complex(CHARSET_INFO *cs __attribute__((unused)), const uchar *str __attribute__((unused)), - uint length __attribute__((unused))) + size_t length __attribute__((unused))) { return 0; } @@ -1770,6 +1794,7 @@ MY_CHARSET_HANDLER my_charset_8bit_handler= my_numcells_8bit, my_mb_wc_8bit, my_wc_mb_8bit, + my_mb_ctype_8bit, my_caseup_str_8bit, my_casedn_str_8bit, my_caseup_8bit, diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index fa00919692f..f07357e3e58 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* This file is for Shift JIS charset, and created by tommy@valley.ne.jp. */ @@ -182,13 +183,13 @@ static uchar NEAR sort_order_sjis[]= (0x80<=(c) && (c)<=0xfc)) -static int ismbchar_sjis(CHARSET_INFO *cs __attribute__((unused)), +static uint ismbchar_sjis(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) { return (issjishead((uchar) *p) && (e-p)>1 && issjistail((uchar)p[1]) ? 2: 0); } -static int mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c) +static uint mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (issjishead((uchar) c) ? 2 : 1); } @@ -198,8 +199,8 @@ static int mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c) static int my_strnncoll_sjis_internal(CHARSET_INFO *cs, - const uchar **a_res, uint a_length, - const uchar **b_res, uint b_length) + const uchar **a_res, size_t a_length, + const uchar **b_res, size_t b_length) { const uchar *a= *a_res, *b= *b_res; const uchar *a_end= a + a_length; @@ -230,9 +231,9 @@ static int my_strnncoll_sjis_internal(CHARSET_INFO *cs, static int my_strnncoll_sjis(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, - my_bool b_is_prefix) + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool b_is_prefix) { int res= my_strnncoll_sjis_internal(cs, &a, a_length, &b, b_length); if (b_is_prefix && a_length > b_length) @@ -242,8 +243,8 @@ static int my_strnncoll_sjis(CHARSET_INFO *cs __attribute__((unused)), static int my_strnncollsp_sjis(CHARSET_INFO *cs __attribute__((unused)), - const uchar *a, uint a_length, - const uchar *b, uint b_length, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference) { const uchar *a_end= a + a_length, *b_end= b + b_length; @@ -281,9 +282,9 @@ static int my_strnncollsp_sjis(CHARSET_INFO *cs __attribute__((unused)), -static int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)), - uchar *dest, uint len, - const uchar *src, uint srclen) +static size_t my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { uchar *d_end = dest + len; uchar *s_end = (uchar*) src + srclen; @@ -304,84 +305,6 @@ static int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)), } -/* -** Calculate min_str and max_str that ranges a LIKE string. -** Arguments: -** ptr Pointer to LIKE string. -** ptr_length Length of LIKE string. -** escape Escape character in LIKE. (Normally '\'). -** All escape characters should be removed from min_str and max_str -** res_length Length of min_str and max_str. -** min_str Smallest case sensitive string that ranges LIKE. -** Should be space padded to res_length. -** max_str Largest case sensitive string that ranges LIKE. -** Normally padded with the biggest character sort value. -** -** The function should return 0 if ok and 1 if the LIKE string can't be -** optimized ! -*/ - -#define max_sort_char ((char) 255) - -static my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr,uint ptr_length, - pbool escape, pbool w_one, pbool w_many, - uint res_length, char *min_str,char *max_str, - uint *min_length,uint *max_length) -{ - const char *end= ptr + ptr_length; - char *min_org=min_str; - char *min_end=min_str+res_length; - uint charlen= res_length / cs->mbmaxlen; - - for ( ; ptr < end && min_str < min_end && charlen > 0 ; charlen--) - { - if (ismbchar_sjis(cs, ptr, end)) { - *min_str++ = *max_str++ = *ptr++; - if (min_str < min_end) - *min_str++ = *max_str++ = *ptr++; - continue; - } - if (*ptr == escape && ptr+1 < end) { - ptr++; /* Skip escape */ - if (ismbchar_sjis(cs, ptr, end)) - *min_str++ = *max_str++ = *ptr++; - if (min_str < min_end) - *min_str++ = *max_str++ = *ptr++; - continue; - } - if (*ptr == w_one) { /* '_' in SQL */ - *min_str++ = '\0'; /* This should be min char */ - *max_str++ = max_sort_char; - ptr++; - continue; - } - if (*ptr == w_many) - { /* '%' in SQL */ - /* - Calculate length of keys: - 'a\0\0... is the smallest possible string when we have space expand - a\ff\ff... is the biggest possible string - */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (uint) (min_str - min_org) : - res_length); - *max_length= res_length; - do - { - *min_str++= 0; - *max_str++= max_sort_char; - } while (min_str < min_end); - return 0; - } - *min_str++ = *max_str++ = *ptr++; - } - - *min_length= *max_length= (uint) (min_str - min_org); - while (min_str != min_end) - *min_str++= *max_str++= ' '; /* Because if key compression */ - return 0; -} - /* page 0 0x00A1-0x00DF */ static uint16 tab_sjis_uni0[]={ 0xFF61,0xFF62,0xFF63,0xFF64,0xFF65,0xFF66,0xFF67,0xFF68, @@ -4553,12 +4476,12 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)), } static -uint my_numcells_sjis(CHARSET_INFO *cs __attribute__((unused)), +size_t my_numcells_sjis(CHARSET_INFO *cs __attribute__((unused)), const char *str, const char *str_end) { - uint clen= 0; - const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) str_end; + size_t clen; + const uchar *b= (const uchar *) str; + const uchar *e= (const uchar *) str_end; for (clen= 0; b < e; ) { @@ -4586,9 +4509,9 @@ uint my_numcells_sjis(CHARSET_INFO *cs __attribute__((unused)), CP932 additional characters are also accepted. */ static -uint my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e, - uint pos, int *error) +size_t my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t pos, int *error) { const char *b0= b; *error= 0; @@ -4616,7 +4539,7 @@ uint my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)), break; } } - return (uint) (b - b0); + return (size_t) (b - b0); } @@ -4627,7 +4550,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler = my_strnncollsp_sjis, my_strnxfrm_sjis, my_strnxfrmlen_simple, - my_like_range_sjis, + my_like_range_mb, my_wildcmp_mb, /* wildcmp */ my_strcasecmp_8bit, my_instr_mb, @@ -4648,10 +4571,11 @@ static MY_CHARSET_HANDLER my_charset_handler= my_numcells_sjis, my_mb_wc_sjis, /* mb_wc */ my_wc_mb_sjis, /* wc_mb */ - my_caseup_str_8bit, - my_casedn_str_8bit, - my_caseup_8bit, - my_casedn_8bit, + my_mb_ctype_mb, + my_caseup_str_mb, + my_casedn_str_mb, + my_caseup_mb, + my_casedn_mb, my_snprintf_8bit, my_long10_to_str_8bit, my_longlong10_to_str_8bit, @@ -4692,7 +4616,7 @@ CHARSET_INFO my_charset_sjis_japanese_ci= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFCFC, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, @@ -4724,7 +4648,7 @@ CHARSET_INFO my_charset_sjis_bin= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFCFC, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index b933f72533c..d42e5072feb 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright (c) 2000-2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* Copyright (C) 2003 by Sathit Jittanupat @@ -462,7 +464,7 @@ static uchar NEAR sort_order_tis620[]= len Length of tstr */ -static uint thai2sortable(uchar *tstr, uint len) +static size_t thai2sortable(uchar *tstr, size_t len) { uchar *p; int tlen; @@ -527,8 +529,8 @@ static uint thai2sortable(uchar *tstr, uint len) static int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)), - const uchar * s1, uint len1, - const uchar * s2, uint len2, + const uchar *s1, size_t len1, + const uchar *s2, size_t len2, my_bool s2_is_prefix) { uchar buf[80] ; @@ -557,12 +559,12 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)), static int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)), - const uchar *a0, uint a_length, - const uchar *b0, uint b_length, + const uchar *a0, size_t a_length, + const uchar *b0, size_t b_length, my_bool diff_if_only_endspace_difference) { uchar buf[80], *end, *a, *b, *alloced= NULL; - uint length; + size_t length; int res= 0; #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE @@ -633,13 +635,13 @@ ret: */ static -int my_strnxfrm_tis620(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint len, - const uchar * src, uint srclen) +size_t my_strnxfrm_tis620(CHARSET_INFO *cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { - uint dstlen= len; - len= (uint) (strmake((char*) dest, (char*) src, min(len, srclen)) - - (char*) dest); + size_t dstlen= len; + len= (size_t) (strmake((char*) dest, (char*) src, min(len, srclen)) - + (char*) dest); len= thai2sortable(dest, len); if (dstlen > len) bfill(dest + len, dstlen - len, ' '); @@ -681,7 +683,7 @@ static unsigned short cs_to_uni[256]={ 0x0E50,0x0E51,0x0E52,0x0E53,0x0E54,0x0E55,0x0E56,0x0E57, 0x0E58,0x0E59,0x0E5A,0x0E5B,0xFFFD,0xFFFD,0xFFFD,0xFFFD }; -static unsigned char pl00[256]={ +static uchar pl00[256]={ 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, @@ -715,7 +717,7 @@ static unsigned char pl00[256]={ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 }; -static unsigned char pl0E[256]={ +static uchar pl0E[256]={ 0x0000,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, 0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, @@ -749,7 +751,7 @@ static unsigned char pl0E[256]={ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 }; -static unsigned char plFF[256]={ +static uchar plFF[256]={ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, @@ -783,7 +785,7 @@ static unsigned char plFF[256]={ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x00FF,0x0000,0x0000 }; -static unsigned char *uni_to_cs[256]={ +static uchar *uni_to_cs[256]={ pl00,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL,NULL,pl0E,NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, @@ -822,8 +824,8 @@ NULL,NULL,NULL,NULL,NULL,NULL,NULL,plFF static int my_mb_wc_tis620(CHARSET_INFO *cs __attribute__((unused)), my_wc_t *wc, - const unsigned char *str, - const unsigned char *end __attribute__((unused))) + const uchar *str, + const uchar *end __attribute__((unused))) { if (str >= end) return MY_CS_TOOSMALL; @@ -835,10 +837,10 @@ int my_mb_wc_tis620(CHARSET_INFO *cs __attribute__((unused)), static int my_wc_mb_tis620(CHARSET_INFO *cs __attribute__((unused)), my_wc_t wc, - unsigned char *str, - unsigned char *end __attribute__((unused))) + uchar *str, + uchar *end __attribute__((unused))) { - unsigned char *pl; + uchar *pl; if (str >= end) return MY_CS_TOOSMALL; @@ -876,6 +878,7 @@ static MY_CHARSET_HANDLER my_charset_handler= my_numcells_8bit, my_mb_wc_tis620, /* mb_wc */ my_wc_mb_tis620, /* wc_mb */ + my_mb_ctype_8bit, my_caseup_str_8bit, my_casedn_str_8bit, my_caseup_8bit, diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 81fb9ee1970..ff97a750c8a 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2004 MySQL AB +/* Copyright (c) 2004-2007 MySQL AB, 2009 Sun Microsystems, Inc. + Use is subject to license terms. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -12,8 +13,9 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ + Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA +*/ /* UCA (Unicode Collation Algorithm) support. @@ -6740,7 +6742,7 @@ typedef struct my_uca_scanner_st typedef struct my_uca_scanner_handler_st { void (*init)(my_uca_scanner *scanner, CHARSET_INFO *cs, - const uchar *str, uint length); + const uchar *str, size_t length); int (*next)(my_uca_scanner *scanner); } my_uca_scanner_handler; @@ -6767,7 +6769,7 @@ static uint16 nochar[]= {0,0}; static void my_uca_scanner_init_ucs2(my_uca_scanner *scanner, CHARSET_INFO *cs __attribute__((unused)), - const uchar *str, uint length) + const uchar *str, size_t length) { scanner->wbeg= nochar; if (length) @@ -6859,8 +6861,8 @@ static int my_uca_scanner_next_ucs2(my_uca_scanner *scanner) if (scanner->sbeg > scanner->send) return -1; - scanner->page= (unsigned char)scanner->sbeg[0]; - scanner->code= (unsigned char)scanner->sbeg[1]; + scanner->page= (uchar)scanner->sbeg[0]; + scanner->code= (uchar)scanner->sbeg[1]; scanner->sbeg+= 2; if (scanner->contractions && (scanner->sbeg <= scanner->send)) @@ -6919,7 +6921,7 @@ static my_uca_scanner_handler my_ucs2_uca_scanner_handler= */ static void my_uca_scanner_init_any(my_uca_scanner *scanner, CHARSET_INFO *cs __attribute__((unused)), - const uchar *str, uint length) + const uchar *str, size_t length) { /* Note, no needs to initialize scanner->wbeg */ scanner->sbeg= str; @@ -7055,8 +7057,8 @@ static my_uca_scanner_handler my_any_uca_scanner_handler= static int my_strnncoll_uca(CHARSET_INFO *cs, my_uca_scanner_handler *scanner_handler, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { my_uca_scanner sscanner; @@ -7126,8 +7128,8 @@ static int my_strnncoll_uca(CHARSET_INFO *cs, static int my_strnncollsp_uca(CHARSET_INFO *cs, my_uca_scanner_handler *scanner_handler, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference) { my_uca_scanner sscanner, tscanner; @@ -7204,7 +7206,7 @@ static int my_strnncollsp_uca(CHARSET_INFO *cs, static void my_hash_sort_uca(CHARSET_INFO *cs, my_uca_scanner_handler *scanner_handler, - const uchar *s, uint slen, + const uchar *s, size_t slen, ulong *n1, ulong *n2) { int s_res; @@ -7254,12 +7256,12 @@ static void my_hash_sort_uca(CHARSET_INFO *cs, Number of bytes that have been written into the binary image. */ -static int my_strnxfrm_uca(CHARSET_INFO *cs, - my_uca_scanner_handler *scanner_handler, - uchar *dst, uint dstlen, - const uchar *src, uint srclen) +static size_t my_strnxfrm_uca(CHARSET_INFO *cs, + my_uca_scanner_handler *scanner_handler, + uchar *dst, size_t dstlen, + const uchar *src, size_t srclen) { - uchar *de = dst + (dstlen & (uint) ~1); /* add even length for easier code */ + uchar *de= dst + (dstlen & (size_t) ~1); /* add even length for easier code */ int s_res; my_uca_scanner scanner; scanner_handler->init(&scanner, cs, src, srclen); @@ -7292,6 +7294,7 @@ static int my_strnxfrm_uca(CHARSET_INFO *cs, This fact allows us to use memcmp() safely, on both little-endian and big-endian machines. */ + static int my_uca_charcmp(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2) { size_t page1= wc1 >> MY_UCA_PSHIFT; @@ -7334,7 +7337,7 @@ int my_wildcmp_uca(CHARSET_INFO *cs, my_wc_t s_wc, w_wc; int scan; int (*mb_wc)(struct charset_info_st *, my_wc_t *, - const unsigned char *, const unsigned char *); + const uchar *, const uchar *); mb_wc= cs->cset->mb_wc; while (wildstr != wildend) @@ -7566,7 +7569,7 @@ static void my_coll_lexem_print_error(MY_COLL_LEXEM *lexem, { char tail[30]; size_t len= lexem->end - lexem->prev; - strmake (tail, lexem->prev, (uint) min(len, sizeof(tail)-1)); + strmake (tail, lexem->prev, (size_t) min(len, sizeof(tail)-1)); errstr[errsize-1]= '\0'; my_snprintf(errstr,errsize-1,"%s at '%s'", txt, tail); } @@ -7830,7 +7833,7 @@ static int my_coll_rule_parse(MY_COLL_RULE *rule, size_t mitems, default weights. */ -static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(uint)) +static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(size_t)) { MY_COLL_RULE rule[MY_MAX_COLL_RULE]; char errstr[128]; @@ -7857,6 +7860,9 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(uint)) return 1; } + if (!cs->caseinfo) + cs->caseinfo= my_unicase_default; + if (!(newweights= (uint16**) (*alloc)(256*sizeof(uint16*)))) return 1; bzero(newweights, 256*sizeof(uint16*)); @@ -7988,15 +7994,16 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(uint)) Should work for any character set. */ -static my_bool my_coll_init_uca(CHARSET_INFO *cs, void *(*alloc)(uint)) +static my_bool my_coll_init_uca(CHARSET_INFO *cs, void *(*alloc)(size_t)) { cs->pad_char= ' '; + cs->ctype= my_charset_utf8_unicode_ci.ctype; return create_tailoring(cs, alloc); } static int my_strnncoll_any_uca(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { return my_strnncoll_uca(cs, &my_any_uca_scanner_handler, @@ -8004,8 +8011,8 @@ static int my_strnncoll_any_uca(CHARSET_INFO *cs, } static int my_strnncollsp_any_uca(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference) { return my_strnncollsp_uca(cs, &my_any_uca_scanner_handler, @@ -8014,15 +8021,15 @@ static int my_strnncollsp_any_uca(CHARSET_INFO *cs, } static void my_hash_sort_any_uca(CHARSET_INFO *cs, - const uchar *s, uint slen, + const uchar *s, size_t slen, ulong *n1, ulong *n2) { my_hash_sort_uca(cs, &my_any_uca_scanner_handler, s, slen, n1, n2); } -static int my_strnxfrm_any_uca(CHARSET_INFO *cs, - uchar *dst, uint dstlen, - const uchar *src, uint srclen) +static size_t my_strnxfrm_any_uca(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, + const uchar *src, size_t srclen) { return my_strnxfrm_uca(cs, &my_any_uca_scanner_handler, dst, dstlen, src, srclen); @@ -8034,8 +8041,8 @@ static int my_strnxfrm_any_uca(CHARSET_INFO *cs, UCS2 optimized CHARSET_INFO compatible wrappers. */ static int my_strnncoll_ucs2_uca(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { return my_strnncoll_uca(cs, &my_ucs2_uca_scanner_handler, @@ -8043,8 +8050,8 @@ static int my_strnncoll_ucs2_uca(CHARSET_INFO *cs, } static int my_strnncollsp_ucs2_uca(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference) { return my_strnncollsp_uca(cs, &my_ucs2_uca_scanner_handler, @@ -8053,15 +8060,15 @@ static int my_strnncollsp_ucs2_uca(CHARSET_INFO *cs, } static void my_hash_sort_ucs2_uca(CHARSET_INFO *cs, - const uchar *s, uint slen, + const uchar *s, size_t slen, ulong *n1, ulong *n2) { my_hash_sort_uca(cs, &my_ucs2_uca_scanner_handler, s, slen, n1, n2); } -static int my_strnxfrm_ucs2_uca(CHARSET_INFO *cs, - uchar *dst, uint dstlen, - const uchar *src, uint srclen) +static size_t my_strnxfrm_ucs2_uca(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, + const uchar *src, size_t srclen) { return my_strnxfrm_uca(cs, &my_ucs2_uca_scanner_handler, dst, dstlen, src, srclen); @@ -8069,17 +8076,17 @@ static int my_strnxfrm_ucs2_uca(CHARSET_INFO *cs, MY_COLLATION_HANDLER my_collation_ucs2_uca_handler = { - my_coll_init_uca, /* init */ - my_strnncoll_ucs2_uca, - my_strnncollsp_ucs2_uca, - my_strnxfrm_ucs2_uca, - my_strnxfrmlen_simple, - my_like_range_ucs2, - my_wildcmp_uca, - NULL, - my_instr_mb, - my_hash_sort_ucs2_uca, - my_propagate_complex + my_coll_init_uca, /* init */ + my_strnncoll_ucs2_uca, + my_strnncollsp_ucs2_uca, + my_strnxfrm_ucs2_uca, + my_strnxfrmlen_simple, + my_like_range_ucs2, + my_wildcmp_uca, + NULL, + my_instr_mb, + my_hash_sort_ucs2_uca, + my_propagate_complex }; CHARSET_INFO my_charset_ucs2_unicode_ci= diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 56cfab3b854..4fceb1a8c71 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1,5 +1,4 @@ -/* Copyright (c) 2003-2008 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. +/* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -14,7 +13,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - MA 02110-1301, USA */ + MA 02110-1301, USA +*/ /* UCS2 support. Written by Alexander Barkov <bar@mysql.com> */ @@ -23,6 +23,7 @@ #include "m_string.h" #include "m_ctype.h" #include <errno.h> +#include <stdarg.h> #ifdef HAVE_CHARSET_ucs2 @@ -97,7 +98,7 @@ static int my_ucs2_uni(CHARSET_INFO *cs __attribute__((unused)), if (s+2 > e) /* Need 2 characters */ return MY_CS_TOOSMALL2; - *pwc= ((unsigned char)s[0]) * 256 + ((unsigned char)s[1]); + *pwc= ((uchar)s[0]) * 256 + ((uchar)s[1]); return 2; } @@ -113,9 +114,9 @@ static int my_uni_ucs2(CHARSET_INFO *cs __attribute__((unused)) , } -static uint my_caseup_ucs2(CHARSET_INFO *cs, char *src, uint srclen, +static size_t my_caseup_ucs2(CHARSET_INFO *cs, char *src, size_t srclen, char *dst __attribute__((unused)), - uint dstlen __attribute__((unused))) + size_t dstlen __attribute__((unused))) { my_wc_t wc; int res; @@ -136,7 +137,7 @@ static uint my_caseup_ucs2(CHARSET_INFO *cs, char *src, uint srclen, } -static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, uint slen, +static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, size_t slen, ulong *n1, ulong *n2) { my_wc_t wc; @@ -160,16 +161,16 @@ static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, uint slen, } -static uint my_caseup_str_ucs2(CHARSET_INFO * cs __attribute__((unused)), +static size_t my_caseup_str_ucs2(CHARSET_INFO * cs __attribute__((unused)), char * s __attribute__((unused))) { return 0; } -static uint my_casedn_ucs2(CHARSET_INFO *cs, char *src, uint srclen, +static size_t my_casedn_ucs2(CHARSET_INFO *cs, char *src, size_t srclen, char *dst __attribute__((unused)), - uint dstlen __attribute__((unused))) + size_t dstlen __attribute__((unused))) { my_wc_t wc; int res; @@ -190,7 +191,7 @@ static uint my_casedn_ucs2(CHARSET_INFO *cs, char *src, uint srclen, } -static uint my_casedn_str_ucs2(CHARSET_INFO *cs __attribute__((unused)), +static size_t my_casedn_str_ucs2(CHARSET_INFO *cs __attribute__((unused)), char * s __attribute__((unused))) { return 0; @@ -198,12 +199,12 @@ static uint my_casedn_str_ucs2(CHARSET_INFO *cs __attribute__((unused)), static int my_strnncoll_ucs2(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { int s_res,t_res; - my_wc_t UNINIT_VAR(s_wc),t_wc; + my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); const uchar *se=s+slen; const uchar *te=t+tlen; MY_UNICASE_INFO **uni_plane= cs->caseinfo; @@ -263,13 +264,13 @@ static int my_strnncoll_ucs2(CHARSET_INFO *cs, */ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference __attribute__((unused))) { const uchar *se, *te; - uint minlen; + size_t minlen; MY_UNICASE_INFO **uni_plane= cs->caseinfo; /* extra safety to make sure the lengths are even numbers */ @@ -314,10 +315,10 @@ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)), static int my_strncasecmp_ucs2(CHARSET_INFO *cs, - const char *s, const char *t, uint len) + const char *s, const char *t, size_t len) { int s_res,t_res; - my_wc_t UNINIT_VAR(s_wc),t_wc; + my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); const char *se=s+len; const char *te=t+len; MY_UNICASE_INFO **uni_plane= cs->caseinfo; @@ -353,15 +354,16 @@ static int my_strncasecmp_ucs2(CHARSET_INFO *cs, static int my_strcasecmp_ucs2(CHARSET_INFO *cs, const char *s, const char *t) { - uint s_len= (uint) strlen(s); - uint t_len= (uint) strlen(t); - uint len = (s_len > t_len) ? s_len : t_len; - return my_strncasecmp_ucs2(cs, s, t, len); + size_t s_len= strlen(s); + size_t t_len= strlen(t); + size_t len = (s_len > t_len) ? s_len : t_len; + return my_strncasecmp_ucs2(cs, s, t, len); } -static int my_strnxfrm_ucs2(CHARSET_INFO *cs, - uchar *dst, uint dstlen, const uchar *src, uint srclen) +static size_t my_strnxfrm_ucs2(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, const uchar *src, + size_t srclen) { my_wc_t wc; int res; @@ -389,30 +391,27 @@ static int my_strnxfrm_ucs2(CHARSET_INFO *cs, dst+=res; } if (dst < de) - cs->cset->fill(cs, (char*) dst, (uint) (de - dst), ' '); + cs->cset->fill(cs, (char*) dst, (size_t) (de - dst), ' '); return dstlen; } -static int my_ismbchar_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *b __attribute__((unused)), - const char *e __attribute__((unused))) +static uint my_ismbchar_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *b __attribute__((unused)), + const char *e __attribute__((unused))) { return 2; } -static int my_mbcharlen_ucs2(CHARSET_INFO *cs __attribute__((unused)) , - uint c __attribute__((unused))) +static uint my_mbcharlen_ucs2(CHARSET_INFO *cs __attribute__((unused)) , + uint c __attribute__((unused))) { return 2; } -#include <m_string.h> -#include <stdarg.h> - -static int my_vsnprintf_ucs2(char *dst, uint n, const char* fmt, va_list ap) +static int my_vsnprintf_ucs2(char *dst, size_t n, const char* fmt, va_list ap) { char *start=dst, *end=dst+n-1; for (; *fmt ; fmt++) @@ -438,10 +437,10 @@ static int my_vsnprintf_ucs2(char *dst, uint n, const char* fmt, va_list ap) if (*fmt == 's') /* String parameter */ { reg2 char *par = va_arg(ap, char *); - uint plen; - uint left_len = (uint)(end-dst); + size_t plen; + size_t left_len = (size_t)(end-dst); if (!par) par = (char*)"(null)"; - plen = (uint) strlen(par); + plen= strlen(par); if (left_len <= plen*2) plen = left_len/2 - 1; @@ -458,7 +457,7 @@ static int my_vsnprintf_ucs2(char *dst, uint n, const char* fmt, va_list ap) char nbuf[16]; char *pbuf=nbuf; - if ((uint) (end-dst) < 32) + if ((size_t) (end-dst) < 32) break; iarg = va_arg(ap, int); if (*fmt == 'd') @@ -483,11 +482,11 @@ static int my_vsnprintf_ucs2(char *dst, uint n, const char* fmt, va_list ap) DBUG_ASSERT(dst <= end); *dst='\0'; /* End of errmessage */ - return (uint) (dst - start); + return (size_t) (dst - start); } -static int my_snprintf_ucs2(CHARSET_INFO *cs __attribute__((unused)), - char* to, uint n, const char* fmt, ...) +static size_t my_snprintf_ucs2(CHARSET_INFO *cs __attribute__((unused)), + char* to, size_t n, const char* fmt, ...) { va_list args; va_start(args,fmt); @@ -496,7 +495,7 @@ static int my_snprintf_ucs2(CHARSET_INFO *cs __attribute__((unused)), long my_strntol_ucs2(CHARSET_INFO *cs, - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr, int *err) { int negative=0; @@ -611,7 +610,7 @@ bs: ulong my_strntoul_ucs2(CHARSET_INFO *cs, - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr, int *err) { int negative=0; @@ -720,7 +719,7 @@ bs: longlong my_strntoll_ucs2(CHARSET_INFO *cs, - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr, int *err) { int negative=0; @@ -837,7 +836,7 @@ bs: ulonglong my_strntoull_ucs2(CHARSET_INFO *cs, - const char *nptr, uint l, int base, + const char *nptr, size_t l, int base, char **endptr, int *err) { int negative=0; @@ -945,7 +944,7 @@ bs: double my_strntod_ucs2(CHARSET_INFO *cs __attribute__((unused)), - char *nptr, uint length, + char *nptr, size_t length, char **endptr, int *err) { char buf[256]; @@ -972,13 +971,14 @@ double my_strntod_ucs2(CHARSET_INFO *cs __attribute__((unused)), *endptr= b; res= my_strtod(buf, endptr, err); - *endptr= nptr + (uint) (*endptr- buf); + *endptr= nptr + (size_t) (*endptr- buf); return res; } ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *nptr, uint length, int unsign_fl, + const char *nptr, size_t length, + int unsign_fl, char **endptr, int *err) { char buf[256], *b= buf; @@ -1000,8 +1000,8 @@ ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs __attribute__((unused)), *b++= (char) wc; } - res= my_strntoull10rnd_8bit(cs, buf, (uint) (b - buf), unsign_fl, endptr, err); - *endptr= (char*) nptr + 2 * (uint) (*endptr- buf); + res= my_strntoull10rnd_8bit(cs, buf, b - buf, unsign_fl, endptr, err); + *endptr= (char*) nptr + 2 * (size_t) (*endptr- buf); return res; } @@ -1010,8 +1010,8 @@ ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs __attribute__((unused)), This is a fast version optimized for the case of radix 10 / -10 */ -int my_l10tostr_ucs2(CHARSET_INFO *cs, - char *dst, uint len, int radix, long int val) +size_t my_l10tostr_ucs2(CHARSET_INFO *cs, + char *dst, size_t len, int radix, long int val) { char buffer[66]; register char *p, *db, *de; @@ -1059,8 +1059,9 @@ int my_l10tostr_ucs2(CHARSET_INFO *cs, return (int) (dst-db); } -int my_ll10tostr_ucs2(CHARSET_INFO *cs __attribute__((unused)), - char *dst, uint len, int radix, longlong val) + +size_t my_ll10tostr_ucs2(CHARSET_INFO *cs __attribute__((unused)), + char *dst, size_t len, int radix, longlong val) { char buffer[65]; register char *p, *db, *de; @@ -1139,7 +1140,7 @@ longlong my_strtoll10_ucs2(CHARSET_INFO *cs __attribute__((unused)), const char *nptr, char **endptr, int *error) { const char *s, *end, *start, *n_end, *true_end; - unsigned char c; + uchar c; unsigned long i, j, k; ulonglong li; int negative; @@ -1275,7 +1276,7 @@ end_i: return (negative ? ((longlong) -(long) i) : (longlong) i); end_i_and_j: - li= (ulonglong) i * lfactor[(uint) (s-start) / 2] + j; + li= (ulonglong) i * lfactor[(size_t) (s-start) / 2] + j; *endptr= (char*) s; return (negative ? -((longlong) li) : (longlong) li); @@ -1304,31 +1305,31 @@ no_conv: static -uint my_numchars_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e) +size_t my_numchars_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e) { - return (uint) (e-b)/2; + return (size_t) (e-b)/2; } static -uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *b __attribute__((unused)), - const char *e __attribute__((unused)), - uint pos) +size_t my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *b __attribute__((unused)), + const char *e __attribute__((unused)), + size_t pos) { - uint string_length= (uint) (e - b); + size_t string_length= (size_t) (e - b); return pos > string_length ? string_length + 2 : pos * 2; } static -uint my_well_formed_len_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e, - uint nchars, int *error) +size_t my_well_formed_len_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t nchars, int *error) { /* Ensure string length is dividable with 2 */ - uint nbytes= ((uint) (e-b)) & ~(uint) 1; + size_t nbytes= ((size_t) (e-b)) & ~(size_t) 1; *error= 0; nchars*= 2; return min(nbytes, nchars); @@ -1337,20 +1338,20 @@ uint my_well_formed_len_ucs2(CHARSET_INFO *cs __attribute__((unused)), static void my_fill_ucs2(CHARSET_INFO *cs __attribute__((unused)), - char *s, uint l, int fill) + char *s, size_t l, int fill) { for ( ; l >= 2; s[0]= 0, s[1]= fill, s+=2, l-=2); } static -uint my_lengthsp_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr, uint length) +size_t my_lengthsp_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr, size_t length) { const char *end= ptr+length; while (end > ptr+1 && end[-1] == ' ' && end[-2] == '\0') end-=2; - return (uint) (end-ptr); + return (size_t) (end-ptr); } @@ -1379,12 +1380,12 @@ int my_wildcmp_ucs2_bin(CHARSET_INFO *cs, static int my_strnncoll_ucs2_bin(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { int s_res,t_res; - my_wc_t UNINIT_VAR(s_wc),t_wc; + my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); const uchar *se=s+slen; const uchar *te=t+tlen; @@ -1410,13 +1411,13 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *cs, } static int my_strnncollsp_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference __attribute__((unused))) { const uchar *se, *te; - uint minlen; + size_t minlen; /* extra safety to make sure the lengths are even numbers */ slen= (slen >> 1) << 1; @@ -1459,17 +1460,17 @@ static int my_strnncollsp_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), static int my_strcasecmp_ucs2_bin(CHARSET_INFO *cs, const char *s, const char *t) { - uint s_len= (uint) strlen(s); - uint t_len= (uint) strlen(t); - uint len = (s_len > t_len) ? s_len : t_len; + size_t s_len= strlen(s); + size_t t_len= strlen(t); + size_t len = (s_len > t_len) ? s_len : t_len; return my_strncasecmp_ucs2(cs, s, t, len); } static -int my_strnxfrm_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), - uchar *dst, uint dstlen, - const uchar *src, uint srclen) +size_t my_strnxfrm_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), + uchar *dst, size_t dstlen, + const uchar *src, size_t srclen) { if (dst != src) memcpy(dst,src,srclen= min(dstlen,srclen)); @@ -1481,7 +1482,7 @@ int my_strnxfrm_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), static void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *key, uint len,ulong *nr1, ulong *nr2) + const uchar *key, size_t len,ulong *nr1, ulong *nr2) { const uchar *pos = key; @@ -1516,16 +1517,16 @@ void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), */ my_bool my_like_range_ucs2(CHARSET_INFO *cs, - const char *ptr,uint ptr_length, + const char *ptr, size_t ptr_length, pbool escape, pbool w_one, pbool w_many, - uint res_length, + size_t res_length, char *min_str,char *max_str, - uint *min_length,uint *max_length) + size_t *min_length,size_t *max_length) { const char *end=ptr+ptr_length; char *min_org=min_str; char *min_end=min_str+res_length; - uint charlen= res_length / cs->mbmaxlen; + size_t charlen= res_length / cs->mbmaxlen; const char *contraction_flags= cs->contractions ? ((const char*) cs->contractions) + 0x40*0x40 : NULL; @@ -1555,7 +1556,7 @@ fill_max_and_min: 'a\0\0... is the smallest possible string when we have space expand a\ff\ff... is the biggest possible string */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (uint) (min_str - min_org) : + *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : res_length); *max_length= res_length; do { @@ -1602,17 +1603,7 @@ fill_max_and_min: *min_str++= *max_str++ = ptr[1]; } - /* Temporary fix for handling w_one at end of string (key compression) */ - { - char *tmp; - for (tmp= min_str ; tmp-1 > min_org && tmp[-1] == '\0' && tmp[-2]=='\0';) - { - *--tmp=' '; - *--tmp='\0'; - } - } - - *min_length= *max_length = (uint) (min_str - min_org); + *min_length= *max_length = (size_t) (min_str - min_org); while (min_str + 1 < min_end) { *min_str++ = *max_str++ = '\0'; @@ -1623,8 +1614,8 @@ fill_max_and_min: -ulong my_scan_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *str, const char *end, int sequence_type) +size_t my_scan_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *str, const char *end, int sequence_type) { const char *str0= str; end--; /* for easier loop condition, because of two bytes per character */ @@ -1637,7 +1628,7 @@ ulong my_scan_ucs2(CHARSET_INFO *cs __attribute__((unused)), if (str[0] != '\0' || str[1] != ' ') break; } - return (ulong) (str - str0); + return (size_t) (str - str0); default: return 0; } @@ -1689,6 +1680,7 @@ MY_CHARSET_HANDLER my_charset_ucs2_handler= my_numcells_mb, my_ucs2_uni, /* mb_wc */ my_uni_ucs2, /* wc_mb */ + my_mb_ctype_mb, my_caseup_str_ucs2, my_casedn_str_ucs2, my_caseup_ucs2, diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 4a75244807d..51bae01562d 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 MySQL AB & tommy@valley.ne.jp. +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. & tommy@valley.ne.jp. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -12,8 +12,9 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ + Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA +*/ /* This file is for Japanese EUC charset, and created by tommy@valley.ne.jp. */ @@ -184,7 +185,7 @@ static uchar NEAR sort_order_ujis[]= #define isujis_ss3(c) (((c)&0xff) == 0x8f) -static int ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)), +static uint ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) { return ((*(uchar*)(p)<0x80)? 0:\ @@ -194,7 +195,7 @@ static int ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)), 0); } -static int mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c) +static uint mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 1); } @@ -264,18 +265,6 @@ my_wc_mb_jisx0201(CHARSET_INFO *cs __attribute__((unused)), return 1; } - if (wc == 0x00A5) - { - *s = 0x5C; - return 1; - } - - if (wc == 0x203E) - { - *s = 0x7E; - return 1; - } - return MY_CS_ILUNI; } @@ -8252,9 +8241,9 @@ my_jisx0212_uni_onechar(int code){ */ static -uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), - const char *beg, const char *end, - uint pos, int *error) +size_t my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), + const char *beg, const char *end, + size_t pos, int *error) { const uchar *b= (uchar *) beg; @@ -8270,7 +8259,7 @@ uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), if (b >= (uchar *) end) /* need more bytes */ { *error= 1; - return (uint) (chbeg - beg); /* unexpected EOL */ + return (size_t) (chbeg - beg); /* unexpected EOL */ } if (ch == 0x8E) /* [x8E][xA0-xDF] */ @@ -8278,7 +8267,7 @@ uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), if (*b >= 0xA0 && *b <= 0xDF) continue; *error= 1; - return (uint) (chbeg - beg); /* invalid sequence */ + return (size_t) (chbeg - beg); /* invalid sequence */ } if (ch == 0x8F) /* [x8F][xA1-xFE][xA1-xFE] */ @@ -8287,7 +8276,7 @@ uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), if (b >= (uchar*) end) { *error= 1; - return (uint) (chbeg - beg); /* unexpected EOL */ + return (size_t) (chbeg - beg); /* unexpected EOL */ } } @@ -8295,19 +8284,19 @@ uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), *b >= 0xA1 && *b <= 0xFE) /* [xA1-xFE][xA1-xFE] */ continue; *error= 1; - return (uint) (chbeg - beg); /* invalid sequence */ + return (size_t) (chbeg - beg); /* invalid sequence */ } - return (uint) (b - (uchar *) beg); + return (size_t) (b - (uchar *) beg); } static -uint my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), +size_t my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), const char *str, const char *str_end) { - uint clen= 0; - const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) str_end; + size_t clen; + const uchar *b= (const uchar *) str; + const uchar *e= (const uchar *) str_end; for (clen= 0; b < e; ) { @@ -8335,6 +8324,7 @@ uint my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), return clen; } + static int my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *pwc, const uchar *s, const uchar *e) { @@ -8422,10 +8412,11 @@ my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *pwc, const uchar *s, const uchar *e) return MY_CS_ILSEQ; } + static int -my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e) +my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, uchar *s, uchar *e) { - unsigned char c1; + uchar c1; int jp; if (s >= e) @@ -8531,6 +8522,7 @@ static MY_CHARSET_HANDLER my_charset_handler= my_numcells_eucjp, my_mb_wc_euc_jp, /* mb_wc */ my_wc_mb_euc_jp, /* wc_mb */ + my_mb_ctype_mb, my_caseup_str_mb, my_casedn_str_mb, my_caseup_mb, @@ -8576,7 +8568,7 @@ CHARSET_INFO my_charset_ujis_japanese_ci= 1, /* mbminlen */ 3, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFEFE, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, @@ -8609,7 +8601,7 @@ CHARSET_INFO my_charset_ujis_bin= 1, /* mbminlen */ 3, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFEFE, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 358d8db1b6e..264b79dca63 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2002-2007 MySQL AB, 2009 Sun Microsystems, Inc. +/* Copyright (c) 2002-2008 MySQL AB, 2009 Sun Microsystems, Inc. Use is subject to license terms. This library is free software; you can redistribute it and/or @@ -14,7 +14,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - MA 02110-1301, USA */ + MA 02110-1301, USA +*/ /* UTF8 according RFC 2279 */ /* Written by Alexander Barkov <bar@udm.net> */ @@ -42,6 +43,8 @@ #ifdef HAVE_UNIDATA +#include "my_uctype.h" + static MY_UNICASE_INFO plane00[]={ {0x0000,0x0000,0x0000}, {0x0001,0x0001,0x0001}, {0x0002,0x0002,0x0002}, {0x0003,0x0003,0x0003}, @@ -154,7 +157,7 @@ static MY_UNICASE_INFO plane00[]={ {0x00D8,0x00F8,0x00D8}, {0x00D9,0x00F9,0x0055}, {0x00DA,0x00FA,0x0055}, {0x00DB,0x00FB,0x0055}, {0x00DC,0x00FC,0x0055}, {0x00DD,0x00FD,0x0059}, - {0x00DE,0x00FE,0x00DE}, {0x00DF,0x00DF,0x00DF}, + {0x00DE,0x00FE,0x00DE}, {0x00DF,0x00DF,0x0053}, {0x00C0,0x00E0,0x0041}, {0x00C1,0x00E1,0x0041}, {0x00C2,0x00E2,0x0041}, {0x00C3,0x00E3,0x0041}, {0x00C4,0x00E4,0x0041}, {0x00C5,0x00E5,0x0041}, @@ -1721,7 +1724,7 @@ int my_wildcmp_unicode(CHARSET_INFO *cs, my_wc_t s_wc, w_wc; int scan, plane; int (*mb_wc)(struct charset_info_st *, my_wc_t *, - const unsigned char *, const unsigned char *); + const uchar *, const uchar *); mb_wc= cs->cset->mb_wc; while (wildstr != wildend) @@ -1945,7 +1948,7 @@ static inline int bincmp(const uchar *s, const uchar *se, static int my_utf8_uni(CHARSET_INFO *cs __attribute__((unused)), my_wc_t * pwc, const uchar *s, const uchar *e) { - unsigned char c; + uchar c; if (s >= e) return MY_CS_TOOSMALL; @@ -1974,7 +1977,8 @@ static int my_utf8_uni(CHARSET_INFO *cs __attribute__((unused)), if (s+3 > e) /* We need 3 characters */ return MY_CS_TOOSMALL3; - if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && (c >= 0xe1 || s[1] >= 0xa0))) + if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && + (c >= 0xe1 || s[1] >= 0xa0))) return MY_CS_ILSEQ; *pwc = ((my_wc_t) (c & 0x0f) << 12) | @@ -2054,7 +2058,7 @@ static int my_utf8_uni(CHARSET_INFO *cs __attribute__((unused)), static int my_utf8_uni_no_range(CHARSET_INFO *cs __attribute__((unused)), my_wc_t * pwc, const uchar *s) { - unsigned char c; + uchar c; c= s[0]; if (c < 0x80) @@ -2092,8 +2096,8 @@ static int my_utf8_uni_no_range(CHARSET_INFO *cs __attribute__((unused)), } -static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)) , - my_wc_t wc, uchar *r, uchar *e) +static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *r, uchar *e) { int count; @@ -2166,8 +2170,8 @@ static int my_uni_utf8_no_range(CHARSET_INFO *cs __attribute__((unused)), } -static uint my_caseup_utf8(CHARSET_INFO *cs, char *src, uint srclen, - char *dst, uint dstlen) +static size_t my_caseup_utf8(CHARSET_INFO *cs, char *src, size_t srclen, + char *dst, size_t dstlen) { my_wc_t wc; int srcres, dstres; @@ -2185,10 +2189,11 @@ static uint my_caseup_utf8(CHARSET_INFO *cs, char *src, uint srclen, src+= srcres; dst+= dstres; } - return (uint) (dst - dst0); + return (size_t) (dst - dst0); } -static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen, + +static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, size_t slen, ulong *n1, ulong *n2) { my_wc_t wc; @@ -2216,7 +2221,7 @@ static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen, } -static uint my_caseup_str_utf8(CHARSET_INFO *cs, char *src) +static size_t my_caseup_str_utf8(CHARSET_INFO *cs, char *src) { my_wc_t wc; int srcres, dstres; @@ -2235,12 +2240,12 @@ static uint my_caseup_str_utf8(CHARSET_INFO *cs, char *src) dst+= dstres; } *dst= '\0'; - return (uint) (dst - dst0); + return (size_t) (dst - dst0); } -static uint my_casedn_utf8(CHARSET_INFO *cs, char *src, uint srclen, - char *dst, uint dstlen) +static size_t my_casedn_utf8(CHARSET_INFO *cs, char *src, size_t srclen, + char *dst, size_t dstlen) { my_wc_t wc; int srcres, dstres; @@ -2258,11 +2263,11 @@ static uint my_casedn_utf8(CHARSET_INFO *cs, char *src, uint srclen, src+= srcres; dst+= dstres; } - return (uint) (dst - dst0); + return (size_t) (dst - dst0); } -static uint my_casedn_str_utf8(CHARSET_INFO *cs, char *src) +static size_t my_casedn_str_utf8(CHARSET_INFO *cs, char *src) { my_wc_t wc; int srcres, dstres; @@ -2297,13 +2302,13 @@ static uint my_casedn_str_utf8(CHARSET_INFO *cs, char *src) */ *dst= '\0'; - return (uint) (dst - dst0); + return (size_t) (dst - dst0); } static int my_strnncoll_utf8(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { int s_res,t_res; @@ -2372,8 +2377,8 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs, */ static int my_strnncollsp_utf8(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference) { int s_res, t_res, res; @@ -2410,8 +2415,8 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs, t+=t_res; } - slen= (uint) (se-s); - tlen= (uint) (te-t); + slen= (size_t) (se-s); + tlen= (size_t) (te-t); res= 0; if (slen != tlen) @@ -2559,14 +2564,16 @@ int my_wildcmp_utf8(CHARSET_INFO *cs, static -uint my_strnxfrmlen_utf8(CHARSET_INFO *cs __attribute__((unused)), uint len) +size_t my_strnxfrmlen_utf8(CHARSET_INFO *cs __attribute__((unused)), + size_t len) { return (len * 2 + 2) / 3; } -static int my_strnxfrm_utf8(CHARSET_INFO *cs, - uchar *dst, uint dstlen, - const uchar *src, uint srclen) + +static size_t my_strnxfrm_utf8(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, + const uchar *src, size_t srclen) { my_wc_t wc; int res; @@ -2602,14 +2609,15 @@ static int my_strnxfrm_utf8(CHARSET_INFO *cs, return dstlen; } -static int my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e) +static uint my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e) { my_wc_t wc; - int res=my_utf8_uni(cs,&wc, (const uchar*)b, (const uchar*)e); + int res= my_utf8_uni(cs,&wc, (const uchar*)b, (const uchar*)e); return (res>1) ? res : 0; } -static int my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint c) +static uint my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)), + uint c) { if (c < 0x80) return 1; @@ -2658,6 +2666,7 @@ MY_CHARSET_HANDLER my_charset_utf8_handler= my_numcells_mb, my_utf8_uni, my_uni_utf8, + my_mb_ctype_mb, my_caseup_str_utf8, my_casedn_str_utf8, my_caseup_utf8, @@ -2753,8 +2762,8 @@ CHARSET_INFO my_charset_utf8_bin= */ static int my_strnncoll_utf8_cs(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool t_is_prefix) { int s_res,t_res; @@ -2799,8 +2808,8 @@ static int my_strnncoll_utf8_cs(CHARSET_INFO *cs, } static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference) { int s_res, t_res, res; @@ -2928,6 +2937,1300 @@ CHARSET_INFO my_charset_utf8_general_cs= #endif /* Cybozu Hack */ +/* + File system encoding components: + +Code range Pattern Number Used Unused Blocks +----------------------------------------------------------------------------- +00C0..017F [.][0..4][g..z] 5*20= 100 97 3 Latin1 Supplement + Ext A +0370..03FF [.][5..9][g..z] 5*20= 100 88 12 Greek + Coptic +0400..052F [.][g..z][0..6] 20*7= 140 140 137 Cyrillic +0530..058F [.][g..z][7..8] 20*2= 40 38 2 Armenian +2160..217F [.][g..z][9] 20*1= 20 16 4 Number Forms +0180..02AF [.][g..z][a..k] 28*11=220 203 17 Latin Ext B + IPA +1E00..0EFF [.][g..z][l..r] 20*7= 140 136 4 Latin Additional Extended +1F00..1FFF [.][g..z][s..z] 20*8= 160 144 16 Greek Extended +.... .... [.][a..f][g..z] 6*20= 120 0 120 RESERVED +24B6..24E9 [.][@][a..z] 26 26 0 Enclosed Alphanumerics +FF21..FF5A [.][a..z][@] 26 26 0 Full Width forms + +All other characters are encoded using five bytes: + +[.][0..9a..z][0..9a..z][0..9a..z][0..9a..z] + +*/ + + +static uint16 touni[5994]= +{ + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00C0, + 0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8, + 0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,0x00D0, + 0x00D1,0x00D2,0x00D3,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00E0, + 0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,0x00E8, + 0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,0x00F0, + 0x00F1,0x00F2,0x00F3,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00D4, + 0x00D5,0x00D6,0x0000,0x00D8,0x00D9,0x00DA,0x00DB,0x00DC, + 0x00DD,0x00DE,0x0178,0x0100,0x0102,0x0104,0x0106,0x0108, + 0x010A,0x010C,0x010E,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00F4, + 0x00F5,0x00F6,0x00DF,0x00F8,0x00F9,0x00FA,0x00FB,0x00FC, + 0x00FD,0x00FE,0x00FF,0x0101,0x0103,0x0105,0x0107,0x0109, + 0x010B,0x010D,0x010F,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0110, + 0x0112,0x0114,0x0116,0x0118,0x011A,0x011C,0x011E,0x0120, + 0x0122,0x0124,0x0126,0x0128,0x012A,0x012C,0x012E,0x0000, + 0x0132,0x0134,0x0136,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0111, + 0x0113,0x0115,0x0117,0x0119,0x011B,0x011D,0x011F,0x0121, + 0x0123,0x0125,0x0127,0x0129,0x012B,0x012D,0x012F,0x0131, + 0x0133,0x0135,0x0137,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0139,0x013B,0x013D,0x013F,0x0141,0x0143,0x0145,0x0147, + 0x0000,0x014A,0x014C,0x014E,0x0150,0x0152,0x0154,0x0156, + 0x0158,0x015A,0x015C,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0138, + 0x013A,0x013C,0x013E,0x0140,0x0142,0x0144,0x0146,0x0148, + 0x0149,0x014B,0x014D,0x014F,0x0151,0x0153,0x0155,0x0157, + 0x0159,0x015B,0x015D,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x015E, + 0x0160,0x0162,0x0164,0x0166,0x0168,0x016A,0x016C,0x016E, + 0x0170,0x0172,0x0174,0x0176,0x0179,0x017B,0x017D,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x015F, + 0x0161,0x0163,0x0165,0x0167,0x0169,0x016B,0x016D,0x016F, + 0x0171,0x0173,0x0175,0x0177,0x017A,0x017C,0x017E,0x017F, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0390,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0386, + 0x0388,0x0389,0x038A,0x0000,0x0391,0x0000,0x0393,0x0394, + 0x0395,0x0396,0x0397,0x0000,0x0399,0x0000,0x039B,0x039C, + 0x039D,0x039E,0x039F,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03AC, + 0x03AD,0x03AE,0x03AF,0x03B0,0x03B1,0x03B2,0x03B3,0x03B4, + 0x03B5,0x03B6,0x03B7,0x03B8,0x03B9,0x03BA,0x03BB,0x03BC, + 0x03BD,0x03BE,0x03BF,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x03A1,0x0000,0x0000,0x03A4,0x03A5,0x0000,0x03A7,0x03A8, + 0x03A9,0x03AA,0x03AB,0x038C,0x038E,0x038F,0x0000,0x0392, + 0x0398,0x03D2,0x03D3,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03C0, + 0x03C1,0x03C2,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8, + 0x03C9,0x03CA,0x03CB,0x03CC,0x03CD,0x03CE,0x0000,0x03D0, + 0x03D1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03D4, + 0x03A6,0x03A0,0x0000,0x0000,0x03DA,0x03DC,0x03DE,0x03E0, + 0x03E2,0x03E4,0x03E6,0x03E8,0x03EA,0x03EC,0x03EE,0x039A, + 0x0000,0x03A3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x03D5,0x03D6,0x03D7,0x03D9,0x03DB,0x03DD,0x03DF,0x03E1, + 0x03E3,0x03E5,0x03E7,0x03E9,0x03EB,0x03ED,0x03EF,0x03F0, + 0x03F1,0x03F2,0x03F3,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x03FD,0x03FE,0x03FF,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03F5, + 0x03F6,0x03F8,0x03FB,0x03FC,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x24B6,0x24B7,0x24B8,0x24B9,0x24BA,0x24BB,0x24BC, + 0x24BD,0x24BE,0x24BF,0x24C0,0x24C1,0x24C2,0x24C3,0x24C4, + 0x24C5,0x24C6,0x24C7,0x24C8,0x24C9,0x24CA,0x24CB,0x24CC, + 0x24CD,0x24CE,0x24CF,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x24D0,0x24D1,0x24D2,0x24D3,0x24D4,0x24D5,0x24D6, + 0x24D7,0x24D8,0x24D9,0x24DA,0x24DB,0x24DC,0x24DD,0x24DE, + 0x24DF,0x24E0,0x24E1,0x24E2,0x24E3,0x24E4,0x24E5,0x24E6, + 0x24E7,0x24E8,0x24E9,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF21,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF22,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF23,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF24,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF25,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF26,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0410,0x0424,0x0408,0x0478,0x04A6,0x04CD,0x04F4,0x0000, + 0x0544,0x2160,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF27,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x01B3,0x01DE,0x0208,0x0230,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E00,0x1E28,0x1E50,0x1E78, + 0x1E60,0x1EBE,0x1EE6,0x1F08,0x1F2A,0x0000,0x1F6C,0x1F88, + 0x1FAC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0411,0x0425,0x0409,0x047A,0x04A8,0x0000,0x04F6,0x0531, + 0x0545,0x2161,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF28,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0182,0x01B5,0x01E0,0x020A,0x0232,0x0000,0x0000, + 0x019D,0x0000,0x0000,0x0000,0x1E02,0x1E2A,0x1E52,0x1E7A, + 0x0000,0x1EC0,0x1EE8,0x1F09,0x1F2B,0x0000,0x1F6D,0x1F89, + 0x1FAD,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0412,0x0426,0x040A,0x047C,0x04AA,0x04D0,0x04F8,0x0532, + 0x0546,0x2162,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF29,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0184,0x01B8,0x01E2,0x020C,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E04,0x1E2C,0x1E54,0x1E7C, + 0x0000,0x1EC2,0x1EEA,0x1F0A,0x1F2C,0x0000,0x1F6E,0x1F8A, + 0x1FAE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0413,0x0427,0x040B,0x047E,0x04AC,0x04D2,0x0000,0x0533, + 0x0547,0x2163,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF2A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0187,0x0000,0x01E4,0x020E,0x0000,0x0000,0x0193, + 0x0000,0x01AE,0x0000,0x0000,0x1E06,0x1E2E,0x1E56,0x1E7E, + 0x0000,0x1EC4,0x1EEC,0x1F0B,0x1F2D,0x0000,0x1F6F,0x1F8B, + 0x1FAF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0414,0x0428,0x040C,0x0480,0x04AE,0x04D4,0x0000,0x0534, + 0x0548,0x2164,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF2B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x018B,0x0000,0x01E6,0x0210,0x0000,0x0000,0x0000, + 0x019F,0x0000,0x0000,0x0000,0x1E08,0x1E30,0x1E58,0x1E80, + 0x0000,0x1EC6,0x1EEE,0x1F0C,0x1F2E,0x0000,0x1FBA,0x1F8C, + 0x1FB8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0415,0x0429,0x040D,0x0000,0x04B0,0x04D6,0x0000,0x0535, + 0x0549,0x2165,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF2C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x01E8,0x0212,0x0000,0x0000,0x0000, + 0x0000,0x01B1,0x0000,0x0000,0x1E0A,0x1E32,0x1E5A,0x1E82, + 0x1EA0,0x1EC8,0x1EF0,0x1F0D,0x1F2F,0x1F59,0x1FBB,0x1F8D, + 0x1FB9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0416,0x042A,0x040E,0x048A,0x04B2,0x04D8,0x0000,0x0536, + 0x054A,0x2166,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF2D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0191,0x0000,0x01EA,0x0214,0x0000,0x0000,0x0194, + 0x0000,0x01B2,0x0000,0x0000,0x1E0C,0x1E34,0x1E5C,0x1E84, + 0x1EA2,0x1ECA,0x1EF2,0x1F0E,0x1F38,0x0000,0x1FC8,0x1F8E, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0417,0x042B,0x040F,0x048C,0x04B4,0x04DA,0x0000,0x0537, + 0x054B,0x2167,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF2E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01F6,0x01BC,0x01EC,0x0216,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E0E,0x1E36,0x1E5E,0x1E86, + 0x1EA4,0x1ECC,0x1EF4,0x1F0F,0x1F39,0x1F5B,0x1FC9,0x1F8F, + 0x1FBC,0x1FE8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0418,0x042C,0x0460,0x048E,0x04B6,0x04DC,0x0000,0x0538, + 0x054C,0x2168,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF2F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0198,0x01C4,0x01EE,0x0218,0x023A,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E10,0x1E38,0x0000,0x1E88, + 0x1EA6,0x1ECE,0x1EF6,0x1F18,0x1F3A,0x0000,0x1FCA,0x1F98, + 0x0000,0x1FE9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0419,0x042D,0x0462,0x0490,0x04B8,0x04DE,0x0500,0x0539, + 0x054D,0x2169,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF30,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x023D,0x01C7,0x0000,0x021A,0x023B,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E12,0x1E3A,0x1E62,0x1E8A, + 0x1EA8,0x1ED0,0x1EF8,0x1F19,0x1F3B,0x1F5D,0x1FCB,0x1F99, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x041A,0x042E,0x0464,0x0492,0x04BA,0x04E0,0x0502,0x053A, + 0x054E,0x216A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF31,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x01CA,0x01F1,0x021C,0x023E,0x0181,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E14,0x1E3C,0x1E64,0x1E8C, + 0x1EAA,0x1ED2,0x0000,0x1F1A,0x1F3C,0x0000,0x1FDA,0x1F9A, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x041B,0x042F,0x0466,0x0494,0x04BC,0x04E2,0x0504,0x053B, + 0x054F,0x216B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF32,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0220,0x01CD,0x01F4,0x021E,0x0000,0x0186,0x0197, + 0x0000,0x0000,0x0000,0x0000,0x1E16,0x1E3E,0x1E66,0x1E8E, + 0x1EAC,0x1ED4,0x0000,0x1F1B,0x1F3D,0x1F5F,0x1FDB,0x1F9B, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x041C,0x0400,0x0468,0x0496,0x04BE,0x04E4,0x0506,0x053C, + 0x0550,0x216C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF33,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A0,0x01CF,0x01F8,0x0000,0x0000,0x0000,0x0196, + 0x0000,0x0000,0x0000,0x0000,0x1E18,0x1E40,0x1E68,0x1E90, + 0x1EAE,0x1ED6,0x0000,0x1F1C,0x1F3E,0x0000,0x1FF8,0x1F9C, + 0x0000,0x1FEC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x041D,0x0401,0x046A,0x0498,0x04C0,0x04E6,0x0508,0x053D, + 0x0551,0x216D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF34,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A2,0x01D1,0x01FA,0x0222,0x0000,0x0189,0x0000, + 0x0000,0x01B7,0x0000,0x0000,0x1E1A,0x1E42,0x1E6A,0x1E92, + 0x1EB0,0x1ED8,0x0000,0x1F1D,0x1F3F,0x0000,0x1FF9,0x1F9D, + 0x1FCC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x041E,0x0402,0x046C,0x049A,0x04C1,0x04E8,0x050A,0x053E, + 0x0552,0x216E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF35,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A4,0x01D3,0x01FC,0x0224,0x0000,0x018A,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E1C,0x1E44,0x1E6C,0x1E94, + 0x1EB2,0x1EDA,0x0000,0x0000,0x1F48,0x0000,0x1FEA,0x1F9E, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x041F,0x0403,0x046E,0x049C,0x04C3,0x04EA,0x050C,0x053F, + 0x0553,0x216F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF36,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A7,0x01D5,0x01FE,0x0226,0x0000,0x0000,0x0000, + 0x01A6,0x0241,0x0000,0x0000,0x1E1E,0x1E46,0x1E6E,0x0000, + 0x1EB4,0x1EDC,0x0000,0x0000,0x1F49,0x0000,0x1FEB,0x1F9F, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0420,0x0404,0x0470,0x049E,0x04C5,0x04EC,0x050E,0x0540, + 0x0554,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF37,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x01D7,0x0200,0x0228,0x0000,0x018F,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E20,0x1E48,0x1E70,0x0000, + 0x1EB6,0x1EDE,0x0000,0x0000,0x1F4A,0x1F68,0x1FFA,0x1FA8, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0421,0x0405,0x0472,0x04A0,0x04C7,0x04EE,0x0000,0x0541, + 0x0555,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF38,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x01D9,0x0202,0x022A,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E22,0x1E4A,0x1E72,0x0000, + 0x1EB8,0x1EE0,0x0000,0x0000,0x1F4B,0x1F69,0x1FFB,0x1FA9, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0422,0x0406,0x0474,0x04A2,0x04C9,0x04F0,0x0000,0x0542, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF39,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01AC,0x01DB,0x0204,0x022C,0x0000,0x0190,0x019C, + 0x01A9,0x0000,0x0000,0x0000,0x1E24,0x1E4C,0x1E74,0x0000, + 0x1EBA,0x1EE2,0x0000,0x1F28,0x1F4C,0x1F6A,0x0000,0x1FAA, + 0x1FD8,0x1FFC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0423,0x0407,0x0476,0x04A4,0x04CB,0x04F2,0x0000,0x0543, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF3A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01AF,0x018E,0x0206,0x022E,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E26,0x1E4E,0x1E76,0x0000, + 0x1EBC,0x1EE4,0x0000,0x1F29,0x1F4D,0x1F6B,0x0000,0x1FAB, + 0x1FD9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF41,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF42,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF43,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF44,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF45,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF46,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0430,0x0444,0x0458,0x0479,0x04A7,0x04CE,0x04F5,0x0000, + 0x0574,0x2170,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF47,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0180,0x01B4,0x01DF,0x0209,0x0231,0x0000,0x025D, + 0x0271,0x0285,0x0299,0x02AD,0x1E01,0x1E29,0x1E51,0x1E79, + 0x1E9B,0x1EBF,0x1EE7,0x1F00,0x1F22,0x0000,0x1F64,0x1F80, + 0x1FA4,0x1FD2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0431,0x0445,0x0459,0x047B,0x04A9,0x0000,0x04F7,0x0561, + 0x0575,0x2171,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF48,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0183,0x01B6,0x01E1,0x020B,0x0233,0x0000,0x025E, + 0x0272,0x0286,0x029A,0x02AE,0x1E03,0x1E2B,0x1E53,0x1E7B, + 0x0000,0x1EC1,0x1EE9,0x1F01,0x1F23,0x0000,0x1F65,0x1F81, + 0x1FA5,0x1FD3,0x1FF6,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0432,0x0446,0x045A,0x047D,0x04AB,0x04D1,0x04F9,0x0562, + 0x0576,0x2172,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF49,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0185,0x01B9,0x01E3,0x020D,0x0234,0x0000,0x025F, + 0x0273,0x0287,0x029B,0x02AF,0x1E05,0x1E2D,0x1E55,0x1E7D, + 0x0000,0x1EC3,0x1EEB,0x1F02,0x1F24,0x0000,0x1F66,0x1F82, + 0x1FA6,0x0000,0x1FF7,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0433,0x0447,0x045B,0x047F,0x04AD,0x04D3,0x0000,0x0563, + 0x0577,0x2173,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF4A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0188,0x01BA,0x01E5,0x020F,0x0235,0x0000,0x0260, + 0x0274,0x0288,0x029C,0x0000,0x1E07,0x1E2F,0x1E57,0x1E7F, + 0x0000,0x1EC5,0x1EED,0x1F03,0x1F25,0x0000,0x1F67,0x1F83, + 0x1FA7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0434,0x0448,0x045C,0x0481,0x04AF,0x04D5,0x0000,0x0564, + 0x0578,0x2174,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF4B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x018C,0x01BB,0x01E7,0x0211,0x0236,0x0000,0x0261, + 0x0275,0x0289,0x029D,0x0000,0x1E09,0x1E31,0x1E59,0x1E81, + 0x0000,0x1EC7,0x1EEF,0x1F04,0x1F26,0x1F50,0x1F70,0x1F84, + 0x1FB0,0x1FD6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0435,0x0449,0x045D,0x0000,0x04B1,0x04D7,0x0000,0x0565, + 0x0579,0x2175,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF4C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x018D,0x0000,0x01E9,0x0213,0x0237,0x0000,0x0262, + 0x0276,0x028A,0x029E,0x0000,0x1E0B,0x1E33,0x1E5B,0x1E83, + 0x1EA1,0x1EC9,0x1EF1,0x1F05,0x1F27,0x1F51,0x1F71,0x1F85, + 0x1FB1,0x1FD7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0436,0x044A,0x045E,0x048B,0x04B3,0x04D9,0x0000,0x0566, + 0x057A,0x2176,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF4D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0192,0x01BE,0x01EB,0x0215,0x0238,0x0000,0x0263, + 0x0277,0x028B,0x029F,0x0000,0x1E0D,0x1E35,0x1E5D,0x1E85, + 0x1EA3,0x1ECB,0x1EF3,0x1F06,0x1F30,0x1F52,0x1F72,0x1F86, + 0x1FB2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0437,0x044B,0x045F,0x048D,0x04B5,0x04DB,0x0000,0x0567, + 0x057B,0x2177,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF4E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0195,0x01BD,0x01ED,0x0217,0x0239,0x0250,0x0264, + 0x0278,0x028C,0x02A0,0x0000,0x1E0F,0x1E37,0x1E5F,0x1E87, + 0x1EA5,0x1ECD,0x1EF5,0x1F07,0x1F31,0x1F53,0x1F73,0x1F87, + 0x1FB3,0x1FE0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0438,0x044C,0x0461,0x048F,0x04B7,0x04DD,0x0000,0x0568, + 0x057C,0x2178,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF4F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0199,0x01C6,0x01EF,0x0219,0x0000,0x0251,0x0265, + 0x0279,0x028D,0x02A1,0x0000,0x1E11,0x1E39,0x1E61,0x1E89, + 0x1EA7,0x1ECF,0x1EF7,0x1F10,0x1F32,0x1F54,0x1F74,0x1F90, + 0x1FB4,0x1FE1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0439,0x044D,0x0463,0x0491,0x04B9,0x04DF,0x0501,0x0569, + 0x057D,0x2179,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF50,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x019A,0x01C9,0x01F0,0x021B,0x023C,0x0252,0x0266, + 0x027A,0x028E,0x02A2,0x0000,0x1E13,0x1E3B,0x1E63,0x1E8B, + 0x1EA9,0x1ED1,0x1EF9,0x1F11,0x1F33,0x1F55,0x1F75,0x1F91, + 0x0000,0x1FE2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x043A,0x044E,0x0465,0x0493,0x04BB,0x04E1,0x0503,0x056A, + 0x057E,0x217A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF51,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x019B,0x01CC,0x01F3,0x021D,0x0000,0x0253,0x0267, + 0x027B,0x028F,0x02A3,0x0000,0x1E15,0x1E3D,0x1E65,0x1E8D, + 0x1EAB,0x1ED3,0x0000,0x1F12,0x1F34,0x1F56,0x1F76,0x1F92, + 0x1FB6,0x1FE3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x043B,0x044F,0x0467,0x0495,0x04BD,0x04E3,0x0505,0x056B, + 0x057F,0x217B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF52,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x019E,0x01CE,0x01F5,0x021F,0x023F,0x0254,0x0268, + 0x027C,0x0290,0x02A4,0x0000,0x1E17,0x1E3F,0x1E67,0x1E8F, + 0x1EAD,0x1ED5,0x0000,0x1F13,0x1F35,0x1F57,0x1F77,0x1F93, + 0x1FB7,0x1FE4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x043C,0x0450,0x0469,0x0497,0x04BF,0x04E5,0x0507,0x056C, + 0x0580,0x217C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF53,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A1,0x01D0,0x01F9,0x0221,0x0240,0x0255,0x0269, + 0x027D,0x0291,0x02A5,0x0000,0x1E19,0x1E41,0x1E69,0x1E91, + 0x1EAF,0x1ED7,0x0000,0x1F14,0x1F36,0x0000,0x1F78,0x1F94, + 0x1FC2,0x1FE5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x043D,0x0451,0x046B,0x0499,0x0000,0x04E7,0x0509,0x056D, + 0x0581,0x217D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF54,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A3,0x01D2,0x01FB,0x0223,0x0000,0x0256,0x026A, + 0x027E,0x0292,0x02A6,0x0000,0x1E1B,0x1E43,0x1E6B,0x1E93, + 0x1EB1,0x1ED9,0x0000,0x1F15,0x1F37,0x0000,0x1F79,0x1F95, + 0x1FC3,0x1FE6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x043E,0x0452,0x046D,0x049B,0x04C2,0x04E9,0x050B,0x056E, + 0x0582,0x217E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF55,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A5,0x01D4,0x01FD,0x0225,0x0000,0x0257,0x026B, + 0x027F,0x0293,0x02A7,0x0000,0x1E1D,0x1E45,0x1E6D,0x1E95, + 0x1EB3,0x1EDB,0x0000,0x0000,0x1F40,0x0000,0x1F7A,0x1F96, + 0x1FC4,0x1FE7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x043F,0x0453,0x046F,0x049D,0x04C4,0x04EB,0x050D,0x056F, + 0x0583,0x217F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF56,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A8,0x01D6,0x01FF,0x0227,0x0000,0x0258,0x026C, + 0x0280,0x0294,0x02A8,0x0000,0x1E1F,0x1E47,0x1E6F,0x1E96, + 0x1EB5,0x1EDD,0x0000,0x0000,0x1F41,0x0000,0x1F7B,0x1F97, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0440,0x0454,0x0471,0x049F,0x04C6,0x04ED,0x050F,0x0570, + 0x0584,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF57,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01AA,0x01D8,0x0201,0x0229,0x0000,0x0259,0x026D, + 0x0281,0x0295,0x02A9,0x0000,0x1E21,0x1E49,0x1E71,0x1E97, + 0x1EB7,0x1EDF,0x0000,0x0000,0x1F42,0x1F60,0x1F7C,0x1FA0, + 0x1FC6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0441,0x0455,0x0473,0x04A1,0x04C8,0x04EF,0x0000,0x0571, + 0x0585,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF58,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01AB,0x01DA,0x0203,0x022B,0x0000,0x025A,0x026E, + 0x0282,0x0296,0x02AA,0x0000,0x1E23,0x1E4B,0x1E73,0x1E98, + 0x1EB9,0x1EE1,0x0000,0x0000,0x1F43,0x1F61,0x1F7D,0x1FA1, + 0x1FC7,0x1FF2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0442,0x0456,0x0475,0x04A3,0x04CA,0x04F1,0x0000,0x0572, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF59,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01AD,0x01DC,0x0205,0x022D,0x0000,0x025B,0x026F, + 0x0283,0x0297,0x02AB,0x0000,0x1E25,0x1E4D,0x1E75,0x1E99, + 0x1EBB,0x1EE3,0x0000,0x1F20,0x1F44,0x1F62,0x0000,0x1FA2, + 0x1FD0,0x1FF3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0443,0x0457,0x0477,0x04A5,0x04CC,0x04F3,0x0000,0x0573, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF5A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01B0,0x01DD,0x0207,0x022F,0x0000,0x025C,0x0270, + 0x0284,0x0298,0x02AC,0x0000,0x1E27,0x1E4F,0x1E77,0x1E9A, + 0x1EBD,0x1EE5,0x0000,0x1F21,0x1F45,0x1F63,0x0000,0x1FA3, + 0x1FD1,0x1FF4 +}; + + +/* 00C0-05FF */ +static uint16 uni_0C00_05FF[1344]= +{ + 0x0017,0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E, + 0x001F,0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026, + 0x0027,0x0028,0x0029,0x002A,0x0067,0x0068,0x0069,0x0000, + 0x006B,0x006C,0x006D,0x006E,0x006F,0x0070,0x0071,0x008A, + 0x0037,0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E, + 0x003F,0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046, + 0x0047,0x0048,0x0049,0x004A,0x0087,0x0088,0x0089,0x0000, + 0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,0x0092, + 0x0073,0x0093,0x0074,0x0094,0x0075,0x0095,0x0076,0x0096, + 0x0077,0x0097,0x0078,0x0098,0x0079,0x0099,0x007A,0x009A, + 0x00B7,0x00D7,0x00B8,0x00D8,0x00B9,0x00D9,0x00BA,0x00DA, + 0x00BB,0x00DB,0x00BC,0x00DC,0x00BD,0x00DD,0x00BE,0x00DE, + 0x00BF,0x00DF,0x00C0,0x00E0,0x00C1,0x00E1,0x00C2,0x00E2, + 0x00C3,0x00E3,0x00C4,0x00E4,0x00C5,0x00E5,0x00C6,0x00E6, + 0x0000,0x00E7,0x00C8,0x00E8,0x00C9,0x00E9,0x00CA,0x00EA, + 0x0127,0x0108,0x0128,0x0109,0x0129,0x010A,0x012A,0x010B, + 0x012B,0x010C,0x012C,0x010D,0x012D,0x010E,0x012E,0x010F, + 0x012F,0x0130,0x0111,0x0131,0x0112,0x0132,0x0113,0x0133, + 0x0114,0x0134,0x0115,0x0135,0x0116,0x0136,0x0117,0x0137, + 0x0118,0x0138,0x0119,0x0139,0x011A,0x013A,0x0157,0x0177, + 0x0158,0x0178,0x0159,0x0179,0x015A,0x017A,0x015B,0x017B, + 0x015C,0x017C,0x015D,0x017D,0x015E,0x017E,0x015F,0x017F, + 0x0160,0x0180,0x0161,0x0181,0x0162,0x0182,0x0163,0x0183, + 0x0072,0x0164,0x0184,0x0165,0x0185,0x0166,0x0186,0x0187, + 0x1161,0x0A86,0x07B1,0x11B1,0x0801,0x1201,0x0AD6,0x0851, + 0x1251,0x0B76,0x0BC6,0x08A1,0x12A1,0x12F1,0x0D52,0x0C66, + 0x0D06,0x0941,0x1341,0x0857,0x0947,0x1391,0x0B27,0x0AD7, + 0x09E1,0x13E1,0x1431,0x1481,0x0D07,0x07B8,0x14D1,0x08A8, + 0x0B21,0x1521,0x0B71,0x1571,0x0BC1,0x15C1,0x0C18,0x0C11, + 0x1611,0x0D08,0x1661,0x16B1,0x0D01,0x1701,0x0859,0x0D51, + 0x1751,0x08F9,0x0949,0x0762,0x1162,0x07B2,0x11B2,0x0B79, + 0x0802,0x1202,0x1252,0x12A2,0x0992,0x1392,0x1342,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x09E2,0x0000,0x13E2,0x0A32, + 0x0000,0x1432,0x0A82,0x0000,0x1482,0x0AD2,0x14D2,0x0B22, + 0x1522,0x0B72,0x1572,0x0BC2,0x15C2,0x0C12,0x1612,0x0C62, + 0x1662,0x0CB2,0x16B2,0x0D02,0x1702,0x1752,0x0763,0x1163, + 0x07B3,0x11B3,0x0803,0x1203,0x0853,0x1253,0x08A3,0x12A3, + 0x08F3,0x12F3,0x0943,0x1343,0x0993,0x1393,0x09E3,0x13E3, + 0x1433,0x0A83,0x0000,0x1483,0x0AD3,0x14D3,0x0991,0x0000, + 0x0B23,0x1523,0x0B73,0x1573,0x0BC3,0x15C3,0x0C13,0x1613, + 0x0C63,0x1663,0x0CB3,0x16B3,0x0D03,0x1703,0x0D53,0x1753, + 0x0764,0x1164,0x07B4,0x11B4,0x0804,0x1204,0x0854,0x1254, + 0x08A4,0x12A4,0x08F4,0x12F4,0x0944,0x1344,0x0994,0x1394, + 0x09E4,0x13E4,0x0A34,0x1434,0x0A84,0x1484,0x0AD4,0x14D4, + 0x0AD1,0x1524,0x0B74,0x1574,0x0BC4,0x15C4,0x0C14,0x1614, + 0x0C64,0x1664,0x0CB4,0x16B4,0x0D04,0x1704,0x0D54,0x1754, + 0x0765,0x1165,0x07B5,0x11B5,0x1205,0x1255,0x12A5,0x12F5, + 0x1345,0x1395,0x09E5,0x0A35,0x1435,0x0A31,0x0A85,0x14D5, + 0x1525,0x0C19,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x1396,0x13E6,0x1436,0x1486,0x14D6,0x1526,0x1576,0x15C6, + 0x1616,0x1666,0x16B6,0x1706,0x1756,0x1167,0x11B7,0x1207, + 0x1257,0x12A7,0x12F7,0x1347,0x1397,0x13E7,0x1437,0x1487, + 0x14D7,0x1527,0x1577,0x15C7,0x1617,0x1667,0x16B7,0x1707, + 0x1757,0x1168,0x11B8,0x1208,0x1258,0x12A8,0x12F8,0x1348, + 0x1398,0x13E8,0x1438,0x1488,0x14D8,0x1528,0x1578,0x15C8, + 0x1618,0x1668,0x16B8,0x1708,0x1758,0x1169,0x11B9,0x1209, + 0x1259,0x12A9,0x12F9,0x1349,0x1399,0x13E9,0x1439,0x1489, + 0x14D9,0x1529,0x1579,0x15C9,0x1619,0x1669,0x16B9,0x1709, + 0x1759,0x116A,0x11BA,0x120A,0x125A,0x12AA,0x12FA,0x134A, + 0x139A,0x13EA,0x143A,0x148A,0x14DA,0x152A,0x157A,0x15CA, + 0x161A,0x166A,0x16BA,0x170A,0x175A,0x116B,0x11BB,0x120B, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x01F7,0x0000, + 0x01F8,0x01F9,0x01FA,0x0000,0x0253,0x0000,0x0254,0x0255, + 0x01D9,0x01FC,0x0257,0x01FE,0x01FF,0x0200,0x0201,0x0202, + 0x0258,0x0204,0x02A7,0x0206,0x0207,0x0208,0x0209,0x020A, + 0x0299,0x0248,0x0000,0x02A9,0x024B,0x024C,0x0298,0x024E, + 0x024F,0x0250,0x0251,0x0252,0x0217,0x0218,0x0219,0x021A, + 0x021B,0x021C,0x021D,0x021E,0x021F,0x0220,0x0221,0x0222, + 0x0223,0x0224,0x0225,0x0226,0x0227,0x0228,0x0229,0x022A, + 0x0267,0x0268,0x0269,0x026A,0x026B,0x026C,0x026D,0x026E, + 0x026F,0x0270,0x0271,0x0272,0x0273,0x0274,0x0275,0x0000, + 0x0277,0x0278,0x0259,0x025A,0x0297,0x02B8,0x02B9,0x02BA, + 0x0000,0x02BB,0x029C,0x02BC,0x029D,0x02BD,0x029E,0x02BE, + 0x029F,0x02BF,0x02A0,0x02C0,0x02A1,0x02C1,0x02A2,0x02C2, + 0x02A3,0x02C3,0x02A4,0x02C4,0x02A5,0x02C5,0x02A6,0x02C6, + 0x02C7,0x02C8,0x02C9,0x02CA,0x0000,0x0307,0x0308,0x0000, + 0x0309,0x0000,0x0000,0x030A,0x030B,0x02EC,0x02ED,0x02EE, + 0x0AF1,0x0B41,0x0B91,0x0BE1,0x0C31,0x0C81,0x0CD1,0x0D21, + 0x0732,0x0782,0x07D2,0x0822,0x0872,0x08C2,0x0912,0x0962, + 0x0730,0x0780,0x07D0,0x0820,0x0870,0x08C0,0x0910,0x0960, + 0x09B0,0x0A00,0x0A50,0x0AA0,0x0AF0,0x0B40,0x0B90,0x0BE0, + 0x0C30,0x0C80,0x0CD0,0x0D20,0x0731,0x0781,0x07D1,0x0821, + 0x0871,0x08C1,0x0911,0x0961,0x09B1,0x0A01,0x0A51,0x0AA1, + 0x1130,0x1180,0x11D0,0x1220,0x1270,0x12C0,0x1310,0x1360, + 0x13B0,0x1400,0x1450,0x14A0,0x14F0,0x1540,0x1590,0x15E0, + 0x1630,0x1680,0x16D0,0x1720,0x1131,0x1181,0x11D1,0x1221, + 0x1271,0x12C1,0x1311,0x1361,0x13B1,0x1401,0x1451,0x14A1, + 0x14F1,0x1541,0x1591,0x15E1,0x1631,0x1681,0x16D1,0x1721, + 0x1132,0x1182,0x11D2,0x1222,0x1272,0x12C2,0x1312,0x1362, + 0x09B2,0x13B2,0x0A02,0x1402,0x0A52,0x1452,0x0AA2,0x14A2, + 0x0AF2,0x14F2,0x0B42,0x1542,0x0B92,0x1592,0x0BE2,0x15E2, + 0x0C32,0x1632,0x0C82,0x1682,0x0CD2,0x16D2,0x0D22,0x1722, + 0x0733,0x1133,0x0783,0x1183,0x07D3,0x11D3,0x0823,0x1223, + 0x0873,0x1273,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0913,0x1313,0x0963,0x1363,0x09B3,0x13B3, + 0x0A03,0x1403,0x0A53,0x1453,0x0AA3,0x14A3,0x0AF3,0x14F3, + 0x0B43,0x1543,0x0B93,0x1593,0x0BE3,0x15E3,0x0C33,0x1633, + 0x0C83,0x1683,0x0CD3,0x16D3,0x0D23,0x1723,0x0734,0x1134, + 0x0784,0x1184,0x07D4,0x11D4,0x0824,0x1224,0x0874,0x1274, + 0x08C4,0x12C4,0x0914,0x1314,0x0964,0x1364,0x09B4,0x13B4, + 0x0A04,0x1404,0x0A54,0x1454,0x0AA4,0x14A4,0x0AF4,0x14F4, + 0x0B44,0x0B94,0x1594,0x0BE4,0x15E4,0x0C34,0x1634,0x0C84, + 0x1684,0x0CD4,0x16D4,0x0D24,0x1724,0x0735,0x1135,0x0000, + 0x07D5,0x11D5,0x0825,0x1225,0x0875,0x1275,0x08C5,0x12C5, + 0x0915,0x1315,0x0965,0x1365,0x09B5,0x13B5,0x0A05,0x1405, + 0x0A55,0x1455,0x0AA5,0x14A5,0x0AF5,0x14F5,0x0B45,0x1545, + 0x0B95,0x1595,0x0BE5,0x15E5,0x0C35,0x1635,0x0C85,0x1685, + 0x0CD5,0x16D5,0x0D25,0x1725,0x0736,0x1136,0x0786,0x1186, + 0x07D6,0x11D6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0A06,0x1406,0x0A56,0x1456,0x0AA6,0x14A6,0x0AF6,0x14F6, + 0x0B46,0x1546,0x0B96,0x1596,0x0BE6,0x15E6,0x0C36,0x1636, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0787,0x07D7,0x0827,0x0877,0x08C7,0x0917,0x0967, + 0x09B7,0x0A07,0x0A57,0x0AA7,0x0AF7,0x0B47,0x0B97,0x0BE7, + 0x0C37,0x0C87,0x0CD7,0x0D27,0x0738,0x0788,0x07D8,0x0828, + 0x0878,0x08C8,0x0918,0x0968,0x09B8,0x0A08,0x0A58,0x0AA8, + 0x0AF8,0x0B48,0x0B98,0x0BE8,0x0C38,0x0C88,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x1187,0x11D7,0x1227,0x1277,0x12C7,0x1317,0x1367, + 0x13B7,0x1407,0x1457,0x14A7,0x14F7,0x1547,0x1597,0x15E7, + 0x1637,0x1687,0x16D7,0x1727,0x1138,0x1188,0x11D8,0x1228, + 0x1278,0x12C8,0x1318,0x1368,0x13B8,0x1408,0x1458,0x14A8, + 0x14F8,0x1548,0x1598,0x15E8,0x1638,0x1688,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 +}; + + +/* 1E00-1FFF */ +static uint16 uni_1E00_1FFF[512]= +{ + 0x076C,0x116C,0x07BC,0x11BC,0x080C,0x120C,0x085C,0x125C, + 0x08AC,0x12AC,0x08FC,0x12FC,0x094C,0x134C,0x099C,0x139C, + 0x09EC,0x13EC,0x0A3C,0x143C,0x0A8C,0x148C,0x0ADC,0x14DC, + 0x0B2C,0x152C,0x0B7C,0x157C,0x0BCC,0x15CC,0x0C1C,0x161C, + 0x0C6C,0x166C,0x0CBC,0x16BC,0x0D0C,0x170C,0x0D5C,0x175C, + 0x076D,0x116D,0x07BD,0x11BD,0x080D,0x120D,0x085D,0x125D, + 0x08AD,0x12AD,0x08FD,0x12FD,0x094D,0x134D,0x099D,0x139D, + 0x09ED,0x13ED,0x0A3D,0x143D,0x0A8D,0x148D,0x0ADD,0x14DD, + 0x0B2D,0x152D,0x0B7D,0x157D,0x0BCD,0x15CD,0x0C1D,0x161D, + 0x0C6D,0x166D,0x0CBD,0x16BD,0x0D0D,0x170D,0x0D5D,0x175D, + 0x076E,0x116E,0x07BE,0x11BE,0x080E,0x120E,0x085E,0x125E, + 0x08AE,0x12AE,0x08FE,0x12FE,0x094E,0x134E,0x099E,0x139E, + 0x0770,0x13EE,0x0A3E,0x143E,0x0A8E,0x148E,0x0ADE,0x14DE, + 0x0B2E,0x152E,0x0B7E,0x157E,0x0BCE,0x15CE,0x0C1E,0x161E, + 0x0C6E,0x166E,0x0CBE,0x16BE,0x0D0E,0x170E,0x0D5E,0x175E, + 0x076F,0x116F,0x07BF,0x11BF,0x080F,0x120F,0x085F,0x125F, + 0x08AF,0x12AF,0x08FF,0x12FF,0x094F,0x134F,0x099F,0x139F, + 0x09EF,0x13EF,0x0A3F,0x143F,0x0A8F,0x148F,0x0ADF,0x14DF, + 0x0B2F,0x152F,0x0B7F,0x157F,0x0BCF,0x15CF,0x161F,0x166F, + 0x16BF,0x170F,0x175F,0x1170,0x0000,0x0000,0x0000,0x0000, + 0x0900,0x1300,0x0950,0x1350,0x09A0,0x13A0,0x09F0,0x13F0, + 0x0A40,0x1440,0x0A90,0x1490,0x0AE0,0x14E0,0x0B30,0x1530, + 0x0B80,0x1580,0x0BD0,0x15D0,0x0C20,0x1620,0x0C70,0x1670, + 0x0CC0,0x16C0,0x0D10,0x1710,0x0D60,0x1760,0x0771,0x1171, + 0x07C1,0x11C1,0x0811,0x1211,0x0861,0x1261,0x08B1,0x12B1, + 0x0901,0x1301,0x0951,0x1351,0x09A1,0x13A1,0x09F1,0x13F1, + 0x0A41,0x1441,0x0A91,0x1491,0x0AE1,0x14E1,0x0B31,0x1531, + 0x0B81,0x1581,0x0BD1,0x15D1,0x0C21,0x1621,0x0C71,0x1671, + 0x0CC1,0x16C1,0x0D11,0x1711,0x0D61,0x1761,0x0772,0x1172, + 0x07C2,0x11C2,0x0812,0x1212,0x0862,0x1262,0x08B2,0x12B2, + 0x0902,0x1302,0x0952,0x1352,0x09A2,0x13A2,0x09F2,0x13F2, + 0x0A42,0x1442,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x1173,0x11C3,0x1213,0x1263,0x12B3,0x1303,0x1353,0x13A3, + 0x0773,0x07C3,0x0813,0x0863,0x08B3,0x0903,0x0953,0x09A3, + 0x13F3,0x1443,0x1493,0x14E3,0x1533,0x1583,0x0000,0x0000, + 0x09F3,0x0A43,0x0A93,0x0AE3,0x0B33,0x0B83,0x0000,0x0000, + 0x1713,0x1763,0x1174,0x11C4,0x1214,0x1264,0x12B4,0x1304, + 0x0D13,0x0D63,0x0774,0x07C4,0x0814,0x0864,0x08B4,0x0904, + 0x1354,0x13A4,0x13F4,0x1444,0x1494,0x14E4,0x1534,0x1584, + 0x0954,0x09A4,0x09F4,0x0A44,0x0A94,0x0AE4,0x0B34,0x0B84, + 0x15D4,0x1624,0x1674,0x16C4,0x1714,0x1764,0x0000,0x0000, + 0x0BD4,0x0C24,0x0C74,0x0CC4,0x0D14,0x0D64,0x0000,0x0000, + 0x12B5,0x1305,0x1355,0x13A5,0x13F5,0x1445,0x1495,0x14E5, + 0x0000,0x0905,0x0000,0x09A5,0x0000,0x0A45,0x0000,0x0AE5, + 0x1675,0x16C5,0x1715,0x1765,0x1176,0x11C6,0x1216,0x1266, + 0x0C75,0x0CC5,0x0D15,0x0D65,0x0776,0x07C6,0x0816,0x0866, + 0x12B6,0x1306,0x1356,0x13A6,0x13F6,0x1446,0x1496,0x14E6, + 0x1536,0x1586,0x15D6,0x1626,0x1676,0x16C6,0x0000,0x0000, + 0x1177,0x11C7,0x1217,0x1267,0x12B7,0x1307,0x1357,0x13A7, + 0x0777,0x07C7,0x0817,0x0867,0x08B7,0x0907,0x0957,0x09A7, + 0x13F7,0x1447,0x1497,0x14E7,0x1537,0x1587,0x15D7,0x1627, + 0x09F7,0x0A47,0x0A97,0x0AE7,0x0B37,0x0B87,0x0BD7,0x0C27, + 0x1677,0x16C7,0x1717,0x1767,0x1178,0x11C8,0x1218,0x1268, + 0x0C77,0x0CC7,0x0D17,0x0D67,0x0778,0x07C8,0x0818,0x0868, + 0x12B8,0x1308,0x1358,0x13A8,0x13F8,0x0000,0x1498,0x14E8, + 0x08B8,0x0908,0x08B6,0x0906,0x09A8,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x1538,0x1588,0x15D8,0x0000,0x1678,0x16C8, + 0x0956,0x09A6,0x09F6,0x0A46,0x0B88,0x0000,0x0000,0x0000, + 0x1718,0x1768,0x1179,0x11C9,0x0000,0x0000,0x12B9,0x1309, + 0x0D18,0x0D68,0x0A96,0x0AE6,0x0000,0x0000,0x0000,0x0000, + 0x13A9,0x13F9,0x1449,0x1499,0x14E9,0x1539,0x1589,0x15D9, + 0x09A9,0x09F9,0x0BD6,0x0C26,0x0B39,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x16C9,0x1719,0x0000,0x0000,0x11CA,0x121A, + 0x0B36,0x0B86,0x0C76,0x0CC6,0x0D19,0x0000,0x0000,0x0000 +}; + + +/* 2160-217F */ +static uint16 uni_2160_217F[32]= +{ + 0x0739,0x0789,0x07D9,0x0829,0x0879,0x08C9,0x0919,0x0969, + 0x09B9,0x0A09,0x0A59,0x0AA9,0x0AF9,0x0B49,0x0B99,0x0BE9, + 0x1139,0x1189,0x11D9,0x1229,0x1279,0x12C9,0x1319,0x1369, + 0x13B9,0x1409,0x1459,0x14A9,0x14F9,0x1549,0x1599,0x15E9 +}; + + +/* 24B0-24EF */ +static uint16 uni_24B0_24EF[64]= +{ + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0511,0x0512, + 0x0513,0x0514,0x0515,0x0516,0x0517,0x0518,0x0519,0x051A, + 0x051B,0x051C,0x051D,0x051E,0x051F,0x0520,0x0521,0x0522, + 0x0523,0x0524,0x0525,0x0526,0x0527,0x0528,0x0529,0x052A, + 0x0531,0x0532,0x0533,0x0534,0x0535,0x0536,0x0537,0x0538, + 0x0539,0x053A,0x053B,0x053C,0x053D,0x053E,0x053F,0x0540, + 0x0541,0x0542,0x0543,0x0544,0x0545,0x0546,0x0547,0x0548, + 0x0549,0x054A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 +}; + + +/* FF20-FF5F */ +static uint16 uni_FF20_FF5F[64]= +{ + 0x0000,0x0560,0x05B0,0x0600,0x0650,0x06A0,0x06F0,0x0740, + 0x0790,0x07E0,0x0830,0x0880,0x08D0,0x0920,0x0970,0x09C0, + 0x0A10,0x0A60,0x0AB0,0x0B00,0x0B50,0x0BA0,0x0BF0,0x0C40, + 0x0C90,0x0CE0,0x0D30,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0F60,0x0FB0,0x1000,0x1050,0x10A0,0x10F0,0x1140, + 0x1190,0x11E0,0x1230,0x1280,0x12D0,0x1320,0x1370,0x13C0, + 0x1410,0x1460,0x14B0,0x1500,0x1550,0x15A0,0x15F0,0x1640, + 0x1690,0x16E0,0x1730,0x0000,0x0000,0x0000,0x0000,0x0000 +}; + + + + + +/* + Returns + a number 0..15, if a valid HEX digit in lower case, + -1 otherwise. +*/ + +static int hexlo(int x) +{ + static char hex_lo_digit[256]= + { + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* ................ */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* ................ */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* !"#$%&'()*+,-./ */ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1, /* 0123456789:;<=>? */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* @ABCDEFGHIJKLMNO */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* PQRSTUVWXYZ[\]^_ */ + -1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* `abcdefghijklmno */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* pqrstuvwxyz{|}~. */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* ................ */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* ................ */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* ................ */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* ................ */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* ................ */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* ................ */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* ................ */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* ................ */ + }; + return hex_lo_digit[(unsigned int) x]; +} + + +/* + Safe characters: + '\0' NULL + A..Z capital letters, + a..z small letters + 0..9 digits + _ underscore +*/ +static char filename_safe_char[128]= +{ + 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* !"#$%&'()*+,-./ */ + 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789:;<=>? */ + 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* @ABCDEFGHIJKLMNO */ + 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ[\]^_ */ + 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* `abcdefghijklmno */ + 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz{|}~. */ +}; + +#define MY_FILENAME_ESCAPE '@' + +static int +my_mb_wc_filename(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *pwc, const uchar *s, const uchar *e) +{ + int byte1, byte2; + if (s >= e) + return MY_CS_TOOSMALL; + + if (*s < 128 && filename_safe_char[*s]) + { + *pwc= *s; + return 1; + } + + if (*s != MY_FILENAME_ESCAPE) + return MY_CS_ILSEQ; + + if (s + 3 > e) + return MY_CS_TOOSMALL3; + + byte1= s[1]; + byte2= s[2]; + + if (byte1 >= 0x30 && byte1 <= 0x7F && + byte2 >= 0x30 && byte2 <= 0x7F) + { + int code= (byte1 - 0x30) * 80 + byte2 - 0x30; + if (code < 5994 && touni[code]) + { + *pwc= touni[code]; + return 3; + } + if (byte1 == '@' && byte2 == '@') + { + *pwc= 0; + return 3; + } + } + + if (s + 4 > e) + return MY_CS_TOOSMALL4; + + if ((byte1= hexlo(byte1)) >= 0 && + (byte2= hexlo(byte2)) >= 0) + { + int byte3= hexlo(s[3]); + int byte4= hexlo(s[4]); + if (byte3 >=0 && byte4 >=0) + { + *pwc= (byte1 << 12) + (byte2 << 8) + (byte3 << 4) + byte4; + return 5; + } + } + + return MY_CS_ILSEQ; +} + + +static int +my_wc_mb_filename(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *s, uchar *e) +{ + int code; + char hex[]= "0123456789abcdef"; + if (wc < 128 && filename_safe_char[wc]) + { + *s= (uchar) wc; + return 1; + } + + if (s + 3 > e) + return MY_CS_TOOSMALL3; + + *s++= MY_FILENAME_ESCAPE; + if ((wc >= 0x00C0 && wc <= 0x05FF && (code= uni_0C00_05FF[wc - 0x00C0])) || + (wc >= 0x1E00 && wc <= 0x1FFF && (code= uni_1E00_1FFF[wc - 0x1E00])) || + (wc >= 0x2160 && wc <= 0x217F && (code= uni_2160_217F[wc - 0x2160])) || + (wc >= 0x24B0 && wc <= 0x24EF && (code= uni_24B0_24EF[wc - 0x24B0])) || + (wc >= 0xFF20 && wc <= 0xFF5F && (code= uni_FF20_FF5F[wc - 0xFF20]))) + { + *s++= (code / 80) + 0x30; + *s++= (code % 80) + 0x30; + return 3; + } + + /* Non letter */ + if (s + 5 > e) + return MY_CS_TOOSMALL5; + + *s++= hex[(wc >> 12) & 15]; + *s++= hex[(wc >> 8) & 15]; + *s++= hex[(wc >> 4) & 15]; + *s++= hex[(wc) & 15]; + return 5; +} + + +static MY_COLLATION_HANDLER my_collation_filename_handler = +{ + NULL, /* init */ + my_strnncoll_utf8, + my_strnncollsp_utf8, + my_strnxfrm_utf8, + my_strnxfrmlen_utf8, + my_like_range_mb, + my_wildcmp_utf8, + my_strcasecmp_utf8, + my_instr_mb, + my_hash_sort_utf8, + my_propagate_complex +}; + +static MY_CHARSET_HANDLER my_charset_filename_handler= +{ + NULL, /* init */ + my_ismbchar_utf8, + my_mbcharlen_utf8, + my_numchars_mb, + my_charpos_mb, + my_well_formed_len_mb, + my_lengthsp_8bit, + my_numcells_mb, + my_mb_wc_filename, + my_wc_mb_filename, + my_mb_ctype_mb, + my_caseup_str_utf8, + my_casedn_str_utf8, + my_caseup_utf8, + my_casedn_utf8, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + + + +CHARSET_INFO my_charset_filename= +{ + 17,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_HIDDEN, + "filename", /* cs name */ + "filename", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_utf8, /* ctype */ + to_lower_utf8, /* to_lower */ + to_upper_utf8, /* to_upper */ + to_upper_utf8, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 5, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + &my_charset_filename_handler, + &my_collation_filename_handler +}; + #ifdef MY_TEST_UTF8 #include <stdio.h> @@ -2937,7 +4240,7 @@ static void test_mb(CHARSET_INFO *cs, uchar *s) { if (my_ismbhead_utf8(cs,*s)) { - int len=my_mbcharlen_utf8(cs,*s); + uint len=my_mbcharlen_utf8(cs,*s); while(len--) { printf("%c",*s); diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index d5be20f7b1b..ebcf42408d8 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2003 MySQL AB +/* Copyright (c) 2002-2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* Shared, independent copyright: (C) 2001 Jan Pazdziora. @@ -400,7 +402,7 @@ static uchar NEAR _sort_order_win1250ch2[] = { }; struct wordvalue { - const uchar * word; + const uchar *word; uchar pass1; uchar pass2; }; @@ -423,8 +425,8 @@ static struct wordvalue doubles[] = { if (value == 0xff) { \ int i; \ for (i = 0; i < (int) sizeof(doubles); i++) { \ - const uchar * patt = doubles[i].word; \ - const uchar * q = (const uchar *) p; \ + const uchar *patt = doubles[i].word; \ + const uchar *q = (const uchar *) p; \ while (*patt \ && !(IS_END(q, src, len)) \ && (*patt == *q)) { \ @@ -446,12 +448,12 @@ static struct wordvalue doubles[] = { #define IS_END(p, src, len) (((char *)p - (char *)src) >= (len)) static int my_strnncoll_win1250ch(CHARSET_INFO *cs __attribute__((unused)), - const uchar * s1, uint len1, - const uchar * s2, uint len2, + const uchar *s1, size_t len1, + const uchar *s2, size_t len2, my_bool s2_is_prefix) { int v1, v2; - const uchar * p1, * p2; + const uchar *p1, * p2; int pass1 = 0, pass2 = 0; int diff; @@ -477,8 +479,8 @@ static int my_strnncoll_win1250ch(CHARSET_INFO *cs __attribute__((unused)), static int my_strnncollsp_win1250ch(CHARSET_INFO * cs, - const uchar *s, uint slen, - const uchar *t, uint tlen, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, my_bool diff_if_only_endspace_difference __attribute__((unused))) { @@ -488,14 +490,14 @@ int my_strnncollsp_win1250ch(CHARSET_INFO * cs, } -static int my_strnxfrm_win1250ch(CHARSET_INFO * cs __attribute__((unused)), - uchar * dest, uint len, - const uchar * src, uint srclen) +static size_t my_strnxfrm_win1250ch(CHARSET_INFO * cs __attribute__((unused)), + uchar *dest, size_t len, + const uchar *src, size_t srclen) { int value; - const uchar * p; + const uchar *p; int pass = 0; - uint totlen = 0; + size_t totlen = 0; p = src; do { @@ -615,11 +617,11 @@ static uchar NEAR like_range_prefix_max_win1250ch[]= static my_bool my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr, uint ptr_length, + const char *ptr, size_t ptr_length, pbool escape, pbool w_one, pbool w_many, - uint res_length, + size_t res_length, char *min_str, char *max_str, - uint *min_length, uint *max_length) + size_t *min_length, size_t *max_length) { int only_min_found= 1; @@ -643,7 +645,7 @@ my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)), } if (cs->state & MY_CS_BINSORT) - *min_length= (uint) (min_str - min_org); + *min_length= (size_t) (min_str - min_org); else { /* 'a\0\0... is the smallest possible string */ diff --git a/strings/ctype.c b/strings/ctype.c index 0e7ed57eb87..8786eb3e889 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -12,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include <my_global.h> #include <m_ctype.h> @@ -40,7 +41,7 @@ */ -static char *mstr(char *str,const char *src,uint l1,uint l2) +static char *mstr(char *str,const char *src,size_t l1,size_t l2) { l1= l1<l2 ? l1 : l2; memcpy(str,src,l1); @@ -80,39 +81,39 @@ struct my_cs_file_section_st static struct my_cs_file_section_st sec[] = { {_CS_MISC, "xml"}, - {_CS_MISC, "xml.version"}, - {_CS_MISC, "xml.encoding"}, + {_CS_MISC, "xml/version"}, + {_CS_MISC, "xml/encoding"}, {_CS_MISC, "charsets"}, - {_CS_MISC, "charsets.max-id"}, - {_CS_CHARSET, "charsets.charset"}, - {_CS_PRIMARY_ID, "charsets.charset.primary-id"}, - {_CS_BINARY_ID, "charsets.charset.binary-id"}, - {_CS_CSNAME, "charsets.charset.name"}, - {_CS_FAMILY, "charsets.charset.family"}, - {_CS_CSDESCRIPT, "charsets.charset.description"}, - {_CS_MISC, "charsets.charset.alias"}, - {_CS_MISC, "charsets.charset.ctype"}, - {_CS_CTYPEMAP, "charsets.charset.ctype.map"}, - {_CS_MISC, "charsets.charset.upper"}, - {_CS_UPPERMAP, "charsets.charset.upper.map"}, - {_CS_MISC, "charsets.charset.lower"}, - {_CS_LOWERMAP, "charsets.charset.lower.map"}, - {_CS_MISC, "charsets.charset.unicode"}, - {_CS_UNIMAP, "charsets.charset.unicode.map"}, - {_CS_COLLATION, "charsets.charset.collation"}, - {_CS_COLNAME, "charsets.charset.collation.name"}, - {_CS_ID, "charsets.charset.collation.id"}, - {_CS_ORDER, "charsets.charset.collation.order"}, - {_CS_FLAG, "charsets.charset.collation.flag"}, - {_CS_COLLMAP, "charsets.charset.collation.map"}, - {_CS_RESET, "charsets.charset.collation.rules.reset"}, - {_CS_DIFF1, "charsets.charset.collation.rules.p"}, - {_CS_DIFF2, "charsets.charset.collation.rules.s"}, - {_CS_DIFF3, "charsets.charset.collation.rules.t"}, + {_CS_MISC, "charsets/max-id"}, + {_CS_CHARSET, "charsets/charset"}, + {_CS_PRIMARY_ID, "charsets/charset/primary-id"}, + {_CS_BINARY_ID, "charsets/charset/binary-id"}, + {_CS_CSNAME, "charsets/charset/name"}, + {_CS_FAMILY, "charsets/charset/family"}, + {_CS_CSDESCRIPT, "charsets/charset/description"}, + {_CS_MISC, "charsets/charset/alias"}, + {_CS_MISC, "charsets/charset/ctype"}, + {_CS_CTYPEMAP, "charsets/charset/ctype/map"}, + {_CS_MISC, "charsets/charset/upper"}, + {_CS_UPPERMAP, "charsets/charset/upper/map"}, + {_CS_MISC, "charsets/charset/lower"}, + {_CS_LOWERMAP, "charsets/charset/lower/map"}, + {_CS_MISC, "charsets/charset/unicode"}, + {_CS_UNIMAP, "charsets/charset/unicode/map"}, + {_CS_COLLATION, "charsets/charset/collation"}, + {_CS_COLNAME, "charsets/charset/collation/name"}, + {_CS_ID, "charsets/charset/collation/id"}, + {_CS_ORDER, "charsets/charset/collation/order"}, + {_CS_FLAG, "charsets/charset/collation/flag"}, + {_CS_COLLMAP, "charsets/charset/collation/map"}, + {_CS_RESET, "charsets/charset/collation/rules/reset"}, + {_CS_DIFF1, "charsets/charset/collation/rules/p"}, + {_CS_DIFF2, "charsets/charset/collation/rules/s"}, + {_CS_DIFF3, "charsets/charset/collation/rules/t"}, {0, NULL} }; -static struct my_cs_file_section_st * cs_file_sec(const char *attr, uint len) +static struct my_cs_file_section_st * cs_file_sec(const char *attr, size_t len) { struct my_cs_file_section_st *s; for (s=sec; s->str; s++) @@ -144,7 +145,7 @@ typedef struct my_cs_file_info -static int fill_uchar(uchar *a,uint size,const char *str, uint len) +static int fill_uchar(uchar *a,uint size,const char *str, size_t len) { uint i= 0; const char *s, *b, *e=str+len; @@ -161,7 +162,7 @@ static int fill_uchar(uchar *a,uint size,const char *str, uint len) return 0; } -static int fill_uint16(uint16 *a,uint size,const char *str, uint len) +static int fill_uint16(uint16 *a,uint size,const char *str, size_t len) { uint i= 0; @@ -179,7 +180,7 @@ static int fill_uint16(uint16 *a,uint size,const char *str, uint len) } -static int cs_enter(MY_XML_PARSER *st,const char *attr, uint len) +static int cs_enter(MY_XML_PARSER *st,const char *attr, size_t len) { struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; struct my_cs_file_section_st *s= cs_file_sec(attr,len); @@ -194,7 +195,7 @@ static int cs_enter(MY_XML_PARSER *st,const char *attr, uint len) } -static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len) +static int cs_leave(MY_XML_PARSER *st,const char *attr, size_t len) { struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; struct my_cs_file_section_st *s= cs_file_sec(attr,len); @@ -212,11 +213,12 @@ static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len) } -static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) +static int cs_value(MY_XML_PARSER *st,const char *attr, size_t len) { struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; struct my_cs_file_section_st *s; - int state= (int)((s=cs_file_sec(st->attr, (int) strlen(st->attr))) ? s->state : 0); + int state= (int)((s=cs_file_sec(st->attr, strlen(st->attr))) ? s->state : + 0); switch (state) { case _CS_ID: @@ -290,8 +292,8 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) } -my_bool my_parse_charset_xml(const char *buf, uint len, - int (*add_collation)(CHARSET_INFO *cs)) +my_bool my_parse_charset_xml(const char *buf, size_t len, + int (*add_collation)(CHARSET_INFO *cs)) { MY_XML_PARSER p; struct my_cs_file_info i; @@ -328,9 +330,8 @@ my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong length) { my_wc_t wc; int chlen; - for (; (chlen= cs->cset->mb_wc(cs, &wc, - (const unsigned char *) str, - (const unsigned char *) strend)) > 0; + for (; + (chlen= cs->cset->mb_wc(cs, &wc, (uchar*) str, (uchar*) strend)) > 0; str+= chlen) { if (wc > 0x7F) diff --git a/strings/decimal.c b/strings/decimal.c index 1498aec15a1..944954f00f5 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1,5 +1,4 @@ -/* Copyright (c) 2004-2008 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. +/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +11,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #line 18 "decimal.c" @@ -972,7 +972,7 @@ int decimal2double(decimal_t *from, double *to) *to= from->sign ? -result : result; - DBUG_PRINT("info", ("result: %f (%lx)", *to, *(ulong *)to)); + DBUG_PRINT("info", ("result: %f", *to)); return E_DEC_OK; } @@ -992,12 +992,18 @@ int decimal2double(decimal_t *from, double *to) int double2decimal(double from, decimal_t *to) { /* TODO: fix it, when we'll have dtoa */ - char s[400], *end; - sprintf(s, "%.16G", from); - end= strend(s); - return string2decimal(s, to, &end); + char buff[400], *end; + int length, res; + DBUG_ENTER("double2decimal"); + length= sprintf(buff, "%.16G", from); + DBUG_PRINT("info",("from: %g from_as_str: %s", from, buff)); + end= buff+length; + res= string2decimal(buff, to, &end); + DBUG_PRINT("exit", ("res: %d", res)); + DBUG_RETURN(res); } + static int ull2dec(ulonglong from, decimal_t *to) { int intg1, error=E_DEC_OK; @@ -1185,7 +1191,7 @@ int decimal2longlong(decimal_t *from, longlong *to) 7E F2 04 37 2D FB 2D */ -int decimal2bin(decimal_t *from, char *to, int precision, int frac) +int decimal2bin(decimal_t *from, uchar *to, int precision, int frac) { dec1 mask=from->sign ? -1 : 0, *buf1=from->buf, *stop1; int error=E_DEC_OK, intg=precision-frac, @@ -1201,7 +1207,7 @@ int decimal2bin(decimal_t *from, char *to, int precision, int frac) fsize1=frac1*sizeof(dec1)+dig2bytes[frac1x]; const int orig_isize0= isize0; const int orig_fsize0= fsize0; - char *orig_to= to; + uchar *orig_to= to; buf1= remove_leading_zeroes(from, &from_intg); @@ -1291,10 +1297,10 @@ int decimal2bin(decimal_t *from, char *to, int precision, int frac) } if (fsize0 > fsize1) { - char *to_end= orig_to + orig_fsize0 + orig_isize0; + uchar *to_end= orig_to + orig_fsize0 + orig_isize0; while (fsize0-- > fsize1 && to < to_end) - *to++=(uchar)mask; + *to++= (uchar)mask; } orig_to[0]^= 0x80; @@ -1320,19 +1326,19 @@ int decimal2bin(decimal_t *from, char *to, int precision, int frac) E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW */ -int bin2decimal(char *from, decimal_t *to, int precision, int scale) +int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale) { int error=E_DEC_OK, intg=precision-scale, intg0=intg/DIG_PER_DEC1, frac0=scale/DIG_PER_DEC1, intg0x=intg-intg0*DIG_PER_DEC1, frac0x=scale-frac0*DIG_PER_DEC1, intg1=intg0+(intg0x>0), frac1=frac0+(frac0x>0); dec1 *buf=to->buf, mask=(*from & 0x80) ? 0 : -1; - char *stop; - char *d_copy; + const uchar *stop; + uchar *d_copy; int bin_size= decimal_bin_size(precision, scale); sanity(to); - d_copy= (char *)my_alloca(bin_size); + d_copy= (uchar*) my_alloca(bin_size); memcpy(d_copy, from, bin_size); d_copy[0]^= 0x80; from= d_copy; @@ -1929,8 +1935,7 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to) int decimal_intg(decimal_t *from) { int res; - dec1 *tmp_res; - tmp_res= remove_leading_zeroes(from, &res); + remove_leading_zeroes(from, &res); return res; } diff --git a/strings/do_ctype.c b/strings/do_ctype.c index b8eca68debf..fed00c82624 100644 --- a/strings/do_ctype.c +++ b/strings/do_ctype.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000-2002, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* Prints case-convert and sort-convert tabell on stdout. This is used to make _ctype.c easyer */ @@ -141,22 +143,22 @@ void init_case_convert() #endif #ifdef MSDOS - higher_pos= (uchar * ) "\217\216\231\232\220"; /* Extra chars to konv. */ - lower_pos= (uchar * ) "\206\204\224\201\202"; + higher_pos= (uchar *) "\217\216\231\232\220"; /* Extra chars to konv. */ + lower_pos= (uchar *) "\206\204\224\201\202"; #else #if defined(HPUX10) && ASCII_BITS_USED == 8 - higher_pos= (uchar * ) "\xd0\xd8\xda\xdb\xdc\xd3"; - lower_pos= (uchar * ) "\xd4\xcc\xce\xdf\xc9\xd7"; + higher_pos= (uchar *) "\xd0\xd8\xda\xdb\xdc\xd3"; + lower_pos= (uchar *) "\xd4\xcc\xce\xdf\xc9\xd7"; #else #ifdef USE_INTERNAL_CTYPE higher_pos=lower_pos= (uchar* ) ""; /* System converts chars */ #else #if defined(DEC_MULTINATIONAL_CHAR) || defined(HP_MULTINATIONAL_CHAR) - higher_pos= (uchar * ) "\305\304\326\311\334"; - lower_pos= (uchar * ) "\345\344\366\351\374"; + higher_pos= (uchar *) "\305\304\326\311\334"; + lower_pos= (uchar *) "\345\344\366\351\374"; #else - higher_pos= (uchar * ) "[]\\@^"; - lower_pos= (uchar * ) "{}|`~"; + higher_pos= (uchar *) "[]\\@^"; + lower_pos= (uchar *) "{}|`~"; #endif #endif /* USE_INTERNAL_CTYPE */ #endif /* HPUX10 */ diff --git a/strings/dump_map.c b/strings/dump_map.c index e2b8b7db077..e40edd9f142 100644 --- a/strings/dump_map.c +++ b/strings/dump_map.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2003-2004 MySQL AB +/* Copyright (c) 2003, 2004, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include <stdio.h> #include <string.h> diff --git a/strings/int2str.c b/strings/int2str.c index fba98aac3f1..8f039d1d5cd 100644 --- a/strings/int2str.c +++ b/strings/int2str.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2004, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include <my_global.h> #include "m_string.h" diff --git a/strings/is_prefix.c b/strings/is_prefix.c index 451cd468b7e..e3cff258a24 100644 --- a/strings/is_prefix.c +++ b/strings/is_prefix.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : is_prefix.c Author : Michael Widenius diff --git a/strings/llstr.c b/strings/llstr.c index 643cf36a311..0734137f3c4 100644 --- a/strings/llstr.c +++ b/strings/llstr.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2004, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* Defines: llstr(); diff --git a/strings/longlong2str.c b/strings/longlong2str.c index d7de5bb0f7c..10e9dc568f8 100644 --- a/strings/longlong2str.c +++ b/strings/longlong2str.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2004, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* Defines: longlong2str(); diff --git a/strings/longlong2str_asm.c b/strings/longlong2str_asm.c index 637815e52c5..a6a64d7d249 100644 --- a/strings/longlong2str_asm.c +++ b/strings/longlong2str_asm.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2005, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* Wrapper for longlong2str.s diff --git a/strings/make-ccc b/strings/make-ccc index 78d5ad1ce42..93be2bbf862 100755 --- a/strings/make-ccc +++ b/strings/make-ccc @@ -1,3 +1,3 @@ -ccc -DHAVE_CONFIG_H -I. -I. -I.. -I./../include -I../include -O -DDBUG_OFF -fast -O3 -fomit-frame-pointer -c atof.c bchange.c bcmp.c bfill.c bmove.c bmove512.c bmove_upp.c ct_init.c ctype-latin1.c int2str.c is_prefix.c llstr.c longlong2str.c r_strinstr.c str2int.c strappend.c strcend.c strcont.c strend.c strfill.c strinstr.c strmake.c strmov.c strnmov.c strstr.c strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c +ccc -DHAVE_CONFIG_H -I. -I. -I.. -I./../include -I../include -O -DDBUG_OFF -fast -O3 -fomit-frame-pointer -c atof.c bchange.c bfill.c bmove.c bmove512.c bmove_upp.c ct_init.c ctype-latin1.c int2str.c is_prefix.c llstr.c longlong2str.c r_strinstr.c str2int.c strappend.c strcend.c strcont.c strend.c strfill.c strinstr.c strmake.c strmov.c strnmov.c strstr.c strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c rm libmystrings.a ar -cr libmystrings.a atof.o diff --git a/strings/memcmp.c b/strings/memcmp.c index 9471353f751..ca9b680c293 100644 --- a/strings/memcmp.c +++ b/strings/memcmp.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* memcmp(lhs, rhs, len) compares the two memory areas lhs[0..len-1] ?? rhs[0..len-1]. It diff --git a/strings/memcpy.c b/strings/memcpy.c index f32d346e3ec..e60c9213717 100644 --- a/strings/memcpy.c +++ b/strings/memcpy.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* memcpy(dst, src, len) diff --git a/strings/memset.c b/strings/memset.c index e07dc4ead85..32482d66b29 100644 --- a/strings/memset.c +++ b/strings/memset.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : memset.c Author : Richard A. O'Keefe. diff --git a/strings/my_strchr.c b/strings/my_strchr.c new file mode 100644 index 00000000000..f68842d4f39 --- /dev/null +++ b/strings/my_strchr.c @@ -0,0 +1,105 @@ +/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include <my_global.h> +#include "m_string.h" +#include "m_ctype.h" + +#define NEQ(A, B) ((A) != (B)) +#define EQU(A, B) ((A) == (B)) + +/** + Macro for the body of the string scanning. + + @param CS The character set of the string + @param STR Pointer to beginning of string + @param END Pointer to one-after-end of string + @param ACC Pointer to beginning of accept (or reject) string + @param LEN Length of accept (or reject) string + @param CMP is a function-like for doing the comparison of two characters. + */ + +#define SCAN_STRING(CS, STR, END, ACC, LEN, CMP) \ + do { \ + uint mbl; \ + const char *ptr_str, *ptr_acc; \ + const char *acc_end= (ACC) + (LEN); \ + for (ptr_str= (STR) ; ptr_str < (END) ; ptr_str+= mbl) \ + { \ + mbl= my_mbcharlen((CS), *(uchar*)ptr_str); \ + if (mbl < 2) \ + { \ + DBUG_ASSERT(mbl == 1); \ + for (ptr_acc= (ACC) ; ptr_acc < acc_end ; ++ptr_acc) \ + if (CMP(*ptr_acc, *ptr_str)) \ + goto end; \ + } \ + } \ +end: \ + return (size_t) (ptr_str - (STR)); \ + } while (0) + + +/* + my_strchr(cs, str, end, c) returns a pointer to the first place in + str where c (1-byte character) occurs, or NULL if c does not occur + in str. This function is multi-byte safe. + TODO: should be moved to CHARSET_INFO if it's going to be called + frequently. +*/ + +char *my_strchr(CHARSET_INFO *cs, const char *str, const char *end, + pchar c) +{ + uint mbl; + while (str < end) + { + mbl= my_mbcharlen(cs, *(uchar *)str); + if (mbl < 2) + { + if (*str == c) + return((char *)str); + str++; + } + else + str+= mbl; + } + return(0); +} + +/** + Calculate the length of the initial segment of 'str' which consists + entirely of characters not in 'reject'. + + @note The reject string points to single-byte characters so it is + only possible to find the first occurrence of a single-byte + character. Multi-byte characters in 'str' are treated as not + matching any character in the reject string. + + @todo should be moved to CHARSET_INFO if it's going to be called + frequently. + + @internal The implementation builds on the assumption that 'str' is long, + while 'reject' is short. So it compares each character in string + with the characters in 'reject' in a tight loop over the characters + in 'reject'. +*/ + +size_t my_strcspn(CHARSET_INFO *cs, const char *str, const char *str_end, + const char *reject) +{ + SCAN_STRING(cs, str, str_end, reject, strlen(reject), EQU); +} diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c index 165d3e38095..7309a2ed20d 100644 --- a/strings/my_strtoll10.c +++ b/strings/my_strtoll10.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2003 MySQL AB +/* Copyright (c) 2003-2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include <my_global.h> #include <my_sys.h> /* Needed for MY_ERRNO_ERANGE */ @@ -86,7 +88,7 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error) { const char *s, *end, *start, *n_end, *true_end; char *dummy; - unsigned char c; + uchar c; unsigned long i, j, k; ulonglong li; int negative; diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 32908a7d155..971f8f2d794 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc. +/* Copyright (c) 2000-2007 MySQL AB, 2009 Sun Microsystems, Inc. Use is subject to license terms. This program is free software; you can redistribute it and/or modify @@ -12,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include <my_global.h> #include <m_string.h> @@ -41,10 +42,11 @@ length of result string */ -int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) +size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) { char *start=to, *end=to+n-1; - uint length, width, pre_zero, have_long; + size_t length, width; + uint pre_zero, have_long; for (; *fmt ; fmt++) { @@ -59,7 +61,8 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) /* Read max fill size (only used with %d and %u) */ if (*fmt == '-') fmt++; - length= width= pre_zero= have_long= 0; + length= width= 0; + pre_zero= have_long= 0; if (*fmt == '*') { fmt++; @@ -94,10 +97,9 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) if (*fmt == 's') /* String parameter */ { reg2 char *par = va_arg(ap, char *); - uint plen,left_len = (uint)(end-to)+1; + size_t plen,left_len = (size_t) (end - to) + 1; if (!par) par = (char*)"(null)"; - plen = (uint) strlen(par); - set_if_smaller(plen,width); + plen= (uint) strnlen(par, width); if (left_len <= plen) plen = left_len - 1; to=strnmov(to,par,plen); @@ -116,11 +118,11 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) else if (*fmt == 'd' || *fmt == 'u'|| *fmt== 'x') /* Integer parameter */ { register long larg; - uint res_length, to_length; + size_t res_length, to_length; char *store_start= to, *store_end; char buff[32]; - if ((to_length= (uint) (end-to)) < 16 || length) + if ((to_length= (size_t) (end-to)) < 16 || length) store_start= buff; if (have_long) larg = va_arg(ap, long); @@ -136,7 +138,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) store_end= int10_to_str(larg, store_start, 10); else store_end= int2str(larg, store_start, 16, 0); - if ((res_length= (uint) (store_end - store_start)) > to_length) + if ((res_length= (size_t) (store_end - store_start)) > to_length) break; /* num doesn't fit in output */ /* If %#d syntax was used, we have to pre-zero/pre-space the string */ if (store_start == buff) @@ -144,7 +146,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) length= min(length, to_length); if (res_length < length) { - uint diff= (length- res_length); + size_t diff= (length- res_length); bfill(to, diff, pre_zero ? '0' : ' '); to+= diff; } @@ -170,12 +172,13 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) } DBUG_ASSERT(to <= end); *to='\0'; /* End of errmessage */ - return (uint) (to - start); + return (size_t) (to - start); } -int my_snprintf(char* to, size_t n, const char* fmt, ...) + +size_t my_snprintf(char* to, size_t n, const char* fmt, ...) { - int result; + size_t result; va_list args; va_start(args,fmt); result= my_vsnprintf(to, n, fmt, args); diff --git a/strings/r_strinstr.c b/strings/r_strinstr.c index 98118015456..3d97fe3959c 100644 --- a/strings/r_strinstr.c +++ b/strings/r_strinstr.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2004, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* Author : David @@ -25,14 +27,14 @@ #include <my_global.h> #include "m_string.h" -uint r_strinstr(reg1 my_string str,int from, reg4 my_string search) +size_t r_strinstr(reg1 const char * str, size_t from, reg4 const char * search) { - reg2 my_string i, j; - uint len = (uint) strlen(search); + reg2 const char *i, *j; + size_t len = strlen(search); /* pointer to the last char of buff */ - my_string start = str + from - 1; + const char * start = str + from - 1; /* pointer to the last char of search */ - my_string search_end = search + len - 1; + const char * search_end = search + len - 1; skip: while (start >= str) /* Cant be != because the first char */ @@ -43,7 +45,7 @@ uint r_strinstr(reg1 my_string str,int from, reg4 my_string search) while (j >= search && start > str) if (*i-- != *j--) goto skip; - return (uint) ((start - len) - str + 3); + return (size_t) ((start - len) - str + 3); } } return (0); diff --git a/strings/str2int.c b/strings/str2int.c index c4a4c07eeff..925880fd83e 100644 --- a/strings/str2int.c +++ b/strings/str2int.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000-2003, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* str2int(src, radix, lower, upper, &val) diff --git a/strings/str_alloc.c b/strings/str_alloc.c index 615ad1ba1e2..9e870950c27 100644 --- a/strings/str_alloc.c +++ b/strings/str_alloc.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2005, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include <my_global.h> #include <m_string.h> diff --git a/strings/str_test.c b/strings/str_test.c index 7863dce8688..b29fd4ab0ce 100644 --- a/strings/str_test.c +++ b/strings/str_test.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* Test of all stringfunktions that is coded in assembler */ @@ -29,12 +30,12 @@ #define T_PREFILL '1' static char from_buff[100],to_buff[100]; -static my_string from,to; +static char * from, *to; static int errors,tests; static int test_strarg(const char *name,...); static void init_strings (void); /* Init from and to */ void test_arg (const char *message,long func_value,long value); -int compare_buff(const char *message,my_string b1,my_string b2,int length, +int compare_buff(const char *message,char * b1,char * b2,int length, pchar fill, pchar prefill); static int my_test(int a) @@ -50,10 +51,10 @@ int main(void) errors=tests=0; init_strings(); - test_arg("bcmp(from,to,5)",(long) my_test(bcmp(from,to,5)),1L); - test_arg("bcmp(from,from,5)",(long) bcmp(from,from,5),0L); + test_arg("memcmp(from,to,5)",(long) my_test(memcmp(from,to,5)),1L); + test_arg("memcmp(from,from,5)",(long) memcmp(from,from,5),0L); - test_arg("bcmp(from,to,0)",(long) bcmp(from,to,0),0L); + test_arg("memcmp(from,to,0)",(long) memcmp(from,to,0),0L); test_arg("strend(from)",(long) strend(from),(long) from+F_LEN); test_arg("strchr(v1,'M')",(long) strchr(v1,'M'),(long) v1); test_arg("strchr(v1,'y')",(long) strchr(v1,'y'),(long) v1+4); @@ -93,7 +94,7 @@ int main(void) test_strarg("bmove_upp(to+6,from+6,3)",(bmove_upp(to+6,from+6,3),0L),INT_MAX32, 3,T_CHAR,3,F_CHAR,0,0); test_strarg("bmove_upp(to,from,0)",(bmove_upp(to,from,0),0L),INT_MAX32,0,0); - test_strarg("bmove_align(to,from,8)",(bmove_align(to,from,8),0L),INT_MAX32, + test_strarg("memcpy(to,from,8)",(memcpy(to,from,8),0L),INT_MAX32, 8,F_CHAR,0,0); test_strarg("strappend(to,3,' ')",(strappend(to,3,' '),0L),INT_MAX32, 3,T_CHAR,1,0,T_LEN-4,T_CHAR,1,0,0,0); @@ -228,12 +229,12 @@ static int test_strarg(const char *message,...) /* test if function made right value */ -int compare_buff(const char *message, my_string b1, my_string b2, int length, +int compare_buff(const char *message, char * b1, char * b2, int length, pchar fill, pchar prefill) { int i,error=0; - if (bcmp(b1,b2,length)) + if (memcmp(b1,b2,length)) { errors++; printf("func: '%s' Buffers differ\nIs: ",message); diff --git a/strings/strappend.c b/strings/strappend.c index 3a5da658709..980cc26af74 100644 --- a/strings/strappend.c +++ b/strings/strappend.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : strappend.c Author : Monty @@ -27,7 +29,7 @@ #include "m_string.h" -void strappend(register char *s, uint len, pchar fill) +void strappend(register char *s, size_t len, pchar fill) { register char *endpos; diff --git a/strings/strcat.c b/strings/strcat.c index e69369c357f..d6ab72bebbd 100644 --- a/strings/strcat.c +++ b/strings/strcat.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : strcat.c Author : Richard A. O'Keefe. diff --git a/strings/strcend.c b/strings/strcend.c index 56e31d5f994..0ff48223500 100644 --- a/strings/strcend.c +++ b/strings/strcend.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : strcend.c Author : Michael Widenius: ifdef MC68000 diff --git a/strings/strchr.c b/strings/strchr.c index 5ffe386c718..0c972e25a9e 100644 --- a/strings/strchr.c +++ b/strings/strchr.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : strchr.c Author : Richard A. O'Keefe. diff --git a/strings/strcmp.c b/strings/strcmp.c index 54bbe92279b..78656633ce1 100644 --- a/strings/strcmp.c +++ b/strings/strcmp.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : strcmp.c Author : Richard A. O'Keefe. diff --git a/strings/strcont.c b/strings/strcont.c index d57af77804d..71755ca4f9a 100644 --- a/strings/strcont.c +++ b/strings/strcont.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : strcont.c Author : Monty @@ -27,9 +29,9 @@ #include <my_global.h> #include "m_string.h" -my_string strcont(reg1 const char *str,reg2 const char *set) +char * strcont(reg1 const char *str,reg2 const char *set) { - reg3 my_string start = (my_string) set; + reg3 char * start = (char *) set; while (*str) { diff --git a/strings/strend.c b/strings/strend.c index 4dadf0675dc..89178d2a662 100644 --- a/strings/strend.c +++ b/strings/strend.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2002 MySQL AB +/* Copyright (c) 2000-2002, 2006 MySQL AB + Use is subject to license terms. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -12,8 +13,9 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ + Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA +*/ /* File : strend.c Author : Richard A. O'Keefe. diff --git a/strings/strfill.c b/strings/strfill.c index 7d3f25e3ff4..16fad9f3670 100644 --- a/strings/strfill.c +++ b/strings/strfill.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : strfill.c Author : Monty @@ -26,7 +28,7 @@ #include <my_global.h> #include "m_string.h" -my_string strfill(my_string s,uint len,pchar fill) +char * strfill(char *s, size_t len, pchar fill) { while (len--) *s++ = fill; *(s) = '\0'; diff --git a/strings/strinstr.c b/strings/strinstr.c index 10f83a54c29..c95dfe9d711 100644 --- a/strings/strinstr.c +++ b/strings/strinstr.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2004, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : strinstr.c Author : Monty & David @@ -28,20 +30,20 @@ #include <my_global.h> #include "m_string.h" -uint strinstr(reg1 const char *str,reg4 const char *search) +size_t strinstr(reg1 const char *str,reg4 const char *search) { - reg2 my_string i,j; - my_string start = (my_string) str; + reg2 const char *i, *j; + const char *start= str; skip: while (*str != '\0') { if (*str++ == *search) { - i=(my_string) str; j= (my_string) search+1; + i= str; j= search+1; while (*j) if (*i++ != *j++) goto skip; - return ((uint) (str - start)); + return ((size_t) (str - start)); } } return (0); diff --git a/strings/strlen.c b/strings/strlen.c index b3c901739b1..3dc514d631d 100644 --- a/strings/strlen.c +++ b/strings/strlen.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : strlen.c Author : Richard A. O'Keefe. / Monty @@ -31,7 +33,7 @@ #if VaxAsm -size_s strlen(char *s) +size_t strlen(char *s) { asm("locc $0,$65535,*4(ap)"); asm("subl3 r0,$65535,r0"); @@ -40,7 +42,7 @@ size_s strlen(char *s) #else #if defined(MC68000) && defined(DS90) -size_s strlen(char *s) +size_t strlen(char *s) { asm(" movl 4(a7),a0 "); asm(" movl a0,a1 "); @@ -52,13 +54,13 @@ asm(" subql #1,d0 "); } #else -size_s strlen(register char *s) +size_t strlen(register char *s) { register char *startpos; startpos = s; while (*s++); - return ((size_s) (s-startpos-1)); + return ((size_t) (s-startpos-1)); } #endif diff --git a/strings/strmake.c b/strings/strmake.c index 2f4221ef426..1a5ad2286df 100644 --- a/strings/strmake.c +++ b/strings/strmake.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2001, 2003, 2006, 2007 MySQL AB, 2009 Sun Microsystems, Inc. +/* Copyright (c) 2000, 2001, 2003, 2006-2008 MySQL AB, 2009 Sun Microsystems, Inc. Use is subject to license terms. This program is free software; you can redistribute it and/or modify @@ -12,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : strmake.c Author : Michael Widenius @@ -28,7 +29,7 @@ #include <my_global.h> #include "m_string.h" -char *strmake(register char *dst, register const char *src, uint length) +char *strmake(register char *dst, register const char *src, size_t length) { #ifdef EXTRA_DEBUG /* diff --git a/strings/strmov.c b/strings/strmov.c index 5ae1474aeab..e670654eb95 100644 --- a/strings/strmov.c +++ b/strings/strmov.c @@ -12,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* strmov(dst, src) moves all the characters of src (including the diff --git a/strings/strnlen.c b/strings/strnlen.c index 11ecf718746..4826c17ff19 100644 --- a/strings/strnlen.c +++ b/strings/strnlen.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : strnlen.c Author : Michael Widenius @@ -25,10 +27,10 @@ #ifndef HAVE_STRNLEN -uint strnlen(register const char *s, register uint maxlen) +size_t strnlen(register const char *s, register size_t maxlen) { const char *end= (const char *)memchr(s, '\0', maxlen); - return end ? (uint) (end - s) : maxlen; + return end ? (size_t) (end - s) : maxlen; } #endif diff --git a/strings/strnmov.c b/strings/strnmov.c index b2099452d98..64cc46e3c05 100644 --- a/strings/strnmov.c +++ b/strings/strnmov.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* strnmov(dst,src,length) moves length characters, or until end, of src to @@ -23,7 +25,7 @@ #include <my_global.h> #include "m_string.h" -char *strnmov(register char *dst, register const char *src, uint n) +char *strnmov(register char *dst, register const char *src, size_t n) { while (n-- != 0) { if (!(*dst++ = *src++)) { diff --git a/strings/strrchr.c b/strings/strrchr.c index cdb0479ef90..0d7b42ac19d 100644 --- a/strings/strrchr.c +++ b/strings/strrchr.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* File : strrchr.c Author : Richard A. O'Keefe. diff --git a/strings/strstr.c b/strings/strstr.c index a5b50d12043..8c7be350bb6 100644 --- a/strings/strstr.c +++ b/strings/strstr.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2002 MySQL AB +/* Copyright (c) 2000-2002, 2004, 2006 MySQL AB + Use is subject to license terms. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -12,8 +13,9 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ + Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA +*/ /* File : strstr.c Author : Monty diff --git a/strings/strto.c b/strings/strto.c index 934b5d88e90..8255c38f52e 100644 --- a/strings/strto.c +++ b/strings/strto.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000-2004, 2006, 2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* strtol,strtoul,strtoll,strtoull @@ -88,7 +90,7 @@ function (const char *nptr,char **endptr,int base) register unsigned int cutlim; register ulongtype i; register const char *s; - register unsigned char c; + register uchar c; const char *save; int overflow; diff --git a/strings/strtod.c b/strings/strtod.c index 4817be6fac0..39f7249d85c 100644 --- a/strings/strtod.c +++ b/strings/strtod.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000, 2007 MySQL AB +/* Copyright (c) 2000, 2004-2007 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* strnmov(dst,src,length) moves length characters, or until end, of src to @@ -50,6 +51,9 @@ #include "my_base.h" /* Includes errno.h + EOVERFLOW */ #include "m_ctype.h" +#ifdef HAVE_IEEEFP_H +#include <ieeefp.h> +#endif #define MAX_DBL_EXP 308 #define MAX_RESULT_FOR_MAX_EXP 1.7976931348623157 @@ -105,7 +109,8 @@ const double log_10[] = { double my_strtod(const char *str, char **end_ptr, int *error) { double result= 0.0; - uint negative= 0, ndigits, dec_digits= 0, neg_exp= 0; + uint negative= 0, neg_exp= 0; + size_t ndigits, dec_digits= 0; int exponent= 0, digits_after_dec_point= 0, tmp_exp, step; const char *old_str, *end= *end_ptr, *start_of_number; char next_char; @@ -149,7 +154,7 @@ double my_strtod(const char *str, char **end_ptr, int *error) } start_of_number= 0; /* Found digit */ } - ndigits= (uint) (str-old_str); + ndigits= (size_t) (str-old_str); if (next_char == '.' && str < end-1) { @@ -173,7 +178,7 @@ double my_strtod(const char *str, char **end_ptr, int *error) } } /* If we found just '+.' or '.' then point at first character */ - if (!(dec_digits= (uint) (str-old_str)) && start_of_number) + if (!(dec_digits= (size_t) (str-old_str)) && start_of_number) str= start_of_number; /* Point at '+' or '.' */ } if ((next_char == 'e' || next_char == 'E') && diff --git a/strings/strtol.c b/strings/strtol.c index 42476b0226a..7b4d13f8778 100644 --- a/strings/strtol.c +++ b/strings/strtol.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2004, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* This implements strtol() if needed */ diff --git a/strings/strtoll.c b/strings/strtoll.c index cfb6fbd75ee..0858b21865e 100644 --- a/strings/strtoll.c +++ b/strings/strtoll.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2003, 2004, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* This implements strtoll() if needed */ diff --git a/strings/strtoul.c b/strings/strtoul.c index 3e2b51bc982..2c5ef0867fd 100644 --- a/strings/strtoul.c +++ b/strings/strtoul.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2004, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* This implements strtol() if needed */ diff --git a/strings/strtoull.c b/strings/strtoull.c index 94bf6904f8d..819d9ab9d72 100644 --- a/strings/strtoull.c +++ b/strings/strtoull.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2003, 2004, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* This implements strtoull() if needed */ diff --git a/strings/strxmov.c b/strings/strxmov.c index 9dd2c936620..c5963170c91 100644 --- a/strings/strxmov.c +++ b/strings/strxmov.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2002 MySQL AB +/* Copyright (c) 2000-2002, 2006 MySQL AB + Use is subject to license terms. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -12,8 +13,9 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ + Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA +*/ /* File : strxmov.c Author : Richard A. O'Keefe. diff --git a/strings/strxnmov.c b/strings/strxnmov.c index dfa3ab858ab..f9db76c0264 100644 --- a/strings/strxnmov.c +++ b/strings/strxnmov.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2002 MySQL AB +/* Copyright (c) 2000-2002, 2005-2007 MySQL AB + Use is subject to license terms. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -12,8 +13,9 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ + Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA +*/ /* File : strxnmov.c Author : Richard A. O'Keefe. @@ -22,26 +24,24 @@ strxnmov(dst, len, src1, ..., srcn, NullS) moves the first len characters of the concatenation of src1,...,srcn - to dst. If there aren't that many characters, a NUL character will - be added to the end of dst to terminate it properly. This gives the - same effect as calling strxcpy(buff, src1, ..., srcn, NullS) with a - large enough buffer, and then calling strnmov(dst, buff, len). + to dst and add a closing NUL character. It is just like strnmov except that it concatenates multiple sources. Beware: the last argument should be the null character pointer. Take VERY great care not to omit it! Also be careful to use NullS and NOT to use 0, as on some machines 0 is not the same size as a character pointer, or not the same bit pattern as NullS. - Note: strxnmov is like strnmov in that it moves up to len - characters; dst will be padded on the right with one NUL characters if - needed. + NOTE + strxnmov is like strnmov in that it moves up to len + characters; dst will be padded on the right with one '\0' character. + if total-string-length >= length then dst[length] will be set to \0 */ #include <my_global.h> #include "m_string.h" #include <stdarg.h> -char *strxnmov(char *dst,uint len, const char *src, ...) +char *strxnmov(char *dst, size_t len, const char *src, ...) { va_list pvar; char *end_of_dst=dst+len; @@ -58,8 +58,8 @@ char *strxnmov(char *dst,uint len, const char *src, ...) dst--; src = va_arg(pvar, char *); } - *dst=0; end: + *dst=0; va_end(pvar); return dst; } diff --git a/strings/uca-dump.c b/strings/uca-dump.c index 774e940c7da..ee0d879b6f8 100644 --- a/strings/uca-dump.c +++ b/strings/uca-dump.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2004 MySQL AB +/* Copyright (c) 2004, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include <stdio.h> #include <stdlib.h> diff --git a/strings/uctypedump.c b/strings/uctypedump.c new file mode 100644 index 00000000000..8de23952016 --- /dev/null +++ b/strings/uctypedump.c @@ -0,0 +1,243 @@ +/* Copyright (c) 2006 MySQL AB + Use is subject to license terms. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +*/ +#include <my_global.h> +#include <m_string.h> +#include <m_ctype.h> +#include "m_ctype.h" + + +typedef struct my_ctype_name_st +{ + const char *name; + int val; +} MY_CTYPE_NAME_ST; + + +static MY_CTYPE_NAME_ST my_ctype_name[]= +{ + {"Lu", _MY_U}, /* Letter, Uppercase */ + {"Ll", _MY_L}, /* Letter, Lowercase */ + {"Lt", _MY_U}, /* Letter, Titlecase */ + {"Lm", _MY_L}, /* Letter, Modifier */ + {"Lo", _MY_L}, /* Letter, other */ + + {"Nd", _MY_NMR}, /* Number, Decimal Digit */ + {"Nl", _MY_NMR|_MY_U|_MY_L}, /* Number, Letter */ + {"No", _MY_NMR|_MY_PNT}, /* Number, Other */ + + {"Mn", _MY_L|_MY_PNT}, /* Mark, Nonspacing */ + {"Mc", _MY_L|_MY_PNT}, /* Mark, Spacing Combining */ + {"Me", _MY_L|_MY_PNT}, /* Mark, Enclosing */ + + {"Pc", _MY_PNT}, /* Punctuation, Connector */ + {"Pd", _MY_PNT}, /* Punctuation, Dash */ + {"Ps", _MY_PNT}, /* Punctuation, Open */ + {"Pe", _MY_PNT}, /* Punctuation, Close */ + {"Pi", _MY_PNT}, /* Punctuation, Initial quote */ + {"Pf", _MY_PNT}, /* Punctuation, Final quote */ + {"Po", _MY_PNT}, /* Punctuation, Other */ + + {"Sm", _MY_PNT}, /* Symbol, Math */ + {"Sc", _MY_PNT}, /* Symbol, Currency */ + {"Sk", _MY_PNT}, /* Symbol, Modifier */ + {"So", _MY_PNT}, /* Symbol, Other */ + + {"Zs", _MY_SPC}, /* Separator, Space */ + {"Zl", _MY_SPC}, /* Separator, Line */ + {"Zp", _MY_SPC}, /* Separator, Paragraph */ + + {"Cc", _MY_CTR}, /* Other, Control */ + {"Cf", _MY_CTR}, /* Other, Format */ + {"Cs", _MY_CTR}, /* Other, Surrogate */ + {"Co", _MY_CTR}, /* Other, Private Use */ + {"Cn", _MY_CTR}, /* Other, Not Assigned */ + {NULL, 0} +}; + + +static int +ctypestr2num(const char *tok) +{ + MY_CTYPE_NAME_ST *p; + for (p= my_ctype_name; p->name; p++) + { + if (!strncasecmp(p->name, tok, 2)) + return p->val; + } + return 0; +} + + +int main(int ac, char ** av) +{ + char str[1024]; + unsigned char ctypea[64*1024]; + size_t i; + size_t plane; + MY_UNI_CTYPE uctype[256]; + FILE *f= stdin; + + if (ac > 1 && av[1] && !(f= fopen(av[1],"r"))) + { + fprintf(stderr, "Can't open file %s\n", av[1]); + exit(1); + } + bzero(&ctypea,sizeof(ctypea)); + bzero(&uctype, sizeof(uctype)); + + printf("/*\n"); + printf(" Unicode ctype data\n"); + printf(" Generated from %s\n", av[1] ? av[1] : "stdin"); + printf("*/\n"); + + while(fgets(str, sizeof(str), f)) + { + size_t n= 0, code= 0; + char *s,*e; + int ctype= 0; + + for(s= str; s; ) + { + char *end; + char tok[1024]=""; + e=strchr(s,';'); + if(e) + { + strncpy(tok,s,(unsigned int)(e-s)); + tok[e-s]=0; + } + else + { + strcpy(tok,s); + } + + end=tok+strlen(tok); + + switch(n) + { + case 0: code= strtol(tok,&end,16);break; + case 2: ctype= ctypestr2num(tok);break; + } + + n++; + if(e) s=e+1; + else s=e; + } + if(code<=0xFFFF) + { + ctypea[code]= ctype; + } + } + + /* Fill digits */ + for (i= '0'; i <= '9'; i++) + ctypea[i]= _MY_NMR; + + for (i= 'a'; i <= 'z'; i++) + ctypea[i]|= _MY_X; + for (i= 'A'; i <= 'Z'; i++) + ctypea[i]|= _MY_X; + + + /* Fill ideographs */ + + /* CJK Ideographs Extension A (U+3400 - U+4DB5) */ + for(i=0x3400;i<=0x4DB5;i++) + { + ctypea[i]= _MY_L | _MY_U; + } + + /* CJK Ideographs (U+4E00 - U+9FA5) */ + for(i=0x4E00;i<=0x9FA5;i++){ + ctypea[i]= _MY_L | _MY_U; + } + + /* Hangul Syllables (U+AC00 - U+D7A3) */ + for(i=0xAC00;i<=0xD7A3;i++) + { + ctypea[i]= _MY_L | _MY_U; + } + + + /* Calc plane parameters */ + for(plane=0;plane<256;plane++) + { + size_t character; + uctype[plane].ctype= ctypea+plane*256; + + uctype[plane].pctype= uctype[plane].ctype[0]; + for(character=1;character<256;character++) + { + if (uctype[plane].ctype[character] != uctype[plane].pctype) + { + uctype[plane].pctype= 0; /* Mixed plane */ + break; + } + } + if (character==256) /* All the same, no needs to dump whole plane */ + uctype[plane].ctype= NULL; + } + + /* Dump mixed planes */ + for(plane=0;plane<256;plane++) + { + if(uctype[plane].ctype) + { + int charnum=0; + int num=0; + + printf("static unsigned char uctype_page%02X[256]=\n{\n",plane); + + for(charnum=0;charnum<256;charnum++) + { + int cod; + + cod=(plane<<8)+charnum; + printf(" %2d%s",uctype[plane].ctype[charnum],charnum<255?",":""); + + num++; + if(num==16) + { + printf("\n"); + num=0; + } + } + printf("};\n\n"); + } + } + + + /* Dump plane index */ + printf("MY_UNI_CTYPE my_uni_ctype[256]={\n"); + for(plane=0;plane<256;plane++) + { + char plane_name[128]="NULL"; + if(uctype[plane].ctype){ + sprintf(plane_name,"uctype_page%02X",plane); + } + printf("\t{%d,%s}%s\n",uctype[plane].pctype,plane_name,plane<255?",":""); + } + printf("};\n"); + + return 0; +} diff --git a/strings/udiv.c b/strings/udiv.c index 81ac01ee9c3..c7780dde64a 100644 --- a/strings/udiv.c +++ b/strings/udiv.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* Do udiv and urem if machine dosn't have it */ diff --git a/strings/utr11-dump.c b/strings/utr11-dump.c index a15f63025f4..77f3b85bb93 100644 --- a/strings/utr11-dump.c +++ b/strings/utr11-dump.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2004 MySQL AB +/* Copyright (c) 2004, 2006 MySQL AB + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include <stdio.h> #include <stdlib.h> diff --git a/strings/xml.c b/strings/xml.c index 986bd0e157f..60753914693 100644 --- a/strings/xml.c +++ b/strings/xml.c @@ -1,5 +1,4 @@ -/* Copyright (c) 2003-2006 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. +/* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,13 +11,15 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include "my_global.h" #include "m_string.h" #include "my_xml.h" +#define MY_XML_UNKNOWN 'U' #define MY_XML_EOF 'E' #define MY_XML_STRING 'S' #define MY_XML_IDENT 'I' @@ -30,6 +31,7 @@ #define MY_XML_TEXT 'T' #define MY_XML_QUESTION '?' #define MY_XML_EXCLAM '!' +#define MY_XML_CDATA 'D' typedef struct xml_attr_st { @@ -38,13 +40,54 @@ typedef struct xml_attr_st } MY_XML_ATTR; +/* + XML ctype: +*/ +#define MY_XML_ID0 0x01 /* Identifier initial character */ +#define MY_XML_ID1 0x02 /* Identifier medial character */ +#define MY_XML_SPC 0x08 /* Spacing character */ + + +/* + http://www.w3.org/TR/REC-xml/ + [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | + CombiningChar | Extender + [5] Name ::= (Letter | '_' | ':') (NameChar)* +*/ + +static char my_xml_ctype[256]= +{ +/*00*/ 0,0,0,0,0,0,0,0,0,8,8,0,0,8,0,0, +/*10*/ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +/*20*/ 8,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0, /* !"#$%&'()*+,-./ */ +/*30*/ 2,2,2,2,2,2,2,2,2,2,3,0,0,0,0,0, /* 0123456789:;<=>? */ +/*40*/ 0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, /* @ABCDEFGHIJKLMNO */ +/*50*/ 3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,3, /* PQRSTUVWXYZ[\]^_ */ +/*60*/ 0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, /* `abcdefghijklmno */ +/*70*/ 3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0, /* pqrstuvwxyz{|}~ */ +/*80*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +/*90*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +/*A0*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +/*B0*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +/*C0*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +/*D0*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +/*E0*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +/*F0*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 +}; + +#define my_xml_is_space(c) (my_xml_ctype[(uchar) (c)] & MY_XML_SPC) +#define my_xml_is_id0(c) (my_xml_ctype[(uchar) (c)] & MY_XML_ID0) +#define my_xml_is_id1(c) (my_xml_ctype[(uchar) (c)] & MY_XML_ID1) + + static const char *lex2str(int lex) { switch(lex) { - case MY_XML_EOF: return "EOF"; + case MY_XML_EOF: return "END-OF-INPUT"; case MY_XML_STRING: return "STRING"; case MY_XML_IDENT: return "IDENT"; + case MY_XML_CDATA: return "CDATA"; case MY_XML_EQ: return "'='"; case MY_XML_LT: return "'<'"; case MY_XML_GT: return "'>'"; @@ -54,13 +97,20 @@ static const char *lex2str(int lex) case MY_XML_QUESTION: return "'?'"; case MY_XML_EXCLAM: return "'!'"; } - return "UNKNOWN"; + return "unknown token"; } static void my_xml_norm_text(MY_XML_ATTR *a) { - for ( ; (a->beg < a->end) && strchr(" \t\r\n",a->beg[0]) ; a->beg++ ); - for ( ; (a->beg < a->end) && strchr(" \t\r\n",a->end[-1]) ; a->end-- ); + for ( ; (a->beg < a->end) && my_xml_is_space(a->beg[0]) ; a->beg++ ); + for ( ; (a->beg < a->end) && my_xml_is_space(a->end[-1]) ; a->end-- ); +} + + +static inline my_bool +my_xml_parser_prefix_cmp(MY_XML_PARSER *p, const char *s, size_t slen) +{ + return (p->cur + slen > p->end) || memcmp(p->cur, s, slen); } @@ -68,7 +118,7 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a) { int lex; - for( ; ( p->cur < p->end) && strchr(" \t\r\n",p->cur[0]) ; p->cur++); + for (; ( p->cur < p->end) && my_xml_is_space(p->cur[0]) ; p->cur++); if (p->cur >= p->end) { @@ -81,15 +131,33 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a) a->beg=p->cur; a->end=p->cur; - if ((p->end - p->cur > 3) && !bcmp(p->cur,"<!--",4)) + if (!my_xml_parser_prefix_cmp(p, C_STRING_WITH_LEN("<!--"))) { - for( ; (p->cur < p->end) && bcmp(p->cur, "-->", 3); p->cur++) - {} - if (!bcmp(p->cur, "-->", 3)) - p->cur+=3; + for (; p->cur < p->end; p->cur++) + { + if (!my_xml_parser_prefix_cmp(p, C_STRING_WITH_LEN("-->"))) + { + p->cur+= 3; + break; + } + } a->end=p->cur; lex=MY_XML_COMMENT; } + else if (!my_xml_parser_prefix_cmp(p, C_STRING_WITH_LEN("<![CDATA["))) + { + p->cur+= 9; + for (; p->cur < p->end - 2 ; p->cur++) + { + if (p->cur[0] == ']' && p->cur[1] == ']' && p->cur[2] == '>') + { + p->cur+= 3; + a->end= p->cur; + break; + } + } + lex= MY_XML_CDATA; + } else if (strchr("?=/<>!",p->cur[0])) { p->cur++; @@ -99,24 +167,26 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a) else if ( (p->cur[0] == '"') || (p->cur[0] == '\'') ) { p->cur++; - for( ; ( p->cur < p->end ) && (p->cur[0] != a->beg[0]); p->cur++) + for (; ( p->cur < p->end ) && (p->cur[0] != a->beg[0]); p->cur++) {} a->end=p->cur; if (a->beg[0] == p->cur[0])p->cur++; a->beg++; - my_xml_norm_text(a); + if (!(p->flags & MY_XML_FLAG_SKIP_TEXT_NORMALIZATION)) + my_xml_norm_text(a); lex=MY_XML_STRING; } - else + else if (my_xml_is_id0(p->cur[0])) { - for(; - (p->cur < p->end) && !strchr("?'\"=/<> \t\r\n", p->cur[0]); - p->cur++) - {} + p->cur++; + while (p->cur < p->end && my_xml_is_id1(p->cur[0])) + p->cur++; a->end=p->cur; my_xml_norm_text(a); lex=MY_XML_IDENT; } + else + lex= MY_XML_UNKNOWN; #if 0 printf("LEX=%s[%d]\n",lex2str(lex),a->end-a->beg); @@ -127,32 +197,35 @@ ret: } -static int my_xml_value(MY_XML_PARSER *st, const char *str, uint len) +static int my_xml_value(MY_XML_PARSER *st, const char *str, size_t len) { return (st->value) ? (st->value)(st,str,len) : MY_XML_OK; } -static int my_xml_enter(MY_XML_PARSER *st, const char *str, uint len) +static int my_xml_enter(MY_XML_PARSER *st, const char *str, size_t len) { - if ((uint) (st->attrend-st->attr+len+1) > sizeof(st->attr)) + if ((size_t) (st->attrend-st->attr+len+1) > sizeof(st->attr)) { sprintf(st->errstr,"To deep XML"); return MY_XML_ERROR; } if (st->attrend > st->attr) { - st->attrend[0]='.'; + st->attrend[0]= '/'; st->attrend++; } memcpy(st->attrend,str,len); st->attrend+=len; st->attrend[0]='\0'; - return st->enter ? st->enter(st,st->attr, (uint) (st->attrend - st->attr)) : MY_XML_OK; + if (st->flags & MY_XML_FLAG_RELATIVE_NAMES) + return st->enter ? st->enter(st, str, len) : MY_XML_OK; + else + return st->enter ? st->enter(st,st->attr,st->attrend-st->attr) : MY_XML_OK; } -static void mstr(char *s,const char *src,uint l1, uint l2) +static void mstr(char *s,const char *src,size_t l1, size_t l2) { l1 = l1<l2 ? l1 : l2; memcpy(s,src,l1); @@ -160,27 +233,36 @@ static void mstr(char *s,const char *src,uint l1, uint l2) } -static int my_xml_leave(MY_XML_PARSER *p, const char *str, uint slen) +static int my_xml_leave(MY_XML_PARSER *p, const char *str, size_t slen) { char *e; - uint glen; + size_t glen; char s[32]; char g[32]; int rc; - - /* Find previous '.' or beginning */ - for( e=p->attrend; (e>p->attr) && (e[0] != '.') ; e--); - glen = (uint) ((e[0] == '.') ? (p->attrend-e-1) : p->attrend-e); + + /* Find previous '/' or beginning */ + for (e=p->attrend; (e>p->attr) && (e[0] != '/') ; e--); + glen = (size_t) ((e[0] == '/') ? (p->attrend-e-1) : p->attrend-e); if (str && (slen != glen)) { mstr(s,str,sizeof(s)-1,slen); - mstr(g,e+1,sizeof(g)-1,glen), - sprintf(p->errstr,"'</%s>' unexpected ('</%s>' wanted)",s,g); + if (glen) + { + mstr(g,e+1,sizeof(g)-1,glen), + sprintf(p->errstr,"'</%s>' unexpected ('</%s>' wanted)",s,g); + } + else + sprintf(p->errstr,"'</%s>' unexpected (END-OF-INPUT wanted)", s); return MY_XML_ERROR; } - rc = p->leave_xml ? p->leave_xml(p,p->attr, (uint) (p->attrend - p->attr)) : MY_XML_OK; + if (p->flags & MY_XML_FLAG_RELATIVE_NAMES) + rc= p->leave_xml ? p->leave_xml(p, str, slen) : MY_XML_OK; + else + rc= (p->leave_xml ? p->leave_xml(p,p->attr,p->attrend-p->attr) : + MY_XML_OK); *e='\0'; p->attrend=e; @@ -189,7 +271,7 @@ static int my_xml_leave(MY_XML_PARSER *p, const char *str, uint slen) } -int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len) +int my_xml_parse(MY_XML_PARSER *p,const char *str, size_t len) { p->attrend=p->attr; p->beg=str; @@ -208,7 +290,13 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len) lex=my_xml_scan(p,&a); if (MY_XML_COMMENT == lex) + continue; + + if (lex == MY_XML_CDATA) { + a.beg+= 9; + a.end-= 3; + my_xml_value(p, a.beg, (size_t) (a.end-a.beg)); continue; } @@ -218,10 +306,10 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len) { if (MY_XML_IDENT != (lex=my_xml_scan(p,&a))) { - sprintf(p->errstr,"1: %s unexpected (ident wanted)",lex2str(lex)); + sprintf(p->errstr,"%s unexpected (ident wanted)",lex2str(lex)); return MY_XML_ERROR; } - if (MY_XML_OK != my_xml_leave(p,a.beg,(uint) (a.end-a.beg))) + if (MY_XML_OK != my_xml_leave(p,a.beg,(size_t) (a.end-a.beg))) return MY_XML_ERROR; lex=my_xml_scan(p,&a); goto gt; @@ -240,18 +328,19 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len) if (MY_XML_IDENT == lex) { - if (MY_XML_OK != my_xml_enter(p,a.beg,(uint) (a.end-a.beg))) + p->current_node_type= MY_XML_NODE_TAG; + if (MY_XML_OK != my_xml_enter(p,a.beg,(size_t) (a.end-a.beg))) return MY_XML_ERROR; } else { - sprintf(p->errstr,"3: %s unexpected (ident or '/' wanted)", + sprintf(p->errstr,"%s unexpected (ident or '/' wanted)", lex2str(lex)); return MY_XML_ERROR; } while ((MY_XML_IDENT == (lex=my_xml_scan(p,&a))) || - (MY_XML_STRING == lex)) + ((MY_XML_STRING == lex && exclam))) { MY_XML_ATTR b; if (MY_XML_EQ == (lex=my_xml_scan(p,&b))) @@ -259,24 +348,35 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len) lex=my_xml_scan(p,&b); if ( (lex == MY_XML_IDENT) || (lex == MY_XML_STRING) ) { - if ((MY_XML_OK != my_xml_enter(p,a.beg,(uint) (a.end-a.beg))) || - (MY_XML_OK != my_xml_value(p,b.beg,(uint) (b.end-b.beg))) || - (MY_XML_OK != my_xml_leave(p,a.beg,(uint) (a.end-a.beg)))) + p->current_node_type= MY_XML_NODE_ATTR; + if ((MY_XML_OK != my_xml_enter(p,a.beg,(size_t) (a.end-a.beg))) || + (MY_XML_OK != my_xml_value(p,b.beg,(size_t) (b.end-b.beg))) || + (MY_XML_OK != my_xml_leave(p,a.beg,(size_t) (a.end-a.beg)))) return MY_XML_ERROR; } else { - sprintf(p->errstr,"4: %s unexpected (ident or string wanted)", + sprintf(p->errstr,"%s unexpected (ident or string wanted)", lex2str(lex)); return MY_XML_ERROR; } } - else if ((MY_XML_STRING == lex) || (MY_XML_IDENT == lex)) + else if (MY_XML_IDENT == lex) { - if ((MY_XML_OK != my_xml_enter(p,a.beg,(uint) (a.end-a.beg))) || - (MY_XML_OK != my_xml_leave(p,a.beg,(uint) (a.end-a.beg)))) + p->current_node_type= MY_XML_NODE_ATTR; + if ((MY_XML_OK != my_xml_enter(p,a.beg,(size_t) (a.end-a.beg))) || + (MY_XML_OK != my_xml_leave(p,a.beg,(size_t) (a.end-a.beg)))) return MY_XML_ERROR; } + else if ((MY_XML_STRING == lex) && exclam) + { + /* + We are in <!DOCTYPE>, e.g. + <!DOCTYPE name SYSTEM "SystemLiteral"> + <!DOCTYPE name PUBLIC "PublidLiteral" "SystemLiteral"> + Just skip "SystemLiteral" and "PublicidLiteral" + */ + } else break; } @@ -293,7 +393,7 @@ gt: { if (lex != MY_XML_QUESTION) { - sprintf(p->errstr,"6: %s unexpected ('?' wanted)",lex2str(lex)); + sprintf(p->errstr,"%s unexpected ('?' wanted)",lex2str(lex)); return MY_XML_ERROR; } if (MY_XML_OK != my_xml_leave(p,NULL,0)) @@ -309,7 +409,7 @@ gt: if (lex != MY_XML_GT) { - sprintf(p->errstr,"5: %s unexpected ('>' wanted)",lex2str(lex)); + sprintf(p->errstr,"%s unexpected ('>' wanted)",lex2str(lex)); return MY_XML_ERROR; } } @@ -319,13 +419,20 @@ gt: for ( ; (p->cur < p->end) && (p->cur[0] != '<') ; p->cur++); a.end=p->cur; - my_xml_norm_text(&a); + if (!(p->flags & MY_XML_FLAG_SKIP_TEXT_NORMALIZATION)) + my_xml_norm_text(&a); if (a.beg != a.end) { - my_xml_value(p,a.beg,(uint) (a.end-a.beg)); + my_xml_value(p,a.beg,(size_t) (a.end-a.beg)); } } } + + if (p->attr[0]) + { + sprintf(p->errstr,"unexpected END-OF-INPUT"); + return MY_XML_ERROR; + } return MY_XML_OK; } @@ -343,14 +450,14 @@ void my_xml_parser_free(MY_XML_PARSER *p __attribute__((unused))) void my_xml_set_value_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, - uint l)) + size_t l)) { p->value=action; } void my_xml_set_enter_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, - uint l)) + size_t l)) { p->enter=action; } @@ -358,7 +465,7 @@ void my_xml_set_enter_handler(MY_XML_PARSER *p, void my_xml_set_leave_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, - uint l)) + size_t l)) { p->leave_xml=action; } @@ -376,7 +483,7 @@ const char *my_xml_error_string(MY_XML_PARSER *p) } -uint my_xml_error_pos(MY_XML_PARSER *p) +size_t my_xml_error_pos(MY_XML_PARSER *p) { const char *beg=p->beg; const char *s; @@ -385,7 +492,7 @@ uint my_xml_error_pos(MY_XML_PARSER *p) if (s[0] == '\n') beg=s; } - return (uint) (p->cur-beg); + return (size_t) (p->cur-beg); } uint my_xml_error_lineno(MY_XML_PARSER *p) |