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

Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Tomas Heinrich 2010-03-26 09:40:47 +01:00 committed by Denys Vlasenko
parent 7724c766bd
commit 1abc07dcca

View File

@ -49,7 +49,11 @@ static void expand(FILE *file, unsigned tab_size, unsigned opt)
unsigned len; unsigned len;
*ptr = '\0'; *ptr = '\0';
# if ENABLE_FEATURE_ASSUME_UNICODE # 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 # else
len = ptr - ptr_strbeg; len = ptr - ptr_strbeg;
# endif # endif
@ -103,9 +107,11 @@ static void unexpand(FILE *file, unsigned tab_size, unsigned opt)
# if ENABLE_FEATURE_ASSUME_UNICODE # if ENABLE_FEATURE_ASSUME_UNICODE
{ {
char c; char c;
uni_stat_t uni_stat;
c = ptr[n]; c = ptr[n];
ptr[n] = '\0'; ptr[n] = '\0';
len = unicode_strlen(ptr); printable_string(&uni_stat, ptr);
len = uni_stat.unicode_width;
ptr[n] = c; ptr[n] = c;
} }
# else # else