From 8783b77f5b102e14378a759d556cae4cdf3efc2b Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Mon, 7 Sep 1998 13:39:15 +0000 Subject: [PATCH] (STRING_CHAR_AND_LENGTH): Return correct value in ACTUAL_LEN even if LEN is too short to have a valid multibyte form. (STRING_CHAR_AND_CHAR_LENGTH): Likewise. --- src/charset.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/charset.h b/src/charset.h index d2fd94e6ade..b25e66a5632 100644 --- a/src/charset.h +++ b/src/charset.h @@ -587,16 +587,14 @@ extern int iso_charset_table[2][2][128]; MULTIBYTE_FORM_LENGTH. */ #define STRING_CHAR_AND_LENGTH(str, len, actual_len) \ - ((BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) == 1 \ - || BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) > (len)) \ + (BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) == 1 \ ? (actual_len = 1), (unsigned char) *(str) \ : string_to_non_ascii_char (str, len, &actual_len, 0)) /* This is like STRING_CHAR_AND_LENGTH but the third arg ACTUAL_LEN does not include garbage bytes following the multibyte character. */ -#define STRING_CHAR_AND_CHAR_LENGTH(str, len, actual_len) \ - ((BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) == 1 \ - || BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) > (len)) \ +#define STRING_CHAR_AND_CHAR_LENGTH(str, len, actual_len) \ + (BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) == 1 \ ? (actual_len = 1), (unsigned char) *(str) \ : string_to_non_ascii_char (str, len, &actual_len, 1)) -- 2.39.2