Revision
15286
Author
jlenk
Date
2009-10-29 23:07:49 -0500 (Thu, 29 Oct 2009)

Log Message

windows compiler fixes and switch_mprintf overflow(32bit only)

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (15285 => 15286)


--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	2009-10-30 02:39:24 UTC (rev 15285)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	2009-10-30 04:07:49 UTC (rev 15286)
@@ -2083,7 +2083,12 @@
 		char *sql;
 
 		x = get_nc(nc, sip);
-		sql = switch_mprintf("update sip_authentication set expires='%ld',last_nc=%lu where nonce='%s'", 
+#ifdef _WIN32 && !_WIN64
+#define	LL_FMT "ll"
+#else
+#define	LL_FMT "l"
+#endif
+		sql = switch_mprintf("update sip_authentication set expires='%"LL_FMT"u',last_nc=%lu where nonce='%s'", 
 							 switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : exptime + 10), x, nonce);
 
 		switch_assert(sql != NULL);

Modified: freeswitch/trunk/src/switch_utils.c (15285 => 15286)


--- freeswitch/trunk/src/switch_utils.c	2009-10-30 02:39:24 UTC (rev 15285)
+++ freeswitch/trunk/src/switch_utils.c	2009-10-30 04:07:49 UTC (rev 15286)
@@ -1342,7 +1342,7 @@
 {
 	struct sockaddr_in *s = (struct sockaddr_in *)&sa->sa;
 
-	return ntohs(s->sin_addr.s_addr);
+	return ntohs((unsigned short)s->sin_addr.s_addr);
 }
 
 
@@ -1351,7 +1351,7 @@
 	struct sockaddr_in *s1 = (struct sockaddr_in *)&sa1->sa;
 	struct sockaddr_in *s2 = (struct sockaddr_in *)&sa2->sa;
 
-	return (ntohs(s1->sin_addr.s_addr) == ntohs(s2->sin_addr.s_addr) && ntohs(s1->sin_port) == ntohs(s2->sin_port));
+	return (ntohs((unsigned short)s1->sin_addr.s_addr) == ntohs((unsigned short)s2->sin_addr.s_addr) && ntohs(s1->sin_port) == ntohs(s2->sin_port));
 }