summaryrefslogtreecommitdiff
path: root/strings/ctype-ujis.c
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2005-04-06 11:53:15 +0500
committerunknown <bar@mysql.com>2005-04-06 11:53:15 +0500
commit5687fe36bf21add03b96871215c58bd2e12a4666 (patch)
treee7ff1b9199a6be79542bbe6fbdf4588d1e054d48 /strings/ctype-ujis.c
parent81125bc8ceb2de09fb0db1851ca80edb45b290e2 (diff)
downloadmariadb-git-5687fe36bf21add03b96871215c58bd2e12a4666.tar.gz
Adding a new parameter for well_formed_length to
return error. We'll use it for better warnign reporting.
Diffstat (limited to 'strings/ctype-ujis.c')
-rw-r--r--strings/ctype-ujis.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index fc1496df280..612dda2b3eb 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;