]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
windows compiler fixes and switch_mprintf overflow(32bit only)
authorJeff Lenk <jeff@jefflenk.com>
Fri, 30 Oct 2009 04:07:49 +0000 (04:07 +0000)
committerJeff Lenk <jeff@jefflenk.com>
Fri, 30 Oct 2009 04:07:49 +0000 (04:07 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15286 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia_reg.c
src/switch_utils.c

index 1e9e7920a1bebc4fa1700aa6ef416056ee6256ca..9a0625e272a2e53cba5fbc689d2d4d1c0bd13041 100644 (file)
@@ -2083,7 +2083,12 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
                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);
index 80356d0886bc578a430ede89f6b27a11c7b7fcdc..1db491232d7443c511f1eddc0043c2f93af58293 100644 (file)
@@ -1342,7 +1342,7 @@ SWITCH_DECLARE(int) get_addr_int(switch_sockaddr_t *sa)
 {
        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 @@ SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *s
        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));
 }