[git commit master] [un]expand: account for different character widths. +16 bytes.

Denys Vlasenko vda.linux at googlemail.com
Fri Mar 26 08:40:47 UTC 2010


commit: http://git.busybox.net/busybox/commit/?id=1abc07dcca237e6b5c98fea740e59d59c801c9e2
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Tomas Heinrich <heinrich.tomas at gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 coreutils/expand.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/coreutils/expand.c b/coreutils/expand.c
index 2f6a708..60ac9f5 100644
--- a/coreutils/expand.c
+++ b/coreutils/expand.c
@@ -49,7 +49,11 @@ static void expand(FILE *file, unsigned tab_size, unsigned opt)
 				unsigned len;
 				*ptr = '\0';
 # if ENABLE_FEATURE_ASSUME_UNICODE
-				len = unicode_strlen(ptr_strbeg);
+				{
+					uni_stat_t uni_stat;
+					printable_string(&uni_stat, ptr_strbeg);
+					len = uni_stat.unicode_width;
+				}
 # else
 				len = ptr - ptr_strbeg;
 # endif
@@ -103,9 +107,11 @@ static void unexpand(FILE *file, unsigned tab_size, unsigned opt)
 # if ENABLE_FEATURE_ASSUME_UNICODE
 			{
 				char c;
+				uni_stat_t uni_stat;
 				c = ptr[n];
 				ptr[n] = '\0';
-				len = unicode_strlen(ptr);
+				printable_string(&uni_stat, ptr);
+				len = uni_stat.unicode_width;
 				ptr[n] = c;
 			}
 # else
-- 
1.6.3.3



More information about the busybox-cvs mailing list