diff options
author | Ron Yorston <rmy@pobox.com> | 2023-06-02 11:34:25 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-06-02 11:34:25 +0100 |
commit | bec2426878edb9b8553b4daa27cd34a8e230d465 (patch) | |
tree | b0b64698eaddbdb543d3cdd0241e725337e56c59 | |
parent | d4c67e67ef66173b3991bd67cc0ed5afc577e490 (diff) | |
download | busybox-w32-bec2426878edb9b8553b4daa27cd34a8e230d465.tar.gz busybox-w32-bec2426878edb9b8553b4daa27cd34a8e230d465.tar.bz2 busybox-w32-bec2426878edb9b8553b4daa27cd34a8e230d465.zip |
win32: fix euro symbol handling
Commit 2b4dbe5fa (libbb: speed up bb_get_chunk_from_file()) speeded
up grep by a factor of two. However, it introduced a call to
OemToCharBuff() in bb_get_chunk_from_file() which didn't have the
fix for the euro symbol from commit 93a63809f9 (win32: add support
for the euro currency symbol).
Export the fixed version of OemToCharBuff() and use it.
Saves 8 bytes (64-bit), adds 28 bytes (32-bit)
-rw-r--r-- | include/mingw.h | 5 | ||||
-rw-r--r-- | win32/winansi.c | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/include/mingw.h b/include/mingw.h index e937a9e3c..22c59f483 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -150,6 +150,7 @@ IMPL(setlinebuf, void, ,FILE * UNUSED_PARAM) | |||
150 | * ANSI emulation wrappers | 150 | * ANSI emulation wrappers |
151 | */ | 151 | */ |
152 | 152 | ||
153 | BOOL winansi_OemToCharBuff(LPCSTR s, LPSTR d, DWORD len); | ||
153 | void set_title(const char *str); | 154 | void set_title(const char *str); |
154 | void move_cursor_row(int n); | 155 | void move_cursor_row(int n); |
155 | void reset_screen(void); | 156 | void reset_screen(void); |
@@ -165,6 +166,10 @@ int winansi_fprintf(FILE *stream, const char *format, ...) __attribute__((format | |||
165 | int winansi_write(int fd, const void *buf, size_t count); | 166 | int winansi_write(int fd, const void *buf, size_t count); |
166 | int winansi_read(int fd, void *buf, size_t count); | 167 | int winansi_read(int fd, void *buf, size_t count); |
167 | int winansi_getc(FILE *stream); | 168 | int winansi_getc(FILE *stream); |
169 | #if ENABLE_FEATURE_EURO | ||
170 | # undef OemToCharBuff | ||
171 | # define OemToCharBuff winansi_OemToCharBuff | ||
172 | #endif | ||
168 | #define putchar winansi_putchar | 173 | #define putchar winansi_putchar |
169 | #define puts winansi_puts | 174 | #define puts winansi_puts |
170 | #define fwrite winansi_fwrite | 175 | #define fwrite winansi_fwrite |
diff --git a/win32/winansi.c b/win32/winansi.c index dbdba9626..14fbee75f 100644 --- a/win32/winansi.c +++ b/win32/winansi.c | |||
@@ -746,7 +746,7 @@ static BOOL winansi_CharToOem(LPCSTR s, LPSTR d) | |||
746 | return winansi_CharToOemBuff(s, d, strlen(s)+1); | 746 | return winansi_CharToOemBuff(s, d, strlen(s)+1); |
747 | } | 747 | } |
748 | 748 | ||
749 | static BOOL winansi_OemToCharBuff(LPCSTR s, LPSTR d, DWORD len) | 749 | BOOL winansi_OemToCharBuff(LPCSTR s, LPSTR d, DWORD len) |
750 | { | 750 | { |
751 | WCHAR *buf; | 751 | WCHAR *buf; |
752 | int i; | 752 | int i; |
@@ -771,10 +771,8 @@ static BOOL winansi_OemToCharBuff(LPCSTR s, LPSTR d, DWORD len) | |||
771 | 771 | ||
772 | # undef CharToOemBuff | 772 | # undef CharToOemBuff |
773 | # undef CharToOem | 773 | # undef CharToOem |
774 | # undef OemToCharBuff | ||
775 | # define CharToOemBuff winansi_CharToOemBuff | 774 | # define CharToOemBuff winansi_CharToOemBuff |
776 | # define CharToOem winansi_CharToOem | 775 | # define CharToOem winansi_CharToOem |
777 | # define OemToCharBuff winansi_OemToCharBuff | ||
778 | #endif | 776 | #endif |
779 | 777 | ||
780 | static int ansi_emulate(const char *s, FILE *stream) | 778 | static int ansi_emulate(const char *s, FILE *stream) |