tweaks: reduce the maximum character length from six bytes to four
In UTF-8 valid multibyte characters are at most four bytes long, and now that we no longer make use of mblen() and mbtowc() from the underlying system, we won't get five- or six-byte sequences mistakenly reported as valid (by glibc). So it is always enough to reserve space for just four bytes per character.
Этот коммит содержится в:
родитель
c75a3839da
Коммит
debb288115
@ -111,9 +111,9 @@
|
||||
#define REPLACING 1
|
||||
#define INREGION 2
|
||||
|
||||
/* In UTF-8 a character is at most six bytes long. */
|
||||
#ifdef ENABLE_UTF8
|
||||
#define MAXCHARLEN 6
|
||||
/* In UTF-8 a valid character is at most four bytes long. */
|
||||
#define MAXCHARLEN 4
|
||||
#else
|
||||
#define MAXCHARLEN 1
|
||||
#endif
|
||||
|
@ -1804,12 +1804,6 @@ int main(int argc, char **argv)
|
||||
textdomain(PACKAGE);
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_UTF8) && !defined(NANO_TINY)
|
||||
if (MB_CUR_MAX > MAXCHARLEN)
|
||||
fprintf(stderr, "Unexpected large character size: %i bytes"
|
||||
" -- please report a bug\n", (int)MB_CUR_MAX);
|
||||
#endif
|
||||
|
||||
/* Set sensible defaults, different from what Pico does. */
|
||||
SET(NO_WRAP);
|
||||
SET(SMOOTH_SCROLL);
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user