diff options
author | Kinsey Moore <kmoore@digium.com> | 2014-05-09 22:49:26 +0000 |
---|---|---|
committer | Kinsey Moore <kmoore@digium.com> | 2014-05-09 22:49:26 +0000 |
commit | abd3e4040bd76058d0148884879858894258fb9f (patch) | |
tree | c5695a0880c4928731b1aa864f862c6cffa57428 /channels/chan_sip.c | |
parent | f3b55da1b855b12a59f84fd9bf6768eb101cd910 (diff) |
Allow Asterisk to compile under GCC 4.10
This resolves a large number of compiler warnings from GCC 4.10 which
cause the build to fail under dev mode. The vast majority are
signed/unsigned mismatches in printf-style format strings.
........
Merged revisions 413586 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 413587 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 413588 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 1f9453cb4..16a8a55e0 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -863,7 +863,7 @@ static int regobjs = 0; /*!< Registry objects */ /*! @} */ static struct ast_flags global_flags[3] = {{0}}; /*!< global SIP_ flags */ -static int global_t38_maxdatagram; /*!< global T.38 FaxMaxDatagram override */ +static unsigned int global_t38_maxdatagram; /*!< global T.38 FaxMaxDatagram override */ static struct stasis_subscription *network_change_sub; /*!< subscription id for network change events */ static struct stasis_subscription *acl_change_sub; /*!< subscription id for named ACL system change events */ @@ -3289,7 +3289,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s } break; default: - ast_log(LOG_ERROR, "Unknown tcptls thread alert '%d'\n", alert); + ast_log(LOG_ERROR, "Unknown tcptls thread alert '%u'\n", alert); } } } @@ -3539,7 +3539,7 @@ void dialog_unlink_all(struct sip_pvt *dialog) void *registry_unref(struct sip_registry *reg, char *tag) { - ast_debug(3, "SIP Registry %s: refcount now %d\n", reg->hostname, reg->refcount - 1); + ast_debug(3, "SIP Registry %s: refcount now %u\n", reg->hostname, reg->refcount - 1); ASTOBJ_UNREF(reg, sip_registry_destroy); return NULL; } @@ -3547,7 +3547,7 @@ void *registry_unref(struct sip_registry *reg, char *tag) /*! \brief Add object reference to SIP registry */ static struct sip_registry *registry_addref(struct sip_registry *reg, char *tag) { - ast_debug(3, "SIP Registry %s: refcount now %d\n", reg->hostname, reg->refcount + 1); + ast_debug(3, "SIP Registry %s: refcount now %u\n", reg->hostname, reg->refcount + 1); return ASTOBJ_REF(reg); /* Add pointer to registry in packet */ } @@ -3985,7 +3985,7 @@ static void build_via(struct sip_pvt *p) snprintf(p->via, sizeof(p->via), "SIP/2.0/%s %s;branch=z9hG4bK%08x%s", get_transport_pvt(p), ast_sockaddr_stringify_remote(&p->ourip), - (int) p->branch, rport); + (unsigned)p->branch, rport); } /*! \brief NAT fix - decide which IP address to use for Asterisk server? @@ -4343,7 +4343,7 @@ static enum sip_result __sip_reliable_xmit(struct sip_pvt *p, uint32_t seqno, in struct sip_pkt *pkt = NULL; int siptimer_a = DEFAULT_RETRANS; int xmitres = 0; - int respid; + unsigned respid; if (sipmethod == SIP_INVITE) { /* Note this is a pending invite */ @@ -5063,7 +5063,7 @@ static int sip_sendhtml(struct ast_channel *chan, int subclass, const char *data ast_string_field_build(p, url, "<%s>;mode=active", data); if (sip_debug_test_pvt(p)) - ast_debug(1, "Send URL %s, state = %d!\n", data, ast_channel_state(chan)); + ast_debug(1, "Send URL %s, state = %u!\n", data, ast_channel_state(chan)); switch (ast_channel_state(chan)) { case AST_STATE_RING: @@ -5080,7 +5080,7 @@ static int sip_sendhtml(struct ast_channel *chan, int subclass, const char *data } break; default: - ast_log(LOG_WARNING, "Don't know how to send URI when state is %d!\n", ast_channel_state(chan)); + ast_log(LOG_WARNING, "Don't know how to send URI when state is %u!\n", ast_channel_state(chan)); } return 0; @@ -5855,7 +5855,7 @@ static void change_t38_state(struct sip_pvt *p, int state) return; p->t38.state = state; - ast_debug(2, "T38 state changed to %d on channel %s\n", p->t38.state, chan ? ast_channel_name(chan) : "<none>"); + ast_debug(2, "T38 state changed to %u on channel %s\n", p->t38.state, chan ? ast_channel_name(chan) : "<none>"); /* If no channel was provided we can't send off a control frame */ if (!chan) @@ -7508,7 +7508,7 @@ static int sip_write(struct ast_channel *ast, struct ast_frame *frame) } break; default: - ast_log(LOG_WARNING, "Can't send %d type frames with SIP write\n", frame->frametype); + ast_log(LOG_WARNING, "Can't send %u type frames with SIP write\n", frame->frametype); return 0; } @@ -8056,7 +8056,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit sip_pvt_unlock(i); /* Don't hold a sip pvt lock while we allocate a channel */ - tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, assignedids, requestor, i->amaflags, "SIP/%s-%08x", my_name, ast_atomic_fetchadd_int((int *)&chan_idx, +1)); + tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, assignedids, requestor, i->amaflags, "SIP/%s-%08x", my_name, (unsigned)ast_atomic_fetchadd_int((int *)&chan_idx, +1)); } if (!tmp) { ast_log(LOG_WARNING, "Unable to allocate AST channel structure for SIP channel\n"); @@ -8508,7 +8508,7 @@ static struct ast_frame *sip_rtp_read(struct ast_channel *ast, struct sip_pvt *p } ast_str_append(&out, 0, " -> "); for (i = 0; i < f->datalen; i++) { - ast_str_append(&out, 0, "%02X ", arr[i]); + ast_str_append(&out, 0, "%02X ", (unsigned)arr[i]); } ast_verb(0, "%s\n", ast_str_buffer(out)); ast_free(out); @@ -8632,7 +8632,7 @@ static char *generate_random_string(char *buf, size_t size) for (x=0; x<4; x++) val[x] = ast_random(); - snprintf(buf, size, "%08lx%08lx%08lx%08lx", val[0], val[1], val[2], val[3]); + snprintf(buf, size, "%08lx%08lx%08lx%08lx", (unsigned long)val[0], (unsigned long)val[1], (unsigned long)val[2], (unsigned long)val[3]); return buf; } @@ -8732,13 +8732,13 @@ static void build_callid_registry(struct sip_registry *reg, const struct ast_soc /*! \brief Build SIP From tag value for REGISTER */ static void build_localtag_registry(struct sip_registry *reg) { - ast_string_field_build(reg, localtag, "as%08lx", ast_random()); + ast_string_field_build(reg, localtag, "as%08lx", (unsigned long)ast_random()); } /*! \brief Make our SIP dialog tag */ static void make_our_tag(struct sip_pvt *pvt) { - ast_string_field_build(pvt, tag, "as%08lx", ast_random()); + ast_string_field_build(pvt, tag, "as%08lx", (unsigned long)ast_random()); } /*! \brief Allocate Session-Timers struct w/in dialog */ @@ -9038,7 +9038,7 @@ static enum match_req_res match_req_to_dialog(struct sip_pvt *sip_pvt_ptr, struc /* totag did not match what we had stored for them. */ char invite_branch[32] = { 0, }; if (sip_pvt_ptr->invite_branch) { - snprintf(invite_branch, sizeof(invite_branch), "z9hG4bK%08x", (int) sip_pvt_ptr->invite_branch); + snprintf(invite_branch, sizeof(invite_branch), "z9hG4bK%08x", (unsigned)sip_pvt_ptr->invite_branch); } /* Forked Request Detection * @@ -10046,7 +10046,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action int newnoncodeccapability; const char *codecs; - int codec; + unsigned int codec; /* SRTP */ int secure_audio = FALSE; @@ -10054,7 +10054,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action /* Others */ int sendonly = -1; - int numberofports; + unsigned int numberofports; int last_rtpmap_codec = 0; int red_data_pt[10]; /* For T.140 RED */ int red_num_gen = 0; /* For T.140 RED */ @@ -10170,7 +10170,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action int text = FALSE; int processed_crypto = FALSE; char protocol[18] = {0,}; - int x; + unsigned int x; struct ast_rtp_engine_dtls *dtls; numberofports = 0; @@ -10215,7 +10215,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action /* Check number of ports offered for stream */ if (numberofports > 1) { - ast_log(LOG_WARNING, "%d ports offered for audio media, not supported by Asterisk. Will try anyway...\n", numberofports); + ast_log(LOG_WARNING, "%u ports offered for audio media, not supported by Asterisk. Will try anyway...\n", numberofports); } if ((!strcmp(protocol, "RTP/SAVPF") || !strcmp(protocol, "UDP/TLS/RTP/SAVPF")) && !ast_test_flag(&p->flags[2], SIP_PAGE3_USE_AVPF)) { @@ -10287,7 +10287,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action goto process_sdp_cleanup; } if (debug) { - ast_verbose("Found RTP audio format %d\n", codec); + ast_verbose("Found RTP audio format %u\n", codec); } ast_rtp_codecs_payloads_set_m_type(&newaudiortp, NULL, codec); @@ -10320,7 +10320,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action /* Check number of ports offered for stream */ if (numberofports > 1) { - ast_log(LOG_WARNING, "%d ports offered for video stream, not supported by Asterisk. Will try anyway...\n", numberofports); + ast_log(LOG_WARNING, "%u ports offered for video stream, not supported by Asterisk. Will try anyway...\n", numberofports); } if (has_media_stream(p, SDP_VIDEO)) { @@ -10367,7 +10367,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action goto process_sdp_cleanup; } if (debug) { - ast_verbose("Found RTP video format %d\n", codec); + ast_verbose("Found RTP video format %u\n", codec); } ast_rtp_codecs_payloads_set_m_type(&newvideortp, NULL, codec); } @@ -10399,7 +10399,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action /* Check number of ports offered for stream */ if (numberofports > 1) { - ast_log(LOG_WARNING, "%d ports offered for text stream, not supported by Asterisk. Will try anyway...\n", numberofports); + ast_log(LOG_WARNING, "%u ports offered for text stream, not supported by Asterisk. Will try anyway...\n", numberofports); } if (!strcmp(protocol, "RTP/AVPF") && !ast_test_flag(&p->flags[2], SIP_PAGE3_USE_AVPF)) { @@ -10431,7 +10431,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action goto process_sdp_cleanup; } if (debug) { - ast_verbose("Found RTP text format %d\n", codec); + ast_verbose("Found RTP text format %u\n", codec); } ast_rtp_codecs_payloads_set_m_type(&newtextrtp, NULL, codec); } @@ -11065,7 +11065,7 @@ static int process_sdp_a_ice(const char *a, struct sip_pvt *p, struct ast_rtp_in int found = FALSE; char ufrag[256], pwd[256], foundation[32], transport[4], address[46], cand_type[6], relay_address[46] = ""; struct ast_rtp_engine_ice_candidate candidate = { 0, }; - int port, relay_port = 0; + unsigned int port, relay_port = 0; if (!instance || !(ice = ast_rtp_instance_get_ice(instance))) { return found; @@ -11077,7 +11077,7 @@ static int process_sdp_a_ice(const char *a, struct sip_pvt *p, struct ast_rtp_in } else if (sscanf(a, "ice-pwd: %255s", pwd) == 1) { ice->set_authentication(instance, NULL, pwd); found = TRUE; - } else if (sscanf(a, "candidate: %31s %30u %3s %30u %23s %30u typ %5s %*s %23s %*s %30u", foundation, &candidate.id, transport, &candidate.priority, + } else if (sscanf(a, "candidate: %31s %30u %3s %30u %23s %30u typ %5s %*s %23s %*s %30u", foundation, &candidate.id, transport, (unsigned *)&candidate.priority, address, &port, cand_type, relay_address, &relay_port) >= 7) { candidate.foundation = foundation; candidate.transport = transport; @@ -11167,7 +11167,7 @@ static int process_sdp_a_dtls(const char *a, struct sip_pvt *p, struct ast_rtp_i static int process_sdp_a_audio(const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newaudiortp, int *last_rtpmap_codec) { int found = FALSE; - int codec; + unsigned int codec; char mimeSubtype[128]; char fmtp_string[256]; unsigned int sample_rate; @@ -11203,18 +11203,18 @@ static int process_sdp_a_audio(const char *a, struct sip_pvt *p, struct ast_rtp_ if (!(ast_rtp_codecs_payloads_set_rtpmap_type_rate(newaudiortp, NULL, codec, "audio", mimeSubtype, ast_test_flag(&p->flags[0], SIP_G726_NONSTANDARD) ? AST_RTP_OPT_G726_NONSTANDARD : 0, sample_rate))) { if (debug) - ast_verbose("Found audio description format %s for ID %d\n", mimeSubtype, codec); + ast_verbose("Found audio description format %s for ID %u\n", mimeSubtype, codec); //found_rtpmap_codecs[last_rtpmap_codec] = codec; (*last_rtpmap_codec)++; found = TRUE; } else { ast_rtp_codecs_payloads_unset(newaudiortp, NULL, codec); if (debug) - ast_verbose("Found unknown media description format %s for ID %d\n", mimeSubtype, codec); + ast_verbose("Found unknown media description format %s for ID %u\n", mimeSubtype, codec); } } else { if (debug) - ast_verbose("Discarded description format %s for ID %d\n", mimeSubtype, codec); + ast_verbose("Discarded description format %s for ID %u\n", mimeSubtype, codec); } } else if (sscanf(a, "fmtp: %30u %255[^\t\n]", &codec, fmtp_string) == 2) { struct ast_format *format; @@ -11232,7 +11232,7 @@ static int process_sdp_a_audio(const char *a, struct sip_pvt *p, struct ast_rtp_ case AST_FORMAT_SIREN7: if (sscanf(fmtp_string, "bitrate=%30u", &bit_rate) == 1) { if (bit_rate != 32000) { - ast_log(LOG_WARNING, "Got Siren7 offer at %d bps, but only 32000 bps supported; ignoring.\n", bit_rate); + ast_log(LOG_WARNING, "Got Siren7 offer at %u bps, but only 32000 bps supported; ignoring.\n", bit_rate); ast_rtp_codecs_payloads_unset(newaudiortp, NULL, codec); } else { found = TRUE; @@ -11242,7 +11242,7 @@ static int process_sdp_a_audio(const char *a, struct sip_pvt *p, struct ast_rtp_ case AST_FORMAT_SIREN14: if (sscanf(fmtp_string, "bitrate=%30u", &bit_rate) == 1) { if (bit_rate != 48000) { - ast_log(LOG_WARNING, "Got Siren14 offer at %d bps, but only 48000 bps supported; ignoring.\n", bit_rate); + ast_log(LOG_WARNING, "Got Siren14 offer at %u bps, but only 48000 bps supported; ignoring.\n", bit_rate); ast_rtp_codecs_payloads_unset(newaudiortp, NULL, codec); } else { found = TRUE; @@ -11252,7 +11252,7 @@ static int process_sdp_a_audio(const char *a, struct sip_pvt *p, struct ast_rtp_ case AST_FORMAT_G719: if (sscanf(fmtp_string, "bitrate=%30u", &bit_rate) == 1) { if (bit_rate != 64000) { - ast_log(LOG_WARNING, "Got G.719 offer at %d bps, but only 64000 bps supported; ignoring.\n", bit_rate); + ast_log(LOG_WARNING, "Got G.719 offer at %u bps, but only 64000 bps supported; ignoring.\n", bit_rate); ast_rtp_codecs_payloads_unset(newaudiortp, NULL, codec); } else { found = TRUE; @@ -11269,7 +11269,7 @@ static int process_sdp_a_audio(const char *a, struct sip_pvt *p, struct ast_rtp_ static int process_sdp_a_video(const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newvideortp, int *last_rtpmap_codec) { int found = FALSE; - int codec; + unsigned int codec; char mimeSubtype[128]; unsigned int sample_rate; int debug = sip_debug_test_pvt(p); @@ -11283,19 +11283,19 @@ static int process_sdp_a_video(const char *a, struct sip_pvt *p, struct ast_rtp_ || !strncasecmp(mimeSubtype, "VP8", 3)) { if (!(ast_rtp_codecs_payloads_set_rtpmap_type_rate(newvideortp, NULL, codec, "video", mimeSubtype, 0, sample_rate))) { if (debug) - ast_verbose("Found video description format %s for ID %d\n", mimeSubtype, codec); + ast_verbose("Found video description format %s for ID %u\n", mimeSubtype, codec); //found_rtpmap_codecs[last_rtpmap_codec] = codec; (*last_rtpmap_codec)++; found = TRUE; } else { ast_rtp_codecs_payloads_unset(newvideortp, NULL, codec); if (debug) - ast_verbose("Found unknown media description format %s for ID %d\n", mimeSubtype, codec); + ast_verbose("Found unknown media description format %s for ID %u\n", mimeSubtype, codec); } } } else { if (debug) - ast_verbose("Discarded description format %s for ID %d\n", mimeSubtype, codec); + ast_verbose("Discarded description format %s for ID %u\n", mimeSubtype, codec); } } else if (sscanf(a, "fmtp: %30u %255s", &codec, fmtp_string) == 2) { struct ast_format *format; @@ -11315,7 +11315,7 @@ static int process_sdp_a_video(const char *a, struct sip_pvt *p, struct ast_rtp_ static int process_sdp_a_text(const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newtextrtp, char *red_fmtp, int *red_num_gen, int *red_data_pt, int *last_rtpmap_codec) { int found = FALSE; - int codec; + unsigned int codec; char mimeSubtype[128]; unsigned int sample_rate; char *red_cp; @@ -11333,25 +11333,25 @@ static int process_sdp_a_text(const char *a, struct sip_pvt *p, struct ast_rtp_c } else if (!strncasecmp(mimeSubtype, "RED", 3)) { /* Text with Redudancy */ if (p->trtp) { ast_rtp_codecs_payloads_set_rtpmap_type_rate(newtextrtp, NULL, codec, "text", mimeSubtype, 0, sample_rate); - sprintf(red_fmtp, "fmtp:%d ", codec); + sprintf(red_fmtp, "fmtp:%u ", codec); if (debug) - ast_verbose("RED submimetype has payload type: %d\n", codec); + ast_verbose("RED submimetype has payload type: %u\n", codec); found = TRUE; } } } else { if (debug) - ast_verbose("Discarded description format %s for ID %d\n", mimeSubtype, codec); + ast_verbose("Discarded description format %s for ID %u\n", mimeSubtype, codec); } } else if (!strncmp(a, red_fmtp, strlen(red_fmtp))) { /* count numbers of generations in fmtp */ red_cp = &red_fmtp[strlen(red_fmtp)]; strncpy(red_fmtp, a, 100); - sscanf(red_cp, "%30u", &red_data_pt[*red_num_gen]); + sscanf(red_cp, "%30u", (unsigned *)&red_data_pt[*red_num_gen]); red_cp = strtok(red_cp, "/"); while (red_cp && (*red_num_gen)++ < AST_RED_MAX_GENERATION) { - sscanf(red_cp, "%30u", &red_data_pt[*red_num_gen]); + sscanf(red_cp, "%30u", (unsigned *)&red_data_pt[*red_num_gen]); red_cp = strtok(NULL, "/"); } red_cp = red_fmtp; @@ -11383,10 +11383,10 @@ static int process_sdp_a_image(const char *a, struct sip_pvt *p) } if ((sscanf(attrib, "t38faxmaxbuffer:%30u", &x) == 1)) { - ast_debug(3, "MaxBufferSize:%d\n", x); + ast_debug(3, "MaxBufferSize:%u\n", x); found = TRUE; } else if ((sscanf(attrib, "t38maxbitrate:%30u", &x) == 1) || (sscanf(attrib, "t38faxmaxrate:%30u", &x) == 1)) { - ast_debug(3, "T38MaxBitRate: %d\n", x); + ast_debug(3, "T38MaxBitRate: %u\n", x); switch (x) { case 14400: p->t38.their_parms.rate = AST_T38_RATE_14400; @@ -11415,7 +11415,7 @@ static int process_sdp_a_image(const char *a, struct sip_pvt *p) } else if ((sscanf(attrib, "t38faxmaxdatagram:%30u", &x) == 1) || (sscanf(attrib, "t38maxdatagram:%30u", &x) == 1)) { /* override the supplied value if the configuration requests it */ if (((signed int) p->t38_maxdatagram >= 0) && ((unsigned int) p->t38_maxdatagram > x)) { - ast_debug(1, "Overriding T38FaxMaxDatagram '%d' with '%d'\n", x, p->t38_maxdatagram); + ast_debug(1, "Overriding T38FaxMaxDatagram '%u' with '%d'\n", x, p->t38_maxdatagram); x = p->t38_maxdatagram; } ast_debug(3, "FaxMaxDatagram: %u\n", x); @@ -11423,7 +11423,7 @@ static int process_sdp_a_image(const char *a, struct sip_pvt *p) found = TRUE; } else if ((strncmp(attrib, "t38faxfillbitremoval", sizeof("t38faxfillbitremoval") - 1) == 0)) { if (sscanf(attrib, "t38faxfillbitremoval:%30u", &x) == 1) { - ast_debug(3, "FillBitRemoval: %d\n", x); + ast_debug(3, "FillBitRemoval: %u\n", x); if (x == 1) { p->t38.their_parms.fill_bit_removal = TRUE; } @@ -11434,7 +11434,7 @@ static int process_sdp_a_image(const char *a, struct sip_pvt *p) found = TRUE; } else if ((strncmp(attrib, "t38faxtranscodingmmr", sizeof("t38faxtranscodingmmr") - 1) == 0)) { if (sscanf(attrib, "t38faxtranscodingmmr:%30u", &x) == 1) { - ast_debug(3, "Transcoding MMR: %d\n", x); + ast_debug(3, "Transcoding MMR: %u\n", x); if (x == 1) { p->t38.their_parms.transcoding_mmr = TRUE; } @@ -11445,7 +11445,7 @@ static int process_sdp_a_image(const char *a, struct sip_pvt *p) found = TRUE; } else if ((strncmp(attrib, "t38faxtranscodingjbig", sizeof("t38faxtranscodingjbig") - 1) == 0)) { if (sscanf(attrib, "t38faxtranscodingjbig:%30u", &x) == 1) { - ast_debug(3, "Transcoding JBIG: %d\n", x); + ast_debug(3, "Transcoding JBIG: %u\n", x); if (x == 1) { p->t38.their_parms.transcoding_jbig = TRUE; } @@ -11540,7 +11540,7 @@ static int finalize_content(struct sip_request *req) return -1; } - snprintf(clen, sizeof(clen), "%zd", ast_str_strlen(req->content)); + snprintf(clen, sizeof(clen), "%zu", ast_str_strlen(req->content)); add_header(req, "Content-Length", clen); if (ast_str_strlen(req->content)) { @@ -12768,7 +12768,7 @@ static void add_ice_to_sdp(struct ast_rtp_instance *instance, struct ast_str **a i = ao2_iterator_init(candidates, 0); while ((candidate = ao2_iterator_next(&i))) { - ast_str_append(a_buf, 0, "a=candidate:%s %d %s %d ", candidate->foundation, candidate->id, candidate->transport, candidate->priority); + ast_str_append(a_buf, 0, "a=candidate:%s %u %s %d ", candidate->foundation, candidate->id, candidate->transport, candidate->priority); ast_str_append(a_buf, 0, "%s ", ast_sockaddr_stringify_host(&candidate->address)); if (candidate->type == AST_RTP_ICE_CANDIDATE_TYPE_SRFLX @@ -12870,7 +12870,7 @@ static void add_codec_to_sdp(const struct sip_pvt *p, unsigned int rate; if (debug) - ast_verbose("Adding codec %d (%s) to SDP\n", format->id, ast_getformatname(format)); + ast_verbose("Adding codec %u (%s) to SDP\n", format->id, ast_getformatname(format)); if (((rtp_code = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(p->rtp), 1, format, 0)) == -1) || !(mime = ast_rtp_lookup_mime_subtype2(1, format, 0, ast_test_flag(&p->flags[0], SIP_G726_NONSTANDARD) ? AST_RTP_OPT_G726_NONSTANDARD : 0)) || @@ -12886,9 +12886,9 @@ static void add_codec_to_sdp(const struct sip_pvt *p, ast_str_append(m_buf, 0, " %d", rtp_code); /* Opus mandates 2 channels in rtpmap */ if ((int)format->id == AST_FORMAT_OPUS) { - ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%d/2\r\n", rtp_code, mime, rate); + ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%u/2\r\n", rtp_code, mime, rate); } else { - ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%d\r\n", rtp_code, mime, rate); + ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%u\r\n", rtp_code, mime, rate); } ast_format_sdp_generate(format, rtp_code, a_buf); @@ -12952,7 +12952,7 @@ static void add_vcodec_to_sdp(const struct sip_pvt *p, struct ast_format *format return; if (debug) - ast_verbose("Adding video codec %d (%s) to SDP\n", format->id, ast_getformatname(format)); + ast_verbose("Adding video codec %u (%s) to SDP\n", format->id, ast_getformatname(format)); if (((rtp_code = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(p->vrtp), 1, format, 0)) == -1) || !(subtype = ast_rtp_lookup_mime_subtype2(1, format, 0, 0)) || @@ -12961,7 +12961,7 @@ static void add_vcodec_to_sdp(const struct sip_pvt *p, struct ast_format *format } ast_str_append(m_buf, 0, " %d", rtp_code); - ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%d\r\n", rtp_code, subtype, rate); + ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%u\r\n", rtp_code, subtype, rate); /* VP8: add RTCP FIR support */ if ((int)format->id == AST_FORMAT_VP8) { ast_str_append(a_buf, 0, "a=rtcp-fb:* ccm fir\r\n"); @@ -12981,13 +12981,13 @@ static void add_tcodec_to_sdp(const struct sip_pvt *p, struct ast_format *format return; if (debug) - ast_verbose("Adding text codec %d (%s) to SDP\n", format->id, ast_getformatname(format)); + ast_verbose("Adding text codec %u (%s) to SDP\n", format->id, ast_getformatname(format)); if ((rtp_code = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(p->trtp), 1, format, 0)) == -1) return; ast_str_append(m_buf, 0, " %d", rtp_code); - ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%d\r\n", rtp_code, + ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%u\r\n", rtp_code, ast_rtp_lookup_mime_subtype2(1, format, 0, 0), ast_rtp_lookup_sample_rate2(1, format, 0)); /* Add fmtp code here */ @@ -13033,12 +13033,12 @@ static void add_noncodec_to_sdp(const struct sip_pvt *p, int format, int rtp_code; if (debug) - ast_verbose("Adding non-codec 0x%x (%s) to SDP\n", format, ast_rtp_lookup_mime_subtype2(0, NULL, format, 0)); + ast_verbose("Adding non-codec 0x%x (%s) to SDP\n", (unsigned)format, ast_rtp_lookup_mime_subtype2(0, NULL, format, 0)); if ((rtp_code = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(p->rtp), 0, NULL, format)) == -1) return; ast_str_append(m_buf, 0, " %d", rtp_code); - ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%d\r\n", rtp_code, + ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%u\r\n", rtp_code, ast_rtp_lookup_mime_subtype2(0, NULL, format, 0), ast_rtp_lookup_sample_rate2(0, NULL, format)); if (format == AST_RTP_DTMF) /* Indicate we support DTMF and FLASH... */ @@ -13503,8 +13503,8 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int "IP6" : "IP4", ast_sockaddr_stringify_addr_remote(&udptldest)); } - ast_str_append(&a_modem, 0, "a=T38FaxVersion:%d\r\n", p->t38.our_parms.version); - ast_str_append(&a_modem, 0, "a=T38MaxBitRate:%d\r\n", t38_get_rate(p->t38.our_parms.rate)); + ast_str_append(&a_modem, 0, "a=T38FaxVersion:%u\r\n", p->t38.our_parms.version); + ast_str_append(&a_modem, 0, "a=T38MaxBitRate:%u\r\n", t38_get_rate(p->t38.our_parms.rate)); if (p->t38.our_parms.fill_bit_removal) { ast_str_append(&a_modem, 0, "a=T38FaxFillBitRemoval\r\n"); } @@ -14355,7 +14355,7 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init, if (sdp) { offered_media_list_destroy(p); if (p->udptl && p->t38.state == T38_LOCAL_REINVITE) { - ast_debug(1, "T38 is in state %d on channel %s\n", p->t38.state, p->owner ? ast_channel_name(p->owner) : "<none>"); + ast_debug(1, "T38 is in state %u on channel %s\n", p->t38.state, p->owner ? ast_channel_name(p->owner) : "<none>"); add_sdp(&req, p, FALSE, FALSE, TRUE); } else if (p->rtp) { try_suggested_sip_codec(p); @@ -14861,7 +14861,7 @@ static int transmit_cc_notify(struct ast_cc_agent *agent, struct sip_pvt *subscr char subscription_state_hdr[64]; if (state < CC_QUEUED || state > CC_READY) { - ast_log(LOG_WARNING, "Invalid state provided for transmit_cc_notify (%d)\n", state); + ast_log(LOG_WARNING, "Invalid state provided for transmit_cc_notify (%u)\n", state); return -1; } @@ -15808,7 +15808,7 @@ void sip_auth_headers(enum sip_auth_type code, char **header, char **respheader) *header = "Proxy-Authenticate"; *respheader = "Proxy-Authorization"; } else { - ast_verbose("-- wrong response code %d\n", code); + ast_verbose("-- wrong response code %u\n", code); *header = *respheader = "Invalid"; } } @@ -16498,7 +16498,7 @@ static int build_path(struct sip_pvt *p, struct sip_peer *peer, struct sip_reque static void build_nonce(struct sip_pvt *p, int forceupdate) { if (p->stalenonce || forceupdate || ast_strlen_zero(p->nonce)) { - ast_string_field_build(p, nonce, "%08lx", ast_random()); /* Create nonce for challenge */ + ast_string_field_build(p, nonce, "%08lx", (unsigned long)ast_random()); /* Create nonce for challenge */ p->stalenonce = 0; } } @@ -20334,7 +20334,7 @@ static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct ast_cli(fd, " DirectMedACL : %s\n", AST_CLI_YESNO(ast_acl_list_is_empty(peer->directmediaacl) == 0)); ast_cli(fd, " T.38 support : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[1], SIP_PAGE2_T38SUPPORT))); ast_cli(fd, " T.38 EC mode : %s\n", faxec2str(ast_test_flag(&peer->flags[1], SIP_PAGE2_T38SUPPORT))); - ast_cli(fd, " T.38 MaxDtgrm: %d\n", peer->t38_maxdatagram); + ast_cli(fd, " T.38 MaxDtgrm: %u\n", peer->t38_maxdatagram); ast_cli(fd, " DirectMedia : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[0], SIP_DIRECT_MEDIA))); ast_cli(fd, " PromiscRedir : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[0], SIP_PROMISCREDIR))); ast_cli(fd, " User=Phone : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[0], SIP_USEREQPHONE))); @@ -20473,7 +20473,7 @@ static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct astman_append(s, "SIP-TextSupport: %s\r\n", (ast_test_flag(&peer->flags[1], SIP_PAGE2_TEXTSUPPORT)?"Y":"N")); astman_append(s, "SIP-T.38Support: %s\r\n", (ast_test_flag(&peer->flags[1], SIP_PAGE2_T38SUPPORT)?"Y":"N")); astman_append(s, "SIP-T.38EC: %s\r\n", faxec2str(ast_test_flag(&peer->flags[1], SIP_PAGE2_T38SUPPORT))); - astman_append(s, "SIP-T.38MaxDtgrm: %d\r\n", peer->t38_maxdatagram); + astman_append(s, "SIP-T.38MaxDtgrm: %u\r\n", peer->t38_maxdatagram); astman_append(s, "SIP-Sess-Timers: %s\r\n", stmode2str(peer->stimer.st_mode_oper)); astman_append(s, "SIP-Sess-Refresh: %s\r\n", strefresherparam2str(peer->stimer.st_ref)); astman_append(s, "SIP-Sess-Expires: %d\r\n", peer->stimer.st_max_se); @@ -20978,7 +20978,7 @@ static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_ ast_cli(a->fd, " T.38 support: %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_T38SUPPORT))); ast_cli(a->fd, " T.38 EC mode: %s\n", faxec2str(ast_test_flag(&global_flags[1], SIP_PAGE2_T38SUPPORT))); - ast_cli(a->fd, " T.38 MaxDtgrm: %d\n", global_t38_maxdatagram); + ast_cli(a->fd, " T.38 MaxDtgrm: %u\n", global_t38_maxdatagram); if (!realtimepeers && !realtimeregs) ast_cli(a->fd, " SIP realtime: Disabled\n" ); else @@ -20992,10 +20992,10 @@ static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_ ast_cli(a->fd, " IP ToS RTP audio: %s\n", ast_tos2str(global_tos_audio)); ast_cli(a->fd, " IP ToS RTP video: %s\n", ast_tos2str(global_tos_video)); ast_cli(a->fd, " IP ToS RTP text: %s\n", ast_tos2str(global_tos_text)); - ast_cli(a->fd, " 802.1p CoS SIP: %d\n", global_cos_sip); - ast_cli(a->fd, " 802.1p CoS RTP audio: %d\n", global_cos_audio); - ast_cli(a->fd, " 802.1p CoS RTP video: %d\n", global_cos_video); - ast_cli(a->fd, " 802.1p CoS RTP text: %d\n", global_cos_text); + ast_cli(a->fd, " 802.1p CoS SIP: %u\n", global_cos_sip); + ast_cli(a->fd, " 802.1p CoS RTP audio: %u\n", global_cos_audio); + ast_cli(a->fd, " 802.1p CoS RTP video: %u\n", global_cos_video); + ast_cli(a->fd, " 802.1p CoS RTP text: %u\n", global_cos_text); ast_cli(a->fd, " Jitterbuffer enabled: %s\n", AST_CLI_YESNO(ast_test_flag(&global_jbconf, AST_JB_ENABLED))); if (ast_test_flag(&global_jbconf, AST_JB_ENABLED)) { ast_cli(a->fd, " Jitterbuffer forced: %s\n", AST_CLI_YESNO(ast_test_flag(&global_jbconf, AST_JB_FORCED))); @@ -22166,7 +22166,7 @@ static int build_reply_digest(struct sip_pvt *p, int method, char* digest, int d else snprintf(uri, sizeof(uri), "%s:%s@%s", p->socket.type == AST_TRANSPORT_TLS ? "sips" : "sip", p->username, ast_sockaddr_stringify_host_remote(&p->sa)); - snprintf(cnonce, sizeof(cnonce), "%08lx", ast_random()); + snprintf(cnonce, sizeof(cnonce), "%08lx", (unsigned long)ast_random()); /* Check if we have peer credentials */ ao2_lock(p); @@ -22224,7 +22224,7 @@ static int build_reply_digest(struct sip_pvt *p, int method, char* digest, int d p->noncecount++; if (!ast_strlen_zero(p->qop)) - snprintf(resp, sizeof(resp), "%s:%s:%08x:%s:%s:%s", a1_hash, p->nonce, p->noncecount, cnonce, "auth", a2_hash); + snprintf(resp, sizeof(resp), "%s:%s:%08x:%s:%s:%s", a1_hash, p->nonce, (unsigned)p->noncecount, cnonce, "auth", a2_hash); else snprintf(resp, sizeof(resp), "%s:%s:%s", a1_hash, p->nonce, a2_hash); ast_md5_hash(resp_hash, resp); @@ -22236,7 +22236,7 @@ static int build_reply_digest(struct sip_pvt *p, int method, char* digest, int d /* XXX We hard code our qop to "auth" for now. XXX */ if (!ast_strlen_zero(p->qop)) - snprintf(digest, digest_len, "Digest username=\"%s\", realm=\"%s\", algorithm=MD5, uri=\"%s\", nonce=\"%s\", response=\"%s\"%s, qop=auth, cnonce=\"%s\", nc=%08x", username, p->realm, uri, p->nonce, resp_hash, opaque, cnonce, p->noncecount); + snprintf(digest, digest_len, "Digest username=\"%s\", realm=\"%s\", algorithm=MD5, uri=\"%s\", nonce=\"%s\", response=\"%s\"%s, qop=auth, cnonce=\"%s\", nc=%08x", username, p->realm, uri, p->nonce, resp_hash, opaque, cnonce, (unsigned)p->noncecount); else snprintf(digest, digest_len, "Digest username=\"%s\", realm=\"%s\", algorithm=MD5, uri=\"%s\", nonce=\"%s\", response=\"%s\"%s", username, p->realm, uri, p->nonce, resp_hash, opaque); @@ -22405,7 +22405,7 @@ static int function_sippeer(struct ast_channel *chan, const char *cmd, char *dat } else if (!strcasecmp(colname, "codecs")) { ast_getformatname_multiple(buf, len -1, peer->caps); } else if (!strcasecmp(colname, "encryption")) { - snprintf(buf, len, "%d", ast_test_flag(&peer->flags[1], SIP_PAGE2_USE_SRTP)); + snprintf(buf, len, "%u", ast_test_flag(&peer->flags[1], SIP_PAGE2_USE_SRTP)); } else if (!strncasecmp(colname, "chanvar[", 8)) { char *chanvar=colname + 8; struct ast_variable *v; @@ -25130,7 +25130,7 @@ static int handle_request_invite_st(struct sip_pvt *p, struct sip_request *req, break; default: - ast_log(LOG_ERROR, "Internal Error %d at %s:%d\n", st_get_mode(p, 1), __FILE__, __LINE__); + ast_log(LOG_ERROR, "Internal Error %u at %s:%d\n", st_get_mode(p, 1), __FILE__, __LINE__); break; } } else { @@ -25884,7 +25884,7 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, str p->invitestate = INV_TERMINATED; break; default: - ast_log(LOG_WARNING, "Don't know how to handle INVITE in state %d\n", ast_channel_state(c)); + ast_log(LOG_WARNING, "Don't know how to handle INVITE in state %u\n", ast_channel_state(c)); transmit_response(p, "100 Trying", req); break; } @@ -27998,7 +27998,7 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct as (could be new request in existing SIP dialog as well...) */ p->method = req->method; /* Find out which SIP method they are using */ - ast_debug(4, "**** Received %s (%d) - Command in SIP %s\n", sip_methods[p->method].text, sip_methods[p->method].id, cmd); + ast_debug(4, "**** Received %s (%u) - Command in SIP %s\n", sip_methods[p->method].text, sip_methods[p->method].id, cmd); if (p->icseq && (p->icseq > seqno) ) { if (p->pendinginvite && seqno == p->pendinginvite && (req->method == SIP_ACK || req->method == SIP_CANCEL)) { @@ -29833,7 +29833,7 @@ static void set_insecure_flags (struct ast_flags *flags, const char *value, int \returns non-zero if any config options were handled, zero otherwise */ static int handle_t38_options(struct ast_flags *flags, struct ast_flags *mask, struct ast_variable *v, - int *maxdatagram) + unsigned int *maxdatagram) { int res = 1; |