* autoload (noload): Avoid clobbering bx register.

* environ.cc (codepage_init): Use case insensitive match.
* fhandler_console.cc (cp_get_internal): Delete.
(con_to_str): Use get_cp to derive code page.
(str_to_con): Ditto.
* miscfuncs.cc (get_cp): New function.
(sys_wcstombs): New function.  Converted from macro.
(sys_mbstowcs): Ditto.
* winsup.h: Reflect above changes.
This commit is contained in:
Christopher Faylor
2002-06-26 05:29:41 +00:00
parent 109e482278
commit f279e522b0
6 changed files with 52 additions and 25 deletions

View File

@ -11,6 +11,8 @@ details. */
#include "winsup.h"
#include "cygerrno.h"
#include <sys/errno.h>
#include <winbase.h>
#include <winnls.h>
long tls_ix = -1;
@ -176,3 +178,21 @@ __check_invalid_read_ptr_errno (const void *s, unsigned sz)
return 0;
return set_errno (EFAULT);
}
UINT
get_cp ()
{
return current_codepage == ansi_cp ? GetACP() : GetOEMCP();
}
int __stdcall
sys_wcstombs (char *tgt, const WCHAR *src, int len)
{
return WideCharToMultiByte (get_cp (), 0, src, -1, tgt, len, NULL, NULL);
}
int __stdcall
sys_mbstowcs (WCHAR *tgt, const char *src, int len)
{
return MultiByteToWideChar (get_cp (), 0, src, -1, tgt, len);
}