clean up some compiler warnings (no reason to use signed integers for buffer lengths...
authorKevin P. Fleming <kpfleming@digium.com>
Tue, 16 May 2006 21:45:15 +0000 (21:45 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Tue, 16 May 2006 21:45:15 +0000 (21:45 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@27524 65c4cc65-6c06-0410-ace0-fbb531ad65f3

rtp.c

diff --git a/rtp.c b/rtp.c
index cfe1418..841bbbd 100644 (file)
--- a/rtp.c
+++ b/rtp.c
@@ -328,7 +328,7 @@ void ast_rtp_stun_request(struct ast_rtp *rtp, struct sockaddr_in *suggestion, c
        stun_send(rtp->s, suggestion, req);
 }
 
-static int stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *data, int len)
+static int stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *data, size_t len)
 {
        struct stun_header *resp, *hdr = (struct stun_header *)data;
        struct stun_attr *attr;
@@ -339,14 +339,14 @@ static int stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *dat
        
        if (len < sizeof(struct stun_header)) {
                if (option_debug)
-                       ast_log(LOG_DEBUG, "Runt STUN packet (only %d, wanting at least %d)\n", len, sizeof(struct stun_header));
+                       ast_log(LOG_DEBUG, "Runt STUN packet (only %zd, wanting at least %zd)\n", len, sizeof(struct stun_header));
                return -1;
        }
        if (stundebug)
                ast_verbose("STUN Packet, msg %s (%04x), length: %d\n", stun_msg2str(ntohs(hdr->msgtype)), ntohs(hdr->msgtype), ntohs(hdr->msglen));
        if (ntohs(hdr->msglen) > len - sizeof(struct stun_header)) {
                if (option_debug)
-                       ast_log(LOG_DEBUG, "Scrambled STUN packet length (got %d, expecting %d)\n", ntohs(hdr->msglen), len - sizeof(struct stun_header));
+                       ast_log(LOG_DEBUG, "Scrambled STUN packet length (got %d, expecting %zd)\n", ntohs(hdr->msglen), len - sizeof(struct stun_header));
        } else
                len = ntohs(hdr->msglen);
        data += sizeof(struct stun_header);
@@ -354,13 +354,13 @@ static int stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *dat
        while(len) {
                if (len < sizeof(struct stun_attr)) {
                        if (option_debug)
-                               ast_log(LOG_DEBUG, "Runt Attribute (got %d, expecting %d)\n", len, sizeof(struct stun_attr));
+                               ast_log(LOG_DEBUG, "Runt Attribute (got %zd, expecting %zd)\n", len, sizeof(struct stun_attr));
                        break;
                }
                attr = (struct stun_attr *)data;
                if (ntohs(attr->len) > len) {
                        if (option_debug)
-                               ast_log(LOG_DEBUG, "Inconsistant Attribute (length %d exceeds remaining msg len %d)\n", ntohs(attr->len), len);
+                               ast_log(LOG_DEBUG, "Inconsistant Attribute (length %d exceeds remaining msg len %zd)\n", ntohs(attr->len), len);
                        break;
                }
                if (stun_process_attr(&st, attr)) {