diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2008-01-31 20:26:01 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2008-01-31 20:26:01 +0000 |
commit | 1597484cb589da409832f64db94c8ac79ccf468c (patch) | |
tree | ea63fb97e7f3563da47673b3db3fbff6f78eb06d /winsup/cygwin/smallprint.cc | |
parent | 8e87af7ed082bf06a30e226e6bc779c932db625a (diff) | |
download | cygnal-1597484cb589da409832f64db94c8ac79ccf468c.tar.gz cygnal-1597484cb589da409832f64db94c8ac79ccf468c.tar.bz2 cygnal-1597484cb589da409832f64db94c8ac79ccf468c.zip |
* 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.
Diffstat (limited to 'winsup/cygwin/smallprint.cc')
-rw-r--r-- | winsup/cygwin/smallprint.cc | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/winsup/cygwin/smallprint.cc b/winsup/cygwin/smallprint.cc index 9208947e2..36cf6db88 100644 --- a/winsup/cygwin/smallprint.cc +++ b/winsup/cygwin/smallprint.cc @@ -195,24 +195,17 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap) us = va_arg (ap, PUNICODE_STRING); wfillin: { - ANSI_STRING as = { 0, 0, NULL }; - NTSTATUS status; + char *tmp; - if (current_codepage == ansi_cp) - status = RtlUnicodeStringToAnsiString (&as, us, TRUE); - else - status = RtlUnicodeStringToOemString (&as, us, TRUE); - if (!NT_SUCCESS (status)) + if (!sys_wcstombs_alloc (&tmp, PATH_MAX, us->Buffer, + us->Length / sizeof (WCHAR))) { s = "invalid UNICODE_STRING"; goto fillin; } - for (i = 0; i < as.Length; ++i) - *dst++ = as.Buffer[i]; - if (current_codepage == ansi_cp) - RtlFreeAnsiString (&as); - else - RtlFreeOemString (&as); + for (i = 0; *tmp && i < n; i++) + *dst++ = *tmp++; + free (tmp); } break; default: |