From: Gabriel Krisman Bertazi Date: Sun, 28 Apr 2019 20:48:01 +0000 (-0400) Subject: ext2fs: drop Unicode normalization support X-Git-Tag: v1.45.1-rc1~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b6d59d6995a0789119cce3f13824e3f7e7d1913;p=thirdparty%2Fe2fsprogs.git ext2fs: drop Unicode normalization support No longer necessary after +F design change. Signed-off-by: Gabriel Krisman Bertazi Signed-off-by: Theodore Ts'o --- diff --git a/lib/e2p/encoding.c b/lib/e2p/encoding.c index ac7695e94..569d28941 100644 --- a/lib/e2p/encoding.c +++ b/lib/e2p/encoding.c @@ -36,8 +36,7 @@ static const struct { { .encoding_magic = EXT4_ENC_UTF8_12_1, .name = "utf8", - .default_flags = (EXT4_UTF8_NORMALIZATION_TYPE_NFKD | - EXT4_UTF8_CASEFOLD_TYPE_NFKDCF) + .default_flags = 0, }, }; diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h index 8e60929f9..97189d868 100644 --- a/lib/ext2fs/ext2_fs.h +++ b/lib/ext2fs/ext2_fs.h @@ -1132,7 +1132,5 @@ struct mmp_struct { #define EXT4_ENC_UTF8_12_1 1 #define EXT4_ENC_STRICT_MODE_FL (1 << 0) /* Reject invalid sequences */ -#define EXT4_UTF8_NORMALIZATION_TYPE_NFKD (1 << 1) -#define EXT4_UTF8_CASEFOLD_TYPE_NFKDCF (1 << 4) #endif /* _LINUX_EXT2_FS_H */ diff --git a/lib/ext2fs/nls.h b/lib/ext2fs/nls.h index 79593f2a6..ce92f8154 100644 --- a/lib/ext2fs/nls.h +++ b/lib/ext2fs/nls.h @@ -33,10 +33,6 @@ struct nls_table; (sizeof(array) / sizeof(array[0])) struct nls_ops { - int (*normalize)(const struct nls_table *charset, - const unsigned char *str, size_t len, - unsigned char *dest, size_t dlen); - int (*casefold)(const struct nls_table *charset, const unsigned char *str, size_t len, unsigned char *dest, size_t dlen); diff --git a/lib/ext2fs/nls_ascii.c b/lib/ext2fs/nls_ascii.c index 5d513df40..cc03fea97 100644 --- a/lib/ext2fs/nls_ascii.c +++ b/lib/ext2fs/nls_ascii.c @@ -39,28 +39,8 @@ static int ascii_casefold(const struct nls_table *table, return len; } -static int ascii_normalize(const struct nls_table *table, - const unsigned char *str, size_t len, - unsigned char *dest, size_t dlen) -{ - int i; - - if (dlen < len) - return -ENAMETOOLONG; - - for (i = 0; i < len; i++) { - if (str[i] & 0x80) - return -EINVAL; - - dest[i] = str[i]; - } - - return len; -} - const static struct nls_ops ascii_ops = { .casefold = ascii_casefold, - .normalize = ascii_normalize, }; const struct nls_table nls_ascii = { diff --git a/lib/ext2fs/nls_utf8.c b/lib/ext2fs/nls_utf8.c index 3db86572f..857754d64 100644 --- a/lib/ext2fs/nls_utf8.c +++ b/lib/ext2fs/nls_utf8.c @@ -54,39 +54,8 @@ invalid_seq: return -EINVAL; } -static int utf8_normalize(const struct nls_table *table, - const unsigned char *str, size_t len, - unsigned char *dest, size_t dlen) -{ - const struct utf8data *data = utf8nfdi(table->version); - struct utf8cursor cur; - ssize_t nlen = 0; - - if (utf8ncursor(&cur, data, str, len) < 0) - goto invalid_seq; - - for (nlen = 0; nlen < dlen; nlen++) { - dest[nlen] = utf8byte(&cur); - if (!dest[nlen]) - return nlen; - if (dest[nlen] == -1) - break; - } - - return -ENAMETOOLONG; - -invalid_seq: - if (dlen < len) - return -ENAMETOOLONG; - - /* Signal invalid sequence */ - return -EINVAL; -} - const static struct nls_ops utf8_ops = { .casefold = utf8_casefold, - .normalize = utf8_normalize, - }; const struct nls_table nls_utf8_12_1 = {