summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-czech.c3
-rw-r--r--strings/ctype-ucs2.c3
-rw-r--r--strings/ctype-ujis.c44
-rw-r--r--strings/ctype-win1250ch.c3
-rw-r--r--strings/xml.c2
5 files changed, 49 insertions, 6 deletions
diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c
index 07c45788d30..76981200a4d 100644
--- a/strings/ctype-czech.c
+++ b/strings/ctype-czech.c
@@ -277,7 +277,8 @@ static
int my_strnncollsp_czech(CHARSET_INFO * cs,
const uchar *s, uint slen,
const uchar *t, uint tlen,
- my_bool diff_if_only_endspace_difference)
+ my_bool diff_if_only_endspace_difference
+ __attribute__((unused)))
{
for ( ; slen && s[slen-1] == ' ' ; slen--);
for ( ; tlen && t[tlen-1] == ' ' ; tlen--);
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index d3fb16aa52e..d21b340e768 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -1360,7 +1360,8 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *cs,
static int my_strnncollsp_ucs2_bin(CHARSET_INFO *cs,
const uchar *s, uint slen,
const uchar *t, uint tlen,
- my_bool diff_if_only_endspace_difference)
+ my_bool diff_if_only_endspace_difference
+ __attribute__((unused)))
{
/* TODO: Needs to be fixed to handle end space! */
return my_strnncoll_ucs2_bin(cs,s,slen,t,tlen,0);
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index 94673a20795..fc1496df280 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -8243,7 +8243,6 @@ my_jisx0212_uni_onechar(int code){
}
-
/*
EUC-JP encoding subcomponents:
[x00-x7F] # ASCII/JIS-Roman (one-byte/character)
@@ -8253,6 +8252,47 @@ 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)
+{
+ const uchar *b= (uchar *) beg;
+
+ for ( ; pos && b < (uchar*) end; pos--, b++)
+ {
+ char *chbeg;
+ uint ch= *b;
+
+ if (ch <= 0x7F) /* one byte */
+ continue;
+
+ chbeg= (char *) b++;
+ if (b >= (uchar *) end) /* need more bytes */
+ return chbeg - beg; /* unexpected EOL */
+
+ if (ch == 0x8E) /* [x8E][xA0-xDF] */
+ {
+ if (*b >= 0xA0 && *b <= 0xDF)
+ continue;
+ return chbeg - beg; /* invalid sequence */
+ }
+
+ if (ch == 0x8F) /* [x8F][xA1-xFE][xA1-xFE] */
+ {
+ ch= *b++;
+ if (b >= (uchar*) end)
+ return chbeg - beg; /* unexpected EOL */
+ }
+
+ if (ch >= 0xA1 && ch <= 0xFE &&
+ *b >= 0xA1 && *b <= 0xFE) /* [xA1-xFE][xA1-xFE] */
+ continue;
+ return chbeg - beg; /* invalid sequence */
+ }
+ return b - (uchar *) beg;
+}
+
+
+static
uint my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)),
const char *str, const char *strend)
{
@@ -8475,7 +8515,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
mbcharlen_ujis,
my_numchars_mb,
my_charpos_mb,
- my_well_formed_len_mb,
+ my_well_formed_len_ujis,
my_lengthsp_8bit,
my_numcells_eucjp,
my_mb_wc_euc_jp, /* mb_wc */
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index 896aef775cf..397dcd6f2f2 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -480,7 +480,8 @@ static
int my_strnncollsp_win1250ch(CHARSET_INFO * cs,
const uchar *s, uint slen,
const uchar *t, uint tlen,
- my_bool diff_if_only_endspace_difference)
+ my_bool diff_if_only_endspace_difference
+ __attribute__((unused)))
{
for ( ; slen && s[slen-1] == ' ' ; slen--);
for ( ; tlen && t[tlen-1] == ' ' ; tlen--);
diff --git a/strings/xml.c b/strings/xml.c
index 6ba52ea41a8..d19c3dab241 100644
--- a/strings/xml.c
+++ b/strings/xml.c
@@ -135,7 +135,7 @@ static int my_xml_value(MY_XML_PARSER *st, const char *str, uint len)
static int my_xml_enter(MY_XML_PARSER *st, const char *str, uint len)
{
- if ( (st->attrend-st->attr+len+1)>sizeof(st->attr))
+ if ((uint) (st->attrend-st->attr+len+1) > sizeof(st->attr))
{
sprintf(st->errstr,"To deep XML");
return MY_XML_ERROR;