windows compiler fixes and switch_mprintf overflow(32bit only)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15286 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Jeff Lenk 2009-10-30 04:07:49 +00:00
parent 1200a12721
commit 3aa5055bf1
2 changed files with 8 additions and 3 deletions

View 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);

View 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));
}