ruby-changes:33442
From: nobu <ko1@a...>
Date: Sun, 6 Apr 2014 08:51:38 +0900 (JST)
Subject: [ruby-changes:33442] nobu:r45521 (trunk): win32.c: wchar conversion
nobu 2014-04-06 08:51:27 +0900 (Sun, 06 Apr 2014) New Revision: 45521 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45521 Log: win32.c: wchar conversion * win32/win32.c (rb_w32_wstr_to_mbstr, rb_w32_mbstr_to_wstr): make WCHAR/mb conversion functions public. Modified files: trunk/include/ruby/win32.h trunk/win32/win32.c Index: include/ruby/win32.h =================================================================== --- include/ruby/win32.h (revision 45520) +++ include/ruby/win32.h (revision 45521) @@ -781,6 +781,8 @@ int rb_w32_wait_events_blocking(HANDLE https://github.com/ruby/ruby/blob/trunk/include/ruby/win32.h#L781 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*** Index: win32/win32.c =================================================================== --- win32/win32.c (revision 45520) +++ win32/win32.c (revision 45521) @@ -1197,8 +1197,8 @@ is_batch(const char *cmd) https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1197 } 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) https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1952 } /* 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 https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1968 } /* 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/