From 1597484cb589da409832f64db94c8ac79ccf468c Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 31 Jan 2008 20:26:01 +0000 Subject: * dcrt0.cc (dll_crt0_1): Use GetCommandLineW and convert to current codepage. * environ.cc (set_file_api_mode): Always set file api to ANSI if not using the OEM codepage. (codepage_init): Allow "utf8" codepage. * fhandler_clipboard.cc (set_clipboard): Convert clipbuf to void and cast as needed. Always convert input to wide char and write CF_UNICODETEXT to clipboard. (fhandler_dev_clipboard::read): Read CF_UNICODETEXT from clipboard and convert to current codepage if CYGWIN_NATIVE format is not available. * fhandler_console.cc: Drop redundant undef. * smallprint.cc (__small_vsprintf): Convert PWCHAR and UNICODE_STRING to current codepage for printing. * strfuncs.cc: Use PWCHAR throughout. (get_cp): Return CP_UTF8 for utf8_cp codepage setting. (sys_wcstombs): Allow NULL target buffer. (sys_wcstombs_alloc): New function. (sys_mbstowcs_alloc): Ditto. * winsup.h (codepage_type): Add utf8_cp. (HEAP_NOTHEAP): Define. (sys_wcstombs_alloc): Declare. (sys_mbstowcs_alloc): Declare. --- winsup/cygwin/winsup.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'winsup/cygwin/winsup.h') diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 5b4b573f5..505326cec 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -110,15 +110,23 @@ extern const char case_folded_upper[]; /* The one function we use from winuser.h most of the time */ extern "C" DWORD WINAPI GetLastError (void); -enum codepage_type {ansi_cp, oem_cp}; +enum codepage_type {ansi_cp, oem_cp, utf8_cp}; extern codepage_type current_codepage; UINT get_cp (); -int __stdcall sys_wcstombs(char *, int, const WCHAR *, int = -1) +/* Used as type by sys_wcstombs_alloc and sys_mbstowcs_alloc. For a + description see there. */ +#define HEAP_NOTHEAP -1 + +int __stdcall sys_wcstombs (char *, int, const PWCHAR, int = -1) + __attribute__ ((regparm(3))); +int __stdcall sys_wcstombs_alloc (char **, int, const PWCHAR, int = -1) __attribute__ ((regparm(3))); -int __stdcall sys_mbstowcs(WCHAR *, const char *, int) +int __stdcall sys_mbstowcs (PWCHAR, const char *, int) + __attribute__ ((regparm(3))); +int __stdcall sys_mbstowcs_alloc (PWCHAR *, int, const char *) __attribute__ ((regparm(3))); /* Used to check if Cygwin DLL is dynamically loaded. */ -- cgit v1.2.3