summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbar@mysql.com <>2005-12-12 21:42:09 +0400
committerbar@mysql.com <>2005-12-12 21:42:09 +0400
commit9ac6e558d44706519561f9e1234044fa850737cc (patch)
tree6c15cf077b53c2157ad83b68ecbe604863e5aabf /include
parentdd7d2d0a115b2b0888a48bced42b2bd3eafcb957 (diff)
downloadmariadb-git-9ac6e558d44706519561f9e1234044fa850737cc.tar.gz
Bug#15375 Unassigned multibyte codes are broken
into parts when converting to Unicode. m_ctype.h: Reorganizing mb_wc return codes to be able to return "an unassigned N-byte-long character". sql_string.cc: Adding code to detect and properly handle unassigned characters (i.e. the those character which are correctly formed according to the character specifications, but don't have Unicode mapping). Many files: Fixing conversion function to return new codes. ctype_ujis.test, ctype_gbk.test, ctype_big5.test: Adding a test case. ctype_ujis.result, ctype_gbk.result, ctype_big5.result: Fixing results accordingly.
Diffstat (limited to 'include')
-rw-r--r--include/m_ctype.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/include/m_ctype.h b/include/m_ctype.h
index a5dc7cc00c6..a6ffbaa713f 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -44,10 +44,19 @@ typedef struct unicase_info_st
uint16 sort;
} MY_UNICASE_INFO;
-#define MY_CS_ILSEQ 0
-#define MY_CS_ILUNI 0
-#define MY_CS_TOOSMALL -1
-#define MY_CS_TOOFEW(n) (-1-(n))
+
+/* wm_wc and wc_mb return codes */
+#define MY_CS_ILSEQ 0 /* Wrong by sequence: wb_wc */
+#define MY_CS_ILUNI 0 /* Cannot encode Unicode to charset: wc_mb */
+#define MY_CS_TOOSMALL -101 /* Need at least one byte: wc_mb and mb_wc */
+#define MY_CS_TOOSMALL2 -102 /* Need at least two bytes: wc_mb and mb_wc */
+#define MY_CS_TOOSMALL3 -103 /* Need at least three bytes: wc_mb and mb_wc */
+/* These following three are currently not really used */
+#define MY_CS_TOOSMALL4 -104 /* Need at least 4 bytes: wc_mb and mb_wc */
+#define MY_CS_TOOSMALL5 -105 /* Need at least 5 bytes: wc_mb and mb_wc */
+#define MY_CS_TOOSMALL6 -106 /* Need at least 6 bytes: wc_mb and mb_wc */
+/* A helper macros for "need at least n bytes" */
+#define MY_CS_TOOSMALLN(n) (-100-(n))
#define MY_SEQ_INTTAIL 1
#define MY_SEQ_SPACES 2