diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2024-04-02 11:56:10 +0300 |
---|---|---|
committer | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2024-04-02 21:02:26 +0300 |
commit | d83942876e089a63526b9624c74407cdefd6b4ac (patch) | |
tree | d9ac730be8ab3b95927a1a9a9606c42f75978380 | |
parent | 95e0a07f891947c5c2d66cd837a5aa379b962308 (diff) | |
download | busybox-w32-d83942876e089a63526b9624c74407cdefd6b4ac.tar.gz busybox-w32-d83942876e089a63526b9624c74407cdefd6b4ac.tar.bz2 busybox-w32-d83942876e089a63526b9624c74407cdefd6b4ac.zip |
win32: unicode: new wcwidth: allow enabling bidi
interval, in_interval_table, and in_uint16_table were previously
not compiled when using the new wcwidth (commit c188a345a) because
they're used by the old wcwidth but not by the new one.
But they're also used by the BIDI routines. mingw64u_defconfig doesn't
enable bidi (rightly - it's not working well), but it'd still be nice
to allow enabling bidi while the new wcwidth is in effect.
Enable the tables lookup code if BIDI is enabled.
-rw-r--r-- | libbb/unicode.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libbb/unicode.c b/libbb/unicode.c index 22e45878a..acc7cd8df 100644 --- a/libbb/unicode.c +++ b/libbb/unicode.c | |||
@@ -276,8 +276,9 @@ int FAST_FUNC iswpunct(wint_t wc) | |||
276 | return (unsigned)wc <= 0x7f && ispunct(wc); | 276 | return (unsigned)wc <= 0x7f && ispunct(wc); |
277 | } | 277 | } |
278 | 278 | ||
279 | # if !ENABLE_PLATFORM_MINGW32 || CONFIG_LAST_SUPPORTED_WCHAR < 0x30000 | 279 | #define WCWIDTH_ALT (ENABLE_PLATFORM_MINGW32 && CONFIG_LAST_SUPPORTED_WCHAR >= 0x30000) |
280 | 280 | ||
281 | # if !WCWIDTH_ALT || ENABLE_UNICODE_BIDI_SUPPORT | ||
281 | # if CONFIG_LAST_SUPPORTED_WCHAR >= 0x300 | 282 | # if CONFIG_LAST_SUPPORTED_WCHAR >= 0x300 |
282 | struct interval { | 283 | struct interval { |
283 | uint16_t first; | 284 | uint16_t first; |
@@ -334,7 +335,9 @@ static int in_uint16_table(unsigned ucs, const uint16_t *table, unsigned max) | |||
334 | return 0; | 335 | return 0; |
335 | } | 336 | } |
336 | # endif | 337 | # endif |
338 | # endif /* !WCWIDTH_ALT || ENABLE_UNICODE_BIDI_SUPPORT */ | ||
337 | 339 | ||
340 | # if !WCWIDTH_ALT | ||
338 | 341 | ||
339 | /* | 342 | /* |
340 | * This is an implementation of wcwidth() and wcswidth() (defined in | 343 | * This is an implementation of wcwidth() and wcswidth() (defined in |
@@ -704,7 +707,7 @@ int FAST_FUNC wcwidth(unsigned ucs) | |||
704 | # endif /* >= 0x300 */ | 707 | # endif /* >= 0x300 */ |
705 | } | 708 | } |
706 | 709 | ||
707 | # else /* ENABLE_PLATFORM_MINGW32 && CONFIG_LAST_SUPPORTED_WCHAR >= 0x30000 */ | 710 | # else /* WCWIDTH_ALT */ |
708 | # include "wcwidth_alt.c" /* simpler and more up-to-date implementation */ | 711 | # include "wcwidth_alt.c" /* simpler and more up-to-date implementation */ |
709 | # endif | 712 | # endif |
710 | 713 | ||