[PATCH e2fsprogs 08/10] ext2fs: nls: Drop normalization code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No longer necessary after +F design change.

Signed-off-by: Gabriel Krisman Bertazi <krisman@xxxxxxxxxxxxx>
---
 lib/e2p/encoding.c     |  3 +--
 lib/ext2fs/ext2_fs.h   |  2 --
 lib/ext2fs/nls.h       |  4 ----
 lib/ext2fs/nls_ascii.c | 20 --------------------
 lib/ext2fs/nls_utf8.c  | 31 -------------------------------
 5 files changed, 1 insertion(+), 59 deletions(-)

diff --git a/lib/e2p/encoding.c b/lib/e2p/encoding.c
index 23470bdf38a5..62e0aada92c2 100644
--- a/lib/e2p/encoding.c
+++ b/lib/e2p/encoding.c
@@ -36,8 +36,7 @@ static const struct {
 	{
 		.encoding_magic = EXT4_ENC_UTF8_12_0,
 		.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 a1edc54dfd52..80ff02265ee5 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_0	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 c4fcbcb32528..ae56aa9abc89 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 5d513df404c1..cc03fea97ec5 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 426657764fc6..b1698e3c409f 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_0 = {
-- 
2.20.1




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux