mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
win32.c: wchar conversion
* win32/win32.c (rb_w32_wstr_to_mbstr, rb_w32_mbstr_to_wstr): make WCHAR/mb conversion functions public. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cce3aa754b
commit
ac4e60bfb2
2 changed files with 8 additions and 6 deletions
|
@ -781,6 +781,8 @@ int rb_w32_wait_events_blocking(HANDLE *events, int num, DWORD timeout);
|
||||||
int rb_w32_time_subtract(struct timeval *rest, const struct timeval *wait);
|
int rb_w32_time_subtract(struct timeval *rest, const struct timeval *wait);
|
||||||
int rb_w32_wrap_io_handle(HANDLE, int);
|
int rb_w32_wrap_io_handle(HANDLE, int);
|
||||||
int rb_w32_unwrap_io_handle(int);
|
int rb_w32_unwrap_io_handle(int);
|
||||||
|
WCHAR *rb_w32_mbstr_to_wstr(UINT, const char *, int, long *);
|
||||||
|
char *rb_w32_wstr_to_mbstr(UINT, const WCHAR *, int, long *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
== ***CAUTION***
|
== ***CAUTION***
|
||||||
|
|
|
@ -1197,8 +1197,8 @@ is_batch(const char *cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
static UINT filecp(void);
|
static UINT filecp(void);
|
||||||
static WCHAR *mbstr_to_wstr(UINT, const char *, int, long *);
|
#define mbstr_to_wstr rb_w32_mbstr_to_wstr
|
||||||
static char *wstr_to_mbstr(UINT, const WCHAR *, int, long *);
|
#define wstr_to_mbstr rb_w32_wstr_to_mbstr
|
||||||
#define acp_to_wstr(str, plen) mbstr_to_wstr(CP_ACP, str, -1, plen)
|
#define acp_to_wstr(str, plen) mbstr_to_wstr(CP_ACP, str, -1, plen)
|
||||||
#define wstr_to_acp(str, plen) wstr_to_mbstr(CP_ACP, str, -1, plen)
|
#define wstr_to_acp(str, plen) wstr_to_mbstr(CP_ACP, str, -1, plen)
|
||||||
#define filecp_to_wstr(str, plen) mbstr_to_wstr(filecp(), str, -1, plen)
|
#define filecp_to_wstr(str, plen) mbstr_to_wstr(filecp(), str, -1, plen)
|
||||||
|
@ -1952,8 +1952,8 @@ filecp(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* License: Ruby's */
|
/* License: Ruby's */
|
||||||
static char *
|
char *
|
||||||
wstr_to_mbstr(UINT cp, const WCHAR *wstr, int clen, long *plen)
|
rb_w32_wstr_to_mbstr(UINT cp, const WCHAR *wstr, int clen, long *plen)
|
||||||
{
|
{
|
||||||
char *ptr;
|
char *ptr;
|
||||||
int len = WideCharToMultiByte(cp, 0, wstr, clen, NULL, 0, NULL, NULL);
|
int len = WideCharToMultiByte(cp, 0, wstr, clen, NULL, 0, NULL, NULL);
|
||||||
|
@ -1968,8 +1968,8 @@ wstr_to_mbstr(UINT cp, const WCHAR *wstr, int clen, long *plen)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* License: Ruby's */
|
/* License: Ruby's */
|
||||||
static WCHAR *
|
WCHAR *
|
||||||
mbstr_to_wstr(UINT cp, const char *str, int clen, long *plen)
|
rb_w32_mbstr_to_wstr(UINT cp, const char *str, int clen, long *plen)
|
||||||
{
|
{
|
||||||
WCHAR *ptr;
|
WCHAR *ptr;
|
||||||
int len = MultiByteToWideChar(cp, 0, str, clen, NULL, 0);
|
int len = MultiByteToWideChar(cp, 0, str, clen, NULL, 0);
|
||||||
|
|
Loading…
Reference in a new issue