diff options
author | unknown <evgen@moonbone.local> | 2006-01-16 16:57:15 +0300 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2006-01-16 16:57:15 +0300 |
commit | 9422fee7de29504c9b1bbd02e49173e3a130a9b3 (patch) | |
tree | cb6f888f350fe4c923d070ac254cf224753512ea /strings | |
parent | 99ebd49555bd1993ccb3745eb3b55f4ea38ec49d (diff) | |
parent | 85f2158b95520b3833732e18ead9c74856b05ff6 (diff) | |
download | mariadb-git-9422fee7de29504c9b1bbd02e49173e3a130a9b3.tar.gz |
Manually merged
mysql-test/r/sp.result:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/field.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_handler.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
storage/innobase/os/os0thread.c:
Auto merged
storage/myisam/myisam_ftdump.c:
Auto merged
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
Auto merged
storage/ndb/src/ndbapi/NdbImpl.hpp:
Auto merged
storage/ndb/src/ndbapi/NdbRecAttr.cpp:
Auto merged
storage/ndb/src/ndbapi/ndb_cluster_connection.cpp:
Auto merged
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-euc_kr.c | 37 | ||||
-rw-r--r-- | strings/ctype-gb2312.c | 37 |
2 files changed, 72 insertions, 2 deletions
diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index 97fea517c1b..5e357e0b65c 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -8635,6 +8635,41 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)), } +/* + Returns well formed length of a EUC-KR string. +*/ +static uint +my_well_formed_len_euckr(CHARSET_INFO *cs __attribute__((unused)), + 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) + { + /* Single byte ascii character */ + b++; + } + else if (b < emb && iseuc_kr(*b) && iseuc_kr(b[1])) + { + /* Double byte character */ + b+= 2; + } + else + { + /* Wrong byte sequence */ + *error= 1; + break; + } + } + return (uint) (b - b0); +} + + static MY_COLLATION_HANDLER my_collation_ci_handler = { NULL, /* init */ @@ -8657,7 +8692,7 @@ static MY_CHARSET_HANDLER my_charset_handler= mbcharlen_euc_kr, my_numchars_mb, my_charpos_mb, - my_well_formed_len_mb, + my_well_formed_len_euckr, my_lengthsp_8bit, my_numcells_8bit, my_mb_wc_euc_kr, /* mb_wc */ diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index f5d9b2627cd..f3938cc27ba 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -5686,6 +5686,41 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)), } +/* + Returns well formed length of a EUC-KR string. +*/ +static uint +my_well_formed_len_gb2312(CHARSET_INFO *cs __attribute__((unused)), + 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) + { + /* Single byte ascii character */ + b++; + } + else if (b < emb && isgb2312head(*b) && isgb2312tail(b[1])) + { + /* Double byte character */ + b+= 2; + } + else + { + /* Wrong byte sequence */ + *error= 1; + break; + } + } + return (uint) (b - b0); +} + + static MY_COLLATION_HANDLER my_collation_ci_handler = { NULL, /* init */ @@ -5708,7 +5743,7 @@ static MY_CHARSET_HANDLER my_charset_handler= mbcharlen_gb2312, my_numchars_mb, my_charpos_mb, - my_well_formed_len_mb, + my_well_formed_len_gb2312, my_lengthsp_8bit, my_numcells_8bit, my_mb_wc_gb2312, /* mb_wc */ |