[前][次][番号順一覧][スレッド一覧]

ruby-changes:33071

From: nobu <ko1@a...>
Date: Sun, 23 Feb 2014 11:54:09 +0900 (JST)
Subject: [ruby-changes:33071] nobu:r45150 (trunk): win32/win32.c: add rb_w32_inet_pton

nobu	2014-02-23 11:54:04 +0900 (Sun, 23 Feb 2014)

  New Revision: 45150

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45150

  Log:
    win32/win32.c: add rb_w32_inet_pton
    
    * include/ruby/win32.h, win32/win32.c (rb_w32_inet_pton): add a
      wrapper function for inet_pton minimum supported client is
      Vista, as well as inet_ntop.

  Modified files:
    trunk/ChangeLog
    trunk/include/ruby/win32.h
    trunk/win32/win32.c
Index: include/ruby/win32.h
===================================================================
--- include/ruby/win32.h	(revision 45149)
+++ include/ruby/win32.h	(revision 45150)
@@ -309,6 +309,7 @@ extern char **rb_w32_get_environ(void); https://github.com/ruby/ruby/blob/trunk/include/ruby/win32.h#L309
 extern void   rb_w32_free_environ(char **);
 extern int    rb_w32_map_errno(DWORD);
 extern const char *WSAAPI rb_w32_inet_ntop(int,const void *,char *,size_t);
+extern int WSAAPI rb_w32_inet_pton(int,const char *,void *);
 extern DWORD  rb_w32_osver(void);
 
 extern int chown(const char *, int, int);
@@ -657,6 +658,9 @@ extern char *rb_w32_strerror(int); https://github.com/ruby/ruby/blob/trunk/include/ruby/win32.h#L658
 #undef inet_ntop
 #define inet_ntop(f,a,n,l)      rb_w32_inet_ntop(f,a,n,l)
 
+#undef inet_pton
+#define inet_pton(f,s,d)        rb_w32_inet_pton(f,s,d)
+
 #undef accept
 #define accept(s, a, l)		rb_w32_accept(s, a, l)
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45149)
+++ ChangeLog	(revision 45150)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Feb 23 11:54:02 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* include/ruby/win32.h, win32/win32.c (rb_w32_inet_pton): add a
+	  wrapper function for inet_pton minimum supported client is
+	  Vista, as well as inet_ntop.
+
 Sun Feb 23 11:33:25 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
 
 	* test/net/imap/test_imap.rb: remove unused variables.
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 45149)
+++ win32/win32.c	(revision 45150)
@@ -6959,6 +6959,19 @@ rb_w32_inet_ntop(int af, const void *add https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L6959
 }
 
 /* License: Ruby's */
+int WSAAPI
+rb_w32_inet_pton(int af, const char *src, void *dst)
+{
+    typedef int (WSAAPI inet_pton_t)(int, const char*, void *);
+    inet_pton_t *pInetPton;
+    pInetPton = (inet_pton_t *)get_proc_address("ws2_32", "inet_pton", NULL);
+    if (pInetPton) {
+	return pInetPton(af, src, dst);
+    }
+    return 0;
+}
+
+/* License: Ruby's */
 char
 rb_w32_fd_is_text(int fd)
 {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]