summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorserg@serg.mylan <>2005-04-06 21:19:20 +0200
committerserg@serg.mylan <>2005-04-06 21:19:20 +0200
commite1e5b97dea1ec945939a711e31ff7e0bb73dd3e9 (patch)
treed7dfbdbb37dfe91906c38499758105cb11079399 /strings
parent78332dcf78be86a16631f1ab7e8e802ad133e171 (diff)
parentf32fe9c154adbd169407c0bf3c11647dc7f0f7b8 (diff)
downloadmariadb-git-e1e5b97dea1ec945939a711e31ff7e0bb73dd3e9.tar.gz
manually merged
Gluh's SESSION/GLOBAL for @variables fix in sql_yacc.yy and Bar's well_formed_len() changes in ndb code did not make it and should be re-applied manually
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-big5.c6
-rw-r--r--strings/ctype-mb.c9
-rw-r--r--strings/ctype-simple.c6
-rw-r--r--strings/ctype-sjis.c5
-rw-r--r--strings/ctype-ucs2.c6
-rw-r--r--strings/ctype-ujis.c13
6 files changed, 32 insertions, 13 deletions
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index 336b5f0e832..ab6691e68b0 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -6294,10 +6294,13 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
*/
static
uint my_well_formed_len_big5(CHARSET_INFO *cs __attribute__((unused)),
- const char *b, const char *e, uint pos)
+ const char *b, const char *e,
+ uint pos, int *error)
{
const char *b0= b;
const char *emb= e - 1; /* Last possible end of an MB character */
+
+ *error= 0;
while (pos && b < e)
{
if ((uchar) b[0] < 128)
@@ -6313,6 +6316,7 @@ uint my_well_formed_len_big5(CHARSET_INFO *cs __attribute__((unused)),
else
{
/* Wrong byte sequence */
+ *error= 1;
break;
}
}
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index a9edb35d8a4..b603a8ea0a8 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -264,18 +264,21 @@ uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)),
}
-uint my_well_formed_len_mb(CHARSET_INFO *cs,
- const char *b, const char *e, uint pos)
+uint my_well_formed_len_mb(CHARSET_INFO *cs, const char *b, const char *e,
+ uint pos, int *error)
{
const char *b_start= b;
-
+ *error= 0;
while (pos)
{
my_wc_t wc;
int mblen;
if ((mblen= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <= 0)
+ {
+ *error= b < e ? 1 : 0;
break;
+ }
b+= mblen;
pos--;
}
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 91888771c80..5fa1a1b18a0 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -1122,11 +1122,11 @@ uint my_charpos_8bit(CHARSET_INFO *cs __attribute__((unused)),
uint my_well_formed_len_8bit(CHARSET_INFO *cs __attribute__((unused)),
- const char *start,
- const char *end,
- uint nchars)
+ const char *start, const char *end,
+ uint nchars, int *error)
{
uint nbytes= (uint) (end-start);
+ *error= 0;
return min(nbytes, nchars);
}
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index 9a54fe5595b..62cb5427dd9 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -4586,9 +4586,11 @@ uint my_numcells_sjis(CHARSET_INFO *cs __attribute__((unused)),
*/
static
uint my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)),
- const char *b, const char *e, uint pos)
+ const char *b, const char *e,
+ uint pos, int *error)
{
const char *b0= b;
+ *error= 0;
while (pos && b < e)
{
if ((uchar) b[0] < 128)
@@ -4609,6 +4611,7 @@ uint my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)),
else
{
/* Wrong byte sequence */
+ *error= 1;
break;
}
}
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index 72483ce5c4c..73d15da8a4a 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -1273,11 +1273,11 @@ uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)),
static
uint my_well_formed_len_ucs2(CHARSET_INFO *cs __attribute__((unused)),
- const char *b,
- const char *e,
- uint nchars)
+ const char *b, const char *e,
+ uint nchars, int *error)
{
uint nbytes= (e-b) & ~ (uint)1;
+ *error= 0;
nchars*= 2;
return min(nbytes, nchars);
}
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index deaddcc76f6..7bcf1c83bab 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -8253,11 +8253,12 @@ 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 char *beg, const char *end,
+ uint pos, int *error)
{
const uchar *b= (uchar *) beg;
- for ( ; pos && b < (uchar*) end; pos--, b++)
+ for ( *error= 0 ; pos && b < (uchar*) end; pos--, b++)
{
char *chbeg;
uint ch= *b;
@@ -8267,12 +8268,16 @@ uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)),
chbeg= (char *) b++;
if (b >= (uchar *) end) /* need more bytes */
+ {
+ *error= 1;
return chbeg - beg; /* unexpected EOL */
+ }
if (ch == 0x8E) /* [x8E][xA0-xDF] */
{
if (*b >= 0xA0 && *b <= 0xDF)
continue;
+ *error= 1;
return chbeg - beg; /* invalid sequence */
}
@@ -8280,12 +8285,16 @@ uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)),
{
ch= *b++;
if (b >= (uchar*) end)
+ {
+ *error= 1;
return chbeg - beg; /* unexpected EOL */
+ }
}
if (ch >= 0xA1 && ch <= 0xFE &&
*b >= 0xA1 && *b <= 0xFE) /* [xA1-xFE][xA1-xFE] */
continue;
+ *error= 1;
return chbeg - beg; /* invalid sequence */
}
return b - (uchar *) beg;