From 4b65f190450f70bd5819bb5c18e3370d75ffebde Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 6 Feb 2008 18:24:50 +0000 Subject: * fhandler.h (fhandler_console::trunc_buf): Add to use as cache for truncated multibyte characters on input. (fhandler_console::write_replacement_char): Declare new method. * fhandler_console.cc (CONVERT_LIMIT): Raise to 64K. (fhandler_console::fhandler_console): Initialize trunc_buf. (ERR): Define as independent value again. (fhandler_console::write_replacement_char): New method to print replacement chars. (fhandler_console::write_normal): Add handling for truncated multibyte sequences. Call next_char instead of pathetic CharNextExA function. Don't change src, rather just work with found later on. * miscfuncs.cc (is_cp_multibyte): Move here from strfuncs.cc. Don't call Windows function, restrict to well-known ANSI/OEM codepages and UTF-8. (next_char): Call CharNextExA only for doublebyte codepages. Implement for UTF-8 here. * strfuncs.cc (is_cp_multibyte): Move to miscfuncs.cc. * winsup.h (next_char): Declare. * include/limits.h (MB_LEN_MAX): Set to maximum value of MB_CUR_MAX as defined by newlib for now. --- winsup/cygwin/winsup.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'winsup/cygwin/winsup.h') diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index f88f23fab..952292862 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -110,6 +110,7 @@ extern const char case_folded_upper[]; /* The one function we use from winuser.h most of the time */ extern "C" DWORD WINAPI GetLastError (void); +/* Codepage and multibyte string specific stuff. */ enum codepage_type {ansi_cp, oem_cp, utf8_cp}; extern codepage_type current_codepage; extern UINT active_codepage; @@ -117,6 +118,8 @@ extern UINT active_codepage; void codepage_init (const char *buf); UINT get_cp (); bool is_cp_multibyte (UINT cp); +const unsigned char *next_char (UINT cp, const unsigned char *str, + const unsigned char *end); /* Used as type by sys_wcstombs_alloc and sys_mbstowcs_alloc. For a description see there. */ -- cgit v1.2.3