[Sumover-dev] [svn commit] r4458 - common/trunk/src

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Thu Jun 4 16:01:53 BST 2009


Author: piers
Date: Thu Jun  4 16:01:52 2009
New Revision: 4458

Modified:
   common/trunk/src/getaddrinfo.c
   common/trunk/src/inet_ntop.c
   common/trunk/src/inet_ntop.h
   common/trunk/src/inet_pton.c
   common/trunk/src/inet_pton.h
   common/trunk/src/mbus_parser.c
   common/trunk/src/net_udp.h

Log:
Updates to fix INET_PTON on WinXP and Vista

Modified: common/trunk/src/getaddrinfo.c
==============================================================================
--- common/trunk/src/getaddrinfo.c	(original)
+++ common/trunk/src/getaddrinfo.c	Thu Jun  4 16:01:52 2009
@@ -768,7 +768,7 @@
 	afd = find_afd(pai->ai_family);
 	flags = pai->ai_flags;
 
-	if (inet_pton(afd->a_af, hostname, pton) == 1) {
+	if (INET_PTON(afd->a_af, hostname, pton) == 1) {
 		uint32_t v4a;
 #ifdef INET6
 		u_char pfx;

Modified: common/trunk/src/inet_ntop.c
==============================================================================
--- common/trunk/src/inet_ntop.c	(original)
+++ common/trunk/src/inet_ntop.c	Thu Jun  4 16:01:52 2009
@@ -45,7 +45,7 @@
  *	Paul Vixie, 1996.
  */
 const char *
-inet_ntop(af, src, dst, size)
+inet_ntop_ucl(af, src, dst, size)
 	int af;
 	const void *src;
 	char *dst;

Modified: common/trunk/src/inet_ntop.h
==============================================================================
--- common/trunk/src/inet_ntop.h	(original)
+++ common/trunk/src/inet_ntop.h	Thu Jun  4 16:01:52 2009
@@ -1,13 +1,16 @@
 #ifndef __INET_NTOP_H__
 #define __INET_NTOP_H__
 
-#ifdef NEED_INET_NTOP
+#ifndef NEED_INET_NTOP
+#define INET_NTOP inet_ntop
+#else
+#define INET_NTOP inet_ntop_ucl
 
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-const char *inet_ntop(int af, const void *src, char *dst,socklen_t size  size);
+const char *inet_ntop_ucl(int af, const void *src, char *dst, size_t size);
 
 #if defined(__cplusplus)
 }

Modified: common/trunk/src/inet_pton.c
==============================================================================
--- common/trunk/src/inet_pton.c	(original)
+++ common/trunk/src/inet_pton.c	Thu Jun  4 16:01:52 2009
@@ -49,7 +49,7 @@
  *	Paul Vixie, 1996.
  */
 int
-inet_pton(af, src, dst)
+inet_pton_ucl(af, src, dst)
 	int af;
 	const char *src;
 	void *dst;

Modified: common/trunk/src/inet_pton.h
==============================================================================
--- common/trunk/src/inet_pton.h	(original)
+++ common/trunk/src/inet_pton.h	Thu Jun  4 16:01:52 2009
@@ -1,9 +1,12 @@
-#ifdef NEED_INET_PTON
+#ifndef NEED_INET_PTON
+#define INET_PTON inet_pton
+#else
+#define INET_PTON inet_pton_ucl
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-int inet_pton(int af, const char *src, void *dst);
+int inet_pton_ucl(int af, const char *src, void *dst);
 
 #if defined(__cplusplus)
 }

Modified: common/trunk/src/mbus_parser.c
==============================================================================
--- common/trunk/src/mbus_parser.c	(original)
+++ common/trunk/src/mbus_parser.c	Thu Jun  4 16:01:52 2009
@@ -29,12 +29,14 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
+//#define _CRT_ERRNO_DEFINED
 
 #include "config_unix.h"
 #include "config_win32.h"
 #include "debug.h"
 #include "memory.h"
 #include "mbus_parser.h"
+#include <stddef.h>
 
 #define MBUS_PARSER_MAGIC 0xbadface
 
@@ -237,10 +239,13 @@
 
 	assert(m->magic == MBUS_PARSER_MAGIC);
 
-        while (isspace((unsigned char)*m->buffer)) {
-                m->buffer++;
+    while (isspace((unsigned char)*m->buffer)) {
+        m->buffer++;
 		CHECK_OVERRUN;
-        }
+    }
+	/* Have to set errno to zero before checking for it as strtol/etc doesn't change it if 
+	it is already set */
+	errno = 0;
 
 	*d = strtod(m->buffer, &p);
 	if (errno == ERANGE) {

Modified: common/trunk/src/net_udp.h
==============================================================================
--- common/trunk/src/net_udp.h	(original)
+++ common/trunk/src/net_udp.h	Thu Jun  4 16:01:52 2009
@@ -57,10 +57,10 @@
 const char *udp_host_addr(socket_udp *s);
 int         udp_fd(socket_udp *s);
 
-int         udp_select( fd_set *readset, int max_fd, struct timeval *timeout);
-void        udp_fd_zero( fd_set *readset, int *max_fd );
-void        udp_fd_set( fd_set *readset, int *max_fd, socket_udp *s);
-int         udp_fd_isset( fd_set *readset, int *max_fd, socket_udp *s);
+int         udp_select( fd_set *readset, fd_t max_fd, struct timeval *timeout);
+void        udp_fd_zero( fd_set *readset, fd_t *max_fd );
+void        udp_fd_set( fd_set *readset, fd_t *max_fd, socket_udp *s);
+int         udp_fd_isset( fd_set *readset, fd_t *max_fd, socket_udp *s);
 
 #if defined(__cplusplus)
 }



More information about the Sumover-dev mailing list