* 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:
@ -17,7 +17,7 @@ details. */
|
||||
#include <wingdi.h>
|
||||
#include <winuser.h>
|
||||
#include <wincon.h>
|
||||
#include <winnls.h> // MultiByteToWideChar () and friends
|
||||
#include <winnls.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/cygwin.h>
|
||||
#include "cygerrno.h"
|
||||
@ -32,16 +32,8 @@ details. */
|
||||
|
||||
#define CONVERT_LIMIT 4096
|
||||
|
||||
/* The codepages are resolved here instead of using CP_ACP and
|
||||
CP_OEMCP, so that they can later be compared for equality. */
|
||||
inline UINT
|
||||
cp_get_internal ()
|
||||
{
|
||||
return current_codepage == ansi_cp ? GetACP() : GetOEMCP();
|
||||
}
|
||||
|
||||
static BOOL
|
||||
cp_convert (UINT destcp, char * dest, UINT srccp, const char * src, DWORD size)
|
||||
cp_convert (UINT destcp, char *dest, UINT srccp, const char *src, DWORD size)
|
||||
{
|
||||
if (!size)
|
||||
/* no action */;
|
||||
@ -68,13 +60,13 @@ cp_convert (UINT destcp, char * dest, UINT srccp, const char * src, DWORD size)
|
||||
inline BOOL
|
||||
con_to_str (char *d, const char *s, DWORD sz)
|
||||
{
|
||||
return cp_convert (cp_get_internal (), d, GetConsoleCP (), s, sz);
|
||||
return cp_convert (get_cp (), d, GetConsoleCP (), s, sz);
|
||||
}
|
||||
|
||||
inline BOOL
|
||||
str_to_con (char *d, const char *s, DWORD sz)
|
||||
{
|
||||
return cp_convert (GetConsoleOutputCP (), d, cp_get_internal (), s, sz);
|
||||
return cp_convert (GetConsoleOutputCP (), d, get_cp (), s, sz);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user