mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
1fd84d3477
Fixes in charset related C++ code configure.in: Make things to be easier managable include/m_ctype.h: Hide some functions under conditional compilation libmysql/Makefile.shared: Make things to be easier managable sql/item_func.cc: Fixed that private member is not available in this context sql/item_strfunc.cc: Fixed that private member is not available in this context strings/Makefile.am: Make charset things to be easier managable Some fixes in charset C++ code strings/ctype-big5.c: Hide some functions under conditional compilation strings/ctype-czech.c: Hide some functions under conditional compilation strings/ctype-euc_kr.c: Hide some functions under conditional compilation strings/ctype-gb2312.c: Hide some functions under conditional compilation strings/ctype-gbk.c: Hide some functions under conditional compilation strings/ctype-latin1_de.c: Hide some functions under conditional compilation strings/ctype-mb.c: Hide some functions under conditional compilation strings/ctype-sjis.c: Hide some functions under conditional compilation strings/ctype-tis620.c: Hide some functions under conditional compilation strings/ctype-ujis.c: Hide some functions under conditional compilation
129 lines
2.7 KiB
C
129 lines
2.7 KiB
C
/* 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; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
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 */
|
|
|
|
#include <my_global.h>
|
|
#include "m_ctype.h"
|
|
|
|
#ifdef USE_MB
|
|
|
|
|
|
void my_caseup_str_mb(CHARSET_INFO * cs, char *str)
|
|
{
|
|
register uint32 l;
|
|
register char *end=str+strlen(str); /* BAR TODO: remove strlen() call */
|
|
while (*str)
|
|
{
|
|
if ((l=my_ismbchar(cs, str,end)))
|
|
str+=l;
|
|
else
|
|
{
|
|
*str=(char)my_toupper(cs,(uchar)*str);
|
|
str++;
|
|
}
|
|
}
|
|
}
|
|
|
|
void my_casedn_str_mb(CHARSET_INFO * cs, char *str)
|
|
{
|
|
register uint32 l;
|
|
register char *end=str+strlen(str);
|
|
while (*str)
|
|
{
|
|
if ((l=my_ismbchar(cs, str,end)))
|
|
str+=l;
|
|
else
|
|
{
|
|
*str=(char)my_tolower(cs,(uchar)*str);
|
|
str++;
|
|
}
|
|
}
|
|
}
|
|
|
|
void my_caseup_mb(CHARSET_INFO * cs, char *str, uint length)
|
|
{
|
|
register uint32 l;
|
|
register char *end=str+length;
|
|
while (str<end)
|
|
{
|
|
if ((l=my_ismbchar(cs, str,end)))
|
|
str+=l;
|
|
else
|
|
{
|
|
*str=(char)my_toupper(cs,(uchar)*str);
|
|
str++;
|
|
}
|
|
}
|
|
}
|
|
|
|
void my_casedn_mb(CHARSET_INFO * cs, char *str, uint length)
|
|
{
|
|
register uint32 l;
|
|
register char *end=str+length;
|
|
while (str<end)
|
|
{
|
|
if ((l=my_ismbchar(cs, str,end)))
|
|
str+=l;
|
|
else
|
|
{
|
|
*str=(char)my_tolower(cs,(uchar)*str);
|
|
str++;
|
|
}
|
|
}
|
|
}
|
|
|
|
int my_strcasecmp_mb(CHARSET_INFO * cs,const char *s, const char *t)
|
|
{
|
|
register uint32 l;
|
|
register const char *end=s+strlen(s);
|
|
while (s<end)
|
|
{
|
|
if ((l=my_ismbchar(cs, s,end)))
|
|
{
|
|
while (l--)
|
|
if (*s++ != *t++)
|
|
return 1;
|
|
}
|
|
else if (my_ismbhead(cs, *t))
|
|
return 1;
|
|
else if (my_toupper(cs,(uchar) *s++) != my_toupper(cs,(uchar) *t++))
|
|
return 1;
|
|
}
|
|
return *t;
|
|
}
|
|
|
|
|
|
int my_strncasecmp_mb(CHARSET_INFO * cs,
|
|
const char *s, const char *t, uint len)
|
|
{
|
|
register uint32 l;
|
|
register const char *end=s+len;
|
|
while (s<end)
|
|
{
|
|
if ((l=my_ismbchar(cs, s,end)))
|
|
{
|
|
while (l--)
|
|
if (*s++ != *t++)
|
|
return 1;
|
|
}
|
|
else if (my_ismbhead(cs, *t))
|
|
return 1;
|
|
else if (my_toupper(cs,(uchar) *s++) != my_toupper(cs,(uchar) *t++))
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
#endif
|