1
0
Fork 0
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:
nobu 2014-04-05 23:51:27 +00:00
parent cce3aa754b
commit ac4e60bfb2
2 changed files with 8 additions and 6 deletions

View file

@ -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_wrap_io_handle(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***

View file

@ -1197,8 +1197,8 @@ is_batch(const char *cmd)
}
static UINT filecp(void);
static WCHAR *mbstr_to_wstr(UINT, const char *, int, long *);
static char *wstr_to_mbstr(UINT, const WCHAR *, int, long *);
#define mbstr_to_wstr rb_w32_mbstr_to_wstr
#define wstr_to_mbstr rb_w32_wstr_to_mbstr
#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 filecp_to_wstr(str, plen) mbstr_to_wstr(filecp(), str, -1, plen)
@ -1952,8 +1952,8 @@ filecp(void)
}
/* License: Ruby's */
static char *
wstr_to_mbstr(UINT cp, const WCHAR *wstr, int clen, long *plen)
char *
rb_w32_wstr_to_mbstr(UINT cp, const WCHAR *wstr, int clen, long *plen)
{
char *ptr;
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 */
static WCHAR *
mbstr_to_wstr(UINT cp, const char *str, int clen, long *plen)
WCHAR *
rb_w32_mbstr_to_wstr(UINT cp, const char *str, int clen, long *plen)
{
WCHAR *ptr;
int len = MultiByteToWideChar(cp, 0, str, clen, NULL, 0);